1Title: Context and IRQ APIs 2 3Description: 4 5This test verifies that the kernel CPU and context APIs operate as expected. 6 7 8APIs tested in this test set 9============================ 10 11k_thread_create 12 - start a helper thread to help with k_yield() tests 13 - start a thread to test thread related functionality 14 15k_yield 16 - Called by a higher priority thread when there is another thread 17 - Called by an equal priority thread when there is another thread 18 - Called by a lower priority thread when there is another thread 19 20k_current_get 21 - Called from an ISR (interrupted a task) 22 - Called from an ISR (interrupted a thread) 23 - Called from a task 24 - Called from a thread 25 26k_is_in_isr 27 - Called from an ISR that interrupted a task 28 - Called from an ISR that interrupted a thread 29 - Called from a task 30 - Called from a thread 31 32k_cpu_idle 33 - Tickless Kernel: CPU to be woken up by a kernel timer (k_timer) 34 - Non-tickless kernel: 35 CPU to be woken up by tick timer. Thus, after each call, the tick count 36 should have advanced by one tick. 37 38irq_lock 39 - 1. Count the number of calls to _tick_get_32() before a tick expires. 40 - 2. Once determined, call _tick_get_32() many more times than that 41 with interrupts locked. Check that the tick count remains unchanged. 42 43irq_unlock 44 - Continuation irq_lock: unlock interrupts, loop and verify the tick 45 count changes. 46 47irq_offload 48 - Used when triggering an ISR to perform ISR context work. 49 50irq_enable 51irq_disable 52 - Use these routines to disable and enable timer interrupts so that they can 53 be tested in the same way as irq_lock() and irq_unlock(). 54 55--------------------------------------------------------------------------- 56 57Building and Running Project: 58 59This project outputs to the console. It can be built and executed 60on QEMU as follows: 61 62 make run 63 64--------------------------------------------------------------------------- 65 66Troubleshooting: 67 68Problems caused by out-dated project information can be addressed by 69issuing one of the following commands then rebuilding the project: 70 71 make clean # discard results of previous builds 72 # but keep existing configuration info 73or 74 make pristine # discard results of previous builds 75 # and restore pre-defined configuration info 76 77--------------------------------------------------------------------------- 78 79Sample Output: 80 81tc_start() - Test kernel CPU and thread routines 82Initializing kernel objects 83Testing k_cpu_idle() 84Testing interrupt locking and unlocking 85Testing irq_disable() and irq_enable() 86Testing some kernel context routines 87Testing k_current_get() from an ISR and task 88Testing k_is_in_isr() from an ISR 89Testing k_is_in_isr() from a preemtible thread 90Spawning a thread from a task 91Thread to test k_current_get() and k_is_in_isr() 92Thread to test k_yield() 93Testing k_busy_wait() 94Thread busy waiting for 20000 usecs 95Thread busy waiting completed 96Testing k_sleep() 97 thread sleeping for 50 milliseconds 98 thread back from sleep 99Testing k_thread_create() without cancellation 100 thread (q order: 2, t/o: 500) is running 101 got thread (q order: 2, t/o: 500) as expected 102 thread (q order: 3, t/o: 750) is running 103 got thread (q order: 3, t/o: 750) as expected 104 thread (q order: 0, t/o: 1000) is running 105 got thread (q order: 0, t/o: 1000) as expected 106 thread (q order: 6, t/o: 1250) is running 107 got thread (q order: 6, t/o: 1250) as expected 108 thread (q order: 1, t/o: 1500) is running 109 got thread (q order: 1, t/o: 1500) as expected 110 thread (q order: 4, t/o: 1750) is running 111 got thread (q order: 4, t/o: 1750) as expected 112 thread (q order: 5, t/o: 2000) is running 113 got thread (q order: 5, t/o: 2000) as expected 114Testing k_thread_create() with cancellations 115 cancelling [q order: 0, t/o: 1000, t/o order: 0] 116 thread (q order: 3, t/o: 750) is running 117 got (q order: 3, t/o: 750, t/o order 1) as expected 118 thread (q order: 0, t/o: 1000) is running 119 got (q order: 0, t/o: 1000, t/o order 2) as expected 120 cancelling [q order: 3, t/o: 750, t/o order: 3] 121 cancelling [q order: 4, t/o: 1750, t/o order: 4] 122 thread (q order: 4, t/o: 1750) is running 123 got (q order: 4, t/o: 1750, t/o order 5) as expected 124 cancelling [q order: 6, t/o: 1250, t/o order: 6] 125PASS - main. 126=================================================================== 127PROJECT EXECUTION SUCCESSFUL 128