summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2016-01-29 10:57:12 -0500
committerAnas Nashif <nashif@linux.intel.com>2016-02-11 18:06:33 +0000
commit13b3727e6e910bf550f3ea8aaf3ca6e667b8cfa2 (patch)
tree2acfef96da42d5d07e839656d7f9d6d9ff455c56 /samples
parent2e4de760be33b3293c6af8ae2b6e9cba7bcd3d76 (diff)
tests: move kernel tests to tests/
Move all kernel testcases to tests/ and change Makefiles accordingly where applicable. Change-Id: I130cc3919174e93b7130d55fb101bed1d5d7552d Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/microkernel/test/test_critical/Makefile6
-rw-r--r--samples/microkernel/test/test_critical/README.txt51
-rw-r--r--samples/microkernel/test/test_critical/prj.mdef11
-rw-r--r--samples/microkernel/test/test_critical/prj_arm.conf2
-rw-r--r--samples/microkernel/test/test_critical/prj_x86.conf6
-rw-r--r--samples/microkernel/test/test_critical/src/Makefile3
-rw-r--r--samples/microkernel/test/test_critical/src/critical.c164
-rw-r--r--samples/microkernel/test/test_critical/testcase.ini3
-rw-r--r--samples/microkernel/test/test_events/Makefile7
-rw-r--r--samples/microkernel/test/test_events/README.txt45
-rw-r--r--samples/microkernel/test/test_events/prj.mdef15
-rw-r--r--samples/microkernel/test/test_events/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_events/prj_x86.conf5
-rw-r--r--samples/microkernel/test/test_events/src/Makefile3
-rw-r--r--samples/microkernel/test/test_events/src/events.c587
-rw-r--r--samples/microkernel/test/test_events/src/test_fiber.c80
-rw-r--r--samples/microkernel/test/test_events/testcase.ini3
-rw-r--r--samples/microkernel/test/test_fifo/Makefile6
-rw-r--r--samples/microkernel/test/test_fifo/README.txt86
-rw-r--r--samples/microkernel/test/test_fifo/prj.mdef15
-rw-r--r--samples/microkernel/test/test_fifo/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_fifo/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_fifo/src/Makefile3
-rw-r--r--samples/microkernel/test/test_fifo/src/fifo.c628
-rw-r--r--samples/microkernel/test/test_fifo/testcase.ini3
-rw-r--r--samples/microkernel/test/test_fifo_priv/Makefile9
-rw-r--r--samples/microkernel/test/test_fifo_priv/README.txt87
-rw-r--r--samples/microkernel/test/test_fifo_priv/prj.mdef21
-rw-r--r--samples/microkernel/test/test_fifo_priv/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_fifo_priv/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_fifo_priv/testcase.ini3
-rw-r--r--samples/microkernel/test/test_fp_sharing/Makefile6
-rw-r--r--samples/microkernel/test/test_fp_sharing/README.txt53
-rw-r--r--samples/microkernel/test/test_fp_sharing/prj.mdef8
-rw-r--r--samples/microkernel/test/test_fp_sharing/prj_x86.conf11
-rw-r--r--samples/microkernel/test/test_fp_sharing/src/Makefile4
-rw-r--r--samples/microkernel/test/test_fp_sharing/src/float_context.h99
-rw-r--r--samples/microkernel/test/test_fp_sharing/src/float_regs_x86_gcc.h210
-rw-r--r--samples/microkernel/test/test_fp_sharing/src/main.c391
-rw-r--r--samples/microkernel/test/test_fp_sharing/src/pi.c166
-rw-r--r--samples/microkernel/test/test_libs/Makefile6
-rw-r--r--samples/microkernel/test/test_libs/README.txt49
-rw-r--r--samples/microkernel/test/test_libs/prj.mdef11
-rw-r--r--samples/microkernel/test/test_libs/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_libs/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_libs/src/Makefile4
-rw-r--r--samples/microkernel/test/test_libs/src/libraries.c410
-rw-r--r--samples/microkernel/test/test_libs/src/main.c104
-rw-r--r--samples/microkernel/test/test_libs/testcase.ini3
-rw-r--r--samples/microkernel/test/test_mail/Makefile6
-rw-r--r--samples/microkernel/test/test_mail/README.txt61
-rw-r--r--samples/microkernel/test/test_mail/prj.mdef24
-rw-r--r--samples/microkernel/test/test_mail/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_mail/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_mail/src/Makefile3
-rw-r--r--samples/microkernel/test/test_mail/src/mail.c682
-rw-r--r--samples/microkernel/test/test_mail/src/main.c135
-rw-r--r--samples/microkernel/test/test_mail/testcase.ini3
-rw-r--r--samples/microkernel/test/test_mail_priv/Makefile10
-rw-r--r--samples/microkernel/test/test_mail_priv/README.txt62
-rw-r--r--samples/microkernel/test/test_mail_priv/prj.mdef30
-rw-r--r--samples/microkernel/test/test_mail_priv/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_mail_priv/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_mail_priv/testcase.ini3
-rw-r--r--samples/microkernel/test/test_map/Makefile6
-rw-r--r--samples/microkernel/test/test_map/README.txt80
-rw-r--r--samples/microkernel/test/test_map/prj.mdef15
-rw-r--r--samples/microkernel/test/test_map/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_map/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_map/src/Makefile3
-rw-r--r--samples/microkernel/test/test_map/src/map.c397
-rw-r--r--samples/microkernel/test/test_map/testcase.ini3
-rw-r--r--samples/microkernel/test/test_map_priv/Makefile10
-rw-r--r--samples/microkernel/test/test_map_priv/README.txt81
-rw-r--r--samples/microkernel/test/test_map_priv/prj.mdef21
-rw-r--r--samples/microkernel/test/test_map_priv/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_map_priv/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_map_priv/testcase.ini3
-rw-r--r--samples/microkernel/test/test_mutex/Makefile6
-rw-r--r--samples/microkernel/test/test_mutex/README.txt39
-rw-r--r--samples/microkernel/test/test_mutex/prj.mdef19
-rw-r--r--samples/microkernel/test/test_mutex/prj_arm.conf2
-rw-r--r--samples/microkernel/test/test_mutex/prj_x86.conf6
-rw-r--r--samples/microkernel/test/test_mutex/src/Makefile3
-rw-r--r--samples/microkernel/test/test_mutex/src/mutex.c385
-rw-r--r--samples/microkernel/test/test_mutex/src/task50.c63
-rw-r--r--samples/microkernel/test/test_mutex/testcase.ini3
-rw-r--r--samples/microkernel/test/test_pipe/Makefile6
-rw-r--r--samples/microkernel/test/test_pipe/README.txt42
-rw-r--r--samples/microkernel/test/test_pipe/prj.mdef19
-rw-r--r--samples/microkernel/test/test_pipe/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_pipe/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_pipe/src/Makefile3
-rw-r--r--samples/microkernel/test/test_pipe/src/main.c128
-rw-r--r--samples/microkernel/test/test_pipe/src/pipe.c1046
-rw-r--r--samples/microkernel/test/test_pipe/testcase.ini3
-rw-r--r--samples/microkernel/test/test_pipe_priv/Makefile10
-rw-r--r--samples/microkernel/test/test_pipe_priv/README.txt43
-rw-r--r--samples/microkernel/test/test_pipe_priv/prj.mdef25
-rw-r--r--samples/microkernel/test/test_pipe_priv/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_pipe_priv/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_pipe_priv/testcase.ini3
-rw-r--r--samples/microkernel/test/test_pool/Makefile6
-rw-r--r--samples/microkernel/test/test_pool/README.txt41
-rw-r--r--samples/microkernel/test/test_pool/prj.mdef20
-rw-r--r--samples/microkernel/test/test_pool/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_pool/prj_x86.conf4
-rw-r--r--samples/microkernel/test/test_pool/src/Makefile3
-rw-r--r--samples/microkernel/test/test_pool/src/pool.c480
-rw-r--r--samples/microkernel/test/test_pool/testcase.ini3
-rw-r--r--samples/microkernel/test/test_rand32/Makefile23
-rw-r--r--samples/microkernel/test/test_rand32/README.txt30
-rw-r--r--samples/microkernel/test/test_rand32/prj.conf5
-rw-r--r--samples/microkernel/test/test_rand32/prj.mdef6
-rw-r--r--samples/microkernel/test/test_rand32/src/Makefile3
-rw-r--r--samples/microkernel/test/test_rand32/src/test-rand32.c81
-rw-r--r--samples/microkernel/test/test_rand32/testcase.ini3
-rw-r--r--samples/microkernel/test/test_sema/Makefile6
-rw-r--r--samples/microkernel/test/test_sema/README.txt42
-rw-r--r--samples/microkernel/test/test_sema/prj.mdef29
-rw-r--r--samples/microkernel/test/test_sema/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_sema/prj_x86.conf5
-rw-r--r--samples/microkernel/test/test_sema/src/Makefile3
-rw-r--r--samples/microkernel/test/test_sema/src/README24
-rw-r--r--samples/microkernel/test/test_sema/src/main.c239
-rw-r--r--samples/microkernel/test/test_sema/src/sema.c657
-rw-r--r--samples/microkernel/test/test_sema/src/test_fiber.c84
-rw-r--r--samples/microkernel/test/test_sema/testcase.ini3
-rw-r--r--samples/microkernel/test/test_sema_priv/Makefile10
-rw-r--r--samples/microkernel/test/test_sema_priv/README.txt44
-rw-r--r--samples/microkernel/test/test_sema_priv/prj.mdef36
-rw-r--r--samples/microkernel/test/test_sema_priv/prj_arm.conf1
-rw-r--r--samples/microkernel/test/test_sema_priv/prj_x86.conf5
-rw-r--r--samples/microkernel/test/test_sema_priv/testcase.ini3
-rw-r--r--samples/microkernel/test/test_sprintf/Makefile6
-rw-r--r--samples/microkernel/test/test_sprintf/README.txt45
-rw-r--r--samples/microkernel/test/test_sprintf/prj.mdef5
-rw-r--r--samples/microkernel/test/test_sprintf/prj_arm.conf2
-rw-r--r--samples/microkernel/test/test_sprintf/prj_x86.conf8
-rw-r--r--samples/microkernel/test/test_sprintf/src/Makefile3
-rw-r--r--samples/microkernel/test/test_sprintf/src/test_sprintf.c756
-rw-r--r--samples/microkernel/test/test_sprintf/testcase.ini4
-rw-r--r--samples/microkernel/test/test_stackprot/Makefile6
-rw-r--r--samples/microkernel/test/test_stackprot/README.txt52
-rw-r--r--samples/microkernel/test/test_stackprot/prj.mdef6
-rw-r--r--samples/microkernel/test/test_stackprot/prj_arm.conf6
-rw-r--r--samples/microkernel/test/test_stackprot/prj_x86.conf5
-rw-r--r--samples/microkernel/test/test_stackprot/src/Makefile3
-rw-r--r--samples/microkernel/test/test_stackprot/src/stackprot.c167
-rw-r--r--samples/microkernel/test/test_stackprot/testcase.ini3
-rw-r--r--samples/microkernel/test/test_static_idt/Makefile6
-rw-r--r--samples/microkernel/test/test_static_idt/README.txt45
-rw-r--r--samples/microkernel/test/test_static_idt/prj.mdef6
-rw-r--r--samples/microkernel/test/test_static_idt/prj_x86.conf5
-rw-r--r--samples/microkernel/test/test_static_idt/src/Makefile3
-rw-r--r--samples/microkernel/test/test_static_idt/src/static_idt.c265
-rw-r--r--samples/microkernel/test/test_static_idt/src/test_asm_inline_gcc.h29
-rw-r--r--samples/microkernel/test/test_static_idt/src/test_stubs.S76
-rw-r--r--samples/microkernel/test/test_static_idt/testcase.ini4
-rw-r--r--samples/microkernel/test/test_task/Makefile6
-rw-r--r--samples/microkernel/test/test_task/README.txt45
-rw-r--r--samples/microkernel/test/test_task/prj.mdef15
-rw-r--r--samples/microkernel/test/test_task/prj_arm.conf3
-rw-r--r--samples/microkernel/test/test_task/prj_x86.conf7
-rw-r--r--samples/microkernel/test/test_task/src/Makefile3
-rw-r--r--samples/microkernel/test/test_task/src/task.c527
-rw-r--r--samples/microkernel/test/test_task/testcase.ini3
-rw-r--r--samples/microkernel/test/test_task_irq/Makefile6
-rw-r--r--samples/microkernel/test/test_task_irq/README.txt58
-rw-r--r--samples/microkernel/test/test_task_irq/prj.mdef14
-rw-r--r--samples/microkernel/test/test_task_irq/prj_arm.conf6
-rw-r--r--samples/microkernel/test/test_task_irq/prj_x86.conf5
-rw-r--r--samples/microkernel/test/test_task_irq/src/Makefile3
-rw-r--r--samples/microkernel/test/test_task_irq/src/main.c147
-rw-r--r--samples/microkernel/test/test_task_irq/src/raise_int.c1406
-rw-r--r--samples/microkernel/test/test_task_irq/src/test_device.c185
-rw-r--r--samples/microkernel/test/test_task_irq/testcase.ini3
-rw-r--r--samples/microkernel/test/test_task_priv/Makefile10
-rw-r--r--samples/microkernel/test/test_task_priv/README.txt46
-rw-r--r--samples/microkernel/test/test_task_priv/prj.mdef17
-rw-r--r--samples/microkernel/test/test_task_priv/prj_arm.conf2
-rw-r--r--samples/microkernel/test/test_task_priv/prj_x86.conf7
-rw-r--r--samples/microkernel/test/test_task_priv/testcase.ini3
-rw-r--r--samples/microkernel/test/test_tickless/Makefile6
-rw-r--r--samples/microkernel/test/test_tickless/README.txt55
-rw-r--r--samples/microkernel/test/test_tickless/prj.mdef5
-rw-r--r--samples/microkernel/test/test_tickless/prj_arm.conf3
-rw-r--r--samples/microkernel/test/test_tickless/prj_x86.conf7
-rw-r--r--samples/microkernel/test/test_tickless/src/Makefile6
-rw-r--r--samples/microkernel/test/test_tickless/src/test_tickless.c191
-rw-r--r--samples/microkernel/test/test_tickless/src/timestamps.c317
-rw-r--r--samples/microkernel/test/test_tickless/testcase.ini3
-rw-r--r--samples/microkernel/test/test_timer/Makefile6
-rw-r--r--samples/microkernel/test/test_timer/README.txt76
-rw-r--r--samples/microkernel/test/test_timer/prj.mdef11
-rw-r--r--samples/microkernel/test/test_timer/prj_arm.conf6
-rw-r--r--samples/microkernel/test/test_timer/prj_x86.conf9
-rw-r--r--samples/microkernel/test/test_timer/src/Makefile4
-rw-r--r--samples/microkernel/test/test_timer/src/timer.c371
-rw-r--r--samples/microkernel/test/test_timer/testcase.ini3
-rw-r--r--samples/microkernel/test/test_xip/Makefile6
-rw-r--r--samples/microkernel/test/test_xip/README.txt37
-rw-r--r--samples/microkernel/test/test_xip/prj.conf2
-rw-r--r--samples/microkernel/test/test_xip/prj.mdef5
-rw-r--r--samples/microkernel/test/test_xip/src/Makefile3
-rw-r--r--samples/microkernel/test/test_xip/src/test.h35
-rw-r--r--samples/microkernel/test/test_xip/src/test_xip.c76
-rw-r--r--samples/microkernel/test/test_xip/src/test_xip_helper.c33
-rw-r--r--samples/microkernel/test/test_xip/testcase.ini3
-rw-r--r--samples/nanokernel/test/test_arm_m3_irq_vector_table/Makefile5
-rw-r--r--samples/nanokernel/test/test_arm_m3_irq_vector_table/README.txt40
-rw-r--r--samples/nanokernel/test/test_arm_m3_irq_vector_table/prj.conf4
-rw-r--r--samples/nanokernel/test/test_arm_m3_irq_vector_table/src/Makefile3
-rw-r--r--samples/nanokernel/test/test_arm_m3_irq_vector_table/src/main.c122
-rw-r--r--samples/nanokernel/test/test_arm_m3_irq_vector_table/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_atomic/Makefile4
-rw-r--r--samples/nanokernel/test/test_atomic/README.txt55
-rw-r--r--samples/nanokernel/test/test_atomic/src/Makefile3
-rw-r--r--samples/nanokernel/test/test_atomic/src/atomic.c164
-rw-r--r--samples/nanokernel/test/test_atomic/testcase.ini2
-rw-r--r--samples/nanokernel/test/test_context/Makefile5
-rw-r--r--samples/nanokernel/test/test_context/README.txt80
-rw-r--r--samples/nanokernel/test/test_context/prj_arm.conf3
-rw-r--r--samples/nanokernel/test/test_context/prj_x86.conf7
-rw-r--r--samples/nanokernel/test/test_context/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_context/src/README51
-rw-r--r--samples/nanokernel/test/test_context/src/context.c935
-rw-r--r--samples/nanokernel/test/test_context/testcase.ini5
-rw-r--r--samples/nanokernel/test/test_errno/Makefile6
-rw-r--r--samples/nanokernel/test/test_errno/README.txt43
-rw-r--r--samples/nanokernel/test/test_errno/prj.conf1
-rw-r--r--samples/nanokernel/test/test_errno/src/Makefile3
-rw-r--r--samples/nanokernel/test/test_errno/src/main.c96
-rw-r--r--samples/nanokernel/test/test_errno/testcase.ini3
-rw-r--r--samples/nanokernel/test/test_fifo/Makefile5
-rw-r--r--samples/nanokernel/test/test_fifo/README.txt121
-rw-r--r--samples/nanokernel/test/test_fifo/prj.conf8
-rw-r--r--samples/nanokernel/test/test_fifo/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_fifo/src/fifo.c713
-rw-r--r--samples/nanokernel/test/test_fifo/src/fifo_timeout.c498
-rw-r--r--samples/nanokernel/test/test_fifo/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_fp_sharing/Makefile6
-rw-r--r--samples/nanokernel/test/test_fp_sharing/README.txt44
-rw-r--r--samples/nanokernel/test/test_fp_sharing/prj_x86.conf9
-rw-r--r--samples/nanokernel/test/test_ipm/Makefile5
-rw-r--r--samples/nanokernel/test/test_ipm/prj.conf5
-rw-r--r--samples/nanokernel/test/test_ipm/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_ipm/src/ipm_dummy.c144
-rw-r--r--samples/nanokernel/test/test_ipm/src/ipm_dummy.h42
-rw-r--r--samples/nanokernel/test/test_ipm/src/test_ipm.c120
-rw-r--r--samples/nanokernel/test/test_ipm/testcase.ini2
-rw-r--r--samples/nanokernel/test/test_lifo/Makefile5
-rw-r--r--samples/nanokernel/test/test_lifo/README.txt85
-rw-r--r--samples/nanokernel/test/test_lifo/prj.conf8
-rw-r--r--samples/nanokernel/test/test_lifo/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_lifo/src/README35
-rw-r--r--samples/nanokernel/test/test_lifo/src/lifo.c1087
-rw-r--r--samples/nanokernel/test/test_lifo/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_mem_safe/Makefile5
-rw-r--r--samples/nanokernel/test/test_mem_safe/README.txt96
-rw-r--r--samples/nanokernel/test/test_mem_safe/prj.conf3
-rw-r--r--samples/nanokernel/test/test_mem_safe/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_mem_safe/src/asm_arm.S0
-rw-r--r--samples/nanokernel/test/test_mem_safe/src/asm_x86.S30
-rw-r--r--samples/nanokernel/test/test_mem_safe/src/main.c412
-rw-r--r--samples/nanokernel/test/test_mem_safe/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_ring_buf/Makefile5
-rw-r--r--samples/nanokernel/test/test_ring_buf/prj.conf2
-rw-r--r--samples/nanokernel/test/test_ring_buf/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_ring_buf/src/test_ring_buf.c107
-rw-r--r--samples/nanokernel/test/test_ring_buf/testcase.ini3
-rw-r--r--samples/nanokernel/test/test_sema/Makefile5
-rw-r--r--samples/nanokernel/test/test_sema/README.txt86
-rw-r--r--samples/nanokernel/test/test_sema/prj.conf6
-rw-r--r--samples/nanokernel/test/test_sema/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_sema/src/README33
-rw-r--r--samples/nanokernel/test/test_sema/src/sema.c976
-rw-r--r--samples/nanokernel/test/test_sema/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_stack/Makefile5
-rw-r--r--samples/nanokernel/test/test_stack/README.txt90
-rw-r--r--samples/nanokernel/test/test_stack/prj.conf5
-rw-r--r--samples/nanokernel/test/test_stack/src/Makefile3
-rw-r--r--samples/nanokernel/test/test_stack/src/stack.c576
-rw-r--r--samples/nanokernel/test/test_stack/testcase.ini2
-rw-r--r--samples/nanokernel/test/test_stackprot/Makefile6
-rw-r--r--samples/nanokernel/test/test_stackprot/README.txt50
-rw-r--r--samples/nanokernel/test/test_stackprot/prj_arc.conf5
-rw-r--r--samples/nanokernel/test/test_stackprot/prj_arm.conf6
-rw-r--r--samples/nanokernel/test/test_stackprot/prj_x86.conf6
-rw-r--r--samples/nanokernel/test/test_stackprot/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_static_idt/Makefile6
-rw-r--r--samples/nanokernel/test/test_static_idt/README.txt46
-rw-r--r--samples/nanokernel/test/test_static_idt/prj_x86.conf5
-rw-r--r--samples/nanokernel/test/test_static_idt/testcase.ini4
-rw-r--r--samples/nanokernel/test/test_timer/Makefile5
-rw-r--r--samples/nanokernel/test/test_timer/README.txt50
-rw-r--r--samples/nanokernel/test/test_timer/prj_arc.conf1
-rw-r--r--samples/nanokernel/test/test_timer/prj_arm.conf1
-rw-r--r--samples/nanokernel/test/test_timer/prj_x86.conf4
-rw-r--r--samples/nanokernel/test/test_timer/src/Makefile4
-rw-r--r--samples/nanokernel/test/test_timer/src/README42
-rw-r--r--samples/nanokernel/test/test_timer/src/timer.c565
-rw-r--r--samples/nanokernel/test/test_timer/testcase.ini3
-rw-r--r--samples/nanokernel/test/test_xip/Makefile6
-rw-r--r--samples/nanokernel/test/test_xip/README.txt37
-rw-r--r--samples/nanokernel/test/test_xip/prj_arc.conf2
-rw-r--r--samples/nanokernel/test/test_xip/prj_arm.conf2
-rw-r--r--samples/nanokernel/test/test_xip/prj_x86.conf2
-rw-r--r--samples/nanokernel/test/test_xip/testcase.ini3
309 files changed, 0 insertions, 22093 deletions
diff --git a/samples/microkernel/test/test_critical/Makefile b/samples/microkernel/test/test_critical/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_critical/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_critical/README.txt b/samples/microkernel/test/test_critical/README.txt
deleted file mode 100644
index 9e03e319e..000000000
--- a/samples/microkernel/test/test_critical/README.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-Title: Offload to the Kernel Service Fiber
-
-Description:
-
-This test verifies that the microkernel task_offload_to_fiber() API operates as
-expected.
-
-This test has two tasks that increment a counter. The routine that
-increments the counter is invoked from _k_server() due to the two tasks
-calling task_offload_to_fiber(). The final result of the counter is expected
-to be the the number of times task_offload_to_fiber() was called to increment
-the counter as the incrementing was done in the context of _k_server().
-
-This is done with time slicing both disabled and enabled to ensure that the
-result always matches the number of times task_offload_to_fiber() is called.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Critical Section API
-
-Obtained expected <criticalVar> value of 10209055
-Enabling time slicing ...
-Obtained expected <criticalVar> value of 15123296
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_critical/prj.mdef b/samples/microkernel/test/test_critical/prj.mdef
deleted file mode 100644
index 214c3c18b..000000000
--- a/samples/microkernel/test/test_critical/prj.mdef
+++ /dev/null
@@ -1,11 +0,0 @@
-% Application : test microkernel critical section API
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK ALTTASK 40 AlternateTask 1024 [EXE]
- TASK REGRESSTASK 40 RegressionTask 1024 [EXE]
-
-% SEMA NAME
-% ================
- SEMA ALT_SEM
- SEMA REGRESS_SEM
diff --git a/samples/microkernel/test/test_critical/prj_arm.conf b/samples/microkernel/test/test_critical/prj_arm.conf
deleted file mode 100644
index 5a79d7320..000000000
--- a/samples/microkernel/test/test_critical/prj_arm.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=50
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_critical/prj_x86.conf b/samples/microkernel/test/test_critical/prj_x86.conf
deleted file mode 100644
index 2ac4a6051..000000000
--- a/samples/microkernel/test/test_critical/prj_x86.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=50
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_critical/src/Makefile b/samples/microkernel/test/test_critical/src/Makefile
deleted file mode 100644
index 7a4013eaa..000000000
--- a/samples/microkernel/test/test_critical/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = critical.o
diff --git a/samples/microkernel/test/test_critical/src/critical.c b/samples/microkernel/test/test_critical/src/critical.c
deleted file mode 100644
index c1467dd5a..000000000
--- a/samples/microkernel/test/test_critical/src/critical.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* critical.c - test the task_offload_to_fiber() API */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module tests the task_offload_to_fiber() API.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <sections.h>
-
-#define NUM_TICKS 500
-#define TEST_TIMEOUT 2000
-
-static uint32_t criticalVar = 0;
-static uint32_t altTaskIterations = 0;
-
-/**
- *
- * @brief Routine to be called from _k_server()
- *
- * This routine increments the global variable <criticalVar>.
- *
- * @return 0
- */
-
-int criticalRtn(void)
-{
- volatile uint32_t x;
-
- x = criticalVar;
- criticalVar = x + 1;
-
- return 0;
-}
-
-/**
- *
- * @brief Common code for invoking task_offload_to_fiber()
- *
- * @param count number of critical section calls made thus far
- *
- * @return number of critical section calls made by task
- */
-
-uint32_t criticalLoop(uint32_t count)
-{
- int32_t ticks;
-
- ticks = sys_tick_get_32();
- while (sys_tick_get_32() < ticks + NUM_TICKS) {
- task_offload_to_fiber(criticalRtn, &criticalVar);
- count++;
- }
-
- return count;
-}
-
-/**
- *
- * @brief Alternate task
- *
- * This routine calls task_offload_to_fiber() many times.
- *
- * @return N/A
- */
-
-void AlternateTask(void)
-{
- task_sem_take(ALT_SEM, TICKS_UNLIMITED); /* Wait to be activated */
-
- altTaskIterations = criticalLoop(altTaskIterations);
-
- task_sem_give(REGRESS_SEM);
-
- task_sem_take(ALT_SEM, TICKS_UNLIMITED); /* Wait to be re-activated */
-
- altTaskIterations = criticalLoop(altTaskIterations);
-
- task_sem_give(REGRESS_SEM);
-}
-
-/**
- *
- * @brief Regression task
- *
- * This routine calls task_offload_to_fiber() many times. It also checks to
- * ensure that the number of times it is called matches the global variable
- * <criticalVar>.
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- uint32_t nCalls = 0;
- int status;
-
- TC_START("Test Microkernel Critical Section API\n");
-
- task_sem_give(ALT_SEM); /* Activate AlternateTask() */
-
- nCalls = criticalLoop(nCalls);
-
- /* Wait for AlternateTask() to complete */
- status = task_sem_take(REGRESS_SEM, TEST_TIMEOUT);
- if (status != RC_OK) {
- TC_ERROR("Timed out waiting for REGRESS_SEM\n");
- goto errorReturn;
- }
-
- if (criticalVar != nCalls + altTaskIterations) {
- TC_ERROR("Unexpected value for <criticalVar>. Expected %d, got %d\n",
- nCalls + altTaskIterations, criticalVar);
- goto errorReturn;
- }
- TC_PRINT("Obtained expected <criticalVar> value of %u\n", criticalVar);
-
- TC_PRINT("Enabling time slicing ...\n");
-
- sys_scheduler_time_slice_set(1, 10);
-
- task_sem_give(ALT_SEM); /* Re-activate AlternateTask() */
-
- nCalls = criticalLoop(nCalls);
-
- /* Wait for AlternateTask() to finish */
- status = task_sem_take(REGRESS_SEM, TEST_TIMEOUT);
- if (status != RC_OK) {
- TC_ERROR("Timed out waiting for REGRESS_SEM\n");
- goto errorReturn;
- }
-
- if (criticalVar != nCalls + altTaskIterations) {
- TC_ERROR("Unexpected value for <criticalVar>. Expected %d, got %d\n",
- nCalls + altTaskIterations, criticalVar);
- goto errorReturn;
- }
- TC_PRINT("Obtained expected <criticalVar> value of %u\n", criticalVar);
-
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
- return;
-
-errorReturn:
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
-}
diff --git a/samples/microkernel/test/test_critical/testcase.ini b/samples/microkernel/test/test_critical/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_critical/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_events/Makefile b/samples/microkernel/test/test_events/Makefile
deleted file mode 100644
index 39a7ff146..000000000
--- a/samples/microkernel/test/test_events/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_events/README.txt b/samples/microkernel/test/test_events/README.txt
deleted file mode 100644
index 71fd66c9f..000000000
--- a/samples/microkernel/test/test_events/README.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Title: Event APIs
-
-Description:
-
-This test verifies that the microkernel event APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Events
-
-Microkernel objects initialized
-Testing task_event_recv(TICKS_NONE) and task_event_send() ...
-Testing task_event_recv(TICKS_UNLIMITED) and task_event_send() ...
-Testing task_event_recv(timeout) and task_event_send() ...
-Testing isr_event_send() ...
-Testing fiber_event_send() ...
-Testing task_event_handler_set() ...
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_events/prj.mdef b/samples/microkernel/test/test_events/prj.mdef
deleted file mode 100644
index 0728087f2..000000000
--- a/samples/microkernel/test/test_events/prj.mdef
+++ /dev/null
@@ -1,15 +0,0 @@
-% Application : test microkernel event APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ==================================================
- TASK tStartTask 5 RegressionTask 2048 [EXE]
- TASK tAlternate 6 AlternateTask 2048 [EXE]
-
-% EVENT NAME ENTRY
-% =========================
- EVENT EVENT_ID NULL
- EVENT ALT_EVENT NULL
-
-% SEMA NAME
-% ==================
- SEMA ALTERNATE_SEM
diff --git a/samples/microkernel/test/test_events/prj_arm.conf b/samples/microkernel/test/test_events/prj_arm.conf
deleted file mode 100644
index 44d4a391a..000000000
--- a/samples/microkernel/test/test_events/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_events/prj_x86.conf b/samples/microkernel/test/test_events/prj_x86.conf
deleted file mode 100644
index 2da0bd453..000000000
--- a/samples/microkernel/test/test_events/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_events/src/Makefile b/samples/microkernel/test/test_events/src/Makefile
deleted file mode 100644
index da644c6a9..000000000
--- a/samples/microkernel/test/test_events/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = events.o test_fiber.o
diff --git a/samples/microkernel/test/test_events/src/events.c b/samples/microkernel/test/test_events/src/events.c
deleted file mode 100644
index cfd030c88..000000000
--- a/samples/microkernel/test/test_events/src/events.c
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test microkernel event APIs
- *
- * This modules tests the following event APIs:
- * task_event_handler_set()
- * task_event_send()
- * isr_event_send()
- * task_event_recv()
- */
-
-#include <tc_util.h>
-#include <zephyr.h>
-#include <arch/cpu.h>
-#include <toolchain.h>
-#include <irq_offload.h>
-
-#include <util_test_common.h>
-
-typedef struct {
- kevent_t event;
-} ISR_INFO;
-
-static int evidence = 0;
-
-static ISR_INFO isrInfo;
-static int handlerRetVal = 0;
-
-extern void testFiberInit(void);
-extern struct nano_sem fiberSem; /* semaphore that allows test control the fiber */
-
-extern kevent_t _k_event_list_end[];
-
-/**
- *
- * @brief ISR handler to signal an event
- *
- * @return N/A
- */
-
-void isr_event_signal_handler(void *data)
-{
- ISR_INFO *pInfo = (ISR_INFO *) data;
-
- isr_event_send(pInfo->event);
-}
-
-static void _trigger_isrEventSignal(void)
-{
- irq_offload(isr_event_signal_handler, &isrInfo);
-}
-
-
-/**
- *
- * @brief Release the test fiber
- *
- * @return N/A
- */
-
-void releaseTestFiber(void)
-{
- nano_task_sem_give(&fiberSem);
-}
-
-/**
- *
- * @brief Initialize objects used in this microkernel test suite
- *
- * @return N/A
- */
-
-void microObjectsInit(void)
-{
- testFiberInit();
-
- TC_PRINT("Microkernel objects initialized\n");
-}
-
-/**
- *
- * @brief Test the task_event_recv(TICKS_NONE) API
- *
- * There are two cases to be tested here. The first is for testing for an
- * event when there is one. The second is for testing for an event when there
- * are none. Note that the "consumption" of the event gets confirmed by the
- * order in which the latter two checks are done.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int eventNoWaitTest(void)
-{
- int rv; /* return value from task_event_xxx() calls */
-
- /* Signal an event */
- rv = task_event_send(EVENT_ID);
- if (rv != RC_OK) {
- TC_ERROR("task_event_send() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- /* No event has been signalled */
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_FAIL) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_FAIL);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the task_event_recv(TICKS_UNLIMITED) API
- *
- * This test checks task_event_recv(TICKS_UNLIMITED) against the following
- * cases:
- * 1. There is already an event waiting (signalled from a task and ISR).
- * 2. The current task must wait on the event until it is signalled
- * from either another task, an ISR or a fiber.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int eventWaitTest(void)
-{
- int rv; /* return value from task_event_xxx() calls */
- int i; /* loop counter */
-
- /*
- * task_event_recv() to return immediately as there will already be
- * an event by a task.
- */
-
- task_event_send(EVENT_ID);
- rv = task_event_recv(EVENT_ID, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- TC_ERROR("Task: task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- /*
- * task_event_recv() to return immediately as there will already be
- * an event made ready by an ISR.
- */
-
- isrInfo.event = EVENT_ID;
- _trigger_isrEventSignal();
- rv = task_event_recv(EVENT_ID, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- TC_ERROR("ISR: task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- /*
- * task_event_recv() to return immediately as there will already be
- * an event made ready by a fiber.
- */
-
- releaseTestFiber();
- rv = task_event_recv(EVENT_ID, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- TC_ERROR("Fiber: task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- task_sem_give(ALTERNATE_SEM); /* Wake the AlternateTask */
-
- /*
- * The 1st pass, task_event_recv() will be signalled from a task,
- * from an ISR for the second and from a fiber third.
- */
-
- for (i = 0; i < 3; i++) {
- rv = task_event_recv(EVENT_ID, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the task_event_recv(timeout) API
- *
- * This test checks task_event_recv(timeout) against the following cases:
- * 1. The current task times out while waiting for the event.
- * 2. There is already an event waiting (signalled from a task).
- * 3. The current task must wait on the event until it is signalled
- * from either another task, an ISR or a fiber.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int eventTimeoutTest(void)
-{
- int rv; /* return value from task_event_xxx() calls */
- int i; /* loop counter */
-
- /* Timeout while waiting for the event */
- rv = task_event_recv(EVENT_ID, MSEC(100));
- if (rv != RC_TIME) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_TIME);
- return TC_FAIL;
- }
-
- /* Let there be an event already waiting to be tested */
- task_event_send(EVENT_ID);
- rv = task_event_recv(EVENT_ID, MSEC(100));
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- task_sem_give(ALTERNATE_SEM); /* Wake AlternateTask() */
-
- /*
- * The 1st pass, task_event_recv(timeout) will be signalled from a task,
- * from an ISR for the second and from a fiber for the third.
- */
-
- for (i = 0; i < 3; i++) {
- rv = task_event_recv(EVENT_ID, MSEC(100));
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the isr_event_send() API
- *
- * Although other tests have done some testing using isr_event_send(), none
- * of them have demonstrated that signalling an event more than once does not
- * "queue" events. That is, should two or more signals of the same event occur
- * before it is tested, it can only be tested for successfully once.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int isrEventSignalTest(void)
-{
- int rv; /* return value from task_event_recv() */
-
- /*
- * The single case of an event made ready has already been tested.
- * Trigger two ISR event signals. Only one should be detected.
- */
-
- isrInfo.event = EVENT_ID;
-
- _trigger_isrEventSignal();
- _trigger_isrEventSignal();
-
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- /* The second event signal should be "lost" */
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_FAIL) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_FAIL);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the fiber_event_send() API
- *
- * Signalling an event by fiber_event_send() more than once does not "queue"
- * events. That is, should two or more signals of the same event occur before
- * it is tested, it can only be tested for successfully once.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int fiberEventSignalTest(void)
-{
- int rv; /* return value from task_event_recv(TICKS_NONE) */
-
- /*
- * Trigger two fiber event signals. Only one should be detected.
- */
-
- releaseTestFiber();
-
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- /* The second event signal should be "lost" */
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_FAIL) {
- TC_ERROR("task_event_recv() returned %d, not %d\n", rv, RC_FAIL);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Handler to run on EVENT_ID event
- *
- * @param event signalled event
- *
- * @return <handlerRetVal>
- */
-
-int eventHandler(int event)
-{
- ARG_UNUSED(event);
-
- evidence++;
-
- return handlerRetVal; /* 0 if not to wake waiting task; 1 if to wake */
-}
-
-/**
- *
- * @brief Handler to run on ALT_EVENT event
- *
- * @param event signalled event
- *
- * @return 1
- */
-
-int altEventHandler(int event)
-{
- ARG_UNUSED(event);
-
- evidence += 100;
-
- return 1;
-}
-
-/**
- *
- * @brief Test the task_event_handler_set() API
- *
- * This test checks that the event handler is set up properly when
- * task_event_handler_set() is called. It shows that event handlers are tied
- * to the specified event and that the return value from the handler affects
- * whether the event wakes a task waiting upon that event.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int eventSignalHandlerTest(void)
-{
- int rv; /* return value from task_event_xxx() calls */
-
- /*
- * NOTE: We cannot test for the validity of an event ID, since
- * task_event_handler_set() only checks for valid event IDs via an
- * __ASSERT() and only in debug kernels (an __ASSERT() stops the system).
- */
-
- /* Expect this call to task_event_handler_set() to succeed */
- rv = task_event_handler_set(EVENT_ID, eventHandler);
- if (rv != RC_OK) {
- TC_ERROR("task_event_handler_set() returned %d not %d\n",
- rv, RC_OK);
- return TC_FAIL;
- }
-
- /* Enable another handler to show that two handlers can be installed */
- rv = task_event_handler_set(ALT_EVENT, altEventHandler);
- if (rv != RC_OK) {
- TC_ERROR("task_event_handler_set() returned %d not %d\n",
- rv, RC_OK);
- return TC_FAIL;
- }
-
- /*
- * The alternate task should signal the event, but the handler will
- * return 0 and the waiting task will not be woken up. Thus, it should
- * timeout and get an RC_TIME return code.
- */
-
- task_sem_give(ALTERNATE_SEM); /* Wake alternate task */
- rv = task_event_recv(EVENT_ID, MSEC(100));
- if (rv != RC_TIME) {
- TC_ERROR("task_event_recv() returned %d not %d\n", rv, RC_TIME);
- return TC_FAIL;
- }
-
- /*
- * The alternate task should signal the event, and the handler will
- * return 1 this time, which will wake the waiting task.
- */
-
- task_sem_give(ALTERNATE_SEM); /* Wake alternate task again */
- rv = task_event_recv(EVENT_ID, MSEC(100));
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- if (evidence != 2) {
- TC_ERROR("Expected event handler evidence to be %d not %d\n",
- 2, evidence);
- return TC_FAIL;
- }
-
- /*
- * Signal the alternate event. This demonstrates that two event handlers
- * can be simultaneously installed for two different events.
- */
-
- task_event_send(ALT_EVENT);
- if (evidence != 102) {
- TC_ERROR("Expected event handler evidence to be %d not %d\n",
- 2, evidence);
- return TC_FAIL;
- }
-
- /* Uninstall the event handlers */
- rv = task_event_handler_set(EVENT_ID, NULL);
- if (rv != RC_OK) {
- TC_ERROR("task_event_handler_set() returned %d not %d\n",
- rv, RC_OK);
- return TC_FAIL;
- }
-
- rv = task_event_handler_set(ALT_EVENT, NULL);
- if (rv != RC_OK) {
- TC_ERROR("task_event_handler_set() returned %d not %d\n",
- rv, RC_OK);
- return TC_FAIL;
- }
-
- task_event_send(EVENT_ID);
- task_event_send(ALT_EVENT);
-
- if (evidence != 102) {
- TC_ERROR("Event handlers did not uninstall\n");
- return TC_FAIL;
- }
-
- /* Clear out the waiting events */
-
- rv = task_event_recv(EVENT_ID, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- rv = task_event_recv(ALT_EVENT, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("task_event_recv() returned %d not %d\n", rv, RC_OK);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Alternate task to signal various events to a waiting task
- *
- * @return N/A
- */
-
-void AlternateTask(void)
-{
- /* Wait for eventWaitTest() to run. */
- task_sem_take(ALTERNATE_SEM, TICKS_UNLIMITED);
- task_event_send(EVENT_ID);
- releaseTestFiber();
- _trigger_isrEventSignal();
-
- /* Wait for eventTimeoutTest() to run. */
- task_sem_take(ALTERNATE_SEM, TICKS_UNLIMITED);
- task_event_send(EVENT_ID);
- releaseTestFiber();
- _trigger_isrEventSignal();
-
- /*
- * Wait for eventSignalHandlerTest() to run.
- *
- * When <handlerRetVal> is zero (0), the waiting task will not get woken up
- * after the event handler for EVENT_ID runs. When it is one (1), the
- * waiting task will get woken up after the event handler for EVENT_ID runs.
- */
-
- task_sem_take(ALTERNATE_SEM, TICKS_UNLIMITED);
- handlerRetVal = 0;
- task_event_send(EVENT_ID);
-
- task_sem_take(ALTERNATE_SEM, TICKS_UNLIMITED);
- handlerRetVal = 1;
- task_event_send(EVENT_ID);
-}
-
-/**
- *
- * @brief Main entry point to the test suite
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int tcRC; /* test case return code */
-
- TC_START("Test Microkernel Events\n");
-
- microObjectsInit();
-
- TC_PRINT("Testing task_event_recv(TICKS_NONE) and task_event_send() ...\n");
- tcRC = eventNoWaitTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing task_event_recv(TICKS_UNLIMITED) and task_event_send() ...\n");
- tcRC = eventWaitTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing task_event_recv(timeout) and task_event_send() ...\n");
- tcRC = eventTimeoutTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing isr_event_send() ...\n");
- tcRC = isrEventSignalTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing fiber_event_send() ...\n");
- tcRC = fiberEventSignalTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing task_event_handler_set() ...\n");
- tcRC = eventSignalHandlerTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
-doneTests:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-}
diff --git a/samples/microkernel/test/test_events/src/test_fiber.c b/samples/microkernel/test/test_events/src/test_fiber.c
deleted file mode 100644
index da594da54..000000000
--- a/samples/microkernel/test/test_events/src/test_fiber.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* test_fiber.c - test fiber functions */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-The module implements functions for the fiber that tests
-event signaling
- */
-#include <zephyr.h>
-
-#define N_TESTS 10 /* number of tests to run */
-#define FIBER_PRIORITY 6
-#define FIBER_STACK_SIZE 1024
-
-/* exports */
-struct nano_sem fiberSem; /* semaphore that allows test control the fiber */
-
-static char __stack fiberStack[FIBER_STACK_SIZE]; /* test fiber stack size */
-
-/**
- *
- * @brief The test fiber entry function
- *
- * Fiber waits on the semaphore controlled by the test task
- * It signals the event for the eventWaitTest() function
- * in single and cycle test, for eventTimeoutTest()
- *
- * @return N/A
- */
-static void testFiberEntry(void)
-{
- /* signal event for eventWaitTest() */
- /* single test */
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- fiber_event_send(EVENT_ID);
- /* test in cycle */
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- fiber_event_send(EVENT_ID);
-
- /* signal event for eventTimeoutTest() */
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- fiber_event_send(EVENT_ID);
-
- /*
- * Signal two events for fiberEventSignalTest ().
- * It has to detect only one
- */
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- fiber_event_send(EVENT_ID);
- fiber_event_send(EVENT_ID);
-}
-
-/**
- *
- * @brief Initializes variables and starts the test fiber
- *
- * @return N/A
- */
-
-void testFiberInit(void)
-{
- nano_sem_init(&fiberSem);
- task_fiber_start(fiberStack, FIBER_STACK_SIZE, (nano_fiber_entry_t)testFiberEntry,
- 0, 0, FIBER_PRIORITY, 0);
-}
diff --git a/samples/microkernel/test/test_events/testcase.ini b/samples/microkernel/test/test_events/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_events/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_fifo/Makefile b/samples/microkernel/test/test_fifo/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_fifo/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_fifo/README.txt b/samples/microkernel/test/test_fifo/README.txt
deleted file mode 100644
index c287175c3..000000000
--- a/samples/microkernel/test/test_fifo/README.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-Title: FIFO APIs
-
-Description:
-
-This test verifies that the microkernel FIFO APIs operate as expected.
-
---------------------------------------------------------------------------------
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel FIFO
-myData[0] = 1,
-myData[1] = 101,
-myData[2] = 201,
-myData[3] = 301,
-myData[4] = 401,
-===================================================================
-PASS - fillFIFO.
-verifyQueueData: i=0, successfully get data 1
-verifyQueueData: i=1, successfully get data 101
-verifyQueueData: i=2, FIFOQ is empty. No data.
-===================================================================
-PASS - verifyQueueData.
-===================================================================
-PASS - fillFIFO.
-RegressionTask: About to putWT with data 401
-RegressionTask: FIFO Put time out as expected for data 401
-verifyQueueData: i=0, successfully get data 1
-verifyQueueData: i=1, successfully get data 101
-===================================================================
-PASS - verifyQueueData.
-===================================================================
-PASS - fillFIFO.
-RegressionTask: 2 element in queue
-RegressionTask: Successfully purged queue
-RegressionTask: confirm 0 element in queue
-===================================================================
-RegressionTask: About to GetW data
-Starts MicroTestFifoTask
-MicroTestFifoTask: Puts element 999
-RegressionTask: GetW get back 999
-MicroTestFifoTask: FIRegressionTask: GetWT timeout expected
-===================================================================
-PASS - fillFIFO.
-RegressionTask: about to putW data 999
-FOPut OK for 999
-MicroTestFifoTask: About to purge queue
-RegressionTask: PutW ok when queue is purged while waiting
-===================================================================
-PASS - fillFIFO.
-RegressionTask: about to putW data 401
-MicroTestFifoTask: Successfully purged queue
-MicroTestFifoTask: About to dequeue 1 element
-RegressionTask: PutW success for data 401
-===================================================================
-RegressionTask: Get back data 101
-RegressionTask: Get back data 401
-RegressionTask: queue is empty. Test Done!
-MicroTestFifoTask: task_fifo_get got back correct data 1
-===================================================================
-PASS - MicroTestFifoTask.
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_fifo/prj.mdef b/samples/microkernel/test/test_fifo/prj.mdef
deleted file mode 100644
index b111ba4db..000000000
--- a/samples/microkernel/test/test_fifo/prj.mdef
+++ /dev/null
@@ -1,15 +0,0 @@
-% Application : test microkernel FIFO APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ====================================================
- TASK tStartTask 5 RegressionTask 2048 [EXE]
- TASK helperTask 7 MicroTestFifoTask 2048 [EXE]
-
-% FIFO NAME DEPTH WIDTH
-% ========================
- FIFO FIFOQ 2 4
-
-% SEMA NAME
-% =============================
- SEMA SEMSIG_MicroTestFifoTask
- SEMA SEM_TestDone
diff --git a/samples/microkernel/test/test_fifo/prj_arm.conf b/samples/microkernel/test/test_fifo/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_fifo/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_fifo/prj_x86.conf b/samples/microkernel/test/test_fifo/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_fifo/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_fifo/src/Makefile b/samples/microkernel/test/test_fifo/src/Makefile
deleted file mode 100644
index db98adde2..000000000
--- a/samples/microkernel/test/test_fifo/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = fifo.o
diff --git a/samples/microkernel/test/test_fifo/src/fifo.c b/samples/microkernel/test/test_fifo/src/fifo.c
deleted file mode 100644
index 2df51f7ca..000000000
--- a/samples/microkernel/test/test_fifo/src/fifo.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test microkernel FIFO APIs
- *
- * This module tests the following FIFO routines:
- *
- * task_fifo_put
- * task_fifo_get
- * task_fifo_size_get
- * task_fifo_purge
- *
- * Scenarios tested include:
- * - Check number of elements in queue when queue is empty, full or
- * while it is being dequeued
- * - Verify the data being dequeued are in correct order
- * - Verify the return codes are correct for the APIs
- */
-
-#include <tc_util.h>
-#include <stdbool.h>
-#include <zephyr.h>
-
-#define MULTIPLIER 100 /* Used to initialize myData */
-#define NUM_OF_ELEMENT 5 /* Number of elements in myData array */
-#define DEPTH_OF_FIFO_QUEUE 2 /*
- * Depth of FIFO queue, this has to
- * be aligned with the number in
- * prj.mdef file
- */
-
-#define SPECIAL_DATA 999 /* Special number to put in queue */
-
-static int myData[NUM_OF_ELEMENT];
-static int tcRC = TC_PASS; /* test case return code */
-
-#ifdef TEST_PRIV_FIFO
- DEFINE_FIFO(FIFOQ, 2, 4);
-#endif
-
-/**
- *
- * @brief Initialize data array
- *
- * This routine initializes the myData array used in the FIFO tests.
- *
- * @return N/A
- */
-
-void initMyData(void)
-{
- for (int i = 0; i < NUM_OF_ELEMENT; i++) {
- myData[i] = i * MULTIPLIER + 1;
- } /* for */
-} /* initMyData */
-
-/**
- *
- * @brief Print data array
- *
- * This routine prints myData array.
- *
- * @return N/A
- */
-
-void printMyData(void)
-{
- for (int i = 0; i < NUM_OF_ELEMENT; i++) {
- PRINT_DATA("myData[%d] = %d,\n", i, myData[i]);
- } /* for */
-
-} /* printMyData */
-
-/**
- *
- * @brief Verify return value
- *
- * This routine verifies current value against expected value
- * and returns true if they are the same.
- *
- * @param expectRetValue expect value
- * @param currentRetValue current value
- *
- * @return true, false
- */
-
-bool verifyRetValue(int expectRetValue, int currentRetValue)
-{
- return (expectRetValue == currentRetValue);
-} /* verifyRetValue */
-
-/**
- *
- * @brief Initialize microkernel objects
- *
- * This routine initializes the microkernel objects used in the FIFO tests.
- *
- * @return N/A
- */
-
-void initMicroObjects(void)
-{
- initMyData();
- printMyData();
-} /* initMicroObjects */
-
-/**
- *
- * @brief Fills up the FIFO queue
- *
- * This routine fills the FIFO queue with myData array. This assumes the
- * queue is empty before we put in elements.
- *
- * @param queue FIFO queue
- * @param numElements Number of elements used to inserted into the queue
- *
- * @return TC_PASS, TC_FAIL
- *
- * Also updates tcRC when result is TC_FAIL.
- */
-
-int fillFIFO(kfifo_t queue, int numElements)
-{
- int result = TC_PASS; /* TC_PASS or TC_FAIL for this function */
- int retValue; /* return value from task_fifo_xxx APIs */
-
- for (int i = 0; i < numElements; i++) {
- retValue = task_fifo_put(queue, &myData[i], TICKS_NONE);
- switch (retValue) {
- case RC_OK:
- /* TC_PRINT("i=%d, successfully put in data=%d\n", i, myData[i]); */
- if (i >= DEPTH_OF_FIFO_QUEUE) {
- TC_ERROR("Incorrect return value of RC_OK when i = %d\n", i);
- result = TC_FAIL;
- goto exitTest3;
- }
- break;
- case RC_FAIL:
- /* TC_PRINT("i=%d, FIFOQ is full. Cannot put data=%d\n", i, myData[i]); */
- if (i < DEPTH_OF_FIFO_QUEUE) {
- TC_ERROR("Incorrect return value of RC_FAIL when i = %d\n", i);
- result = TC_FAIL;
- goto exitTest3;
- }
- break;
- default:
- TC_ERROR("Incorrect return value of %d when i = %d\n", retValue, i);
- result = TC_FAIL;
- goto exitTest3;
- } /* switch */
-
- } /* for */
-
-exitTest3:
- if (result == TC_FAIL) {
- tcRC = TC_FAIL;
- }
-
- TC_END_RESULT(result);
- return result;
-
-} /* fillFIFO */
-
-/**
- *
- * @brief Task to test FIFO queue
- *
- * This routine is run in three context switches:
- * - it puts an element to the FIFO queue
- * - it purges the FIFO queue
- * - it dequeues an element from the FIFO queue
- *
- * @return N/A
- */
-void MicroTestFifoTask(void)
-{
- int retValue; /* return value of task_fifo_xxx interface */
- int locData = SPECIAL_DATA; /* variable to pass data to and from queue */
-
- /* (1) Wait for semaphore: put element test */
- task_sem_take(SEMSIG_MicroTestFifoTask, TICKS_UNLIMITED);
-
- TC_PRINT("Starts %s\n", __func__);
- /* Put one element */
- TC_PRINT("%s: Puts element %d\n", __func__, locData);
- retValue = task_fifo_put(FIFOQ, &locData, TICKS_NONE);
- /*
- * Execution is switched back to RegressionTask (a higher priority task)
- * which is not block anymore.
- */
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT("%s: FIFOPut OK for %d\n", __func__, locData);
- } else {
- TC_ERROR("FIFOPut failed, retValue %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest4;
- }
-
- /*
- * (2) Wait for semaphore: purge queue test. Purge queue while another
- * task is in task_fifo_put(TICKS_UNLIMITED). This is to test return
- * value of the task_fifo_put(TICKS_UNLIMITED) interface.
- */
- task_sem_take(SEMSIG_MicroTestFifoTask, TICKS_UNLIMITED);
- /*
- * RegressionTask is waiting to put data into FIFO queue, which is
- * full. We purge the queue here and the task_fifo_put(TICKS_UNLIMITED)
- * interface will terminate the wait and return RC_FAIL.
- */
- TC_PRINT("%s: About to purge queue\n", __func__);
- retValue = task_fifo_purge(FIFOQ);
-
- /*
- * Execution is switched back to RegressionTask (a higher priority task)
- * which is not block anymore.
- */
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT("%s: Successfully purged queue\n", __func__);
- } else {
- TC_ERROR("Problem purging queue, %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest4;
- }
-
- /* (3) Wait for semaphore: get element test */
- task_sem_take(SEMSIG_MicroTestFifoTask, TICKS_UNLIMITED);
- TC_PRINT("%s: About to dequeue 1 element\n", __func__);
- retValue = task_fifo_get(FIFOQ, &locData, TICKS_NONE);
- /*
- * Execution is switched back to RegressionTask (a higher priority task)
- * which is not block anymore
- */
- if ((retValue != RC_OK) || (locData != myData[0])) {
- TC_ERROR("task_fifo_get failed,\n retValue %d OR got data %d while expect %d\n"
- , retValue, locData, myData[0]);
- tcRC = TC_FAIL;
- goto exitTest4;
- } else {
- TC_PRINT("%s: task_fifo_get got back correct data %d\n", __func__, locData);
- }
-
-exitTest4:
- TC_END_RESULT(tcRC);
-
- /* Allow RegressionTask to print final result of the test */
- task_sem_give(SEM_TestDone);
-}
-
-/**
- *
- * @brief Verifies data in queue is correct
- *
- * This routine assumes that the queue is full when this function is called.
- * It counts the number of elements in the queue, dequeues elements and verifies
- * that they are in the right order. Expect the dequeue order as: myData[0],
- * myData[1].
- *
- * @param loopCnt number of elements passed to the for loop
- *
- * @return TC_PASS, TC_FAIL
- *
- * Also updates tcRC when result is TC_FAIL.
- */
-int verifyQueueData(int loopCnt)
-{
- int result = TC_PASS; /* TC_PASS or TC_FAIL for this function */
- int retValue; /* task_fifo_xxx interface return value */
- int locData; /* local variable used for passing data */
-
- /*
- * Counts elements using task_fifo_size_get interface. Dequeues elements from
- * FIFOQ. Test for proper return code when FIFO queue is empty using
- * task_fifo_get interface.
- */
- for (int i = 0; i < loopCnt; i++) {
- /* Counts number of elements */
- retValue = task_fifo_size_get(FIFOQ);
- if (!verifyRetValue(DEPTH_OF_FIFO_QUEUE-i, retValue)) {
- TC_ERROR("i=%d, incorrect number of FIFO elements in queue: %d, expect %d\n"
- , i, retValue, DEPTH_OF_FIFO_QUEUE-i);
- result = TC_FAIL;
- goto exitTest2;
- } else {
- /* TC_PRINT("%s: i=%d, %d elements in queue\n", __func__, i, retValue); */
- }
-
- /* Dequeues element */
- retValue = task_fifo_get(FIFOQ, &locData, TICKS_NONE);
-
- switch (retValue) {
- case RC_OK:
- if ((i >= DEPTH_OF_FIFO_QUEUE) || (locData != myData[i])) {
- TC_ERROR("RC_OK but got wrong data %d for i=%d\n", locData, i);
- result = TC_FAIL;
- goto exitTest2;
- }
-
- TC_PRINT("%s: i=%d, successfully get data %d\n", __func__, i, locData);
- break;
- case RC_FAIL:
- if (i < DEPTH_OF_FIFO_QUEUE) {
- TC_ERROR("RC_FAIL but i is only %d\n", i);
- result = TC_FAIL;
- goto exitTest2;
- }
- TC_PRINT("%s: i=%d, FIFOQ is empty. No data.\n", __func__, i);
- break;
- default:
- TC_ERROR("i=%d, incorrect return value %d\n", i, retValue);
- result = TC_FAIL;
- goto exitTest2;
- } /* switch */
- } /* for */
-
-exitTest2:
-
- if (result == TC_FAIL) {
- tcRC = TC_FAIL;
- }
-
- TC_END_RESULT(result);
- return result;
-
-} /* verifyQueueData */
-
-
-/**
- *
- * @brief Main task to test FIFO queue
- *
- * This routine initializes data, fills the FIFO queue and verifies the
- * data in the queue is in correct order when items are being dequeued.
- * It also tests the wait (with and without timeouts) to put data into
- * queue when the queue is full. The queue is purged at some point
- * and checked to see if the number of elements is correct.
- * The get wait interfaces (with and without timeouts) are also tested
- * and data verified.
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int retValue; /* task_fifo_xxx interface return value */
- int locData; /* local variable used for passing data */
- int result; /* result from utility functions */
-
- TC_START("Test Microkernel FIFO");
-
- initMicroObjects();
-
- /*
- * Checks number of elements in queue, expect 0. Test task_fifo_size_get
- * interface.
- */
- retValue = task_fifo_size_get(FIFOQ);
- if (!verifyRetValue(0, retValue)) {
- TC_ERROR("Incorrect number of FIFO elements in queue: %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
- /*
- * FIFOQ is only two elements deep. Test for proper return code when
- * FIFO queue is full. Test task_fifo_put(TICKS_NONE) interface.
- */
- result = fillFIFO(FIFOQ, NUM_OF_ELEMENT);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed fillFIFO.\n");
- goto exitTest;
- }
-
- /*
- * Checks number of elements in FIFO queue, should be full. Also verifies
- * data is in correct order. Test task_fifo_size_get and task_fifo_get interface.
- */
- result = verifyQueueData(DEPTH_OF_FIFO_QUEUE + 1);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed verifyQueueData.\n");
- goto exitTest;
- }
-
-/*----------------------------------------------------------------------------*/
-
- /* Fill FIFO queue */
- result = fillFIFO(FIFOQ, NUM_OF_ELEMENT);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed fillFIFO.\n");
- goto exitTest;
- }
-
- /*
- * Put myData[4] into queue with wait, test task_fifo_put(timeout)
- * interface. Queue is full, so this data did not make it into queue.
- * Expect return code of RC_TIME.
- */
- TC_PRINT("%s: About to putWT with data %d\n", __func__, myData[4]);
- retValue = task_fifo_put(FIFOQ, &myData[4], 2); /* wait for 2 ticks */
- if (verifyRetValue(RC_TIME, retValue)) {
- TC_PRINT("%s: FIFO Put time out as expected for data %d\n"
- , __func__, myData[4]);
- } else {
- TC_ERROR("Failed task_fifo_put for data %d, retValue %d\n",
- myData[4], retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
- /* Queue is full at this stage. Verify data is correct. */
- result = verifyQueueData(DEPTH_OF_FIFO_QUEUE);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed verifyQueueData.\n");
- goto exitTest;
- }
-
-/*----------------------------------------------------------------------------*/
-
- /* Fill FIFO queue. Check number of elements in queue, should be 2. */
- result = fillFIFO(FIFOQ, NUM_OF_ELEMENT);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed fillFIFO.\n");
- goto exitTest;
- }
-
- retValue = task_fifo_size_get(FIFOQ);
- if (verifyRetValue(DEPTH_OF_FIFO_QUEUE, retValue)) {
- TC_PRINT("%s: %d element in queue\n", __func__, retValue);
- } else {
- TC_ERROR("Incorrect number of FIFO elements in queue: %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
- /*
- * Purge queue, check number of elements in queue. Test task_fifo_purge
- * interface.
- */
- retValue = task_fifo_purge(FIFOQ);
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT("%s: Successfully purged queue\n", __func__);
- } else {
- TC_ERROR("Problem purging queue, %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
- /* Count number of elements in queue */
- retValue = task_fifo_size_get(FIFOQ);
- if (verifyRetValue(0, retValue)) {
- TC_PRINT("%s: confirm %d element in queue\n", __func__, retValue);
- } else {
- TC_ERROR("Incorrect number of FIFO elements in queue: %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
- PRINT_LINE;
-/*----------------------------------------------------------------------------*/
-
- /*
- * Semaphore to allow MicroTestFifoTask to run, but MicroTestFifoTask is lower
- * priority, so it won't run until this current task is blocked
- * in task_fifo_get interface later.
- */
- task_sem_give(SEMSIG_MicroTestFifoTask);
-
- /*
- * Test task_fifo_get interface.
- * Expect MicroTestFifoTask to run and insert SPECIAL_DATA into queue.
- */
- TC_PRINT("%s: About to GetW data\n", __func__);
- retValue = task_fifo_get(FIFOQ, &locData, TICKS_UNLIMITED);
- if ((retValue != RC_OK) || (locData != SPECIAL_DATA)) {
- TC_ERROR("Failed task_fifo_get interface for data %d, retValue %d\n"
- , locData, retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- } else {
- TC_PRINT("%s: GetW get back %d\n", __func__, locData);
- }
-
- /* MicroTestFifoTask may have modified tcRC */
- if (tcRC == TC_FAIL) { /* terminate test */
- TC_ERROR("tcRC failed.");
- goto exitTest;
- }
-
- /*
- * Test task_fifo_get(timeout) interface. Try to get more data, but
- * there is none before it times out.
- */
- retValue = task_fifo_get(FIFOQ, &locData, 2);
- if (verifyRetValue(RC_TIME, retValue)) {
- TC_PRINT("%s: GetWT timeout expected\n", __func__);
- } else {
- TC_ERROR("Failed task_fifo_get interface for retValue %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
-/*----------------------------------------------------------------------------*/
-
- /* Fill FIFO queue */
- result = fillFIFO(FIFOQ, NUM_OF_ELEMENT);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed fillFIFO.\n");
- goto exitTest;
- }
-
- /* Semaphore to allow MicroTestFifoTask to run */
- task_sem_give(SEMSIG_MicroTestFifoTask);
-
- /* MicroTestFifoTask may have modified tcRC */
- if (tcRC == TC_FAIL) { /* terminate test */
- TC_ERROR("tcRC failed.");
- goto exitTest;
- }
-
- /* Queue is full */
- locData = SPECIAL_DATA;
- TC_PRINT("%s: about to putW data %d\n", __func__, locData);
- retValue = task_fifo_put(FIFOQ, &locData, TICKS_UNLIMITED);
-
- /*
- * Execution is switched to MicroTestFifoTask, which will purge the queue.
- * When the queue is purged while other tasks are waiting to put data into
- * queue, the return value will be RC_FAIL.
- */
- if (verifyRetValue(RC_FAIL, retValue)) {
- TC_PRINT("%s: PutW ok when queue is purged while waiting\n", __func__);
- } else {
- TC_ERROR("Failed task_fifo_put interface when queue is purged, retValue %d\n"
- , retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
-/*----------------------------------------------------------------------------*/
-
- /* Fill FIFO queue */
- result = fillFIFO(FIFOQ, NUM_OF_ELEMENT);
- if (result == TC_FAIL) { /* terminate test */
- TC_ERROR("Failed fillFIFO.\n");
- goto exitTest;
- }
-
- /* Semaphore to allow MicroTestFifoTask to run */
- task_sem_give(SEMSIG_MicroTestFifoTask);
-
- /* MicroTestFifoTask may have modified tcRC */
- if (tcRC == TC_FAIL) { /* terminate test */
- TC_ERROR("tcRC failed.");
- goto exitTest;
- }
-
- /* Queue is full */
- TC_PRINT("%s: about to putW data %d\n", __func__, myData[4]);
- retValue = task_fifo_put(FIFOQ, &myData[4], TICKS_UNLIMITED);
- /* Execution is switched to MicroTestFifoTask, which will dequeue one element */
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT("%s: PutW success for data %d\n", __func__, myData[4]);
- } else {
- TC_ERROR("Failed task_fifo_put interface for data %d, retValue %d\n"
- , myData[4], retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- }
-
- PRINT_LINE;
-/*----------------------------------------------------------------------------*/
-
- /*
- * Dequeue all data to check. Expect data in the queue to be:
- * myData[1], myData[4]. myData[0] was dequeued by MicroTestFifoTask.
- */
-
- /* Get first data */
- retValue = task_fifo_get(FIFOQ, &locData, TICKS_NONE);
- if ((retValue != RC_OK) || (locData != myData[1])) {
- TC_ERROR("Get back data %d, retValue %d\n", locData, retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- } else {
- TC_PRINT("%s: Get back data %d\n", __func__, locData);
- }
-
- /* Get second data */
- retValue = task_fifo_get(FIFOQ, &locData, TICKS_NONE);
- if ((retValue != RC_OK) || (locData != myData[4])) {
- TC_ERROR("Get back data %d, retValue %d\n", locData, retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- } else {
- TC_PRINT("%s: Get back data %d\n", __func__, locData);
- }
-
- /* Queue should be empty */
- retValue = task_fifo_get(FIFOQ, &locData, TICKS_NONE);
- if (retValue != RC_FAIL) {
- TC_ERROR("%s: incorrect retValue %d\n", __func__, retValue);
- tcRC = TC_FAIL;
- goto exitTest;
- } else {
- TC_PRINT("%s: queue is empty. Test Done!\n", __func__);
- }
-
- task_sem_take(SEM_TestDone, TICKS_UNLIMITED);
-
-exitTest:
-
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-} /* RegressionTask */
diff --git a/samples/microkernel/test/test_fifo/testcase.ini b/samples/microkernel/test/test_fifo/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_fifo/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_fifo_priv/Makefile b/samples/microkernel/test/test_fifo_priv/Makefile
deleted file mode 100644
index ebf42c725..000000000
--- a/samples/microkernel/test/test_fifo_priv/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR := $(ZEPHYR_BASE)/samples/microkernel/test/test_fifo/src
-# Enable testing for private microkernel FIFOs
-CFLAGS = -DTEST_PRIV_FIFO
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_fifo_priv/README.txt b/samples/microkernel/test/test_fifo_priv/README.txt
deleted file mode 100644
index 670353760..000000000
--- a/samples/microkernel/test/test_fifo_priv/README.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-Title: Private FIFOs
-
-Description:
-
-This test verifies that the microkernel FIFO APIs operate as expected.
-This also verifies the mechanism to define private FIFO and its usage.
-
---------------------------------------------------------------------------------
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel FIFO
-myData[0] = 1,
-myData[1] = 101,
-myData[2] = 201,
-myData[3] = 301,
-myData[4] = 401,
-===================================================================
-PASS - fillFIFO.
-verifyQueueData: i=0, successfully get data 1
-verifyQueueData: i=1, successfully get data 101
-verifyQueueData: i=2, FIFOQ is empty. No data.
-===================================================================
-PASS - verifyQueueData.
-===================================================================
-PASS - fillFIFO.
-RegressionTask: About to putWT with data 401
-RegressionTask: FIFO Put time out as expected for data 401
-verifyQueueData: i=0, successfully get data 1
-verifyQueueData: i=1, successfully get data 101
-===================================================================
-PASS - verifyQueueData.
-===================================================================
-PASS - fillFIFO.
-RegressionTask: 2 element in queue
-RegressionTask: Successfully purged queue
-RegressionTask: confirm 0 element in queue
-===================================================================
-RegressionTask: About to GetW data
-Starts MicroTestFifoTask
-MicroTestFifoTask: Puts element 999
-RegressionTask: GetW get back 999
-MicroTestFifoTask: FIRegressionTask: GetWT timeout expected
-===================================================================
-PASS - fillFIFO.
-RegressionTask: about to putW data 999
-FOPut OK for 999
-MicroTestFifoTask: About to purge queue
-RegressionTask: PutW ok when queue is purged while waiting
-===================================================================
-PASS - fillFIFO.
-RegressionTask: about to putW data 401
-MicroTestFifoTask: Successfully purged queue
-MicroTestFifoTask: About to dequeue 1 element
-RegressionTask: PutW success for data 401
-===================================================================
-RegressionTask: Get back data 101
-RegressionTask: Get back data 401
-RegressionTask: queue is empty. Test Done!
-MicroTestFifoTask: task_fifo_get got back correct data 1
-===================================================================
-PASS - MicroTestFifoTask.
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_fifo_priv/prj.mdef b/samples/microkernel/test/test_fifo_priv/prj.mdef
deleted file mode 100644
index 9aa69b830..000000000
--- a/samples/microkernel/test/test_fifo_priv/prj.mdef
+++ /dev/null
@@ -1,21 +0,0 @@
-% Please keep this in-sync with ../test_fifo/prj.mdef
-% except those specified below
-
-% Application : test microkernel FIFO APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ====================================================
- TASK tStartTask 5 RegressionTask 2048 [EXE]
- TASK helperTask 7 MicroTestFifoTask 2048 [EXE]
-
-% FIFOQ is defined in source code. So keep this
-% commented out.
-%
-% FIFO NAME DEPTH WIDTH
-% ========================
-% FIFO FIFOQ 2 4
-
-% SEMA NAME
-% =============================
- SEMA SEMSIG_MicroTestFifoTask
- SEMA SEM_TestDone
diff --git a/samples/microkernel/test/test_fifo_priv/prj_arm.conf b/samples/microkernel/test/test_fifo_priv/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_fifo_priv/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_fifo_priv/prj_x86.conf b/samples/microkernel/test/test_fifo_priv/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_fifo_priv/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_fifo_priv/testcase.ini b/samples/microkernel/test/test_fifo_priv/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_fifo_priv/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_fp_sharing/Makefile b/samples/microkernel/test/test_fp_sharing/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_fp_sharing/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_fp_sharing/README.txt b/samples/microkernel/test/test_fp_sharing/README.txt
deleted file mode 100644
index 121d265e3..000000000
--- a/samples/microkernel/test/test_fp_sharing/README.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-Title: Shared Floating Point Support
-
-Description:
-
-This test uses two tasks to independently compute pi, while two other tasks
-load and store floating point registers and check for corruption. This tests
-the ability of tasks to safely share floating point hardware resources, even
-when switching occurs preemptively. (Note that both sets of tests run
-concurrently even though they report their progress at different times.)
-
-The demonstration utilizes microkernel mutex APIs, timers, semaphores,
-round robin scheduling, and floating point support.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Floating point sharing tests started
-===================================================================
-Pi calculation OK after 50 (high) + 1 (low) tests (computed 3.141594)
-Load and store OK after 100 (high) + 29695 (low) tests
-Pi calculation OK after 150 (high) + 2 (low) tests (computed 3.141594)
-Load and store OK after 200 (high) + 47593 (low) tests
-Pi calculation OK after 250 (high) + 4 (low) tests (computed 3.141594)
-Load and store OK after 300 (high) + 66674 (low) tests
-Pi calculation OK after 350 (high) + 5 (low) tests (computed 3.141594)
-Load and store OK after 400 (high) + 83352 (low) tests
-Pi calculation OK after 450 (high) + 7 (low) tests (computed 3.141594)
-Load and store OK after 500 (high) + 92290 (low) tests
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_fp_sharing/prj.mdef b/samples/microkernel/test/test_fp_sharing/prj.mdef
deleted file mode 100644
index 62ccc4446..000000000
--- a/samples/microkernel/test/test_fp_sharing/prj.mdef
+++ /dev/null
@@ -1,8 +0,0 @@
-% Application : floating point sharing test
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =======================================================
- TASK load_low 10 load_store_low 2048 [EXE]
- TASK load_high 5 load_store_high 2048 [EXE]
- TASK pi_low 10 calculate_pi_low 2048 [EXE]
- TASK pi_high 5 calculate_pi_high 2048 [EXE]
diff --git a/samples/microkernel/test/test_fp_sharing/prj_x86.conf b/samples/microkernel/test/test_fp_sharing/prj_x86.conf
deleted file mode 100644
index 18375a17f..000000000
--- a/samples/microkernel/test/test_fp_sharing/prj_x86.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG_FLOAT=y
-CONFIG_SSE=y
-CONFIG_FP_SHARING=y
-CONFIG_SSE_FP_MATH=y
-
-CONFIG_STDOUT_CONSOLE=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_fp_sharing/src/Makefile b/samples/microkernel/test/test_fp_sharing/src/Makefile
deleted file mode 100644
index 9e3020465..000000000
--- a/samples/microkernel/test/test_fp_sharing/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y += main.o
-obj-y += pi.o
diff --git a/samples/microkernel/test/test_fp_sharing/src/float_context.h b/samples/microkernel/test/test_fp_sharing/src/float_context.h
deleted file mode 100644
index e4f5d9131..000000000
--- a/samples/microkernel/test/test_fp_sharing/src/float_context.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* float_context.h - common definitions for the FPU sharing test application */
-
-/*
- * Copyright (c) 2011-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _FLOATCONTEXT_H
-#define _FLOATCONTEXT_H
-
-/*
- * Each architecture must define the FP_REG_SET and FP_NONVOLATILE_REG_SET
- * structures, and tailor the architecture specific implementations of
- * _LoadAllFloatRegisters(), _StoreAllFloatRegisters(), and
- * _StoreNonVolatileFloatRegisters() to read/write from these structures.
- */
-
-#if defined(CONFIG_ISA_IA32)
-
-#define FP_OPTION 0
-
-/*
- * In the future, the struct definitions may need to be refined based on the
- * specific IA-32 processor, but for now only the Pentium4 is supported.
- *
- * There exists 8 x 80 bit floating point registers (ST[0] -> ST[7]) and
- * 8 * 128 bit XMM registers (XMM[0] -> XMM[7]). All of these registers are
- * considered volatile across a function invocation.
- */
-
-/* a single x87 FPU register in double extended format (80 bits) */
-
-typedef struct fpReg {
- unsigned char reg[10];
-} FP_REG;
-
-/* a single XMM register (128 bits) */
-
-typedef struct xmmReg {
- unsigned char reg[16];
-} XMM_REG;
-
-/* the set of volatile floating point registers */
-
-typedef struct fpVolatileRegSet {
- XMM_REG xmmRegs[8]; /* XMM[0] -> XMM[7] */
- FP_REG fpRegs[8]; /* ST[0] -> ST[7] */
-} FP_VOLATILE_REG_SET;
-
-/* the set of non-volatile floating point registers */
-
-typedef struct fpNonVolatileRegSet {
- /* this structure has been intentionally left blank */
-} FP_NONVOLATILE_REG_SET;
-
-#define SIZEOF_FP_VOLATILE_REG_SET sizeof(FP_VOLATILE_REG_SET)
-#define SIZEOF_FP_NONVOLATILE_REG_SET 0
-
-
-#else /* ! CONFIG_ISA_IA32 */
-
-#error Architecture needs to provide a definition for 'struct fpRegSet' \
-and 'struct fpNonVolatileRegSet'
-#endif /* CONFIG_ISA_IA32 */
-
-/* the set of ALL floating point registers */
-
-typedef struct fpRegSet {
- FP_VOLATILE_REG_SET fpVolRegSet;
- FP_NONVOLATILE_REG_SET fpNonVolRegSet;
-} FP_REG_SET;
-
-#define SIZEOF_FP_REG_SET \
- (SIZEOF_FP_VOLATILE_REG_SET + SIZEOF_FP_NONVOLATILE_REG_SET)
-
-/*
- * The following constants define the initial byte value used by the background
- * task, and the fiber when loading up the floating point registers.
- */
-
-#define MAIN_FLOAT_REG_CHECK_BYTE (unsigned char)0xe5
-#define FIBER_FLOAT_REG_CHECK_BYTE (unsigned char)0xf9
-
-void _StoreNonVolatileFloatRegisters(FP_NONVOLATILE_REG_SET *pToBuffer);
-
-extern int fpu_sharing_error;
-
-#endif /* _FLOATRCONTEXT_H */
diff --git a/samples/microkernel/test/test_fp_sharing/src/float_regs_x86_gcc.h b/samples/microkernel/test/test_fp_sharing/src/float_regs_x86_gcc.h
deleted file mode 100644
index 834d9e887..000000000
--- a/samples/microkernel/test/test_fp_sharing/src/float_regs_x86_gcc.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Intel x86 GCC specific floating point register macros */
-
-/*
- * Copyright (c) 2015, Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _FLOAT_REGS_X86_GCC_H
-#define _FLOAT_REGS_X86_GCC_H
-
-#if !defined(__GNUC__) || !defined(CONFIG_ISA_IA32)
-#error test_asm_inline_gcc.h goes only with x86 GCC
-#endif
-
-#include <toolchain.h>
-#include "float_context.h"
-
-/**
- *
- * @brief Load all floating point registers
- *
- * This function loads ALL floating point registers from the memory buffer
- * specified by <pFromBuffer>. It is expected that a subsequent call to
- * _StoreAllFloatRegisters() will be issued to dump the floating point registers
- * to memory.
- *
- * The format/organization of the FP_REG_SET structure is not important; the
- * generic C test code (main.c and fiber.c) merely treat the FP_REG_SET
- * (and FP_NONVOLATILE_REG_SET) as an array of bytes.
- *
- * The only requirement is that the arch specific implementations of
- * _LoadAllFloatRegisters(), _StoreAllFloatRegisters(), and
- * _LoadThenStoreAllFloatRegisters agree on the format.
- *
- * @return N/A
- */
-
-static inline void _LoadAllFloatRegisters(FP_REG_SET *pFromBuffer)
-{
- /*
- * The 'movdqu' is the "move double quad unaligned" instruction: Move
- * a double quadword (16 bytes) between memory and an XMM register (or
- * between a pair of XMM registers). The memory destination/source operand
- * may be unaligned on a 16-byte boundary without causing an exception.
- *
- * The 'fldt' is the "load floating point value" instruction: Push an 80-bit
- * (double extended-precision) onto the FPU register stack.
- *
- * A note about operand size specification in the AT&T assembler syntax:
- *
- * Instructions are generally suffixed with the a letter or a pair of
- * letters to specify the operand size:
- *
- * b = byte (8 bit)
- * s = short (16 bit integer) or single (32-bit floating point)
- * w = word (16 bit)
- * l = long (32 bit integer or 64-bit floating point)
- * q = quad (64 bit)
- * t = ten bytes (80-bit floating point)
- * dq = double quad (128 bit)
- */
-
- __asm__ volatile (
- "movdqu 0(%0), %%xmm0\n\t;"
- "movdqu 16(%0), %%xmm1\n\t;"
- "movdqu 32(%0), %%xmm2\n\t;"
- "movdqu 48(%0), %%xmm3\n\t;"
- "movdqu 64(%0), %%xmm4\n\t;"
- "movdqu 80(%0), %%xmm5\n\t;"
- "movdqu 96(%0), %%xmm6\n\t;"
- "movdqu 112(%0), %%xmm7\n\t;"
-
- "fldt 128(%0)\n\t;"
- "fldt 138(%0)\n\t;"
- "fldt 148(%0)\n\t;"
- "fldt 158(%0)\n\t;"
- "fldt 168(%0)\n\t;"
- "fldt 178(%0)\n\t;"
- "fldt 188(%0)\n\t;"
- "fldt 198(%0)\n\t;"
-
- :: "r" (pFromBuffer)
- );
-}
-
-
-/**
- *
- * @brief Load then dump all float registers to memory
- *
- * This function loads ALL floating point registers from the memory buffer
- * specified by <pFromToBuffer>, and then stores them back to that buffer.
- *
- * This routine is called by a high priority thread prior to calling a primitive
- * that pends and triggers a co-operative context switch to a low priority
- * thread. Because the kernel doesn't save floating point context for
- * co-operative context switches, the x87 FPU register stack must be put back
- * in an empty state before the switch occurs in case the next task to perform
- * floating point operations was also co-operatively switched out and simply
- * inherits the existing x87 FPU state (expecting the stack to be empty).
- *
- * @return N/A
- */
-
-static inline void _LoadThenStoreAllFloatRegisters(FP_REG_SET *pFromToBuffer)
-{
- __asm__ volatile (
- "movdqu 0(%0), %%xmm0\n\t;"
- "movdqu 16(%0), %%xmm1\n\t;"
- "movdqu 32(%0), %%xmm2\n\t;"
- "movdqu 48(%0), %%xmm3\n\t;"
- "movdqu 64(%0), %%xmm4\n\t;"
- "movdqu 80(%0), %%xmm5\n\t;"
- "movdqu 96(%0), %%xmm6\n\t;"
- "movdqu 112(%0), %%xmm7\n\t;"
-
- "fldt 128(%0)\n\t;"
- "fldt 138(%0)\n\t;"
- "fldt 148(%0)\n\t;"
- "fldt 158(%0)\n\t;"
- "fldt 168(%0)\n\t;"
- "fldt 178(%0)\n\t;"
- "fldt 188(%0)\n\t;"
- "fldt 198(%0)\n\t;"
-
- /* pop the x87 FPU registers back to memory */
-
- "fstpt 198(%0)\n\t;"
- "fstpt 188(%0)\n\t;"
- "fstpt 178(%0)\n\t;"
- "fstpt 168(%0)\n\t;"
- "fstpt 158(%0)\n\t;"
- "fstpt 148(%0)\n\t;"
- "fstpt 138(%0)\n\t;"
- "fstpt 128(%0)\n\t;"
-
- :: "r" (pFromToBuffer)
- );
-}
-
-
-/**
- *
- * @brief Dump all floating point registers to memory
- *
- * This function stores ALL floating point registers to the memory buffer
- * specified by <pToBuffer>. It is expected that a previous invocation of
- * _LoadAllFloatRegisters() occurred to load all the floating point registers
- * from a memory buffer.
- *
- * @return N/A
- */
-
-static inline void _StoreAllFloatRegisters(FP_REG_SET *pToBuffer)
-{
- __asm__ volatile (
- "movdqu %%xmm0, 0(%0)\n\t;"
- "movdqu %%xmm1, 16(%0)\n\t;"
- "movdqu %%xmm2, 32(%0)\n\t;"
- "movdqu %%xmm3, 48(%0)\n\t;"
- "movdqu %%xmm4, 64(%0)\n\t;"
- "movdqu %%xmm5, 80(%0)\n\t;"
- "movdqu %%xmm6, 96(%0)\n\t;"
- "movdqu %%xmm7, 112(%0)\n\t;"
-
- "fstpt 198(%0)\n\t;"
- "fstpt 188(%0)\n\t;"
- "fstpt 178(%0)\n\t;"
- "fstpt 168(%0)\n\t;"
- "fstpt 158(%0)\n\t;"
- "fstpt 148(%0)\n\t;"
- "fstpt 138(%0)\n\t;"
- "fstpt 128(%0)\n\t;"
-
- :: "r" (pToBuffer) : "memory"
- );
-}
-
-/**
- *
- * @brief Dump non-volatile FP registers to memory
- *
- * This routine is called by a high priority thread after resuming execution
- * from calling a primitive that will pend and thus result in a co-operative
- * context switch to a low priority thread.
- *
- * Only the non-volatile floating point registers are expected to survive across
- * a function call, regardless of whether the call results in the thread being
- * pended.
- *
- * @return N/A
- */
-
-void _StoreNonVolatileFloatRegisters(FP_NONVOLATILE_REG_SET *pToBuffer)
-{
- ARG_UNUSED(pToBuffer);
- /* do nothing; there are no non-volatile floating point registers */
-}
-#endif /* _FLOAT_REGS_X86_GCC_H */
diff --git a/samples/microkernel/test/test_fp_sharing/src/main.c b/samples/microkernel/test/test_fp_sharing/src/main.c
deleted file mode 100644
index 0a5b36a7b..000000000
--- a/samples/microkernel/test/test_fp_sharing/src/main.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* main.c - load/store portion of FPU sharing test */
-
-/*
- * Copyright (c) 2011-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module implements the load/store portion of the FPU sharing test. This
-microkernel version of this test utilizes a pair of tasks, while the nanokernel
-verions utilizes a task and a fiber.
-
-The load/store test validates the nanokernel's floating point unit context
-save/restore mechanism. (For the IA-32 architecture this includes the x87 FPU
-(MMX) registers and the XMM registers.) This test utilizes a pair of threads
-of different priorities that each use the floating point registers. The context
-switching that occurs exercises the kernel's ability to properly preserve the
-floating point registers. The test also exercises the kernel's ability to
-automatically enable floating point support for a task, if supported.
-
-FUTURE IMPROVEMENTS
-On architectures where the non-integer capabilities are provided in a hierarchy,
-for example on IA-32 the USE_FP and USE_SSE options are provided, this test
-should be enhanced to ensure that the architectures' _Swap() routine doesn't
-context switch more registers that it needs to (which would represent a
-performance issue). For example, on the IA-32, the test should issue
-a nanoCpuFpDisable() from main(), and then indicate that only x87 FPU
-registers will be utilized (nanoCpuFpEnable). The fiber should continue
-to load ALL non-integer registers, but main() should validate that only the
-x87 FPU registers are being saved/restored.
- */
-
-#if defined(CONFIG_ISA_IA32)
-#ifndef CONFIG_FLOAT
-#error Rebuild the nanokernel with the FLOAT config option enabled
-#endif
-
-#ifndef CONFIG_SSE
-#error Rebuild the nanokernel with the SSE config option enabled
-#endif
-
-#ifndef CONFIG_FP_SHARING
-#error Rebuild the nanokernel with the FP_SHARING config option enabled
-#endif
-
-#endif /* CONFIG_ISA_IA32 */
-
-
-#include <zephyr.h>
-
-#if defined(__GNUC__)
-#include <float_regs_x86_gcc.h>
-#else
-#include <float_regs_x86_other.h>
-#endif /* __GNUC__ */
-
-#include <arch/cpu.h>
-#include <tc_util.h>
-#include "float_context.h"
-#include <stddef.h>
-#include <string.h>
-
-#ifndef MAX_TESTS
-/* test duration, unless overridden by project builder (0 => run forever) */
-#define MAX_TESTS 500
-#endif
-
-/* macro used to read system clock value */
-
-#define TICK_COUNT_GET() sys_tick_get_32()
-
-/* space for float register load/store area used by low priority task */
-
-static FP_REG_SET floatRegSetLoad;
-static FP_REG_SET floatRegSetStore;
-
-/* space for float register load/store area used by high priority thread */
-
-static FP_REG_SET floatRegisterSet;
-
-
-#ifdef CONFIG_NANOKERNEL
-/* stack for high priority fiber (also use .bss for floatRegisterSet) */
-
-static char __stack fiberStack[1024];
-
-static struct nano_timer fiberTimer;
-static void *dummyTimerData; /* allocate just enough room for a pointer */
-#endif
-
-/* flag indicating that an error has occurred */
-
-int fpu_sharing_error;
-
-/*
- * Test counters are "volatile" because GCC may not update them properly
- * otherwise. (See description of pi calculation test for more details.)
- */
-
-static volatile unsigned int load_store_low_count = 0;
-static volatile unsigned int load_store_high_count = 0;
-
-/**
- *
- * main -
- * @brief Low priority FPU load/store thread
- *
- * @return N/A
- */
-
-#ifdef CONFIG_NANOKERNEL
-void main(void)
-#else
-void load_store_low(void)
-#endif
-{
- unsigned int bufIx;
- unsigned char floatRegInitByte;
- unsigned char *floatRegSetStorePtr = (unsigned char *)&floatRegSetStore;
-
- volatile char volatileStackVar;
-
- PRINT_DATA("Floating point sharing tests started\n");
- PRINT_LINE;
-
-#if defined(CONFIG_FP_SHARING)
- /*
- * No need to invoke task_float_enable() since
- * FP_SHARING is in effect
- */
-#else /* ! CONFIG_FP_SHARING */
-#if defined(CONFIG_FLOAT)
- task_float_enable(sys_thread_self_get());
-#endif
-#endif /* CONFIG_FP_SHARING */
-
-#ifdef CONFIG_NANOKERNEL
- /*
- * Start a single fiber which will regularly preempt the background
- * task, and perform similiar floating point register manipulations
- * that the background task performs; except that a different constant
- * is loaded into the floating point registers.
- */
-
- extern void load_store_high(int regFillValue, int unused);
-
- task_fiber_start(fiberStack,
- sizeof(fiberStack),
- load_store_high,
- 0, /* arg1 */
- 0, /* arg2 */
- 5, /* priority */
- FP_OPTION /* options */
- );
-#elif defined(CONFIG_MICROKERNEL)
- /*
- * For microkernel builds, preemption tasks are specified in the .mdef file.
- *
- * Enable round robin scheduling to allow both the low priority pi
- * computation and load/store tasks to execute. The high priority pi
- * computation and load/store tasks will preempt the low priority tasks
- * periodically.
- */
-
- sys_scheduler_time_slice_set(1, 10);
-#endif /* CONFIG_NANOKERNEL */
-
- /*
- * Initialize floating point load buffer to known values;
- * these values must be different than the value used in other threads.
- */
-
- floatRegInitByte = MAIN_FLOAT_REG_CHECK_BYTE;
- for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx) {
- ((unsigned char *)&floatRegSetLoad)[bufIx] = floatRegInitByte++;
- }
-
- /* Keep cranking forever, or until an error is detected. */
-
- for (load_store_low_count = 0; ; load_store_low_count++) {
-
- /*
- * Clear store buffer to erase all traces of any previous
- * floating point values that have been saved.
- */
-
- memset(&floatRegSetStore, 0, SIZEOF_FP_REG_SET);
-
- /*
- * Utilize an architecture specific function to load all the floating
- * point (and XMM on IA-32) registers with known values.
- */
-
- _LoadAllFloatRegisters(&floatRegSetLoad);
-
- /*
- * Waste some cycles to give the high priority load/store thread
- * an opportunity to run when the low priority thread is using the
- * floating point registers.
- *
- * IMPORTANT: This logic requires that TICK_COUNT_GET() not perform
- * any floating point operations!
- */
-
- while ((TICK_COUNT_GET() % 5) != 0) {
- /*
- * Use a volatile variable to prevent compiler optimizing
- * out the spin loop.
- */
- ++volatileStackVar;
- }
-
- /*
- * Utilize an architecture specific function to dump the contents
- * of all floating point (and XMM on IA-32) register to memory.
- */
-
- _StoreAllFloatRegisters(&floatRegSetStore);
-
- /*
- * Compare each byte of buffer to ensure the expected value is
- * present, indicating that the floating point registers weren't
- * impacted by the operation of the high priority thread(s).
- *
- * Display error message and terminate if discrepancies are detected.
- */
-
- floatRegInitByte = MAIN_FLOAT_REG_CHECK_BYTE;
-
- for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx) {
- if (floatRegSetStorePtr[bufIx] != floatRegInitByte) {
- TC_ERROR("load_store_low found 0x%x instead of 0x%x"
- " @ offset 0x%x\n",
- floatRegSetStorePtr[bufIx], floatRegInitByte, bufIx);
- TC_ERROR("Discrepancy found during iteration %d\n",
- load_store_low_count);
- fpu_sharing_error = 1;
- }
- floatRegInitByte++;
- }
-
- /*
- * Terminate if a test error has been reported.
- */
-
- if (fpu_sharing_error) {
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
-
-#if defined(CONFIG_FP_SHARING)
- /*
- * After every 1000 iterations (arbitrarily chosen), explicitly
- * disable floating point operations for the task. The subsequent
- * execution of _LoadAllFloatRegisters() will result in an exception
- * to automatically re-enable floating point support for the task.
- *
- * The purpose of this part of the test is to exercise the
- * task_float_disable() API, and to also continue exercising the
- * (exception based) floating enabling mechanism.
- */
- if ((load_store_low_count % 1000) == 0) {
-#if defined(CONFIG_FLOAT)
- task_float_disable(sys_thread_self_get());
-#endif
- }
-#endif /* CONFIG_FP_SHARING */
- }
-}
-
-/**
- *
- * @brief High priority FPU load/store thread
- *
- * @return N/A
- */
-
-#ifdef CONFIG_NANOKERNEL
-void load_store_high(int unused1, int unused2)
-#else
-void load_store_high(void)
-#endif
-{
- unsigned int bufIx;
- unsigned char floatRegInitByte;
-#if !defined(CONFIG_ISA_IA32)
- unsigned int numNonVolatileBytes;
-#endif /* !CONFIG_ISA_IA32 */
- unsigned char *floatRegisterSetBytePtr =
- (unsigned char *)&floatRegisterSet;
-
-#ifdef CONFIG_NANOKERNEL
- ARG_UNUSED(unused1);
- ARG_UNUSED(unused2);
-
- /* initialize timer; data field is not used */
-
- nano_timer_init(&fiberTimer, (void *)dummyTimerData);
-#endif
-
- /* test until the specified time limit, or until an error is detected */
-
- while (1) {
- /*
- * Initialize the floatRegisterSet structure by treating it as a simple
- * array of bytes (the arrangement and actual number of registers is
- * not important for this generic C code). The structure is
- * initialized by using the byte value specified by the constant
- * FIBER_FLOAT_REG_CHECK_BYTE, and then incrementing the value for each
- * successive location in the floatRegisterSet structure.
- *
- * The initial byte value, and thus the contents of the entire
- * floatRegisterSet structure, must be different for each thread to
- * effectively test the nanokernel's ability to properly save/restore
- * the floating point values during a context switch.
- */
-
- floatRegInitByte = FIBER_FLOAT_REG_CHECK_BYTE;
-
- for (bufIx = 0; bufIx < SIZEOF_FP_REG_SET; ++bufIx) {
- floatRegisterSetBytePtr[bufIx] = floatRegInitByte++;
- }
-
- /*
- * Utilize an architecture specific function to load all the floating
- * point (and XMM on IA-32) registers with the contents of
- * the floatRegisterSet structure.
- *
- * The goal of the loading all floating point registers with values
- * that differ from the values used in other threads is to help
- * determine whether the floating point register save/restore mechanism
- * in the nanokernel's context switcher is operating correctly.
- *
- * When a subsequent nano_fiber_timer_test() invocation is performed, a
- * (cooperative) context switch back to the preempted task will occur.
- * This context switch should result in restoring the state of the
- * task's floating point registers when the task was swapped out due
- * to the occurence of the timer tick.
- */
-
-#if defined(CONFIG_ISA_IA32)
- _LoadThenStoreAllFloatRegisters(&floatRegisterSet);
-#endif
-
- /*
- * Relinquish the processor for the remainder of the current system
- * clock tick, so that lower priority threads get a chance to run.
- *
- * This exercises the ability of the nanokernel to restore the FPU
- * state of a low priority thread _and_ the ability of the nanokernel
- * to provide a "clean" FPU state to this thread once the sleep ends.
- */
-
-#ifdef CONFIG_NANOKERNEL
- nano_fiber_timer_start(&fiberTimer, 1);
- nano_fiber_timer_test(&fiberTimer, TICKS_UNLIMITED);
-#else
- task_sleep(1);
-#endif
-
- /* periodically issue progress report */
-
- if ((++load_store_high_count % 100) == 0) {
- PRINT_DATA("Load and store OK after %u (high) + %u (low) tests\n",
- load_store_high_count, load_store_low_count);
- }
-
-#if (MAX_TESTS != 0)
- /* terminate testing if specified limit has been reached */
-
- if (load_store_high_count == MAX_TESTS) {
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
- return;
- }
-#endif
- }
-}
diff --git a/samples/microkernel/test/test_fp_sharing/src/pi.c b/samples/microkernel/test/test_fp_sharing/src/pi.c
deleted file mode 100644
index b561a38ab..000000000
--- a/samples/microkernel/test/test_fp_sharing/src/pi.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* pi.c - pi computation portion of FPU sharing test */
-
-/*
- * Copyright (c) 2011-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module is used for the microkernel version of the FPU sharing test,
-and supplements the basic load/store test by incorporating two additional
-threads that utilize the floating point unit.
-
-Testing utilizes a pair of tasks that independently compute pi. The lower
-priority task is regularly preempted by the higher priority task, thereby
-testing whether floating point context information is properly preserved.
-
-The following formula is used to compute pi:
-
- pi = 4 * (1 - 1/3 + 1/5 - 1/7 + 1/9 - ... )
-
-This series converges to pi very slowly. For example, performing 50,000
-iterations results in an accuracy of 3 decimal places.
-
-A reference value of pi is computed once at the start of the test. All
-subsequent computations must produce the same value, otherwise an error
-has occurred.
- */
-
-#include <zephyr.h>
-
-#ifdef CONFIG_MICROKERNEL
-#include <stdio.h>
-#include <tc_util.h>
-
-#include <float_context.h>
-
-#define PI_NUM_ITERATIONS 700000
-
-static double reference_pi = 0.0f;
-
-/*
- * Test counters are "volatile" because GCC wasn't properly updating
- * calc_pi_low_count properly when calculate_pi_low() contained a "return"
- * in its error handling logic -- the value was incremented in a register,
- * but never written back to memory. (Seems to be a compiler bug!)
- */
-
-static volatile unsigned int calc_pi_low_count = 0;
-static volatile unsigned int calc_pi_high_count = 0;
-
-/**
- *
- * @brief Entry point for the low priority pi compute task
- *
- * @return N/A
- */
-
-void calculate_pi_low(void)
-{
- volatile double pi; /* volatile to avoid optimizing out of loop */
- double divisor = 3.0;
- double sign = -1.0;
- unsigned int ix;
-
- /* loop forever, unless an error is detected */
-
- while (1) {
-
- sign = -1.0;
- pi = 1.0;
- divisor = 3.0;
-
- for (ix = 0; ix < PI_NUM_ITERATIONS; ix++) {
- pi += sign / divisor;
- divisor += 2.0;
- sign *= -1.0;
- }
-
- pi *= 4;
-
- if (reference_pi == 0.0f) {
- reference_pi = pi;
- } else if (reference_pi != pi) {
- TC_ERROR("Computed pi %1.6f, reference pi %1.6f\n",
- pi, reference_pi);
- fpu_sharing_error = 1;
- return;
- }
-
- ++calc_pi_low_count;
- }
-}
-
-/**
- *
- * @brief Entry point for the high priority pi compute task
- *
- * @return N/A
- */
-
-void calculate_pi_high(void)
-{
- volatile double pi; /* volatile to avoid optimizing out of loop */
- double divisor = 3.0;
- double sign = -1.0;
- unsigned int ix;
-
- /* loop forever, unless an error is detected */
-
- while (1) {
-
- sign = -1.0;
- pi = 1.0;
- divisor = 3.0;
-
- for (ix = 0; ix < PI_NUM_ITERATIONS; ix++) {
- pi += sign / divisor;
- divisor += 2.0;
- sign *= -1.0;
- }
-
- /*
- * Relinquish the processor for the remainder of the current system
- * clock tick, so that lower priority threads get a chance to run.
- *
- * This exercises the ability of the nanokernel to restore the FPU
- * state of a low priority thread _and_ the ability of the nanokernel
- * to provide a "clean" FPU state to this thread once the sleep ends.
- */
-
- task_sleep(1);
-
- pi *= 4;
-
- if (reference_pi == 0.0f) {
- reference_pi = pi;
- } else if (reference_pi != pi) {
- TC_ERROR("Computed pi %1.6f, reference pi %1.6f\n",
- pi, reference_pi);
- fpu_sharing_error = 1;
- return;
- }
-
- /* periodically issue progress report */
-
- if ((++calc_pi_high_count % 100) == 50) {
- printf("Pi calculation OK after %u (high) + %u (low) tests "
- "(computed %1.6f)\n",
- calc_pi_high_count, calc_pi_low_count, pi);
- }
- }
-}
-
-#endif /* CONFIG_MICROKERNEL */
diff --git a/samples/microkernel/test/test_libs/Makefile b/samples/microkernel/test/test_libs/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_libs/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_libs/README.txt b/samples/microkernel/test/test_libs/README.txt
deleted file mode 100644
index 3250b63b3..000000000
--- a/samples/microkernel/test/test_libs/README.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-Title: Kernel Access to Standard Libraries
-
-Description:
-
-This test verifies kernel access to the standard C libraries.
-It is intended to catch issues in which a library is completely absent
-or non-functional, and is NOT intended to be a comprehensive test suite
-of all functionality provided by the libraries.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting standard libraries tests
-===================================================================
-Validating access to supported libraries
-Testing ctype.h library ...
-Testing inttypes.h library ...
-Testing iso646.h library ...
-Testing limits.h library ...
-Testing stdbool.h library ...
-Testing stddef.h library ...
-Testing stdint.h library ...
-Testing string.h library ...
-Validation complete
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_libs/prj.mdef b/samples/microkernel/test/test_libs/prj.mdef
deleted file mode 100644
index ef76ef1da..000000000
--- a/samples/microkernel/test/test_libs/prj.mdef
+++ /dev/null
@@ -1,11 +0,0 @@
-% Application : test standard libraries
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK MONITORTASK 4 MonitorTaskEntry 2048 [EXE]
- TASK tStartTask 5 RegressionTaskEntry 2048 [EXE]
-
-% SEMA NAME
-% =================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
diff --git a/samples/microkernel/test/test_libs/prj_arm.conf b/samples/microkernel/test/test_libs/prj_arm.conf
deleted file mode 100644
index 9df657136..000000000
--- a/samples/microkernel/test/test_libs/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-# use default configuration settings
diff --git a/samples/microkernel/test/test_libs/prj_x86.conf b/samples/microkernel/test/test_libs/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_libs/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_libs/src/Makefile b/samples/microkernel/test/test_libs/src/Makefile
deleted file mode 100644
index 376866e97..000000000
--- a/samples/microkernel/test/test_libs/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = libraries.o
-obj-y += main.o
diff --git a/samples/microkernel/test/test_libs/src/libraries.c b/samples/microkernel/test/test_libs/src/libraries.c
deleted file mode 100644
index 60017da21..000000000
--- a/samples/microkernel/test/test_libs/src/libraries.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/* libraries.c - test access to the minimal C libraries */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module verifies that the various minimal C libraries can be used.
-
-IMPORTANT: The module only ensures that each supported library is present,
-and that a bare minimum of its functionality is operating correctly. It does
-NOT guarantee that ALL standards-defined functionality is present, nor does
-it guarantee that ALL functionality provided is working correctly.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-
-#include <limits.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-/*
- * variables used during limits library testing; must be marked as "volatile"
- * to prevent compiler from computing results at compile time
- */
-
-volatile long longMax = LONG_MAX;
-volatile long longOne = 1L;
-
-/**
- *
- * @brief Test implementation-defined constants library
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int limitsTest(void)
-{
- TC_PRINT("Testing limits.h library ...\n");
-
- if (longMax + longOne != LONG_MIN) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test boolean types and values library
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int stdboolTest(void)
-{
- TC_PRINT("Testing stdbool.h library ...\n");
-
- if ((true != 1) || (false != 0)) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/*
- * variables used during stddef library testing; must be marked as "volatile"
- * to prevent compiler from computing results at compile time
- */
-
-volatile long longVariable;
-volatile size_t sizeOfLongVariable = sizeof(longVariable);
-
-/**
- *
- * @brief Test standard type definitions library
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int stddefTest(void)
-{
- TC_PRINT("Testing stddef.h library ...\n");
-
- if (sizeOfLongVariable != 4) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/*
- * variables used during stdint library testing; must be marked as "volatile"
- * to prevent compiler from computing results at compile time
- */
-
-volatile uint8_t unsignedByte = 0xff;
-volatile uint32_t unsignedInt = 0xffffff00;
-
-/**
- *
- * @brief Test integer types library
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int stdintTest(void)
-{
- TC_PRINT("Testing stdint.h library ...\n");
-
- if (unsignedInt + unsignedByte + 1u != 0) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/*
- * variables used during string library testing
- */
-
-#define BUFSIZE 10
-
-char buffer[BUFSIZE];
-
-/**
- *
- * @brief Test string memset
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int memset_test(void)
-{
- TC_PRINT("\tmemset ...\t");
-
- memset(buffer, 'a', BUFSIZE);
- if (buffer[0] != 'a' || buffer[BUFSIZE-1] != 'a') {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("passed\n");
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test string length function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int strlen_test(void)
-{
- TC_PRINT("\tstrlen ...\t");
-
- memset(buffer, '\0', BUFSIZE);
- memset(buffer, 'b', 5); /* 5 is BUFSIZE / 2 */
- if (strlen(buffer) != 5) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("passed\n");
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test string compare function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int strcmp_test(void)
-{
- strcpy(buffer, "eeeee");
-
- TC_PRINT("\tstrcmp less ...\t");
- if (strcmp(buffer, "fffff") >= 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- } else {
- TC_PRINT("passed\n");
- }
-
- TC_PRINT("\tstrcmp equal ...\t");
- if (strcmp(buffer, "eeeee") != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- } else {
- TC_PRINT("passed\n");
- }
-
- TC_PRINT("\tstrcmp greater ...\t");
- if (strcmp(buffer, "ddddd") <= 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- } else {
- TC_PRINT("passed\n");
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test string N compare function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int strncmp_test(void)
-{
- strncpy(buffer, "eeeeeeeeeeee", BUFSIZE);
-
- TC_PRINT("\tstrncmp 0 ...\t");
- if (strncmp(buffer, "fffff", 0) != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- } else {
- TC_PRINT("passed\n");
- }
-
- TC_PRINT("\tstrncmp 3 ...\t");
- if (strncmp(buffer, "eeeff", 3) != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- } else {
- TC_PRINT("passed\n");
- }
-
- TC_PRINT("\tstrncmp 10 ...\t");
- if (strncmp(buffer, "eeeeeeeeeeeff", BUFSIZE) != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- } else {
- TC_PRINT("passed\n");
- }
-
- return TC_PASS;
-}
-
-
-/**
- *
- * @brief Test string copy function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int strcpy_test(void)
-{
- TC_PRINT("\tstrcpy ...\t");
-
- memset(buffer, '\0', BUFSIZE);
- strcpy(buffer, "10 chars!!\0");
-
- if (strcmp(buffer, "10 chars!!\0") != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("passed\n");
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test string N copy function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int strncpy_test(void)
-{
- TC_PRINT("\tstrncpy ...\t");
-
- memset(buffer, '\0', BUFSIZE);
- strncpy(buffer, "This is over 10 characters", BUFSIZE);
-
- /* Purposely different values */
- if (strncmp(buffer, "This is over 20 characters", BUFSIZE) != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("passed\n");
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test string scanning function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int strchr_test(void)
-{
- char *rs = NULL;
- TC_PRINT("\tstrchr ...\t");
-
- memset(buffer, '\0', BUFSIZE);
- strncpy(buffer, "Copy 10", BUFSIZE);
-
- rs = strchr(buffer, '1');
-
- if (!rs) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- if (strncmp(rs, "10", 2) != 0) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("passed\n");
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test memory comparison function
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int memcmp_test(void)
-{
- unsigned char m1[5] = { 1, 2, 3, 4, 5 };
- unsigned char m2[5] = { 1, 2, 3, 4, 6 };
-
- TC_PRINT("\tmemcmp ...\t");
-
- if (memcmp(m1, m2, 4)) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- if (!memcmp(m1, m2, 5)) {
- TC_PRINT("failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("passed\n");
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test string operations library
- * * @return TC_PASS or TC_FAIL
- */
-
-int stringTest(void)
-{
- TC_PRINT("Testing string.h library ...\n");
-
- if (memset_test() || strlen_test() || strcmp_test() || strcpy_test() ||
- strncpy_test() || strncmp_test() || strchr_test() ||
- memcmp_test()) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Main task in the test suite
- *
- * This is the entry point to the main task used by the standard libraries test
- * suite. It tests each library in turn until a failure is detected or all
- * libraries have been tested successfully.
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int RegressionTask(void)
-{
- TC_PRINT("Validating access to supported libraries\n");
-
- if (limitsTest() || stdboolTest() || stddefTest() ||
- stdintTest() || stringTest()) {
- TC_PRINT("Library validation failed\n");
- return TC_FAIL;
- }
-
- TC_PRINT("Validation complete\n");
- return TC_PASS;
-}
diff --git a/samples/microkernel/test/test_libs/src/main.c b/samples/microkernel/test/test_libs/src/main.c
deleted file mode 100644
index 366555457..000000000
--- a/samples/microkernel/test/test_libs/src/main.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* main.c - test access to standard libraries */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module contains the entry points for the tasks used by the standard
-libraries test application.
-
-Each test task entry point invokes a test routine that returns a success/failure
-indication, then gives a corresponding semaphore. An additional task monitors
-these semaphores until it detects a failure or the completion of all test tasks,
-then announces the result of the test.
-
-NOTE: At present only a single test task is used, but more tasks may be added
-in the future to enhance test coverage.
- */
-
-#include <tc_util.h>
-#include <zephyr.h>
-
-#include <util_test_common.h>
-
-#define NUM_TEST_TASKS 1 /* # of test tasks to monitor */
-
-/* # ticks to wait for test completion */
-#define TIMEOUT (60 * sys_clock_ticks_per_sec)
-
-/*
- * Note that semaphore group entries are arranged so that resultSems[TC_PASS]
- * refers to SEM_TASKDONE and resultSems[TC_FAIL] refers to SEM_TASKFAIL.
- */
-
-static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
-
-/**
- *
- * @brief Entry point for RegressionTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * RegressionTask.
- *
- * @return N/A
- */
-
-void RegressionTaskEntry(void)
-{
- extern int RegressionTask(void);
-
- task_sem_give(resultSems[RegressionTask()]);
-}
-
-/**
- *
- * @brief Entry point for MonitorTask
- *
- * This routine keeps tabs on the progress of the tasks doing the actual testing
- * and generates the final test case summary message.
- *
- * @return N/A
- */
-
-void MonitorTaskEntry(void)
-{
- ksem_t result;
- int tasksDone;
-
- PRINT_DATA("Starting standard libraries tests\n");
- PRINT_LINE;
-
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
-
- for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take(resultSems, TIMEOUT);
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
- }
- TC_END_REPORT(TC_FAIL);
- return;
- }
- }
-
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
-}
diff --git a/samples/microkernel/test/test_libs/testcase.ini b/samples/microkernel/test/test_libs/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_libs/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_mail/Makefile b/samples/microkernel/test/test_mail/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_mail/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_mail/README.txt b/samples/microkernel/test/test_mail/README.txt
deleted file mode 100644
index 5dd710151..000000000
--- a/samples/microkernel/test/test_mail/README.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-Title: Mailbox APIs
-
-Description:
-
-This test verifies that the microkernel mailbox APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting mailbox tests
-===================================================================
-MsgSenderTask: task_mbox_put(TICKS_NONE) to non-waiting task is OK
-MsgRcvrTask: task_mbox_get when no message is OK
-MsgSenderTask: task_mbox_put(timeout) to non-waiting task is OK
-MsgRcvrTask: task_mbox_get(timeout) when no message is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) from specified task is OK
-MsgSenderTask: task_mbox_put(TICKS_NONE) to specified waiting task is OK
-MsgRcvrTask: task_mbox_get from anonymous task is OK
-MsgSenderTask: task_mbox_put(timeout) to anonymous non-waiting task is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) of empty message is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of empty message is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #3 is OK
-MsgRcvrTask: task_mbox_data_get of message data #3 is OK
-MsgSenderTask: task_mbox_put(timeout) for 2 part receive test is OK
-MsgRcvrTask: task_mbox_get(timeout) of message header #4 is OK
-MsgRcvrTask: task_mbox_data_get cancellation of message #4 is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) for cancelled receive test is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #1 is OK
-MsgRcvrTask: task_mbox_data_block_get of message data #1 is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) for block-based receive test is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #2 is OK
-MsgRcvrTask: task_mbox_data_block_get of message data #2 is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) for block-exhaustion receive test is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #3 is OK
-MsgRcvrTask: task_mbox_data_get of message data #3 is OK
-MsgSenderTask: task_mbox_put(timeout) for long-duration receive test is OK
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_mail/prj.mdef b/samples/microkernel/test/test_mail/prj.mdef
deleted file mode 100644
index 93f92ce06..000000000
--- a/samples/microkernel/test/test_mail/prj.mdef
+++ /dev/null
@@ -1,24 +0,0 @@
-% Application : test microkernel Msg APIs for mail
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ========================================================
- TASK MONITORTASK 5 MonitorTaskEntry 2048 [EXE]
- TASK MSGSENDERTASK 7 MsgSenderTaskEntry 2048 [EXE]
- TASK MSGRCVRTASK 7 MsgRcvrTaskEntry 2048 [EXE]
-
-% MAILBOX NAME
-% ==================
- MAILBOX MYMBOX
- MAILBOX NORCVRMBOX
-
-% SEMA NAME
-% =================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA SEM_SYNC1
- SEMA SEM_SYNC2
-
-% POOL NAME SIZE_SMALL SIZE_LARGE BLOCK_NUMBER
-% ======================================================
- POOL SMALLBLKSZPOOL 8 8 1
- POOL TESTPOOL 16 16 1
diff --git a/samples/microkernel/test/test_mail/prj_arm.conf b/samples/microkernel/test/test_mail/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_mail/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_mail/prj_x86.conf b/samples/microkernel/test/test_mail/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_mail/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_mail/src/Makefile b/samples/microkernel/test/test_mail/src/Makefile
deleted file mode 100644
index d135965a9..000000000
--- a/samples/microkernel/test/test_mail/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = mail.o main.o
diff --git a/samples/microkernel/test/test_mail/src/mail.c b/samples/microkernel/test/test_mail/src/mail.c
deleted file mode 100644
index a5d5d4a02..000000000
--- a/samples/microkernel/test/test_mail/src/mail.c
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test mailbox APIs
- *
- * This module tests the following mailbox APIs:
- *
- * task_mbox_put
- * task_mbox_get
- *
- * task_mbox_data_get
- * task_mbox_data_block_get
- *
- * The module does NOT test the following mailbox APIs:
- *
- * task_mbox_block_put
- *
- * Also, not all capabilities of all of the tested APIs are exercised.
- * Things that are not (yet) tested include:
- *
- * - Having multiple tasks sending simultaneously to a mailbox,
- * to ensure a mailbox can contain more than one message.
- * - Having multiple tasks waiting simultaneously on a mailbox,
- * to ensure a mailbox can have more than one waiting task.
- * - Having messages of differing priorities residing in a mailbox,
- * to ensure higher priority messages get preference.
- * - Having receiving tasks of differing priorities waiting on a mailbox.
- * to ensure higher priority tasks get preference.
- */
-
-#include <zephyr.h>
-
-#include <tc_util.h>
-
-#define MSGSIZE 16 /* Standard message data size */
-#define XFER_PRIO 5 /* standard message transfer priority */
-#define MSG_INFO1 1234 /* Message info test value */
-#define MSG_INFO2 666 /* Message info test value */
-
-static char myData1[MSGSIZE] = "This is myData1";
-static char myData2[MSGSIZE] = "This is myData2";
-static char myData3[MSGSIZE] = "This is myData3";
-static char myData4[MSGSIZE] = "This is myData4";
-
-extern ktask_t msgSenderTask;
-extern ktask_t msgRcvrTask;
-
-extern ksem_t semSync1;
-extern ksem_t semSync2;
-
-#ifndef TEST_PRIV_MBX
-extern kmbox_t myMbox;
-extern kmbox_t noRcvrMbox;
-#else
-DEFINE_MAILBOX(myMbox);
-DEFINE_MAILBOX(noRcvrMbox);
-#endif
-
-extern kmemory_pool_t testPool;
-extern kmemory_pool_t smallBlkszPool;
-
-/**
- *
- * @brief Sets various fields in the message for the sender
- *
- * Sets the following fields in the message:
- * rx_task to receiverTask - destination for the message
- * mailbox to inMbox
- *
- * @param inMsg The message being received.
- * @param inMbox Mail box to receive the message.
- * @param receiverTask Destination for the message.
- * @param dataArea Pointer to (optional) buffer to send.
- * @param dataSize Size of (optional) buffer to send.
- * @param info Additional (optional) info to send.
- *
- * @return N/A
- */
-
-static void setMsg_Sender(struct k_msg *inMsg, kmbox_t inMbox, ktask_t receiverTask,
- void *dataArea, uint32_t dataSize, uint32_t info)
-{
- inMsg->rx_task = receiverTask;
- inMsg->mailbox = inMbox;
- inMsg->tx_data = dataArea;
- inMsg->size = SIZEOFUNIT_TO_OCTET(dataSize);
- inMsg->info = info;
-}
-
-/**
- *
- * @brief Sets various fields in the message for the receiver
- *
- * Sets the following fields in the message:
- * rx_data to NULL - to allow message transfer to occur
- * size to MSGSIZE
- * tx_task to senderTask - receiver tries to get message from this source
- * mailbox to inMbox
- *
- * @param inMsg Message descriptor.
- * @param inMbox Mail box to receive from.
- * @param senderTask Sending task to receive from.
- * @param inBuffer Incoming data area
- * @param inBufferSize Size of incoming data area.
- *
- * @return N/A
- */
-
-static void setMsg_Receiver(struct k_msg *inMsg, kmbox_t inMbox, ktask_t senderTask,
- void *inBuffer, uint32_t inBufferSize)
-{
- inMsg->mailbox = inMbox;
- inMsg->tx_task = senderTask;
- inMsg->rx_data = inBuffer;
- inMsg->size = inBufferSize;
- if (inBufferSize != 0 && inBuffer != NULL) {
- memset(inBuffer, 0, inBufferSize);
- }
-}
-
-/**
- *
- * @brief Sets rx_data field in msg and clears buffer
- *
- * @param inMsg The message being received.
- * @param inBuffer Incoming data area.
- * @param inBufferSize Size of incoming data area.
- *
- * @return N/A
- */
-
-static void setMsg_RecvBuf(struct k_msg *inMsg, char *inBuffer, uint32_t inBufferSize)
-{
- inMsg->rx_data = inBuffer;
- inMsg->size = inBufferSize;
- if (inBufferSize != 0 && inBuffer != NULL) {
- memset(inBuffer, 0, inBufferSize);
- }
-}
-
-/**
- *
- * @brief Task that tests sending of mailbox messages
- *
- * This routine exercises the task_mbox_put() API.
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int MsgSenderTask(void)
-{
- int retValue; /* task_mbox_xxx interface return value */
- struct k_msg MSTmsg; /* Message sender task msg */
-
- /* Send message (no wait) to a mailbox with no receiver */
-
- setMsg_Sender(&MSTmsg, noRcvrMbox, msgRcvrTask, myData1, MSGSIZE, 0);
- retValue = task_mbox_put(noRcvrMbox, XFER_PRIO, &MSTmsg, TICKS_NONE);
- if (RC_FAIL != retValue) {
- TC_ERROR("task_mbox_put to non-waiting task returned %d\n", retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(TICKS_NONE) to non-waiting task is OK\n",
- __func__);
-
- /* Send message (with timeout) to a mailbox with no receiver */
-
- setMsg_Sender(&MSTmsg, noRcvrMbox, msgRcvrTask, myData1, MSGSIZE, 0);
- retValue = task_mbox_put(noRcvrMbox, XFER_PRIO, &MSTmsg, 2);
- if (RC_TIME != retValue) {
- TC_ERROR("task_mbox_put to non-waiting task returned %d\n", retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(timeout) to non-waiting task is OK\n",
- __func__);
-
- /* Wait for Receiver Task to finish using myMbox */
-
- (void) task_sem_take(semSync1, TICKS_UNLIMITED);
-
- /* Send message (no wait) to specified task that is waiting for it */
-
- setMsg_Sender(&MSTmsg, myMbox, msgRcvrTask, myData1, MSGSIZE, 0);
- /*
- * Transmit more data then receiver can actually handle
- * to ensure that "size" field gets updated properly during send
- */
- MSTmsg.size += 10;
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, TICKS_NONE);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put to specified waiting task returned %d\n",
- retValue);
- return TC_FAIL;
- }
- if (MSTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_put to specified waiting task got wrong size (%d)\n",
- MSTmsg.size);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(TICKS_NONE) to specified waiting task is OK\n",
- __func__);
-
- /* Wait for Receiver Task to start sleeping */
-
- (void) task_sem_take(semSync2, TICKS_UNLIMITED);
-
- /* Send message to any task that is not yet waiting for it */
-
- setMsg_Sender(&MSTmsg, myMbox, ANYTASK, myData2, MSGSIZE, MSG_INFO1);
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, 5);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put to anonymous non-waiting task returned %d\n",
- retValue);
- return TC_FAIL;
- }
- if (MSTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_put to anonymous non-waiting task "
- "got wrong size (%d)\n", MSTmsg.size);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(timeout) to anonymous non-waiting task is OK\n",
- __func__);
-
- /* Send empty message to specified task */
-
- setMsg_Sender(&MSTmsg, myMbox, msgRcvrTask, NULL, 0, MSG_INFO2);
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put of empty message returned %d\n", retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(TICKS_UNLIMITED) of empty message is OK\n",
- __func__);
-
-
- /* Sync with Receiver Task, since we're about to use a timeout */
-
- task_sem_take(semSync1, TICKS_UNLIMITED);
-
- /* Send message used in 2 part receive test */
-
- setMsg_Sender(&MSTmsg, myMbox, ANYTASK, myData3, MSGSIZE, MSG_INFO1);
- /*
- * Transmit more data then receiver can actually handle
- * to ensure that "size" field gets updated properly during send
- */
- MSTmsg.size += 10;
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, 5);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put for 2 part receive test returned %d\n",
- retValue);
- return TC_FAIL;
- }
- if (MSTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_put for 2 part receive test got wrong size (%d)\n",
- MSTmsg.size);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(timeout) for 2 part receive test is OK\n",
- __func__);
-
- /* Sync with Receiver Task, since he's about to use a timeout */
-
- task_sem_give(semSync2);
-
- /* Send message used in cancelled receive test */
-
- setMsg_Sender(&MSTmsg, myMbox, msgRcvrTask, myData4, MSGSIZE, MSG_INFO2);
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put for cancelled receive test returned %d\n",
- retValue);
- return TC_FAIL;
- }
- if (MSTmsg.size != MSGSIZE) {
- /* kernel bug: should really set size to 0! */
- TC_ERROR("task_mbox_put for cancelled receive test got wrong size (%d)\n",
- MSTmsg.size);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(TICKS_UNLIMITED) for cancelled receive test is OK\n",
- __func__);
-
- /* Send message used in block-based receive test */
-
- setMsg_Sender(&MSTmsg, myMbox, msgRcvrTask, myData1, MSGSIZE, MSG_INFO2);
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put for block-based receive test returned %d\n",
- retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(TICKS_UNLIMITED) for block-based receive test is OK\n",
- __func__);
-
- /* Send message used in block-exhaustion receive test */
-
- setMsg_Sender(&MSTmsg, myMbox, msgRcvrTask, myData2, MSGSIZE, MSG_INFO2);
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put for block-exhaustion receive test returned %d\n",
- retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(TICKS_UNLIMITED) for block-exhaustion receive test is OK\n",
- __func__);
-
- /* Sync with Receiver Task, since we're about to use a timeout */
-
- task_sem_take(semSync1, TICKS_UNLIMITED);
-
- /* Send message used in long-duration receive test */
-
- setMsg_Sender(&MSTmsg, myMbox, ANYTASK, myData3, MSGSIZE, MSG_INFO1);
- retValue = task_mbox_put(myMbox, XFER_PRIO, &MSTmsg, 2);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_put for long-duration receive test returned %d\n",
- retValue);
- return TC_FAIL;
- }
- if (MSTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_put for long-duration receive test got wrong size "
- "(%d)\n", MSTmsg.size);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_put(timeout) for long-duration receive test is OK\n",
- __func__);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Task that tests receiving of mailbox messages
- *
- * This routine exercises the task_mbox_get() and task_mbox_data_get[xxx] APIs.
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int MsgRcvrTask(void)
-{
- int retValue; /* task_mbox_xxx interface return value */
- struct k_msg MRTmsg = {0, }; /* Message receiver task msg */
- char rxBuffer[MSGSIZE*2]; /* Buffer to place message data in (has extra
- space at end for overrun testing) */
- struct k_block MRTblock; /* Message receiver task memory block */
- struct k_block MRTblockAlt; /* Message receiver task memory block (alternate) */
-
- /* Receive message (no wait) from an empty mailbox */
-
- setMsg_Receiver(&MRTmsg, myMbox, ANYTASK, rxBuffer, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_NONE);
- if (RC_FAIL != retValue) {
- TC_ERROR("task_mbox_get when no message returned %d\n", retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get when no message is OK\n", __func__);
-
- /* Receive message (with timeout) from an empty mailbox */
-
- setMsg_Receiver(&MRTmsg, myMbox, ANYTASK, rxBuffer, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, 2);
- if (RC_TIME != retValue) {
- TC_ERROR("task_mbox_get when no message returned %d\n",
- retValue);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(timeout) when no message is OK\n", __func__);
-
- /* Allow Sender Task to proceed once we start our receive */
-
- task_sem_give(semSync1);
-
- /* Receive message (no timeout) from specified task */
-
- setMsg_Receiver(&MRTmsg, myMbox, msgSenderTask, rxBuffer, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get from specified task got wrong return code (%d)\n",
- retValue);
- return TC_FAIL;
- }
- if (strcmp(MRTmsg.rx_data, myData1) != 0) {
- TC_ERROR("task_mbox_get from specified task got wrong data (%s)\n",
- MRTmsg.rx_data);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(TICKS_UNLIMITED) from specified task is OK\n",
- __func__);
-
- /* Allow Sender Task to proceed once we go to sleep for a while */
-
- task_sem_give(semSync2);
- task_sleep(2);
-
- /* Receive message (no wait) from anonymous task */
-
- setMsg_Receiver(&MRTmsg, myMbox, ANYTASK, rxBuffer, MSGSIZE);
- /*
- * Ask for more data then is actually being sent
- * to ensure that "size" field gets updated properly during receive
- */
- MRTmsg.size += MSGSIZE;
-
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_NONE);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get from anonymous task got wrong return code (%d)\n",
- retValue);
- return TC_FAIL;
- }
- if (MRTmsg.info != MSG_INFO1) {
- TC_ERROR("task_mbox_get from anonymous task got wrong info (%d)\n",
- MRTmsg.info);
- return TC_FAIL;
- }
- if (MRTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_get from anonymous task got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
- if (strcmp(MRTmsg.rx_data, myData2) != 0) {
- TC_ERROR("task_mbox_get from anonymous task got wrong data (%s)\n",
- MRTmsg.rx_data);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get from anonymous task is OK\n", __func__);
-
- /* Receive empty message from anonymous task */
-
- setMsg_Receiver(&MRTmsg, myMbox, ANYTASK, rxBuffer, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get of empty message got wrong return code (%d)\n",
- retValue);
- return TC_FAIL;
- }
- if (MRTmsg.info != MSG_INFO2) {
- TC_ERROR("task_mbox_get of empty message got wrong info (%d)\n",
- MRTmsg.info);
- return TC_FAIL;
- }
- if (MRTmsg.size != 0) {
- TC_ERROR("task_mbox_get of empty message got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(TICKS_UNLIMITED) of empty message is OK\n", __func__);
-
-
- /* Sync with Sender Task, since he's about to use a timeout */
-
- (void) task_sem_give(semSync1);
-
- /* Receive message header for 2 part receive test */
-
- setMsg_Receiver(&MRTmsg, myMbox, msgSenderTask, NULL, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get of message header #3 returned %d\n", retValue);
- return TC_FAIL;
- }
- if (MRTmsg.info != MSG_INFO1) {
- TC_ERROR("task_mbox_get of message header #3 got wrong info (%d)\n",
- MRTmsg.info);
- return TC_FAIL;
- }
- if (MRTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_get of message header #3 got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
-
- /* Now grab the message data */
-
- setMsg_RecvBuf(&MRTmsg, rxBuffer, MSGSIZE);
- task_mbox_data_get(&MRTmsg);
- if (strcmp(MRTmsg.rx_data, myData3) != 0) {
- TC_ERROR("task_mbox_data_get got wrong data #3 (%s)\n", MRTmsg.rx_data);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(TICKS_UNLIMITED) of message header #3 is OK\n",
- __func__);
- TC_PRINT("%s: task_mbox_data_get of message data #3 is OK\n", __func__);
-
- /* Sync with Sender Task, since we're about to use a timeout */
-
- (void) task_sem_take(semSync2, TICKS_UNLIMITED);
-
- /* Receive message header for cancelled receive test */
-
- setMsg_Receiver(&MRTmsg, myMbox, msgSenderTask, NULL, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, 5);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get of message header #4 returned %d\n", retValue);
- return TC_FAIL;
- }
- if (MRTmsg.info != MSG_INFO2) {
- TC_ERROR("task_mbox_get of message header #4 got wrong info (%d)\n",
- MRTmsg.info);
- return TC_FAIL;
- }
- if (MRTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_get of message header #4 got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
-
- /* Cancel receiving of message data */
-
- setMsg_RecvBuf(&MRTmsg, rxBuffer, 0);
- task_mbox_data_get(&MRTmsg);
-
- TC_PRINT("%s: task_mbox_get(timeout) of message header #4 is OK\n", __func__);
- TC_PRINT("%s: task_mbox_data_get cancellation of message #4 is OK\n", __func__);
-
- /* Receive message header for block-based receive test */
-
- setMsg_Receiver(&MRTmsg, myMbox, ANYTASK, NULL, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get of message header #1 returned %d\n", retValue);
- return TC_FAIL;
- }
- if (MRTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_get of message header #1 got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
-
- /* Try to grab message data using a block that's too small */
-
- retValue = task_mbox_data_block_get(&MRTmsg, &MRTblock, smallBlkszPool,
- TICKS_NONE);
- if (RC_FAIL != retValue) {
- TC_ERROR("task_mbox_data_block_get that should have failed returned %d\n",
- retValue);
- return TC_FAIL;
- }
-
- /* Now grab message data using a block that's big enough */
-
- retValue = task_mbox_data_block_get(&MRTmsg, &MRTblock, testPool,
- TICKS_NONE);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_data_block_get returned %d\n", retValue);
- return TC_FAIL;
- }
- if (strcmp((char *)(MRTblock.pointer_to_data), myData1) != 0) {
- TC_ERROR("task_mbox_data_block_get got wrong data #1 (%s)\n",
- MRTblock.pointer_to_data);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(TICKS_UNLIMITED) of message header #1 is OK\n",
- __func__);
- TC_PRINT("%s: task_mbox_data_block_get of message data #1 is OK\n", __func__);
-
- /* Don't free block yet ... */
-
- /* Receive message header for block-exhaustion receive test */
-
- setMsg_Receiver(&MRTmsg, myMbox, ANYTASK, NULL, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get of message header #2 returned %d\n", retValue);
- return TC_FAIL;
- }
- if (MRTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_get of message header #2 got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
-
- /* Try to grab message data using block from an empty pool */
-
- retValue = task_mbox_data_block_get(&MRTmsg, &MRTblockAlt, testPool, 2);
- if (RC_TIME != retValue) {
- TC_ERROR("task_mbox_data_block_get that should have timed out "
- "returned %d\n", retValue);
- return TC_FAIL;
- }
-
- /* Free block used with previous message */
-
- task_mem_pool_free(&MRTblock);
-
- /* Now grab message data using the newly released block */
-
- retValue = task_mbox_data_block_get(&MRTmsg, &MRTblockAlt, testPool,
- TICKS_NONE);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_data_block_get returned %d\n", retValue);
- return TC_FAIL;
- }
- if (strcmp((char *)(MRTblockAlt.pointer_to_data), myData2) != 0) {
- TC_ERROR("task_mbox_data_block_get got wrong data #2 (%s)\n",
- MRTblockAlt.pointer_to_data);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(TICKS_UNLIMITED) of message header #2 is OK\n",
- __func__);
- TC_PRINT("%s: task_mbox_data_block_get of message data #2 is OK\n", __func__);
-
- /* Free block used with most recent message */
-
- task_mem_pool_free(&MRTblockAlt);
-
- /* Sync with Sender Task, since he's about to use a timeout */
-
- (void) task_sem_give(semSync1);
-
- /* Receive message header for long-duration receive test */
-
- setMsg_Receiver(&MRTmsg, myMbox, msgSenderTask, NULL, MSGSIZE);
- retValue = task_mbox_get(myMbox, &MRTmsg, TICKS_UNLIMITED);
- if (RC_OK != retValue) {
- TC_ERROR("task_mbox_get of message header #3 returned %d\n", retValue);
- return TC_FAIL;
- }
- if (MRTmsg.info != MSG_INFO1) {
- TC_ERROR("task_mbox_get of message header #3 got wrong info (%d)\n",
- MRTmsg.info);
- return TC_FAIL;
- }
- if (MRTmsg.size != MSGSIZE) {
- TC_ERROR("task_mbox_get of message header #3 got wrong size (%d)\n",
- MRTmsg.size);
- return TC_FAIL;
- }
-
- /* Now sleep long enough for sender's timeout to expire */
-
- task_sleep(10);
-
- /* Sender should still be blocked, so grab the message data */
-
- setMsg_RecvBuf(&MRTmsg, rxBuffer, MSGSIZE);
- task_mbox_data_get(&MRTmsg);
- if (strcmp(MRTmsg.rx_data, myData3) != 0) {
- TC_ERROR("task_mbox_data_get got wrong data #3 (%s)\n", MRTmsg.rx_data);
- return TC_FAIL;
- }
-
- TC_PRINT("%s: task_mbox_get(TICKS_UNLIMITED) of message header #3 is OK\n",
- __func__);
- TC_PRINT("%s: task_mbox_data_get of message data #3 is OK\n", __func__);
-
- return TC_PASS;
-}
diff --git a/samples/microkernel/test/test_mail/src/main.c b/samples/microkernel/test/test_mail/src/main.c
deleted file mode 100644
index fbb58d2b8..000000000
--- a/samples/microkernel/test/test_mail/src/main.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* main.c - test mailbox APIs (kernel version) */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module contains the entry points for the tasks used by the kernel version
-of the mailbox test application. It also initializes global variables that
-identify the various kernel objects used by the test code.
-
-Each test task entry point invokes a test routine that returns a success/failure
-indication, then gives a corresponding semaphore. An additional task monitors
-these semaphores until it detects a failure or the completion of all test tasks,
-then announces the result of the test.
- */
-
-#include <tc_util.h>
-#include <zephyr.h>
-
-#define NUM_TEST_TASKS 2 /* # of test tasks to monitor */
-
-/* # ticks to wait for test completion */
-#define TIMEOUT (60 * sys_clock_ticks_per_sec)
-
-/*
- * Note that semaphore group entries are arranged so that resultSems[TC_PASS]
- * refers to SEM_TASKDONE and resultSems[TC_FAIL] refers to SEM_TASKFAIL.
- */
-
-static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
-
-ktask_t msgSenderTask = MSGSENDERTASK;
-ktask_t msgRcvrTask = MSGRCVRTASK;
-
-ksem_t semSync1 = SEM_SYNC1;
-ksem_t semSync2 = SEM_SYNC2;
-
-#ifndef TEST_PRIV_MBX
-kmbox_t myMbox = MYMBOX;
-kmbox_t noRcvrMbox = NORCVRMBOX;
-#else
-extern const kmbox_t myMbox;
-extern const kmbox_t noRcvrMbox;
-#endif
-
-kmemory_pool_t testPool = TESTPOOL;
-kmemory_pool_t smallBlkszPool = SMALLBLKSZPOOL;
-
-/**
- *
- * @brief Entry point for MsgSenderTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * MsgSenderTask.
- *
- * @return N/A
- */
-
-void MsgSenderTaskEntry(void)
-{
- extern int MsgSenderTask(void);
-
- task_sem_give(resultSems[MsgSenderTask()]);
-}
-
-/**
- *
- * @brief Entry point for MsgRcvrTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * MsgRcvrTask.
- *
- * @return N/A
- */
-
-void MsgRcvrTaskEntry(void)
-{
- extern int MsgRcvrTask(void);
-
- task_sem_give(resultSems[MsgRcvrTask()]);
-}
-
-/**
- *
- * @brief Entry point for MonitorTask
- *
- * This routine keeps tabs on the progress of the tasks doing the actual testing
- * and generates the final test case summary message.
- *
- * @return N/A
- */
-
-void MonitorTaskEntry(void)
-{
- ksem_t result;
- int tasksDone;
-
- PRINT_DATA("Starting mailbox tests\n");
- PRINT_LINE;
-
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
-
- for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take(resultSems, TIMEOUT);
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
- }
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
- }
-
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
-}
diff --git a/samples/microkernel/test/test_mail/testcase.ini b/samples/microkernel/test/test_mail/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_mail/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_mail_priv/Makefile b/samples/microkernel/test/test_mail_priv/Makefile
deleted file mode 100644
index 706c12aa1..000000000
--- a/samples/microkernel/test/test_mail_priv/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR := $(ZEPHYR_BASE)/samples/microkernel/test/test_mail/src
-
-# Enable testing for private microkernel mailboxes
-CFLAGS = -DTEST_PRIV_MBX
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_mail_priv/README.txt b/samples/microkernel/test/test_mail_priv/README.txt
deleted file mode 100644
index 915811914..000000000
--- a/samples/microkernel/test/test_mail_priv/README.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-Title: Private Mailboxes
-
-Description:
-
-This test verifies that the microkernel mailbox APIs operate as expected.
-This also verifies the mechanism to define private mailboxes and their usage.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting mailbox tests
-===================================================================
-MsgSenderTask: task_mbox_put(TICKS_NONE) to non-waiting task is OK
-MsgRcvrTask: task_mbox_get when no message is OK
-MsgSenderTask: task_mbox_put(timeout) to non-waiting task is OK
-MsgRcvrTask: task_mbox_get(timeout) when no message is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) from specified task is OK
-MsgSenderTask: task_mbox_put(TICKS_NONE) to specified waiting task is OK
-MsgRcvrTask: task_mbox_get from anonymous task is OK
-MsgSenderTask: task_mbox_put(timeout) to anonymous non-waiting task is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) of empty message is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of empty message is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #3 is OK
-MsgRcvrTask: task_mbox_data_get of message data #3 is OK
-MsgSenderTask: task_mbox_put(timeout) for 2 part receive test is OK
-MsgRcvrTask: task_mbox_get(timeout) of message header #4 is OK
-MsgRcvrTask: task_mbox_data_get cancellation of message #4 is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) for cancelled receive test is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #1 is OK
-MsgRcvrTask: task_mbox_data_block_get of message data #1 is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) for block-based receive test is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #2 is OK
-MsgRcvrTask: task_mbox_data_block_get of message data #2 is OK
-MsgSenderTask: task_mbox_put(TICKS_UNLIMITED) for block-exhaustion receive test is OK
-MsgRcvrTask: task_mbox_get(TICKS_UNLIMITED) of message header #3 is OK
-MsgRcvrTask: task_mbox_data_get of message data #3 is OK
-MsgSenderTask: task_mbox_put(timeout) for long-duration receive test is OK
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_mail_priv/prj.mdef b/samples/microkernel/test/test_mail_priv/prj.mdef
deleted file mode 100644
index c37092a60..000000000
--- a/samples/microkernel/test/test_mail_priv/prj.mdef
+++ /dev/null
@@ -1,30 +0,0 @@
-% Please keep this in-sync with ../test_mail/prj.mdef
-% except those specified below
-
-% Application : test microkernel Msg APIs for mail
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ========================================================
- TASK MONITORTASK 5 MonitorTaskEntry 2048 [EXE]
- TASK MSGSENDERTASK 7 MsgSenderTaskEntry 2048 [EXE]
- TASK MSGRCVRTASK 7 MsgRcvrTaskEntry 2048 [EXE]
-
-% MYMBOX and NORCVRMBOX are defined withint source code.
-% So keep them commented out.
-%
-% MAILBOX NAME
-% ==================
-% MAILBOX MYMBOX
-% MAILBOX NORCVRMBOX
-
-% SEMA NAME
-% =================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA SEM_SYNC1
- SEMA SEM_SYNC2
-
-% POOL NAME SIZE_SMALL SIZE_LARGE BLOCK_NUMBER
-% ======================================================
- POOL SMALLBLKSZPOOL 8 8 1
- POOL TESTPOOL 16 16 1
diff --git a/samples/microkernel/test/test_mail_priv/prj_arm.conf b/samples/microkernel/test/test_mail_priv/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_mail_priv/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_mail_priv/prj_x86.conf b/samples/microkernel/test/test_mail_priv/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_mail_priv/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_mail_priv/testcase.ini b/samples/microkernel/test/test_mail_priv/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_mail_priv/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_map/Makefile b/samples/microkernel/test/test_map/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_map/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_map/README.txt b/samples/microkernel/test/test_map/README.txt
deleted file mode 100644
index 858cc1a13..000000000
--- a/samples/microkernel/test/test_map/README.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-Title: Memory Map APIs
-
-Description:
-
-This test verifies that the microkernel memory map APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Memory Maps
-Starts RegressionTask
-Function testMapGetAllBlocks
-MAP_LgBlks used 0 blocks
- task_mem_map_alloc OK, p[0] = 001040a8
-MAP_LgBlks used 1 blocks
- task_mem_map_alloc OK, p[1] = 00103ca8
-MAP_LgBlks used 2 blocks
- task_mem_map_alloc RC_FAIL expected as all (2) blocks are used.
-===================================================================
-printPointers: p[0] = 001040a8, p[1] = 00103ca8,
-===================================================================
-Function testMapFreeAllBlocks
-MAP_LgBlks used 2 blocks
- block ptr to free p[0] = 001040a8
-MAP_LgBlks freed 1 block
-MAP_LgBlks used 1 blocks
- block ptr to free p[1] = 00103ca8
-MAP_LgBlks freed 2 block
-MAP_LgBlks used 0 blocks
-===================================================================
-printPointers: p[0] = 00000000, p[1] = 00000000,
-===================================================================
-Starts HelperTask
-Function testMapGetAllBlocks
-MAP_LgBlks used 0 blocks
- task_mem_map_alloc OK, p[0] = 00103ca8
-MAP_LgBlks used 1 blocks
- task_mem_map_alloc OK, p[1] = 001040a8
-MAP_LgBlks used 2 blocks
- task_mem_map_alloc RC_FAIL expected as all (2) blocks are used.
-===================================================================
-RegressionTask: task_mem_map_alloc timeout expected
-RegressionTask: start to wait for block
-HelperTask: About to free a memory block
-RegressionTask: task_mem_map_alloc OK, block allocated at 00103ca8
-RegressionTask: start to wait for block
-HelperTask: About to free another memory block
-RegressionTask: task_mem_map_alloc OK, block allocated at 00000000
-HelperTask: freed all blocks allocated by this task
-===================================================================
-PASS - HelperTask.
-RegressionTask: Used 1 block
-RegressionTask: 1 block freed, used 0 block
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_map/prj.mdef b/samples/microkernel/test/test_map/prj.mdef
deleted file mode 100644
index 0826328ee..000000000
--- a/samples/microkernel/test/test_map/prj.mdef
+++ /dev/null
@@ -1,15 +0,0 @@
-% Application : test microkernel map APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK REGRESSTASK 5 RegressionTask 2048 [EXE]
- TASK HELPERTASK 7 HelperTask 2048 [EXE]
-
-% MAP NAME BLOCKS BLOCKSIZE
-% ================================
- MAP MAP_LgBlks 2 1024
-
-% SEMA NAME
-% ====================
- SEMA SEM_HELPERDONE
- SEMA SEM_REGRESSDONE
diff --git a/samples/microkernel/test/test_map/prj_arm.conf b/samples/microkernel/test/test_map/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_map/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_map/prj_x86.conf b/samples/microkernel/test/test_map/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_map/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_map/src/Makefile b/samples/microkernel/test/test_map/src/Makefile
deleted file mode 100644
index cc1bb6ac6..000000000
--- a/samples/microkernel/test/test_map/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = map.o
diff --git a/samples/microkernel/test/test_map/src/map.c b/samples/microkernel/test/test_map/src/map.c
deleted file mode 100644
index 0c8bdbc0c..000000000
--- a/samples/microkernel/test/test_map/src/map.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* map.c - test microkernel memory map APIs */
-
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test microkernel memory map APIs
- *
- * This module tests the following map routines:
- *
- * task_mem_map_alloc
- * task_mem_map_free
- * task_mem_map_used_get
- *
- * @note
- * One should ensure that the block is released to the same map from which it
- * was allocated, and is only released once. Using an invalid pointer will
- * have unpredictable side effects.
- */
-
-#include <tc_util.h>
-#include <stdbool.h>
-#include <zephyr.h>
-
-#define NUMBLOCKS 2 /*
- * Number of memory blocks. This number
- * has to be aligned with the number in MDEF file
- * The minimum number of blocks needed to run the
- * test is 2
- */
-
-static int tcRC = TC_PASS; /* test case return code */
-
-int testMapGetAllBlocks(void **P);
-int testMapFreeAllBlocks(void **P);
-
-#ifdef TEST_PRIV_MEM_MAPS
-DEFINE_MEM_MAP(MAP_LgBlks, 2, 1024);
-#endif
-
-/**
- *
- * @brief Verify return value
- *
- * This routine verifies current value against expected value
- * and returns true if they are the same.
- *
- * @param expectRetValue expect value
- * @param currentRetValue current value
- *
- * @return true, false
- */
-
-bool verifyRetValue(int expectRetValue, int currentRetValue)
-{
- return (expectRetValue == currentRetValue);
-
-} /* verifyRetValue */
-
-/**
- *
- * @brief Helper task
- *
- * This routine gets all blocks from the memory map. It uses semaphores
- * SEM_REGRESDONE and SEM_HELPERDONE to synchronize between different parts
- * of the test.
- *
- * @return N/A
- */
-
-void HelperTask(void)
-{
- void *ptr[NUMBLOCKS]; /* Pointer to memory block */
-
- /* Wait for part 1 to complete */
- task_sem_take(SEM_REGRESSDONE, TICKS_UNLIMITED);
-
- /* Part 2 of test */
-
- TC_PRINT("Starts %s\n", __func__);
-
- /* Test task_mem_map_alloc */
- tcRC = testMapGetAllBlocks(ptr);
- if (tcRC == TC_FAIL) {
- TC_ERROR("Failed testMapGetAllBlocks function\n");
- goto exitTest1; /* terminate test */
- }
-
- task_sem_give(SEM_HELPERDONE); /* Indicate part 2 is complete */
- /* Wait for part 3 to complete */
- task_sem_take(SEM_REGRESSDONE, TICKS_UNLIMITED);
-
- /*
- * Part 4 of test.
- * Free the first memory block. RegressionTask is currently blocked
- * waiting (with a timeout) for a memory block. Freeing the memory
- * block will unblock RegressionTask.
- */
-
- TC_PRINT("%s: About to free a memory block\n", __func__);
- task_mem_map_free(MAP_LgBlks, &ptr[0]);
- task_sem_give(SEM_HELPERDONE);
-
- /* Part 5 of test */
- task_sem_take(SEM_REGRESSDONE, TICKS_UNLIMITED);
- TC_PRINT("%s: About to free another memory block\n", __func__);
- task_mem_map_free(MAP_LgBlks, &ptr[1]);
-
- /*
- * Free all the other blocks. The first 2 blocks are freed by this task
- */
- for (int i = 2; i < NUMBLOCKS; i++) {
- task_mem_map_free(MAP_LgBlks, &ptr[i]);
- }
- TC_PRINT("%s: freed all blocks allocated by this task\n", __func__);
-
-exitTest1:
-
- TC_END_RESULT(tcRC);
- task_sem_give(SEM_HELPERDONE);
-} /* HelperTask */
-
-
-/**
- *
- * @brief Get all blocks from the memory map
- *
- * Get all blocks from the memory map. It also tries to get one more block
- * from the map after the map is empty to verify the error return code.
- *
- * This routine tests the following:
- *
- * task_mem_map_alloc(), task_mem_map_used_get()
- *
- * @param p pointer to pointer of allocated blocks
- *
- * @return TC_PASS, TC_FAIL
- */
-
-int testMapGetAllBlocks(void **p)
-{
- int retValue; /* task_mem_map_xxx interface return value */
- void *errPtr; /* Pointer to block */
-
- TC_PRINT("Function %s\n", __func__);
-
- /* Number of blocks in the map is defined in MDEF file */
- for (int i = 0; i < NUMBLOCKS; i++) {
- /* Verify number of used blocks in the map */
- retValue = task_mem_map_used_get(MAP_LgBlks);
- if (verifyRetValue(i, retValue)) {
- TC_PRINT("MAP_LgBlks used %d blocks\n", retValue);
- } else {
- TC_ERROR("Failed task_mem_map_used_get for MAP_LgBlks, i=%d, retValue=%d\n",
- i, retValue);
- return TC_FAIL;
- }
-
- /* Get memory block */
- retValue = task_mem_map_alloc(MAP_LgBlks, &p[i], TICKS_NONE);
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT(" task_mem_map_alloc OK, p[%d] = %p\n", i, p[i]);
- } else {
- TC_ERROR("Failed task_mem_map_alloc, i=%d, retValue %d\n",
- i, retValue);
- return TC_FAIL;
- }
-
- } /* for */
-
- /* Verify number of used blocks in the map - expect all blocks are used */
- retValue = task_mem_map_used_get(MAP_LgBlks);
- if (verifyRetValue(NUMBLOCKS, retValue)) {
- TC_PRINT("MAP_LgBlks used %d blocks\n", retValue);
- } else {
- TC_ERROR("Failed task_mem_map_used_get for MAP_LgBlks, retValue %d\n",
- retValue);
- return TC_FAIL;
- }
-
- /* Try to get one more block and it should fail */
- retValue = task_mem_map_alloc(MAP_LgBlks, &errPtr, TICKS_NONE);
- if (verifyRetValue(RC_FAIL, retValue)) {
- TC_PRINT(" task_mem_map_alloc RC_FAIL expected as all (%d) blocks are used.\n",
- NUMBLOCKS);
- } else {
- TC_ERROR("Failed task_mem_map_alloc, expect RC_FAIL, got %d\n", retValue);
- return TC_FAIL;
- }
-
- PRINT_LINE;
-
- return TC_PASS;
-} /* testMapGetAllBlocks */
-
-/**
- *
- * @brief Free all memeory blocks
- *
- * This routine frees all memory blocks and also verifies that the number of
- * blocks used are correct.
- *
- * This routine tests the following:
- *
- * task_mem_map_free(), task_mem_map_used_get()
- *
- * @param p pointer to pointer of allocated blocks
- *
- * @return TC_PASS, TC_FAIL
- */
-
-int testMapFreeAllBlocks(void **p)
-{
- int retValue; /* task_mem_map_xxx interface return value */
-
- TC_PRINT("Function %s\n", __func__);
-
- /* Number of blocks in the map is defined in MDEF file */
- for (int i = 0; i < NUMBLOCKS; i++) {
- /* Verify number of used blocks in the map */
- retValue = task_mem_map_used_get(MAP_LgBlks);
- if (verifyRetValue(NUMBLOCKS - i, retValue)) {
- TC_PRINT("MAP_LgBlks used %d blocks\n", retValue);
- } else {
- TC_ERROR("Failed task_mem_map_used_get for MAP_LgBlks, expect %d, got %d\n",
- NUMBLOCKS - i, retValue);
- return TC_FAIL;
- }
-
- TC_PRINT(" block ptr to free p[%d] = %p\n", i, p[i]);
- /* Free memory block */
- task_mem_map_free(MAP_LgBlks, &p[i]);
-
- TC_PRINT("MAP_LgBlks freed %d block\n", i + 1);
-
- } /* for */
-
- /*
- * Verify number of used blocks in the map
- * - should be 0 as no blocks are used
- */
-
- retValue = task_mem_map_used_get(MAP_LgBlks);
- if (verifyRetValue(0, retValue)) {
- TC_PRINT("MAP_LgBlks used %d blocks\n", retValue);
- } else {
- TC_ERROR("Failed task_mem_map_used_get for MAP_LgBlks, retValue %d\n",
- retValue);
- return TC_FAIL;
- }
-
- PRINT_LINE;
- return TC_PASS;
-} /* testMapFreeAllBlocks */
-
-/**
- *
- * @brief Print the pointers
- *
- * This routine prints out the pointers.
- *
- * @param pointer pointer to pointer of allocated blocks
- *
- * @return N/A
- */
-void printPointers(void **pointer)
-{
- TC_PRINT("%s: ", __func__);
- for (int i = 0; i < NUMBLOCKS; i++) {
- TC_PRINT("p[%d] = %p, ", i, pointer[i]);
- }
-
- TC_PRINT("\n");
- PRINT_LINE;
-
-} /* printPointers */
-
-/**
- *
- * @brief Main task to test task_mem_map_xxx interfaces
- *
- * This routine calls testMapGetAllBlocks() to get all memory blocks from the
- * map and calls testMapFreeAllBlocks() to free all memory blocks. It also
- * tries to wait (with and without timeout) for a memory block.
- *
- * This routine tests the following:
- *
- * task_mem_map_alloc
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int retValue; /* task_mem_map_xxx interface return value */
- void *b; /* Pointer to memory block */
- void *ptr[NUMBLOCKS]; /* Pointer to memory block */
-
- /* Part 1 of test */
-
- TC_START("Test Microkernel Memory Maps");
- TC_PRINT("Starts %s\n", __func__);
-
- /* Test task_mem_map_alloc */
- tcRC = testMapGetAllBlocks(ptr);
- if (tcRC == TC_FAIL) {
- TC_ERROR("Failed testMapGetAllBlocks function\n");
- goto exitTest; /* terminate test */
- }
-
- printPointers(ptr);
- /* Test task_mem_map_free */
- tcRC = testMapFreeAllBlocks(ptr);
- if (tcRC == TC_FAIL) {
- TC_ERROR("Failed testMapFreeAllBlocks function\n");
- goto exitTest; /* terminate test */
- }
-
- printPointers(ptr);
-
- task_sem_give(SEM_REGRESSDONE); /* Allow HelperTask to run */
- /* Wait for HelperTask to finish */
- task_sem_take(SEM_HELPERDONE, TICKS_UNLIMITED);
-
- /*
- * Part 3 of test.
- *
- * HelperTask got all memory blocks. There is no free block left.
- * The call will timeout. Note that control does not switch back to
- * HelperTask as it is waiting for SEM_REGRESSDONE.
- */
-
- retValue = task_mem_map_alloc(MAP_LgBlks, &b, 2);
- if (verifyRetValue(RC_TIME, retValue)) {
- TC_PRINT("%s: task_mem_map_alloc timeout expected\n", __func__);
- } else {
- TC_ERROR("Failed task_mem_map_alloc, retValue %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest; /* terminate test */
- }
-
- TC_PRINT("%s: start to wait for block\n", __func__);
- task_sem_give(SEM_REGRESSDONE); /* Allow HelperTask to run part 4 */
- retValue = task_mem_map_alloc(MAP_LgBlks, &b, 5);
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT("%s: task_mem_map_alloc OK, block allocated at %p\n",
- __func__, b);
- } else {
- TC_ERROR("Failed task_mem_map_alloc, retValue %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest; /* terminate test */
- }
-
- /* Wait for HelperTask to complete */
- task_sem_take(SEM_HELPERDONE, TICKS_UNLIMITED);
-
- TC_PRINT("%s: start to wait for block\n", __func__);
- task_sem_give(SEM_REGRESSDONE); /* Allow HelperTask to run part 5 */
- retValue = task_mem_map_alloc(MAP_LgBlks, &b, TICKS_UNLIMITED);
- if (verifyRetValue(RC_OK, retValue)) {
- TC_PRINT("%s: task_mem_map_alloc OK, block allocated at %p\n",
- __func__, b);
- } else {
- TC_ERROR("Failed task_mem_map_alloc, retValue %d\n", retValue);
- tcRC = TC_FAIL;
- goto exitTest; /* terminate test */
- }
-
- /* Wait for HelperTask to complete */
- task_sem_take(SEM_HELPERDONE, TICKS_UNLIMITED);
-
-
- /* Free memory block */
- TC_PRINT("%s: Used %d block\n", __func__, task_mem_map_used_get(MAP_LgBlks));
- task_mem_map_free(MAP_LgBlks, &b);
- TC_PRINT("%s: 1 block freed, used %d block\n",
- __func__, task_mem_map_used_get(MAP_LgBlks));
-
-exitTest:
-
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-} /* RegressionTask */
diff --git a/samples/microkernel/test/test_map/testcase.ini b/samples/microkernel/test/test_map/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_map/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_map_priv/Makefile b/samples/microkernel/test/test_map_priv/Makefile
deleted file mode 100644
index d8d1097d1..000000000
--- a/samples/microkernel/test/test_map_priv/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR := $(ZEPHYR_BASE)/samples/microkernel/test/test_map/src
-
-# Enable testing for private microkernel memory map objects
-CFLAGS = -DTEST_PRIV_MEM_MAPS
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_map_priv/README.txt b/samples/microkernel/test/test_map_priv/README.txt
deleted file mode 100644
index 066ff60e9..000000000
--- a/samples/microkernel/test/test_map_priv/README.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-Title: Private Memory Maps
-
-Description:
-
-This test verifies that the microkernel memory map APIs operate as expected.
-This also verifies the mechanism to define private memory map and its usage.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Memory Maps
-Starts RegressionTask
-Function testMapGetAllBlocks
-MAP_LgBlks used 0 blocks
- task_mem_map_alloc OK, p[0] = 001040a8
-MAP_LgBlks used 1 blocks
- task_mem_map_alloc OK, p[1] = 00103ca8
-MAP_LgBlks used 2 blocks
- task_mem_map_alloc RC_FAIL expected as all (2) blocks are used.
-===================================================================
-printPointers: p[0] = 001040a8, p[1] = 00103ca8,
-===================================================================
-Function testMapFreeAllBlocks
-MAP_LgBlks used 2 blocks
- block ptr to free p[0] = 001040a8
-MAP_LgBlks freed 1 block
-MAP_LgBlks used 1 blocks
- block ptr to free p[1] = 00103ca8
-MAP_LgBlks freed 2 block
-MAP_LgBlks used 0 blocks
-===================================================================
-printPointers: p[0] = 00000000, p[1] = 00000000,
-===================================================================
-Starts HelperTask
-Function testMapGetAllBlocks
-MAP_LgBlks used 0 blocks
- task_mem_map_alloc OK, p[0] = 00103ca8
-MAP_LgBlks used 1 blocks
- task_mem_map_alloc OK, p[1] = 001040a8
-MAP_LgBlks used 2 blocks
- task_mem_map_alloc RC_FAIL expected as all (2) blocks are used.
-===================================================================
-RegressionTask: task_mem_map_alloc timeout expected
-RegressionTask: start to wait for block
-HelperTask: About to free a memory block
-RegressionTask: task_mem_map_alloc OK, block allocated at 00103ca8
-RegressionTask: start to wait for block
-HelperTask: About to free another memory block
-RegressionTask: task_mem_map_alloc OK, block allocated at 00000000
-HelperTask: freed all blocks allocated by this task
-===================================================================
-PASS - HelperTask.
-RegressionTask: Used 1 block
-RegressionTask: 1 block freed, used 0 block
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_map_priv/prj.mdef b/samples/microkernel/test/test_map_priv/prj.mdef
deleted file mode 100644
index f972388ce..000000000
--- a/samples/microkernel/test/test_map_priv/prj.mdef
+++ /dev/null
@@ -1,21 +0,0 @@
-% Application : test microkernel map APIs
-
-% Please keep this in-sync with ../test_map/prj.mdef
-% except those specified below
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK REGRESSTASK 5 RegressionTask 2048 [EXE]
- TASK HELPERTASK 7 HelperTask 2048 [EXE]
-
-% MAP MAP_LgBlks is defined within the source file,
-% so keep it commented out here.
-%
-% MAP NAME BLOCKS BLOCKSIZE
-% ================================
-% MAP MAP_LgBlks 2 1024
-
-% SEMA NAME
-% ====================
- SEMA SEM_HELPERDONE
- SEMA SEM_REGRESSDONE
diff --git a/samples/microkernel/test/test_map_priv/prj_arm.conf b/samples/microkernel/test/test_map_priv/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_map_priv/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_map_priv/prj_x86.conf b/samples/microkernel/test/test_map_priv/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_map_priv/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_map_priv/testcase.ini b/samples/microkernel/test/test_map_priv/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_map_priv/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_mutex/Makefile b/samples/microkernel/test/test_mutex/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_mutex/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_mutex/README.txt b/samples/microkernel/test/test_mutex/README.txt
deleted file mode 100644
index 9260ba8c3..000000000
--- a/samples/microkernel/test/test_mutex/README.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-Title: Mutex APIs
-
-Description:
-
-This test verifies that the microkernel mutex APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Mutex API
-===================================================================
-Done LOCKING! Current priority = 10
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_mutex/prj.mdef b/samples/microkernel/test/test_mutex/prj.mdef
deleted file mode 100644
index 5a227523a..000000000
--- a/samples/microkernel/test/test_mutex/prj.mdef
+++ /dev/null
@@ -1,19 +0,0 @@
-% Application : test microkernel mutex APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK TASK10 10 Task10 2048 [EXE]
- TASK TASK15 15 Task15 2048 [EXE]
- TASK TASK20 20 Task20 2048 [EXE]
- TASK TASK25 25 Task25 2048 [EXE]
- TASK TASK30 30 Task30 2048 [EXE]
- TASK TASK45 45 Task45 2048 [EXE]
- TASK TASK50 50 Task50 2048 []
- TASK REGRESSTASK 40 RegressionTask 2048 [EXE]
-
-% MUTEX NAME
-% ============
- MUTEX Mutex1
- MUTEX Mutex2
- MUTEX Mutex3
- MUTEX Mutex4
diff --git a/samples/microkernel/test/test_mutex/prj_arm.conf b/samples/microkernel/test/test_mutex/prj_arm.conf
deleted file mode 100644
index c4ac991e2..000000000
--- a/samples/microkernel/test/test_mutex/prj_arm.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=64
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_mutex/prj_x86.conf b/samples/microkernel/test/test_mutex/prj_x86.conf
deleted file mode 100644
index 085e7c60d..000000000
--- a/samples/microkernel/test/test_mutex/prj_x86.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=64
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_mutex/src/Makefile b/samples/microkernel/test/test_mutex/src/Makefile
deleted file mode 100644
index cf835f496..000000000
--- a/samples/microkernel/test/test_mutex/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = mutex.o task50.o
diff --git a/samples/microkernel/test/test_mutex/src/mutex.c b/samples/microkernel/test/test_mutex/src/mutex.c
deleted file mode 100644
index 759915cb9..000000000
--- a/samples/microkernel/test/test_mutex/src/mutex.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test microkernel mutex APIs
- *
- *
- * This module demonstrates the microkernel's priority inheritance algorithm.
- * A task that owns a mutex is promoted to the priority level of the
- * highest-priority task attempting to lock the mutex.
- *
- * In addition, recusive locking capabilities and the use of a private mutex
- * are also tested.
- *
- * This module tests the following mutex routines:
- *
- * task_mutex_lock
- * task_mutex_unlock
- * task_mutex_init
- *
- * Timeline for priority inheritance testing:
- * - 0.0 sec: Task10, Task15, Task20, Task25, Task30, sleep
- * : RegressionTask takes Mutex1 then sleeps
- * - 0.0 sec: Task45 sleeps
- * - 0.5 sec: Task30 wakes and waits on Mutex1
- * - 1.0 sec: RegressionTask (@ priority 30) takes Mutex2 then sleeps
- * - 1.5 sec: Task25 wakes and waits on Mutex2
- * - 2.0 sec: RegressionTask (@ priority 25) takes Mutex3 then sleeps
- * - 2.5 sec: Task20 wakes and waits on Mutex3
- * - 3.0 sec: RegressionTask (@ priority 20) takes Mutex4 then sleeps
- * - 3.5 sec: Task10 wakes and waits on Mutex4
- * - 3.5 sec: Task45 wakes and waits on Mutex3
- * - 3.75 sec: Task15 wakes and waits on Mutex4
- * - 4.0 sec: RegressionTask wakes (@ priority 10) then sleeps
- * - 4.5 sec: Task10 times out
- * - 5.0 sec: RegressionTask wakes (@ priority 15) then gives Mutex4
- * : RegressionTask (@ priority 20) sleeps
- * - 5.5 sec: Task20 times out on Mutex3
- * - 6.0 sec: RegressionTask (@ priority 25) gives Mutex3
- * : RegressionTask (@ priority 25) gives Mutex2
- * : RegressionTask (@ priority 30) gives Mutex1
- * : RegressionTask (@ priority 40) sleeps
- */
-
-#include <tc_util.h>
-#include <zephyr.h>
-
-#define ONE_SECOND (sys_clock_ticks_per_sec)
-#define HALF_SECOND (sys_clock_ticks_per_sec / 2)
-#define THIRD_SECOND (sys_clock_ticks_per_sec / 3)
-#define FOURTH_SECOND (sys_clock_ticks_per_sec / 4)
-
-static int tcRC = TC_PASS; /* test case return code */
-
-DEFINE_MUTEX(private_mutex);
-
-/**
- *
- * Task10 -
- *
- * @return N/A
- */
-
-void Task10(void)
-{
- int rv;
-
- task_sleep(3 * ONE_SECOND + HALF_SECOND);
-
- /* Wait and boost owner priority to 10 */
- rv = task_mutex_lock(Mutex4, ONE_SECOND);
- if (rv != RC_TIME) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to timeout on mutex 0x%x\n", Mutex4);
- return;
- }
-} /* Task10 */
-
-
-/**
- *
- * Task15 -
- *
- * @return N/A
- */
-
-void Task15(void)
-{
- int rv;
-
- task_sleep(3 * ONE_SECOND + 3 * FOURTH_SECOND);
-
- /*
- * Wait for the mutex. There is a higher priority level task waiting
- * on the mutex, so request will not immediately contribute to raising
- * the priority of the owning task (RegressionTask). When Task10 times out
- * this task will become the highest priority waiting task. The priority
- * of the owning task (RegressionTask) will not drop back to 20, but will
- * instead drop to 15.
- */
-
- rv = task_mutex_lock(Mutex4, 2 * ONE_SECOND);
- if (rv != RC_OK) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to take mutex 0x%x\n", Mutex4);
- return;
- }
-
- task_mutex_unlock(Mutex4);
-}
-
-/**
- *
- * Task20 -
- *
- * @return N/A
- */
-
-void Task20(void)
-{
- int rv;
-
- task_sleep(2 * ONE_SECOND + HALF_SECOND);
-
- /*
- * Wait and boost owner priority to 20. While waiting, another task of
- * a very low priority level will also wait for the mutex. Task20 is
- * expected to time out around the 5.5 second mark. When it times out,
- * Task45 will become the only waiting task for this mutex and the
- * priority of the owning task RegressionTask will drop to 25.
- */
-
- rv = task_mutex_lock(Mutex3, 3 * ONE_SECOND);
- if (rv != RC_TIME) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to timeout on mutex 0x%x\n", Mutex3);
- return;
- }
-
-} /* Task20 */
-
-/**
- *
- * Task25 -
- *
- * @return N/A
- */
-
-void Task25(void)
-{
- int rv;
-
- task_sleep(ONE_SECOND + HALF_SECOND);
-
- /* Wait and boost owner priority to 25 */
- rv = task_mutex_lock(Mutex2, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to take mutex 0x%x\n", Mutex2);
- return;
- }
-
- task_mutex_unlock(Mutex2);
-} /* Task25 */
-
-/**
- *
- * Task30 -
- *
- * @return N/A
- */
-
-void Task30(void)
-{
- int rv;
-
- task_sleep(HALF_SECOND); /* Allow lower priority task to run */
-
- rv = task_mutex_lock(Mutex1, TICKS_NONE); /* <Mutex1> is already locked. */
- if (rv != RC_FAIL) { /* This attempt to lock the mutex */
- /* should not succeed. */
- tcRC = TC_FAIL;
- TC_ERROR("Failed to NOT take locked mutex 0x%x\n", Mutex1);
- return;
- }
-
- /* Wait and boost owner priority to 30 */
- rv = task_mutex_lock(Mutex1, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to take mutex 0x%x\n", Mutex1);
- return;
- }
-
- task_mutex_unlock(Mutex1);
-}
-
-/**
- *
- * Task45 -
- *
- * @return N/A
- */
-
-void Task45(void)
-{
- int rv;
-
- task_sleep(3 * ONE_SECOND + HALF_SECOND);
- rv = task_mutex_lock(Mutex3, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to take mutex 0x%x\n", Mutex2);
- return;
- }
- task_mutex_unlock(Mutex3);
-}
-
-/**
- *
- * @brief Main task to test task_mutex_xxx interfaces
- *
- * This task will lock on Mutex1, Mutex2, Mutex3 and Mutex4. It later
- * recursively locks private_mutex, releases it, then re-locks it.
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int rv;
- int i;
- kmutex_t mutexes[4] = {Mutex1, Mutex2, Mutex3, Mutex4};
- kmutex_t giveMutex[3] = {Mutex3, Mutex2, Mutex1};
- int priority[4] = {30, 25, 20, 10};
- int dropPri[3] = {25, 25, 30};
-
- TC_START("Test Microkernel Mutex API");
-
- PRINT_LINE;
-
- /*
- * 1st iteration: Take Mutex1; Task30 waits on Mutex1
- * 2nd iteration: Take Mutex2: Task25 waits on Mutex2
- * 3rd iteration: Take Mutex3; Task20 waits on Mutex3
- * 4th iteration: Take Mutex4; Task10 waits on Mutex4
- */
-
- for (i = 0; i < 4; i++) {
- rv = task_mutex_lock(mutexes[i], TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("Failed to lock mutex 0x%x\n", mutexes[i]);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
- task_sleep(ONE_SECOND);
-
- rv = task_priority_get();
- if (rv != priority[i]) {
- TC_ERROR("Expected priority %d, not %d\n", priority[i], rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- if (tcRC != TC_PASS) { /* Catch any errors from other tasks */
- goto errorReturn;
- }
- }
-
- /* ~ 4 seconds have passed */
-
- TC_PRINT("Done LOCKING! Current priority = %d\n", task_priority_get());
-
- task_sleep(ONE_SECOND); /* Task10 should time out */
-
- /* ~ 5 seconds have passed */
-
- rv = task_priority_get();
- if (rv != 15) {
- TC_ERROR("%s timed out and out priority should drop.\n", "Task10");
- TC_ERROR("Expected priority %d, not %d\n", 15, rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_mutex_unlock(Mutex4);
- rv = task_priority_get();
- if (rv != 20) {
- TC_ERROR("Gave %s and priority should drop.\n", "Mutex4");
- TC_ERROR("Expected priority %d, not %d\n", 20, rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_sleep(ONE_SECOND); /* Task20 should time out */
-
- /* ~ 6 seconds have passed */
-
- for (i = 0; i < 3; i++) {
- rv = task_priority_get();
- if (rv != dropPri[i]) {
- TC_ERROR("Expected priority %d, not %d\n", dropPri[i], rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
- task_mutex_unlock(giveMutex[i]);
-
- if (tcRC != TC_PASS) {
- goto errorReturn;
- }
- }
-
- rv = task_priority_get();
- if (rv != 40) {
- TC_ERROR("Expected priority %d, not %d\n", 40, rv);
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_sleep(ONE_SECOND); /* Give Task45 time to run */
-
- if (tcRC != TC_PASS) {
- goto errorReturn;
- }
-
- /* test recursive locking using a private mutex */
-
- TC_PRINT("Testing recursive locking\n");
-
- rv = task_mutex_lock(private_mutex, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("Failed to lock private mutex\n");
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- rv = task_mutex_lock(private_mutex, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("Failed to recursively lock private mutex\n");
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_start(TASK50); /* Start Task50 */
- task_sleep(1); /* Give Task50 a chance to block on the mutex */
-
- task_mutex_unlock(private_mutex);
- task_mutex_unlock(private_mutex); /* Task50 should now have lock */
-
- rv = task_mutex_lock(private_mutex, TICKS_NONE);
- if (rv != RC_FAIL) {
- TC_ERROR("Unexpectedly got lock on private mutex\n");
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- rv = task_mutex_lock(private_mutex, ONE_SECOND);
- if (rv != RC_OK) {
- TC_ERROR("Failed to re-obtain lock on private mutex\n");
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_mutex_unlock(private_mutex);
-
- TC_PRINT("Recursive locking tests successful\n");
-
-errorReturn:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-} /* RegressionTask */
diff --git a/samples/microkernel/test/test_mutex/src/task50.c b/samples/microkernel/test/test_mutex/src/task50.c
deleted file mode 100644
index e13713ac7..000000000
--- a/samples/microkernel/test/test_mutex/src/task50.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* task50.c - helper file for testing microkernel mutex APIs */
-
-/*
- * Copyright (c) 2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module defines a task that is used in recursive mutex locking tests.
-It helps ensure that a private mutex can be referenced in a file other than
-the one it was defined in.
-*/
-
-#include <tc_util.h>
-#include <zephyr.h>
-
-#define ONE_SECOND (sys_clock_ticks_per_sec)
-#define HALF_SECOND (sys_clock_ticks_per_sec / 2)
-#define THIRD_SECOND (sys_clock_ticks_per_sec / 3)
-#define FOURTH_SECOND (sys_clock_ticks_per_sec / 4)
-
-static int tcRC = TC_PASS; /* test case return code */
-
-extern const kmutex_t private_mutex;
-
-/**
- *
- * Task50 - task that participates in recursive locking tests
- *
- * @return N/A
- */
-
-void Task50(void)
-{
- int rv;
-
- /* Wait for private mutex to be released */
-
- rv = task_mutex_lock(private_mutex, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- tcRC = TC_FAIL;
- TC_ERROR("Failed to obtain private mutex\n");
- return;
- }
-
- /* Wait a bit, then release the mutex */
-
- task_sleep(HALF_SECOND);
- task_mutex_unlock(private_mutex);
-
-} /* Task50 */
diff --git a/samples/microkernel/test/test_mutex/testcase.ini b/samples/microkernel/test/test_mutex/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_mutex/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_pipe/Makefile b/samples/microkernel/test/test_pipe/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_pipe/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_pipe/README.txt b/samples/microkernel/test/test_pipe/README.txt
deleted file mode 100644
index 1b00e1fb5..000000000
--- a/samples/microkernel/test/test_pipe/README.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Title: Pipe APIs
-
-Description:
-
-This test verifies that the microkernel pipe APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting pipe tests
-===================================================================
-Testing task_pipe_put(TICKS_NONE) ...
-Testing task_pipe_put(TICKS_UNLIMITED) ...
-Testing task_pipe_put(timeout) ...
-Testing task_pipe_get(TICKS_NONE) ...
-Testing task_pipe_get(TICKS_UNLIMITED) ...
-Testing task_pipe_get(timeout) ...
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_pipe/prj.mdef b/samples/microkernel/test/test_pipe/prj.mdef
deleted file mode 100644
index 0d076e503..000000000
--- a/samples/microkernel/test/test_pipe/prj.mdef
+++ /dev/null
@@ -1,19 +0,0 @@
-% Application : test microkernel target pipe APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK MONITORTASK 4 MonitorTaskEntry 2048 [EXE]
- TASK tStartTask 5 RegressionTaskEntry 2048 [EXE]
- TASK tAlternate 6 AlternateTaskEntry 2048 [EXE]
-
-% PIPE NAME BUFFERSIZE
-% =============================
- PIPE PIPE_ID 256
-
-% SEMA NAME
-% ===================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA ALTERNATE_SEM
- SEMA REGRESSION_SEM
- SEMA COUNTER_SEM
diff --git a/samples/microkernel/test/test_pipe/prj_arm.conf b/samples/microkernel/test/test_pipe/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_pipe/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_pipe/prj_x86.conf b/samples/microkernel/test/test_pipe/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_pipe/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_pipe/src/Makefile b/samples/microkernel/test/test_pipe/src/Makefile
deleted file mode 100644
index dbd9e802c..000000000
--- a/samples/microkernel/test/test_pipe/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = main.o pipe.o
diff --git a/samples/microkernel/test/test_pipe/src/main.c b/samples/microkernel/test/test_pipe/src/main.c
deleted file mode 100644
index 6a28f865c..000000000
--- a/samples/microkernel/test/test_pipe/src/main.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* main.c - test pipe APIs (kernel version) */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module contains the entry points for the tasks used by the kernel version
-of the pipe test application. It also initializes global variables that
-identify the various kernel objects used by the test code.
-
-Each test task entry point invokes a test routine that returns a success/failure
-indication, then gives a corresponding semaphore. An additional task monitors
-these semaphores until it detects a failure or the completion of all test tasks,
-then announces the result of the test.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-
-#define NUM_TEST_TASKS 2 /* # of test tasks to monitor */
-
-/* # ticks to wait for test completion */
-#define TIMEOUT (60 * sys_clock_ticks_per_sec)
-
-/*
- * Note that semaphore group entries are arranged so that resultSems[TC_PASS]
- * refers to SEM_TASKDONE and resultSems[TC_FAIL] refers to SEM_TASKFAIL.
- */
-
-static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
-
-ksem_t regSem = REGRESSION_SEM;
-ksem_t altSem = ALTERNATE_SEM;
-ksem_t counterSem = COUNTER_SEM;
-
-#ifndef TEST_PRIV_PIPES
-kpipe_t pipeId = PIPE_ID;
-#else
-DEFINE_PIPE(pipeId, 256);
-#endif
-
-/**
- *
- * @brief Entry point for RegressionTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * RegressionTask.
- *
- * @return N/A
- */
-
-void RegressionTaskEntry(void)
-{
- extern int RegressionTask(void);
-
- task_sem_give(resultSems[RegressionTask()]);
-}
-
-/**
- *
- * @brief Entry point for AlternateTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * AlternateTask.
- *
- * @return N/A
- */
-
-void AlternateTaskEntry(void)
-{
- extern int AlternateTask(void);
-
- task_sem_give(resultSems[AlternateTask()]);
-}
-
-/**
- *
- * @brief Entry point for MonitorTask
- *
- * This routine keeps tabs on the progress of the tasks doing the actual testing
- * and generates the final test case summary message.
- *
- * @return N/A
- */
-
-void MonitorTaskEntry(void)
-{
- ksem_t result;
- int tasksDone;
-
- PRINT_DATA("Starting pipe tests\n");
- PRINT_LINE;
-
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
-
- for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take(resultSems, TIMEOUT);
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
- }
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
- }
-
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
-}
diff --git a/samples/microkernel/test/test_pipe/src/pipe.c b/samples/microkernel/test/test_pipe/src/pipe.c
deleted file mode 100644
index 691f11ed7..000000000
--- a/samples/microkernel/test/test_pipe/src/pipe.c
+++ /dev/null
@@ -1,1046 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test microkernel target pipe APIs
- *
- * This modules tests the following target pipe routines:
- *
- * task_pipe_put()
- * task_pipe_get()
- *
- * The following target pipe routine does not yet have a test case:
- * task_pipe_block_put()
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <misc/util.h>
-
-#define ONE_SECOND (sys_clock_ticks_per_sec)
-
-#define IRQ_PRIORITY 3
-
-#define PIPE_SIZE 256 /* This must match the value in the MDEF file */
-
-typedef struct {
- int size; /* number of bytes to send/receive */
- K_PIPE_OPTION options; /* options for task_pipe_XXX() APIs */
- int sent; /* expected # of bytes sent */
- int rcode; /* expected return code */
-} SIZE_EXPECT;
-
-static char txBuffer[PIPE_SIZE + 32];
-static char rxBuffer[PIPE_SIZE + 32];
-
-static SIZE_EXPECT all_N[] = {
- {0, _ALL_N, 0, RC_FAIL},
- {1, _ALL_N, 1, RC_OK},
- {PIPE_SIZE - 1, _ALL_N, PIPE_SIZE - 1, RC_OK},
- {PIPE_SIZE, _ALL_N, PIPE_SIZE, RC_OK},
- {PIPE_SIZE + 1, _ALL_N, 0, RC_FAIL}
- };
-
-static SIZE_EXPECT many_all_N[] = {
- {PIPE_SIZE / 3, _ALL_N, PIPE_SIZE / 3, RC_OK,},
- {PIPE_SIZE / 3, _ALL_N, PIPE_SIZE / 3, RC_OK,},
- {PIPE_SIZE / 3, _ALL_N, PIPE_SIZE / 3, RC_OK,},
- {PIPE_SIZE / 3, _ALL_N, 0, RC_FAIL}
- };
-
-static SIZE_EXPECT one_to_N[] = {
- {0, _1_TO_N, 0, RC_FAIL},
- {1, _1_TO_N, 1, RC_OK},
- {PIPE_SIZE - 1, _1_TO_N, PIPE_SIZE - 1, RC_OK},
- {PIPE_SIZE, _1_TO_N, PIPE_SIZE, RC_OK},
- {PIPE_SIZE + 1, _1_TO_N, PIPE_SIZE, RC_OK}
- };
-
-static SIZE_EXPECT many_one_to_N[] = {
- {PIPE_SIZE / 3, _1_TO_N, PIPE_SIZE / 3, RC_OK},
- {PIPE_SIZE / 3, _1_TO_N, PIPE_SIZE / 3, RC_OK},
- {PIPE_SIZE / 3, _1_TO_N, PIPE_SIZE / 3, RC_OK},
- {PIPE_SIZE / 3, _1_TO_N, 1, RC_OK},
- {PIPE_SIZE / 3, _1_TO_N, 0, RC_FAIL}
- };
-
-static SIZE_EXPECT zero_to_N[] = {
- {0, _0_TO_N, 0, RC_FAIL},
- {1, _0_TO_N, 1, RC_OK},
- {PIPE_SIZE - 1, _0_TO_N, PIPE_SIZE - 1, RC_OK},
- {PIPE_SIZE, _0_TO_N, PIPE_SIZE, RC_OK},
- {PIPE_SIZE + 1, _0_TO_N, PIPE_SIZE, RC_OK}
- };
-
-static SIZE_EXPECT many_zero_to_N[] = {
- {PIPE_SIZE / 3, _0_TO_N, PIPE_SIZE / 3, RC_OK},
- {PIPE_SIZE / 3, _0_TO_N, PIPE_SIZE / 3, RC_OK},
- {PIPE_SIZE / 3, _0_TO_N, PIPE_SIZE / 3, RC_OK},
- {PIPE_SIZE / 3, _0_TO_N, 1, RC_OK},
- {PIPE_SIZE / 3, _0_TO_N, 0, RC_OK}
- };
-
-/*
- * With the following 'wait' cases, the pipe buffer may be bypassed. It is
- * thus possible to transmit and receive via the pipe more bytes than its
- * buffer would allow.
- */
-
-static SIZE_EXPECT wait_all_N[] = {
- {0, _ALL_N, 0, RC_FAIL},
- {1, _ALL_N, 1, RC_OK},
- {PIPE_SIZE - 1, _ALL_N, PIPE_SIZE - 1, RC_OK},
- {PIPE_SIZE, _ALL_N, PIPE_SIZE, RC_OK},
- {PIPE_SIZE + 1, _ALL_N, PIPE_SIZE + 1, RC_OK}
- };
-
-static SIZE_EXPECT wait_one_to_N[] = {
- {0, _1_TO_N, 0, RC_FAIL},
- {1, _1_TO_N, 1, RC_OK},
- {PIPE_SIZE - 1, _1_TO_N, PIPE_SIZE - 1, RC_OK},
- {PIPE_SIZE, _1_TO_N, PIPE_SIZE, RC_OK},
- {PIPE_SIZE + 1, _1_TO_N, PIPE_SIZE + 1, RC_OK}
- };
-
-static SIZE_EXPECT timeout_cases[] = {
- {0, _ALL_N, 0, RC_FAIL},
- {1, _ALL_N, 0, RC_TIME},
- {PIPE_SIZE - 1, _ALL_N, 0 , RC_TIME},
- {PIPE_SIZE, _ALL_N, 0, RC_TIME},
- {PIPE_SIZE + 1, _ALL_N, 0, RC_TIME},
- {0, _1_TO_N, 0, RC_FAIL},
- {1, _1_TO_N, 0, RC_TIME},
- {PIPE_SIZE - 1, _1_TO_N, 0, RC_TIME},
- {PIPE_SIZE, _1_TO_N, 0, RC_TIME},
- {PIPE_SIZE + 1, _1_TO_N, 0, RC_TIME},
- {0, _0_TO_N, 0, RC_FAIL},
- {1, _0_TO_N, 0, RC_FAIL},
- {PIPE_SIZE - 1, _0_TO_N, 0, RC_FAIL},
- {PIPE_SIZE, _0_TO_N, 0, RC_FAIL},
- {PIPE_SIZE + 1, _0_TO_N, 0, RC_FAIL}
- };
-
-extern ksem_t regSem;
-extern ksem_t altSem;
-extern ksem_t counterSem;
-
-extern kpipe_t pipeId;
-
-/**
- *
- * @brief Initialize objects used in this microkernel test suite
- *
- * @return N/A
- */
-
-void microObjectsInit(void)
-{
- int i; /* loop counter */
-
- for (i = 0; i < sizeof(rxBuffer); i++) {
- txBuffer[i] = (char) i;
- }
-}
-
-/**
- *
- * @brief Check the contents of the receive buffer
- *
- * @param buffer pointer to buffer to check
- * @param size number of bytes to check
- *
- * @return <size> on success, index of wrong character on failure
- */
-
-int receiveBufferCheck(char *buffer, int size)
-{
- int j; /* loop counter */
-
- for (j = 0; j < size; j++) {
- if (buffer[j] != (char) j) {
- return j;
- }
- }
-
- return size;
-}
-
-/**
- *
- * @brief Helper routine to pipePutTest()
- *
- * @param singleItems testcase list (one item in the pipe)
- * @param nSingles number of items in testcase
- * @param manyItems testcase list (many items in the pipe)
- * @param nMany number of items in testcase
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutHelperWork(SIZE_EXPECT *singleItems, int nSingles,
- SIZE_EXPECT *manyItems, int nMany)
-{
- int i; /* loop counter */
- int j; /* loop counter */
- int rv; /* value returned from task_pipe_get() */
- int index; /* index to corrupted byte in buffer */
- int bytesReceived; /* number of bytes received */
-
- for (i = 0; i < nSingles; i++) {
- (void)task_sem_take(altSem, TICKS_UNLIMITED);
- for (j = 0; j < sizeof(rxBuffer); j++) {
- rxBuffer[j] = 0;
- }
-
- rv = task_pipe_get(pipeId, rxBuffer, singleItems[i].size,
- &bytesReceived, singleItems[i].options,
- TICKS_NONE);
- if (rv != singleItems[i].rcode) {
- TC_ERROR("task_pipe_get(%d bytes) : Expected %d not %d.\n"
- " bytesReceived = %d\n",
- singleItems[i].size, singleItems[i].rcode,
- rv, bytesReceived);
- return TC_FAIL;
- }
-
- if (bytesReceived != singleItems[i].sent) {
- TC_ERROR("task_pipe_get(%d) : "
- "Expected %d bytes to be received, not %d\n",
- singleItems[i].size, singleItems[i].sent, bytesReceived);
- return TC_FAIL;
- }
-
- index = receiveBufferCheck(rxBuffer, bytesReceived);
- if (index != bytesReceived) {
- TC_ERROR("pipePutHelper: rxBuffer[%d] is %d, not %d\n",
- index, rxBuffer[index], index);
- return TC_FAIL;
- }
-
- task_sem_give(counterSem);
- task_sem_give(regSem);
- }
-
- /*
- * Get items from the pipe. There should be more than one item
- * stored in it.
- */
-
- (void)task_sem_take(altSem, TICKS_UNLIMITED);
-
- for (i = 0; i < nMany; i++) {
- for (j = 0; j < sizeof(rxBuffer); j++) {
- rxBuffer[j] = 0;
- }
-
- rv = task_pipe_get(pipeId, rxBuffer, manyItems[i].size,
- &bytesReceived, manyItems[i].options,
- TICKS_NONE);
-
- if (rv != manyItems[i].rcode) {
- TC_ERROR("task_pipe_get(%d bytes) : Expected %d not %d.\n"
- " bytesReceived = %d, iteration: %d\n",
- manyItems[i].size, manyItems[i].rcode,
- rv, bytesReceived, i+1);
- return TC_FAIL;
- }
-
- if (bytesReceived != manyItems[i].sent) {
- TC_ERROR("task_pipe_get(%d) : "
- "Expected %d bytes to be received, not %d\n",
- manyItems[i].size, manyItems[i].sent, bytesReceived);
- return TC_FAIL;
- }
-
- index = receiveBufferCheck(rxBuffer, bytesReceived);
- if (index != bytesReceived) {
- TC_ERROR("pipeGetHelper: rxBuffer[%d] is %d, not %d\n",
- index, rxBuffer[index], index);
- return TC_FAIL;
- }
-
- task_sem_give(counterSem);
- }
-
- task_sem_give(regSem); /* Wake the RegressionTask */
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper routine to pipePutTest()
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutHelper(void)
-{
- int rv; /* return value from pipePutHelperWork() */
-
- rv = pipePutHelperWork(all_N, ARRAY_SIZE(all_N),
- many_all_N, ARRAY_SIZE(many_all_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on all_N/many_all_N test\n");
- return TC_FAIL;
- }
-
- rv = pipePutHelperWork(one_to_N, ARRAY_SIZE(one_to_N),
- many_one_to_N, ARRAY_SIZE(many_one_to_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _1_TO_N/many_1_TO_N test\n");
- return TC_FAIL;
- }
-
- rv = pipePutHelperWork(zero_to_N, ARRAY_SIZE(zero_to_N),
- many_zero_to_N, ARRAY_SIZE(many_zero_to_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _0_TO_N/many_0_TO_N test\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_put(TICKS_NONE)
- *
- * This routine tests the task_pipe_put(TICKS_NONE) API.
- *
- * @param singleItems testcase list (one item in the pipe)
- * @param nSingles number of items in testcase
- * @param manyItems testcase list (many items in the pipe)
- * @param nMany number of items in testcase
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutTestWork(SIZE_EXPECT *singleItems, int nSingles,
- SIZE_EXPECT *manyItems, int nMany)
-{
- int rv; /* return code from task_pipe_put() */
- int i; /* loop counter */
- int bytesWritten; /* # of bytes sent to pipe */
- int nitem; /* expected item number processed by the other task */
-
- task_sem_reset(counterSem);
-
- for (i = 0; i < nSingles; i++) {
- rv = task_pipe_put(pipeId, txBuffer, singleItems[i].size,
- &bytesWritten, singleItems[i].options,
- TICKS_NONE);
- if (rv != singleItems[i].rcode) {
- TC_ERROR("task_pipe_put(%d) : Expected %d not %d.\n"
- " bytesWritten = %d, Iteration: %d\n",
- singleItems[i].size, singleItems[i].rcode,
- rv, bytesWritten, i + 1);
- return TC_FAIL;
- }
-
- if (bytesWritten != singleItems[i].sent) {
- TC_ERROR("task_pipe_put(%d) : "
- "Expected %d bytes to be written, not %d\n",
- singleItems[i].size, singleItems[i].sent, bytesWritten);
- return TC_FAIL;
- }
-
- task_sem_give(altSem);
- (void)task_sem_take(regSem, TICKS_UNLIMITED);
-
- nitem = task_sem_count_get(counterSem) - 1;
- if (nitem != i) {
- TC_ERROR("Expected item number is %d, not %d\n",
- i, nitem);
- return TC_FAIL;
- }
- }
-
- /* This time, more than one item will be in the pipe at a time */
-
- task_sem_reset(counterSem);
-
- for (i = 0; i < nMany; i++) {
- rv = task_pipe_put(pipeId, txBuffer, manyItems[i].size,
- &bytesWritten, manyItems[i].options, TICKS_NONE);
- if (rv != manyItems[i].rcode) {
- TC_ERROR("task_pipe_put(%d) : Expected %d not %d.\n"
- " bytesWritten = %d, iteration: %d\n",
- manyItems[i].size, manyItems[i].rcode,
- rv, bytesWritten, i + 1);
- return TC_FAIL;
- }
-
- if (bytesWritten != manyItems[i].sent) {
- TC_ERROR("task_pipe_put(%d) : "
- "Expected %d bytes to be written, not %d\n",
- manyItems[i].size, manyItems[i].sent, bytesWritten);
- return TC_FAIL;
- }
- }
-
- task_sem_give(altSem); /* Wake the alternate task */
- /* wait for other task reading all the items from pipe */
- (void)task_sem_take(regSem, TICKS_UNLIMITED);
-
- if (task_sem_count_get(counterSem) != nMany) {
- TC_ERROR("Expected number of items %d, not %d\n",
- nMany, task_sem_count_get(counterSem));
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_put(TICKS_NONE)
- *
- * This routine tests the task_pipe_put(TICKS_NONE) API.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutTest(void)
-{
- int rv; /* return value from pipePutTestWork() */
-
- rv = pipePutTestWork(all_N, ARRAY_SIZE(all_N),
- many_all_N, ARRAY_SIZE(many_all_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _ALL_N/many_ALL_N test\n");
- return TC_FAIL;
- }
-
- rv = pipePutTestWork(one_to_N, ARRAY_SIZE(one_to_N),
- many_one_to_N, ARRAY_SIZE(many_one_to_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _1_TO_N/many_1_TO_N test\n");
- return TC_FAIL;
- }
-
- rv = pipePutTestWork(zero_to_N, ARRAY_SIZE(zero_to_N),
- many_zero_to_N, ARRAY_SIZE(many_zero_to_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _0_TO_N/many_0_TO_N test\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Help test task_pipe_put(TICKS_UNLIMITED)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutWaitHelper(void)
-{
- int i; /* loop counter */
- int rv; /* return value from task_pipe_get*/
- int bytesRead; /* # of bytes read from task_pipe_get() */
-
- /* Wait until test is ready */
- (void)task_sem_take(altSem, TICKS_UNLIMITED);
-
- /*
- * 1. task_pipe_get(TICKS_UNLIMITED) will force a context
- * switch to RegressionTask().
- */
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _ALL_N, TICKS_UNLIMITED);
- if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
- return TC_FAIL;
- }
-
- /*
- * 2. task_pipe_get(TICKS_UNLIMITED) will force a context
- * switch to RegressionTask().
- */
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _1_TO_N, TICKS_UNLIMITED);
- if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
- return TC_FAIL;
- }
-
- /*
- * Before emptying the pipe, check that task_pipe_get(TICKS_UNLIMITED)
- * fails when using the _0_TO_N option.
- */
-
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N, TICKS_UNLIMITED);
- if (rv != RC_FAIL) {
- TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
- return TC_FAIL;
- }
-
- /* 3. Empty the pipe in two reads */
- for (i = 0; i < 2; i++) {
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N, TICKS_NONE);
- if ((rv != RC_OK) || (bytesRead != PIPE_SIZE / 2)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE / 2, bytesRead);
- return TC_FAIL;
- }
- }
-
- task_sem_give(regSem);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_put(TICKS_UNLIMITED)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutWaitTest(void)
-{
- int rv; /* return code from task_pipe_put() */
- int bytesWritten; /* # of bytes written to pipe */
-
- /* 1. Fill the pipe */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, TICKS_UNLIMITED);
- if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
- return TC_FAIL;
- }
-
- task_sem_give(altSem); /* Wake the alternate task */
-
- /* 2. task_pipe_put() will force a context switch to AlternateTask(). */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, TICKS_UNLIMITED);
- if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
- return TC_FAIL;
- }
-
- /* 3. task_pipe_put() will force a context switch to AlternateTask(). */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _1_TO_N, TICKS_UNLIMITED);
- if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
- return TC_FAIL;
- }
-
- /* This should return immediately as _0_TO_N with a wait is an error. */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _0_TO_N, TICKS_UNLIMITED);
- if ((rv != RC_FAIL) || (bytesWritten != 0)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_FAIL, rv, 0, bytesWritten);
- return TC_FAIL;
- }
-
- /* Wait for AlternateTask()'s pipePutWaitHelper() to finish */
- (void)task_sem_take(regSem, TICKS_UNLIMITED);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_get(timeout)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutTimeoutHelper(void)
-{
- int i; /* loop counter */
- int rv; /* return value from task_pipe_get() */
- int bytesRead; /* # of bytes read from task_pipe_get() */
-
- /* Wait until test is ready */
- (void)task_sem_take(altSem, TICKS_UNLIMITED);
-
- /*
- * 1. task_pipe_get(timeout) will force a context
- * switch to RegressionTask()
- */
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _ALL_N, ONE_SECOND);
- if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
- return TC_FAIL;
- }
-
- /*
- * 2. task_pipe_get(timeout) will force a context
- * switch to RegressionTask().
- */
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _1_TO_N, ONE_SECOND);
- if ((rv != RC_OK) || (bytesRead != PIPE_SIZE)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE, bytesRead);
- return TC_FAIL;
- }
-
- /*
- * Before emptying the pipe, check that task_pipe_get(timeout) fails when
- * using the _0_TO_N option.
- */
-
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N, ONE_SECOND);
- if (rv != RC_FAIL) {
- TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
- return TC_FAIL;
- }
-
- /* 3. Empty the pipe in two reads */
- for (i = 0; i < 2; i++) {
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE / 2,
- &bytesRead, _0_TO_N, TICKS_NONE);
- if ((rv != RC_OK) || (bytesRead != PIPE_SIZE / 2)) {
- TC_ERROR("Expected return code %d, not %d\n"
- "Expected %d bytes to be read, not %d\n",
- RC_OK, rv, PIPE_SIZE / 2, bytesRead);
- return TC_FAIL;
- }
- }
-
- task_sem_give(regSem);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_put(timeout)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipePutTimeoutTest(void)
-{
- int rv; /* return code from task_pipe_put() */
- int bytesWritten; /* # of bytes written to task_pipe_put() */
-
- /* 1. Fill the pipe */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, ONE_SECOND);
- if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
- return TC_FAIL;
- }
-
- /* Timeout while waiting to put data into the pipe */
-
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, ONE_SECOND);
- if ((rv != RC_TIME) || (bytesWritten != 0)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_TIME, rv, 0, bytesWritten);
- return TC_FAIL;
- }
-
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _1_TO_N, ONE_SECOND);
- if ((rv != RC_TIME) || (bytesWritten != 0)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_TIME, rv, 0, bytesWritten);
- return TC_FAIL;
- }
-
- task_sem_give(altSem); /* Wake the alternate task */
-
- /* 2. task_pipe_put() will force a context switch to AlternateTask(). */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _ALL_N, ONE_SECOND);
- if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
- return TC_FAIL;
- }
-
- /* 3. task_pipe_put() will force a context switch to AlternateTask(). */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _1_TO_N, ONE_SECOND);
- if ((rv != RC_OK) || (bytesWritten != PIPE_SIZE)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_OK, rv, PIPE_SIZE, bytesWritten);
- return TC_FAIL;
- }
-
- /* This should return immediately as _0_TO_N with a wait is an error. */
- rv = task_pipe_put(pipeId, txBuffer, PIPE_SIZE,
- &bytesWritten, _0_TO_N, TICKS_UNLIMITED);
- if ((rv != RC_FAIL) || (bytesWritten != 0)) {
- TC_ERROR("Return code: expected %d, got %d\n"
- "Bytes written: expected %d, got %d\n",
- RC_FAIL, rv, 0, bytesWritten);
- return TC_FAIL;
- }
-
- /* Wait for AlternateTask()'s pipePutWaitHelper() to finish */
- (void)task_sem_take(regSem, TICKS_UNLIMITED);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Routine to test task_pipe_get(TICKS_NONE)
- *
- * This routine tests the task_pipe_get(TICKS_NONE) API. Some of this
- * functionality has already been tested while testing task_pipe_put(). As
- * a result, the only remaining functionality that needs to be checked are
- * attempts to get data from an empty pipe.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipeGetTest(void)
-{
- int i; /* loop counter */
- int j; /* loop counter */
- int rv; /* return code from task_pipe_get() */
- int bytesRead; /* # of bytes read from task_pipe_get() */
- int size[] ={1, PIPE_SIZE - 1, PIPE_SIZE, PIPE_SIZE + 1};
- K_PIPE_OPTION options[] = {_ALL_N, _1_TO_N};
-
- for (j = 0; j < ARRAY_SIZE(options); j++) {
- for (i = 0; i < ARRAY_SIZE(size); i++) {
- rv = task_pipe_get(pipeId, rxBuffer, size[i],
- &bytesRead, options[j], TICKS_NONE);
- if (rv != RC_FAIL) {
- TC_ERROR("Expected return code %d, not %d\n", RC_FAIL, rv);
- return TC_FAIL;
- }
- }
- }
-
- for (i = 0; i < ARRAY_SIZE(size); i++) {
- rv = task_pipe_get(pipeId, rxBuffer, size[i],
- &bytesRead, _0_TO_N, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("Expected return code %d, not %d\n", RC_OK, rv);
- return TC_FAIL;
- }
-
- if (bytesRead != 0) {
- TC_ERROR("Expected <bytesRead> %d, not %d\n", 0, bytesRead);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_get(TICKS_UNLIMITED)
- *
- * @param items testcase list for task_pipe_get(TICKS_UNLIMITED)
- * @param nItems number of items in list
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipeGetWaitHelperWork(SIZE_EXPECT *items, int nItems)
-{
- int i; /* loop counter */
- int rv; /* return value from task_pipe_put() */
- int bytesSent; /* # of bytes sent to task_pipe_put() */
-
- for (i = 0; i < nItems; i++) {
- /*
- * Pipe should be empty. Most calls to task_pipe_get(TICKS_UNLIMITED)
- * should block until the call to task_pipe_put() is performed in the
- * routine pipeGetWaitHelperWork().
- */
-
- bytesSent = 0;
- rv = task_pipe_put(pipeId, rxBuffer, items[i].size,
- &bytesSent, items[i].options,
- TICKS_UNLIMITED);
- if ((rv != items[i].rcode) || (bytesSent != items[i].sent)) {
- TC_ERROR("Expected return value %d, got %d\n"
- "Expected bytesSent = %d, got %d\n",
- items[i].rcode, rv, 0, bytesSent);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_get(TICKS_UNLIMITED)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipeGetWaitHelper(void)
-{
- int rv; /* return coded form pipeGetWaitHelperWork() */
-
- (void)task_sem_take(altSem, TICKS_UNLIMITED);
-
- rv = pipeGetWaitHelperWork(wait_all_N, ARRAY_SIZE(wait_all_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _ALL_N test\n");
- return TC_FAIL;
- }
-
- rv = pipeGetWaitHelperWork(wait_one_to_N, ARRAY_SIZE(wait_one_to_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _1_TO_N test\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_get(TICKS_UNLIMITED)
- *
- * @param items testcase list for task_pipe_get(TICKS_UNLIMITED)
- * @param nItems number of items in list
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipeGetWaitTestWork(SIZE_EXPECT *items, int nItems)
-{
- int i; /* loop counter */
- int rv; /* return code from task_pipe_get() */
- int bytesRead; /* # of bytes read from task_pipe_get() */
-
- for (i = 0; i < nItems; i++) {
- /*
- * Pipe should be empty. Most calls to task_pipe_get(TICKS_UNLIMITED)
- * should block until the call to task_pipe_put() is performed in the
- * routine pipeGetWaitHelperWork().
- */
-
- rv = task_pipe_get(pipeId, rxBuffer, items[i].size,
- &bytesRead, items[i].options,
- TICKS_UNLIMITED);
- if ((rv != items[i].rcode) || (bytesRead != items[i].sent)) {
- TC_ERROR("Expected return value %d, got %d\n"
- "Expected bytesRead = %d, got %d\n",
- items[i].rcode, rv, 0, bytesRead);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_pipe_get(TICKS_UNLIMITED)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipeGetWaitTest(void)
-{
- int rv; /* return code from pipeGetWaitTestWork() */
- int bytesRead; /* # of bytes read from task_pipe_get_waitait() */
-
- task_sem_give(altSem); /* Wake AlternateTask */
-
- rv = pipeGetWaitTestWork(wait_all_N, ARRAY_SIZE(wait_all_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _ALL_N test\n");
- return TC_FAIL;
- }
-
- rv = pipeGetWaitTestWork(wait_one_to_N, ARRAY_SIZE(wait_one_to_N));
- if (rv != TC_PASS) {
- TC_ERROR("Failed on _1_TO_N test\n");
- return TC_FAIL;
- }
-
- rv = task_pipe_get(pipeId, rxBuffer, PIPE_SIZE,
- &bytesRead, _0_TO_N, TICKS_UNLIMITED);
- if (rv != RC_FAIL) {
- TC_ERROR("Expected return code of %d, not %d\n", RC_FAIL, rv);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test remaining task_pipe_get(timeout) functionality
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int pipeGetTimeoutTest(void)
-{
- int i; /* loop counter */
- int rv; /* return value from task_pipe_get() */
- int bytesRead; /* # of bytes read from task_pipe_get() */
-
- for (i = 0; i < ARRAY_SIZE(timeout_cases); i++) {
- rv = task_pipe_get(pipeId, rxBuffer, timeout_cases[i].size,
- &bytesRead, timeout_cases[i].options,
- ONE_SECOND);
- if ((rv != timeout_cases[i].rcode) ||
- (bytesRead != timeout_cases[i].sent)) {
- TC_ERROR("Expected return code %d, got %d\n"
- "Expected <bytesRead> %d, got %d\n"
- "Iteration %d\n",
- timeout_cases[i].rcode, rv, timeout_cases[i].sent,
- bytesRead, i + 1);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Alternate task in the test suite
- *
- * This routine runs at a lower priority than RegressionTask().
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int AlternateTask(void)
-{
- int rv; /* return code from each set of test cases */
-
- rv = pipePutHelper();
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- rv = pipePutWaitHelper();
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- rv = pipePutTimeoutHelper();
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- /*
- * There is no pipeGetHelper() as the task_pipe_get() checks have
- * either been done in pipePutHelper(), or pipeGetTest().
- */
-
- rv = pipeGetWaitHelper();
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- /*
- * There is no pipeGetTimeoutHelper() as the task_pipe_get(timeout) checks
- * have either been done in pipePutTimeoutHelper() or
- * pipeGetTimeoutTest().
- */
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Main task in the test suite
- *
- * This is the entry point to the pipe test suite.
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int RegressionTask(void)
-{
- int tcRC; /* test case return code */
-
- microObjectsInit();
-
- TC_PRINT("Testing task_pipe_put(TICKS_NONE) ...\n");
- tcRC = pipePutTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing task_pipe_put(TICKS_UNLIMITED) ...\n");
- tcRC = pipePutWaitTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing task_pipe_put(timeout) ...\n");
- tcRC = pipePutTimeoutTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing task_pipe_get(TICKS_NONE) ...\n");
- tcRC = pipeGetTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing task_pipe_get(TICKS_UNLIMITED) ...\n");
- tcRC = pipeGetWaitTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing task_pipe_get(timeout) ...\n");
- tcRC = pipeGetTimeoutTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
diff --git a/samples/microkernel/test/test_pipe/testcase.ini b/samples/microkernel/test/test_pipe/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_pipe/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_pipe_priv/Makefile b/samples/microkernel/test/test_pipe_priv/Makefile
deleted file mode 100644
index 1b7e86284..000000000
--- a/samples/microkernel/test/test_pipe_priv/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR := $(ZEPHYR_BASE)/samples/microkernel/test/test_pipe/src
-
-# Enable testing for private microkernel pipe objects
-CFLAGS = -DTEST_PRIV_PIPES
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_pipe_priv/README.txt b/samples/microkernel/test/test_pipe_priv/README.txt
deleted file mode 100644
index f13def99f..000000000
--- a/samples/microkernel/test/test_pipe_priv/README.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-Title: Private Pipes
-
-Description:
-
-This test verifies that the microkernel pipe APIs operate as expected.
-This also verifies the mechanism to define private pipe object and its usage.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting pipe tests
-===================================================================
-Testing task_pipe_put(TICKS_NONE) ...
-Testing task_pipe_put(TICKS_UNLIMITED) ...
-Testing task_pipe_put(timeout) ...
-Testing task_pipe_get(TICKS_NONE) ...
-Testing task_pipe_get(TICKS_UNLIMITED) ...
-Testing task_pipe_get(timeout) ...
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_pipe_priv/prj.mdef b/samples/microkernel/test/test_pipe_priv/prj.mdef
deleted file mode 100644
index 21ea668cc..000000000
--- a/samples/microkernel/test/test_pipe_priv/prj.mdef
+++ /dev/null
@@ -1,25 +0,0 @@
-% Application : test microkernel target pipe APIs
-
-% Please keep this in-sync with ../test_pipe/prj.mdef
-% except those specified below
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK MONITORTASK 4 MonitorTaskEntry 2048 [EXE]
- TASK tStartTask 5 RegressionTaskEntry 2048 [EXE]
- TASK tAlternate 6 AlternateTaskEntry 2048 [EXE]
-
-% PIPE PIPE_ID is defined within the source file,
-% so keep it commented out here.
-%
-% PIPE NAME BUFFERSIZE
-% =============================
-% PIPE PIPE_ID 256
-
-% SEMA NAME
-% ===================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA ALTERNATE_SEM
- SEMA REGRESSION_SEM
- SEMA COUNTER_SEM
diff --git a/samples/microkernel/test/test_pipe_priv/prj_arm.conf b/samples/microkernel/test/test_pipe_priv/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_pipe_priv/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_pipe_priv/prj_x86.conf b/samples/microkernel/test/test_pipe_priv/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_pipe_priv/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_pipe_priv/testcase.ini b/samples/microkernel/test/test_pipe_priv/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_pipe_priv/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_pool/Makefile b/samples/microkernel/test/test_pool/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_pool/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_pool/README.txt b/samples/microkernel/test/test_pool/README.txt
deleted file mode 100644
index 6ef81dde3..000000000
--- a/samples/microkernel/test/test_pool/README.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Title: Memory Pool APIs
-
-Description:
-
-This test verifies that the microkernel memory pool APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Memory Pools
-Testing task_mem_pool_alloc(TICKS_NONE) ...
-Testing task_mem_pool_alloc(timeout) ...
-Testing task_mem_pool_alloc(TICKS_UNLIMITED) ...
-Testing task_mem_pool_defragment() ...
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_pool/prj.mdef b/samples/microkernel/test/test_pool/prj.mdef
deleted file mode 100644
index 656acb41d..000000000
--- a/samples/microkernel/test/test_pool/prj.mdef
+++ /dev/null
@@ -1,20 +0,0 @@
-% Application : test microkernel memory pool APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK tStartTask 5 RegressionTask 2048 [EXE]
- TASK tAlternate 6 AlternateTask 2048 [EXE]
- TASK tDefrag 7 DefragTask 2048 [EXE]
- TASK tHelper 7 HelperTask 2048 [EXE]
-
-% SEMA NAME
-% ==================
- SEMA ALTERNATE_SEM
- SEMA DEFRAG_SEM
- SEMA REGRESS_SEM
- SEMA HELPER_SEM
-
-% POOL NAME MIN MAX NMAX
-% =======================================
- POOL POOL_ID 64 4096 1
- POOL SECOND_POOL_ID 16 1024 5
diff --git a/samples/microkernel/test/test_pool/prj_arm.conf b/samples/microkernel/test/test_pool/prj_arm.conf
deleted file mode 100644
index 0e53b3c71..000000000
--- a/samples/microkernel/test/test_pool/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NUM_IRQS=2
diff --git a/samples/microkernel/test/test_pool/prj_x86.conf b/samples/microkernel/test/test_pool/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/microkernel/test/test_pool/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_pool/src/Makefile b/samples/microkernel/test/test_pool/src/Makefile
deleted file mode 100644
index fa7293eb8..000000000
--- a/samples/microkernel/test/test_pool/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = pool.o
diff --git a/samples/microkernel/test/test_pool/src/pool.c b/samples/microkernel/test/test_pool/src/pool.c
deleted file mode 100644
index c62912fc9..000000000
--- a/samples/microkernel/test/test_pool/src/pool.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/* pool.c - test microkernel memory pool APIs */
-
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This modules tests the following memory pool routines:
-
- task_mem_pool_alloc(),
- task_mem_pool_free()
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <misc/util.h>
-
-#define ONE_SECOND (sys_clock_ticks_per_sec)
-#define TENTH_SECOND (sys_clock_ticks_per_sec / 10)
-
-#define NUM_BLOCKS 64
-
-#define DEFRAG_BLK_TEST 2222
-
-typedef struct {
- struct k_block *block; /* pointer to block data */
- kmemory_pool_t poolId; /* pool ID */
- int size; /* request size in bytes */
- int32_t timeout; /* # of ticks to wait */
- int rcode; /* expected return code */
-} TEST_CASE;
-
-typedef int (*poolBlockGetFunc_t)(struct k_block *, kmemory_pool_t, int, int32_t);
-typedef int (*poolMoveBlockFunc_t)(struct k_block *, kmemory_pool_t);
-
-static volatile int evidence = 0;
-
-static struct k_block blockList[NUM_BLOCKS];
-static struct k_block helperBlock;
-
-static TEST_CASE getSet[] = {
- {&blockList[0], POOL_ID, 0, 0, RC_OK},
- {&blockList[1], POOL_ID, 1, 0, RC_OK},
- {&blockList[2], POOL_ID, 32, 0, RC_OK},
- {&blockList[3], POOL_ID, 64, 0, RC_OK},
- {&blockList[4], POOL_ID, 128, 0, RC_OK},
- {&blockList[5], POOL_ID, 256, 0, RC_OK},
- {&blockList[6], POOL_ID, 512, 0, RC_OK},
- {&blockList[7], POOL_ID, 1024, 0, RC_OK},
- {&blockList[8], POOL_ID, 2048, 0, RC_FAIL},
- {&blockList[9], POOL_ID, 4096, 0, RC_FAIL}
-};
-
-static TEST_CASE getSet2[] = {
- {&blockList[0], POOL_ID, 4096, 0, RC_OK},
- {&blockList[1], POOL_ID, 2048, 0, RC_FAIL},
- {&blockList[2], POOL_ID, 1024, 0, RC_FAIL},
- {&blockList[3], POOL_ID, 512, 0, RC_FAIL},
- {&blockList[4], POOL_ID, 256, 0, RC_FAIL}
-};
-
-static TEST_CASE getwtSet[] = {
- {&blockList[0], POOL_ID, 4096, TENTH_SECOND, RC_OK},
- {&blockList[1], POOL_ID, 2048, TENTH_SECOND, RC_TIME},
- {&blockList[2], POOL_ID, 1024, TENTH_SECOND, RC_TIME},
- {&blockList[3], POOL_ID, 512, TENTH_SECOND, RC_TIME},
- {&blockList[4], POOL_ID, 256, TENTH_SECOND, RC_TIME}
-};
-
-static TEST_CASE defrag[] = {
- {&blockList[0], POOL_ID, 64, 0, RC_OK},
- {&blockList[1], POOL_ID, 64, 0, RC_OK},
- {&blockList[2], POOL_ID, 64, 0, RC_OK},
- {&blockList[3], POOL_ID, 64, 0, RC_OK},
- {&blockList[4], POOL_ID, 256, 0, RC_OK},
- {&blockList[5], POOL_ID, 256, 0, RC_OK},
- {&blockList[6], POOL_ID, 256, 0, RC_OK},
- {&blockList[7], POOL_ID, 1024, 0, RC_OK},
- {&blockList[8], POOL_ID, 1024, 0, RC_OK},
- {&blockList[9], POOL_ID, 1024, 0, RC_OK}
-};
-
-/**
- *
- * @brief Compare the two blocks
- *
- * @return 0 if the same, non-zero if not the same
- */
-
-int blockCompare(struct k_block *b1, struct k_block *b2)
-{
- char *p1 = (char *) b1;
- char *p2 = (char *) b2;
- int i;
- int diff;
-
- for (i = 0; i < sizeof(struct k_block); i++) {
- diff = p2[i] - p1[i];
- if (diff != 0) {
- break;
- }
- }
-
- return diff;
-}
-
-/**
- *
- * @brief Wrapper for task_mem_pool_alloc()
- *
- * @return task_mem_pool_alloc() return value
- */
-
-int poolBlockGetFunc(struct k_block *block, kmemory_pool_t pool, int size,
- int32_t unused)
-{
- ARG_UNUSED(unused);
-
- return task_mem_pool_alloc(block, pool, size, TICKS_NONE);
-}
-
-/**
- *
- * @brief Wrapper for task_mem_pool_alloc(TICKS_UNLIMITED)
- *
- * @return task_mem_pool_alloc() return value
- */
-
-int poolBlockGetWFunc(struct k_block *block, kmemory_pool_t pool, int size,
- int32_t unused)
-{
- ARG_UNUSED(unused);
-
- return task_mem_pool_alloc(block, pool, size, TICKS_UNLIMITED);
-}
-
-/**
- *
- * @brief Wrapper for task_mem_pool_alloc(timeout)
- *
- * @return task_mem_pool_alloc(timeout) return value
- */
-
-int poolBlockGetWTFunc(struct k_block *block, kmemory_pool_t pool,
- int size, int32_t timeout)
-{
- return task_mem_pool_alloc(block, pool, size, timeout);
-}
-
-/**
- *
- * @brief Free any blocks allocated in the test set
- *
- * @return N/A
- */
-
-void freeBlocks(TEST_CASE *tests, int nTests)
-{
- int i;
-
- for (i = 0; i < nTests; i++) {
- if (tests[i].rcode == RC_OK) {
- task_mem_pool_free(tests[i].block);
- }
- }
-}
-
-/**
- *
- * @brief Perform the work of getting blocks
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int poolBlockGetWork(char *string, poolBlockGetFunc_t func,
- TEST_CASE *tests, int nTests)
-{
- int i;
- int rv;
-
- for (i = 0; i < nTests; i++) {
- rv = func(tests[i].block, tests[i].poolId, tests[i].size,
- tests[i].timeout);
- if (rv != tests[i].rcode) {
- TC_ERROR("%s() expected %d, got %d\n"
- "size: %d, timeout: %d\n", string, tests[i].rcode, rv,
- tests[i].size, tests[i].timeout);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the task_mem_pool_alloc(TICKS_NONE) API
- *
- * The pool is 4 kB in size.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int poolBlockGetTest(void)
-{
- int rv; /* return value from task_mem_pool_alloc() */
- int j; /* loop counter */
-
- for (j = 0; j < 8; j++) {
- rv = poolBlockGetWork("task_mem_pool_alloc", poolBlockGetFunc,
- getSet, ARRAY_SIZE(getSet));
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- freeBlocks(getSet, ARRAY_SIZE(getSet));
-
- rv = poolBlockGetWork("task_mem_pool_alloc", poolBlockGetFunc,
- getSet2, ARRAY_SIZE(getSet2));
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- freeBlocks(getSet2, ARRAY_SIZE(getSet2));
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper task to poolBlockGetTimeoutTest()
- *
- * @return N/A
- */
-
-void HelperTask(void)
-{
- task_sem_take(HELPER_SEM, TICKS_UNLIMITED);
-
- task_sem_give(REGRESS_SEM);
- task_mem_pool_free(&helperBlock);
-}
-
-/**
- *
- * @brief Test task_mem_pool_alloc(timeout)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int poolBlockGetTimeoutTest(void)
-{
- struct k_block block;
- int rv; /* return value from task_mem_pool_alloc() */
- int j; /* loop counter */
-
- for (j = 0; j < 8; j++) {
- rv = poolBlockGetWork("task_mem_pool_alloc", poolBlockGetWTFunc,
- getwtSet, ARRAY_SIZE(getwtSet));
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
- freeBlocks(getwtSet, ARRAY_SIZE(getwtSet));
- }
-
- rv = task_mem_pool_alloc(&helperBlock, POOL_ID, 3148, 5);
- if (rv != RC_OK) {
- TC_ERROR("Failed to get size 3148 byte block from POOL_ID\n");
- return TC_FAIL;
- }
-
- rv = task_mem_pool_alloc(&block, POOL_ID, 3148, TICKS_NONE);
- if (rv != RC_FAIL) {
- TC_ERROR("Unexpectedly got size 3148 byte block from POOL_ID\n");
- return TC_FAIL;
- }
-
- task_sem_give(HELPER_SEM); /* Activate HelperTask */
- rv = task_mem_pool_alloc(&block, POOL_ID, 3148, 20);
- if (rv != RC_OK) {
- TC_ERROR("Failed to get size 3148 byte block from POOL_ID\n");
- return TC_FAIL;
- }
-
- rv = task_sem_take(REGRESS_SEM, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("Failed to get size 3148 byte block within 20 ticks\n");
- return TC_FAIL;
- }
-
- task_mem_pool_free(&block);
-
- return TC_PASS;
-}
-
-/**
- *
- * poolBlockGetWaitTest -
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int poolBlockGetWaitTest(void)
-{
- int rv;
-
- rv = task_mem_pool_alloc(&blockList[0], POOL_ID, 3000, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- TC_ERROR("task_mem_pool_alloc(3000) expected %d, got %d\n", RC_OK, rv);
- return TC_FAIL;
- }
-
- task_sem_give(ALTERNATE_SEM); /* Wake AlternateTask */
- evidence = 0;
- rv = task_mem_pool_alloc(&blockList[1], POOL_ID, 128, TICKS_UNLIMITED);
- if (rv != RC_OK) {
- TC_ERROR("task_mem_pool_alloc(128) expected %d, got %d\n", RC_OK, rv);
- return TC_FAIL;
- }
-
- switch (evidence) {
- case 0:
- TC_ERROR("task_mem_pool_alloc(128) did not block!\n");
- return TC_FAIL;
- case 1:
- break;
- case 2:
- default:
- TC_ERROR("Rescheduling did not occur after task_mem_pool_free()\n");
- return TC_FAIL;
- }
-
- task_mem_pool_free(&blockList[1]);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Task responsible for defragmenting the pool POOL_ID
- *
- * @return N/A
- */
-
-void DefragTask(void)
-{
- task_sem_take(DEFRAG_SEM, TICKS_UNLIMITED); /* Wait to be activated */
-
- task_mem_pool_defragment(POOL_ID);
-
- task_sem_give(REGRESS_SEM); /* DefragTask is finished */
-}
-
-/**
- *
- * poolDefragTest -
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int poolDefragTest(void)
-{
- int rv;
- struct k_block newBlock;
-
- /* Get a bunch of blocks */
-
- rv = poolBlockGetWork("task_mem_pool_alloc", poolBlockGetFunc,
- defrag, ARRAY_SIZE(defrag));
- if (rv != TC_PASS) {
- return TC_FAIL;
- }
-
-
- task_sem_give(DEFRAG_SEM); /* Activate DefragTask */
-
- /*
- * Block on getting another block from the pool.
- * This will allow DefragTask to execute so that we can get some
- * better code coverage. 50 ticks is expected to more than sufficient
- * time for DefragTask to finish.
- */
-
- rv = task_mem_pool_alloc(&newBlock, POOL_ID, DEFRAG_BLK_TEST, 50);
- if (rv != RC_TIME) {
- TC_ERROR("task_mem_pool_alloc() returned %d, not %d\n", rv, RC_TIME);
- return TC_FAIL;
- }
-
- rv = task_sem_take(REGRESS_SEM, TICKS_NONE);
- if (rv != RC_OK) {
- TC_ERROR("DefragTask did not finish in allotted time!\n");
- return TC_FAIL;
- }
-
- /* Free the allocated blocks */
-
- freeBlocks(defrag, ARRAY_SIZE(defrag));
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Alternate task in the test suite
- *
- * This routine runs at a lower priority than RegressionTask().
- *
- * @return N/A
- */
-
-void AlternateTask(void)
-{
- task_sem_take(ALTERNATE_SEM, TICKS_UNLIMITED);
-
- evidence = 1;
-
- task_mem_pool_free(&blockList[0]);
-
- evidence = 2;
-}
-
-/**
- *
- * @brief Main task in the test suite
- *
- * This is the entry point to the memory pool test suite.
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int tcRC; /* test case return code */
-
- TC_START("Test Microkernel Memory Pools");
-
- TC_PRINT("Testing task_mem_pool_alloc(TICKS_NONE) ...\n");
- tcRC = poolBlockGetTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing task_mem_pool_alloc(timeout) ...\n");
- tcRC = poolBlockGetTimeoutTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing task_mem_pool_alloc(TICKS_UNLIMITED) ...\n");
- tcRC = poolBlockGetWaitTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing task_mem_pool_defragment() ...\n");
- tcRC = poolDefragTest();
- if (tcRC != TC_PASS) {
- goto doneTests;
- }
-
-doneTests:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-}
diff --git a/samples/microkernel/test/test_pool/testcase.ini b/samples/microkernel/test/test_pool/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_pool/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_rand32/Makefile b/samples/microkernel/test/test_rand32/Makefile
deleted file mode 100644
index 551d4dd69..000000000
--- a/samples/microkernel/test/test_rand32/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-# Makefile - random number generator regression testing Makefile for microkernel
-#
-# Copyright (c) 2015 Wind River Systems, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj.conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_rand32/README.txt b/samples/microkernel/test/test_rand32/README.txt
deleted file mode 100644
index 4bb1ad6d7..000000000
--- a/samples/microkernel/test/test_rand32/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Title: Random Number Generator APIs
-
-Description:
-
-This test verifies the following random number APIs operate
-as expected:
-sys_rand32_get()
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make pristine
- make qemu
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting random number tests
-===================================================================
-Generating random numbers
-Generated 10 values with expected randomness
-===================================================================
-PASS - RegressionTaskEntry.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_rand32/prj.conf b/samples/microkernel/test/test_rand32/prj.conf
deleted file mode 100644
index 24ee63a0a..000000000
--- a/samples/microkernel/test/test_rand32/prj.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Use non-random number generator if platform does not
-# provide one
-# This option is NOT to be used in production code.
-CONFIG_TEST_RANDOM_GENERATOR=y
-
diff --git a/samples/microkernel/test/test_rand32/prj.mdef b/samples/microkernel/test/test_rand32/prj.mdef
deleted file mode 100644
index 9b598eb59..000000000
--- a/samples/microkernel/test/test_rand32/prj.mdef
+++ /dev/null
@@ -1,6 +0,0 @@
-% Application : test random number APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =======================================================
- TASK tTestTask 5 RegressionTaskEntry 2048 [EXE]
-
diff --git a/samples/microkernel/test/test_rand32/src/Makefile b/samples/microkernel/test/test_rand32/src/Makefile
deleted file mode 100644
index afc3189f4..000000000
--- a/samples/microkernel/test/test_rand32/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = test-rand32.o
diff --git a/samples/microkernel/test/test_rand32/src/test-rand32.c b/samples/microkernel/test/test_rand32/src/test-rand32.c
deleted file mode 100644
index 84743552e..000000000
--- a/samples/microkernel/test/test_rand32/src/test-rand32.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* test random number generator APIs */
-
-/*
- * Copyright (c) 2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * DESCRIPTION
- * This module tests the following random number routines:
- * uint32_t sys_rand32_get(void);
- */
-
-#include <tc_util.h>
-#include <zephyr.h>
-
-#define N_VALUES 10
-
-/**
- *
- * @brief Regression test's entry point
- *
- *
- * @return N/A
- */
-
-void RegressionTaskEntry(void)
-{
- int tc_result; /* test result code */
- uint32_t rnd_values[N_VALUES];
- int i;
-
- PRINT_DATA("Starting random number tests\n");
- PRINT_LINE;
-
- /*
- * Test subsequently calls sys_rand32_get(), checking
- * that two values are not equal.
- */
- PRINT_DATA("Generating random numbers\n");
- /*
- * Get several subsequent numbers as fast as possible.
- * If random number generator is based on timer, check
- * the situation when random number generator is called
- * faster than timer clock ticks.
- * In order to do this, make several subsequent calls
- * and save results in an array to verify them on the
- * next step
- */
- for (i = 0; i < N_VALUES; i++) {
- rnd_values[i] = sys_rand32_get();
- }
- for (tc_result = TC_PASS, i = 1; i < N_VALUES; i++) {
- if (rnd_values[i - 1] == rnd_values[i]) {
- tc_result = TC_FAIL;
- break;
- }
- }
-
- if (tc_result == TC_FAIL) {
- TC_ERROR("random number subsequent calls\n"
- "returned same value %d\n", rnd_values[i]);
- } else {
- PRINT_DATA("Generated %d values with expected randomness\n",
- N_VALUES);
- }
-
- TC_END_RESULT(tc_result);
- TC_END_REPORT(tc_result);
-}
diff --git a/samples/microkernel/test/test_rand32/testcase.ini b/samples/microkernel/test/test_rand32/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_rand32/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_sema/Makefile b/samples/microkernel/test/test_sema/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_sema/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_sema/README.txt b/samples/microkernel/test/test_sema/README.txt
deleted file mode 100644
index 8fff16652..000000000
--- a/samples/microkernel/test/test_sema/README.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Title: Semaphore APIs
-
-Description:
-
-This test verifies that the microkernel semaphore APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting semaphore tests
-===================================================================
-Signal and test a semaphore without blocking
-Signal and test a semaphore with blocking
-Testing many tasks blocked on the same semaphore
-Testing semaphore groups without blocking
-Testing semaphore groups with blocking
-Testing semaphore release by fiber
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_sema/prj.mdef b/samples/microkernel/test/test_sema/prj.mdef
deleted file mode 100644
index 8e4e01c8d..000000000
--- a/samples/microkernel/test/test_sema/prj.mdef
+++ /dev/null
@@ -1,29 +0,0 @@
-% Application : test microkernel semaphore APIs
-
-% TASKGROUP NAME
-% =====================================================
- TASKGROUP TEST
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =====================================================
- TASK MONITORTASK 5 MonitorTaskEntry 2048 [EXE]
- TASK tHigh 4 HighPriTaskEntry 2048 [TEST]
- TASK tStartTask 5 RegressionTaskEntry 2048 [TEST]
- TASK tAlternate 6 AlternateTaskEntry 2048 [TEST]
- TASK tLow 7 LowPriTaskEntry 2048 [TEST]
-
-% SEMA NAME
-% ======================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA SIMPLE_SEM
- SEMA ALTTASK_SEM
- SEMA HIGH_PRI_SEM
- SEMA MANY_BLOCKED_SEM
- SEMA GROUP_SEM1
- SEMA GROUP_SEM2
- SEMA GROUP_SEM3
- SEMA GROUP_SEM4
- SEMA BLOCK_HP_SEM
- SEMA BLOCK_LP_SEM
- SEMA BLOCK_MP_SEM
diff --git a/samples/microkernel/test/test_sema/prj_arm.conf b/samples/microkernel/test/test_sema/prj_arm.conf
deleted file mode 100644
index 44d4a391a..000000000
--- a/samples/microkernel/test/test_sema/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_sema/prj_x86.conf b/samples/microkernel/test/test_sema/prj_x86.conf
deleted file mode 100644
index 2da0bd453..000000000
--- a/samples/microkernel/test/test_sema/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_sema/src/Makefile b/samples/microkernel/test/test_sema/src/Makefile
deleted file mode 100644
index 7ad909957..000000000
--- a/samples/microkernel/test/test_sema/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = main.o sema.o test_fiber.o
diff --git a/samples/microkernel/test/test_sema/src/README b/samples/microkernel/test/test_sema/src/README
deleted file mode 100644
index f8e67bc23..000000000
--- a/samples/microkernel/test/test_sema/src/README
+++ /dev/null
@@ -1,24 +0,0 @@
-The semaphore test suite checks the following ...
-
-1. Signal a semaphore from an ISR 5 times.
-2. Check the semaphore status from the task.
-3. Take the semaphore 8 times. First 5 should succeed; next three should fail.
-4. Wait for up to XX ticks for the semaphore. This should timeout.
-5. Wait for up to XX ticks for the semaphore. Have an ISR give the semaphore.
-6. Wait for up to XX ticks for the semaphore. Have a task give the semaphore.
-7. Multiple tasks wait for the semaphore. Highest priority task gets it.
-8. Wait on a group of semaphores--timeout.
-9. Wait on a group of semaphores
- - Wake on receipt of each semaphore (test done for each sem in group)
- - Semaphore signalled from ISR
- - Semaphore signalled from task
- - Wake on receipt of many semaphores (test done for various combos)
- - Can only be done from a task
- - task_sem_count_get() performed on semaphores in group before and signalling
-10. Give semaphore a number of times, then call task_sem_reset()
-11. Give many semaphores a number of times, then call task_sem_group_take()
-12. Tests signaling semaphore from a fiber:
- - task waits on a semaphore and fiber signals it
- - fiber signals the semaphore N times, task checks that task_sem_count_get is N
- - task waits on a semaphore group and fiber signals each of them once. Task
- checks which of the semaphores has been signaled
diff --git a/samples/microkernel/test/test_sema/src/main.c b/samples/microkernel/test/test_sema/src/main.c
deleted file mode 100644
index 4476fe74c..000000000
--- a/samples/microkernel/test/test_sema/src/main.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* main.c - test semaphore APIs (kernel version) */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module contains the entry points for the tasks used by the kernel version
-of the semaphore test application. It also initializes global variables that
-identify the various kernel objects used by the test code.
-
-Each test task entry point invokes a test routine that returns a success/failure
-indication, then gives a corresponding semaphore. An additional task monitors
-these semaphores until it detects a failure or the completion of all test tasks,
-then announces the result of the test.
- */
-
-#include <zephyr.h>
-#include <irq_offload.h>
-#include <tc_util.h>
-
-#include <util_test_common.h>
-
-extern void testFiberInit(void);
-extern struct nano_sem fiberSem; /* semaphore that allows test control the fiber */
-
-#define NUM_TEST_TASKS 4 /* # of test tasks to monitor */
-
-static ksem_t testIsrInfo;
-
-/*
- * Note that semaphore group entries are arranged so that resultSems[TC_PASS]
- * refers to SEM_TASKDONE and resultSems[TC_FAIL] refers to SEM_TASKFAIL.
- */
-
-static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
-
-ksem_t group1Sem = GROUP_SEM1;
-ksem_t group2Sem = GROUP_SEM2;
-ksem_t group3Sem = GROUP_SEM3;
-ksem_t group4Sem = GROUP_SEM4;
-
-#ifdef TEST_PRIV_KSEM
- DEFINE_SEMAPHORE(simpleSem);
- DEFINE_SEMAPHORE(altSem);
- DEFINE_SEMAPHORE(hpSem);
- DEFINE_SEMAPHORE(manyBlockSem);
- DEFINE_SEMAPHORE(blockHpSem);
- DEFINE_SEMAPHORE(blockMpSem);
- DEFINE_SEMAPHORE(blockLpSem);
-#else
- ksem_t simpleSem = SIMPLE_SEM;
- ksem_t altSem = ALTTASK_SEM;
- ksem_t hpSem = HIGH_PRI_SEM;
- ksem_t manyBlockSem = MANY_BLOCKED_SEM;
- ksem_t blockHpSem = BLOCK_HP_SEM;
- ksem_t blockMpSem = BLOCK_MP_SEM;
- ksem_t blockLpSem = BLOCK_LP_SEM;
-#endif
-
-ksem_t semList[] = {
- GROUP_SEM1,
- GROUP_SEM2,
- GROUP_SEM3,
- GROUP_SEM4,
- ENDLIST
- };
-
-/**
- *
- * @brief ISR that gives specified semaphore
- *
- * @param isrData pointer to semaphore to be given
- *
- * @return N/A
- */
-
-static void testIsrHandler(void *isrData)
-{
- isr_sem_give(*(ksem_t *)isrData);
-}
-
-static void _trigger_isrSemaSignal(void)
-{
- irq_offload(testIsrHandler, &testIsrInfo);
-}
-
-/**
- *
- * @brief Entry point for RegressionTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * RegressionTask.
- *
- * @return N/A
- */
-
-void RegressionTaskEntry(void)
-{
- extern int RegressionTask(void);
-
- task_sem_give(resultSems[RegressionTask()]);
-}
-
-/**
- *
- * @brief Entry point for AlternateTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * MsgRcvrTask.
- *
- * @return N/A
- */
-
-void AlternateTaskEntry(void)
-{
- extern int AlternateTask(void);
-
- task_sem_give(resultSems[AlternateTask()]);
-}
-
-/**
- *
- * @brief Entry point for HighPriTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * HighPriTask.
- *
- * @return N/A
- */
-
-void HighPriTaskEntry(void)
-{
- extern int HighPriTask(void);
-
- task_sem_give(resultSems[HighPriTask()]);
-}
-
-/**
- *
- * @brief Entry point for LowPriTask
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * LowPriTask.
- *
- * @return N/A
- */
-
-void LowPriTaskEntry(void)
-{
- extern int LowPriTask(void);
-
- task_sem_give(resultSems[LowPriTask()]);
-}
-
-
-/**
- *
- * @brief Generate interrupt that gives specified semaphore
- *
- * @param semaphore semaphore to be given
- *
- * @return N/A
- */
-
-void trigger_isrSemaSignal(ksem_t semaphore)
-{
- testIsrInfo = semaphore;
- _trigger_isrSemaSignal();
-}
-
-/**
- *
- * @brief Release the test fiber
- *
- * @return N/A
- */
-
-void releaseTestFiber(void)
-{
- nano_task_sem_give(&fiberSem);
-}
-
-/**
- *
- * @brief Entry point for MonitorTask
- *
- * This routine keeps tabs on the progress of the tasks doing the actual testing
- * and generates the final test case summary message.
- *
- * @return N/A
- */
-
-void MonitorTaskEntry(void)
-{
- ksem_t result;
- int tasksDone;
-
- testFiberInit();
-
- PRINT_DATA("Starting semaphore tests\n");
- PRINT_LINE;
-
- task_group_start(TEST);
-
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
-
- for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take(resultSems, SECONDS(60));
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
- }
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
- }
-
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
-}
diff --git a/samples/microkernel/test/test_sema/src/sema.c b/samples/microkernel/test/test_sema/src/sema.c
deleted file mode 100644
index 9560265e0..000000000
--- a/samples/microkernel/test/test_sema/src/sema.c
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Test semaphore APIs
- *
- * This modules tests the following semaphore routines:
- *
- * task_sem_group_reset()
- * task_sem_group_give()
- * task_sem_reset()
- * task_sem_give()
- * task_sem_count_get()
- * task_sem_take()
- * isr_sem_give()
- * fiber_sem_give()
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-
-#include <util_test_common.h>
-
-extern void trigger_isrSemaSignal(ksem_t semaphore);
-extern void releaseTestFiber(void);
-
-#define N_TESTS 10 /* number of tests to run */
-
-#define OBJ_TIMEOUT SECONDS(1)
-
-extern ksem_t simpleSem;
-extern ksem_t altSem;
-extern ksem_t hpSem;
-extern ksem_t manyBlockSem;
-extern ksem_t group1Sem;
-extern ksem_t group2Sem;
-extern ksem_t group3Sem;
-extern ksem_t group4Sem;
-extern ksem_t blockHpSem;
-extern ksem_t blockMpSem;
-extern ksem_t blockLpSem;
-
-extern ksem_t semList[];
-
-
-/**
- *
- * @brief Signal semaphore that has no waiting tasks from ISR
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int simpleSemaTest(void)
-{
- int signalCount;
- int i;
- int status;
-
- /*
- * Signal the semaphore several times from an ISR. After each signal,
- * check the signal count.
- */
-
- for (i = 0; i < 5; i++) {
- trigger_isrSemaSignal(simpleSem);
-
- task_sleep(10); /* Time for low priority task to run. */
- signalCount = task_sem_count_get(simpleSem);
- if (signalCount != (i + 1)) {
- TC_ERROR("<signalCount> error. Expected %d, got %d\n",
- i + 1, signalCount);
- return TC_FAIL;
- }
- }
-
- /*
- * Signal the semaphore several times from a task. After each signal,
- * check the signal count.
- */
-
- for (i = 5; i < 10; i++) {
- task_sem_give(simpleSem);
-
- signalCount = task_sem_count_get(simpleSem);
- if (signalCount != (i + 1)) {
- TC_ERROR("<signalCount> error. Expected %d, got %d\n",
- i + 1, signalCount);
- return TC_FAIL;
- }
- }
-
- /*
- * Test the semaphore without wait. Check the signal count after each
- * attempt (it should be decrementing by 1 each time).
- */
-
- for (i = 9; i >= 4; i--) {
- status = task_sem_take(simpleSem, TICKS_NONE);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take(SIMPLE_SEM) error. Expected %d, not %d.\n",
- RC_OK, status);
- return TC_FAIL;
- }
-
- signalCount = task_sem_count_get(simpleSem);
- if (signalCount != i) {
- TC_ERROR("<signalCount> error. Expected %d, not %d\n",
- i, signalCount);
- return TC_FAIL;
- }
- }
-
- task_sem_reset(simpleSem);
-
- /*
- * The semaphore's signal count should now be zero (0). Test the
- * semaphore without wait. It should fail.
- */
-
- for (i = 0; i < 10; i++) {
- status = task_sem_take(simpleSem, TICKS_NONE);
- if (status != RC_FAIL) {
- TC_ERROR("task_sem_take(SIMPLE_SEM) error. Expected %d, got %d.\n",
- RC_FAIL, status);
- return TC_FAIL;
- }
-
- signalCount = task_sem_count_get(simpleSem);
- if (signalCount != 0) {
- TC_ERROR("<signalCount> error. Expected %d, not %d\n",
- 0, signalCount);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the waiting of a semaphore
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int simpleSemaWaitTest(void)
-{
- int status;
- int i;
-
- for (i = 0; i < 5; i++) {
- /* Wait one second for SIMPLE_SEM. Timeout is expected. */
- status = task_sem_take(simpleSem, OBJ_TIMEOUT);
- if (status != RC_TIME) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d\n",
- RC_TIME, status);
- return TC_FAIL;
- }
- }
-
- /*
- * Signal the semaphore upon which the alternate task is waiting. The
- * alternate task (which is at a lower priority) will cause SIMPLE_SEM
- * to be signalled, thus waking this task.
- */
-
- task_sem_give(altSem);
-
- status = task_sem_take(simpleSem, OBJ_TIMEOUT);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d\n",
- RC_OK, status);
- return TC_FAIL;
- }
-
- /*
- * Note that task_sem_take(TICKS_UNLIMITED) has been tested when waking up
- * the alternate task. Since previous tests had this task waiting, the
- * alternate task must have had the time to enter the state where it is
- * waiting for the ALTTASK_SEM semaphore to be given. Thus, we do not need
- * to test for it here.
- *
- * Now wait on SIMPLE_SEM again. This time it will be woken up by an
- * ISR signalling the semaphore.
- */
-
- status = task_sem_take(simpleSem, OBJ_TIMEOUT);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d\n",
- RC_OK, status);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test for a group of semaphores
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int simpleGroupTest(void)
-{
- int i;
- int j;
- int status;
- ksem_t value;
-
- /* Ensure that the semaphores in the group are reset */
-
- task_sem_group_reset(semList);
-
- for (i = 0; semList[i] != ENDLIST; i++) {
- status = task_sem_count_get(semList[i]);
- if (status != 0) {
- TC_ERROR("task_sem_count_get() returned %d not %d\n", status, 0);
- return TC_FAIL;
- }
- }
-
- /* Timeout while waiting for a semaphore from the group */
-
- value = task_sem_group_take(semList, OBJ_TIMEOUT);
- if (value != ENDLIST) {
- TC_ERROR("task_sem_group_take() returned %d not %d\n",
- value, ENDLIST);
- return TC_FAIL;
- }
-
- /* Signal the semaphores in the group */
-
- for (i = 0; i < 10; i++) {
- task_sem_group_give(semList);
-
- for (j = 0; semList[j] != ENDLIST; j++) {
- status = task_sem_count_get(semList[j]);
- if (status != i + 1) {
- TC_ERROR("task_sem_count_get() returned %d not %d\n",
- status, i + 1);
- return TC_FAIL;
- }
- }
- }
-
- /* Get the semaphores */
-
- for (i = 9; i >= 5; i--) {
- value = task_sem_group_take(semList, 0);
-
- for (j = 0; semList[j] != ENDLIST; j++) {
- status = task_sem_count_get(semList[j]);
- if (status != (value == semList[j] ? i : 10)) {
- TC_ERROR("task_sem_count_get(0x%x) returned %d not %d\n",
- semList[j], status, (value == semList[j]) ? i : 10);
- return TC_FAIL;
- }
- }
- }
-
- /* Reset the semaphores in the group */
-
- task_sem_group_reset(semList);
-
- for (i = 0; semList[i] != ENDLIST; i++) {
- status = task_sem_count_get(semList[i]);
- if (status != 0) {
- TC_ERROR("task_sem_count_get() returned %d not %d\n", status, 0);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test a group of semaphores with waiting
- *
- * This routine tests the waiting feature on a group of semaphores. Note that
- * timing out on a wait has already been tested so it need not be done again.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int simpleGroupWaitTest(void)
-{
- int i;
- ksem_t sema;
-
- task_sem_give(altSem); /* Wake the alternate task */
-
- /*
- * Wait for a semaphore to be signalled by the alternate task.
- * Each semaphore in the group will be tested.
- */
-
- for (i = 0; semList[i] != ENDLIST; i++) {
- sema = task_sem_group_take(semList, TICKS_UNLIMITED);
- if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take() error. Expected %d, not %d\n",
- (int) semList[i], (int) sema);
- return TC_FAIL;
- }
- }
-
- /*
- * The Alternate Task will signal the semaphore group once. Note that
- * when the semaphore group is signalled, the last semaphore in the
- * group is the value that is returned, not the first.
- */
-
- for (i = 3; i >= 0; i--) {
- sema = task_sem_group_take(semList, TICKS_UNLIMITED);
- if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take() error. Expected %d, not %d\n",
- (int) semList[3], (int) sema);
- return TC_FAIL;
- }
- }
-
- /*
- * Again wait for a semaphore to be signalled. This time, the alternate
- * task will trigger an interrupt that signals the semaphore.
- */
-
- for (i = 0; semList[i] != ENDLIST; i++) {
- sema = task_sem_group_take(semList, TICKS_UNLIMITED);
- if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take() error. Expected %d, not %d\n",
- (int) semList[i], (int) sema);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test semaphore signaling from fiber
- *
- * Routine starts a fiber and does the following tests:
- * - fiber signals the semaphore N times, task checks that task_sem_count_get is N
- * - task waits on a semaphore and fiber signals it
- * - task waits on a semaphore group and fiber signals each of them once. Task
- * checks which of the semaphores has been signaled
- *
- * See also: testFiber.c
- *
- * @return TC_PASS on success or TC_FAIL on failure
- */
-static int simpleFiberSemTest(void)
-{
- int signalCount;
- int status;
- int i;
- ksem_t sema;
-
- task_sem_reset(simpleSem);
- task_sem_group_reset(semList);
-
- /* let the fiber signal the semaphore and wait on it */
- releaseTestFiber();
- status = task_sem_take(simpleSem, OBJ_TIMEOUT);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d\n",
- RC_OK, status);
- return TC_FAIL;
- }
-
- /* release the fiber and let it signal the semaphore N_TESTS times */
- releaseTestFiber();
- signalCount = task_sem_count_get(simpleSem);
- if (signalCount != N_TESTS) {
- TC_ERROR("<signalCount> error. Expected %d, got %d\n",
- N_TESTS, signalCount);
- return TC_FAIL;
- }
-
- /* wait on the semaphore group while the fiber signals each semaphore in it */
- for (i = 0; semList[i] != ENDLIST; i++) {
- releaseTestFiber();
- sema = task_sem_group_take(semList, OBJ_TIMEOUT);
- if (sema != semList[i]) {
- TC_ERROR("task_sem_group_take() error. Expected %d, not %d\n",
- (int) semList[i], (int) sema);
- return TC_FAIL;
- }
- }
- return TC_PASS;
-}
-
-/**
- *
- * @brief A high priority task
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int HighPriTask(void)
-{
- int status;
-
- /* Wait until task is activated */
- status = task_sem_take(hpSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("%s priority task failed to wait on %s: %d\n",
- "High", "HIGH_PRI_SEM", status);
- return TC_FAIL;
- }
-
- /* Wait on a semaphore along with other tasks */
- status = task_sem_take(manyBlockSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("%s priority task failed to wait on %s: %d\n",
- "High", "MANY_BLOCKED_SEM", status);
- return TC_FAIL;
- }
-
- /* Inform Regression test HP task is no longer blocked on MANY_BLOCKED_SEM*/
- task_sem_give(blockHpSem);
-
- return TC_PASS;
-
-}
-
-/**
- *
- * @brief A low priority task
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int LowPriTask(void)
-{
- int status;
-
- /* Wait on a semaphore along with other tasks */
- status = task_sem_take(manyBlockSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("%s priority task failed to wait on %s: %d\n",
- "Low", "MANY_BLOCKED_SEM", status);
- return TC_FAIL;
- }
-
- /* Inform Regression test LP task is no longer blocked on MANY_BLOCKED_SEM*/
- task_sem_give(blockLpSem);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Alternate task in the test suite
- *
- * This routine runs at a lower priority than RegressionTask().
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int AlternateTask(void)
-{
- int status;
- int i;
-
- /* Wait until it is time to continue */
- status = task_sem_take(altSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d\n",
- RC_OK, status);
- return TC_FAIL;
- }
-
- /*
- * After signalling the semaphore upon which the main (RegressionTask) task
- * is waiting, control will pass back to the main (RegressionTask) task.
- */
-
- task_sem_give(simpleSem);
-
- /*
- * Control has returned to the alternate task. Trigger an ISR that will
- * signal the semaphore upon which RegressionTask is waiting.
- */
-
- trigger_isrSemaSignal(simpleSem);
-
- /* Wait for RegressionTask to wake this task up */
- status = task_sem_take(altSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d",
- RC_OK, status);
- return TC_FAIL;
- }
-
- /* Wait on a semaphore that will have many waiters */
- status = task_sem_take(manyBlockSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d",
- RC_OK, status);
- return TC_FAIL;
- }
-
- /* Inform Regression test MP task is no longer blocked on MANY_BLOCKED_SEM*/
- task_sem_give(blockMpSem);
-
- /* Wait until the alternate task is needed again */
- status = task_sem_take(altSem, TICKS_UNLIMITED);
- if (status != RC_OK) {
- TC_ERROR("task_sem_take() error. Expected %d, got %d",
- RC_OK, status);
- return TC_FAIL;
- }
-
- for (i = 0; semList[i] != ENDLIST; i++) {
- task_sem_give(semList[i]);
- /* Context switch back to Regression Task */
- }
-
- task_sem_group_give(semList);
- /* Context switch back to Regression Task */
-
- for (i = 0; semList[i] != ENDLIST; i++) {
- trigger_isrSemaSignal(semList[i]);
- /* Context switch back to Regression Task */
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to semaphore test suite
- *
- * This is the entry point to the semaphore test suite.
- *
- * @return TC_PASS or TC_FAIL
- */
-
-int RegressionTask(void)
-{
- int tcRC;
- int value;
- ksem_t semBlockList[4];
-
- semBlockList[0] = blockHpSem;
- semBlockList[1] = blockMpSem;
- semBlockList[2] = blockLpSem;
- semBlockList[3] = ENDLIST;
-
- /* Signal a semaphore that has no waiting tasks. */
- TC_PRINT("Signal and test a semaphore without blocking\n");
- tcRC = simpleSemaTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- /* Wait on a semaphore. */
- TC_PRINT("Signal and test a semaphore with blocking\n");
- tcRC = simpleSemaWaitTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- /*
- * Have many tasks wait on a semaphore (MANY_BLOCKED_SEM). They will
- * block in the following order:
- * LowPriorityTask (low priority)
- * HighPriorityTask (high priority)
- * AlternateTask (medium priority)
- *
- * When the semaphore (MANY_BLOCKED_SEM) is signalled, HighPriorityTask
- * will be woken first.
- *
- */
-
- TC_PRINT("Testing many tasks blocked on the same semaphore\n");
-
- task_sleep(OBJ_TIMEOUT); /* Time for low priority task to run. */
- task_sem_give(hpSem); /* Wake high priority task */
- task_sem_give(altSem); /* Wake alternate task (medium priority) */
- task_sleep(OBJ_TIMEOUT); /* Give alternate task time to run */
-
- task_sem_give(manyBlockSem);
- task_sleep(OBJ_TIMEOUT); /* Ensure high priority task can run */
-
- value = task_sem_group_take(semBlockList, OBJ_TIMEOUT);
- if (value != blockHpSem) {
- TC_ERROR("%s priority task did not get semaphore: 0x%x\n",
- "High", value);
- return TC_FAIL;
- }
-
- task_sem_give(manyBlockSem);
- task_sleep(OBJ_TIMEOUT); /* Ensure medium priority task can run */
- value = task_sem_group_take(semBlockList, OBJ_TIMEOUT);
- if (value != blockMpSem) {
- TC_ERROR("%s priority task did not get semaphore: 0x%x\n",
- "Medium", value);
- return TC_FAIL;
- }
-
- task_sem_give(manyBlockSem);
-
- task_sleep(OBJ_TIMEOUT); /* Ensure low priority task can run */
-
- value = task_sem_group_take(semBlockList, OBJ_TIMEOUT);
- if (value != blockLpSem) {
- TC_ERROR("%s priority task did not get semaphore: 0x%x\n",
- "Low", value);
- return TC_FAIL;
- }
-
- value = task_sem_group_take(semBlockList, OBJ_TIMEOUT);
- if (value != ENDLIST) {
- TC_ERROR("Group test Expecting ENDLIST, but got 0x%x\n",
- value);
- return TC_FAIL;
- }
-
-
- TC_PRINT("Testing semaphore groups without blocking\n");
- tcRC = simpleGroupTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing semaphore groups with blocking\n");
- tcRC = simpleGroupWaitTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing semaphore release by fiber\n");
- tcRC = simpleFiberSemTest();
- if (tcRC != TC_PASS) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
diff --git a/samples/microkernel/test/test_sema/src/test_fiber.c b/samples/microkernel/test/test_sema/src/test_fiber.c
deleted file mode 100644
index 5ad696ed6..000000000
--- a/samples/microkernel/test/test_sema/src/test_fiber.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* test_fiber.c - test fiber functions */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-The module implements functions for the fiber that tests
-semaphore signaling
- */
-
-#include <zephyr.h>
-
-#define N_TESTS 10 /* number of tests to run */
-#define FIBER_PRIORITY 6
-#define FIBER_STACK_SIZE 1024
-
-/* exports */
-struct nano_sem fiberSem; /* semaphore that allows test control the fiber */
-
-extern ksem_t simpleSem;
-extern ksem_t semList[];
-
-static char __stack fiberStack[FIBER_STACK_SIZE]; /* test fiber stack size */
-
-/**
- *
- * @brief The test fiber entry function
- *
- * Fiber waits on the semaphore controlled by the test task
- * It signals the semaphore, the testing task waits for,
- * then it signals the semaphore for N_TASKS times, testing task
- * checks this number.
- * Then fiber signals each of the semaphores in the group. Test
- * task checks this.
- *
- * @return N/A
- */
-static void testFiberEntry(void)
-{
- int i;
- /* release semaphore test task is waiting for */
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- fiber_sem_give(simpleSem);
-
- /* release the semaphore for N_TESTS times */
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- for (i = 0; i < N_TESTS; i++) {
- fiber_sem_give(simpleSem);
- }
-
- /* signal each semaphore in the group */
- for (i = 0; semList[i] != ENDLIST; i++) {
- nano_fiber_sem_take(&fiberSem, TICKS_UNLIMITED);
- fiber_sem_give(semList[i]);
- }
-}
-
-/**
- *
- * @brief Initializes variables and starts the test fiber
- *
- * @return N/A
- */
-
-void testFiberInit(void)
-{
- nano_sem_init(&fiberSem);
- task_fiber_start(fiberStack, FIBER_STACK_SIZE, (nano_fiber_entry_t)testFiberEntry,
- 0, 0, FIBER_PRIORITY, 0);
-}
diff --git a/samples/microkernel/test/test_sema/testcase.ini b/samples/microkernel/test/test_sema/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_sema/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_sema_priv/Makefile b/samples/microkernel/test/test_sema_priv/Makefile
deleted file mode 100644
index 88c293295..000000000
--- a/samples/microkernel/test/test_sema_priv/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR := $(ZEPHYR_BASE)/samples/microkernel/test/test_sema/src
-
-# Enable testing of private microkernel semaphore
-CFLAGS = -DTEST_PRIV_KSEM
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_sema_priv/README.txt b/samples/microkernel/test/test_sema_priv/README.txt
deleted file mode 100644
index ef7cb6ca1..000000000
--- a/samples/microkernel/test/test_sema_priv/README.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-Title: Private Semaphores
-
-Description:
-
-This test verifies that the microkernel semaphore APIs operate as expected.
-This also verifies the mechanism to define private semaphores and their
-usage.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting semaphore tests
-===================================================================
-Signal and test a semaphore without blocking
-Signal and test a semaphore with blocking
-Testing many tasks blocked on the same semaphore
-Testing semaphore groups without blocking
-Testing semaphore groups with blocking
-Testing semaphore release by fiber
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_sema_priv/prj.mdef b/samples/microkernel/test/test_sema_priv/prj.mdef
deleted file mode 100644
index eff1f59b6..000000000
--- a/samples/microkernel/test/test_sema_priv/prj.mdef
+++ /dev/null
@@ -1,36 +0,0 @@
-% Please keep this in-sync with ../test_sem/prj.mdef
-% except those specified below
-
-% Application : test microkernel semaphore APIs
-
-% TASKGROUP NAME
-% =====================================================
- TASKGROUP TEST
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =====================================================
- TASK MONITORTASK 5 MonitorTaskEntry 2048 [EXE]
- TASK tHigh 4 HighPriTaskEntry 2048 [TEST]
- TASK tStartTask 5 RegressionTaskEntry 2048 [TEST]
- TASK tAlternate 6 AlternateTaskEntry 2048 [TEST]
- TASK tLow 7 LowPriTaskEntry 2048 [TEST]
-
-% SEMA NAME
-% ======================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA GROUP_SEM1
- SEMA GROUP_SEM2
- SEMA GROUP_SEM3
- SEMA GROUP_SEM4
-
-% These semaphores are defined inside source code.
-% So these need to be commented out.
-%
-% SEMA SIMPLE_SEM
-% SEMA ALTTASK_SEM
-% SEMA HIGH_PRI_SEM
-% SEMA MANY_BLOCKED_SEM
-% SEMA BLOCK_HP_SEM
-% SEMA BLOCK_LP_SEM
-% SEMA BLOCK_MP_SEM
diff --git a/samples/microkernel/test/test_sema_priv/prj_arm.conf b/samples/microkernel/test/test_sema_priv/prj_arm.conf
deleted file mode 100644
index 44d4a391a..000000000
--- a/samples/microkernel/test/test_sema_priv/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_sema_priv/prj_x86.conf b/samples/microkernel/test/test_sema_priv/prj_x86.conf
deleted file mode 100644
index 2da0bd453..000000000
--- a/samples/microkernel/test/test_sema_priv/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_sema_priv/testcase.ini b/samples/microkernel/test/test_sema_priv/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_sema_priv/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_sprintf/Makefile b/samples/microkernel/test/test_sprintf/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_sprintf/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_sprintf/README.txt b/samples/microkernel/test/test_sprintf/README.txt
deleted file mode 100644
index f29cbec01..000000000
--- a/samples/microkernel/test/test_sprintf/README.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Title: sprintf() APIs
-
-Description:
-
-This test verifies that sprintf() and its variants operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-Sample Output:
-
-tc_start() - Test Microkernel sprintf APIs
-
-===================================================================
-Testing sprintf() with integers ....
-Testing snprintf() ....
-Testing vsprintf() ....
-Testing vsnprintf() ....
-Testing sprintf() with strings ....
-Testing sprintf() with misc options ....
-Testing sprintf() with doubles ....
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_sprintf/prj.mdef b/samples/microkernel/test/test_sprintf/prj.mdef
deleted file mode 100644
index 9e0208dac..000000000
--- a/samples/microkernel/test/test_sprintf/prj.mdef
+++ /dev/null
@@ -1,5 +0,0 @@
-% Application : test microkernel task APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =================================================
- TASK RT_TASKID 10 RegressionTask 2048 [EXE]
diff --git a/samples/microkernel/test/test_sprintf/prj_arm.conf b/samples/microkernel/test/test_sprintf/prj_arm.conf
deleted file mode 100644
index e901fc7eb..000000000
--- a/samples/microkernel/test/test_sprintf/prj_arm.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_NUM_IRQS=2
-CONFIG_STDOUT_CONSOLE=y
diff --git a/samples/microkernel/test/test_sprintf/prj_x86.conf b/samples/microkernel/test/test_sprintf/prj_x86.conf
deleted file mode 100644
index 1cddfcea7..000000000
--- a/samples/microkernel/test/test_sprintf/prj_x86.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG_STDOUT_CONSOLE=y
-
-CONFIG_FLOAT=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_sprintf/src/Makefile b/samples/microkernel/test/test_sprintf/src/Makefile
deleted file mode 100644
index 51d36153b..000000000
--- a/samples/microkernel/test/test_sprintf/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = test_sprintf.o
diff --git a/samples/microkernel/test/test_sprintf/src/test_sprintf.c b/samples/microkernel/test/test_sprintf/src/test_sprintf.c
deleted file mode 100644
index 669a43a95..000000000
--- a/samples/microkernel/test/test_sprintf/src/test_sprintf.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/* test_sprintf.c - test various sprintf functionality */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module contains the code for testing sprintf() functionality.
- */
-
-#include <tc_util.h>
-#include <stdio.h>
-
-#define DEADBEEF 0xdeadbeef
-
-#define DEADBEEF_LHEX_ALT_STR "0xdeadbeef"
-#define DEADBEEF_UHEX_ALT_STR "0XDEADBEEF"
-#define DEADBEEF_LHEX_STR "deadbeef"
-#define DEADBEEF_UHEX_STR "DEADBEEF"
-#define DEADBEEF_UNSIGNED_STR "3735928559"
-#define DEADBEEF_SIGNED_STR "-559038737"
-#define DEADBEEF_OCTAL_STR "33653337357"
-#define DEADBEEF_OCTAL_ALT_STR "033653337357"
-#define DEADBEEF_PTR_STR "0xdeadbeef"
-
-/*
- * A really long string (330 characters + NUL).
- * The underlying sprintf() architecture will truncate it.
- */
-#define REALLY_LONG_STRING \
- "11111111111111111111111111111111111111111111111111111111111111111" \
- "22222222222222222222222222222222222222222222222222222222222222222" \
- "33333333333333333333333333333333333333333333333333333333333333333" \
- "44444444444444444444444444444444444444444444444444444444444444444" \
- "55555555555555555555555555555555555555555555555555555555555555555" \
- "66666666666666666666666666666666666666666666666666666666666666666"
-
-#define PRINTF_MAX_STRING_LENGTH 200
-
-typedef union {
- double d;
- struct {
- uint32_t u1; /* This part contains the exponent */
- uint32_t u2; /* This part contains the fraction */
- };
-} raw_double_u;
-
-#ifdef CONFIG_FLOAT
-/**
- *
- * @brief Test sprintf with doubles
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int sprintfDoubleTest(void)
-{
- char buffer[100];
- raw_double_u var;
- int status = TC_PASS;
-
- var.u1 = 0x00000000;
- var.u2 = 0x7ff00000; /* Bit pattern for +INF (double) */
- sprintf(buffer, "%f", var.d);
- if (strcmp(buffer, "+INF") != 0) {
- TC_ERROR("sprintf(+INF) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- var.u1 = 0x00000000;
- var.u2 = 0xfff00000; /* Bit pattern for -INF (double) */
- sprintf(buffer, "%f", var.d);
- if (strcmp(buffer, "-INF") != 0) {
- TC_ERROR("sprintf(-INF) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- var.u1 = 0x00000000;
- var.u2 = 0x7ff80000; /* Bit pattern for NaN (double) */
- sprintf(buffer, "%f", var.d);
- if (strcmp(buffer, "NaN") != 0) {
- TC_ERROR("sprintf(NaN) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- var.d = 1.0;
- sprintf(buffer, "%f", var.d);
- if (strcmp(buffer, "1.000000") != 0) {
- TC_ERROR("sprintf(1.0) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%+f", var.d);
- if (strcmp(buffer, "+1.000000") != 0) {
- TC_ERROR("sprintf(+1.0) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%.2f", var.d);
- if (strcmp(buffer, "1.00") != 0) {
- TC_ERROR("sprintf(1.00) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%.*f", 11, var.d);
- if (strcmp(buffer, "1.00000000000") != 0) {
- TC_ERROR("sprintf(1.00000000000) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%12f", var.d);
- if (strcmp(buffer, " 1.000000") != 0) {
- TC_ERROR("sprintf( 1.000000) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%-12f", var.d);
- if (strcmp(buffer, "1.000000 ") != 0) {
- TC_ERROR("sprintf(1.000000 ) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%012f", var.d);
- if (strcmp(buffer, "00001.000000") != 0) {
- TC_ERROR("sprintf(00001.000000) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- var.d = -1.0;
- sprintf(buffer, "%f", var.d);
- if (strcmp(buffer, "-1.000000") != 0) {
- TC_ERROR("sprintf(-1.0) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- var.d = 1234.56789;
- sprintf(buffer, "%f", var.d);
- if (strcmp(buffer, "1234.567890") != 0) {
- TC_ERROR("sprintf(-1.0) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- var.d = 1234.0;
- sprintf(buffer, "%e", var.d);
- if (strcmp(buffer, "1.234000e+003") != 0) {
- TC_ERROR("sprintf(1.234000e+003) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%E", var.d);
- if (strcmp(buffer, "1.234000E+003") != 0) {
- TC_ERROR("sprintf(1.234000E+003) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- var.d = 0.1234;
- sprintf(buffer, "%e", var.d);
- if (strcmp(buffer, "1.234000e-001") != 0) {
- TC_ERROR("sprintf(1.234000e-001) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%E", var.d);
- if (strcmp(buffer, "1.234000E-001") != 0) {
- TC_ERROR("sprintf(1.234000E-001) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- var.d = 1234000000.0;
- sprintf(buffer, "%g", var.d);
- if (strcmp(buffer, "1.234e+009") != 0) {
- TC_ERROR("sprintf(1.234e+009) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%G", var.d);
- if (strcmp(buffer, "1.234E+009") != 0) {
- TC_ERROR("sprintf(1.234E+009) - incorrect output '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
-
- /*
- * Size modifiers such as L are not supported. As such, attempts to
- * print a long double will NOT result in intuitively expected output.
- * Until such time as they are supported (if ever) the output will remain
- * counter-intuitive. If they ever are supported then this test will have
- * to be updated.
- */
-
- sprintf(buffer, "%Lf", (long double) 1234567.0);
- if (strcmp("-0.000000", buffer) != 0) {
- TC_ERROR("sprintf(%%Lf). Expected '-0.000000', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- return status;
-}
-#endif /* CONFIG_FLOAT */
-
-/**
- *
- * @brief A test wrapper for vsnprintf()
- */
-
-int tvsnprintf(char *s, size_t len, const char *format, ...)
-{
- va_list vargs;
- int r;
-
- va_start(vargs, format);
- r = vsnprintf(s, len, format, vargs);
- va_end(vargs);
-
- return r;
-}
-
-/**
- *
- * @brief Test the vsprintf() routine
- *
- * This routine does not aim to test the same underlying functionality as
- * sprintfTest(). Instead it tries to limit it to functionality specific to
- * vsnprintf(). Instead of calling vsnprintf() directly, it invokes the wrapper
- * routine tvsnprintf().
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int vsnprintfTest(void)
-{
- int len;
- int status = TC_PASS;
- char buffer[100];
-
- /*
- * The string size may be handled in a non-standard manner.
- * If a negative value is supplied for the string size, it is converted
- * to 0x7fffffff--maximum integer size. Since there is insufficient
- * memory to test a string of that length, we just check that the string
- * was fully written so that we can exercise the code path.
- */
- buffer[0] = '\0';
- len = tvsnprintf(buffer, (size_t)(-4), "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("vsnprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
- TC_ERROR("vsnprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- buffer[0] = '\0';
- len = tvsnprintf(buffer, 0, "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("vsnprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, "") != 0) {
- TC_ERROR("vsnprintf(%%x). Expected '%s', got '%s'\n",
- "", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = tvsnprintf(buffer, 4, "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("vsnprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, "dea") != 0) {
- TC_ERROR("vsnprintf(%%x). Expected '%s', got '%s'\n",
- "dea", buffer);
- status = TC_FAIL;
- }
-
- return status;
-}
-
-/**
- *
- * @brief A test wrapper for vsprintf()
- */
-
-int tvsprintf(char *s, const char *format, ...)
-{
- va_list vargs;
- int r;
-
- va_start(vargs, format);
- r = vsprintf(s, format, vargs);
- va_end(vargs);
-
- return r;
-}
-
-/**
- *
- * @brief Test the vsprintf() routine
- *
- * This routine does not aim to test the same underlying functionality as
- * sprintfTest(). Instead it tries to limit it to functionality specific to
- * vsprintf().
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int vsprintfTest(void)
-{
- int len;
- int status = TC_PASS;
- char buffer[100];
-
- /*******************/
- len = tvsprintf(buffer, "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("sprintf(%%x). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
- TC_ERROR("sprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
- status = TC_FAIL;
- }
-
- return status;
-}
-
-/**
- *
- * @brief Test the snprintf() routine
- *
- * This routine does not aim to test the same underlying functionality as
- * sprintfTest(). Instead it tries to limit it to functionality specific to
- * snprintf().
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int snprintfTest(void)
-{
- int len;
- int status = TC_PASS;
- char buffer[100];
-
- /*
- * The string size may be handled in a non-standard manner.
- * If a negative value is supplied for the string size, it is converted
- * to 0x7fffffff--maximum integer size. Since there is insufficient
- * memory to test a string of that length, we just check that the string
- * was fully written so that we can exercise the code path.
- */
- buffer[0] = '\0';
- len = snprintf(buffer, (size_t)(-4), "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("snprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
- TC_ERROR("snprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- buffer[0] = '\0';
- len = snprintf(buffer, 0, "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("snprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, "") != 0) {
- TC_ERROR("snprintf(%%x). Expected '%s', got '%s'\n",
- "", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = snprintf(buffer, 4, "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("snprintf(%%x). Expected return value %d, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, "dea") != 0) {
- TC_ERROR("snprintf(%%x). Expected '%s', got '%s'\n",
- "dea", buffer);
- status = TC_FAIL;
- }
-
- return status;
-}
-
-/**
- *
- * @brief Test the sprintf() routine with miscellaneous specifiers
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int sprintfMiscTest(void)
-{
- int status = TC_PASS;
- int count;
- char buffer[100];
-
- /*******************/
- sprintf(buffer, "%p", (void *) DEADBEEF);
- if (strcmp(buffer, DEADBEEF_PTR_STR) != 0) {
- TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- DEADBEEF_PTR_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- sprintf(buffer, "test data %n test data", &count);
- if (count != 10) {
- TC_ERROR("sprintf(%%n). Expected count to be %d, not %d\n",
- 10, count);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, "test data test data") != 0) {
- TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- "test data test data", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- sprintf(buffer, "%*d", 10, 1234);
- if (strcmp(buffer, " 1234") != 0) {
- TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- " 1234", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- sprintf(buffer, "%*d", -10, 1234);
- if (strcmp(buffer, "1234 ") != 0) {
- TC_ERROR("sprintf(%%p). Expected '%s', got '%s'\n",
- "1234 ", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- sprintf(buffer, "% d", 1234);
- if (strcmp(buffer, " 1234") != 0) {
- TC_ERROR("sprintf(%% d). Expected '%s', got '%s'\n",
- " 1234", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- sprintf(buffer, "%hx", 1234);
- if (strcmp("4d2", buffer) != 0) {
- TC_ERROR("sprintf(%%hx). Expected '4d2', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- sprintf(buffer, "%lx", 1234ul);
- if (strcmp("4d2", buffer) != 0) {
- TC_ERROR("sprintf(%%lx). Expected '4d2', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- return status;
-}
-
-/**
- *
- * @brief Test the sprintf() routine with integers
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int sprintfIntegerTest(void)
-{
- int status = TC_PASS;
- int len;
- char buffer[100];
-
- /*******************/
-
- /* Note: prints hex numbers in 8 characters */
- len = sprintf(buffer, "%x", 0x11);
- if (len != 2) {
- TC_ERROR("sprintf(%%x). Expected 2 bytes written, not %d\n", len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, "11") != 0) {
- TC_ERROR("sprintf(%%x). Expected '%s', got '%s'\n", "11", buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_STR)) {
- TC_ERROR("sprintf(%%x). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_LHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_LHEX_STR) != 0) {
- TC_ERROR("sprintf(%%x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%X", DEADBEEF);
- if (len != strlen(DEADBEEF_UHEX_STR)) {
- TC_ERROR("sprintf(%%X). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_UHEX_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_UHEX_STR) != 0) {
- TC_ERROR("sprintf(%%X). Expected '%s', got '%s'\n",
- DEADBEEF_UHEX_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%u", DEADBEEF);
- if (len != strlen(DEADBEEF_UNSIGNED_STR)) {
- TC_ERROR("sprintf(%%u). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_UNSIGNED_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_UNSIGNED_STR) != 0) {
- TC_ERROR("sprintf(%%u). Expected '%s', got '%s'\n",
- DEADBEEF_UNSIGNED_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%d", (int) DEADBEEF);
- if (len != strlen(DEADBEEF_SIGNED_STR)) {
- TC_ERROR("sprintf(%%d). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_SIGNED_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_SIGNED_STR) != 0) {
- TC_ERROR("sprintf(%%d). Expected '%s', got '%s'\n",
- DEADBEEF_SIGNED_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%o", DEADBEEF);
- if (len != strlen(DEADBEEF_OCTAL_STR)) {
- TC_ERROR("sprintf(%%o). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_OCTAL_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_OCTAL_STR) != 0) {
- TC_ERROR("sprintf(%%o). Expected '%s', got '%s'\n",
- DEADBEEF_OCTAL_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%#o", DEADBEEF);
- if (len != strlen(DEADBEEF_OCTAL_ALT_STR)) {
- TC_ERROR("sprintf(%%#o). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_OCTAL_ALT_STR), len);
- status = TC_FAIL;
- }
-
- if (strcmp(buffer, DEADBEEF_OCTAL_ALT_STR) != 0) {
- TC_ERROR("sprintf(%%#o). Expected '%s', got '%s'\n",
- DEADBEEF_OCTAL_ALT_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%#x", DEADBEEF);
- if (len != strlen(DEADBEEF_LHEX_ALT_STR)) {
- TC_ERROR("sprintf(%%#x). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_LHEX_ALT_STR), len);
- status = TC_FAIL;
- }
- if (strcmp(buffer, DEADBEEF_LHEX_ALT_STR) != 0) {
- TC_ERROR("sprintf(%%#x). Expected '%s', got '%s'\n",
- DEADBEEF_LHEX_ALT_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
- len = sprintf(buffer, "%#X", DEADBEEF);
- if (len != strlen(DEADBEEF_UHEX_ALT_STR)) {
- TC_ERROR("sprintf(%%#X). Expected %d bytes written, not %d\n",
- strlen(DEADBEEF_UHEX_ALT_STR), len);
- status = TC_FAIL;
- }
- if (strcmp(buffer, DEADBEEF_UHEX_ALT_STR) != 0) {
- TC_ERROR("sprintf(%%#X). Expected '%s', got '%s'\n",
- DEADBEEF_UHEX_ALT_STR, buffer);
- status = TC_FAIL;
- }
-
- /*******************/
-
- len = sprintf(buffer, "%+d", 1);
- if (len != 2) {
- TC_ERROR("sprintf(%%+d). Expected %d bytes written, not %d\n",
- 2, len);
- status = TC_FAIL;
- }
- if (strcmp(buffer, "+1") != 0) {
- TC_ERROR("sprintf(%%+d). Expected '+1', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- return status;
-}
-
-/**
- *
- * @brief Test sprintf with strings
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int sprintfStringTest(void)
-{
- int len;
- int status = TC_PASS;
- char buffer[400];
-
- sprintf(buffer, "%%");
- if (strcmp(buffer, "%") != 0) {
- TC_ERROR("sprintf(%%). Expected '%%', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%c", 't');
- if (strcmp(buffer, "t") != 0) {
- TC_ERROR("sprintf(%%c). Expected 't', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- sprintf(buffer, "%s", "short string");
- if (strcmp(buffer, "short string") != 0) {
- TC_ERROR("sprintf(%%s). Expected 'short string', got '%s'\n", buffer);
- status = TC_FAIL;
- }
-
- len = sprintf(buffer, "%s", REALLY_LONG_STRING);
- if (len != PRINTF_MAX_STRING_LENGTH) {
- TC_ERROR("Internals changed. Max string length no longer %d\n",
- PRINTF_MAX_STRING_LENGTH);
- status = TC_FAIL;
- }
- if (strncmp(buffer, REALLY_LONG_STRING, PRINTF_MAX_STRING_LENGTH) != 0) {
- TC_ERROR("First %d characters of REALLY_LONG_STRING not printed!\n",
- PRINTF_MAX_STRING_LENGTH);
- status = TC_FAIL;
- }
-
- return status;
-}
-
-/**
- *
- * @brief Test entry point
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int status = TC_PASS;
-
- TC_START("Test Microkernel sprintf APIs\n");
-
- PRINT_LINE;
-
- TC_PRINT("Testing sprintf() with integers ....\n");
- if (sprintfIntegerTest() != TC_PASS) {
- status = TC_FAIL;
- }
-
- TC_PRINT("Testing snprintf() ....\n");
- if (snprintfTest() != TC_PASS) {
- status = TC_FAIL;
- }
-
- TC_PRINT("Testing vsprintf() ....\n");
- if (vsprintfTest() != TC_PASS) {
- status = TC_FAIL;
- }
-
- TC_PRINT("Testing vsnprintf() ....\n");
- if (vsnprintfTest() != TC_PASS) {
- status = TC_FAIL;
- }
-
- TC_PRINT("Testing sprintf() with strings ....\n");
- if (sprintfStringTest() != TC_PASS) {
- status = TC_FAIL;
- }
-
- TC_PRINT("Testing sprintf() with misc options ....\n");
- if (sprintfMiscTest() != TC_PASS) {
- status = TC_FAIL;
- }
-
-#ifdef CONFIG_FLOAT
- TC_PRINT("Testing sprintf() with doubles ....\n");
- if (sprintfDoubleTest() != TC_PASS) {
- status = TC_FAIL;
- }
-#endif /* CONFIG_FLOAT */
-
- TC_END_RESULT(status);
- TC_END_REPORT(status);
-}
diff --git a/samples/microkernel/test/test_sprintf/testcase.ini b/samples/microkernel/test/test_sprintf/testcase.ini
deleted file mode 100644
index b73ffed57..000000000
--- a/samples/microkernel/test/test_sprintf/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-config_whitelist = !CONFIG_CPU_MINUTEIA
-
diff --git a/samples/microkernel/test/test_stackprot/Makefile b/samples/microkernel/test/test_stackprot/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_stackprot/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_stackprot/README.txt b/samples/microkernel/test/test_stackprot/README.txt
deleted file mode 100644
index b0fb07edd..000000000
--- a/samples/microkernel/test/test_stackprot/README.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-Title: Stack Protection Support
-
-Description:
-
-This test verifies that stack canaries operate as expected in the microkernel.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Stack Protection Canary
-
-Starts RegressionTask
-Starts AlternateTask
-AlternateTask: Input string is too long and stack overflowed!
-
-***** Stack Check Fail! *****
-Current context ID = 0x00102804
-Faulting instruction address = 0xdeaddead
-Fatal task error! Aborting task.
-RegressionTask: Stack ok
-RegressionTask: Stack ok
-RegressionTask: Stack ok
-RegressionTask: Stack ok
-RegressionTask: Stack ok
-RegressionTask: Stack ok
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_stackprot/prj.mdef b/samples/microkernel/test/test_stackprot/prj.mdef
deleted file mode 100644
index 24b8ab6c8..000000000
--- a/samples/microkernel/test/test_stackprot/prj.mdef
+++ /dev/null
@@ -1,6 +0,0 @@
-% Application : Stack Protector Regression
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ======================================================
- TASK REGRESSIONTASK 7 RegressionTask 2048 [EXE]
- TASK ALTERNATETASK 5 AlternateTask 2048 []
diff --git a/samples/microkernel/test/test_stackprot/prj_arm.conf b/samples/microkernel/test/test_stackprot/prj_arm.conf
deleted file mode 100644
index 705015028..000000000
--- a/samples/microkernel/test/test_stackprot/prj_arm.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_STACK_CANARIES=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_stackprot/prj_x86.conf b/samples/microkernel/test/test_stackprot/prj_x86.conf
deleted file mode 100644
index 1061a3de3..000000000
--- a/samples/microkernel/test/test_stackprot/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-CONFIG_STACK_CANARIES=y
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_stackprot/src/Makefile b/samples/microkernel/test/test_stackprot/src/Makefile
deleted file mode 100644
index cfb8ca8df..000000000
--- a/samples/microkernel/test/test_stackprot/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = stackprot.o
diff --git a/samples/microkernel/test/test_stackprot/src/stackprot.c b/samples/microkernel/test/test_stackprot/src/stackprot.c
deleted file mode 100644
index cec4135ec..000000000
--- a/samples/microkernel/test/test_stackprot/src/stackprot.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* stackprot.c - test Stack Protector feature using canary */
-
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*
-DESCRIPTION
- This is the test program to test stack protection using canary.
-
- For the microkernel version (nanokernel version in brackets):
- The regression (main) task starts alternate task (fiber1), which tries
- to cause a stack check failure scenario, to test this stack check protection
- feature.
-
- This alternate task (fiber) will not complete it's execution by design and
- thus will not set tcRC to TC_FAIL. When this alternate task (fiber)
- terminates, control is returned back to the regression (main) task which
- prints out a short string couple times.
- */
-
-#include <tc_util.h>
-
-#ifdef CONFIG_MICROKERNEL
-#include <zephyr.h>
-
-#else
-#include <arch/cpu.h>
-
-#define STACKSIZE 1024
-char __stack fiberStack[STACKSIZE];
-
-#endif /* CONFIG_MICROKERNEL */
-
-static int count = 0;
-static int tcRC = TC_PASS;
-
-void check_input(const char *name, const char *input);
-
-/**
- *
- * printLoop
- *
- * This function calls check_input 6 times with the input name and a short
- * string, which is printed properly by check_input.
- *
- * @param name task or fiber identification string
- *
- * @return N/A
- */
-
-void printLoop(const char *name)
-{
- while (count < 6) {
- /* A short input string to check_input. It will pass. */
- check_input(name, "Stack ok");
- count++;
- }
-}
-
-/**
- *
- * check_input
- *
- * This function copies the input string to a buffer of 16 characters and
- * prints the name and buffer as a string. If the input string is longer
- * than the buffer, an error condition is detected.
- *
- * When stack protection feature is enabled (see prj.conf file), the
- * system error handler is invoked and reports a "Stack Check Fail" error.
- * When stack protection feature is not enabled, the system crashes with
- * error like: Trying to execute code outside RAM or ROM.
- *
- * @return N/A
- */
-
-void check_input(const char *name, const char *input)
-{
- /* Stack will overflow when input is more than 16 characters */
- char buf[16];
-
- strcpy(buf, input);
- TC_PRINT("%s: %s\n", name, buf);
-}
-
-/**
- *
- * Microkernel: AlternateTask
- * Nanokernel: fiber1
- *
- * This task/fiber passes a long string to check_input function. It terminates due
- * to stack overflow and reports "Stack Check Fail" when stack protection
- * feature is enabled. Hence it will not execute the printLoop function and will
- * not set tcRC to TC_FAIL. Control is transferred back to the other task.
- *
- * @return N/A
- */
-#ifdef CONFIG_MICROKERNEL
-void AlternateTask(void)
-#else
-void fiber1(void)
-#endif /* ! CONFIG_MICROKERNEL */
-{
- TC_PRINT("Starts %s\n", __func__);
- check_input(__func__, "Input string is too long and stack overflowed!\n");
- /*
- * Expect this task to terminate due to stack check fail and will not
- * execute pass here.
- */
- printLoop(__func__);
-
- tcRC = TC_FAIL;
-}
-
-/**
- *
- * Microkernel: RegressionTask
- * Nanokernel: main
- *
- * This is the entry point to the test stack protection feature. It calls
- * printLoop to print a string and alternates execution with AlternateTask
- * when the task goes to sleep in printLoop.
- *
- * @return N/A
- */
-
-#ifdef CONFIG_MICROKERNEL
-void RegressionTask(void)
-#else
-void main(void)
-#endif /* ! CONFIG_MICROKERNEL */
-{
- TC_START("Test Stack Protection Canary\n");
- TC_PRINT("Starts %s\n", __func__);
-
-#ifdef CONFIG_MICROKERNEL
- /* Start task */
- task_start(ALTERNATETASK); /* refer to prj.mdef file */
-#else
- /* Start fiber */
- task_fiber_start(&fiberStack[0], STACKSIZE,
- (nano_fiber_entry_t) fiber1, 0, 0, 7, 0);
-#endif /* ! CONFIG_MICROKERNEL */
-
- if (tcRC == TC_FAIL) {
- goto errorExit;
- }
-
- printLoop(__func__);
-
-errorExit:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-}
diff --git a/samples/microkernel/test/test_stackprot/testcase.ini b/samples/microkernel/test/test_stackprot/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_stackprot/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_static_idt/Makefile b/samples/microkernel/test/test_static_idt/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_static_idt/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_static_idt/README.txt b/samples/microkernel/test/test_static_idt/README.txt
deleted file mode 100644
index 7cfeda129..000000000
--- a/samples/microkernel/test/test_static_idt/README.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Title: Static IDT Support
-
-Description:
-
-This test verifies that the static IDT feature operates as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel static IDT tests
-Testing to see if IDT has address of test stubs()
-Testing to see interrupt handler executes properly
-Testing to see exception handler executes properly
-Testing to see spurious handler executes properly
-- Expect to see unhandled interrupt/exception message
-***** Unhandled exception/interrupt occurred! *****
-Current context ID = 0x00102c44
-Faulting instruction address = 0x0010342c
-Fatal task error! Aborting task.
-PASS - idtTestTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_static_idt/prj.mdef b/samples/microkernel/test/test_static_idt/prj.mdef
deleted file mode 100644
index fe33c70c2..000000000
--- a/samples/microkernel/test/test_static_idt/prj.mdef
+++ /dev/null
@@ -1,6 +0,0 @@
-% Application : test static interrutps
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ==================================================
- TASK tStartTask 6 idtTestTask 2048 [EXE]
- TASK tSpurTask 5 idtSpurTask 2048 []
diff --git a/samples/microkernel/test/test_static_idt/prj_x86.conf b/samples/microkernel/test/test_static_idt/prj_x86.conf
deleted file mode 100644
index 51f60f531..000000000
--- a/samples/microkernel/test/test_static_idt/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_EXCEPTION_DEBUG=n
diff --git a/samples/microkernel/test/test_static_idt/src/Makefile b/samples/microkernel/test/test_static_idt/src/Makefile
deleted file mode 100644
index a5ea3b275..000000000
--- a/samples/microkernel/test/test_static_idt/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = static_idt.o test_stubs.o
diff --git a/samples/microkernel/test/test_static_idt/src/static_idt.c b/samples/microkernel/test/test_static_idt/src/static_idt.c
deleted file mode 100644
index a3c1afd79..000000000
--- a/samples/microkernel/test/test_static_idt/src/static_idt.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* static_idt.c - test static IDT APIs */
-
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-Ensures interrupt and exception stubs are installed correctly.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-
-#include <nano_private.h>
-#if defined(__GNUC__)
-#include <test_asm_inline_gcc.h>
-#else
-#include <test_asm_inline_other.h>
-#endif
-
-/* These vectors are somewhat arbitrary. We try and use unused vectors */
-#define TEST_SOFT_INT 62
-#define TEST_SPUR_INT 63
-
-/* externs */
-
- /* the _idt_base_address symbol is generated via a linker script */
-
-extern unsigned char _idt_base_address[];
-
-extern void *nanoIntStub;
-extern void *exc_divide_error_handlerStub;
-
-NANO_CPU_INT_REGISTER(nanoIntStub, -1, -1, TEST_SOFT_INT, 0);
-
-static volatile int excHandlerExecuted;
-static volatile int intHandlerExecuted;
-/* Assume the spurious interrupt handler will execute and abort the task/fiber */
-static volatile int spurHandlerAbortedThread = 1;
-
-#ifdef CONFIG_NANOKERNEL
-static char __stack fiberStack[512];
-#endif
-
-
-/**
- *
- * isr_handler - handler to perform various actions from within an ISR context
- *
- * This routine is the ISR handler for _trigger_isrHandler().
- *
- * @return N/A
- */
-
-void isr_handler(void)
-{
- intHandlerExecuted++;
-}
-
-/**
- *
- * exc_divide_error_handler -
- *
- * This is the handler for the divde by zero exception. The source of this
- * divide-by-zero error comes from the following line in main() ...
- * error = error / excHandlerExecuted;
- * Where excHandlerExecuted is zero.
- * The disassembled code for it looks something like ....
- * f7 fb idiv %ecx
- * This handler is part of a test that is only interested in detecting the
- * error so that we know the exception connect code is working. Therefore,
- * a very quick and dirty approach is taken for dealing with the exception;
- * we skip the offending instruction by adding 2 to the EIP. (If nothing is
- * done, then control goes back to the offending instruction and an infinite
- * loop of divide-by-zero errors would be created.)
- *
- * @return N/A
- */
-
-void exc_divide_error_handler(NANO_ESF *pEsf)
-{
- pEsf->eip += 2;
- excHandlerExecuted = 1; /* provide evidence that the handler executed */
-}
-
-
-/**
- *
- * @brief Check the IDT.
- *
- * This test examines the IDT and verifies that the static interrupt and
- * exception stubs are installed at the correct place.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int nanoIdtStubTest(void)
-{
- IDT_ENTRY *pIdtEntry;
- uint16_t offset;
-
- /* Check for the interrupt stub */
- pIdtEntry = (IDT_ENTRY *) (_idt_base_address + (TEST_SOFT_INT << 3));
-
- offset = (uint16_t)((uint32_t)(&nanoIntStub) & 0xFFFF);
- if (pIdtEntry->offset_low != offset) {
- TC_ERROR("Failed to find low offset of nanoIntStub "
- "(0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
- return TC_FAIL;
- }
-
- offset = (uint16_t)((uint32_t)(&nanoIntStub) >> 16);
- if (pIdtEntry->offset_high != offset) {
- TC_ERROR("Failed to find high offset of nanoIntStub "
- "(0x%x) at vector %d\n", (uint32_t)offset, TEST_SOFT_INT);
- return TC_FAIL;
- }
-
- /* Check for the exception stub */
- pIdtEntry = (IDT_ENTRY *) (_idt_base_address + (IV_DIVIDE_ERROR << 3));
-
- offset = (uint16_t)((uint32_t)(&exc_divide_error_handlerStub) & 0xFFFF);
- if (pIdtEntry->offset_low != offset) {
- TC_ERROR("Failed to find low offset of exc stub "
- "(0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
- return TC_FAIL;
- }
-
- offset = (uint16_t)((uint32_t)(&exc_divide_error_handlerStub) >> 16);
- if (pIdtEntry->offset_high != offset) {
- TC_ERROR("Failed to find high offset of exc stub "
- "(0x%x) at vector %d\n", (uint32_t)offset, IV_DIVIDE_ERROR);
- return TC_FAIL;
- }
-
- /*
- * If the other fields are wrong, the system will crash when the exception
- * and software interrupt are triggered so we don't check them.
- */
- return TC_PASS;
-}
-
-/**
- *
- * @brief Task/fiber to test spurious handlers
- *
- * @return 0
- */
-
-#ifdef CONFIG_MICROKERNEL
-void idtSpurTask(void)
-#else
-static void idtSpurFiber(int a1, int a2)
-#endif
-{
-#ifndef CONFIG_MICROKERNEL
- ARG_UNUSED(a1);
- ARG_UNUSED(a2);
-#endif /* !CONFIG_MICROKERNEL */
-
- TC_PRINT("- Expect to see unhandled interrupt/exception message\n");
-
- _trigger_spurHandler();
-
- /* Shouldn't get here */
- spurHandlerAbortedThread = 0;
-
-}
-
-/**
- *
- * @brief Entry point to static IDT tests
- *
- * This is the entry point to the static IDT tests.
- *
- * @return N/A
- */
-
-#ifdef CONFIG_MICROKERNEL
-void idtTestTask(void)
-#else
-void main(void)
-#endif
-{
- int rv; /* return value from tests */
- volatile int error; /* used to create a divide by zero error */
-
- TC_START("Test Nanokernel static IDT tests");
-
-
- TC_PRINT("Testing to see if IDT has address of test stubs()\n");
- rv = nanoIdtStubTest();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing to see interrupt handler executes properly\n");
- _trigger_isrHandler();
-
- if (intHandlerExecuted == 0) {
- TC_ERROR("Interrupt handler did not execute\n");
- rv = TC_FAIL;
- goto doneTests;
- } else if (intHandlerExecuted != 1) {
- TC_ERROR("Interrupt handler executed more than once! (%d)\n",
- intHandlerExecuted);
- rv = TC_FAIL;
- goto doneTests;
- }
-
- TC_PRINT("Testing to see exception handler executes properly\n");
-
- /*
- * Use excHandlerExecuted instead of 0 to prevent the compiler issuing a
- * 'divide by zero' warning.
- */
- error = error / excHandlerExecuted;
-
- if (excHandlerExecuted == 0) {
- TC_ERROR("Exception handler did not execute\n");
- rv = TC_FAIL;
- goto doneTests;
- } else if (excHandlerExecuted != 1) {
- TC_ERROR("Exception handler executed more than once! (%d)\n",
- excHandlerExecuted);
- rv = TC_FAIL;
- goto doneTests;
- }
-
- /*
- * Start fiber/task to trigger the spurious interrupt handler
- */
- TC_PRINT("Testing to see spurious handler executes properly\n");
-#ifdef CONFIG_MICROKERNEL
- task_start(tSpurTask);
-#else
- task_fiber_start(fiberStack, sizeof(fiberStack), idtSpurFiber, 0, 0, 5, 0);
-#endif
- /*
- * The fiber/task should not run past where the spurious interrupt is
- * generated. Therefore spurHandlerAbortedThread should remain at 1.
- */
- if (spurHandlerAbortedThread == 0) {
- TC_ERROR("Spurious handler did not execute as expected\n");
- rv = TC_FAIL;
- goto doneTests;
- }
-
-doneTests:
- TC_END(rv, "%s - %s.\n", rv == TC_PASS ? PASS : FAIL, __func__);
- TC_END_REPORT(rv);
-}
diff --git a/samples/microkernel/test/test_static_idt/src/test_asm_inline_gcc.h b/samples/microkernel/test/test_static_idt/src/test_asm_inline_gcc.h
deleted file mode 100644
index 31172528b..000000000
--- a/samples/microkernel/test/test_static_idt/src/test_asm_inline_gcc.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Intel x86 GCC specific test inline assembler functions and macros */
-
-/*
- * Copyright (c) 2015, Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _TEST_ASM_INLINE_GCC_H
-#define _TEST_ASM_INLINE_GCC_H
-
-#if !defined(__GNUC__) || !defined(CONFIG_X86)
-#error test_asm_inline_gcc.h goes only with x86 GCC
-#endif
-
-#define _trigger_isrHandler() __asm__ volatile("int %0" : : "i" (TEST_SOFT_INT) : "memory")
-#define _trigger_spurHandler() __asm__ volatile("int %0" : : "i" (TEST_SPUR_INT) : "memory")
-
-#endif /* _TEST_ASM_INLINE_GCC_H */
diff --git a/samples/microkernel/test/test_static_idt/src/test_stubs.S b/samples/microkernel/test/test_static_idt/src/test_stubs.S
deleted file mode 100644
index 070a7a8cf..000000000
--- a/samples/microkernel/test/test_static_idt/src/test_stubs.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* test_stubs.S - Exception and interrupt stubs */
-
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module implements assembler exception and interrupt stubs for regression
-testing.
- */
-
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_ISA_IA32
-
-/* IA-32 specific */
-
-#include <arch/cpu.h>
-#include <nano_private.h>
-#include <arch/x86/asm.h>
-#include <asmPrv.h>
-#include <asm_inline.h>
-
- /* exports (internal APIs) */
-
- GTEXT(_ExcEnt)
- GTEXT(_ExcExit)
- GTEXT(_IntEnt)
- GTEXT(_IntExit)
-
-
-/* Static exception handler stubs */
-SYS_NANO_CPU_EXC_CONNECT(exc_divide_error_handler,IV_DIVIDE_ERROR)
-
-/* Static interrupt handler stubs */
-
-
- GTEXT(nanoIntStub)
-#if !defined(CONFIG_X86_IAMCU)
-SECTION_FUNC(TEXT, nanoIntStub)
- call _IntEnt
- pushl $0
- call isr_handler
- addl $4, %esp
- jmp _IntExit
-#else
-SECTION_FUNC(TEXT, nanoIntStub)
- pushl %eax
- pushl %edx
- pushl %ecx
- movl $isr_handler, %eax
- movl $0, %edx
- call _execute_handler
- pop %ecx
- pop %edx
- pop %eax
- iret
-#endif
-#else
-
-#error Arch not supported
-
-#endif /* CONFIG_ISA_IA32 */
diff --git a/samples/microkernel/test/test_static_idt/testcase.ini b/samples/microkernel/test/test_static_idt/testcase.ini
deleted file mode 100644
index 2c17b4094..000000000
--- a/samples/microkernel/test/test_static_idt/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-arch_whitelist = x86
-
diff --git a/samples/microkernel/test/test_task/Makefile b/samples/microkernel/test/test_task/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_task/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_task/README.txt b/samples/microkernel/test/test_task/README.txt
deleted file mode 100644
index 7d938d487..000000000
--- a/samples/microkernel/test/test_task/README.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Title: Task APIs
-
-Description:
-
-This test verifies that the microkernel task APIs operate as expected.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Task API
-===================================================================
-Microkernel objects initialized
-Testing isr_task_id_get() and isr_task_priority_get()
-Testing task_id_get() and task_priority_get()
-Testing task_priority_set()
-Testing task_sleep()
-Testing task_yield()
-Testing task_suspend() and task_resume()
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_task/prj.mdef b/samples/microkernel/test/test_task/prj.mdef
deleted file mode 100644
index 438cc2ab0..000000000
--- a/samples/microkernel/test/test_task/prj.mdef
+++ /dev/null
@@ -1,15 +0,0 @@
-% Application : test microkernel task APIs
-
-% TASKGROUP NAME
-% ==================================================
- TASKGROUP TEST
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ==================================================
- TASK HT_TASKID 20 HelperTask 2048 [TEST]
- TASK RT_TASKID 10 RegressionTask 2048 [EXE]
-
-% SEMA NAME
-% ===========
- SEMA HT_SEM
- SEMA RT_SEM
diff --git a/samples/microkernel/test/test_task/prj_arm.conf b/samples/microkernel/test/test_task/prj_arm.conf
deleted file mode 100644
index 74802771f..000000000
--- a/samples/microkernel/test/test_task/prj_arm.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=32
-CONFIG_NUM_IRQS=1
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_task/prj_x86.conf b/samples/microkernel/test/test_task/prj_x86.conf
deleted file mode 100644
index 4f877d1a0..000000000
--- a/samples/microkernel/test/test_task/prj_x86.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=32
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_task/src/Makefile b/samples/microkernel/test/test_task/src/Makefile
deleted file mode 100644
index 01e060bf7..000000000
--- a/samples/microkernel/test/test_task/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = task.o
diff --git a/samples/microkernel/test/test_task/src/task.c b/samples/microkernel/test/test_task/src/task.c
deleted file mode 100644
index 4e3131baa..000000000
--- a/samples/microkernel/test/test_task/src/task.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/* task.c - test microkernel task APIs */
-
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module tests the following task APIs:
- isr_task_id_get(), isr_task_priority_get(), task_id_get(), task_priority_get(),
- task_resume(), task_suspend(), task_priority_set(),
- task_sleep(), task_yield()
- */
-
-#include <tc_util.h>
-#include <zephyr.h>
-#include <arch/cpu.h>
-#include <irq_offload.h>
-
-#include <util_test_common.h>
-
-#define RT_PRIO 10 /* RegressionTask prio - must match prj.mdef */
-#define HT_PRIO 20 /* HelperTask prio - must match prj.mdef */
-
-#define SLEEP_TIME SECONDS(1)
-
-#define CMD_TASKID 0
-#define CMD_PRIORITY 1
-
-typedef struct {
- int cmd;
- int data;
-} ISR_INFO;
-
-static ISR_INFO isrInfo;
-
-static int tcRC = TC_PASS; /* test case return code */
-static int helperData;
-
-static volatile int is_main_task_ready = 0;
-
-#ifdef TEST_PRIV_TASKS
-/* Note this is in reverse order of what is defined under
- * test_task/prj.mdef. This is due to compiler filling linker
- * section like a stack. This is to preserve the same order
- * in memory as test_task.
- */
-DEFINE_TASK(RT_TASKID, 10, RegressionTask, 2048, EXE);
-DEFINE_TASK(HT_TASKID, 20, HelperTask, 2048, EXE);
-#endif
-
-/**
- *
- * @brief ISR handler to call isr_task_id_get() and isr_task_priority_get()
- *
- * @return N/A
- */
-
-void isr_task_command_handler(void *data)
-{
- ISR_INFO *pInfo = (ISR_INFO *) data;
- int value = -1;
-
- switch (pInfo->cmd) {
- case CMD_TASKID:
- value = isr_task_id_get();
- break;
-
- case CMD_PRIORITY:
- value = isr_task_priority_get();
- break;
- }
-
- pInfo->data = value;
-}
-
-/**
- *
- * @brief Test isr_task_id_get() and isr_task_priority_get
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int isrAPIsTest(int taskId, int taskPrio)
-{
- isrInfo.cmd = CMD_TASKID;
- irq_offload(isr_task_command_handler, &isrInfo);
- if (isrInfo.data != taskId) {
- TC_ERROR("isr_task_id_get() returned %d, not %d\n",
- isrInfo.data, taskId);
- return TC_FAIL;
- }
-
- isrInfo.cmd = CMD_PRIORITY;
- irq_offload(isr_task_command_handler, &isrInfo);
- if (isrInfo.data != taskPrio) {
- TC_ERROR("isr_task_priority_get() returned %d, not %d\n",
- isrInfo.data, taskPrio);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test task_id_get() and task_priority_get() macros
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int taskMacrosTest(int taskId, int taskPrio)
-{
- int value;
-
- value = task_id_get();
- if (value != taskId) {
- TC_ERROR("task_id_get() returned 0x%x, not 0x%x\n",
- value, taskId);
- return TC_FAIL;
- }
-
- value = task_priority_get();
- if (value != taskPrio) {
- TC_ERROR("task_priority_get() returned %d, not %d\n",
- value, taskPrio);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper task portion to test setting the priority
- *
- * @return N/A
- */
-
-void helperTaskSetPrioTest(void)
-{
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
- helperData = task_priority_get(); /* Helper task priority lowered by 5 */
- task_sem_give(RT_SEM);
-
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
- helperData = task_priority_get(); /* Helper task prioirty raised by 10 */
- task_sem_give(RT_SEM);
-
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
- helperData = task_priority_get(); /* Helper task prioirty restored */
- task_sem_give(RT_SEM);
-}
-
-/**
- *
- * @brief Test the task_priority_set() API
- *
- * @return N/A
- */
-
-int taskSetPrioTest(void)
-{
- int rv;
-
- /* Lower the priority of the current task (RegressionTask) */
- task_priority_set(RT_TASKID, RT_PRIO + 5);
- rv = task_priority_get();
- if (rv != RT_PRIO + 5) {
- TC_ERROR("Expected priority to be changed to %d, not %d\n",
- RT_PRIO + 5, rv);
- return TC_FAIL;
- }
-
- /* Raise the priority of the current task (RegressionTask) */
- task_priority_set(RT_TASKID, RT_PRIO - 5);
- rv = task_priority_get();
- if (rv != RT_PRIO - 5) {
- TC_ERROR("Expected priority to be changed to %d, not %d\n",
- RT_PRIO - 5, rv);
- return TC_FAIL;
- }
-
-
- /* Restore the priority of the current task (RegressionTask) */
- task_priority_set(RT_TASKID, RT_PRIO);
- rv = task_priority_get();
- if (rv != RT_PRIO) {
- TC_ERROR("Expected priority to be changed to %d, not %d\n",
- RT_PRIO, rv);
- return TC_FAIL;
- }
-
-
- /* Lower the priority of the helper task (HelperTask) */
- task_priority_set(HT_TASKID, HT_PRIO + 5);
- task_sem_give(HT_SEM);
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
- if (helperData != HT_PRIO + 5) {
- TC_ERROR("Expected priority to be changed to %d, not %d\n",
- HT_PRIO + 5, helperData);
- return TC_FAIL;
- }
-
- /* Raise the priority of the helper task (HelperTask) */
- task_priority_set(HT_TASKID, HT_PRIO - 5);
- task_sem_give(HT_SEM);
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
- if (helperData != HT_PRIO - 5) {
- TC_ERROR("Expected priority to be changed to %d, not %d\n",
- HT_PRIO - 5, helperData);
- return TC_FAIL;
- }
-
-
- /* Restore the priority of the helper task (HelperTask) */
- task_priority_set(HT_TASKID, HT_PRIO);
- task_sem_give(HT_SEM);
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
- if (helperData != HT_PRIO) {
- TC_ERROR("Expected priority to be changed to %d, not %d\n",
- HT_PRIO, helperData);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper task portion to test task_sleep()
- *
- * @return N/A
- */
-
-void helperTaskSleepTest(void)
-{
- int32_t firstTick;
-
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
-
- firstTick = sys_tick_get_32();
- while (!is_main_task_ready) {
- /* busy work */
- }
- helperData = sys_tick_get_32() - firstTick;
-
- task_sem_give(RT_SEM);
-}
-
-/**
- *
- * @brief Test task_sleep()
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int taskSleepTest(void)
-{
- int32_t tick;
-
- task_sem_give(HT_SEM);
-
- /* align on tick boundary and get current tick */
- tick = sys_tick_get_32();
- while (tick == sys_tick_get_32()) {
- }
-
- /* compensate for the extra tick we just waited */
- ++tick;
-
- task_sleep(SLEEP_TIME);
-
- tick = sys_tick_get_32() - tick;
-
- is_main_task_ready = 1;
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
-
- if (tick != SLEEP_TIME) {
- TC_ERROR("task_sleep() slept for %d ticks, not %d\n", tick, SLEEP_TIME);
- return TC_FAIL;
- }
-
- /*
- * Check that the helper task ran for approximately SLEEP_TIME. On QEMU,
- * when the host CPU is overloaded, it has been observed that the tick
- * count can be missed by 1 on either side. Allow for 2 ticks to be sure.
- * This check is only there to make sure that the helper task did run for
- * approximately the whole time the main task was sleeping.
- */
- const int tick_error_allowed = 2;
- if (helperData > SLEEP_TIME + tick_error_allowed ||
- helperData < SLEEP_TIME - tick_error_allowed) {
- TC_ERROR("helper task should have run for around %d ticks "
- "(+/-%d), but ran for %d ticks\n",
- SLEEP_TIME, tick_error_allowed, helperData);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper task portion of task_yield() test
- *
- * @return N/A
- */
-
-void helperTaskYieldTest(void)
-{
- int i;
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
-
- for (i = 0; i < 5; i++) {
- helperData++;
- task_yield();
- }
-
- task_sem_give(RT_SEM);
-}
-
-/**
- *
- * @brief Test task_yield()
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int taskYieldTest(void)
-{
- int prevHelperData;
- int i;
-
- helperData = 0;
-
- /* 1st raise the priority of the helper task */
- task_priority_set(HT_TASKID, RT_PRIO);
- task_sem_give(HT_SEM);
-
- for (i = 0; i < 5; i++) {
- prevHelperData = helperData;
- task_yield();
-
- if (helperData == prevHelperData) {
- TC_ERROR("Iter %d. helperData did not change (%d)\n",
- i + 1, helperData);
- return TC_FAIL;
- }
- }
-
- /* Restore helper task priority */
- task_priority_set(HT_TASKID, HT_PRIO);
-
- /* Ensure that the helper task finishes */
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper task portion of task_suspend() and
- * task_resume() tests
- *
- * @return N/A
- */
-
-void helperTaskSuspendTest(void)
-{
- helperData++;
-
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
-}
-
-/**
- *
- * @brief Test task_suspend() and task_resume()
- *
- * This test suspends the helper task. Once it is suspended, the main task
- * (RegressionTask) sleeps for one second. If the helper task is truly
- * suspended, it will not execute and modify <helperData>. Once confirmed,
- * the helper task is resumed, and the main task sleeps once more. If the
- * helper task has truly resumed, it will modify <helperData>.
- *
- * @return TC_PASS on success or TC_FAIL on failure
- */
-
-int taskSuspendTest(void)
-{
- int prevHelperData;
-
- task_suspend(HT_TASKID); /* Suspend the helper task */
-
- prevHelperData = helperData;
- task_sleep(SLEEP_TIME);
-
- if (prevHelperData != helperData) {
- TC_ERROR("Helper task did not suspend!\n");
- return TC_FAIL;
- }
-
- task_resume(HT_TASKID);
- task_sleep(SLEEP_TIME);
-
- if (prevHelperData == helperData) {
- TC_ERROR("Helper task did not resume!\n");
- return TC_FAIL;
- }
-
- task_sem_give(HT_SEM);
- return TC_PASS;
-}
-
-/**
- *
- * @brief Helper task to test the task APIs
- *
- * @return N/A
- */
-
-void HelperTask(void)
-{
- int rv;
-
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
- rv = isrAPIsTest(HT_TASKID, HT_PRIO);
- if (rv != TC_PASS) {
- tcRC = TC_FAIL;
- return;
- }
- task_sem_give(RT_SEM);
-
- task_sem_take(HT_SEM, TICKS_UNLIMITED);
- rv = taskMacrosTest(HT_TASKID, HT_PRIO);
- if (rv != TC_PASS) {
- tcRC = TC_FAIL;
- return;
- }
- task_sem_give(RT_SEM);
-
- helperTaskSetPrioTest();
-
- helperTaskSleepTest();
-
- helperTaskYieldTest();
-
- helperTaskSuspendTest();
-}
-
-/**
- *
- * @brief Main task to test the task APIs
- *
- * @return N/A
- */
-
-void RegressionTask(void)
-{
- int rv;
-
- TC_START("Test Microkernel Task API");
-
- PRINT_LINE;
-
- task_start(HT_TASKID);
-
- TC_PRINT("Testing isr_task_id_get() and isr_task_priority_get()\n");
- rv = isrAPIsTest(RT_TASKID, RT_PRIO);
- if (rv != TC_PASS) {
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_sem_give(HT_SEM);
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
-
- TC_PRINT("Testing task_id_get() and task_priority_get()\n");
- rv = taskMacrosTest(RT_TASKID, RT_PRIO);
- if (rv != TC_PASS) {
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- task_sem_give(HT_SEM);
- task_sem_take(RT_SEM, TICKS_UNLIMITED);
-
- TC_PRINT("Testing task_priority_set()\n");
- if (taskSetPrioTest() != TC_PASS) {
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- TC_PRINT("Testing task_sleep()\n");
- if (taskSleepTest() != TC_PASS) {
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- TC_PRINT("Testing task_yield()\n");
- if (taskYieldTest() != TC_PASS) {
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
- TC_PRINT("Testing task_suspend() and task_resume()\n");
- if (taskSuspendTest() != TC_PASS) {
- tcRC = TC_FAIL;
- goto errorReturn;
- }
-
-errorReturn:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-} /* RegressionTask */
diff --git a/samples/microkernel/test/test_task/testcase.ini b/samples/microkernel/test/test_task/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_task/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_task_irq/Makefile b/samples/microkernel/test/test_task_irq/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_task_irq/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_task_irq/README.txt b/samples/microkernel/test/test_task_irq/README.txt
deleted file mode 100644
index caa6d5583..000000000
--- a/samples/microkernel/test/test_task_irq/README.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-Title: Task Level Interrupt Handling
-
-Description:
-
-This test exercises the APIs of the task level interrupt handling feature.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting task level interrupt handling tests
-===================================================================
-IRQ object 0 using IRQ8 allocated
-IRQ object 1 using IRQ14 allocated
-
-IRQ object 2 using IRQ32 allocated
-IRQ object 3 using IRQ34 allocated
-
-Generating interrupts for all allocated IRQ objects...
-Received event for IRQ object 0
-Received event for IRQ object 1
-Received event for IRQ object 2
-Received event for IRQ object 3
-
-Attempt to allocate an IRQ object that
-is already allocated by another task...
-Re-allocation of IRQ object 3 prevented
-
-Attempt to allocate an IRQ that
-is already allocated by another task...
-Re-allocation of IRQ34 prevented
-
-Attempt to free an IRQ object...
-IRQ object 2 freed
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_task_irq/prj.mdef b/samples/microkernel/test/test_task_irq/prj.mdef
deleted file mode 100644
index 413f26617..000000000
--- a/samples/microkernel/test/test_task_irq/prj.mdef
+++ /dev/null
@@ -1,14 +0,0 @@
-% Application : kernel task level device interrupt test
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ===================================================
- TASK MONITORTASK 10 MonitorTaskEntry 1024 [EXE]
- TASK tTaskAMain 11 taskAMain 1024 [EXE]
- TASK tTaskBMain 12 taskBMain 1024 [EXE]
- TASK tRegisterWait 13 registerWait 1024 [EXE]
-
-% SEMA NAME
-% =================
- SEMA SEM_TASKDONE
- SEMA SEM_TASKFAIL
- SEMA SEM_RDY
diff --git a/samples/microkernel/test/test_task_irq/prj_arm.conf b/samples/microkernel/test/test_task_irq/prj_arm.conf
deleted file mode 100644
index 4b0a8064a..000000000
--- a/samples/microkernel/test/test_task_irq/prj_arm.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_SW_ISR_TABLE_DYNAMIC=y
-CONFIG_MAX_NUM_TASK_IRQS=5
-CONFIG_NUM_IRQS=4
diff --git a/samples/microkernel/test/test_task_irq/prj_x86.conf b/samples/microkernel/test/test_task_irq/prj_x86.conf
deleted file mode 100644
index e6cc9e118..000000000
--- a/samples/microkernel/test/test_task_irq/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-CONFIG_TEST_RANDOM_GENERATOR=y
-
-CONFIG_MAX_NUM_TASK_IRQS=5
diff --git a/samples/microkernel/test/test_task_irq/src/Makefile b/samples/microkernel/test/test_task_irq/src/Makefile
deleted file mode 100644
index 90eceb969..000000000
--- a/samples/microkernel/test/test_task_irq/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = main.o raise_int.o test_device.o
diff --git a/samples/microkernel/test/test_task_irq/src/main.c b/samples/microkernel/test/test_task_irq/src/main.c
deleted file mode 100644
index 58514127c..000000000
--- a/samples/microkernel/test/test_task_irq/src/main.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* main.c - main testing module */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * DESCRIPTION
- * This file contains the main testing module that invokes all the tests.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-
-/* One of the task IRQ objects will not be allocated */
-#define NUM_TASK_IRQS CONFIG_MAX_NUM_TASK_IRQS - 1
-
-#define NUM_TEST_TASKS 3 /* # of test tasks to monitor */
-
-/* # ticks to wait for test completion */
-#define TIMEOUT (60 * sys_clock_ticks_per_sec)
-
-static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
-static ksem_t rdySem = SEM_RDY;
-
-#define NUM_OBJECTS 4
-extern uint32_t irq_vectors[NUM_OBJECTS];
-
-/**
- *
- * @brief Entry point for taskA
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * taskA.
- *
- * @return N/A
- */
-
-void taskAMain(void)
-{
- extern int taskA(ksem_t semRdy);
- task_sem_give(resultSems[taskA(rdySem)]);
-}
-
-/**
- *
- * @brief Entry point for taskB
- *
- * This routine signals "task done" or "task fail", based on the return code of
- * taskB.
- *
- * @return N/A
- */
-
-void taskBMain(void)
-{
- extern int taskB(ksem_t semRdy);
- task_sem_give(resultSems[taskB(rdySem)]);
-}
-
-/**
- *
- * @brief Wait for devices to be registered and generate SW ints
- *
- * This routine waits for the tasks to indicate the IRQ objects are allocated and
- * then generates SW interrupts for all IRQs. Signals "task done" if all task
- * indicated the IRQs are allocated or signals "task fail"if not.
- *
- * @return N/A
- */
-void registerWait(void)
-{
- extern void raiseInt(uint8_t id);
- int tasksDone;
- int irq_obj;
-
- /* Wait for the 2 tasks to finish registering their IRQ objects*/
-
- for (tasksDone = 0; tasksDone < NUM_TEST_TASKS - 1; tasksDone++) {
- if (task_sem_take(SEM_RDY, TIMEOUT) != RC_OK) {
- TC_ERROR("Monitor task timed out\n");
- task_sem_give(resultSems[TC_FAIL]);
- return;
- }
- }
-
- TC_PRINT("Generating interrupts for all allocated IRQ objects...\n");
- for (irq_obj = 0; irq_obj < NUM_OBJECTS; irq_obj++) {
- if (irq_vectors[irq_obj] != INVALID_VECTOR) {
- raiseInt((uint8_t)irq_vectors[irq_obj]);
- }
- }
-
- task_sem_give(resultSems[TC_PASS]);
-}
-
-/**
- *
- * @brief Entry point for MonitorTask
- *
- * This routine keeps tabs on the progress of the tasks doing the actual testing
- * and generates the final test case summary message.
- *
- * @return N/A
- */
-
-void MonitorTaskEntry(void)
-{
- ksem_t result;
- int tasksDone;
-
- PRINT_DATA("Starting task level interrupt handling tests\n");
- PRINT_LINE;
-
- /*
- * the various test tasks start executing automatically;
- * wait for all tasks to complete or a failure to occur,
- * then issue the appropriate test case summary message
- */
-
- for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) {
- result = task_sem_group_take(resultSems, TIMEOUT);
- if (result != resultSems[TC_PASS]) {
- if (result != resultSems[TC_FAIL]) {
- TC_ERROR("Monitor task timed out\n");
- }
- TC_END_RESULT(TC_FAIL);
- TC_END_REPORT(TC_FAIL);
- return;
- }
- }
-
- TC_END_RESULT(TC_PASS);
- TC_END_REPORT(TC_PASS);
-}
diff --git a/samples/microkernel/test/test_task_irq/src/raise_int.c b/samples/microkernel/test/test_task_irq/src/raise_int.c
deleted file mode 100644
index da0a2b326..000000000
--- a/samples/microkernel/test/test_task_irq/src/raise_int.c
+++ /dev/null
@@ -1,1406 +0,0 @@
-/* raise_int.c - utility functions for generating SW interrupt */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * DESCRIPTION
- * This file implements raiseInt(), which generates the specified SW interrupt
- * (in the range 0 to 255).
- * This method is being used because the MM_POMS model prevents the
- * execution of a dynamically generated stub.
- */
-
-#include <stdint.h>
-
-#if defined(CONFIG_X86)
-
-static void genInt0(void)
-{
- __asm__ volatile("int $0");
-}
-
-static void genInt1(void)
-{
- __asm__ volatile("int $1");
-}
-
-static void genInt2(void)
-{
- __asm__ volatile("int $2");
-}
-
-static void genInt3(void)
-{
- __asm__ volatile("int $3");
-}
-
-static void genInt4(void)
-{
- __asm__ volatile("int $4");
-}
-
-static void genInt5(void)
-{
- __asm__ volatile("int $5");
-}
-
-static void genInt6(void)
-{
- __asm__ volatile("int $6");
-}
-
-static void genInt7(void)
-{
- __asm__ volatile("int $7");
-}
-
-static void genInt8(void)
-{
- __asm__ volatile("int $8");
-}
-
-static void genInt9(void)
-{
- __asm__ volatile("int $9");
-}
-
-static void genInt10(void)
-{
- __asm__ volatile("int $10");
-}
-
-static void genInt11(void)
-{
- __asm__ volatile("int $11");
-}
-
-static void genInt12(void)
-{
- __asm__ volatile("int $12");
-}
-
-static void genInt13(void)
-{
- __asm__ volatile("int $13");
-}
-
-static void genInt14(void)
-{
- __asm__ volatile("int $14");
-}
-
-static void genInt15(void)
-{
- __asm__ volatile("int $15");
-}
-
-static void genInt16(void)
-{
- __asm__ volatile("int $16");
-}
-
-static void genInt17(void)
-{
- __asm__ volatile("int $17");
-}
-
-static void genInt18(void)
-{
- __asm__ volatile("int $18");
-}
-
-static void genInt19(void)
-{
- __asm__ volatile("int $19");
-}
-
-static void genInt20(void)
-{
- __asm__ volatile("int $20");
-}
-
-static void genInt21(void)
-{
- __asm__ volatile("int $21");
-}
-
-static void genInt22(void)
-{
- __asm__ volatile("int $22");
-}
-
-static void genInt23(void)
-{
- __asm__ volatile("int $23");
-}
-
-static void genInt24(void)
-{
- __asm__ volatile("int $24");
-}
-
-static void genInt25(void)
-{
- __asm__ volatile("int $25");
-}
-
-static void genInt26(void)
-{
- __asm__ volatile("int $26");
-}
-
-static void genInt27(void)
-{
- __asm__ volatile("int $27");
-}
-
-static void genInt28(void)
-{
- __asm__ volatile("int $28");
-}
-
-static void genInt29(void)
-{
- __asm__ volatile("int $29");
-}
-
-static void genInt30(void)
-{
- __asm__ volatile("int $30");
-}
-
-static void genInt31(void)
-{
- __asm__ volatile("int $31");
-}
-
-static void genInt32(void)
-{
- __asm__ volatile("int $32");
-}
-
-static void genInt33(void)
-{
- __asm__ volatile("int $33");
-}
-
-static void genInt34(void)
-{
- __asm__ volatile("int $34");
-}
-
-static void genInt35(void)
-{
- __asm__ volatile("int $35");
-}
-
-static void genInt36(void)
-{
- __asm__ volatile("int $36");
-}
-
-static void genInt37(void)
-{
- __asm__ volatile("int $37");
-}
-
-static void genInt38(void)
-{
- __asm__ volatile("int $38");
-}
-
-static void genInt39(void)
-{
- __asm__ volatile("int $39");
-}
-
-static void genInt40(void)
-{
- __asm__ volatile("int $40");
-}
-
-static void genInt41(void)
-{
- __asm__ volatile("int $41");
-}
-
-static void genInt42(void)
-{
- __asm__ volatile("int $42");
-}
-
-static void genInt43(void)
-{
- __asm__ volatile("int $43");
-}
-
-static void genInt44(void)
-{
- __asm__ volatile("int $44");
-}
-
-static void genInt45(void)
-{
- __asm__ volatile("int $45");
-}
-
-static void genInt46(void)
-{
- __asm__ volatile("int $46");
-}
-
-static void genInt47(void)
-{
- __asm__ volatile("int $47");
-}
-
-static void genInt48(void)
-{
- __asm__ volatile("int $48");
-}
-
-static void genInt49(void)
-{
- __asm__ volatile("int $49");
-}
-
-static void genInt50(void)
-{
- __asm__ volatile("int $50");
-}
-
-static void genInt51(void)
-{
- __asm__ volatile("int $51");
-}
-
-static void genInt52(void)
-{
- __asm__ volatile("int $52");
-}
-
-static void genInt53(void)
-{
- __asm__ volatile("int $53");
-}
-
-static void genInt54(void)
-{
- __asm__ volatile("int $54");
-}
-
-static void genInt55(void)
-{
- __asm__ volatile("int $55");
-}
-
-static void genInt56(void)
-{
- __asm__ volatile("int $56");
-}
-
-static void genInt57(void)
-{
- __asm__ volatile("int $57");
-}
-
-static void genInt58(void)
-{
- __asm__ volatile("int $58");
-}
-
-static void genInt59(void)
-{
- __asm__ volatile("int $59");
-}
-
-static void genInt60(void)
-{
- __asm__ volatile("int $60");
-}
-
-static void genInt61(void)
-{
- __asm__ volatile("int $61");
-}
-
-static void genInt62(void)
-{
- __asm__ volatile("int $62");
-}
-
-static void genInt63(void)
-{
- __asm__ volatile("int $63");
-}
-
-static void genInt64(void)
-{
- __asm__ volatile("int $64");
-}
-
-static void genInt65(void)
-{
- __asm__ volatile("int $65");
-}
-
-static void genInt66(void)
-{
- __asm__ volatile("int $66");
-}
-
-static void genInt67(void)
-{
- __asm__ volatile("int $67");
-}
-
-static void genInt68(void)
-{
- __asm__ volatile("int $68");
-}
-
-static void genInt69(void)
-{
- __asm__ volatile("int $69");
-}
-
-static void genInt70(void)
-{
- __asm__ volatile("int $70");
-}
-
-static void genInt71(void)
-{
- __asm__ volatile("int $71");
-}
-
-static void genInt72(void)
-{
- __asm__ volatile("int $72");
-}
-
-static void genInt73(void)
-{
- __asm__ volatile("int $73");
-}
-
-static void genInt74(void)
-{
- __asm__ volatile("int $74");
-}
-
-static void genInt75(void)
-{
- __asm__ volatile("int $75");
-}
-
-static void genInt76(void)
-{
- __asm__ volatile("int $76");
-}
-
-static void genInt77(void)
-{
- __asm__ volatile("int $77");
-}
-
-static void genInt78(void)
-{
- __asm__ volatile("int $78");
-}
-
-static void genInt79(void)
-{
- __asm__ volatile("int $79");
-}
-
-static void genInt80(void)
-{
- __asm__ volatile("int $80");
-}
-
-static void genInt81(void)
-{
- __asm__ volatile("int $81");
-}
-
-static void genInt82(void)
-{
- __asm__ volatile("int $82");
-}
-
-static void genInt83(void)
-{
- __asm__ volatile("int $83");
-}
-
-static void genInt84(void)
-{
- __asm__ volatile("int $84");
-}
-
-static void genInt85(void)
-{
- __asm__ volatile("int $85");
-}
-
-static void genInt86(void)
-{
- __asm__ volatile("int $86");
-}
-
-static void genInt87(void)
-{
- __asm__ volatile("int $87");
-}
-
-static void genInt88(void)
-{
- __asm__ volatile("int $88");
-}
-
-static void genInt89(void)
-{
- __asm__ volatile("int $89");
-}
-
-static void genInt90(void)
-{
- __asm__ volatile("int $90");
-}
-
-static void genInt91(void)
-{
- __asm__ volatile("int $91");
-}
-
-static void genInt92(void)
-{
- __asm__ volatile("int $92");
-}
-
-static void genInt93(void)
-{
- __asm__ volatile("int $93");
-}
-
-static void genInt94(void)
-{
- __asm__ volatile("int $94");
-}
-
-static void genInt95(void)
-{
- __asm__ volatile("int $95");
-}
-
-static void genInt96(void)
-{
- __asm__ volatile("int $96");
-}
-
-static void genInt97(void)
-{
- __asm__ volatile("int $97");
-}
-
-static void genInt98(void)
-{
- __asm__ volatile("int $98");
-}
-
-static void genInt99(void)
-{
- __asm__ volatile("int $99");
-}
-
-static void genInt100(void)
-{
- __asm__ volatile("int $100");
-}
-
-static void genInt101(void)
-{
- __asm__ volatile("int $101");
-}
-
-static void genInt102(void)
-{
- __asm__ volatile("int $102");
-}
-
-static void genInt103(void)
-{
- __asm__ volatile("int $103");
-}
-
-static void genInt104(void)
-{
- __asm__ volatile("int $104");
-}
-
-static void genInt105(void)
-{
- __asm__ volatile("int $105");
-}
-
-static void genInt106(void)
-{
- __asm__ volatile("int $106");
-}
-
-static void genInt107(void)
-{
- __asm__ volatile("int $107");
-}
-
-static void genInt108(void)
-{
- __asm__ volatile("int $108");
-}
-
-static void genInt109(void)
-{
- __asm__ volatile("int $109");
-}
-
-static void genInt110(void)
-{
- __asm__ volatile("int $110");
-}
-
-static void genInt111(void)
-{
- __asm__ volatile("int $111");
-}
-
-static void genInt112(void)
-{
- __asm__ volatile("int $112");
-}
-
-static void genInt113(void)
-{
- __asm__ volatile("int $113");
-}
-
-static void genInt114(void)
-{
- __asm__ volatile("int $114");
-}
-
-static void genInt115(void)
-{
- __asm__ volatile("int $115");
-}
-
-static void genInt116(void)
-{
- __asm__ volatile("int $116");
-}
-
-static void genInt117(void)
-{
- __asm__ volatile("int $117");
-}
-
-static void genInt118(void)
-{
- __asm__ volatile("int $118");
-}
-
-static void genInt119(void)
-{
- __asm__ volatile("int $119");
-}
-
-static void genInt120(void)
-{
- __asm__ volatile("int $120");
-}
-
-static void genInt121(void)
-{
- __asm__ volatile("int $121");
-}
-
-static void genInt122(void)
-{
- __asm__ volatile("int $122");
-}
-
-static void genInt123(void)
-{
- __asm__ volatile("int $123");
-}
-
-static void genInt124(void)
-{
- __asm__ volatile("int $124");
-}
-
-static void genInt125(void)
-{
- __asm__ volatile("int $125");
-}
-
-static void genInt126(void)
-{
- __asm__ volatile("int $126");
-}
-
-static void genInt127(void)
-{
- __asm__ volatile("int $127");
-}
-
-static void genInt128(void)
-{
- __asm__ volatile("int $128");
-}
-
-static void genInt129(void)
-{
- __asm__ volatile("int $129");
-}
-
-static void genInt130(void)
-{
- __asm__ volatile("int $130");
-}
-
-static void genInt131(void)
-{
- __asm__ volatile("int $131");
-}
-
-static void genInt132(void)
-{
- __asm__ volatile("int $132");
-}
-
-static void genInt133(void)
-{
- __asm__ volatile("int $133");
-}
-
-static void genInt134(void)
-{
- __asm__ volatile("int $134");
-}
-
-static void genInt135(void)
-{
- __asm__ volatile("int $135");
-}
-
-static void genInt136(void)
-{
- __asm__ volatile("int $136");
-}
-
-static void genInt137(void)
-{
- __asm__ volatile("int $137");
-}
-
-static void genInt138(void)
-{
- __asm__ volatile("int $138");
-}
-
-static void genInt139(void)
-{
- __asm__ volatile("int $139");
-}
-
-static void genInt140(void)
-{
- __asm__ volatile("int $140");
-}
-
-static void genInt141(void)
-{
- __asm__ volatile("int $141");
-}
-
-static void genInt142(void)
-{
- __asm__ volatile("int $142");
-}
-
-static void genInt143(void)
-{
- __asm__ volatile("int $143");
-}
-
-static void genInt144(void)
-{
- __asm__ volatile("int $144");
-}
-
-static void genInt145(void)
-{
- __asm__ volatile("int $145");
-}
-
-static void genInt146(void)
-{
- __asm__ volatile("int $146");
-}
-
-static void genInt147(void)
-{
- __asm__ volatile("int $147");
-}
-
-static void genInt148(void)
-{
- __asm__ volatile("int $148");
-}
-
-static void genInt149(void)
-{
- __asm__ volatile("int $149");
-}
-
-static void genInt150(void)
-{
- __asm__ volatile("int $150");
-}
-
-static void genInt151(void)
-{
- __asm__ volatile("int $151");
-}
-
-static void genInt152(void)
-{
- __asm__ volatile("int $152");
-}
-
-static void genInt153(void)
-{
- __asm__ volatile("int $153");
-}
-
-static void genInt154(void)
-{
- __asm__ volatile("int $154");
-}
-
-static void genInt155(void)
-{
- __asm__ volatile("int $155");
-}
-
-static void genInt156(void)
-{
- __asm__ volatile("int $156");
-}
-
-static void genInt157(void)
-{
- __asm__ volatile("int $157");
-}
-
-static void genInt158(void)
-{
- __asm__ volatile("int $158");
-}
-
-static void genInt159(void)
-{
- __asm__ volatile("int $159");
-}
-
-static void genInt160(void)
-{
- __asm__ volatile("int $160");
-}
-
-static void genInt161(void)
-{
- __asm__ volatile("int $161");
-}
-
-static void genInt162(void)
-{
- __asm__ volatile("int $162");
-}
-
-static void genInt163(void)
-{
- __asm__ volatile("int $163");
-}
-
-static void genInt164(void)
-{
- __asm__ volatile("int $164");
-}
-
-static void genInt165(void)
-{
- __asm__ volatile("int $165");
-}
-
-static void genInt166(void)
-{
- __asm__ volatile("int $166");
-}
-
-static void genInt167(void)
-{
- __asm__ volatile("int $167");
-}
-
-static void genInt168(void)
-{
- __asm__ volatile("int $168");
-}
-
-static void genInt169(void)
-{
- __asm__ volatile("int $169");
-}
-
-static void genInt170(void)
-{
- __asm__ volatile("int $170");
-}
-
-static void genInt171(void)
-{
- __asm__ volatile("int $171");
-}
-
-static void genInt172(void)
-{
- __asm__ volatile("int $172");
-}
-
-static void genInt173(void)
-{
- __asm__ volatile("int $173");
-}
-
-static void genInt174(void)
-{
- __asm__ volatile("int $174");
-}
-
-static void genInt175(void)
-{
- __asm__ volatile("int $175");
-}
-
-static void genInt176(void)
-{
- __asm__ volatile("int $176");
-}
-
-static void genInt177(void)
-{
- __asm__ volatile("int $177");
-}
-
-static void genInt178(void)
-{
- __asm__ volatile("int $178");
-}
-
-static void genInt179(void)
-{
- __asm__ volatile("int $179");
-}
-
-static void genInt180(void)
-{
- __asm__ volatile("int $180");
-}
-
-static void genInt181(void)
-{
- __asm__ volatile("int $181");
-}
-
-static void genInt182(void)
-{
- __asm__ volatile("int $182");
-}
-
-static void genInt183(void)
-{
- __asm__ volatile("int $183");
-}
-
-static void genInt184(void)
-{
- __asm__ volatile("int $184");
-}
-
-static void genInt185(void)
-{
- __asm__ volatile("int $185");
-}
-
-static void genInt186(void)
-{
- __asm__ volatile("int $186");
-}
-
-static void genInt187(void)
-{
- __asm__ volatile("int $187");
-}
-
-static void genInt188(void)
-{
- __asm__ volatile("int $188");
-}
-
-static void genInt189(void)
-{
- __asm__ volatile("int $189");
-}
-
-static void genInt190(void)
-{
- __asm__ volatile("int $190");
-}
-
-static void genInt191(void)
-{
- __asm__ volatile("int $191");
-}
-
-static void genInt192(void)
-{
- __asm__ volatile("int $192");
-}
-
-static void genInt193(void)
-{
- __asm__ volatile("int $193");
-}
-
-static void genInt194(void)
-{
- __asm__ volatile("int $194");
-}
-
-static void genInt195(void)
-{
- __asm__ volatile("int $195");
-}
-
-static void genInt196(void)
-{
- __asm__ volatile("int $196");
-}
-
-static void genInt197(void)
-{
- __asm__ volatile("int $197");
-}
-
-static void genInt198(void)
-{
- __asm__ volatile("int $198");
-}
-
-static void genInt199(void)
-{
- __asm__ volatile("int $199");
-}
-
-static void genInt200(void)
-{
- __asm__ volatile("int $200");
-}
-
-static void genInt201(void)
-{
- __asm__ volatile("int $201");
-}
-
-static void genInt202(void)
-{
- __asm__ volatile("int $202");
-}
-
-static void genInt203(void)
-{
- __asm__ volatile("int $203");
-}
-
-static void genInt204(void)
-{
- __asm__ volatile("int $204");
-}
-
-static void genInt205(void)
-{
- __asm__ volatile("int $205");
-}
-
-static void genInt206(void)
-{
- __asm__ volatile("int $206");
-}
-
-static void genInt207(void)
-{
- __asm__ volatile("int $207");
-}
-
-static void genInt208(void)
-{
- __asm__ volatile("int $208");
-}
-
-static void genInt209(void)
-{
- __asm__ volatile("int $209");
-}
-
-static void genInt210(void)
-{
- __asm__ volatile("int $210");
-}
-
-static void genInt211(void)
-{
- __asm__ volatile("int $211");
-}
-
-static void genInt212(void)
-{
- __asm__ volatile("int $212");
-}
-
-static void genInt213(void)
-{
- __asm__ volatile("int $213");
-}
-
-static void genInt214(void)
-{
- __asm__ volatile("int $214");
-}
-
-static void genInt215(void)
-{
- __asm__ volatile("int $215");
-}
-
-static void genInt216(void)
-{
- __asm__ volatile("int $216");
-}
-
-static void genInt217(void)
-{
- __asm__ volatile("int $217");
-}
-
-static void genInt218(void)
-{
- __asm__ volatile("int $218");
-}
-
-static void genInt219(void)
-{
- __asm__ volatile("int $219");
-}
-
-static void genInt220(void)
-{
- __asm__ volatile("int $220");
-}
-
-static void genInt221(void)
-{
- __asm__ volatile("int $221");
-}
-
-static void genInt222(void)
-{
- __asm__ volatile("int $222");
-}
-
-static void genInt223(void)
-{
- __asm__ volatile("int $223");
-}
-
-static void genInt224(void)
-{
- __asm__ volatile("int $224");
-}
-
-static void genInt225(void)
-{
- __asm__ volatile("int $225");
-}
-
-static void genInt226(void)
-{
- __asm__ volatile("int $226");
-}
-
-static void genInt227(void)
-{
- __asm__ volatile("int $227");
-}
-
-static void genInt228(void)
-{
- __asm__ volatile("int $228");
-}
-
-static void genInt229(void)
-{
- __asm__ volatile("int $229");
-}
-
-static void genInt230(void)
-{
- __asm__ volatile("int $230");
-}
-
-static void genInt231(void)
-{
- __asm__ volatile("int $231");
-}
-
-static void genInt232(void)
-{
- __asm__ volatile("int $232");
-}
-
-static void genInt233(void)
-{
- __asm__ volatile("int $233");
-}
-
-static void genInt234(void)
-{
- __asm__ volatile("int $234");
-}
-
-static void genInt235(void)
-{
- __asm__ volatile("int $235");
-}
-
-static void genInt236(void)
-{
- __asm__ volatile("int $236");
-}
-
-static void genInt237(void)
-{
- __asm__ volatile("int $237");
-}
-
-static void genInt238(void)
-{
- __asm__ volatile("int $238");
-}
-
-static void genInt239(void)
-{
- __asm__ volatile("int $239");
-}
-
-static void genInt240(void)
-{
- __asm__ volatile("int $240");
-}
-
-static void genInt241(void)
-{
- __asm__ volatile("int $241");
-}
-
-static void genInt242(void)
-{
- __asm__ volatile("int $242");
-}
-
-static void genInt243(void)
-{
- __asm__ volatile("int $243");
-}
-
-static void genInt244(void)
-{
- __asm__ volatile("int $244");
-}
-
-static void genInt245(void)
-{
- __asm__ volatile("int $245");
-}
-
-static void genInt246(void)
-{
- __asm__ volatile("int $246");
-}
-
-static void genInt247(void)
-{
- __asm__ volatile("int $247");
-}
-
-static void genInt248(void)
-{
- __asm__ volatile("int $248");
-}
-
-static void genInt249(void)
-{
- __asm__ volatile("int $249");
-}
-
-static void genInt250(void)
-{
- __asm__ volatile("int $250");
-}
-
-static void genInt251(void)
-{
- __asm__ volatile("int $251");
-}
-
-static void genInt252(void)
-{
- __asm__ volatile("int $252");
-}
-
-static void genInt253(void)
-{
- __asm__ volatile("int $253");
-}
-
-static void genInt254(void)
-{
- __asm__ volatile("int $254");
-}
-
-static void genInt255(void)
-{
- __asm__ volatile("int $255");
-}
-
-static void (*intFPtr[256])(void) = {
- genInt0, genInt1, genInt2,genInt3,
- genInt4, genInt5, genInt6,genInt7,
- genInt8, genInt9, genInt10,genInt11,
- genInt12, genInt13, genInt14,genInt15,
- genInt16, genInt17, genInt18,genInt19,
- genInt20, genInt21, genInt22,genInt23,
- genInt24, genInt25, genInt26,genInt27,
- genInt28, genInt29, genInt30,genInt31,
- genInt32, genInt33, genInt34,genInt35,
- genInt36, genInt37, genInt38,genInt39,
- genInt40, genInt41, genInt42,genInt43,
- genInt44, genInt45, genInt46,genInt47,
- genInt48, genInt49, genInt50,genInt51,
- genInt52, genInt53, genInt54,genInt55,
- genInt56, genInt57, genInt58,genInt59,
- genInt60, genInt61, genInt62,genInt63,
- genInt64, genInt65, genInt66,genInt67,
- genInt68, genInt69, genInt70,genInt71,
- genInt72, genInt73, genInt74,genInt75,
- genInt76, genInt77, genInt78,genInt79,
- genInt80, genInt81, genInt82,genInt83,
- genInt84, genInt85, genInt86,genInt87,
- genInt88, genInt89, genInt90,genInt91,
- genInt92, genInt93, genInt94,genInt95,
- genInt96, genInt97, genInt98,genInt99,
- genInt100, genInt101, genInt102,genInt103,
- genInt104, genInt105, genInt106,genInt107,
- genInt108, genInt109, genInt110,genInt111,
- genInt112, genInt113, genInt114,genInt115,
- genInt116, genInt117, genInt118,genInt119,
- genInt120, genInt121, genInt122,genInt123,
- genInt124, genInt125, genInt126,genInt127,
- genInt128, genInt129, genInt130,genInt131,
- genInt132, genInt133, genInt134,genInt135,
- genInt136, genInt137, genInt138,genInt139,
- genInt140, genInt141, genInt142,genInt143,
- genInt144, genInt145, genInt146,genInt147,
- genInt148, genInt149, genInt150,genInt151,
- genInt152, genInt153, genInt154,genInt155,
- genInt156, genInt157, genInt158,genInt159,
- genInt160, genInt161, genInt162,genInt163,
- genInt164, genInt165, genInt166,genInt167,
- genInt168, genInt169, genInt170,genInt171,
- genInt172, genInt173, genInt174,genInt175,
- genInt176, genInt177, genInt178,genInt179,
- genInt180, genInt181, genInt182,genInt183,
- genInt184, genInt185, genInt186,genInt187,
- genInt188, genInt189, genInt190,genInt191,
- genInt192, genInt193, genInt194,genInt195,
- genInt196, genInt197, genInt198,genInt199,
- genInt200, genInt201, genInt202,genInt203,
- genInt204, genInt205, genInt206,genInt207,
- genInt208, genInt209, genInt210,genInt211,
- genInt212, genInt213, genInt214,genInt215,
- genInt216, genInt217, genInt218,genInt219,
- genInt220, genInt221, genInt222,genInt223,
- genInt224, genInt225, genInt226,genInt227,
- genInt228, genInt229, genInt230,genInt231,
- genInt232, genInt233, genInt234,genInt235,
- genInt236, genInt237, genInt238,genInt239,
- genInt240, genInt241, genInt242,genInt243,
- genInt244, genInt245, genInt246,genInt247,
- genInt248, genInt249, genInt250,genInt251,
- genInt252, genInt253, genInt254,genInt255};
-
-/**
- *
- * @brief Generate a software interrupt
- *
- * This routine will call one of the genInt functions based upon the
- * value passed to it (which is essentially the interrupt vector number).
- *
- * @return N/A
- */
-void raiseInt(uint8_t id)
-{
- (*intFPtr[id])();
-}
-#endif /* Intel */
-
-#if defined(CONFIG_CPU_CORTEX_M3_M4)
-#include <arch/cpu.h>
-/**
- *
- * @brief Generate a software interrupt
- *
- * Trigger via NVIC. <id> is the IRQ number.
- *
- * @return N/A
- */
-void raiseInt(uint8_t id)
-{
- _NvicSwInterruptTrigger((unsigned int)id);
-}
-#endif
diff --git a/samples/microkernel/test/test_task_irq/src/test_device.c b/samples/microkernel/test/test_task_irq/src/test_device.c
deleted file mode 100644
index 12195ba39..000000000
--- a/samples/microkernel/test/test_task_irq/src/test_device.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* test_device.c - APIs for testing task level interrupts */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module exercises the task level interrupt handling feature.
-
-Each function allocates 2 IRQ objects and then tests for an event
-associated with the IRQ. The taskA() function also attempts to allocate an IRQ
-that has already been allocated by another task.
- */
-
-#include <zephyr.h>
-#include <misc/printk.h>
-
-#include <tc_util.h>
-
-#define DEV1_ID 0
-#define DEV2_ID 1
-#define DEV3_ID 2
-#define DEV4_ID 3
-#define DEV5_ID 4
-
-#if defined(CONFIG_X86)
- #define DEV1_IRQ 8
- #define DEV2_IRQ 14
- #define DEV3_IRQ 32
- #define DEV4_IRQ 34
-#elif defined(CONFIG_CPU_CORTEX_M3_M4)
- #define DEV1_IRQ 0
- #define DEV2_IRQ 1
- #define DEV3_IRQ 2
- #define DEV4_IRQ 3
-#else
- #error "Unknown target"
-#endif
-
-#define NUM_OBJECTS 4
-uint32_t irq_vectors[NUM_OBJECTS] = {[0 ... (NUM_OBJECTS - 1)] = INVALID_VECTOR};
-
-/**
- *
- * @brief First of 2 tasks to allocate IRQ objects and check for events
- *
- * This task allocates 2 IRQ objects with unique IRQs and then tests for an
- * interrupt associated with those IRQs. The function then attempts to allocate
- * a device that has already been allocate from taskB.
- *
- * @return TC_PASS, TC_FAIL
- */
-
-int taskA(ksem_t semRdy)
-{
- irq_vectors[DEV1_ID] = task_irq_alloc(DEV1_ID, DEV1_IRQ, 1, 0);
- if (irq_vectors[DEV1_ID] == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
- TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV1_ID, DEV1_IRQ);
-
- irq_vectors[DEV2_ID] = task_irq_alloc(DEV2_ID, DEV2_IRQ, 2, 0);
- if (irq_vectors[DEV2_ID] == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
- TC_PRINT("IRQ object %d using IRQ%d allocated\n\n", DEV2_ID, DEV2_IRQ);
-
- /* Send semaphore to let loader know IRQ objects have been allocated */
-
- task_sem_give(semRdy);
-
- if (task_irq_wait(DEV1_ID, TICKS_UNLIMITED) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
- TC_PRINT("Received event for IRQ object %d\n", DEV1_ID);
- task_irq_ack(DEV1_ID);
-
- if (task_irq_wait(DEV2_ID, TICKS_UNLIMITED) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
- TC_PRINT("Received event for IRQ object %d\n", DEV2_ID);
- task_irq_ack(DEV2_ID);
-
- /* Wait for other task to receive its events */
-
- (void)task_sem_take(semRdy, TICKS_UNLIMITED);
-
- TC_PRINT("\nAttempt to allocate an IRQ object that\n");
- TC_PRINT("is already allocated by another task...\n");
- if (task_irq_alloc(DEV4_ID, DEV4_IRQ, 1, 0) != INVALID_VECTOR) {
- TC_ERROR("Error: Was able to allocate\n\n");
- return TC_FAIL;
- }
- TC_PRINT("Re-allocation of IRQ object %d prevented\n", DEV4_ID);
-
- TC_PRINT("\nAttempt to allocate an IRQ that\n"
- "is already allocated by another task...\n");
- if (task_irq_alloc(DEV5_ID, DEV4_IRQ, 1, 0) != INVALID_VECTOR) {
- TC_ERROR("Error: Was able to allocate\n\n");
- return TC_FAIL;
- }
- TC_PRINT("Re-allocation of IRQ%d prevented\n\n", DEV4_IRQ);
-
- /* Signal other task that we are done processing */
-
- task_sem_give(semRdy);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Second of 2 tasks to allocate IRQ objects and check for events
- *
- * This task allocates 2 IRQ objects with unique IRQs and then tests for an
- * interrupt associated with those IRQs. The function then frees an IRQ object
- * using task_irq_free().
- *
- * @return TC_PASS, TC_FAIL
- */
-
-int taskB(ksem_t semRdy)
-{
- irq_vectors[DEV3_ID] = task_irq_alloc(DEV3_ID, DEV3_IRQ, 1, 0);
- if (irq_vectors[DEV3_ID] == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
- TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV3_ID, DEV3_IRQ);
-
- irq_vectors[DEV4_ID] = task_irq_alloc(DEV4_ID, DEV4_IRQ, 1, 0);
- if (irq_vectors[DEV4_ID] == INVALID_VECTOR) {
- TC_ERROR("Not able to allocate IRQ object\n");
- return TC_FAIL;
- }
- TC_PRINT("IRQ object %d using IRQ%d allocated\n\n", DEV4_ID, DEV4_IRQ);
-
- /* Send semaphore to let loader/main know objects have been allocated */
-
- task_sem_give(semRdy);
-
- if (task_irq_wait(DEV3_ID, TICKS_UNLIMITED) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
- TC_PRINT("Received event for IRQ object %d\n", DEV3_ID);
- task_irq_ack(DEV3_ID);
-
- if (task_irq_wait(DEV4_ID, TICKS_UNLIMITED) != RC_OK) {
- TC_ERROR("Not able to test IRQ object event\n");
- return TC_FAIL;
- }
- TC_PRINT("Received event for IRQ object %d\n", DEV4_ID);
- task_irq_ack(DEV4_ID);
-
- /* Signal other task that we are done receiving events */
-
- task_sem_give(semRdy);
-
- /*
- * Wait for other task to finish processing. The signal just previously
- * sent will not be seen here as the other task is a higher priority and
- * will thus consume the signal first.
- */
-
- (void)task_sem_take(semRdy, TICKS_UNLIMITED);
- return TC_PASS;
-}
diff --git a/samples/microkernel/test/test_task_irq/testcase.ini b/samples/microkernel/test/test_task_irq/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_task_irq/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_task_priv/Makefile b/samples/microkernel/test/test_task_priv/Makefile
deleted file mode 100644
index de91df7c6..000000000
--- a/samples/microkernel/test/test_task_priv/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR := $(ZEPHYR_BASE)/samples/microkernel/test/test_task/src
-
-# Enable testing for private microkernel task objects
-CFLAGS = -DTEST_PRIV_TASKS
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_task_priv/README.txt b/samples/microkernel/test/test_task_priv/README.txt
deleted file mode 100644
index 01a0aa705..000000000
--- a/samples/microkernel/test/test_task_priv/README.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-Title: Private Tasks
-
-Description:
-
-This test verifies that the microkernel task APIs operate as expected. This
-also verifies the mechanism to define private task objects and their usage.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Microkernel Task API
-===================================================================
-Microkernel objects initialized
-Testing isr_task_id_get() and isr_task_priority_get()
-Testing task_id_get() and task_priority_get()
-Testing task_priority_set()
-Testing task_sleep()
-Testing task_yield()
-Testing task_suspend() and task_resume()
-===================================================================
-PASS - RegressionTask.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_task_priv/prj.mdef b/samples/microkernel/test/test_task_priv/prj.mdef
deleted file mode 100644
index 0e504f513..000000000
--- a/samples/microkernel/test/test_task_priv/prj.mdef
+++ /dev/null
@@ -1,17 +0,0 @@
-% Application : test microkernel task APIs
-
-% Please keep this in-sync with ../test_task/prj.mdef
-% except those specified below
-
-% TASK HT_TASKID and RT_TASKID are defined within
-% the source file, so keep them commented out.
-%
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ==================================================
-% TASK HT_TASKID 20 HelperTask 2048 [EXE]
-% TASK RT_TASKID 10 RegressionTask 2048 [EXE]
-
-% SEMA NAME
-% ===========
- SEMA HT_SEM
- SEMA RT_SEM
diff --git a/samples/microkernel/test/test_task_priv/prj_arm.conf b/samples/microkernel/test/test_task_priv/prj_arm.conf
deleted file mode 100644
index e7bed8388..000000000
--- a/samples/microkernel/test/test_task_priv/prj_arm.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=32
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_task_priv/prj_x86.conf b/samples/microkernel/test/test_task_priv/prj_x86.conf
deleted file mode 100644
index 4f877d1a0..000000000
--- a/samples/microkernel/test/test_task_priv/prj_x86.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG_NUM_TASK_PRIORITIES=32
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/microkernel/test/test_task_priv/testcase.ini b/samples/microkernel/test/test_task_priv/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_task_priv/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_tickless/Makefile b/samples/microkernel/test/test_tickless/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_tickless/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_tickless/README.txt b/samples/microkernel/test/test_tickless/README.txt
deleted file mode 100644
index 7de293af2..000000000
--- a/samples/microkernel/test/test_tickless/README.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-Title: Tickless Idle Support
-
-Description:
-
-This test verifies the timing accuracy of the tickless idle feature.
-
-The test first calibrates itself by repeatedly sleeping for 10 ticks with the
-tickless idle feature disabled. It then repeats this process with the tickless
-idle feature enabled. Lastly, it compares the average measured duration of
-each approach and displays the result. The tick timing is correct if the
-'diff ticks' with tickless enabled matches the SLEEP_TICKS (10) setting in
-the source.
-
-The demonstration utilizes microkernel mutex APIs, timers and tickless
-idle mode.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Tickless Idle Test
-Calibrating TSC...
-Calibrated time stamp period = 0x00000000163adc3a
-Do the real test with tickless enabled
-Going idle for 10 ticks...
-start ticks : 343
-end ticks : 353
-diff ticks : 10
-diff time stamp: 0x0000000018a69898
-Cal time stamp: 0x00000000163adc3a
-variance in time stamp diff: 10 percent
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_tickless/prj.mdef b/samples/microkernel/test/test_tickless/prj.mdef
deleted file mode 100644
index 84a3ad84c..000000000
--- a/samples/microkernel/test/test_tickless/prj.mdef
+++ /dev/null
@@ -1,5 +0,0 @@
-% Application : TicklessTest
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% ==================================================
- TASK timerApp 6 ticklessTestTask 4096 [EXE]
diff --git a/samples/microkernel/test/test_tickless/prj_arm.conf b/samples/microkernel/test/test_tickless/prj_arm.conf
deleted file mode 100644
index 1b6dca9aa..000000000
--- a/samples/microkernel/test/test_tickless/prj_arm.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_ADVANCED_POWER_MANAGEMENT=y
-CONFIG_TICKLESS_IDLE=y
-CONFIG_SW_ISR_TABLE_DYNAMIC=n
diff --git a/samples/microkernel/test/test_tickless/prj_x86.conf b/samples/microkernel/test/test_tickless/prj_x86.conf
deleted file mode 100644
index e132e3505..000000000
--- a/samples/microkernel/test/test_tickless/prj_x86.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG_ADVANCED_POWER_MANAGEMENT=y
-CONFIG_TICKLESS_IDLE=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/microkernel/test/test_tickless/src/Makefile b/samples/microkernel/test/test_tickless/src/Makefile
deleted file mode 100644
index c15d42a3c..000000000
--- a/samples/microkernel/test/test_tickless/src/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = test_tickless.o
-ifeq ($(ARCH),arm)
-obj-y += timestamps.o
-endif
diff --git a/samples/microkernel/test/test_tickless/src/test_tickless.c b/samples/microkernel/test/test_tickless/src/test_tickless.c
deleted file mode 100644
index 315b775d9..000000000
--- a/samples/microkernel/test/test_tickless/src/test_tickless.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* test_tickless.c - tickless idle tests */
-
-/*
- * Copyright (c) 2011, 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-Unit test for tickless idle feature.
- */
-
-#include <zephyr.h>
-
-#include <misc/printk.h>
-#include <arch/cpu.h>
-#include <tc_util.h>
-
-#define SLEEP_TICKS 10
-
-#ifdef CONFIG_TICKLESS_IDLE
-extern int32_t _sys_idle_threshold_ticks;
-#endif
-
-/* NOTE: Clock speed may change between platforms */
-
-#define CAL_REPS 16 /* # of loops in timestamp calibration */
-
-/*
- * Arch-specific timer resolution/size types, definitions and
- * timestamp routines.
- */
-
-#if defined(CONFIG_X86)
-typedef uint64_t _timer_res_t;
-#define _TIMER_ZERO 0ULL
-
-/* timestamp routines */
-#define _TIMESTAMP_OPEN()
-#define _TIMESTAMP_READ() (_NanoTscRead())
-#define _TIMESTAMP_CLOSE()
-
-#elif defined(CONFIG_ARM)
-
-# if defined(CONFIG_SOC_TI_LM3S6965_QEMU)
-/* A bug in the QEMU ARMv7-M sysTick timer prevents tickless idle support */
-#error "This QEMU target does not support tickless idle!"
-# endif
-
-typedef uint32_t _timer_res_t;
-#define _TIMER_ZERO 0
-
-/* timestamp routines, from timestamps.c */
-extern void _TimestampOpen(void);
-extern uint32_t _TimestampRead(void);
-extern void _TimestampClose(void);
-
-#define _TIMESTAMP_OPEN() (_TimestampOpen())
-#define _TIMESTAMP_READ() (_TimestampRead())
-#define _TIMESTAMP_CLOSE() (_TimestampClose())
-
-#else
-#error "Unknown target"
-#endif
-
-void ticklessTestTask(void)
-{
- int32_t start_ticks;
- int32_t end_ticks;
- int32_t diff_ticks;
- _timer_res_t start_tsc;
- _timer_res_t end_tsc;
- _timer_res_t cal_tsc = _TIMER_ZERO;
- _timer_res_t diff_tsc = _TIMER_ZERO;
- _timer_res_t diff_per;
-
-#ifdef CONFIG_TICKLESS_IDLE
- int32_t oldThreshold;
-#endif
- int i;
-
- printk("Tickless Idle Test\n");
-#ifndef CONFIG_TICKLESS_IDLE
- printk("WARNING! Tickless idle support has not been enabled!\n");
-#endif
-
- printk("Calibrating TSC...\n");
-#ifdef CONFIG_TICKLESS_IDLE
- oldThreshold = _sys_idle_threshold_ticks;
- /* make sure we do not enter tickless idle mode */
- _sys_idle_threshold_ticks = 0x7FFFFFFF;
-#endif
-
- /* initialize the timer, if necessary */
- _TIMESTAMP_OPEN();
-
- for (i = 0; i < CAL_REPS; i++) {
- /*
- * Do a single tick sleep to get us as close to a tick boundary
- * as we can.
- */
- task_sleep(1);
- start_ticks = sys_tick_get_32();
- start_tsc = _TIMESTAMP_READ();
- task_sleep(SLEEP_TICKS);
- end_tsc = _TIMESTAMP_READ();
- end_ticks = sys_tick_get_32();
- cal_tsc += end_tsc - start_tsc;
- }
- cal_tsc /= CAL_REPS;
-
-#if defined(CONFIG_X86)
- printk("Calibrated time stamp period = 0x%x%x\n",
- (uint32_t)(cal_tsc >> 32), (uint32_t)(cal_tsc & 0xFFFFFFFFLL));
-#elif defined(CONFIG_ARM)
- printk("Calibrated time stamp period = 0x%x\n", cal_tsc);
-#endif
-
- printk("Do the real test with tickless enabled\n");
-
-#ifdef CONFIG_TICKLESS_IDLE
- _sys_idle_threshold_ticks = oldThreshold;
-#endif
-
- printk("Going idle for %d ticks...\n", SLEEP_TICKS);
-
- for (i = 0; i < CAL_REPS; i++) {
- /*
- * Do a single tick sleep to get us as close to a tick boundary
- * as we can.
- */
- task_sleep(1);
- start_ticks = sys_tick_get_32();
- start_tsc = _TIMESTAMP_READ();
- task_sleep(SLEEP_TICKS);
- end_tsc = _TIMESTAMP_READ();
- end_ticks = sys_tick_get_32();
- diff_tsc += end_tsc - start_tsc;
- }
-
- diff_tsc /= CAL_REPS;
-
- diff_ticks = end_ticks - start_ticks;
-
- printk("start ticks : %d\n", start_ticks);
- printk("end ticks : %d\n", end_ticks);
- printk("diff ticks : %d\n", diff_ticks);
-
-#if defined(CONFIG_X86)
- printk("diff time stamp: 0x%x%x\n",
- (uint32_t)(diff_tsc >> 32), (uint32_t)(diff_tsc & 0xFFFFFFFFULL));
- printk("Cal time stamp: 0x%x%x\n",
- (uint32_t)(cal_tsc >> 32), (uint32_t)(cal_tsc & 0xFFFFFFFFLL));
-#elif defined(CONFIG_ARM)
- printk("diff time stamp: 0x%x\n", diff_tsc);
- printk("Cal time stamp: 0x%x\n", cal_tsc);
-#endif
-
- /* Calculate percentage difference between calibrated TSC diff and measured result */
- if (diff_tsc > cal_tsc) {
- diff_per = (100 * (diff_tsc - cal_tsc)) / cal_tsc;
- } else {
- diff_per = (100 * (cal_tsc - diff_tsc)) / cal_tsc;
- }
-
- printk("variance in time stamp diff: %d percent\n", (int32_t)diff_per);
-
- if (diff_ticks != SLEEP_TICKS) {
- printk("* TEST FAILED. TICK COUNT INCORRECT *\n");
- TC_END_REPORT(TC_FAIL);
- } else {
- TC_END_REPORT(TC_PASS);
- }
-
- /* release the timer, if necessary */
- _TIMESTAMP_CLOSE();
-
- while (1);
-
-}
diff --git a/samples/microkernel/test/test_tickless/src/timestamps.c b/samples/microkernel/test/test_tickless/src/timestamps.c
deleted file mode 100644
index 7d3ccf1f3..000000000
--- a/samples/microkernel/test/test_tickless/src/timestamps.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* timestamps.c - timestamp support for tickless idle testing */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-Platform-specific timestamp support for the tickless idle test.
- */
-
-#include <tc_util.h>
-#include <stddef.h>
-
-#if defined(CONFIG_SOC_TI_LM3S6965_QEMU)
-/*
- * @brief Use a General Purpose Timer in
- * 32-bit periodic timer mode (down-counter)
- * (RTC mode's resolution of 1 second is insufficient.)
- */
-
-#define _TIMESTAMP_NUM 0 /* set to timer # for use by timestamp (0-3) */
-
-#define _CLKGATECTRL *((volatile uint32_t *)0x400FE104)
-#define _CLKGATECTRL_TIMESTAMP_EN (1 << (16 + _TIMESTAMP_NUM))
-
-#define _TIMESTAMP_BASE 0x40030000
-#define _TIMESTAMP_OFFSET (0x1000 * _TIMESTAMP_NUM)
-#define _TIMESTAMP_ADDR (_TIMESTAMP_BASE + _TIMESTAMP_OFFSET)
-
-#define _TIMESTAMP_CFG *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0))
-#define _TIMESTAMP_CTRL *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0xC))
-#define _TIMESTAMP_MODE *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x4))
-#define _TIMESTAMP_LOAD *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x28))
-#define _TIMESTAMP_IMASK *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x18))
-#define _TIMESTAMP_ISTATUS *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x1C))
-#define _TIMESTAMP_ICLEAR *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x24))
-#define _TIMESTAMP_VAL *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x48))
-
-/*
- * Set the rollover value such that it leaves the most significant bit of
- * the returned timestamp value unused. This allows room for extended values
- * when handling rollovers when converting to an up-counter value.
- */
-#define _TIMESTAMP_MAX ((uint32_t)0x7FFFFFFF)
-#define _TIMESTAMP_EXT ((uint32_t)0x80000000)
-
-/**
- *
- * @brief Timestamp initialization
- *
- * This routine initializes the timestamp timer.
- *
- * @return N/A
- */
-void _TimestampOpen(void)
-{
- /* QEMU does not currently support the 32-bit timer modes of the GPTM */
- printk("WARNING! Timestamp is not supported for this target!\n");
-
- /* enable timer access */
- _CLKGATECTRL |= _CLKGATECTRL_TIMESTAMP_EN;
-
- /* minimum 3 clk delay is required before timer register access */
- task_sleep(3);
-
- _TIMESTAMP_CTRL = 0x0; /* disable/reset timer */
- _TIMESTAMP_CFG = 0x0; /* 32-bit timer */
- _TIMESTAMP_MODE = 0x2; /* periodic mode */
- _TIMESTAMP_LOAD = _TIMESTAMP_MAX; /* maximum interval to reduce rollovers */
- _TIMESTAMP_IMASK = 0x70F; /* mask all timer interrupts */
- _TIMESTAMP_ICLEAR = 0x70F; /* clear all interrupt status */
-
- _TIMESTAMP_CTRL = 0x1; /* enable timer */
-}
-
-/**
- *
- * @brief Timestamp timer read
- *
- * This routine returns the timestamp value.
- *
- * @return timestamp value
- */
-uint32_t _TimestampRead(void)
-{
- static uint32_t lastTimerVal = 0;
- static uint32_t cnt = 0;
- uint32_t timerVal = _TIMESTAMP_VAL;
-
- /* handle rollover for every other read (end of sleep) */
-
- if ((cnt % 2) && (timerVal > lastTimerVal)) {
- lastTimerVal = timerVal;
-
- /* convert to extended up-counter value */
- timerVal = _TIMESTAMP_EXT + (_TIMESTAMP_MAX - timerVal);
- } else {
- lastTimerVal = timerVal;
-
- /* convert to up-counter value */
- timerVal = _TIMESTAMP_MAX - timerVal;
- }
-
- cnt++;
-
- return timerVal;
-}
-
-/**
- *
- * @brief Timestamp release
- *
- * This routine releases the timestamp timer.
- *
- * @return N/A
- */
-void _TimestampClose(void)
-{
-
- /* disable/reset timer */
- _TIMESTAMP_CTRL = 0x0;
- _TIMESTAMP_CFG = 0x0;
-
- /* disable timer access */
- _CLKGATECTRL &= ~_CLKGATECTRL_TIMESTAMP_EN;
-}
-
-#elif defined(CONFIG_SOC_FSL_FRDM_K64F)
-/* Freescale FRDM-K64F target - use RTC (prescale value) */
-
-#define _COUNTDOWN_TIMER false
-
-#define _CLKGATECTRL *((volatile uint32_t *)0x4004803C)
-#define _CLKGATECTRL_TIMESTAMP_EN (1 << 29)
-
-#define _SYSOPTCTRL2 *((volatile uint32_t *)0x40048004)
-#define _SYSOPTCTRL2_32KHZRTCCLK (1 << 4)
-
-#define _TIMESTAMP_ADDR (0x4003D000)
-
-#define _TIMESTAMP_ICLEAR *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x24))
-
-#define _TIMESTAMP_VAL *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0))
-#define _TIMESTAMP_PRESCALE *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x4))
-#define _TIMESTAMP_COMP *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0xC))
-#define _TIMESTAMP_CTRL *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x10))
-#define _TIMESTAMP_STATUS *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x14))
-#define _TIMESTAMP_LOCK *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x18))
-#define _TIMESTAMP_IMASK *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x1C))
-#define _TIMESTAMP_RACCESS *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x800))
-#define _TIMESTAMP_WACCESS *((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x804))
-
-/**
- *
- * @brief Timestamp initialization
- *
- * This routine initializes the timestamp timer.
- *
- * @return N/A
- */
-void _TimestampOpen(void)
-{
- /* enable timer access */
- _CLKGATECTRL |= _CLKGATECTRL_TIMESTAMP_EN;
-
- /* set 32 KHz RTC clk */
- _SYSOPTCTRL2 |= _SYSOPTCTRL2_32KHZRTCCLK;
-
- _TIMESTAMP_STATUS = 0x0; /* disable counter */
- _TIMESTAMP_CTRL = 0x100; /* enable oscillator */
-
- _TIMESTAMP_LOCK = 0xFF; /* unlock registers */
- _TIMESTAMP_PRESCALE = 0x0; /* reset prescale value */
- _TIMESTAMP_COMP = 0x0; /* reset compensation values */
- _TIMESTAMP_RACCESS = 0xFF; /* allow register read access */
- _TIMESTAMP_WACCESS = 0xFF; /* allow register write access */
- _TIMESTAMP_IMASK = 0x0; /* mask all timer interrupts */
-
- /* minimum 0.3 sec delay required for oscillator stabilization */
- task_sleep(300000/sys_clock_us_per_tick);
-
- _TIMESTAMP_VAL = 0x0; /* clear invalid time flag in status register */
-
- _TIMESTAMP_STATUS = 0x10; /* enable counter */
-}
-
-/**
- *
- * @brief Timestamp timer read
- *
- * This routine returns the timestamp value.
- *
- * @return timestamp value
- */
-uint32_t _TimestampRead(void)
-{
- static uint32_t lastPrescale = 0;
- static uint32_t cnt = 0;
- uint32_t prescale1 = _TIMESTAMP_PRESCALE;
- uint32_t prescale2 = _TIMESTAMP_PRESCALE;
-
- /* ensure a valid reading */
-
- while (prescale1 != prescale2) {
- prescale1 = _TIMESTAMP_PRESCALE;
- prescale2 = _TIMESTAMP_PRESCALE;
- }
-
- /* handle prescale rollover @ 0x8000 for every other read (end of sleep) */
-
- if ((cnt % 2) && (prescale1 < lastPrescale)) {
- prescale1 += 0x8000;
- }
-
- lastPrescale = prescale2;
- cnt++;
-
- return prescale1;
-}
-
-/**
- *
- * @brief Timestamp release
- *
- * This routine releases the timestamp timer.
- *
- * @return N/A
- */
-void _TimestampClose(void)
-{
- _TIMESTAMP_STATUS = 0x0; /* disable counter */
- _TIMESTAMP_CTRL = 0x0; /* disable oscillator */
-}
-
-#elif defined(CONFIG_SOC_ATMEL_SAM3)
-/* Atmel SAM3 family processor - use RTT (Real-time Timer) */
-
-#include <soc.h>
-
-#define _TIMESTAMP_ADDR (0x400E1A30)
-
-#define _TIMESTAMP_MODE (*((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x00)))
-#define _TIMESTAMP_VAL (*((volatile uint32_t *)(_TIMESTAMP_ADDR + 0x08)))
-
-/**
- *
- * @brief Timestamp initialization
- *
- * This routine initializes the timestamp timer.
- *
- * @return N/A
- */
-void _TimestampOpen(void)
-{
- /* enable RTT clock from PMC */
- __PMC->pcer0 = (1 << PID_RTT);
-
- /* Reset RTT and set prescaler to 1 */
- _TIMESTAMP_MODE = (1 << 18) | (1 << 0);
-}
-
-/**
- *
- * @brief Timestamp timer read
- *
- * This routine returns the timestamp value.
- *
- * @return timestamp value
- */
-uint32_t _TimestampRead(void)
-{
- static uint32_t last_val;
- uint32_t tmr_val = _TIMESTAMP_VAL;
- uint32_t ticks;
-
- /* handle rollover */
- if (tmr_val < last_val) {
- ticks = ((0xFFFFFFFF - last_val)) + 1 + tmr_val;
- } else {
- ticks = tmr_val - last_val;
- }
-
- last_val = tmr_val;
-
- return ticks;
-}
-
-/**
- *
- * @brief Timestamp release
- *
- * This routine releases the timestamp timer.
- *
- * @return N/A
- */
-void _TimestampClose(void)
-{
- /* disable RTT clock from PMC */
- __PMC->pcdr0 = (1 << PID_RTT);
-}
-
-#else
-#error "Unknown platform"
-#endif /* CONFIG_SOC_xxx */
diff --git a/samples/microkernel/test/test_tickless/testcase.ini b/samples/microkernel/test/test_tickless/testcase.ini
deleted file mode 100644
index d0c6a3351..000000000
--- a/samples/microkernel/test/test_tickless/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-config_whitelist = !CONFIG_SOC_TI_LM3S6965_QEMU
diff --git a/samples/microkernel/test/test_timer/Makefile b/samples/microkernel/test/test_timer/Makefile
deleted file mode 100644
index 01ab057b1..000000000
--- a/samples/microkernel/test/test_timer/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_timer/README.txt b/samples/microkernel/test/test_timer/README.txt
deleted file mode 100644
index 5feb59003..000000000
--- a/samples/microkernel/test/test_timer/README.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-Title: Low Resolution Timer
-
-Description:
-
-This test verifies the following low resolution microkernel timer APIs operate
-as expected:
- task_timer_alloc (), task_timer_free()
- task_timer_start(), task_timer_restart(), task_timer_stop()
- sys_tick_delta(), sys_tick_get_32()
-
-Also verifies the nanokernel timeouts can work alongside the microkernel timers.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting timer tests
-===================================================================
-Test the allocation of timers.
-Test the one shot feature of a timer.
-test nano_task_fifo_get with timeout > 0
-nano_task_fifo_get timed out as expected
-nano_task_fifo_get got fifo in time, as expected
-testing timeouts of 5 fibers on same fifo
- got fiber (q order: 2, t/o: 10, fifo 00109134) as expected
- got fiber (q order: 3, t/o: 15, fifo 00109134) as expected
- got fiber (q order: 0, t/o: 20, fifo 00109134) as expected
- got fiber (q order: 4, t/o: 25, fifo 00109134) as expected
- got fiber (q order: 1, t/o: 30, fifo 00109134) as expected
-testing timeouts of 9 fibers on different fifos
- got fiber (q order: 0, t/o: 10, fifo 00109140) as expected
- got fiber (q order: 5, t/o: 15, fifo 00109134) as expected
- got fiber (q order: 7, t/o: 20, fifo 00109134) as expected
- got fiber (q order: 1, t/o: 25, fifo 00109134) as expected
- got fiber (q order: 8, t/o: 30, fifo 00109140) as expected
- got fiber (q order: 2, t/o: 35, fifo 00109134) as expected
- got fiber (q order: 6, t/o: 40, fifo 00109134) as expected
- got fiber (q order: 4, t/o: 45, fifo 00109140) as expected
- got fiber (q order: 3, t/o: 50, fifo 00109140) as expected
-testing 5 fibers timing out, but obtaining the data in time
-(except the last one, which times out)
- got fiber (q order: 0, t/o: 20, fifo 00109134) as expected
- got fiber (q order: 1, t/o: 30, fifo 00109134) as expected
- got fiber (q order: 2, t/o: 10, fifo 00109134) as expected
- got fiber (q order: 3, t/o: 15, fifo 00109134) as expected
- got fiber (q order: 4, t/o: 25, fifo 00109134) as expected
-===================================================================
-PASS - test_fifo_timeout.
-Test that a timer does not start.
-Test the periodic feature of a timer
-Test the stopping of a timer
-Verifying the nanokernel timeouts worked
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_timer/prj.mdef b/samples/microkernel/test/test_timer/prj.mdef
deleted file mode 100644
index 6de710408..000000000
--- a/samples/microkernel/test/test_timer/prj.mdef
+++ /dev/null
@@ -1,11 +0,0 @@
-% Application : test microkernel timer APIs
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =================================================================
- TASK tStartTask 5 RegressionTaskEntry 2048 [EXE]
- TASK tNanoTimeoutTest 6 test_nano_timeouts 2048 [EXE]
-
-% SEMA NAME
-% ==============
- SEMA TIMER_SEM
- SEMA test_nano_timeouts_sem
diff --git a/samples/microkernel/test/test_timer/prj_arm.conf b/samples/microkernel/test/test_timer/prj_arm.conf
deleted file mode 100644
index ad373ef10..000000000
--- a/samples/microkernel/test/test_timer/prj_arm.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_NUM_IRQS=2
-CONFIG_NUM_TIMER_PACKETS=4
-CONFIG_NANO_TIMEOUTS=y
-CONFIG_NANO_TIMERS=y
-CONFIG_ASSERT=y
-CONFIG_ASSERT_LEVEL=2
diff --git a/samples/microkernel/test/test_timer/prj_x86.conf b/samples/microkernel/test/test_timer/prj_x86.conf
deleted file mode 100644
index a70e8d403..000000000
--- a/samples/microkernel/test/test_timer/prj_x86.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_NUM_TIMER_PACKETS=4
-CONFIG_NANO_TIMEOUTS=y
-CONFIG_NANO_TIMERS=y
-CONFIG_ASSERT=y
-CONFIG_ASSERT_LEVEL=2
diff --git a/samples/microkernel/test/test_timer/src/Makefile b/samples/microkernel/test/test_timer/src/Makefile
deleted file mode 100644
index de98797b6..000000000
--- a/samples/microkernel/test/test_timer/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include \
- -I$(srctree)/samples/nanokernel/test/test_fifo/src/
-
-obj-y = timer.o
diff --git a/samples/microkernel/test/test_timer/src/timer.c b/samples/microkernel/test/test_timer/src/timer.c
deleted file mode 100644
index 6430f2156..000000000
--- a/samples/microkernel/test/test_timer/src/timer.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* timer.c - test microkernel timer APIs */
-
-/*
- * Copyright (c) 2013-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module tests the following microkernel timer routines:
-
- task_timer_alloc(), task_timer_free()
- task_timer_start(), task_timer_restart(), task_timer_stop()
- sys_tick_delta(), sys_tick_get_32()
- */
-
-#include <tc_util.h>
-#include <util_test_common.h>
-#include <zephyr.h>
-
-#include "fifo_timeout.c"
-
-extern struct nano_lifo _k_timer_free; /* For white box testing only */
-
-#define NTIMERS CONFIG_NUM_TIMER_PACKETS
-
-#define WITHIN_ERROR(var, target, epsilon) \
- (((var) >= (target)) && ((var) <= (target) + (epsilon)))
-
-static ktimer_t pTimer[NTIMERS + 1];
-
-/**
- *
- * @brief Test that task_timer_stop() does stop a timer
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int testLowTimerStop(void)
-{
- int status;
-
- pTimer[0] = task_timer_alloc();
-
- task_timer_start(pTimer[0], 10, 5, TIMER_SEM);
-
- task_timer_stop(pTimer[0]);
-
- status = task_sem_take(TIMER_SEM, 20);
- if (status != RC_TIME) {
- TC_ERROR("** task_sem_take() returned %d, not %d\n", status, RC_TIME);
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
-
- task_timer_free(pTimer[0]);
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the periodic feature of a timer
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int testLowTimerPeriodicity(void)
-{
- int64_t ticks;
- int32_t ticks_32;
- int64_t refTime;
- int i;
- int status;
-
- pTimer[0] = task_timer_alloc();
-
- /* Align to a tick */
- ticks_32 = sys_tick_get_32();
- while (sys_tick_get_32() == ticks_32) {
- }
-
- (void) sys_tick_delta(&refTime);
- task_timer_start(pTimer[0], 100, 50, TIMER_SEM);
-
- for (i = 0; i < 5; i++) {
- status = task_sem_take(TIMER_SEM, 200);
- ticks = sys_tick_delta(&refTime);
-
- if (status != RC_OK) {
- TC_ERROR("** Timer appears to not have fired\n");
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
-
- if (((i == 0) && !WITHIN_ERROR(ticks, 100, 1)) ||
- ((i != 0) && !WITHIN_ERROR(ticks, 50, 1))) {
- TC_ERROR("** Timer fired after %d ticks, not %d\n",
- ticks, (i == 0) ? 100 : 50);
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
- }
-
-
- ticks_32 = sys_tick_get_32();
- while (sys_tick_get_32() == ticks_32) { /* Align to a tick */
- }
- (void) sys_tick_delta_32(&refTime);
-
- /* Use task_timer_restart() to change the periodicity */
- task_timer_restart(pTimer[0], 60, 60);
- for (i = 0; i < 6; i++) {
- status = task_sem_take(TIMER_SEM, 100);
- ticks_32 = sys_tick_delta_32(&refTime);
-
- if (status != RC_OK) {
- TC_ERROR("** Timer appears to not have fired\n");
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
-
- if (!WITHIN_ERROR(ticks_32, 60, 1)) {
- TC_ERROR("** Timer fired after %d ticks, not %d\n", ticks, 60);
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
- }
-
- /* task_timer_free() will both stop and free the timer */
- task_timer_free(pTimer[0]);
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test that the timer does not start
- *
- * This test checks that the timer does not start under a variety of
- * circumstances.
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int testLowTimerDoesNotStart(void)
-{
- int32_t ticks;
- int status;
- int Ti[3] = {-1, 1, 0};
- int Tr[3] = {1, -1, 0};
- int i;
-
- pTimer[0] = task_timer_alloc();
-
- for (i = 0; i < 3; i++) {
- /* Align to a tick */
- ticks = sys_tick_get_32();
- while (sys_tick_get_32() == ticks) {
- }
-
- task_timer_start(pTimer[0], Ti[i], Tr[i], TIMER_SEM);
- status = task_sem_take(TIMER_SEM, 200);
- if (status != RC_TIME) {
- TC_ERROR("** Timer appears to have fired unexpectedly\n");
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
-
- }
-
- task_timer_free(pTimer[0]);
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the one shot feature of a timer
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int testLowTimerOneShot(void)
-{
- int32_t ticks;
- int64_t refTime;
- int status;
-
- pTimer[0] = task_timer_alloc();
-
- /* Align to a tick */
- ticks = sys_tick_get_32();
- while (sys_tick_get_32() == ticks) {
- }
-
- /* Timer to fire once only in 100 ticks */
- (void) sys_tick_delta(&refTime);
- task_timer_start(pTimer[0], 100, 0, TIMER_SEM);
- status = task_sem_take(TIMER_SEM, TICKS_UNLIMITED);
- ticks = sys_tick_delta(&refTime);
- if (!WITHIN_ERROR(ticks, 100, 1)) {
- TC_ERROR("** Expected %d ticks to elapse, got %d\n", 100, ticks);
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
- if (status != RC_OK) {
- TC_ERROR("** task_sem_take() unexpectedly failed\n");
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
-
- /*
- * Wait up to 200 more ticks for another timer signalling
- * that should not occur.
- */
- status = task_sem_take(TIMER_SEM, 200);
- if (status != RC_TIME) {
- TC_ERROR("** task_sem_take() expected timeout, got %d\n", status);
- return TC_FAIL; /* Return failure, do not "clean up" */
- }
-
- task_timer_free(pTimer[0]);
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the task_timer_alloc() API
- *
- * This routine allocates all the timers in the system using task_timer_alloc().
- * It verifies that all the allocated timers have unique IDs before freeing
- * them using task_timer_free().
- *
- * This routine also does some partial testing of task_timer_free(). That is,
- * it checks that timers that have been freed are available to be allocated
- * again at a later time.
- *
- * @return TC_PASS on success, TC_FAIL otherwise
- */
-
-int testLowTimerGet(void)
-{
- int i;
- int j;
- int k;
-
- for (j = 0; j < 2; j++) {
- for (i = 0; i < NTIMERS; i++) {
- pTimer[i] = task_timer_alloc();
-
- for (k = 0; k < i; k++) {
- if (pTimer[i] == pTimer[k]) {
- TC_ERROR("** task_timer_alloc() did not return a unique "
- "timer ID.\n");
- return TC_FAIL;
- }
- }
- }
-
- /* Whitebox test to ensure that all timers were allocated. */
-
- if (_k_timer_free.list != NULL) {
- TC_ERROR("** Not all timers were allocated!\n");
- }
-
- for (i = 0; i < NTIMERS; i++) {
- task_timer_free(pTimer[i]);
- }
- }
-
- return TC_PASS;
-}
-
-extern int test_fifo_timeout(void);
-void test_nano_timeouts(void)
-{
- if (test_fifo_timeout() == TC_PASS) {
- task_sem_give(test_nano_timeouts_sem);
- }
-
- /* on failure, don't give semaphore, main test will time out */
-}
-
-#define TEST_NANO_TIMERS_DELAY 4
-static struct nano_sem test_nano_timers_sem;
-static char __stack test_nano_timers_stack[512];
-static void test_nano_timers(int unused1, int unused2)
-{
- struct nano_timer timer;
-
- ARG_UNUSED(unused1);
- ARG_UNUSED(unused2);
-
- nano_timer_init(&timer, (void *)0xdeadbeef);
- TC_PRINT("starting nano timer to expire in %d seconds\n",
- TEST_NANO_TIMERS_DELAY);
- nano_fiber_timer_start(&timer, SECONDS(TEST_NANO_TIMERS_DELAY));
- TC_PRINT("fiber pending on timer\n");
- nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
- TC_PRINT("fiber back from waiting on timer: giving semaphore.\n");
- nano_task_sem_give(&test_nano_timers_sem);
- TC_PRINT("fiber semaphore given.\n");
-
- /* on failure, don't give semaphore, main test will not obtain it */
-}
-
-/**
- *
- * @brief Regression test's entry point
- *
- * @return N/A
- */
-
-void RegressionTaskEntry(void)
-{
- int tcRC;
-
- nano_sem_init(&test_nano_timers_sem);
-
- PRINT_DATA("Starting timer tests\n");
- PRINT_LINE;
-
- task_fiber_start(test_nano_timers_stack, 512, test_nano_timers, 0, 0, 5, 0);
-
- /* Test the task_timer_alloc() API */
-
- TC_PRINT("Test the allocation of timers\n");
- tcRC = testLowTimerGet();
- if (tcRC != TC_PASS) {
- goto exitRtn;
- }
-
- TC_PRINT("Test the one shot feature of a timer\n");
- tcRC = testLowTimerOneShot();
- if (tcRC != TC_PASS) {
- goto exitRtn;
- }
-
- TC_PRINT("Test that a timer does not start\n");
- tcRC = testLowTimerDoesNotStart();
- if (tcRC != TC_PASS) {
- goto exitRtn;
- }
-
- TC_PRINT("Test the periodic feature of a timer\n");
- tcRC = testLowTimerPeriodicity();
- if (tcRC != TC_PASS) {
- goto exitRtn;
- }
-
- TC_PRINT("Test the stopping of a timer\n");
- tcRC = testLowTimerStop();
- if (tcRC != TC_PASS) {
- goto exitRtn;
- }
-
- TC_PRINT("Verifying the nanokernel timer fired\n");
- if (!nano_task_sem_take(&test_nano_timers_sem, TICKS_NONE)) {
- tcRC = TC_FAIL;
- goto exitRtn;
- }
-
- TC_PRINT("Verifying the nanokernel timeouts worked\n");
- tcRC = task_sem_take(test_nano_timeouts_sem, SECONDS(5));
- tcRC = tcRC == RC_OK ? TC_PASS : TC_FAIL;
-
-exitRtn:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-}
diff --git a/samples/microkernel/test/test_timer/testcase.ini b/samples/microkernel/test/test_timer/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_timer/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/microkernel/test/test_xip/Makefile b/samples/microkernel/test/test_xip/Makefile
deleted file mode 100644
index 0d56ce66d..000000000
--- a/samples/microkernel/test/test_xip/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-MDEF_FILE = prj.mdef
-KERNEL_TYPE = micro
-BOARD ?= qemu_x86
-CONF_FILE = prj.conf
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/microkernel/test/test_xip/README.txt b/samples/microkernel/test/test_xip/README.txt
deleted file mode 100644
index fd776c59c..000000000
--- a/samples/microkernel/test/test_xip/README.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-Title: Execute in Place (XIP) Support
-
-Description:
-
-This test verifies XIP is working in the microkernel
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This microkernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting XIP tests
-===================================================================
-Test globals
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/microkernel/test/test_xip/prj.conf b/samples/microkernel/test/test_xip/prj.conf
deleted file mode 100644
index 31961fa9c..000000000
--- a/samples/microkernel/test/test_xip/prj.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# Disable enhanced security and enable XIP.
-CONFIG_XIP=y
diff --git a/samples/microkernel/test/test_xip/prj.mdef b/samples/microkernel/test/test_xip/prj.mdef
deleted file mode 100644
index d6507af87..000000000
--- a/samples/microkernel/test/test_xip/prj.mdef
+++ /dev/null
@@ -1,5 +0,0 @@
-% Application : test XIP
-
-% TASK NAME PRIO ENTRY STACK GROUPS
-% =====================================================
- TASK tStartTask 5 RegressionTaskEntry 1024 [EXE]
diff --git a/samples/microkernel/test/test_xip/src/Makefile b/samples/microkernel/test/test_xip/src/Makefile
deleted file mode 100644
index 05521e873..000000000
--- a/samples/microkernel/test/test_xip/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = test_xip.o test_xip_helper.o
diff --git a/samples/microkernel/test/test_xip/src/test.h b/samples/microkernel/test/test_xip/src/test.h
deleted file mode 100644
index ae0402281..000000000
--- a/samples/microkernel/test/test_xip/src/test.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* test.h - XIP test header */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This header contains defines, externs etc. for the XIP
-regression test.
- */
-
-
-/* This test relies on these values being one larger than the one before */
-
-#define TEST_VAL_1 0x1
-#define TEST_VAL_2 0x2
-#define TEST_VAL_3 0x3
-#define TEST_VAL_4 0x4
-
-#define XIP_TEST_ARRAY_SZ 4
-
-extern uint32_t xip_array[XIP_TEST_ARRAY_SZ];
diff --git a/samples/microkernel/test/test_xip/src/test_xip.c b/samples/microkernel/test/test_xip/src/test_xip.c
deleted file mode 100644
index 4b9205ad1..000000000
--- a/samples/microkernel/test/test_xip/src/test_xip.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* test_xip.c - test XIP */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module tests that XIP performs as expected. If the first
-task is even activated that is a good indication that XIP is
-working. However, the test does do some some testing on
-global variables for completeness sake.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include "test.h"
-
-
-#if defined(CONFIG_NANOKERNEL)
-/**
- *
- * @brief Main task entry point
- *
- * Entry point for nanokernel only builds.
- *
- * @return N/A
- */
-
-void main(void)
-#else
-/**
- *
- * @brief Regression test's entry point
- *
- * @return N/A
- */
-
-void RegressionTaskEntry(void)
-#endif
-{
- int tcRC = TC_PASS;
- int i;
-
- PRINT_DATA("Starting XIP tests\n");
- PRINT_LINE;
-
- /* Test globals are correct */
-
- TC_PRINT("Test globals\n");
-
- /* Array should be filled with monotomically incrementing values */
- for (i = 0; i < XIP_TEST_ARRAY_SZ; i++) {
- if (xip_array[i] != (i+1)) {
- TC_PRINT("xip_array[%d] != %d\n", i, i+1);
- tcRC = TC_FAIL;
- goto exitRtn;
- }
- }
-
-exitRtn:
- TC_END_RESULT(tcRC);
- TC_END_REPORT(tcRC);
-}
diff --git a/samples/microkernel/test/test_xip/src/test_xip_helper.c b/samples/microkernel/test/test_xip/src/test_xip_helper.c
deleted file mode 100644
index 181f70caa..000000000
--- a/samples/microkernel/test/test_xip/src/test_xip_helper.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* test_xip_helper.c - XIP helper module */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module contains support code for the XIP regression
-test.
- */
-
-#include <zephyr.h>
-#include "test.h"
-
-/*
- * This array is deliberately defined outside of the scope of the main test
- * module to avoid optimization issues.
- */
-uint32_t xip_array[XIP_TEST_ARRAY_SZ] = {
- TEST_VAL_1, TEST_VAL_2, TEST_VAL_3, TEST_VAL_4};
diff --git a/samples/microkernel/test/test_xip/testcase.ini b/samples/microkernel/test/test_xip/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/microkernel/test/test_xip/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/nanokernel/test/test_arm_m3_irq_vector_table/Makefile b/samples/nanokernel/test/test_arm_m3_irq_vector_table/Makefile
deleted file mode 100644
index ae1aba6d5..000000000
--- a/samples/nanokernel/test/test_arm_m3_irq_vector_table/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= basic_cortex_m3
-CONF_FILE = prj.conf
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_arm_m3_irq_vector_table/README.txt b/samples/nanokernel/test/test_arm_m3_irq_vector_table/README.txt
deleted file mode 100644
index 80c7dad99..000000000
--- a/samples/nanokernel/test/test_arm_m3_irq_vector_table/README.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-Title: Installation of ISRs Directly in the Vector Table (ARM Only)
-
-Description:
-
-Verify a project can install ISRs directly in the vector table. Only for
-ARM Cortex-M3/4 targets.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Cortex-M3 IRQ installed directly in vector table
-isr0 ran!
-isr1 ran!
-isr2 ran!
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_arm_m3_irq_vector_table/prj.conf b/samples/nanokernel/test/test_arm_m3_irq_vector_table/prj.conf
deleted file mode 100644
index e226a5c1f..000000000
--- a/samples/nanokernel/test/test_arm_m3_irq_vector_table/prj.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG_SW_ISR_TABLE=n
-CONFIG_IRQ_VECTOR_TABLE_CUSTOM=y
-CONFIG_NUM_IRQS=3
-CONFIG_COMPILER_OPT="-O0"
diff --git a/samples/nanokernel/test/test_arm_m3_irq_vector_table/src/Makefile b/samples/nanokernel/test/test_arm_m3_irq_vector_table/src/Makefile
deleted file mode 100644
index f6830f904..000000000
--- a/samples/nanokernel/test/test_arm_m3_irq_vector_table/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = main.o
diff --git a/samples/nanokernel/test/test_arm_m3_irq_vector_table/src/main.c b/samples/nanokernel/test/test_arm_m3_irq_vector_table/src/main.c
deleted file mode 100644
index a34ee7b03..000000000
--- a/samples/nanokernel/test/test_arm_m3_irq_vector_table/src/main.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* main.c - test IRQs installed in vector table */
-
-/*
- * Copyright (c) 2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-Set up three software IRQs: the ISR for each will print that it runs and then
-release a semaphore. The task then verifies it can obtain all three
-semaphores.
-
-The ISRs are installed at build time, directly in the vector table.
- */
-
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
- #error project can only run on Cortex-M3/M4
-#endif
-
-#include <arch/cpu.h>
-#include <tc_util.h>
-#include <sections.h>
-
-struct nano_sem sem[3];
-
-/**
- *
- * @brief ISR for IRQ0
- *
- * @return N/A
- */
-
-void isr0(void)
-{
- printk("%s ran!\n", __func__);
- nano_isr_sem_give(&sem[0]);
- _IntExit();
-}
-
-/**
- *
- * @brief ISR for IRQ1
- *
- * @return N/A
- */
-
-void isr1(void)
-{
- printk("%s ran!\n", __func__);
- nano_isr_sem_give(&sem[1]);
- _IntExit();
-}
-
-/**
- *
- * @brief ISR for IRQ2
- *
- * @return N/A
- */
-
-void isr2(void)
-{
- printk("%s ran!\n", __func__);
- nano_isr_sem_give(&sem[2]);
- _IntExit();
-}
-
-/**
- *
- * @brief Task entry point
- *
- * @return N/A
- */
-
-void main(void)
-{
- TC_START("Test Cortex-M3 IRQ installed directly in vector table");
-
- for (int ii = 0; ii < 3; ii++) {
- irq_enable(ii);
- _irq_priority_set(ii, 0, 0);
- nano_sem_init(&sem[ii]);
- }
-
- int rv;
- rv = nano_task_sem_take(&sem[0], TICKS_NONE) ||
- nano_task_sem_take(&sem[1], TICKS_NONE) ||
- nano_task_sem_take(&sem[2], TICKS_NONE) ? TC_FAIL : TC_PASS;
-
- if (TC_FAIL == rv) {
- goto get_out;
- }
-
- for (int ii = 0; ii < 3; ii++) {
- _NvicSwInterruptTrigger(ii);
- }
-
- rv = nano_task_sem_take(&sem[0], TICKS_NONE) &&
- nano_task_sem_take(&sem[1], TICKS_NONE) &&
- nano_task_sem_take(&sem[2], TICKS_NONE) ? TC_PASS : TC_FAIL;
-
-get_out:
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
-
-typedef void (*vth)(void); /* Vector Table Handler */
-vth __irq_vector_table _irq_vector_table[CONFIG_NUM_IRQS] = {
- isr0, isr1, isr2
- };
diff --git a/samples/nanokernel/test/test_arm_m3_irq_vector_table/testcase.ini b/samples/nanokernel/test/test_arm_m3_irq_vector_table/testcase.ini
deleted file mode 100644
index b152b149c..000000000
--- a/samples/nanokernel/test/test_arm_m3_irq_vector_table/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-arch_whitelist = arm
-
diff --git a/samples/nanokernel/test/test_atomic/Makefile b/samples/nanokernel/test/test_atomic/Makefile
deleted file mode 100644
index 665f36ce6..000000000
--- a/samples/nanokernel/test/test_atomic/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_atomic/README.txt b/samples/nanokernel/test/test_atomic/README.txt
deleted file mode 100644
index 5665691d9..000000000
--- a/samples/nanokernel/test/test_atomic/README.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-Title: Atomic Operations
-
-Description:
-
-This test verifies that atomic operations manipulate data as expected.
-They currently do not test atomicity.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test atomic operation primitives
-Test atomic_cas()
-Test atomic_add()
-Test atomic_sub()
-Test atomic_inc()
-Test atomic_dec()
-Test atomic_get()
-Test atomic_set()
-Test atomic_clear()
-Test atomic_or()
-Test atomic_xor()
-Test atomic_and()
-Test atomic_nand()
-Test atomic_test_bit()
-Test atomic_test_and_clear_bit()
-Test atomic_test_and_set_bit()
-Test atomic_clear_bit()
-Test atomic_set_bit()
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_atomic/src/Makefile b/samples/nanokernel/test/test_atomic/src/Makefile
deleted file mode 100644
index bf74fc80f..000000000
--- a/samples/nanokernel/test/test_atomic/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = atomic.o
diff --git a/samples/nanokernel/test/test_atomic/src/atomic.c b/samples/nanokernel/test/test_atomic/src/atomic.c
deleted file mode 100644
index 461e20e12..000000000
--- a/samples/nanokernel/test/test_atomic/src/atomic.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2015 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <atomic.h>
-
-#include <tc_util.h>
-
-#define CHECK_OUTPUT(expr, val) do { \
- atomic_val_t x = (expr); \
- if (x != (val)) { \
- failed++; \
- TC_ERROR(#expr" != " #val " got %d\n", x); \
- } \
-} while (0)
-
-#define CHECK_TRUTH(expr, val) CHECK_OUTPUT(!!(expr), !!(val))
-
-void main(void)
-{
- int failed, rv, i;
-
- atomic_t target, orig;
- atomic_val_t value;
- atomic_val_t oldvalue;
-
- failed = 0;
- TC_START("Test atomic operation primitives");
-
- TC_PRINT("Test atomic_cas()\n");
- target = 4;
- value = 5;
- oldvalue = 6;
-
- CHECK_OUTPUT(atomic_cas(&target, oldvalue, value), 0);
- target = 6;
- CHECK_OUTPUT(atomic_cas(&target, oldvalue, value), 1);
- CHECK_OUTPUT(target, value);
-
- TC_PRINT("Test atomic_add()\n");
- target = 1;
- value = 2;
- CHECK_OUTPUT(atomic_add(&target, value), 1);
- CHECK_OUTPUT(target, 3);
-
- TC_PRINT("Test atomic_sub()\n");
- target = 10;
- value = 2;
- CHECK_OUTPUT(atomic_sub(&target, value), 10);
- CHECK_OUTPUT(target, 8);
-
- TC_PRINT("Test atomic_inc()\n");
- target = 5;
- CHECK_OUTPUT(atomic_inc(&target), 5);
- CHECK_OUTPUT(target, 6);
-
- TC_PRINT("Test atomic_dec()\n");
- target = 2;
- CHECK_OUTPUT(atomic_dec(&target), 2);
- CHECK_OUTPUT(target, 1);
-
- TC_PRINT("Test atomic_get()\n");
- target = 50;
- CHECK_OUTPUT(atomic_get(&target), 50);
-
- TC_PRINT("Test atomic_set()\n");
- target = 42;
- value = 77;
- CHECK_OUTPUT(atomic_set(&target, value), 42);
- CHECK_OUTPUT(target, value);
-
- TC_PRINT("Test atomic_clear()\n");
- target = 100;
- CHECK_OUTPUT(atomic_clear(&target), 100);
- CHECK_OUTPUT(target, 0);
-
- TC_PRINT("Test atomic_or()\n");
- target = 0xFF00;
- value = 0x0F0F;
- CHECK_OUTPUT(atomic_or(&target, value), 0xFF00);
- CHECK_OUTPUT(target, 0xFF0F);
-
- TC_PRINT("Test atomic_xor()\n");
- target = 0xFF00;
- value = 0x0F0F;
- CHECK_OUTPUT(atomic_xor(&target, value), 0xFF00);
- CHECK_OUTPUT(target, 0xF00F);
-
- TC_PRINT("Test atomic_and()\n");
- target = 0xFF00;
- value = 0x0F0F;
- CHECK_OUTPUT(atomic_and(&target, value), 0xFF00);
- CHECK_OUTPUT(target, 0x0F00);
-
- TC_PRINT("Test atomic_nand()\n");
- target = 0xFF00;
- value = 0x0F0F;
- CHECK_OUTPUT(atomic_nand(&target, value), 0xFF00);
- CHECK_OUTPUT(target, 0xFFFFF0FF);
-
- TC_PRINT("Test atomic_test_bit()\n");
- for (i = 0; i < 32; i++) {
- target = 0x0F0F0F0F;
- CHECK_TRUTH(atomic_test_bit(&target, i),
- (target & (1 << i)));
- }
-
- TC_PRINT("Test atomic_test_and_clear_bit()\n");
- for (i = 0; i < 32; i++) {
- orig = 0x0F0F0F0F;
- target = orig;
- CHECK_TRUTH(atomic_test_and_clear_bit(&target, i),
- (orig & (1 << i)));
- CHECK_OUTPUT(target, orig & ~(1 << i));
- }
-
- TC_PRINT("Test atomic_test_and_set_bit()\n");
- for (i = 0; i < 32; i++) {
- orig = 0x0F0F0F0F;
- target = orig;
- CHECK_TRUTH(atomic_test_and_set_bit(&target, i),
- (orig & (1 << i)));
- CHECK_OUTPUT(target, orig | (1 << i));
- }
-
- TC_PRINT("Test atomic_clear_bit()\n");
- for (i = 0; i < 32; i++) {
- orig = 0x0F0F0F0F;
- target = orig;
- atomic_clear_bit(&target, i);
- CHECK_OUTPUT(target, orig & ~(1 << i));
- }
-
- TC_PRINT("Test atomic_set_bit()\n");
- for (i = 0; i < 32; i++) {
- orig = 0x0F0F0F0F;
- target = orig;
- atomic_set_bit(&target, i);
- CHECK_OUTPUT(target, orig | (1 << i));
- }
-
- if (failed) {
- TC_PRINT("%d tests failed\n", failed);
- rv = TC_FAIL;
- } else {
- rv = TC_PASS;
- }
-
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_atomic/testcase.ini b/samples/nanokernel/test/test_atomic/testcase.ini
deleted file mode 100644
index 914a14535..000000000
--- a/samples/nanokernel/test/test_atomic/testcase.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test]
-tags = core
diff --git a/samples/nanokernel/test/test_context/Makefile b/samples/nanokernel/test/test_context/Makefile
deleted file mode 100644
index e5444f423..000000000
--- a/samples/nanokernel/test/test_context/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_context/README.txt b/samples/nanokernel/test/test_context/README.txt
deleted file mode 100644
index 60e94bebb..000000000
--- a/samples/nanokernel/test/test_context/README.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-Title: Context and IRQ APIs
-
-Description:
-
-This test verifies that the nanokernel CPU and context APIs operate as expected.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel CPU and thread routines
-Initializing nanokernel objects
-Testing nano_cpu_idle()
-Testing interrupt locking and unlocking
-Testing irq_disable() and irq_enable()
-Testing sys_thread_self_get() from an ISR and task
-Testing sys_execution_context_type_get() from an ISR
-Testing sys_execution_context_type_get() from a task
-Spawning a fiber from a task
-Fiber to test sys_thread_self_get() and sys_execution_context_type_get
-Fiber to test fiber_yield()
-Testing sys_thread_busy_wait()
- fiber busy waiting for 20000 usecs (2 ticks)
- fiber busy waiting completed
-Testing fiber_sleep()
- fiber sleeping for 5 ticks
- fiber back from sleep
-Testing fiber_delayed_start() without cancellation
- fiber (q order: 2, t/o: 50) is running
- got fiber (q order: 2, t/o: 50) as expected
- fiber (q order: 3, t/o: 75) is running
- got fiber (q order: 3, t/o: 75) as expected
- fiber (q order: 0, t/o: 100) is running
- got fiber (q order: 0, t/o: 100) as expected
- fiber (q order: 6, t/o: 125) is running
- got fiber (q order: 6, t/o: 125) as expected
- fiber (q order: 1, t/o: 150) is running
- got fiber (q order: 1, t/o: 150) as expected
- fiber (q order: 4, t/o: 175) is running
- got fiber (q order: 4, t/o: 175) as expected
- fiber (q order: 5, t/o: 200) is running
- got fiber (q order: 5, t/o: 200) as expected
-Testing fiber_delayed_start() with cancellations
- cancelling [q order: 0, t/o: 100, t/o order: 0]
- fiber (q order: 3, t/o: 75) is running
- got (q order: 3, t/o: 75, t/o order 1074292) as expected
- fiber (q order: 0, t/o: 100) is running
- got (q order: 0, t/o: 100, t/o order 1074292) as expected
- cancelling [q order: 3, t/o: 75, t/o order: 3]
- cancelling [q order: 4, t/o: 175, t/o order: 4]
- fiber (q order: 4, t/o: 175) is running
- got (q order: 4, t/o: 175, t/o order 1074292) as expected
- cancelling [q order: 6, t/o: 125, t/o order: 6]
-Verifying exception handler installed
-excHandlerExecuted: 1
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_context/prj_arm.conf b/samples/nanokernel/test/test_context/prj_arm.conf
deleted file mode 100644
index bb4d818f4..000000000
--- a/samples/nanokernel/test/test_context/prj_arm.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_IRQ_OFFLOAD=y
-CONFIG_ZERO_LATENCY_IRQS=y
-CONFIG_NANO_TIMEOUTS=y
diff --git a/samples/nanokernel/test/test_context/prj_x86.conf b/samples/nanokernel/test/test_context/prj_x86.conf
deleted file mode 100644
index 60075a0f5..000000000
--- a/samples/nanokernel/test/test_context/prj_x86.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_NANO_TIMEOUTS=y
-CONFIG_IRQ_OFFLOAD=y
-CONFIG_NUM_DYNAMIC_EXC_NOERR_STUBS=1
diff --git a/samples/nanokernel/test/test_context/src/Makefile b/samples/nanokernel/test/test_context/src/Makefile
deleted file mode 100644
index 503b0d82f..000000000
--- a/samples/nanokernel/test/test_context/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-ccflags-$(CONFIG_SOC_QUARK_D2000) += -DFIBER_STACKSIZE=256
-
-obj-y = context.o
diff --git a/samples/nanokernel/test/test_context/src/README b/samples/nanokernel/test/test_context/src/README
deleted file mode 100644
index 459bbee4f..000000000
--- a/samples/nanokernel/test/test_context/src/README
+++ /dev/null
@@ -1,51 +0,0 @@
-APIs tested in this test set
-============================
-
-fiber_fiber_start
- - start a helper fiber to help with fiber_yield() tests
-
-task_fiber_start
- - start a fiber to test fiber related functionality
-
-fiber_yield
- - Called by a higher priority fiber when there is another fiber
- - Called by an equal priority fiber when there is another fiber
- - Called by a lower priority fiber when there is another fiber
-
-sys_thread_self_get
- - Called from an ISR (interrupted a task)
- - Called from an ISR (interrupted a fiber)
- - Called from a task
- - Called from a fiber
-
-sys_execution_context_type_get
- - Called from an ISR that interrupted a task
- - Called from an ISR that interrupted a fiber
- - Called from a task
- - Called from a fiber
-
-nano_cpu_idle
- - CPU to be woken up by tick timer. Thus, after each call, the tick count
- should have advanced by one tick.
-
-irq_lock
- - 1. Count the number of calls to sys_tick_get_32() before a tick expires.
- - 2. Once determined, call sys_tick_get_32() many more times than that
- with interrupts locked. Check that the tick count remains unchanged.
-
-irq_unlock
- - Continuation irq_lock: unlock interrupts, loop and verify the tick
- count changes.
-
-irq_offload
- - Used when triggering an ISR to perform ISR context work.
-
-nanoCpuExcConnect
- - Used during nanokernel object initialization. Verified by triggering a
- divide-by-zero exception. The handler skips us over the offending
- instruction.
-
-irq_enable
-irq_disable
- - Use these routines to disable and enable timer interrupts so that they can
- be tested in the same way as irq_lock() and irq_unlock().
diff --git a/samples/nanokernel/test/test_context/src/context.c b/samples/nanokernel/test/test_context/src/context.c
deleted file mode 100644
index 3dd4fd9c2..000000000
--- a/samples/nanokernel/test/test_context/src/context.c
+++ /dev/null
@@ -1,935 +0,0 @@
-/* thread.c - test nanokernel CPU and thread APIs */
-
-/*
- * Copyright (c) 2012-2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
-DESCRIPTION
-This module tests the following CPU and thread related routines:
- fiber_fiber_start(), task_fiber_start(), fiber_yield(),
- sys_thread_self_get(), sys_execution_context_type_get(), nano_cpu_idle(),
- irq_lock(), irq_unlock(),
- irq_offload(), nanoCpuExcConnect(),
- irq_enable(), irq_disable(),
- */
-
-#include <tc_util.h>
-#include <nano_private.h>
-#include <arch/cpu.h>
-#include <irq_offload.h>
-
-#include <util_test_common.h>
-
-/*
- * Include board.h from platform to get IRQ number.
- * NOTE: Cortex-M3/M4 does not need IRQ numbers
- */
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
- #include <board.h>
-#endif
-
-#ifndef FIBER_STACKSIZE
-#define FIBER_STACKSIZE 2000
-#endif
-#define FIBER_PRIORITY 4
-
-#define THREAD_SELF_CMD 0
-#define EXEC_CTX_TYPE_CMD 1
-
-#define UNKNOWN_COMMAND -1
-
-/*
- * Get the timer type dependent IRQ number. If timer type
- * is not defined in platform, generate an error
- */
-#if defined(CONFIG_HPET_TIMER)
- #define TICK_IRQ CONFIG_HPET_TIMER_IRQ
-#elif defined(CONFIG_LOAPIC_TIMER)
- #define TICK_IRQ CONFIG_LOAPIC_TIMER_IRQ
-#elif defined(CONFIG_CPU_CORTEX_M3_M4)
- /* Cortex-M3/M4 does not need a tick IRQ number. */
-#else
- /* generate an error */
- #error Timer type is not defined for this platform
-#endif
-
-typedef struct {
- int command; /* command to process */
- int error; /* error value (if any) */
- union {
- void *data; /* pointer to data to use or return */
- int value; /* value to be passed or returned */
- };
-} ISR_INFO;
-
-typedef int (* disable_interrupt_func)(int);
-typedef void (* enable_interrupt_func)(int);
-
-/* Cortex-M3/M4 does not implement connecting non-IRQ exception handlers */
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
-static volatile int excHandlerExecuted;
-#endif
-
-static struct nano_sem wakeFiber;
-static struct nano_timer timer;
-static struct nano_sem reply_timeout;
-struct nano_fifo timeout_order_fifo;
-static void *timerData[1];
-
-static int fiberDetectedError = 0;
-static char __stack fiberStack1[FIBER_STACKSIZE];
-static char __stack fiberStack2[FIBER_STACKSIZE];
-static int fiberEvidence = 0;
-
-static ISR_INFO isrInfo;
-
-/**
- *
- * @brief Handler to perform various actions from within an ISR context
- *
- * This routine is the ISR handler for _trigger_isrHandler(). It performs
- * the command requested in <isrInfo.command>.
- *
- * @return N/A
- */
-
-void isr_handler(void *data)
-{
- ARG_UNUSED(data);
-
- switch (isrInfo.command) {
- case THREAD_SELF_CMD:
- isrInfo.data = (void *) sys_thread_self_get();
- break;
-
- case EXEC_CTX_TYPE_CMD:
- isrInfo.value = sys_execution_context_type_get();
- break;
-
- default:
- isrInfo.error = UNKNOWN_COMMAND;
- break;
- }
-}
-static void _trigger_isrHandler(void)
-{
- irq_offload(isr_handler, NULL);
-}
-
-
-/* Cortex-M3/M4 does not implement connecting non-IRQ exception handlers */
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
-/**
- *
- * @brief Divide by zero exception handler
- *
- * This handler is part of a test that is only interested in detecting the
- * error so that we know the exception connect code is working. It simply
- * adds 2 to the EIP to skip over the offending instruction:
- * f7 f9 idiv %ecx
- * thereby preventing the infinite loop of divide-by-zero errors which would
- * arise if control simply returns to that instruction.
- *
- * @return N/A
- */
-
-void exc_divide_error_handler(NANO_ESF *pEsf)
-{
- pEsf->eip += 2;
- excHandlerExecuted = 1; /* provide evidence that the handler executed */
-}
-#endif
-
-/**
- *
- * @brief Initialize nanokernel objects
- *
- * This routine initializes the nanokernel objects used in this module's tests.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int initNanoObjects(void)
-{
- nano_sem_init(&wakeFiber);
- nano_timer_init(&timer, timerData);
- nano_fifo_init(&timeout_order_fifo);
-
-/* no nanoCpuExcConnect on Cortex-M3/M4 */
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
- nanoCpuExcConnect(IV_DIVIDE_ERROR, exc_divide_error_handler);
-#endif
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the nano_cpu_idle() routine
- *
- * This tests the nano_cpu_idle() routine. The first thing it does is align to
- * a tick boundary. The only source of interrupts while the test is running is
- * expected to be the tick clock timer which should wake the CPU. Thus after
- * each call to nano_cpu_idle(), the tick count should be one higher.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int nano_cpu_idleTest(void)
-{
- int tick; /* current tick count */
- int i; /* loop variable */
-
- /* Align to a "tick boundary". */
- tick = sys_tick_get_32();
- while (tick == sys_tick_get_32()) {
- }
- tick = sys_tick_get_32();
-
- for (i = 0; i < 5; i++) { /* Repeat the test five times */
- nano_cpu_idle();
- tick++;
- if (sys_tick_get_32() != tick) {
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief A wrapper for irq_lock()
- *
- * @return irq_lock() return value
- */
-
-int irq_lockWrapper(int unused)
-{
- ARG_UNUSED(unused);
-
- return irq_lock();
-}
-
-/**
- *
- * @brief A wrapper for irq_unlock()
- *
- * @return N/A
- */
-
-void irq_unlockWrapper(int imask)
-{
- irq_unlock(imask);
-}
-
-/**
- *
- * @brief A wrapper for irq_disable()
- *
- * @return <irq>
- */
-
-int irq_disableWrapper(int irq)
-{
- irq_disable(irq);
- return irq;
-}
-
-/**
- *
- * @brief A wrapper for irq_enable()
- *
- * @return N/A
- */
-
-void irq_enableWrapper(int irq)
-{
- irq_enable(irq);
-}
-
-/**
- *
- * @brief Test routines for disabling and enabling ints
- *
- * This routine tests the routines for disabling and enabling interrupts. These
- * include irq_lock() and irq_unlock(), irq_disable() and irq_enable().
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int nanoCpuDisableInterruptsTest(disable_interrupt_func disableRtn,
- enable_interrupt_func enableRtn, int irq)
-{
- unsigned long long count = 0;
- unsigned long long i = 0;
- int tick;
- int tick2;
- int imask;
-
- /* Align to a "tick boundary" */
- tick = sys_tick_get_32();
- while (sys_tick_get_32() == tick) {
- }
- tick++;
-
- while (sys_tick_get_32() == tick) {
- count++;
- }
-
- /*
- * Inflate <count> so that when we loop later, many ticks should have
- * elapsed during the loop. This later loop will not exactly match the
- * previous loop, but it should be close enough in structure that when
- * combined with the inflated count, many ticks will have passed.
- */
-
- count <<= 4;
-
- imask = disableRtn(irq);
- tick = sys_tick_get_32();
- for (i = 0; i < count; i++) {
- sys_tick_get_32();
- }
-
- tick2 = sys_tick_get_32();
-
- /*
- * Re-enable interrupts before returning (for both success and failure
- * cases).
- */
-
- enableRtn(imask);
-
- if (tick2 != tick) {
- return TC_FAIL;
- }
-
- /* Now repeat with interrupts unlocked. */
- for (i = 0; i < count; i++) {
- sys_tick_get_32();
- }
-
- return (tick == sys_tick_get_32()) ? TC_FAIL : TC_PASS;
-}
-
-/**
- *
- * @brief Test the various nanoCtxXXX() routines from a task
- *
- * This routines tests the sys_thread_self_get() and
- * sys_execution_context_type_get() routines from both a task and an ISR (that
- * interrupted a task). Checking those routines with fibers are done
- * elsewhere.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int nanoCtxTaskTest(void)
-{
- nano_thread_id_t self_thread_id;
-
- TC_PRINT("Testing sys_thread_self_get() from an ISR and task\n");
- self_thread_id = sys_thread_self_get();
- isrInfo.command = THREAD_SELF_CMD;
- isrInfo.error = 0;
- _trigger_isrHandler();
- if ((isrInfo.error != 0) || (isrInfo.data != (void *) self_thread_id)) {
- /*
- * Either the ISR detected an error, or the ISR context ID does not
- * match the interrupted task's thread ID.
- */
- return TC_FAIL;
- }
-
- TC_PRINT("Testing sys_execution_context_type_get() from an ISR\n");
- isrInfo.command = EXEC_CTX_TYPE_CMD;
- isrInfo.error = 0;
- _trigger_isrHandler();
- if ((isrInfo.error != 0) || (isrInfo.value != NANO_CTX_ISR)) {
- return TC_FAIL;
- }
-
- TC_PRINT("Testing sys_execution_context_type_get() from a task\n");
- if (sys_execution_context_type_get() != NANO_CTX_TASK) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Test the various context/thread routines from a fiber
- *
- * This routines tests the sys_thread_self_get() and
- * sys_execution_context_type_get() routines from both a fiber and an ISR (that
- * interrupted a fiber). Checking those routines with tasks are done
- * elsewhere.
- *
- * This routine may set <fiberDetectedError> to the following values:
- * 1 - if fiber ID matches that of the task
- * 2 - if thread ID taken during ISR does not match that of the fiber
- * 3 - sys_execution_context_type_get() when called from an ISR is not
- * NANO_TYPE_ISR
- * 4 - sys_execution_context_type_get() when called from a fiber is not
- * NANO_TYPE_FIBER
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int nanoCtxFiberTest(nano_thread_id_t task_thread_id)
-{
- nano_thread_id_t self_thread_id;
-
- self_thread_id = sys_thread_self_get();
- if (self_thread_id == task_thread_id) {
- fiberDetectedError = 1;
- return TC_FAIL;
- }
-
- isrInfo.command = THREAD_SELF_CMD;
- isrInfo.error = 0;
- _trigger_isrHandler();
- if ((isrInfo.error != 0) || (isrInfo.data != (void *) self_thread_id)) {
- /*
- * Either the ISR detected an error, or the ISR context ID does not
- * match the interrupted fiber's thread ID.
- */
- fiberDetectedError = 2;
- return TC_FAIL;
- }
-
- isrInfo.command = EXEC_CTX_TYPE_CMD;
- isrInfo.error = 0;
- _trigger_isrHandler();
- if ((isrInfo.error != 0) || (isrInfo.value != NANO_CTX_ISR)) {
- fiberDetectedError = 3;
- return TC_FAIL;
- }
-
- if (sys_execution_context_type_get() != NANO_CTX_FIBER) {
- fiberDetectedError = 4;
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to the fiber's helper
- *
- * This routine is the entry point to the fiber's helper fiber. It is used to
- * help test the behaviour of the fiber_yield() routine.
- *
- * @param arg1 unused
- * @param arg2 unused
- *
- * @return N/A
- */
-
-static void fiberHelper(int arg1, int arg2)
-{
- nano_thread_id_t self_thread_id;
-
- ARG_UNUSED(arg1);
- ARG_UNUSED(arg2);
-
- /*
- * This fiber starts off at a higher priority than fiberEntry(). Thus, it
- * should execute immediately.
- */
-
- fiberEvidence++;
-
- /* Test that helper will yield to a fiber of equal priority */
- self_thread_id = sys_thread_self_get();
- self_thread_id->prio++; /* Lower priority to that of fiberEntry() */
- fiber_yield(); /* Yield to fiber of equal priority */
-
- fiberEvidence++;
- /* <fiberEvidence> should now be 2 */
-
-}
-
-/**
- *
- * @brief Test the fiber_yield() routine
- *
- * This routine tests the fiber_yield() routine. It starts another fiber
- * (thus also testing fiber_fiber_start()) and checks that behaviour of
- * fiber_yield() against the cases of there being a higher priority fiber,
- * a lower priority fiber, and another fiber of equal priority.
- *
- * On error, it may set <fiberDetectedError> to one of the following values:
- * 10 - helper fiber ran prematurely
- * 11 - fiber_yield() did not yield to a higher priority fiber
- * 12 - fiber_yield() did not yield to an equal prioirty fiber
- * 13 - fiber_yield() yielded to a lower priority fiber
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int fiber_yieldTest(void)
-{
- nano_thread_id_t self_thread_id;
-
- /*
- * Start a fiber of higher priority. Note that since the new fiber is
- * being started from a fiber, it will not automatically switch to the
- * fiber as it would if done from a task.
- */
-
- self_thread_id = sys_thread_self_get();
- fiberEvidence = 0;
- fiber_fiber_start(fiberStack2, FIBER_STACKSIZE, fiberHelper,
- 0, 0, FIBER_PRIORITY - 1, 0);
-
- if (fiberEvidence != 0) {
- /* ERROR! Helper spawned at higher */
- fiberDetectedError = 10; /* priority ran prematurely. */
- return TC_FAIL;
- }
-
- /*
- * Test that the fiber will yield to the higher priority helper.
- * <fiberEvidence> is still 0.
- */
-
- fiber_yield();
-
- if (fiberEvidence == 0) {
- /* ERROR! Did not yield to higher */
- fiberDetectedError = 11; /* priority fiber. */
- return TC_FAIL;
- }
-
- if (fiberEvidence > 1) {
- /* ERROR! Helper did not yield to */
- fiberDetectedError = 12; /* equal priority fiber. */
- return TC_FAIL;
- }
-
- /*
- * Raise the priority of fiberEntry(). Calling fiber_yield() should
- * not result in switching to the helper.
- */
-
- self_thread_id->prio--;
- fiber_yield();
-
- if (fiberEvidence != 1) {
- /* ERROR! Context switched to a lower */
- fiberDetectedError = 13; /* priority fiber! */
- return TC_FAIL;
- }
-
- /*
- * Block on <wakeFiber>. This will allow the helper fiber to complete.
- * The main task will wake this fiber.
- */
-
- nano_fiber_sem_take(&wakeFiber, TICKS_UNLIMITED);
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to fiber started by the task
- *
- * This routine is the entry point to the fiber started by the task.
- *
- * @param task_thread_id thread ID of the spawning task
- * @param arg1 unused
- *
- * @return N/A
- */
-
-static void fiberEntry(int task_thread_id, int arg1)
-{
- int rv;
-
- ARG_UNUSED(arg1);
-
- fiberEvidence++; /* Prove to the task that the fiber has run */
- nano_fiber_sem_take(&wakeFiber, TICKS_UNLIMITED);
-
- rv = nanoCtxFiberTest((nano_thread_id_t) task_thread_id);
- if (rv != TC_PASS) {
- return;
- }
-
- /* Allow the task to print any messages before the next test runs */
- nano_fiber_sem_take(&wakeFiber, TICKS_UNLIMITED);
-
- rv = fiber_yieldTest();
- if (rv != TC_PASS) {
- return;
- }
-}
-
-/*
- * Timeout tests
- *
- * Test the fiber_sleep() API, as well as the fiber_delayed_start() ones.
- */
-
-#include <tc_nano_timeout_common.h>
-
-struct timeout_order_data {
- void *link_in_fifo;
- int32_t timeout;
- int timeout_order;
- int q_order;
-};
-
-struct timeout_order_data timeout_order_data[] = {
- {0, TIMEOUT(2), 2, 0},
- {0, TIMEOUT(4), 4, 1},
- {0, TIMEOUT(0), 0, 2},
- {0, TIMEOUT(1), 1, 3},
- {0, TIMEOUT(5), 5, 4},
- {0, TIMEOUT(6), 6, 5},
- {0, TIMEOUT(3), 3, 6},
-};
-
-#define NUM_TIMEOUT_FIBERS ARRAY_SIZE(timeout_order_data)
-static char __stack timeout_stacks[NUM_TIMEOUT_FIBERS][FIBER_STACKSIZE];
-
-/* a fiber busy waits, then reports through a fifo */
-static void test_fiber_busy_wait(int ticks, int unused)
-{
- ARG_UNUSED(unused);
-
- uint32_t usecs = ticks * sys_clock_us_per_tick;
-
- TC_PRINT(" fiber busy waiting for %d usecs (%d ticks)\n",
- usecs, ticks);
- sys_thread_busy_wait(usecs);
- TC_PRINT(" fiber busy waiting completed\n");
-
- /*
- * Ideally the test should verify that the correct number of ticks
- * have elapsed. However, when run under QEMU the tick interrupt
- * may be processed on a very irregular basis, meaning that far
- * fewer than the expected number of ticks may occur for a given
- * number of clock cycles vs. what would ordinarily be expected.
- *
- * Consequently, the best we can do for now to test busy waiting is
- * to invoke the API and verify that it returns. (If it takes way
- * too long, or never returns, the main test task may be able to
- * time out and report an error.)
- */
-
- nano_fiber_sem_give(&reply_timeout);
-}
-
-/* a fiber sleeps and times out, then reports through a fifo */
-static void test_fiber_sleep(int timeout, int arg2)
-{
- int64_t orig_ticks = sys_tick_get();
-
- TC_PRINT(" fiber sleeping for %d ticks\n", timeout);
- fiber_sleep(timeout);
- TC_PRINT(" fiber back from sleep\n");
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- return;
- }
-
- nano_fiber_sem_give(&reply_timeout);
-}
-
-/* a fiber is started with a delay, then it reports that it ran via a fifo */
-void delayed_fiber(int num, int unused)
-{
- struct timeout_order_data *data = &timeout_order_data[num];
-
- ARG_UNUSED(unused);
-
- TC_PRINT(" fiber (q order: %d, t/o: %d) is running\n",
- data->q_order, data->timeout);
-
- nano_fiber_fifo_put(&timeout_order_fifo, data);
-}
-
-static int test_timeout(void)
-{
- int32_t timeout;
- int rv;
- int ii;
- struct timeout_order_data *data;
-
- /* test sys_thread_busy_wait() */
-
- TC_PRINT("Testing sys_thread_busy_wait()\n");
- timeout = 2;
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_busy_wait, (int)timeout, 0,
- FIBER_PRIORITY, 0);
-
- rv = nano_task_sem_take(&reply_timeout, timeout + 2);
- if (!rv) {
- rv = TC_FAIL;
- TC_ERROR(" *** task timed out waiting for sys_thread_busy_wait()\n");
- return TC_FAIL;
- }
-
- /* test fiber_sleep() */
-
- TC_PRINT("Testing fiber_sleep()\n");
- timeout = 5;
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_sleep, (int)timeout, 0,
- FIBER_PRIORITY, 0);
-
- rv = nano_task_sem_take(&reply_timeout, timeout + 5);
- if (!rv) {
- rv = TC_FAIL;
- TC_ERROR(" *** task timed out waiting for fiber on fiber_sleep().\n");
- return TC_FAIL;
- }
-
- /* test fiber_delayed_start() without cancellation */
-
- TC_PRINT("Testing fiber_delayed_start() without cancellation\n");
-
- for (ii = 0; ii < NUM_TIMEOUT_FIBERS; ii++) {
- (void)task_fiber_delayed_start(timeout_stacks[ii], FIBER_STACKSIZE,
- delayed_fiber, ii, 0, 5, 0,
- timeout_order_data[ii].timeout);
- }
- for (ii = 0; ii < NUM_TIMEOUT_FIBERS; ii++) {
-
- data = nano_task_fifo_get(&timeout_order_fifo, TIMEOUT_TWO_INTERVALS);
-
- if (!data) {
- TC_ERROR(" *** timeout while waiting for delayed fiber\n");
- return TC_FAIL;
- }
-
- if (data->timeout_order != ii) {
- TC_ERROR(" *** wrong delayed fiber ran (got %d, expected %d)\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
-
- TC_PRINT(" got fiber (q order: %d, t/o: %d) as expected\n",
- data->q_order, data->timeout);
- }
-
- /* ensure no more fibers fire */
-
- data = nano_task_fifo_get(&timeout_order_fifo, TIMEOUT_TWO_INTERVALS);
-
- if (data) {
- TC_ERROR(" *** got something on the fifo, but shouldn't have...\n");
- return TC_FAIL;
- }
-
- /* test fiber_delayed_start() with cancellation */
-
- TC_PRINT("Testing fiber_delayed_start() with cancellations\n");
-
- int cancellations[] = {0, 3, 4, 6};
- int num_cancellations = ARRAY_SIZE(cancellations);
- int next_cancellation = 0;
-
- void *delayed_fibers[NUM_TIMEOUT_FIBERS];
-
- for (ii = 0; ii < NUM_TIMEOUT_FIBERS; ii++) {
- delayed_fibers[ii] =
- task_fiber_delayed_start(timeout_stacks[ii], FIBER_STACKSIZE,
- delayed_fiber, ii, 0, 5, 0,
- timeout_order_data[ii].timeout);
- }
-
- for (ii = 0; ii < NUM_TIMEOUT_FIBERS; ii++) {
- int jj;
-
- if (ii == cancellations[next_cancellation]) {
- TC_PRINT(" cancelling [q order: %d, t/o: %d, t/o order: %d]\n",
- timeout_order_data[ii].q_order,
- timeout_order_data[ii].timeout, ii);
- for (jj = 0; jj < NUM_TIMEOUT_FIBERS; jj++) {
- if (timeout_order_data[jj].timeout_order == ii) {
- break;
- }
- }
- task_fiber_delayed_start_cancel(delayed_fibers[jj]);
- ++next_cancellation;
- continue;
- }
-
- data = nano_task_fifo_get(&timeout_order_fifo, TIMEOUT_TEN_INTERVALS);
-
- if (!data) {
- TC_ERROR(" *** timeout while waiting for delayed fiber\n");
- return TC_FAIL;
- }
-
- if (data->timeout_order != ii) {
- TC_ERROR(" *** wrong delayed fiber ran (got %d, expected %d)\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
-
- TC_PRINT(" got (q order: %d, t/o: %d, t/o order %d) as expected\n",
- data->q_order, data->timeout);
- }
-
- if (num_cancellations != next_cancellation) {
- TC_ERROR(" *** wrong number of cancellations (expected %d, got %d\n",
- num_cancellations, next_cancellation);
- return TC_FAIL;
- }
-
- /* ensure no more fibers fire */
-
- data = nano_task_fifo_get(&timeout_order_fifo, TIMEOUT_TWO_INTERVALS);
-
- if (data) {
- TC_ERROR(" *** got something on the fifo, but shouldn't have...\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to timer tests
- *
- * This is the entry point to the CPU and thread tests.
- *
- * @return N/A
- */
-
-void main(void)
-{
- int rv; /* return value from tests */
-
- TC_START("Test Nanokernel CPU and thread routines");
-
- TC_PRINT("Initializing nanokernel objects\n");
- rv = initNanoObjects();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing nano_cpu_idle()\n");
- rv = nano_cpu_idleTest();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Testing interrupt locking and unlocking\n");
- rv = nanoCpuDisableInterruptsTest(irq_lockWrapper,
- irq_unlockWrapper, -1);
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
-
-/*
- * The Cortex-M3/M4 use the SYSTICK exception for the system timer, which is
- * not considered an IRQ by the irq_enable/Disable APIs.
- */
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
- /* Disable interrupts coming from the timer. */
-
- TC_PRINT("Testing irq_disable() and irq_enable()\n");
- rv = nanoCpuDisableInterruptsTest(irq_disableWrapper,
- irq_enableWrapper, TICK_IRQ);
- if (rv != TC_PASS) {
- goto doneTests;
- }
-#endif
-
- rv = nanoCtxTaskTest();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- TC_PRINT("Spawning a fiber from a task\n");
- fiberEvidence = 0;
- task_fiber_start(fiberStack1, FIBER_STACKSIZE, fiberEntry,
- (int) sys_thread_self_get(), 0, FIBER_PRIORITY, 0);
-
- if (fiberEvidence != 1) {
- rv = TC_FAIL;
- TC_ERROR(" - fiber did not execute as expected!\n");
- goto doneTests;
- }
-
- /*
- * The fiber ran, now wake it so it can test sys_thread_self_get and
- * sys_execution_context_type_get.
- */
- TC_PRINT("Fiber to test sys_thread_self_get() and sys_execution_context_type_get\n");
- nano_task_sem_give(&wakeFiber);
-
- if (fiberDetectedError != 0) {
- rv = TC_FAIL;
- TC_ERROR(" - failure detected in fiber; fiberDetectedError = %d\n",
- fiberDetectedError);
- goto doneTests;
- }
-
- TC_PRINT("Fiber to test fiber_yield()\n");
- nano_task_sem_give(&wakeFiber);
-
- if (fiberDetectedError != 0) {
- rv = TC_FAIL;
- TC_ERROR(" - failure detected in fiber; fiberDetectedError = %d\n",
- fiberDetectedError);
- goto doneTests;
- }
-
- nano_task_sem_give(&wakeFiber);
-
- rv = test_timeout();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
-/* Cortex-M3/M4 does not implement connecting non-IRQ exception handlers */
-#if !defined(CONFIG_CPU_CORTEX_M3_M4)
- /*
- * Test divide by zero exception handler.
- *
- * WARNING: This code has been very carefully crafted so that it does
- * what it is supposed to. Both "error" and "excHandlerExecuted" must be
- * volatile to prevent the compiler from issuing a "divide by zero"
- * warning (since otherwise in knows "excHandlerExecuted" is zero),
- * and to ensure the compiler issues the two byte "idiv" instruction
- * that the exception handler is designed to deal with.
- */
-
- volatile int error; /* used to create a divide by zero error */
- TC_PRINT("Verifying exception handler installed\n");
- excHandlerExecuted = 0;
- error = error / excHandlerExecuted;
- TC_PRINT("excHandlerExecuted: %d\n", excHandlerExecuted);
-
- rv = (excHandlerExecuted == 1) ? TC_PASS : TC_FAIL;
-#endif
-
-doneTests:
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_context/testcase.ini b/samples/nanokernel/test/test_context/testcase.ini
deleted file mode 100644
index 9d02b99bc..000000000
--- a/samples/nanokernel/test/test_context/testcase.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[test]
-tags = core
-# FIXME: We need more expressive config filtering, see RTOS-476
-arch_whitelist = x86 arm
-
diff --git a/samples/nanokernel/test/test_errno/Makefile b/samples/nanokernel/test/test_errno/Makefile
deleted file mode 100644
index 6fe47af43..000000000
--- a/samples/nanokernel/test/test_errno/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj.conf
-
-
-include ${ZEPHYR_BASE}/Makefile.inc
diff --git a/samples/nanokernel/test/test_errno/README.txt b/samples/nanokernel/test/test_errno/README.txt
deleted file mode 100644
index 2cb844339..000000000
--- a/samples/nanokernel/test/test_errno/README.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-Title: Test errno
-
-Description:
-
-A simple application verifies the errno value is per-thread and saved during
-context switches.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-task, errno before starting fibers: abad1dea
-fiber 0, errno before sleep: babef00d
-fiber 1, errno before sleep: deadbeef
-fiber 1, errno after sleep: deadbeef
-fiber 0, errno after sleep: babef00d
-task, errno after running fibers: abad1dea
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_errno/prj.conf b/samples/nanokernel/test/test_errno/prj.conf
deleted file mode 100644
index 3f9e6db72..000000000
--- a/samples/nanokernel/test/test_errno/prj.conf
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_NANO_TIMEOUTS=y
diff --git a/samples/nanokernel/test/test_errno/src/Makefile b/samples/nanokernel/test/test_errno/src/Makefile
deleted file mode 100644
index f6830f904..000000000
--- a/samples/nanokernel/test/test_errno/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = main.o
diff --git a/samples/nanokernel/test/test_errno/src/main.c b/samples/nanokernel/test/test_errno/src/main.c
deleted file mode 100644
index 0f9a82103..000000000
--- a/samples/nanokernel/test/test_errno/src/main.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <errno.h>
-#include <tc_util.h>
-
-#define N_FIBERS 2
-
-#define STACK_SIZE 256
-static __stack char stacks[N_FIBERS][STACK_SIZE];
-
-static int errno_values[N_FIBERS + 1] = {
- 0xbabef00d,
- 0xdeadbeef,
- 0xabad1dea,
-};
-
-struct result {
- void *q;
- int pass;
-};
-
-struct result result[N_FIBERS];
-
-struct nano_fifo fifo;
-
-static void errno_fiber(int n, int my_errno)
-{
- errno = my_errno;
-
- printk("fiber %d, errno before sleep: %x\n", n, errno);
-
- fiber_sleep(3 - n);
- if (errno == my_errno) {
- result[n].pass = 1;
- }
-
- printk("fiber %d, errno after sleep: %x\n", n, errno);
-
- nano_fiber_fifo_put(&fifo, &result[n]);
-}
-
-void main(void)
-{
- int rv = TC_PASS;
-
- nano_fifo_init(&fifo);
-
- errno = errno_values[N_FIBERS];
-
- printk("task, errno before starting fibers: %x\n", errno);
-
- for (int ii = 0; ii < N_FIBERS; ii++) {
- result[ii].pass = TC_FAIL;
- }
-
- for (int ii = 0; ii < N_FIBERS; ii++) {
- task_fiber_start(stacks[ii], STACK_SIZE, errno_fiber,
- ii, errno_values[ii], ii + 5, 0);
- }
-
- for (int ii = 0; ii < N_FIBERS; ii++) {
- struct result *p = nano_task_fifo_get(&fifo, 10);
-
- if (!p || !p->pass) {
- rv = TC_FAIL;
- }
- }
-
- printk("task, errno after running fibers: %x\n", errno);
-
- if (errno != errno_values[N_FIBERS]) {
- rv = TC_FAIL;
- }
-
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-
- for (;;) {
- nano_cpu_idle();
- }
-}
diff --git a/samples/nanokernel/test/test_errno/testcase.ini b/samples/nanokernel/test/test_errno/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/nanokernel/test/test_errno/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/nanokernel/test/test_fifo/Makefile b/samples/nanokernel/test/test_fifo/Makefile
deleted file mode 100644
index 28e8a5ca8..000000000
--- a/samples/nanokernel/test/test_fifo/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj.conf
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_fifo/README.txt b/samples/nanokernel/test/test_fifo/README.txt
deleted file mode 100644
index 1c1ee5e9c..000000000
--- a/samples/nanokernel/test/test_fifo/README.txt
+++ /dev/null
@@ -1,121 +0,0 @@
-Title: FIFO APIs
-
-Description:
-
-This test verifies that the nanokernel FIFO APIs operate as expected.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel FIFO
-Test Task FIFO Put
-
-TASK FIFO Put Order: 001056dc, 00104ed4, 001046c0, 00103e80,
-===================================================================
-Test Fiber FIFO Get
-
-FIBER FIFO Get: count = 0, ptr is 001056dc
-FIBER FIFO Get: count = 1, ptr is 00104ed4
-FIBER FIFO Get: count = 2, ptr is 001046c0
-FIBER FIFO Get: count = 3, ptr is 00103e80
-PASS - fiber1.
-===================================================================
-Test Fiber FIFO Put
-
-FIBER FIFO Put Order: 00103e80, 001046c0, 00104ed4, 001056dc,
-===================================================================
-Test Task FIFO Get
-TASK FIFO Get: count = 0, ptr is 00103e80
-TASK FIFO Get: count = 1, ptr is 001046c0
-TASK FIFO Get: count = 2, ptr is 00104ed4
-TASK FIFO Get: count = 3, ptr is 001056dc
-===================================================================
-Test Task FIFO Get Wait Interfaces
-
-TASK FIFO Put to queue2: 001056dc
-Test Fiber FIFO Get Wait Interfaces
-
-FIBER FIFO Get from queue2: 001056dc
-FIBER FIFO Put to queue1: 00104ed4
-TASK FIFO Get from queue1: 00104ed4
-TASK FIFO Put to queue2: 001046c0
-FIBER FIFO Get from queue2: 001046c0
-FIBER FIFO Put to queue1: 00103e80
-PASS - testFiberFifoGetW.
-===================================================================
-Test ISR FIFO (invoked from Fiber)
-
-ISR FIFO Get from queue1: 00103e80
-
-ISR FIFO (running in fiber context) Put Order:
- 001056dc, 00104ed4, 001046c0, 00103e80,
-PASS - testIsrFifoFromFiber.
-PASS - fiber2.
-PASS - testTaskFifoGetW.
-===================================================================
-Test ISR FIFO (invoked from Task)
-
-Get from queue1: count = 0, ptr is 001056dc
-Get from queue1: count = 1, ptr is 00104ed4
-Get from queue1: count = 2, ptr is 001046c0
-Get from queue1: count = 3, ptr is 00103e80
-
-Test ISR FIFO (invoked from Task) - put 001056dc and get back 001056dc
-PASS - testIsrFifoFromTask.
-===================================================================
-test nano_task_fifo_get with timeout > 0
-nano_task_fifo_get timed out as expected
-nano_task_fifo_get got fifo in time, as expected
-testing timeouts of 5 fibers on same fifo
- got fiber (q order: 2, t/o: 10, fifo 200049c0) as expected
- got fiber (q order: 3, t/o: 15, fifo 200049c0) as expected
- got fiber (q order: 0, t/o: 20, fifo 200049c0) as expected
- got fiber (q order: 4, t/o: 25, fifo 200049c0) as expected
- got fiber (q order: 1, t/o: 30, fifo 200049c0) as expected
-testing timeouts of 9 fibers on different fifos
- got fiber (q order: 0, t/o: 10, fifo 200049cc) as expected
- got fiber (q order: 5, t/o: 15, fifo 200049c0) as expected
- got fiber (q order: 7, t/o: 20, fifo 200049c0) as expected
- got fiber (q order: 1, t/o: 25, fifo 200049c0) as expected
- got fiber (q order: 8, t/o: 30, fifo 200049cc) as expected
- got fiber (q order: 2, t/o: 35, fifo 200049c0) as expected
- got fiber (q order: 6, t/o: 40, fifo 200049c0) as expected
- got fiber (q order: 4, t/o: 45, fifo 200049cc) as expected
- got fiber (q order: 3, t/o: 50, fifo 200049cc) as expected
-testing 5 fibers timing out, but obtaining the data in time
-(except the last one, which times out)
- got fiber (q order: 0, t/o: 20, fifo 200049c0) as expected
- got fiber (q order: 1, t/o: 30, fifo 200049c0) as expected
- got fiber (q order: 2, t/o: 10, fifo 200049c0) as expected
- got fiber (q order: 3, t/o: 15, fifo 200049c0) as expected
- got fiber (q order: 4, t/o: 25, fifo 200049c0) as expected
-===================================================================
-PASS - test_timeout.
-===================================================================
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_fifo/prj.conf b/samples/nanokernel/test/test_fifo/prj.conf
deleted file mode 100644
index dfabafd11..000000000
--- a/samples/nanokernel/test/test_fifo/prj.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_NANO_TIMEOUTS=y
-CONFIG_ASSERT=y
-CONFIG_ASSERT_LEVEL=2
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/nanokernel/test/test_fifo/src/Makefile b/samples/nanokernel/test/test_fifo/src/Makefile
deleted file mode 100644
index 5836fd486..000000000
--- a/samples/nanokernel/test/test_fifo/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-ccflags-$(CONFIG_SOC_QUARK_D2000) += -DFIBER_STACKSIZE=256
-
-obj-y = fifo.o fifo_timeout.o
diff --git a/samples/nanokernel/test/test_fifo/src/fifo.c b/samples/nanokernel/test/test_fifo/src/fifo.c
deleted file mode 100644
index 21b409014..000000000
--- a/samples/nanokernel/test/test_fifo/src/fifo.c
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file
- * @brief Test nanokernel FIFO APIs
- *
- * This module tests four basic scenarios with the usage of the following FIFO
- * routines:
- *
- * nano_fiber_fifo_get, nano_fiber_fifo_put
- * nano_task_fifo_get, nano_task_fifo_put
- * nano_isr_fifo_get, nano_isr_fifo_put
- *
- * Scenario #1
- * Task enters items into a queue, starts the fiber and waits for a semaphore.
- * Fiber extracts all items from the queue and enters some items back into
- * the queue. Fiber gives the semaphore for task to continue. Once the control
- * is returned back to task, task extracts all items from the queue.
-
- * Scenario #2
- * Task enters an item into queue2, starts a fiber and extract an item from
- * queue1 once the item is there. The fiber will extract an item from queue2
- * once the item is there and and enter an item to queue1. The flow of control
- * goes from task to fiber and so forth.
-
- * Scenario #3
- * Tests the ISR interfaces. Function testIsrFifoFromFiber gets an item from
- * the fifo queue in ISR context. It then enters four items into the queue
- * and finishes execution. Control is returned back to function
- * testTaskFifoGetW which also finished it's execution and returned to main.
- * Finally function testIsrFifoFromTask is run and it gets all data from
- * the queue and puts and gets one last item to the queue. All these are run
- * in ISR context.
- *
- * Scenario #4:
- * Timeout scenarios with multiple FIFOs and fibers.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <misc/__assert.h>
-#include <misc/util.h>
-#include <irq_offload.h>
-
-#include <util_test_common.h>
-
-#ifndef FIBER_STACKSIZE
-#define FIBER_STACKSIZE 2048
-#endif
-#define NUM_FIFO_ELEMENT 4
-#define INVALID_DATA NULL
-
-#define TCERR1(count) TC_ERROR("Didn't get back correct FIFO, count %d\n", count)
-#define TCERR2 TC_ERROR("Didn't get back correct FIFO\n")
-#define TCERR3 TC_ERROR("The queue should be empty!\n")
-
-typedef struct {
- struct nano_fifo *fifo_ptr; /* FIFO */
- void *data; /* pointer to data to add */
-} ISR_FIFO_INFO;
-
-char __stack fiberStack1[FIBER_STACKSIZE];
-char __stack fiberStack2[FIBER_STACKSIZE];
-char __stack fiberStack3[FIBER_STACKSIZE];
-
-struct nano_fifo nanoFifoObj;
-struct nano_fifo nanoFifoObj2;
-
-struct nano_sem nanoSemObj1; /* Used to block/wake-up fiber1 */
-struct nano_sem nanoSemObj2; /* Used to block/wake-up fiber2 */
-struct nano_sem nanoSemObj3; /* Used to block/wake-up fiber3 */
-struct nano_sem nanoSemObjTask; /* Used to block/wake-up task */
-
-struct nano_timer timer;
-void *timerData[1];
-
-int myFifoData1[4];
-int myFifoData2[2];
-int myFifoData3[4];
-int myFifoData4[2];
-
-void * const pMyFifoData1 = (void *)myFifoData1;
-void * const pMyFifoData2 = (void *)myFifoData2;
-void * const pMyFifoData3 = (void *)myFifoData3;
-void * const pMyFifoData4 = (void *)myFifoData4;
-
-void * const pPutList1[NUM_FIFO_ELEMENT] = {
- (void *)myFifoData1,
- (void *)myFifoData2,
- (void *)myFifoData3,
- (void *)myFifoData4
- };
-
-void * const pPutList2[NUM_FIFO_ELEMENT] = {
- (void *)myFifoData4,
- (void *)myFifoData3,
- (void *)myFifoData2,
- (void *)myFifoData1
- };
-
-int retCode = TC_PASS;
-
-static ISR_FIFO_INFO isrFifoInfo = {&nanoFifoObj, NULL};
-
-void fiber1(void);
-void fiber2(void);
-void fiber3(void);
-
-void initNanoObjects(void);
-void testTaskFifoGetW(void);
-
-extern int test_fifo_timeout(void);
-
-/**
- *
- * @brief Add an item to a FIFO
- *
- * This routine is the ISR handler for _trigger_nano_isr_fifo_put(). It adds
- * an item to the FIFO in the context of an ISR.
- *
- * @param parameter pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_fifo_put(void *parameter)
-{
- ISR_FIFO_INFO *pInfo = (ISR_FIFO_INFO *) parameter;
-
- nano_isr_fifo_put(pInfo->fifo_ptr, pInfo->data);
-}
-
-static void _trigger_nano_isr_fifo_put(void)
-{
- irq_offload(isr_fifo_put, &isrFifoInfo);
-}
-
-
-/**
- *
- * @brief Get an item from a FIFO
- *
- * This routine is the ISR handler for _trigger_nano_isr_fifo_get(). It gets
- * an item from the FIFO in the context of an ISR.
- *
- * @param parameter pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_fifo_get(void *parameter)
-{
- ISR_FIFO_INFO *pInfo = (ISR_FIFO_INFO *) parameter;
-
- pInfo->data = nano_isr_fifo_get(pInfo->fifo_ptr, TICKS_NONE);
-}
-
-static void _trigger_nano_isr_fifo_get(void)
-{
- irq_offload(isr_fifo_get, &isrFifoInfo);
-}
-
-/**
- *
- * @brief Entry point for the first fiber
- *
- * @return N/A
- */
-
-void fiber1(void)
-{
- void *pData; /* pointer to FIFO object get from the queue */
- int count = 0; /* counter */
-
- /* Wait for fiber1 to be activated. */
- nano_fiber_sem_take(&nanoSemObj1, TICKS_UNLIMITED);
-
- /* Wait for data to be added to <nanoFifoObj> by task */
- pData = nano_fiber_fifo_get(&nanoFifoObj, TICKS_UNLIMITED);
- if (pData != pPutList1[0]) {
- TC_ERROR("fiber1 (1) - expected 0x%x, got 0x%x\n",
- pPutList1[0], pData);
- retCode = TC_FAIL;
- return;
- }
-
- /* Wait for data to be added to <nanoFifoObj2> by fiber3 */
- pData = nano_fiber_fifo_get(&nanoFifoObj2, TICKS_UNLIMITED);
- if (pData != pPutList2[0]) {
- TC_ERROR("fiber1 (2) - expected 0x%x, got 0x%x\n",
- pPutList2[0], pData);
- retCode = TC_FAIL;
- return;
- }
-
- /* Wait for fiber1 to be reactivated */
- nano_fiber_sem_take(&nanoSemObj1, TICKS_UNLIMITED);
-
- TC_PRINT("Test Fiber FIFO Get\n\n");
- /* Get all FIFOs */
- while ((pData = nano_fiber_fifo_get(&nanoFifoObj, TICKS_NONE)) != NULL) {
- TC_PRINT("FIBER FIFO Get: count = %d, ptr is %p\n", count, pData);
- if ((count >= NUM_FIFO_ELEMENT) || (pData != pPutList1[count])) {
- TCERR1(count);
- retCode = TC_FAIL;
- return;
- }
- count++;
- }
-
- TC_END_RESULT(retCode);
- PRINT_LINE;
-
- /*
- * Entries in the FIFO queue have to be unique.
- * Put data.
- */
- TC_PRINT("Test Fiber FIFO Put\n");
- TC_PRINT("\nFIBER FIFO Put Order: ");
- for (int i=0; i<NUM_FIFO_ELEMENT; i++) {
- nano_fiber_fifo_put(&nanoFifoObj, pPutList2[i]);
- TC_PRINT(" %p,", pPutList2[i]);
- }
- TC_PRINT("\n");
- PRINT_LINE;
-
- /* Give semaphore to allow the main task to run */
- nano_fiber_sem_give(&nanoSemObjTask);
-
-} /* fiber1 */
-
-
-/**
- *
- * @brief Test the nano_fiber_fifo_get(TICKS_UNLIMITED) interface
- *
- * This function tests the fifo put and get wait interfaces in a fiber.
- * It gets data from nanoFifoObj2 queue and puts data to nanoFifoObj queue.
- *
- * @return N/A
- */
-
-void testFiberFifoGetW(void)
-{
- void *pGetData; /* pointer to FIFO object get from the queue */
- void *pPutData; /* pointer to FIFO object to put to the queue */
-
- TC_PRINT("Test Fiber FIFO Get Wait Interfaces\n\n");
- pGetData = nano_fiber_fifo_get(&nanoFifoObj2, TICKS_UNLIMITED);
- TC_PRINT("FIBER FIFO Get from queue2: %p\n", pGetData);
- /* Verify results */
- if (pGetData != pMyFifoData1) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- pPutData = pMyFifoData2;
- TC_PRINT("FIBER FIFO Put to queue1: %p\n", pPutData);
- nano_fiber_fifo_put(&nanoFifoObj, pPutData);
-
- pGetData = nano_fiber_fifo_get(&nanoFifoObj2, TICKS_UNLIMITED);
- TC_PRINT("FIBER FIFO Get from queue2: %p\n", pGetData);
- /* Verify results */
- if (pGetData != pMyFifoData3) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- pPutData = pMyFifoData4;
- TC_PRINT("FIBER FIFO Put to queue1: %p\n", pPutData);
- nano_fiber_fifo_put(&nanoFifoObj, pPutData);
-
- TC_END_RESULT(retCode);
-
-} /* testFiberFifoGetW */
-
-
-/**
- *
- * @brief Test ISR FIFO routines (triggered from fiber)
- *
- * This function tests the fifo put and get interfaces in the ISR context.
- * It is invoked from a fiber.
- *
- * We use nanoFifoObj queue to put and get data.
- *
- * @return N/A
- */
-
-void testIsrFifoFromFiber(void)
-{
- void *pGetData; /* pointer to FIFO object get from the queue */
-
- TC_PRINT("Test ISR FIFO (invoked from Fiber)\n\n");
-
- /* This is data pushed by function testFiberFifoGetW */
- _trigger_nano_isr_fifo_get();
- pGetData = isrFifoInfo.data;
-
- TC_PRINT("ISR FIFO Get from queue1: %p\n", pGetData);
- if (isrFifoInfo.data != pMyFifoData4) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- /* Verify that the queue is empty */
- _trigger_nano_isr_fifo_get();
- pGetData = isrFifoInfo.data;
-
- if (pGetData != NULL) {
- TC_PRINT("Get from queue1: %p\n", pGetData);
- retCode = TC_FAIL;
- TCERR3;
- return;
- }
-
- /* Put more item into queue */
- TC_PRINT("\nISR FIFO (running in fiber) Put Order:\n");
- for (int i=0; i<NUM_FIFO_ELEMENT; i++) {
- isrFifoInfo.data = pPutList1[i];
- TC_PRINT(" %p,", pPutList1[i]);
- _trigger_nano_isr_fifo_put();
- }
- TC_PRINT("\n");
-
- TC_END_RESULT(retCode);
-
-} /* testIsrFifoFromFiber */
-
-
-/**
- *
- * @brief Test ISR FIFO routines (triggered from task)
- *
- * This function tests the fifo put and get interfaces in the ISR context.
- * It is invoked from a task.
- *
- * We use nanoFifoObj queue to put and get data.
- *
- * @return N/A
- */
-
-void testIsrFifoFromTask(void)
-{
- void *pGetData; /* pointer to FIFO object get from the queue */
- void *pPutData; /* pointer to FIFO object put to queue */
- int count = 0; /* counter */
-
- TC_PRINT("Test ISR FIFO (invoked from Task)\n\n");
-
- /* This is data pushed by function testIsrFifoFromFiber
- * Get all FIFOs
- */
- _trigger_nano_isr_fifo_get();
- pGetData = isrFifoInfo.data;
-
- while (pGetData != NULL) {
- TC_PRINT("Get from queue1: count = %d, ptr is %p\n", count, pGetData);
- if ((count >= NUM_FIFO_ELEMENT) || (pGetData != pPutList1[count])) {
- TCERR1(count);
- retCode = TC_FAIL;
- return;
- }
-
- /* Get the next element */
- _trigger_nano_isr_fifo_get();
- pGetData = isrFifoInfo.data;
- count++;
- } /* while */
-
-
- /* Put data into queue and get it again */
- pPutData = pPutList2[3];
-
- isrFifoInfo.data = pPutData;
- _trigger_nano_isr_fifo_put();
- isrFifoInfo.data = NULL; /* force data to a new value */
- /* Get data from queue */
- _trigger_nano_isr_fifo_get();
- pGetData = isrFifoInfo.data;
- /* Verify data */
- if (pGetData != pPutData) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- } else {
- TC_PRINT("\nTest ISR FIFO (invoked from Task) - put %p and get back %p\n",
- pPutData, pGetData);
- }
-
- TC_END_RESULT(retCode);
-} /* testIsrFifoFromTask */
-
-/**
- *
- * @brief Entry point for the second fiber
- *
- * @return N/A
- */
-
-void fiber2(void)
-{
- void *pData; /* pointer to FIFO object from the queue */
-
- /* Wait for fiber2 to be activated */
-
- nano_fiber_sem_take(&nanoSemObj2, TICKS_UNLIMITED);
-
- /* Wait for data to be added to <nanoFifoObj> */
- pData = nano_fiber_fifo_get(&nanoFifoObj, TICKS_UNLIMITED);
- if (pData != pPutList1[1]) {
- TC_ERROR("fiber2 (1) - expected 0x%x, got 0x%x\n",
- pPutList1[1], pData);
- retCode = TC_FAIL;
- return;
- }
-
- /* Wait for data to be added to <nanoFifoObj2> by fiber3 */
- pData = nano_fiber_fifo_get(&nanoFifoObj2, TICKS_UNLIMITED);
- if (pData != pPutList2[1]) {
- TC_ERROR("fiber2 (2) - expected 0x%x, got 0x%x\n",
- pPutList2[1], pData);
- retCode = TC_FAIL;
- return;
- }
-
- /* Wait for fiber2 to be reactivated */
- nano_fiber_sem_take(&nanoSemObj2, TICKS_UNLIMITED);
-
- /* Fiber #2 has been reactivated by main task */
- for (int i = 0; i < 4; i++) {
- pData = nano_fiber_fifo_get(&nanoFifoObj, TICKS_UNLIMITED);
- if (pData != pPutList1[i]) {
- TC_ERROR("fiber2 (3) - iteration %d expected 0x%x, got 0x%x\n",
- i, pPutList1[i], pData);
- retCode = TC_FAIL;
- return;
- }
- }
-
- nano_fiber_sem_give(&nanoSemObjTask); /* Wake main task */
- /* Wait for fiber2 to be reactivated */
- nano_fiber_sem_take(&nanoSemObj2, TICKS_UNLIMITED);
-
- testFiberFifoGetW();
- PRINT_LINE;
- testIsrFifoFromFiber();
-
- TC_END_RESULT(retCode);
-} /* fiber2 */
-
-/**
- *
- * @brief Entry point for the third fiber
- *
- * @return N/A
- */
-
-void fiber3(void)
-{
- void *pData;
-
- /* Wait for fiber3 to be activated */
- nano_fiber_sem_take(&nanoSemObj3, TICKS_UNLIMITED);
-
- /* Put two items onto <nanoFifoObj2> to unblock fibers #1 and #2. */
- nano_fiber_fifo_put(&nanoFifoObj2, pPutList2[0]); /* Wake fiber1 */
- nano_fiber_fifo_put(&nanoFifoObj2, pPutList2[1]); /* Wake fiber2 */
-
- /* Wait for fiber3 to be re-activated */
- nano_fiber_sem_take(&nanoSemObj3, TICKS_UNLIMITED);
-
- /* Immediately get the data from <nanoFifoObj2>. */
- pData = nano_fiber_fifo_get(&nanoFifoObj2, TICKS_UNLIMITED);
- if (pData != pPutList2[0]) {
- retCode = TC_FAIL;
- TC_ERROR("fiber3 (1) - got 0x%x from <nanoFifoObj2>, expected 0x%x\n",
- pData, pPutList2[0]);
- }
-
- /* Put three items onto the FIFO for the task to get */
- nano_fiber_fifo_put(&nanoFifoObj2, pPutList2[0]);
- nano_fiber_fifo_put(&nanoFifoObj2, pPutList2[1]);
- nano_fiber_fifo_put(&nanoFifoObj2, pPutList2[2]);
-
- /* Sleep for 2 seconds */
- nano_fiber_timer_start(&timer, SECONDS(2));
- nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
-
- /* Put final item onto the FIFO for the task to get */
- nano_fiber_fifo_put(&nanoFifoObj2, pPutList2[3]);
-
- /* Wait for fiber3 to be re-activated (not expected to occur) */
- nano_fiber_sem_take(&nanoSemObj3, TICKS_UNLIMITED);
-}
-
-
-/**
- *
- * @brief Test the nano_task_fifo_get(TICKS_UNLIMITED) interface
- *
- * This is in a task. It puts data to nanoFifoObj2 queue and gets
- * data from nanoFifoObj queue.
- *
- * @return N/A
- */
-
-void testTaskFifoGetW(void)
-{
- void *pGetData; /* pointer to FIFO object get from the queue */
- void *pPutData; /* pointer to FIFO object to put to the queue */
-
- PRINT_LINE;
- TC_PRINT("Test Task FIFO Get Wait Interfaces\n\n");
- pPutData = pMyFifoData1;
- TC_PRINT("TASK FIFO Put to queue2: %p\n", pPutData);
- nano_task_fifo_put(&nanoFifoObj2, pPutData);
-
- /* Activate fiber2 */
- nano_task_sem_give(&nanoSemObj2);
-
- pGetData = nano_task_fifo_get(&nanoFifoObj, TICKS_UNLIMITED);
- TC_PRINT("TASK FIFO Get from queue1: %p\n", pGetData);
- /* Verify results */
- if (pGetData != pMyFifoData2) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- pPutData = pMyFifoData3;
- TC_PRINT("TASK FIFO Put to queue2: %p\n", pPutData);
- nano_task_fifo_put(&nanoFifoObj2, pPutData);
-
- TC_END_RESULT(retCode);
-} /* testTaskFifoGetW */
-
-/**
- *
- * @brief Initialize nanokernel objects
- *
- * This routine initializes the nanokernel objects used in the FIFO tests.
- *
- * @return N/A
- */
-
-void initNanoObjects(void)
-{
- nano_fifo_init(&nanoFifoObj);
- nano_fifo_init(&nanoFifoObj2);
-
- nano_sem_init(&nanoSemObj1);
- nano_sem_init(&nanoSemObj2);
- nano_sem_init(&nanoSemObj3);
- nano_sem_init(&nanoSemObjTask);
-
- nano_timer_init(&timer, timerData);
-
-} /* initNanoObjects */
-
-/**
- *
- * @brief Entry point to FIFO tests
- *
- * This is the entry point to the FIFO tests.
- *
- * @return N/A
- */
-
-void main(void)
-{
- void *pData; /* pointer to FIFO object get from the queue */
- int count = 0; /* counter */
-
- TC_START("Test Nanokernel FIFO");
-
- /* Initialize the FIFO queues and semaphore */
- initNanoObjects();
-
- /* Create and start the three (3) fibers. */
-
- task_fiber_start(&fiberStack1[0], FIBER_STACKSIZE, (nano_fiber_entry_t) fiber1,
- 0, 0, 7, 0);
-
- task_fiber_start(&fiberStack2[0], FIBER_STACKSIZE, (nano_fiber_entry_t) fiber2,
- 0, 0, 7, 0);
-
- task_fiber_start(&fiberStack3[0], FIBER_STACKSIZE, (nano_fiber_entry_t) fiber3,
- 0, 0, 7, 0);
-
- /*
- * The three fibers have each blocked on a different semaphore. Giving
- * the semaphore nanoSemObjX will unblock fiberX (where X = {1, 2, 3}).
- *
- * Activate fibers #1 and #2. They will each block on nanoFifoObj.
- */
-
- nano_task_sem_give(&nanoSemObj1);
- nano_task_sem_give(&nanoSemObj2);
-
- /* Put two items into <nanoFifoObj> to unblock fibers #1 and #2. */
- nano_task_fifo_put(&nanoFifoObj, pPutList1[0]); /* Wake fiber1 */
- nano_task_fifo_put(&nanoFifoObj, pPutList1[1]); /* Wake fiber2 */
-
- /* Activate fiber #3 */
- nano_task_sem_give(&nanoSemObj3);
-
- /*
- * All three fibers should be blocked on their semaphores. Put data into
- * <nanoFifoObj2>. Fiber #3 will read it after it is reactivated.
- */
-
- nano_task_fifo_put(&nanoFifoObj2, pPutList2[0]);
- nano_task_sem_give(&nanoSemObj3); /* Reactivate fiber #3 */
-
- for (int i = 0; i < 4; i++) {
- pData = nano_task_fifo_get(&nanoFifoObj2, TICKS_UNLIMITED);
- if (pData != pPutList2[i]) {
- TC_ERROR("nano_task_fifo_get() expected 0x%x, got 0x%x\n",
- pPutList2[i], pData);
- goto exit;
- }
- }
-
- /* Add items to <nanoFifoObj> for fiber #2 */
- for (int i = 0; i < 4; i++) {
- nano_task_fifo_put(&nanoFifoObj, pPutList1[i]);
- }
-
- nano_task_sem_give(&nanoSemObj2); /* Activate fiber #2 */
-
- /* Wait for fibers to finish */
- nano_task_sem_take(&nanoSemObjTask, TICKS_UNLIMITED);
-
- if (retCode == TC_FAIL) {
- goto exit;
- }
-
- /*
- * Entries in the FIFO queue have to be unique.
- * Put data to queue.
- */
-
- TC_PRINT("Test Task FIFO Put\n");
- TC_PRINT("\nTASK FIFO Put Order: ");
- for (int i=0; i<NUM_FIFO_ELEMENT; i++) {
- nano_task_fifo_put(&nanoFifoObj, pPutList1[i]);
- TC_PRINT(" %p,", pPutList1[i]);
- }
- TC_PRINT("\n");
-
- PRINT_LINE;
-
- nano_task_sem_give(&nanoSemObj1); /* Activate fiber1 */
-
- if (retCode == TC_FAIL) {
- goto exit;
- }
-
- /*
- * Wait for fiber1 to complete execution. (Using a semaphore gives
- * the fiber the freedom to do blocking-type operations if it wants to.)
- */
- nano_task_sem_take(&nanoSemObjTask, TICKS_UNLIMITED);
-
- TC_PRINT("Test Task FIFO Get\n");
-
- /* Get all FIFOs */
- while ((pData = nano_task_fifo_get(&nanoFifoObj, TICKS_NONE)) != NULL) {
- TC_PRINT("TASK FIFO Get: count = %d, ptr is %p\n", count, pData);
- if ((count >= NUM_FIFO_ELEMENT) || (pData != pPutList2[count])) {
- TCERR1(count);
- retCode = TC_FAIL;
- goto exit;
- }
- count++;
- }
-
- /* Test FIFO Get Wait interfaces*/
- testTaskFifoGetW();
- PRINT_LINE;
-
- testIsrFifoFromTask();
- PRINT_LINE;
-
- /* test timeouts */
- if (test_fifo_timeout() != TC_PASS) {
- retCode = TC_FAIL;
- goto exit;
- }
- PRINT_LINE;
-
-exit:
- TC_END_RESULT(retCode);
- TC_END_REPORT(retCode);
-}
diff --git a/samples/nanokernel/test/test_fifo/src/fifo_timeout.c b/samples/nanokernel/test/test_fifo/src/fifo_timeout.c
deleted file mode 100644
index 32d5aa00d..000000000
--- a/samples/nanokernel/test/test_fifo/src/fifo_timeout.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * Copyright (c) 2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <misc/__assert.h>
-#include <misc/util.h>
-
-/* timeout tests
- *
- * Test the nano_xxx_fifo_wait_timeout() APIs.
- *
- * First, the task waits with a timeout and times out. Then it wait with a
- * timeout, but gets the data in time.
- *
- * Then, multiple timeout tests are done for the fibers, to test the ordering
- * of queueing/dequeueing when timeout occurs, first on one fifo, then on
- * multiple fifos.
- *
- * Finally, multiple fibers pend on one fifo, and they all get the
- * data in time, except the last one: this tests that the timeout is
- * recomputed correctly when timeouts are aborted.
- */
-
-#include <tc_nano_timeout_common.h>
-
-#define FIBER_PRIORITY 5
-#ifndef FIBER_STACKSIZE
-#define FIBER_STACKSIZE 2048
-#endif
-
-struct scratch_fifo_packet {
- void *link_in_fifo;
- void *data_if_needed;
-};
-
-struct reply_packet {
- void *link_in_fifo;
- int reply;
-};
-
-#define NUM_SCRATCH_FIFO_PACKETS 20
-struct scratch_fifo_packet scratch_fifo_packets[NUM_SCRATCH_FIFO_PACKETS];
-
-struct nano_fifo scratch_fifo_packets_fifo;
-
-void *get_scratch_packet(void)
-{
- void *packet = nano_fifo_get(&scratch_fifo_packets_fifo, TICKS_NONE);
-
- __ASSERT_NO_MSG(packet);
-
- return packet;
-}
-
-void put_scratch_packet(void *packet)
-{
- nano_fifo_put(&scratch_fifo_packets_fifo, packet);
-}
-
-static struct nano_fifo fifo_timeout[2];
-struct nano_fifo timeout_order_fifo;
-
-struct timeout_order_data {
- void *link_in_fifo;
- struct nano_fifo *fifo;
- int32_t timeout;
- int timeout_order;
- int q_order;
-};
-
-
-struct timeout_order_data timeout_order_data[] = {
- {0, &fifo_timeout[0], TIMEOUT(2), 2, 0},
- {0, &fifo_timeout[0], TIMEOUT(4), 4, 1},
- {0, &fifo_timeout[0], TIMEOUT(0), 0, 2},
- {0, &fifo_timeout[0], TIMEOUT(1), 1, 3},
- {0, &fifo_timeout[0], TIMEOUT(3), 3, 4},
-};
-
-struct timeout_order_data timeout_order_data_mult_fifo[] = {
- {0, &fifo_timeout[1], TIMEOUT(0), 0, 0},
- {0, &fifo_timeout[0], TIMEOUT(3), 3, 1},
- {0, &fifo_timeout[0], TIMEOUT(5), 5, 2},
- {0, &fifo_timeout[1], TIMEOUT(8), 8, 3},
- {0, &fifo_timeout[1], TIMEOUT(7), 7, 4},
- {0, &fifo_timeout[0], TIMEOUT(1), 1, 5},
- {0, &fifo_timeout[0], TIMEOUT(6), 6, 6},
- {0, &fifo_timeout[0], TIMEOUT(2), 2, 7},
- {0, &fifo_timeout[1], TIMEOUT(4), 4, 8},
-};
-
-#define TIMEOUT_ORDER_NUM_FIBERS ARRAY_SIZE(timeout_order_data_mult_fifo)
-static char __stack timeout_stacks[TIMEOUT_ORDER_NUM_FIBERS][FIBER_STACKSIZE];
-
-/* a fiber sleeps then puts data on the fifo */
-static void test_fiber_put_timeout(int fifo, int timeout)
-{
- fiber_sleep((int32_t)timeout);
- nano_fiber_fifo_put((struct nano_fifo *)fifo, get_scratch_packet());
-}
-
-/* a fiber pends on a fifo then times out */
-static void test_fiber_pend_and_timeout(int data, int unused)
-{
- struct timeout_order_data *d = (void *)data;
- int32_t orig_ticks = sys_tick_get();
- void *packet;
-
- ARG_UNUSED(unused);
-
- packet = nano_fiber_fifo_get(d->fifo, d->timeout);
- if (packet) {
- TC_ERROR(" *** timeout of %d did not time out.\n",
- d->timeout);
- return;
- }
- if (!is_timeout_in_range(orig_ticks, d->timeout)) {
- return;
- }
-
- nano_fiber_fifo_put(&timeout_order_fifo, d);
-}
-
-/* the task spins several fibers that pend and timeout on fifos */
-static int test_multiple_fibers_pending(struct timeout_order_data *test_data,
- int test_data_size)
-{
- int ii;
-
- for (ii = 0; ii < test_data_size; ii++) {
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_timeout,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
- }
-
- for (ii = 0; ii < test_data_size; ii++) {
- struct timeout_order_data *data =
- nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
-
- if (data->timeout_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, fifo %p) as expected\n",
- data->q_order, data->timeout, data->fifo);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/* a fiber pends on a fifo with a timeout and gets the data in time */
-static void test_fiber_pend_and_get_data(int data, int unused)
-{
- struct timeout_order_data *d = (void *)data;
- void *packet;
-
- ARG_UNUSED(unused);
-
- packet = nano_fiber_fifo_get(d->fifo, d->timeout);
- if (!packet) {
- TC_PRINT(" *** fiber (q order: %d, t/o: %d, fifo %p) timed out!\n",
- d->q_order, d->timeout, d->fifo);
- return;
- }
-
- put_scratch_packet(packet);
- nano_fiber_fifo_put(&timeout_order_fifo, d);
-}
-
-/* the task spins fibers that get fifo data in time, except the last one */
-static int test_multiple_fibers_get_data(struct timeout_order_data *test_data,
- int test_data_size)
-{
- struct timeout_order_data *data;
- int ii;
-
- for (ii = 0; ii < test_data_size-1; ii++) {
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_get_data,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
- }
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_timeout,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
-
- for (ii = 0; ii < test_data_size-1; ii++) {
-
- nano_task_fifo_put(test_data[ii].fifo, get_scratch_packet());
-
- data = nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
-
- if (data->q_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, fifo %p) as expected\n",
- data->q_order, data->timeout, data->fifo);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->q_order, ii);
- return TC_FAIL;
- }
- }
-
- data = nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
- if (data->q_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, fifo %p) as expected\n",
- data->q_order, data->timeout, data->fifo);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/* try getting data on fifo with special timeout value, return result in fifo */
-static void test_fiber_ticks_special_values(int packet, int special_value)
-{
- struct reply_packet *reply_packet = (void *)packet;
-
- reply_packet->reply =
- !!nano_fiber_fifo_get(&fifo_timeout[0], special_value);
-
- nano_fiber_fifo_put(&timeout_order_fifo, reply_packet);
-}
-
-/* the timeout test entry point */
-int test_fifo_timeout(void)
-{
- int64_t orig_ticks;
- int32_t timeout;
- int rv;
- void *packet, *scratch_packet;
- int test_data_size;
- int ii;
- struct reply_packet reply_packet;
-
- nano_fifo_init(&fifo_timeout[0]);
- nano_fifo_init(&fifo_timeout[1]);
- nano_fifo_init(&timeout_order_fifo);
- nano_fifo_init(&scratch_fifo_packets_fifo);
-
- for (ii = 0; ii < NUM_SCRATCH_FIFO_PACKETS; ii++) {
- scratch_fifo_packets[ii].data_if_needed = (void *)ii;
- nano_task_fifo_put(&scratch_fifo_packets_fifo,
- &scratch_fifo_packets[ii]);
- }
-
- /* test nano_task_fifo_get() with timeout */
- timeout = 10;
- orig_ticks = sys_tick_get();
- packet = nano_task_fifo_get(&fifo_timeout[0], timeout);
- if (packet) {
- TC_ERROR(" *** timeout of %d did not time out.\n", timeout);
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
- if ((sys_tick_get() - orig_ticks) < timeout) {
- TC_ERROR(" *** task did not wait long enough on timeout of %d.\n",
- timeout);
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- /* test nano_task_fifo_get with timeout of 0 */
-
- packet = nano_task_fifo_get(&fifo_timeout[0], 0);
- if (packet) {
- TC_ERROR(" *** timeout of 0 did not time out.\n");
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- /* test nano_task_fifo_get with timeout > 0 */
-
- TC_PRINT("test nano_task_fifo_get with timeout > 0\n");
-
- timeout = 3;
- orig_ticks = sys_tick_get();
-
- packet = nano_task_fifo_get(&fifo_timeout[0], timeout);
-
- if (packet) {
- TC_ERROR(" *** timeout of %d did not time out.\n",
- timeout);
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- TC_PRINT("nano_task_fifo_get timed out as expected\n");
-
- /*
- * test nano_task_fifo_get with a timeout and fiber that puts
- * data on the fifo on time
- */
-
- timeout = 5;
- orig_ticks = sys_tick_get();
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_put_timeout, (int)&fifo_timeout[0],
- timeout,
- FIBER_PRIORITY, 0);
-
- packet = nano_task_fifo_get(&fifo_timeout[0],
- (int)(timeout + 5));
- if (!packet) {
- TC_ERROR(" *** data put in time did not return valid pointer.\n");
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- put_scratch_packet(packet);
-
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- TC_PRINT("nano_task_fifo_get got fifo in time, as expected\n");
-
- /*
- * test nano_task_fifo_get with TICKS_NONE and no data
- * unavailable.
- */
-
- if (nano_task_fifo_get(&fifo_timeout[0], TICKS_NONE)) {
- TC_ERROR("task with TICKS_NONE got data, but shouldn't have\n");
- return TC_FAIL;
- }
-
- TC_PRINT("task with TICKS_NONE did not get data, as expected\n");
-
- /*
- * test nano_task_fifo_get with TICKS_NONE and some data
- * available.
- */
-
- scratch_packet = get_scratch_packet();
- nano_task_fifo_put(&fifo_timeout[0], scratch_packet);
- if (!nano_task_fifo_get(&fifo_timeout[0], TICKS_NONE)) {
- TC_ERROR("task with TICKS_NONE did not get available data\n");
- return TC_FAIL;
- }
- put_scratch_packet(scratch_packet);
-
- TC_PRINT("task with TICKS_NONE got available data, as expected\n");
-
- /*
- * test nano_task_fifo_get with TICKS_UNLIMITED and the
- * data available.
- */
-
- TC_PRINT("Trying to take available data with TICKS_UNLIMITED:\n"
- " will hang the test if it fails.\n");
-
- scratch_packet = get_scratch_packet();
- nano_task_fifo_put(&fifo_timeout[0], scratch_packet);
- if (!nano_task_fifo_get(&fifo_timeout[0], TICKS_UNLIMITED)) {
- TC_ERROR(" *** This will never be hit!!! .\n");
- return TC_FAIL;
- }
- put_scratch_packet(scratch_packet);
-
- TC_PRINT("task with TICKS_UNLIMITED got available data, as expected\n");
-
- /* test fiber with timeout of TICKS_NONE not getting data on empty fifo */
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_NONE, FIBER_PRIORITY, 0);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 0) {
- TC_ERROR(" *** fiber should not have obtained the data.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_NONE did not get data, as expected\n");
-
- /* test fiber with timeout of TICKS_NONE getting data when available */
-
- scratch_packet = get_scratch_packet();
- nano_task_fifo_put(&fifo_timeout[0], scratch_packet);
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_NONE, FIBER_PRIORITY, 0);
- put_scratch_packet(scratch_packet);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 1) {
- TC_ERROR(" *** fiber should have obtained the data.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_NONE got available data, as expected\n");
-
- /* test fiber with TICKS_UNLIMITED timeout getting data when availalble */
-
- scratch_packet = get_scratch_packet();
- nano_task_fifo_put(&fifo_timeout[0], scratch_packet);
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_UNLIMITED, FIBER_PRIORITY, 0);
- put_scratch_packet(scratch_packet);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 1) {
- TC_ERROR(" *** fiber should have obtained the data.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_UNLIMITED got available data, as expected\n");
-
- /* test multiple fibers pending on the same fifo with different timeouts */
-
- test_data_size = ARRAY_SIZE(timeout_order_data);
-
- TC_PRINT("testing timeouts of %d fibers on same fifo\n", test_data_size);
-
- rv = test_multiple_fibers_pending(timeout_order_data, test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not time out in the right order\n");
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- /* test mult. fibers pending on different fifos with different timeouts */
-
- test_data_size = ARRAY_SIZE(timeout_order_data_mult_fifo);
-
- TC_PRINT("testing timeouts of %d fibers on different fifos\n",
- test_data_size);
-
- rv = test_multiple_fibers_pending(timeout_order_data_mult_fifo,
- test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not time out in the right order\n");
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- /*
- * test multiple fibers pending on same fifo with different timeouts, but
- * getting the data in time, except the last one.
- */
-
- test_data_size = ARRAY_SIZE(timeout_order_data);
-
- TC_PRINT("testing %d fibers timing out, but obtaining the data in time\n"
- "(except the last one, which times out)\n",
- test_data_size);
-
- rv = test_multiple_fibers_get_data(timeout_order_data, test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not get the data in the right order\n");
- TC_END_RESULT(TC_FAIL);
- return TC_FAIL;
- }
-
- TC_END_RESULT(TC_PASS);
- return TC_PASS;
-}
diff --git a/samples/nanokernel/test/test_fifo/testcase.ini b/samples/nanokernel/test/test_fifo/testcase.ini
deleted file mode 100644
index 6be0a8d3a..000000000
--- a/samples/nanokernel/test/test_fifo/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-# Not enough SRAM to run this test on quark SE
-platform_exclude = quark_se_sss_ctb arduino_101_sss
diff --git a/samples/nanokernel/test/test_fp_sharing/Makefile b/samples/nanokernel/test/test_fp_sharing/Makefile
deleted file mode 100644
index 4d905f01a..000000000
--- a/samples/nanokernel/test/test_fp_sharing/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR = $(ZEPHYR_BASE)/samples/microkernel/test/test_fp_sharing/src/
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_fp_sharing/README.txt b/samples/nanokernel/test/test_fp_sharing/README.txt
deleted file mode 100644
index 07449ef77..000000000
--- a/samples/nanokernel/test/test_fp_sharing/README.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-Title: Shared Floating Point Support
-
-Description:
-
-This test uses the background task and a fiber to independently load and
-store floating point registers and check for corruption. This tests the
-ability of contexts to safely share floating point hardware resources, even
-when switching occurs preemptively.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Floating point sharing tests started
-===================================================================
-Load and store OK after 100 (high) + 83270 (low) tests
-Load and store OK after 200 (high) + 164234 (low) tests
-Load and store OK after 300 (high) + 245956 (low) tests
-Load and store OK after 400 (high) + 330408 (low) tests
-Load and store OK after 500 (high) + 411981 (low) tests
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_fp_sharing/prj_x86.conf b/samples/nanokernel/test/test_fp_sharing/prj_x86.conf
deleted file mode 100644
index eb76e2852..000000000
--- a/samples/nanokernel/test/test_fp_sharing/prj_x86.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG_FLOAT=y
-CONFIG_SSE=y
-CONFIG_FP_SHARING=y
-CONFIG_SSE_FP_MATH=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/nanokernel/test/test_ipm/Makefile b/samples/nanokernel/test/test_ipm/Makefile
deleted file mode 100644
index ed3337118..000000000
--- a/samples/nanokernel/test/test_ipm/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-CONF_FILE = prj.conf
-BOARD ?= qemu_x86
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_ipm/prj.conf b/samples/nanokernel/test/test_ipm/prj.conf
deleted file mode 100644
index 345104c36..000000000
--- a/samples/nanokernel/test/test_ipm/prj.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-CONFIG_CONSOLE=y
-CONFIG_STDOUT_CONSOLE=y
-CONFIG_IPM_CONSOLE_RECEIVER=y
-CONFIG_IPM_CONSOLE_SENDER=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/nanokernel/test/test_ipm/src/Makefile b/samples/nanokernel/test/test_ipm/src/Makefile
deleted file mode 100644
index 03594c535..000000000
--- a/samples/nanokernel/test/test_ipm/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = ipm_dummy.o test_ipm.o
-
diff --git a/samples/nanokernel/test/test_ipm/src/ipm_dummy.c b/samples/nanokernel/test/test_ipm/src/ipm_dummy.c
deleted file mode 100644
index 110063952..000000000
--- a/samples/nanokernel/test/test_ipm/src/ipm_dummy.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ipm_dummy.c - Fake IPM driver for testing upper-level drivers */
-
-/*
- * Copyright (c) 2015 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <ipm.h>
-#include <errno.h>
-#include <device.h>
-#include <init.h>
-#include <misc/printk.h>
-#include <irq_offload.h>
-
-#include "ipm_dummy.h"
-
-
-
-/* Implemented as a software interrupt so that callbacks are executed
- * in the expected context
- */
-static void ipm_dummy_isr(void *data)
-{
- struct device *d = (struct device *)data;
- struct ipm_dummy_driver_data *driver_data = d->driver_data;
-
- /* In a real driver the interrupt simply wouldn't fire, we fake
- * that here
- */
- if (!driver_data->regs.enabled || !driver_data->regs.busy)
- return;
-
- if (driver_data->cb) {
- driver_data->cb(driver_data->cb_context, driver_data->regs.id,
- (volatile void *)&driver_data->regs.data);
- }
- driver_data->regs.busy = 0;
-}
-
-
-/* IPM API functions for the dummy driver */
-
-static int ipm_dummy_send(struct device *d, int wait, uint32_t id,
- const void *data, int size)
-{
- struct ipm_dummy_driver_data *driver_data;
- volatile uint8_t *datareg;
- const uint8_t *data8;
- int i;
-
- driver_data = d->driver_data;
- if (size > ipm_max_data_size_get(d)) {
- return -EMSGSIZE;
- }
-
- if (driver_data->regs.busy) {
- return -EBUSY;
- }
-
- data8 = (const uint8_t *)data;
- datareg = (volatile uint8_t *)driver_data->regs.data;
-
- for (i = 0; i < size; ++i) {
- datareg[i] = data8[i];
- }
- driver_data->regs.id = id;
- driver_data->regs.busy = 1;
-
- irq_offload(ipm_dummy_isr, d);
-
- if (wait) {
- while (driver_data->regs.busy) {
- /* busy-wait */
- }
- }
- return 0;
-}
-
-static void ipm_dummy_register_callback(struct device *d, ipm_callback_t cb,
- void *cb_context)
-{
- struct ipm_dummy_driver_data *driver_data;
-
- driver_data = d->driver_data;
- driver_data->cb = cb;
- driver_data->cb_context = cb_context;
-}
-
-static int ipm_dummy_set_enabled(struct device *d, int enable)
-{
- struct ipm_dummy_driver_data *driver_data = d->driver_data;
-
- driver_data->regs.enabled = enable;
- if (enable) {
- /* In case there are pending messages */
- irq_offload(ipm_dummy_isr, d);
- }
- return 0;
-}
-
-static uint32_t ipm_dummy_max_id_val_get(struct device *d)
-{
- return 0xFFFFFFFF;
-}
-
-static int ipm_dummy_max_data_size_get(struct device *d)
-{
- return DUMMY_IPM_DATA_WORDS * sizeof(uint32_t);
-}
-
-struct ipm_driver_api ipm_dummy_api = {
- .send = ipm_dummy_send,
- .register_callback = ipm_dummy_register_callback,
- .max_data_size_get = ipm_dummy_max_data_size_get,
- .max_id_val_get = ipm_dummy_max_id_val_get,
- .set_enabled = ipm_dummy_set_enabled
-};
-
-/* Dummy IPM driver initialization, will be bound at runtime
- * to high-level drivers under test
- */
-
-int ipm_dummy_init(struct device *d)
-{
- struct ipm_dummy_driver_data *driver_data;
-
- driver_data = d->driver_data;
- d->driver_api = &ipm_dummy_api;
-
- return DEV_OK;
-}
-
diff --git a/samples/nanokernel/test/test_ipm/src/ipm_dummy.h b/samples/nanokernel/test/test_ipm/src/ipm_dummy.h
deleted file mode 100644
index 70c7603b5..000000000
--- a/samples/nanokernel/test/test_ipm/src/ipm_dummy.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ipm_dummy.c - Fake IPM driver */
-
-/*
- * Copyright (c) 2015 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _IPM_DUMMY_H_
-
-#include <zephyr.h>
-#include <device.h>
-#include <ipm.h>
-
-/* Arbitrary */
-#define DUMMY_IPM_DATA_WORDS 4
-
-struct ipm_dummy_regs {
- uint32_t id;
- uint32_t data[DUMMY_IPM_DATA_WORDS];
- uint8_t busy;
- uint8_t enabled;
-};
-
-struct ipm_dummy_driver_data {
- ipm_callback_t cb;
- void *cb_context;
- volatile struct ipm_dummy_regs regs;
-};
-
-int ipm_dummy_init(struct device *d);
-#endif
diff --git a/samples/nanokernel/test/test_ipm/src/test_ipm.c b/samples/nanokernel/test/test_ipm/src/test_ipm.c
deleted file mode 100644
index 814d78e10..000000000
--- a/samples/nanokernel/test/test_ipm/src/test_ipm.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* ipm_dummy.c - Fake IPM driver */
-
-/*
- * Copyright (c) 2015 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <ipm.h>
-#include <drivers/console/ipm_console.h>
-#include <device.h>
-#include <init.h>
-#include <stdio.h>
-
-#include <tc_util.h>
-#include "ipm_dummy.h"
-
-#define PRINTK_OUT 1
-
-#if PRINTK_OUT
-#define SOURCE IPM_CONSOLE_STDOUT
-#define DEST IPM_CONSOLE_PRINTK
-#else
-#define SOURCE IPM_CONSOLE_PRINTK
-#define DEST IPM_CONSOLE_STDOUT
-#endif
-
-#define INIT_PRIO_IPM_SEND 50
-
-/* Set up the dummy IPM driver */
-struct ipm_dummy_driver_data ipm_dummy0_driver_data;
-DEVICE_INIT(ipm_dummy0, "ipm_dummy0", ipm_dummy_init,
- &ipm_dummy0_driver_data, NULL,
- SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
-
-/* Sending side of the console IPM driver, will forward anything sent
- * to printf() since we selected IPM_CONSOLE_STDOUT
- */
-struct ipm_console_sender_config_info sender_config = {
- .bind_to = "ipm_dummy0",
- .flags = SOURCE
-};
-DEVICE_INIT(ipm_console_send0, "ipm_send0", ipm_console_sender_init,
- NULL, &sender_config,
- NANOKERNEL, INIT_PRIO_IPM_SEND);
-
-/* Receiving side of the console IPM driver. These numbers are
- * more or less arbitrary
- */
-#define LINE_BUF_SIZE 80
-#define RING_BUF_SIZE32 8
-
-static uint32_t ring_buf_data[RING_BUF_SIZE32];
-static char __stack fiber_stack[IPM_CONSOLE_STACK_SIZE];
-static char line_buf[LINE_BUF_SIZE];
-
-/* Dump incoming messages to printk() */
-struct ipm_console_receiver_config_info receiver_config = {
- .bind_to = "ipm_dummy0",
- .fiber_stack = fiber_stack,
- .ring_buf_data = ring_buf_data,
- .rb_size32 = RING_BUF_SIZE32,
- .line_buf = line_buf,
- .lb_size = LINE_BUF_SIZE,
- .flags = DEST
-};
-
-struct ipm_console_receiver_runtime_data receiver_data;
-DEVICE_INIT(ipm_console_recv0, "ipm_recv0", ipm_console_receiver_init,
- &receiver_data, &receiver_config,
- NANOKERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
-
-static const char thestr[] = "everything is awesome\n";
-
-void main(void)
-{
- int rv, i;
- struct device *ipm;
-
- TC_START("Test IPM");
- ipm = device_get_binding("ipm_dummy0");
-
- /* Try sending a raw string to the IPM device to show that the
- * receiver works
- */
- for (i = 0; i < strlen(thestr); i++) {
- ipm_send(ipm, 1, thestr[i], NULL, 0);
- }
-
- /* Now do this through printf() to exercise the sender */
- printf("Lorem ipsum dolor sit amet, consectetur adipiscing elit, "
- "sed do eiusmod tempor incididunt ut labore et dolore magna "
- "aliqua. Ut enim ad minim veniam, quis nostrud exercitation "
- "ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis "
- "aute irure dolor in reprehenderit in voluptate velit esse "
- "cillum dolore eu fugiat nulla pariatur. Excepteur sint "
- "occaecat cupidatat non proident, sunt in culpa qui officia "
- "deserunt mollit anim id est laborum.\n");
-
- /* XXX how to tell if something was actually printed out for
- * automation purposes?
- */
-
- rv = TC_PASS;
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
-
-
diff --git a/samples/nanokernel/test/test_ipm/testcase.ini b/samples/nanokernel/test/test_ipm/testcase.ini
deleted file mode 100644
index 914a14535..000000000
--- a/samples/nanokernel/test/test_ipm/testcase.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test]
-tags = core
diff --git a/samples/nanokernel/test/test_lifo/Makefile b/samples/nanokernel/test/test_lifo/Makefile
deleted file mode 100644
index ed3337118..000000000
--- a/samples/nanokernel/test/test_lifo/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-CONF_FILE = prj.conf
-BOARD ?= qemu_x86
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_lifo/README.txt b/samples/nanokernel/test/test_lifo/README.txt
deleted file mode 100644
index 4d5ed6db1..000000000
--- a/samples/nanokernel/test/test_lifo/README.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-Title: LIFO APIs
-
-Description:
-
-This test verifies that the nanokernel LIFO APIs operate as expected.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel LIFO
-Nano objects initialized
-Fiber waiting on an empty LIFO
-Task waiting on an empty LIFO
-Fiber to get LIFO items without waiting
-Task to get LIFO items without waiting
-ISR to get LIFO items without waiting
-First pass
-multiple-waiter fiber 0 receiving item...
-multiple-waiter fiber 1 receiving item...
-multiple-waiter fiber 2 receiving item...
-multiple-waiter fiber 0 got correct item, giving semaphore
-multiple-waiter fiber 1 got correct item, giving semaphore
-multiple-waiter fiber 2 got correct item, giving semaphore
-Task took multi-waiter reply semaphore 3 times, as expected.
-Second pass
-multiple-waiter fiber 0 receiving item...
-multiple-waiter fiber 0 got correct item, giving semaphore
-multiple-waiter fiber 1 receiving item...
-multiple-waiter fiber 2 receiving item...
-multiple-waiter fiber 1 got correct item, giving semaphore
-multiple-waiter fiber 2 got correct item, giving semaphore
-Task took multi-waiter reply semaphore 3 times, as expected.
-test nano_task_lifo_get() with timeout > 0
-nano_task_lifo_get() timed out as expected
-nano_task_lifo_get() got lifo in time, as expected
-testing timeouts of 5 fibers on same lifo
- got fiber (q order: 2, t/o: 10, lifo 20005ff0) as expected
- got fiber (q order: 3, t/o: 15, lifo 20005ff0) as expected
- got fiber (q order: 0, t/o: 20, lifo 20005ff0) as expected
- got fiber (q order: 4, t/o: 25, lifo 20005ff0) as expected
- got fiber (q order: 1, t/o: 30, lifo 20005ff0) as expected
-testing timeouts of 9 fibers on different lifos
- got fiber (q order: 0, t/o: 10, lifo 20005ffc) as expected
- got fiber (q order: 5, t/o: 15, lifo 20005ff0) as expected
- got fiber (q order: 7, t/o: 20, lifo 20005ff0) as expected
- got fiber (q order: 1, t/o: 25, lifo 20005ff0) as expected
- got fiber (q order: 8, t/o: 30, lifo 20005ffc) as expected
- got fiber (q order: 2, t/o: 35, lifo 20005ff0) as expected
- got fiber (q order: 6, t/o: 40, lifo 20005ff0) as expected
- got fiber (q order: 4, t/o: 45, lifo 20005ffc) as expected
- got fiber (q order: 3, t/o: 50, lifo 20005ffc) as expected
-testing 5 fibers timing out, but obtaining the data in time
-(except the last one, which times out)
- got fiber (q order: 0, t/o: 20, lifo 20005ff0) as expected
- got fiber (q order: 1, t/o: 30, lifo 20005ff0) as expected
- got fiber (q order: 2, t/o: 10, lifo 20005ff0) as expected
- got fiber (q order: 3, t/o: 15, lifo 20005ff0) as expected
- got fiber (q order: 4, t/o: 25, lifo 20005ff0) as expected
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_lifo/prj.conf b/samples/nanokernel/test/test_lifo/prj.conf
deleted file mode 100644
index dfabafd11..000000000
--- a/samples/nanokernel/test/test_lifo/prj.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_NANO_TIMEOUTS=y
-CONFIG_ASSERT=y
-CONFIG_ASSERT_LEVEL=2
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/nanokernel/test/test_lifo/src/Makefile b/samples/nanokernel/test/test_lifo/src/Makefile
deleted file mode 100644
index 8b33443f6..000000000
--- a/samples/nanokernel/test/test_lifo/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-ccflags-$(CONFIG_SOC_QUARK_D2000) += -DFIBER_STACKSIZE=256
-
-obj-y = lifo.o
diff --git a/samples/nanokernel/test/test_lifo/src/README b/samples/nanokernel/test/test_lifo/src/README
deleted file mode 100644
index fdd263dc9..000000000
--- a/samples/nanokernel/test/test_lifo/src/README
+++ /dev/null
@@ -1,35 +0,0 @@
-This LIFO test set covers the following scenarios.
-
-nano_fiber_lifo_get(TICKS_UNLIMITED)
- - Getting an item from an emtpy LIFO (involves blocking and waking)
- - Getting an item from a non-empty LIFO (no blocking)
-
-nano_task_lifo_get(TICKS_UNLIMITED)
- - Getting an item from an emtpy LIFO (involves blocking and waking)
- - Getting an item from a non-empty LIFO (no blocking)
-
-nano_isr_lifo_get(TICKS_NONE)
- - Getting an item from a non-empty LIFO (no blocking)
- - Getting an item from an empty LIFO (no blocking, returns NULL)
-
-nano_fiber_lifo_get(TICKS_NONE)
- - Getting an item from a non-empty LIFO (no blocking)
- - Getting an item from an empty LIFO (no blocking, returns NULL)
-
-nano_task_lifo_get(TICKS_NONE)
- - Getting an item from a non-empty LIFO (no blocking)
- - Getting an item from an empty LIFO (no blocking, returns NULL)
-
-nano_fiber_lifo_put
- - Waking a task blocked on an empty LIFO
- - Putting an item into an empty LIFO that upon which nothing is blocked
- - Putting an item into a non-empty LIFO
-
-nano_task_lifo_put
- - Waking a fiber blocked on an empty LIFO
- - Putting an item into an empty LIFO that upon which nothing is blocked
- - Putting an item into a non-empty LIFO
-
-nano_isr_lifo_put
- - Putting an item into an empty LIFO that upon which nothing is blocked
- - Putting an item into a non-empty LIFO
diff --git a/samples/nanokernel/test/test_lifo/src/lifo.c b/samples/nanokernel/test/test_lifo/src/lifo.c
deleted file mode 100644
index 439101580..000000000
--- a/samples/nanokernel/test/test_lifo/src/lifo.c
+++ /dev/null
@@ -1,1087 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file
- * @brief Test nanokernel LIFO APIs
- *
- * DESCRIPTION
- * This module tests four basic scenarios with the usage of the following LIFO
- * routines:
- *
- * nano_isr_lifo_get, nano_isr_lifo_put
- * nano_fiber_lifo_get, nano_fiber_lifo_put
- * nano_task_lifo_get, nano_task_lifo_put
- *
- * Scenario #1
- * Getting (and waiting for an object) from an empty LIFO. Both fibers and
- * tasks can wait on a LIFO, but an ISR can not.
- *
- * Scenario #2
- * Getting objects from a non-empty LIFO. Fibers, tasks and ISRs are all
- * allowed to get an object from a non-empty LIFO.
- *
- * Scenario #3:
- * Multiple fibers pend on the same LIFO.
- *
- * Scenario #4:
- * Timeout scenarios with multiple LIFOs and fibers.
- *
- * These scenarios will be tested using a combinations of tasks, fibers and
- * ISRs.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <misc/util.h>
-#include <misc/__assert.h>
-#include <irq_offload.h>
-
-/* test uses 2 software IRQs */
-#define NUM_SW_IRQS 2
-
-#include <util_test_common.h>
-
-#ifndef FIBER_STACKSIZE
-#define FIBER_STACKSIZE 2000
-#endif
-#define FIBER_PRIORITY 4
-
-typedef struct {
- struct nano_lifo *lifo_ptr; /* LIFO */
- void *data; /* pointer to data to add */
-} ISR_LIFO_INFO;
-
-typedef struct {
- uint32_t link; /* 32-bit word for LIFO to use as a link */
- uint32_t data; /* miscellaneous data put on LIFO (not important) */
-} LIFO_ITEM;
-
-/* Items to be added/removed from LIFO during the test */
-static LIFO_ITEM lifoItem[4] = {
- {0, 1},
- {0, 2},
- {0, 3},
- {0, 4},
- };
-
-static struct nano_lifo test_lifo; /* LIFO used in test */
-static struct nano_sem taskWaitSem; /* task waits on this semaphore */
-static struct nano_sem fiberWaitSem; /* fiber waits on this semaphore */
-static struct nano_timer timer;
-static void *timerData[1];
-static ISR_LIFO_INFO isrLifoInfo = {&test_lifo, NULL};
-
-static volatile int fiberDetectedFailure = 0; /* non-zero on failure */
-
-static char __stack fiberStack[FIBER_STACKSIZE];
-
-static struct nano_lifo multi_waiters;
-static struct nano_sem reply_multi_waiters;
-
-/**
- *
- * @brief Add an item to a LIFO
- *
- * This routine is the ISR handler for _trigger_nano_isr_lifo_put(). It adds
- * an item to the LIFO in the context of an ISR.
- *
- * @param data pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_lifo_put(void *data)
-{
- ISR_LIFO_INFO *pInfo = (ISR_LIFO_INFO *) data;
-
- nano_isr_lifo_put(pInfo->lifo_ptr, pInfo->data);
-}
-
-static void _trigger_nano_isr_lifo_put(void)
-{
- irq_offload(isr_lifo_put, &isrLifoInfo);
-}
-
-
-/**
- *
- * @brief Get an item from a LIFO
- *
- * This routine is the ISR handler for _trigger_nano_isr_lifo_get(). It gets
- * an item from the LIFO in the context of an ISR.
- *
- * @param data pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_lifo_get(void *data)
-{
- ISR_LIFO_INFO *pInfo = (ISR_LIFO_INFO *) data;
-
- pInfo->data = nano_isr_lifo_get(pInfo->lifo_ptr, TICKS_NONE);
-}
-
-static void _trigger_nano_isr_lifo_get(void)
-{
- irq_offload(isr_lifo_get, &isrLifoInfo);
-}
-
-
-/**
- *
- * @brief Fiber portion of test that waits on a LIFO
- *
- * This routine works with taskLifoWaitTest() to test the addition and removal
- * of items to/from a LIFO. The cases covered will have a fiber or task waiting
- * on an empty LIFO.
- *
- * @return 0 on success, -1 on failure
- */
-
-int fiberLifoWaitTest(void)
-{
- void *data; /* ptr to data retrieved from LIFO */
-
- /*
- * The LIFO is empty; wait for an item to be added to the LIFO
- * from the task.
- */
-
- TC_PRINT("Fiber waiting on an empty LIFO\n");
- nano_fiber_sem_give(&taskWaitSem);
- data = nano_fiber_lifo_get(&test_lifo, TICKS_UNLIMITED);
- if (data != &lifoItem[0]) {
- fiberDetectedFailure = 1;
- return -1;
- }
-
- nano_fiber_sem_take(&fiberWaitSem, TICKS_UNLIMITED);
- data = nano_fiber_lifo_get(&test_lifo, TICKS_UNLIMITED);
- if (data != &lifoItem[2]) {
- fiberDetectedFailure = 1;
- return -1;
- }
-
- /*
- * Give the task some time to check the results. Ideally, this would
- * be waiting for a semaphore instead of a using a delay, but if the
- * main task wakes the fiber before it blocks on the LIFO, the fiber
- * will add the item to the LIFO too soon. Obviously, a semaphore could
- * not be given if the task is blocked on the LIFO; hence the delay.
- */
-
- nano_fiber_timer_start(&timer, SECONDS(2));
- nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
-
- /* The task is waiting on an empty LIFO. Wake it up. */
- nano_fiber_lifo_put(&test_lifo, &lifoItem[3]);
- nano_fiber_lifo_put(&test_lifo, &lifoItem[1]);
-
- /*
- * Wait for the task to check the results. If the results pass, then the
- * the task will wake the fiber. If the results do not pass, then the
- * fiber will wait forever.
- */
-
- nano_fiber_sem_take(&fiberWaitSem, TICKS_UNLIMITED);
-
- return 0;
-}
-
-/**
- *
- * @brief Fiber portion of test that does not wait on a LIFO
- *
- * This routine works with fiberLifoNonWaitTest() to test the addition and
- * removal of items from a LIFO without having to wait.
- *
- * @return 0 on success, -1 on failure
- */
-
-int fiberLifoNonWaitTest(void)
-{
- void *data; /* pointer to data retrieved from LIFO */
-
- /* The LIFO has two items in it; retrieve them both */
-
- data = nano_fiber_lifo_get(&test_lifo, TICKS_NONE);
- if (data != (void *) &lifoItem[3]) {
- goto errorReturn;
- }
-
- data = nano_fiber_lifo_get(&test_lifo, TICKS_NONE);
- if (data != (void *) &lifoItem[2]) {
- goto errorReturn;
- }
-
- /* LIFO should be empty--verify. */
- data = nano_fiber_lifo_get(&test_lifo, TICKS_NONE);
- if (data != NULL) {
- goto errorReturn;
- }
-
- /*
- * The LIFO is now empty. Add two items to the LIFO and then wait
- * for the semaphore so that the task can retrieve them.
- */
-
- TC_PRINT("Task to get LIFO items without waiting\n");
- nano_fiber_lifo_put(&test_lifo, &lifoItem[0]);
- nano_fiber_lifo_put(&test_lifo, &lifoItem[1]);
- nano_fiber_sem_give(&taskWaitSem); /* Wake the task (if blocked) */
-
- /*
- * Wait for the task to get the items and then trigger an ISR to populate
- * the LIFO.
- */
-
- nano_fiber_sem_take(&fiberWaitSem, TICKS_UNLIMITED);
-
- /*
- * The task retrieved the two items from the LIFO and then triggered
- * two interrupts to add two other items to the LIFO. The fiber will
- * now trigger two interrupts to read the two items.
- */
-
- _trigger_nano_isr_lifo_get();
- if (isrLifoInfo.data != &lifoItem[1]) {
- goto errorReturn;
- }
-
- _trigger_nano_isr_lifo_get();
- if (isrLifoInfo.data != &lifoItem[3]) {
- goto errorReturn;
- }
-
- /* The LIFO should now be empty--verify */
- _trigger_nano_isr_lifo_get();
- if (isrLifoInfo.data != NULL) {
- goto errorReturn;
- }
-
- return 0;
-
-errorReturn:
- fiberDetectedFailure = 1;
- return -1;
-}
-
-/**
- *
- * @brief Entry point for the fiber portion of the LIFO tests
- *
- * NOTE: The fiber portion of the tests have higher priority than the task
- * portion of the tests.
- *
- * @param arg1 unused
- * @param arg2 unused
- *
- * @return N/A
- */
-
-static void fiberEntry(int arg1, int arg2)
-{
- int rv; /* return value from a test */
-
- ARG_UNUSED(arg1);
- ARG_UNUSED(arg2);
-
- rv = fiberLifoWaitTest();
-
- if (rv == 0) {
- fiberLifoNonWaitTest();
- }
-
-}
-
-/**
- *
- * @brief Task portion of test that waits on a LIFO
- *
- * This routine works with fiberLifoWaitTest() to test the addition and removal
- * of items to/from a LIFO. The cases covered will have a fiber or task waiting
- * on an empty LIFO.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int taskLifoWaitTest(void)
-{
- void *data; /* ptr to data retrieved from LIFO */
-
- /* Wait on <taskWaitSem> in case fiber's print message blocked */
- nano_fiber_sem_take(&taskWaitSem, TICKS_UNLIMITED);
-
- /* The fiber is waiting on the LIFO. Wake it. */
- nano_task_lifo_put(&test_lifo, &lifoItem[0]);
-
- /*
- * The fiber ran, but is now blocked on the semaphore. Add an item to the
- * LIFO before giving the semaphore that wakes the fiber so that we can
- * cover the path of nano_fiber_lifo_get(TICKS_UNLIMITED) not waiting on
- * the LIFO.
- */
-
- nano_task_lifo_put(&test_lifo, &lifoItem[2]);
- nano_task_sem_give(&fiberWaitSem);
-
- /* Check that the fiber got the correct item (lifoItem[0]) */
-
- if (fiberDetectedFailure) {
- TC_ERROR(" *** nano_task_lifo_put()/nano_fiber_lifo_get() failure\n");
- return TC_FAIL;
- }
-
- /* The LIFO is empty. This time the task will wait for the item. */
-
- TC_PRINT("Task waiting on an empty LIFO\n");
- data = nano_task_lifo_get(&test_lifo, TICKS_UNLIMITED);
- if (data != (void *) &lifoItem[1]) {
- TC_ERROR(" *** nano_task_lifo_get()/nano_fiber_lifo_put() failure\n");
- return TC_FAIL;
- }
-
- data = nano_task_lifo_get(&test_lifo, TICKS_UNLIMITED);
- if (data != (void *) &lifoItem[3]) {
- TC_ERROR(" *** nano_task_lifo_get()/nano_fiber_lifo_put() failure\n");
- return TC_FAIL;
- }
-
-
- /* Waiting on an empty LIFO passed for both fiber and task. */
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Task portion of test that does not wait on a LIFO
- *
- * This routine works with fiberLifoNonWaitTest() to test the addition and
- * removal of items from a LIFO without having to wait.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int taskLifoNonWaitTest(void)
-{
- void *data; /* ptr to data retrieved from LIFO */
-
- /*
- * The fiber is presently waiting for <fiberWaitSem>. Populate the LIFO
- * before waking the fiber.
- */
-
- TC_PRINT("Fiber to get LIFO items without waiting\n");
- nano_task_lifo_put(&test_lifo, &lifoItem[2]);
- nano_task_lifo_put(&test_lifo, &lifoItem[3]);
- nano_task_sem_give(&fiberWaitSem); /* Wake the fiber */
-
- /* Check that fiber received the items correctly */
- if (fiberDetectedFailure) {
- TC_ERROR(" *** nano_task_lifo_put()/nano_fiber_lifo_get() failure\n");
- return TC_FAIL;
- }
-
- /* Wait for the fiber to be ready */
- nano_task_sem_take(&taskWaitSem, TICKS_UNLIMITED);
-
- data = nano_task_lifo_get(&test_lifo, TICKS_NONE);
- if (data != (void *) &lifoItem[1]) {
- TC_ERROR(" *** nano_task_lifo_get()/nano_fiber_lifo_put() failure\n");
- return TC_FAIL;
- }
-
- data = nano_task_lifo_get(&test_lifo, TICKS_NONE);
- if (data != (void *) &lifoItem[0]) {
- TC_ERROR(" *** nano_task_lifo_get()/nano_fiber_lifo_put() failure\n");
- return TC_FAIL;
- }
-
- data = nano_task_lifo_get(&test_lifo, TICKS_NONE);
- if (data != NULL) {
- TC_ERROR(" *** nano_task_lifo_get()/nano_fiber_lifo_put() failure\n");
- return TC_FAIL;
- }
-
- /*
- * Software interrupts have been configured so that when invoked,
- * the ISR will add an item to the LIFO. The fiber (when unblocked)
- * trigger software interrupts to get the items from the LIFO from
- * within an ISR.
- *
- * Populate the LIFO.
- */
-
- TC_PRINT("ISR to get LIFO items without waiting\n");
- isrLifoInfo.data = &lifoItem[3];
- _trigger_nano_isr_lifo_put();
- isrLifoInfo.data = &lifoItem[1];
- _trigger_nano_isr_lifo_put();
-
- isrLifoInfo.data = NULL; /* Force NULL to ensure [data] changes */
-
- nano_task_sem_give(&fiberWaitSem); /* Wake the fiber */
-
- if (fiberDetectedFailure) {
- TC_ERROR(" *** nano_isr_lifo_put()/nano_isr_lifo_get() failure\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Initialize nanokernel objects
- *
- * This routine initializes the nanokernel objects used in the LIFO tests.
- *
- * @return N/A
- */
-
-void initNanoObjects(void)
-{
- nano_lifo_init(&test_lifo); /* Initialize the LIFO */
- nano_sem_init(&taskWaitSem); /* Initialize the task waiting semaphore */
- nano_sem_init(&fiberWaitSem); /* Initialize the fiber waiting semaphore */
- nano_timer_init(&timer, timerData);
-
- nano_lifo_init(&multi_waiters);
- nano_sem_init(&reply_multi_waiters);
-
- TC_PRINT("Nano objects initialized\n");
-}
-
-/*
- * Multiple-waiters test
- *
- * NUM_WAITERS fibers pend on the multi_waiters LIFO, then the task puts data
- * on the LIFO NUM_WAITERS times. Each time, the first fiber in the queue wakes
- * up, is context-switched to, verifies the data is the one expected, and gives
- * the reply_multi_waiters semaphore, for a total of NUM_WAITERS times. The
- * task finally must be able to obtain the reply_multi_waiters semaphore
- * NUM_WAITERS times.
- */
-#define NUM_WAITERS 3
-static char __stack fiber_multi_waiters_stacks[NUM_WAITERS][FIBER_STACKSIZE];
-static LIFO_ITEM multi_waiters_items[NUM_WAITERS] = {
- [0 ...(NUM_WAITERS-1)].link = 0,
- [0 ...(NUM_WAITERS-1)].data = 0xabad1dea,
-};
-
-/**
- *
- * @brief Fiber entry point for multiple-waiters test
- *
- * @return N/A
- */
-
-static void fiber_multi_waiters(int arg1, int arg2)
-{
- void *item;
-
- TC_PRINT("multiple-waiter fiber %d receiving item...\n", arg1);
- item = nano_fiber_lifo_get(&multi_waiters, TICKS_UNLIMITED);
- if (item != &multi_waiters_items[arg1]) {
- TC_ERROR(" *** fiber %d did not receive correct item\n", arg1);
- TC_ERROR(" *** received %p instead of %p.\n",
- item, &multi_waiters_items[arg1]);
-
- /* do NOT give the semaphore, signifying an error */
- return;
- }
- TC_PRINT("multiple-waiter fiber %d got correct item, giving semaphore\n",
- arg1);
- nano_fiber_sem_give(&reply_multi_waiters);
-}
-
-/**
- *
- * @brief Task part of multiple-waiter test, repeatable
- *
- * @return N/A
- */
-
-static int do_test_multiple_waiters(void)
-{
- int ii;
-
- /* pend all fibers one the same lifo */
- for (ii = 0; ii < NUM_WAITERS; ii++) {
- task_fiber_start(fiber_multi_waiters_stacks[ii], FIBER_STACKSIZE,
- fiber_multi_waiters, ii, 0, FIBER_PRIORITY, 0);
- }
-
- /* wake up all the fibers: the task is preempted each time */
- for (ii = 0; ii < NUM_WAITERS; ii++) {
- nano_task_lifo_put(&multi_waiters, &multi_waiters_items[ii]);
- }
-
- /* reply_multi_waiters will have been given once for each fiber */
- for (ii = 0; ii < NUM_WAITERS; ii++) {
- if (!nano_task_sem_take(&reply_multi_waiters, TICKS_NONE)) {
- TC_ERROR(" *** Cannot take sem supposedly given by waiters.\n");
- return TC_FAIL;
- }
- }
-
- TC_PRINT("Task took multi-waiter reply semaphore %d times, as expected.\n",
- NUM_WAITERS);
-
- if (nano_task_lifo_get(&multi_waiters, TICKS_NONE)) {
- TC_ERROR(" *** multi_waiters should have been empty.\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point for multiple-waiters test
- *
- * @return N/A
- */
-
-static int test_multiple_waiters(void)
-{
- TC_PRINT("First pass\n");
- if (do_test_multiple_waiters() == TC_FAIL) {
- TC_ERROR(" *** First pass test failed.\n");
- return TC_FAIL;
- }
-
- /*
- * Verity a wait q that has been emptied has been reset correctly, so
- * redo the test. This time, send one message before starting the fibers.
- */
-
- TC_PRINT("Second pass\n");
- if (do_test_multiple_waiters() == TC_FAIL) {
- TC_ERROR(" *** Second pass test failed.\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/* timeout tests
- *
- * Test the nano_xxx_lifo_wait_timeout() APIs.
- *
- * First, the task waits with a timeout and times out. Then it wait with a
- * timeout, but gets the data in time.
- *
- * Then, multiple timeout tests are done for the fibers, to test the ordering
- * of queueing/dequeueing when timeout occurs, first on one lifo, then on
- * multiple lifos.
- *
- * Finally, multiple fibers pend on one lifo, and they all get the
- * data in time, except the last one: this tests that the timeout is
- * recomputed correctly when timeouts are aborted.
- */
-
-#include <tc_nano_timeout_common.h>
-
-struct scratch_q_packet {
- void *link_in_q;
- void *data_if_needed;
-};
-
-struct reply_packet {
- void *link_in_fifo;
- int reply;
-};
-
-#define NUM_SCRATCH_Q_PACKETS 20
-struct scratch_q_packet scratch_q_packets[NUM_SCRATCH_Q_PACKETS];
-
-struct nano_fifo scratch_q_packets_fifo;
-
-void *get_scratch_packet(void)
-{
- void *packet = nano_fifo_get(&scratch_q_packets_fifo, TICKS_NONE);
-
- __ASSERT_NO_MSG(packet);
-
- return packet;
-}
-
-void put_scratch_packet(void *packet)
-{
- nano_fifo_put(&scratch_q_packets_fifo, packet);
-}
-
-static struct nano_lifo lifo_timeout[2];
-struct nano_fifo timeout_order_fifo;
-
-struct timeout_order_data {
- void *link_in_lifo;
- struct nano_lifo *lifo;
- int32_t timeout;
- int timeout_order;
- int q_order;
-};
-
-struct timeout_order_data timeout_order_data[] = {
- {0, &lifo_timeout[0], TIMEOUT(2), 2, 0},
- {0, &lifo_timeout[0], TIMEOUT(4), 4, 1},
- {0, &lifo_timeout[0], TIMEOUT(0), 0, 2},
- {0, &lifo_timeout[0], TIMEOUT(1), 1, 3},
- {0, &lifo_timeout[0], TIMEOUT(3), 3, 4},
-};
-
-struct timeout_order_data timeout_order_data_mult_lifo[] = {
- {0, &lifo_timeout[1], TIMEOUT(0), 0, 0},
- {0, &lifo_timeout[0], TIMEOUT(3), 3, 1},
- {0, &lifo_timeout[0], TIMEOUT(5), 5, 2},
- {0, &lifo_timeout[1], TIMEOUT(8), 8, 3},
- {0, &lifo_timeout[1], TIMEOUT(7), 7, 4},
- {0, &lifo_timeout[0], TIMEOUT(1), 1, 5},
- {0, &lifo_timeout[0], TIMEOUT(6), 6, 6},
- {0, &lifo_timeout[0], TIMEOUT(2), 2, 7},
- {0, &lifo_timeout[1], TIMEOUT(4), 4, 8},
-};
-
-#define TIMEOUT_ORDER_NUM_FIBERS ARRAY_SIZE(timeout_order_data_mult_lifo)
-static char __stack timeout_stacks[TIMEOUT_ORDER_NUM_FIBERS][FIBER_STACKSIZE];
-
-/* a fiber sleeps then puts data on the lifo */
-static void test_fiber_put_timeout(int lifo, int timeout)
-{
- fiber_sleep((int32_t)timeout);
- nano_fiber_lifo_put((struct nano_lifo *)lifo, get_scratch_packet());
-}
-
-/* a fiber pends on a lifo then times out */
-static void test_fiber_pend_and_timeout(int data, int unused)
-{
- struct timeout_order_data *d = (void *)data;
- int32_t orig_ticks = sys_tick_get();
- void *packet;
-
- ARG_UNUSED(unused);
-
- packet = nano_fiber_lifo_get(d->lifo, d->timeout);
- if (packet) {
- TC_ERROR(" *** timeout of %d did not time out.\n",
- d->timeout);
- return;
- }
- if (!is_timeout_in_range(orig_ticks, d->timeout)) {
- return;
- }
-
- nano_fiber_fifo_put(&timeout_order_fifo, d);
-}
-
-/* the task spins several fibers that pend and timeout on lifos */
-static int test_multiple_fibers_pending(struct timeout_order_data *test_data,
- int test_data_size)
-{
- int ii;
-
- for (ii = 0; ii < test_data_size; ii++) {
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_timeout,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
- }
-
- for (ii = 0; ii < test_data_size; ii++) {
- struct timeout_order_data *data =
- nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
-
- if (data->timeout_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, lifo %p) as expected\n",
- data->q_order, data->timeout, data->lifo);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/* a fiber pends on a lifo with a timeout and gets the data in time */
-static void test_fiber_pend_and_get_data(int data, int unused)
-{
- struct timeout_order_data *d = (void *)data;
- void *packet;
-
- ARG_UNUSED(unused);
-
- packet = nano_fiber_lifo_get(d->lifo, d->timeout);
- if (!packet) {
- TC_PRINT(" *** fiber (q order: %d, t/o: %d, lifo %p) timed out!\n",
- d->q_order, d->timeout, d->lifo);
- return;
- }
-
- put_scratch_packet(packet);
- nano_fiber_fifo_put(&timeout_order_fifo, d);
-}
-
-/* the task spins fibers that get lifo data in time, except the last one */
-static int test_multiple_fibers_get_data(struct timeout_order_data *test_data,
- int test_data_size)
-{
- struct timeout_order_data *data;
- int ii;
-
- for (ii = 0; ii < test_data_size-1; ii++) {
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_get_data,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
- }
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_timeout,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
-
- for (ii = 0; ii < test_data_size-1; ii++) {
-
- nano_task_lifo_put(test_data[ii].lifo, get_scratch_packet());
-
- data = nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
-
- if (data->q_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, lifo %p) as expected\n",
- data->q_order, data->timeout, data->lifo);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->q_order, ii);
- return TC_FAIL;
- }
- }
-
- data = nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
- if (data->q_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, lifo %p) as expected\n",
- data->q_order, data->timeout, data->lifo);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/* try getting data on lifo with special timeout value, return result in fifo */
-static void test_fiber_ticks_special_values(int packet, int special_value)
-{
- struct reply_packet *reply_packet = (void *)packet;
-
- reply_packet->reply =
- !!nano_fiber_lifo_get(&lifo_timeout[0], special_value);
-
- nano_fiber_fifo_put(&timeout_order_fifo, reply_packet);
-}
-
-/* the timeout test entry point */
-static int test_timeout(void)
-{
- int64_t orig_ticks;
- int32_t timeout;
- int rv;
- void *packet, *scratch_packet;
- int test_data_size;
- int ii;
- struct reply_packet reply_packet;
-
- nano_lifo_init(&lifo_timeout[0]);
- nano_lifo_init(&lifo_timeout[1]);
- nano_fifo_init(&timeout_order_fifo);
- nano_fifo_init(&scratch_q_packets_fifo);
-
- for (ii = 0; ii < NUM_SCRATCH_Q_PACKETS; ii++) {
- scratch_q_packets[ii].data_if_needed = (void *)ii;
- nano_task_fifo_put(&scratch_q_packets_fifo,
- &scratch_q_packets[ii]);
- }
-
- /* test nano_task_lifo_get() with timeout */
- timeout = 10;
- orig_ticks = sys_tick_get();
- packet = nano_task_lifo_get(&lifo_timeout[0], timeout);
- if (packet) {
- TC_ERROR(" *** timeout of %d did not time out.\n", timeout);
- return TC_FAIL;
- }
- if ((sys_tick_get() - orig_ticks) < timeout) {
- TC_ERROR(" *** task did not wait long enough on timeout of %d.\n",
- timeout);
- return TC_FAIL;
- }
-
- /* test nano_task_lifo_get() with timeout of 0 */
-
- packet = nano_task_lifo_get(&lifo_timeout[0], 0);
- if (packet) {
- TC_ERROR(" *** timeout of 0 did not time out.\n");
- return TC_FAIL;
- }
-
- /* test nano_task_lifo_get() with timeout > 0 */
-
- TC_PRINT("test nano_task_lifo_get() with timeout > 0\n");
-
- timeout = 3;
- orig_ticks = sys_tick_get();
-
- packet = nano_task_lifo_get(&lifo_timeout[0], timeout);
-
- if (packet) {
- TC_ERROR(" *** timeout of %d did not time out.\n",
- timeout);
- return TC_FAIL;
- }
-
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- return TC_FAIL;
- }
-
- TC_PRINT("nano_task_lifo_get() timed out as expected\n");
-
- /*
- * test nano_task_lifo_get() with a timeout and fiber that puts
- * data on the lifo on time
- */
-
- timeout = 5;
- orig_ticks = sys_tick_get();
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_put_timeout, (int)&lifo_timeout[0],
- timeout,
- FIBER_PRIORITY, 0);
-
- packet = nano_task_lifo_get(&lifo_timeout[0],
- (int)(timeout + 5));
- if (!packet) {
- TC_ERROR(" *** data put in time did not return valid pointer.\n");
- return TC_FAIL;
- }
-
- put_scratch_packet(packet);
-
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- return TC_FAIL;
- }
-
- TC_PRINT("nano_task_lifo_get() got lifo in time, as expected\n");
-
- /*
- * test nano_task_lifo_get() with TICKS_NONE and no data
- * unavailable.
- */
-
- if (nano_task_lifo_get(&lifo_timeout[0], TICKS_NONE)) {
- TC_ERROR("task with TICKS_NONE got data, but shouldn't have\n");
- return TC_FAIL;
- }
-
- TC_PRINT("task with TICKS_NONE did not get data, as expected\n");
-
- /*
- * test nano_task_lifo_get() with TICKS_NONE and some data
- * available.
- */
-
- scratch_packet = get_scratch_packet();
- nano_task_lifo_put(&lifo_timeout[0], scratch_packet);
- if (!nano_task_lifo_get(&lifo_timeout[0], TICKS_NONE)) {
- TC_ERROR("task with TICKS_NONE did not get available data\n");
- return TC_FAIL;
- }
- put_scratch_packet(scratch_packet);
-
- TC_PRINT("task with TICKS_NONE got available data, as expected\n");
-
- /*
- * test nano_task_lifo_get() with TICKS_UNLIMITED and the
- * data available.
- */
-
- TC_PRINT("Trying to take available data with TICKS_UNLIMITED:\n"
- " will hang the test if it fails.\n");
-
- scratch_packet = get_scratch_packet();
- nano_task_lifo_put(&lifo_timeout[0], scratch_packet);
- if (!nano_task_lifo_get(&lifo_timeout[0], TICKS_UNLIMITED)) {
- TC_ERROR(" *** This will never be hit!!! .\n");
- return TC_FAIL;
- }
- put_scratch_packet(scratch_packet);
-
- TC_PRINT("task with TICKS_UNLIMITED got available data, as expected\n");
-
- /* test fiber with timeout of TICKS_NONE not getting data on empty lifo */
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_NONE, FIBER_PRIORITY, 0);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 0) {
- TC_ERROR(" *** fiber should not have obtained the data.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_NONE did not get data, as expected\n");
-
- /* test fiber with timeout of TICKS_NONE getting data when available */
-
- scratch_packet = get_scratch_packet();
- nano_task_lifo_put(&lifo_timeout[0], scratch_packet);
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_NONE, FIBER_PRIORITY, 0);
- put_scratch_packet(scratch_packet);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 1) {
- TC_ERROR(" *** fiber should have obtained the data.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_NONE got available data, as expected\n");
-
- /* test fiber with TICKS_UNLIMITED timeout getting data when availalble */
-
- scratch_packet = get_scratch_packet();
- nano_task_lifo_put(&lifo_timeout[0], scratch_packet);
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_UNLIMITED, FIBER_PRIORITY, 0);
- put_scratch_packet(scratch_packet);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 1) {
- TC_ERROR(" *** fiber should have obtained the data.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_UNLIMITED got available data, as expected\n");
-
- /* test multiple fibers pending on the same lifo with different timeouts */
-
- test_data_size = ARRAY_SIZE(timeout_order_data);
-
- TC_PRINT("testing timeouts of %d fibers on same lifo\n", test_data_size);
-
- rv = test_multiple_fibers_pending(timeout_order_data, test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not time out in the right order\n");
- return TC_FAIL;
- }
-
- /* test mult. fibers pending on different lifos with different timeouts */
-
- test_data_size = ARRAY_SIZE(timeout_order_data_mult_lifo);
-
- TC_PRINT("testing timeouts of %d fibers on different lifos\n",
- test_data_size);
-
- rv = test_multiple_fibers_pending(timeout_order_data_mult_lifo,
- test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not time out in the right order\n");
- return TC_FAIL;
- }
-
- /*
- * test multiple fibers pending on same lifo with different timeouts, but
- * getting the data in time, except the last one.
- */
-
- test_data_size = ARRAY_SIZE(timeout_order_data);
-
- TC_PRINT("testing %d fibers timing out, but obtaining the data in time\n"
- "(except the last one, which times out)\n",
- test_data_size);
-
- rv = test_multiple_fibers_get_data(timeout_order_data, test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not get the data in the right order\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to LIFO tests
- *
- * This is the entry point to the LIFO tests.
- *
- * @return N/A
- */
-
-void main(void)
-{
- int rv; /* return value from tests */
-
- TC_START("Test Nanokernel LIFO");
-
- initNanoObjects();
-
- /*
- * Start the fiber. The fiber will be given a higher priority than the
- * main task.
- */
-
- task_fiber_start(fiberStack, FIBER_STACKSIZE, fiberEntry,
- 0, 0, FIBER_PRIORITY, 0);
-
- rv = taskLifoWaitTest();
-
- if (rv == TC_PASS) {
- rv = taskLifoNonWaitTest();
- }
-
- if (rv == TC_PASS) {
- rv = test_multiple_waiters();
- }
-
- /* test timeouts */
- if (rv == TC_PASS) {
- rv = test_timeout();
- }
-
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_lifo/testcase.ini b/samples/nanokernel/test/test_lifo/testcase.ini
deleted file mode 100644
index 6be0a8d3a..000000000
--- a/samples/nanokernel/test/test_lifo/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-# Not enough SRAM to run this test on quark SE
-platform_exclude = quark_se_sss_ctb arduino_101_sss
diff --git a/samples/nanokernel/test/test_mem_safe/Makefile b/samples/nanokernel/test/test_mem_safe/Makefile
deleted file mode 100644
index 28e8a5ca8..000000000
--- a/samples/nanokernel/test/test_mem_safe/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj.conf
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_mem_safe/README.txt b/samples/nanokernel/test/test_mem_safe/README.txt
deleted file mode 100644
index d186193e2..000000000
--- a/samples/nanokernel/test/test_mem_safe/README.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-Title: Safe Memory Access
-
-Description:
-
-This test verifies that the safe memory access (_mem_safe) functions as
-intended.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-testing SUCCESS of READ on RO memory with width 1.......PASS
-testing SUCCESS of READ on RO memory with width 2.......PASS
-testing SUCCESS of READ on RO memory with width 4.......PASS
-testing FAILURE of WRITE on RO memory with width 1.......PASS
-testing FAILURE of WRITE on RO memory with width 2.......PASS
-testing FAILURE of WRITE on RO memory with width 4.......PASS
-testing SUCCESS of READ on RW memory with width 1.......PASS
-testing SUCCESS of READ on RW memory with width 2.......PASS
-testing SUCCESS of READ on RW memory with width 4.......PASS
-testing SUCCESS of WRITE on RW memory with width 1.......PASS
-testing SUCCESS of WRITE on RW memory with width 2.......PASS
-testing SUCCESS of WRITE on RW memory with width 4.......PASS
-testing FAILURE of INVALID ACCESS on RW memory with width 4.......PASS
-testing FAILURE of READ on RO memory with width 0.......PASS
-testing SUCCESS of READ on RO memory with width 1.......PASS
-testing SUCCESS of READ on RO memory with width 2.......PASS
-testing FAILURE of READ on RO memory with width 3.......PASS
-testing SUCCESS of READ on RO memory with width 4.......PASS
-testing FAILURE of READ on RO memory with width 5.......PASS
-testing FAILURE of READ on RO memory with width 8.......PASS
-testing SUCCESS of READ on RO memory with width 1.......PASS
-testing SUCCESS of READ on RO memory with width 1.......PASS
-testing SUCCESS of READ on RW memory with width 1.......PASS
-testing SUCCESS of READ on RW memory with width 1.......PASS
-testing FAILURE of WRITE on RO memory with width 1.......PASS
-testing FAILURE of WRITE on RO memory with width 1.......PASS
-testing SUCCESS of WRITE on RW memory with width 1.......PASS
-testing SUCCESS of WRITE on RW memory with width 1.......PASS
-testing FAILURE of READ on out-of-image memory with width 1.......PASS
-testing FAILURE of READ on out-of-image memory with width 1.......PASS
-testing SUCCESS of adding extra RO region.......PASS
-testing SUCCESS of adding extra RW region.......PASS
-testing FAILURE of adding extra region that won't fit.......PASS
-testing SUCCESS of READ on out-of-image memory with width 1.......PASS
-testing SUCCESS of READ on out-of-image memory with width 1.......PASS
-testing SUCCESS of READ on out-of-image memory with width 1.......PASS
-testing SUCCESS of READ on out-of-image memory with width 1.......PASS
-testing FAILURE of WRITE on out-of-image memory with width 1.......PASS
-testing FAILURE of WRITE on out-of-image memory with width 1.......PASS
-testing SUCCESS of WRITE on out-of-image memory with width 1.......PASS
-testing SUCCESS of WRITE on out-of-image memory with width 1.......PASS
-testing FAILURE of READ on out-of-image memory with width 1.......PASS
-testing FAILURE of READ on out-of-image memory with width 1.......PASS
-testing FAILURE of READ on out-of-image memory with width 1.......PASS
-testing FAILURE of READ on out-of-image memory with width 1.......PASS
-testing FAILURE of WRITE on RO memory with width 1.......PASS
-testing SUCCESS of _mem_probe() reading RO values.......PASS
-testing SUCCESS of _mem_probe() reading RW values.......PASS
-testing SUCCESS of _mem_probe() writing values.......PASS
-testing SUCCESS of _mem_safe_read(size: 16, width: 0).......PASS
-testing SUCCESS of _mem_safe_read(size: 16, width: 4).......PASS
-testing SUCCESS of _mem_safe_read(size: 14, width: 2).......PASS
-testing SUCCESS of _mem_safe_read(size: 15, width: 1).......PASS
-testing FAILURE of _mem_safe_read() with bad params.......PASS (-22)
-testing SUCCESS of _mem_safe_write(size: 16, width: 0).......PASS
-testing SUCCESS of _mem_safe_write(size: 16, width: 4).......PASS
-testing SUCCESS of _mem_safe_write(size: 14, width: 2).......PASS
-testing SUCCESS of _mem_safe_write(size: 15, width: 1).......PASS
-testing FAILURE of _mem_safe_write() with bad params.......PASS (-22)
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_mem_safe/prj.conf b/samples/nanokernel/test/test_mem_safe/prj.conf
deleted file mode 100644
index 42b9285d3..000000000
--- a/samples/nanokernel/test/test_mem_safe/prj.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_MEM_SAFE=y
-CONFIG_MEM_SAFE_NUM_EXTRA_REGIONS=2
-CONFIG_CACHE_FLUSHING=y
diff --git a/samples/nanokernel/test/test_mem_safe/src/Makefile b/samples/nanokernel/test/test_mem_safe/src/Makefile
deleted file mode 100644
index 5e9a3939c..000000000
--- a/samples/nanokernel/test/test_mem_safe/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y += main.o
-obj-y += asm_$(ARCH).o
diff --git a/samples/nanokernel/test/test_mem_safe/src/asm_arm.S b/samples/nanokernel/test/test_mem_safe/src/asm_arm.S
deleted file mode 100644
index e69de29bb..000000000
--- a/samples/nanokernel/test/test_mem_safe/src/asm_arm.S
+++ /dev/null
diff --git a/samples/nanokernel/test/test_mem_safe/src/asm_x86.S b/samples/nanokernel/test/test_mem_safe/src/asm_x86.S
deleted file mode 100644
index 1e24e11e1..000000000
--- a/samples/nanokernel/test/test_mem_safe/src/asm_x86.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @ brief architecture specific support for the mem_probe tests
- */
-
-#define _ASMLANGUAGE
-#include <arch/x86/asm.h>
-
- GDATA(foo)
- GTEXT(add_ten_to_foo)
-
-SECTION_FUNC(TEXT, add_ten_to_foo)
- addl $10, foo
- ret
diff --git a/samples/nanokernel/test/test_mem_safe/src/main.c b/samples/nanokernel/test/test_mem_safe/src/main.c
deleted file mode 100644
index 7c6476ad0..000000000
--- a/samples/nanokernel/test/test_mem_safe/src/main.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * Copyright (c) 2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @ brief tests for the mem_probe functionalities
- */
-
-#include <stdio.h>
-#include <misc/util.h>
-#include <linker-defs.h>
-#include <misc/debug/mem_safe.h>
-#include <tc_util.h>
-#include <cache.h>
-
-#define MY_DATA_SIZE 16
-const char __aligned(4) real_rodata[MY_DATA_SIZE] = "0123456789abcdef";
-char *rodata = (char *)real_rodata;
-char __aligned(4) rwdata[MY_DATA_SIZE+1];
-char __aligned(4) buffer[MY_DATA_SIZE+1];
-
-#if MY_DATA_SIZE != 16
- #error never verified with values other than 16!
-#endif
-
-#define ROM_START ((uint32_t)&_image_rom_start)
-#define ROM_END ((uint32_t)&_image_rom_end)
-#define RAM_START ((uint32_t)&_image_ram_start)
-#define RAM_END ((uint32_t)&_image_ram_end)
-
-char * const p_image_rom_start = (char *)ROM_START;
-char * const p_image_rom_end = (char *)ROM_END;
-char * const p_image_ram_start = (char *)RAM_START;
-char * const p_image_ram_end = (char *)RAM_END;
-
-char *rw_data_after_image = (char *)(RAM_END + KB(1));
-char *rw_data_after_image_end;
-char *ro_data_after_image = (char *)(RAM_END + KB(3));
-char *ro_data_after_image_end;
-
-int foo;
-
-static void update_rv(int *rv, int last_result)
-{
- *rv = *rv == TC_FAIL ? *rv : last_result;
- if (last_result == TC_FAIL) {
- TC_PRINT("FAIL\n");
- } else {
- TC_PRINT("PASS\n");
- }
-}
-
-#define RO 0
-#define RW 1
-#define INVALID -1
-static int mem_range_check(const void *p)
-{
- uint32_t addr = (uint32_t)p;
-
- if (addr >= ROM_START && addr < ROM_END) {
- return RO;
- } else if (addr >= RAM_START && addr < RAM_END) {
- return RW;
- } else {
- return INVALID;
- }
-}
-
-static int test_width(char *mem, int perm, int width, int expected)
-{
- char *rights_str = perm == SYS_MEM_SAFE_READ ? "READ" :
- perm == SYS_MEM_SAFE_WRITE ? "WRITE" :
- "INVALID ACCESS";
- int mem_type = mem_range_check(mem);
- char *mem_range_str = mem_type == RO ? "RO" :
- mem_type == RW ? "RW" : "out-of-image";
-
- TC_PRINT("testing %s of %s on %s memory with width %d.......",
- expected == 0 ? "SUCCESS" : "FAILURE",
- rights_str, mem_range_str, width);
-
- int rv = _mem_probe(mem, perm, width, buffer);
-
- return rv == expected ? TC_PASS : TC_FAIL;
-}
-
-static int test_width_read(char *mem, int width, int expected)
-{
- return test_width(mem, SYS_MEM_SAFE_READ, width, expected);
-}
-
-static int test_width_write(char *mem, int width, int expected)
-{
- return test_width(mem, SYS_MEM_SAFE_WRITE, width, expected);
-}
-
-typedef int (*access_func)(void *, char *, size_t, int);
-static int test_mem_safe_access(void *p, char *buf, int size,
- int width, int perm)
-{
- int rc;
- char *func_str = (perm == SYS_MEM_SAFE_WRITE) ? "write" : "read";
-
- access_func func = (perm == SYS_MEM_SAFE_WRITE) ?
- _mem_safe_write : _mem_safe_read;
-
- TC_PRINT("testing SUCCESS of _mem_safe_%s(size: %d, width: %d).......",
- func_str, size, width);
- rc = func(p, buf, size, width);
- if (rc < 0) {
- TC_PRINT("(%d)", rc);
- return TC_FAIL;
- }
-
- if (memcmp(p, buf, size) != 0) {
- TC_PRINT("(bad data)");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-void main(void)
-{
- int rv = TC_PASS;
- int rc; /* temporary return code */
-
- buffer[MY_DATA_SIZE] = '\0';
- rwdata[MY_DATA_SIZE] = '\0';
-
- TC_START("safe memory access routines\n");
-
- /****
- * _mem_probe()
- */
-
- /* test access perm */
-
- update_rv(&rv, test_width_read(rodata, 1, 0));
- update_rv(&rv, test_width_read(rodata, 2, 0));
- update_rv(&rv, test_width_read(rodata, 4, 0));
-
- update_rv(&rv, test_width_write(rodata, 1, -EFAULT));
- update_rv(&rv, test_width_write(rodata, 2, -EFAULT));
- update_rv(&rv, test_width_write(rodata, 4, -EFAULT));
-
- update_rv(&rv, test_width_read(rwdata, 1, 0));
- update_rv(&rv, test_width_read(rwdata, 2, 0));
- update_rv(&rv, test_width_read(rwdata, 4, 0));
-
- update_rv(&rv, test_width_write(rwdata, 1, 0));
- update_rv(&rv, test_width_write(rwdata, 2, 0));
- update_rv(&rv, test_width_write(rwdata, 4, 0));
-
- const int invalid_access_right = 3;
-
- update_rv(&rv, test_width(rwdata, invalid_access_right, 4, -EINVAL));
-
- /* test alignments constraints */
-
- update_rv(&rv, test_width_read(rodata, 0, -EINVAL));
- update_rv(&rv, test_width_read(rodata, 1, 0));
- update_rv(&rv, test_width_read(rodata, 2, 0));
- update_rv(&rv, test_width_read(rodata, 3, -EINVAL));
- update_rv(&rv, test_width_read(rodata, 4, 0));
- update_rv(&rv, test_width_read(rodata, 5, -EINVAL));
- update_rv(&rv, test_width_read(rodata, 8, -EINVAL));
-
- /* test image limits */
-
- update_rv(&rv, test_width_read(p_image_rom_start, 1, 0));
- update_rv(&rv, test_width_read(p_image_rom_end - 1, 1, 0));
- update_rv(&rv, test_width_read(p_image_ram_start, 1, 0));
- update_rv(&rv, test_width_read(p_image_ram_end - 1, 1, 0));
-
- update_rv(&rv, test_width_write(p_image_rom_start, 1, -EFAULT));
- update_rv(&rv, test_width_write(p_image_rom_end - 1, 1, -EFAULT));
- update_rv(&rv, test_width_write(p_image_ram_start, 1, 0));
- update_rv(&rv, test_width_write(p_image_ram_end - 1, 1, 0));
-
- update_rv(&rv, test_width_read(p_image_rom_start - 1, 1, -EFAULT));
- update_rv(&rv, test_width_read(p_image_ram_end, 1, -EFAULT));
-
- /* test out-of-image valid regions */
-
- rw_data_after_image_end = rw_data_after_image + KB(1);
- ro_data_after_image_end = ro_data_after_image + KB(1);
-
- TC_PRINT("testing SUCCESS of adding extra RO region.......");
- int region_add_rc = _mem_safe_region_add(ro_data_after_image, KB(1),
- SYS_MEM_SAFE_READ);
- if (region_add_rc < 0) {
- update_rv(&rv, TC_FAIL);
- TC_PRINT("FAIL (%d)\n", region_add_rc);
- } else {
- TC_PRINT("PASS\n");
- }
-
- TC_PRINT("testing SUCCESS of adding extra RW region.......");
- region_add_rc = _mem_safe_region_add(rw_data_after_image, KB(1),
- SYS_MEM_SAFE_WRITE);
- if (region_add_rc < 0) {
- update_rv(&rv, TC_FAIL);
- TC_PRINT("FAIL (%d)\n", region_add_rc);
- } else {
- TC_PRINT("PASS\n");
- }
-
- TC_PRINT("testing FAILURE of adding extra region that won't fit.......");
- region_add_rc = _mem_safe_region_add(rw_data_after_image, KB(1),
- SYS_MEM_SAFE_WRITE);
- if (region_add_rc < 0) {
- TC_PRINT("PASS\n");
- } else {
- TC_PRINT("FAIL\n");
- }
-
- update_rv(&rv, test_width_read(ro_data_after_image, 1, 0));
- update_rv(&rv, test_width_read(ro_data_after_image_end - 1, 1, 0));
- update_rv(&rv, test_width_read(rw_data_after_image, 1, 0));
- update_rv(&rv, test_width_read(rw_data_after_image_end - 1, 1, 0));
-
- update_rv(&rv, test_width_write(ro_data_after_image, 1, -EFAULT));
- update_rv(&rv, test_width_write(ro_data_after_image_end - 1, 1, -EFAULT));
- update_rv(&rv, test_width_write(rw_data_after_image, 1, 0));
- update_rv(&rv, test_width_write(rw_data_after_image_end - 1, 1, 0));
-
- update_rv(&rv, test_width_read(ro_data_after_image - 1, 1, -EFAULT));
- update_rv(&rv, test_width_read(ro_data_after_image_end, 1, -EFAULT));
- update_rv(&rv, test_width_read(rw_data_after_image - 1, 1, -EFAULT));
- update_rv(&rv, test_width_read(rw_data_after_image_end, 1, -EFAULT));
-
- /*
- * Test the dividing line between rom and ram, even in non-xip images:
- * it might hit ROM or invalid memory, but never RAM.
- */
- update_rv(&rv, test_width_write(p_image_ram_start - 1, 1, -EFAULT));
-
- TC_PRINT("testing SUCCESS of _mem_probe() reading RO values.......");
- (void)_mem_probe(rodata, SYS_MEM_SAFE_READ, 4, buffer);
- (void)_mem_probe(rodata+4, SYS_MEM_SAFE_READ, 4, buffer+4);
- (void)_mem_probe(rodata+8, SYS_MEM_SAFE_READ, 2, buffer+8);
- (void)_mem_probe(rodata+10, SYS_MEM_SAFE_READ, 2, buffer+10);
- (void)_mem_probe(rodata+12, SYS_MEM_SAFE_READ, 1, buffer+12);
- (void)_mem_probe(rodata+13, SYS_MEM_SAFE_READ, 1, buffer+13);
- (void)_mem_probe(rodata+14, SYS_MEM_SAFE_READ, 1, buffer+14);
- (void)_mem_probe(rodata+15, SYS_MEM_SAFE_READ, 1, buffer+15);
-
- if (memcmp(rodata, buffer, 16) != 0) {
- TC_PRINT("FAIL\n");
- update_rv(&rv, TC_FAIL);
- } else {
- TC_PRINT("PASS\n");
- }
-
- memcpy(rwdata, rodata, MY_DATA_SIZE);
- memset(buffer, '-', MY_DATA_SIZE);
-
- TC_PRINT("testing SUCCESS of _mem_probe() reading RW values.......");
- (void)_mem_probe(rwdata, SYS_MEM_SAFE_READ, 4, buffer);
- (void)_mem_probe(rwdata+4, SYS_MEM_SAFE_READ, 4, buffer+4);
- (void)_mem_probe(rwdata+8, SYS_MEM_SAFE_READ, 2, buffer+8);
- (void)_mem_probe(rwdata+10, SYS_MEM_SAFE_READ, 2, buffer+10);
- (void)_mem_probe(rwdata+12, SYS_MEM_SAFE_READ, 1, buffer+12);
- (void)_mem_probe(rwdata+13, SYS_MEM_SAFE_READ, 1, buffer+13);
- (void)_mem_probe(rwdata+14, SYS_MEM_SAFE_READ, 1, buffer+14);
- (void)_mem_probe(rwdata+15, SYS_MEM_SAFE_READ, 1, buffer+15);
-
- if (memcmp(rwdata, buffer, 16) != 0) {
- TC_PRINT("FAIL\n");
- update_rv(&rv, TC_FAIL);
- } else {
- TC_PRINT("PASS\n");
- }
-
- memcpy(buffer, rodata, MY_DATA_SIZE);
- memset(rwdata, '-', MY_DATA_SIZE);
-
- TC_PRINT("testing SUCCESS of _mem_probe() writing values.......");
- (void)_mem_probe(rwdata, SYS_MEM_SAFE_WRITE, 4, buffer);
- (void)_mem_probe(rwdata+4, SYS_MEM_SAFE_WRITE, 4, buffer+4);
- (void)_mem_probe(rwdata+8, SYS_MEM_SAFE_WRITE, 2, buffer+8);
- (void)_mem_probe(rwdata+10, SYS_MEM_SAFE_WRITE, 2, buffer+10);
- (void)_mem_probe(rwdata+12, SYS_MEM_SAFE_WRITE, 1, buffer+12);
- (void)_mem_probe(rwdata+13, SYS_MEM_SAFE_WRITE, 1, buffer+13);
- (void)_mem_probe(rwdata+14, SYS_MEM_SAFE_WRITE, 1, buffer+14);
- (void)_mem_probe(rwdata+15, SYS_MEM_SAFE_WRITE, 1, buffer+15);
-
- if (memcmp(rwdata, buffer, 16) != 0) {
- TC_PRINT("FAIL\n");
- update_rv(&rv, TC_FAIL);
- } else {
- TC_PRINT("PASS\n");
- }
-
- /*****
- * _mem_safe_read()
- */
-
- memset(buffer, '-', MY_DATA_SIZE);
-
- update_rv(&rv, test_mem_safe_access(rodata, buffer, MY_DATA_SIZE,
- 0, SYS_MEM_SAFE_READ));
-
- update_rv(&rv, test_mem_safe_access(rodata, buffer, MY_DATA_SIZE,
- 4, SYS_MEM_SAFE_READ));
-
- update_rv(&rv, test_mem_safe_access(rodata, buffer, MY_DATA_SIZE-2,
- 2, SYS_MEM_SAFE_READ));
-
- update_rv(&rv, test_mem_safe_access(rodata, buffer, MY_DATA_SIZE-1,
- 1, SYS_MEM_SAFE_READ));
-
- TC_PRINT("testing FAILURE of _mem_safe_read() with bad params.......");
- rc = _mem_safe_read(rodata+1, buffer, MY_DATA_SIZE-1, 2);
- if (rc == 0) {
- TC_PRINT("FAIL\n");
- update_rv(&rv, TC_FAIL);
- } else {
- TC_PRINT("PASS (%d)\n", rc);
- }
-
-
- /*****
- * _mem_safe_write()
- */
-
- memcpy(buffer, rodata, MY_DATA_SIZE);
- memset(rwdata, '-', MY_DATA_SIZE);
- update_rv(&rv, test_mem_safe_access(rwdata, buffer, MY_DATA_SIZE,
- 0, SYS_MEM_SAFE_WRITE));
-
- memcpy(buffer, rodata, MY_DATA_SIZE);
- memset(rwdata, '-', MY_DATA_SIZE);
- update_rv(&rv, test_mem_safe_access(rwdata, buffer, MY_DATA_SIZE,
- 4, SYS_MEM_SAFE_WRITE));
-
- memcpy(buffer, rodata, MY_DATA_SIZE);
- memset(rwdata, '-', MY_DATA_SIZE);
- update_rv(&rv, test_mem_safe_access(rwdata, buffer, MY_DATA_SIZE - 2,
- 2, SYS_MEM_SAFE_WRITE));
-
- memcpy(buffer, rodata, MY_DATA_SIZE);
- memset(rwdata, '-', MY_DATA_SIZE);
- update_rv(&rv, test_mem_safe_access(rwdata, buffer, MY_DATA_SIZE - 1,
- 1, SYS_MEM_SAFE_WRITE));
-
- memcpy(buffer, rodata, MY_DATA_SIZE);
- memset(rwdata, '-', MY_DATA_SIZE);
-
- TC_PRINT("testing FAILURE of _mem_safe_write() with bad params.......");
- rc = _mem_safe_write(rwdata+1, buffer, MY_DATA_SIZE-1, 2);
- if (rc == 0) {
- TC_PRINT("FAIL\n");
- update_rv(&rv, TC_FAIL);
- } else {
- TC_PRINT("PASS (%d)\n", rc);
- }
-
-#if !defined(CONFIG_XIP)
- /*****
- * _mem_safe_write_to_text_section()
- */
-
- extern void add_ten_to_foo(void);
- foo = 0;
- memset(buffer, 0x90, 7);
-
- TC_PRINT("testing FAILURE of _mem_safe_write_to_text_section(&data).......");
- if (_mem_safe_write_to_text_section(&foo, buffer, 1) == 0) {
- TC_PRINT("FAIL\n");
- } else {
- TC_PRINT("PASS\n");
- }
-
- TC_PRINT("testing SUCCESS of _mem_safe_write_to_text_section(&text).......");
- add_ten_to_foo();
- if (foo != 10) {
- TC_PRINT("FAIL\n");
- } else {
- if (_mem_safe_write_to_text_section((void *)add_ten_to_foo,
- buffer, 7) < 0) {
- TC_PRINT("FAIL\n");
- } else {
-
- sys_cache_flush((vaddr_t)add_ten_to_foo, 7);
- add_ten_to_foo();
- if (foo != 10) {
- TC_PRINT("FAIL\n");
- } else {
- TC_PRINT("PASS\n");
- }
- }
- }
-#endif
-
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_mem_safe/testcase.ini b/samples/nanokernel/test/test_mem_safe/testcase.ini
deleted file mode 100644
index e46111b28..000000000
--- a/samples/nanokernel/test/test_mem_safe/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-arch_whitelist = x86 arm
-config_whitelist = !CONFIG_X86_IAMCU
diff --git a/samples/nanokernel/test/test_ring_buf/Makefile b/samples/nanokernel/test/test_ring_buf/Makefile
deleted file mode 100644
index 28e8a5ca8..000000000
--- a/samples/nanokernel/test/test_ring_buf/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj.conf
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_ring_buf/prj.conf b/samples/nanokernel/test/test_ring_buf/prj.conf
deleted file mode 100644
index b6fb4257f..000000000
--- a/samples/nanokernel/test/test_ring_buf/prj.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_RING_BUFFER=y
-
diff --git a/samples/nanokernel/test/test_ring_buf/src/Makefile b/samples/nanokernel/test/test_ring_buf/src/Makefile
deleted file mode 100644
index 7de0cac88..000000000
--- a/samples/nanokernel/test/test_ring_buf/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = test_ring_buf.o
-
diff --git a/samples/nanokernel/test/test_ring_buf/src/test_ring_buf.c b/samples/nanokernel/test/test_ring_buf/src/test_ring_buf.c
deleted file mode 100644
index d54e8e026..000000000
--- a/samples/nanokernel/test/test_ring_buf/src/test_ring_buf.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* test_ring_buf.c: Simple ring buffer test application */
-
-/*
- * Copyright (c) 2015 Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zephyr.h>
-#include <tc_util.h>
-#include <misc/ring_buffer.h>
-
-SYS_RING_BUF_DECLARE_POW2(ring_buf, 8);
-
-char data[] = "ABCDEFGHIJKLMNOPQRSTUVWX";
-#define TYPE 1
-#define VALUE 2
-
-#define INITIAL_SIZE 2
-
-void main(void)
-{
- int ret, put_count, i, rv;
- uint32_t getdata[6];
- uint8_t getsize, getval;
- uint16_t gettype;
- int dsize = INITIAL_SIZE;
-
- TC_START("Test ring buffers");
-
- rv = TC_FAIL;
- put_count = 0;
- while (1) {
- ret = sys_ring_buf_put(&ring_buf, TYPE, VALUE,
- (uint32_t *)data, dsize);
- if (ret == -EMSGSIZE) {
- printk("ring buffer is full\n");
- break;
- }
- printk("inserted %d chunks, %d remaining\n", dsize,
- sys_ring_buf_space_get(&ring_buf));
- dsize = (dsize + 1) % SIZE32_OF(data);
- put_count++;
- }
-
- getsize = INITIAL_SIZE - 1;
- ret = sys_ring_buf_get(&ring_buf, &gettype, &getval, getdata, &getsize);
- if (ret != -EMSGSIZE) {
- printk("Allowed retreival with insufficient destination buffer space\n");
- if (getsize != INITIAL_SIZE)
- printk("Correct size wasn't reported back to the caller\n");
- goto done;
- }
-
- for (i = 0; i < put_count; i++) {
- getsize = SIZE32_OF(getdata);
- ret = sys_ring_buf_get(&ring_buf, &gettype, &getval, getdata,
- &getsize);
- if (ret < 0) {
- printk("Couldn't retrieve a stored value (%d)\n",
- ret);
- goto done;
- }
- printk("got %u chunks of type %u and val %u, %u remaining\n",
- getsize, gettype, getval,
- sys_ring_buf_space_get(&ring_buf));
-
- if (memcmp((char*)getdata, data, getsize * sizeof(uint32_t))) {
- printk("data corrupted\n");
- goto done;
- }
- if (gettype != TYPE) {
- printk("type information corrupted\n");
- goto done;
- }
- if (getval != VALUE) {
- printk("value information corrupted\n");
- goto done;
- }
- }
-
- getsize = SIZE32_OF(getdata);
- ret = sys_ring_buf_get(&ring_buf, &gettype, &getval, getdata,
- &getsize);
- if (ret != -EAGAIN) {
- printk("Got data out of an empty buffer");
- goto done;
- }
- printk("empty buffer detected\n");
-
- rv = TC_PASS;
-done:
- printk("head: %d tail: %d\n", ring_buf.head, ring_buf.tail);
-
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_ring_buf/testcase.ini b/samples/nanokernel/test/test_ring_buf/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/nanokernel/test/test_ring_buf/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/nanokernel/test/test_sema/Makefile b/samples/nanokernel/test/test_sema/Makefile
deleted file mode 100644
index ed3337118..000000000
--- a/samples/nanokernel/test/test_sema/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-CONF_FILE = prj.conf
-BOARD ?= qemu_x86
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_sema/README.txt b/samples/nanokernel/test/test_sema/README.txt
deleted file mode 100644
index 62e64ef4f..000000000
--- a/samples/nanokernel/test/test_sema/README.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-Title: Semaphore APIs
-
-Description:
-
-This test verifies that the nanokernel semaphore APIs operate as expected.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel Semaphores
-Nano objects initialized
-Giving and taking a semaphore in a task (non-blocking)
-Giving and taking a semaphore in an ISR (non-blocking)
-Giving and taking a semaphore in a fiber (non-blocking)
-Semaphore from the task woke the fiber
-Semaphore from the fiber woke the task
-Semaphore from the ISR woke the task.
-First pass
-multiple-waiter fiber 0 trying to get semaphore...
-multiple-waiter fiber 1 trying to get semaphore...
-multiple-waiter fiber 2 trying to get semaphore...
-multiple-waiter fiber 0 acquired semaphore, sending reply
-multiple-waiter fiber 1 acquired semaphore, sending reply
-multiple-waiter fiber 2 acquired semaphore, sending reply
-Task took multi-waiter reply semaphore 3 times, as expected.
-Second pass
-multiple-waiter fiber 0 trying to get semaphore...
-multiple-waiter fiber 1 trying to get semaphore...
-multiple-waiter fiber 2 trying to get semaphore...
-multiple-waiter fiber 0 acquired semaphore, sending reply
-multiple-waiter fiber 1 acquired semaphore, sending reply
-multiple-waiter fiber 2 acquired semaphore, sending reply
-Task took multi-waiter reply semaphore 3 times, as expected.
-test nano_task_sem_take() with timeout > 0
-nano_task_sem_take() timed out as expected
-nano_task_sem_take() got sem in time, as expected
-testing timeouts of 5 fibers on same sem
- got fiber (q order: 2, t/o: 10, sem: 200001c8) as expected
- got fiber (q order: 3, t/o: 15, sem: 200001c8) as expected
- got fiber (q order: 0, t/o: 20, sem: 200001c8) as expected
- got fiber (q order: 4, t/o: 25, sem: 200001c8) as expected
- got fiber (q order: 1, t/o: 30, sem: 200001c8) as expected
-testing timeouts of 9 fibers on different sems
- got fiber (q order: 0, t/o: 10, sem: 200001d4) as expected
- got fiber (q order: 5, t/o: 15, sem: 200001c8) as expected
- got fiber (q order: 7, t/o: 20, sem: 200001c8) as expected
- got fiber (q order: 1, t/o: 25, sem: 200001c8) as expected
- got fiber (q order: 8, t/o: 30, sem: 200001d4) as expected
- got fiber (q order: 2, t/o: 35, sem: 200001c8) as expected
- got fiber (q order: 6, t/o: 40, sem: 200001c8) as expected
- got fiber (q order: 4, t/o: 45, sem: 200001d4) as expected
- got fiber (q order: 3, t/o: 50, sem: 200001d4) as expected
-testing 5 fibers timing out, but obtaining the sem in time
-(except the last one, which times out)
- got fiber (q order: 0, t/o: 20, sem: 200001c8) as expected
- got fiber (q order: 1, t/o: 30, sem: 200001c8) as expected
- got fiber (q order: 2, t/o: 10, sem: 200001c8) as expected
- got fiber (q order: 3, t/o: 15, sem: 200001c8) as expected
- got fiber (q order: 4, t/o: 25, sem: 200001c8) as expected
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_sema/prj.conf b/samples/nanokernel/test/test_sema/prj.conf
deleted file mode 100644
index db8ec4141..000000000
--- a/samples/nanokernel/test/test_sema/prj.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_NANO_TIMEOUTS=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/nanokernel/test/test_sema/src/Makefile b/samples/nanokernel/test/test_sema/src/Makefile
deleted file mode 100644
index 640a46095..000000000
--- a/samples/nanokernel/test/test_sema/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-ccflags-$(CONFIG_SOC_QUARK_D2000) += -DFIBER_STACKSIZE=256
-
-obj-y = sema.o
diff --git a/samples/nanokernel/test/test_sema/src/README b/samples/nanokernel/test/test_sema/src/README
deleted file mode 100644
index 501864ec8..000000000
--- a/samples/nanokernel/test/test_sema/src/README
+++ /dev/null
@@ -1,33 +0,0 @@
-This semaphore test set covers the following scenarios.
-
-nano_fiber_sem_take(TICKS_UNLIMITED)
- - Wait for a semaphore to be given
- - Take a semaphore without waiting
-
-nano_task_sem_take(TICKS_UNLIMITED)
- - Wait for a semaphore to be given
- - Take a semaphore without waiting
-
-nano_isr_sem_take
- - Take a semaphore without waiting
- - Try to take an unavailable semaphore
-
-nano_fiber_sem_take
- - Take a semaphore without waiting
- - Try to take an unavailable semaphore
-
-nano_task_sem_take
- - Take a semaphore without waiting
- - Try to take an unavailable semaphore
-
-nano_fiber_sem_give
- - Waking a task blocked on a semaphore
- - Giving an available semaphore
-
-nano_task_sem_give
- - Waking a fiber blocked on a semaphore
- - Giving an available semaphore
-
-nano_isr_sem_give
- - Waking a task blocked on a semaphore
- - Giving an available semaphore
diff --git a/samples/nanokernel/test/test_sema/src/sema.c b/samples/nanokernel/test/test_sema/src/sema.c
deleted file mode 100644
index c5397d7f0..000000000
--- a/samples/nanokernel/test/test_sema/src/sema.c
+++ /dev/null
@@ -1,976 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file
- * @brief Test nanokernel semaphore APIs
- *
- * This module tests four basic scenarios with the usage of the following
- * semaphore routines:
- *
- * nano_sem_init
- * nano_fiber_sem_give, nano_fiber_sem_take
- * nano_task_sem_give, nano_task_sem_take
- * nano_isr_sem_give, nano_isr_sem_take
- *
- * Scenario #1:
- * A task, fiber or ISR does not wait for the semaphore when taking it.
- *
- * Scenario #2:
- * A task or fiber must wait for the semaphore to be given before it gets it.
- *
- * Scenario #3:
- * Multiple fibers pend on the same semaphore.
- *
- * Scenario #4:
- * Timeout scenarios with multiple semaphores and fibers.
- */
-
-#include <tc_util.h>
-#include <arch/cpu.h>
-#include <misc/util.h>
-#include <irq_offload.h>
-
-#include <util_test_common.h>
-
-#ifndef FIBER_STACKSIZE
-#define FIBER_STACKSIZE 2000
-#endif
-#define FIBER_PRIORITY 4
-
-typedef struct {
- struct nano_sem *sem; /* ptr to semaphore */
- int data; /* data */
-} ISR_SEM_INFO;
-
-typedef enum {
- STS_INIT = -1,
- STS_TASK_WOKE_FIBER,
- STS_FIBER_WOKE_TASK,
- STS_ISR_WOKE_TASK
-} SEM_TEST_STATE;
-
-static SEM_TEST_STATE semTestState;
-static ISR_SEM_INFO isrSemInfo;
-static struct nano_sem testSem;
-static int fiberDetectedFailure = 0;
-
-static struct nano_timer timer;
-static void *timerData[1];
-
-static char __stack fiberStack[FIBER_STACKSIZE];
-
-static struct nano_sem multi_waiters;
-static struct nano_sem reply_multi_waiters;
-
-/**
- *
- * @brief Take a semaphore
- *
- * This routine is the ISR handler for _trigger_nano_isr_sem_take(). It takes a
- * semaphore within the context of an ISR.
- *
- * @param data pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_sem_take(void *data)
-{
- ISR_SEM_INFO *pInfo = (ISR_SEM_INFO *) data;
-
- pInfo->data = nano_isr_sem_take(pInfo->sem, TICKS_NONE);
-}
-
-static void _trigger_nano_isr_sem_take(void)
-{
- irq_offload(isr_sem_take, &isrSemInfo);
-}
-
-/**
- *
- * @brief Give a semaphore
- *
- * This routine is the ISR handler for _trigger_nano_isr_sem_take(). It gives a
- * semaphore within the context of an ISR.
- *
- * @param data pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_sem_give(void *data)
-{
- ISR_SEM_INFO *pInfo = (ISR_SEM_INFO *) data;
-
- nano_isr_sem_give(pInfo->sem);
- pInfo->data = 1; /* Indicate semaphore has been given */
-}
-
-static void _trigger_nano_isr_sem_give(void)
-{
- irq_offload(isr_sem_give, &isrSemInfo);
-}
-
-/**
- *
- * @brief Give and take the semaphore in a fiber without blocking
- *
- * This test gives and takes the test semaphore in a fiber
- * without blocking on the semaphore.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int testSemFiberNoWait(void)
-{
- int i;
-
- TC_PRINT("Giving and taking a semaphore in a fiber (non-blocking)\n");
-
- /*
- * Give the semaphore many times and then make sure that it can only be
- * taken that many times.
- */
-
- for (i = 0; i < 32; i++) {
- nano_fiber_sem_give(&testSem);
- }
-
- for (i = 0; i < 32; i++) {
- if (nano_fiber_sem_take(&testSem, TICKS_NONE) != 1) {
- TC_ERROR(" *** Expected nano_fiber_sem_take() to succeed, not fail\n");
- goto errorReturn;
- }
- }
-
- if (nano_fiber_sem_take(&testSem, TICKS_NONE) != 0) {
- TC_ERROR(" *** Expected nano_fiber_sem_take() to fail, not succeed\n");
- goto errorReturn;
- }
-
- return TC_PASS;
-
-errorReturn:
- fiberDetectedFailure = 1;
- return TC_FAIL;
-}
-
-/**
- *
- * @brief Entry point for the fiber portion of the semaphore tests
- *
- * NOTE: The fiber portion of the tests have higher priority than the task
- * portion of the tests.
- *
- * @param arg1 unused
- * @param arg2 unused
- *
- * @return N/A
- */
-
-static void fiberEntry(int arg1, int arg2)
-{
- int rv; /* return value from a test */
-
- ARG_UNUSED(arg1);
- ARG_UNUSED(arg2);
-
- rv = testSemFiberNoWait();
- if (rv != TC_PASS) {
- return;
- }
-
- /*
- * At this point <testSem> is not available. Wait for <testSem> to become
- * available (the main task will give it).
- */
-
- nano_fiber_sem_take(&testSem, TICKS_UNLIMITED);
-
- semTestState = STS_TASK_WOKE_FIBER;
-
- /*
- * Delay for two seconds. This gives the main task time to print
- * any messages (very important if I/O link is slow!), and wait
- * on <testSem>. Once the delay is done, this fiber will give <testSem>
- * thus waking the main task.
- */
-
- nano_fiber_timer_start(&timer, SECONDS(2));
- nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
-
- /*
- * The main task is now waiting on <testSem>. Give the semaphore <testSem>
- * to wake it.
- */
-
- nano_fiber_sem_give(&testSem);
-
- /*
- * Some small delay must be done so that the main task can process the
- * semaphore signal.
- */
-
- semTestState = STS_FIBER_WOKE_TASK;
-
- nano_fiber_timer_start(&timer, SECONDS(2));
- nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
-
- /*
- * The main task should be waiting on <testSem> again. This time, instead
- * of giving the semaphore from the semaphore, give it from an ISR to wake
- * the main task.
- */
-
- isrSemInfo.data = 0;
- isrSemInfo.sem = &testSem;
- _trigger_nano_isr_sem_give();
-
- if (isrSemInfo.data == 1) {
- semTestState = STS_ISR_WOKE_TASK;
- }
-}
-
-/**
- *
- * @brief Initialize nanokernel objects
- *
- * This routine initializes the nanokernel objects used in the semaphore tests.
- *
- * @return N/A
- */
-
-void initNanoObjects(void)
-{
- nano_sem_init(&testSem);
- nano_sem_init(&multi_waiters);
- nano_sem_init(&reply_multi_waiters);
- nano_timer_init(&timer, timerData);
-
- TC_PRINT("Nano objects initialized\n");
-}
-
-/**
- *
- * @brief Give and take the semaphore in an ISR without blocking
- *
- * This test gives and takes the test semaphore in the context of an ISR without
- * blocking on the semaphore.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int testSemIsrNoWait(void)
-{
- int i;
-
- TC_PRINT("Giving and taking a semaphore in an ISR (non-blocking)\n");
-
- /*
- * Give the semaphore many times and then make sure that it can only be
- * taken that many times.
- */
-
- isrSemInfo.sem = &testSem;
- for (i = 0; i < 32; i++) {
- _trigger_nano_isr_sem_give();
- }
-
- for (i = 0; i < 32; i++) {
- isrSemInfo.data = 0;
- _trigger_nano_isr_sem_take();
- if (isrSemInfo.data != 1) {
- TC_ERROR(" *** Expected nano_isr_sem_take() to succeed, not fail\n");
- goto errorReturn;
- }
- }
-
- _trigger_nano_isr_sem_take();
- if (isrSemInfo.data != 0) {
- TC_ERROR(" *** Expected nano_isr_sem_take() to fail, not succeed!\n");
- goto errorReturn;
- }
-
- return TC_PASS;
-
-errorReturn:
- return TC_FAIL;
-}
-
-/**
- *
- * @brief Give and take the semaphore in a task without blocking
- *
- * This test gives and takes the test semaphore in a task without
- * blocking on the semaphore.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int testSemTaskNoWait(void)
-{
- int i; /* loop counter */
-
- TC_PRINT("Giving and taking a semaphore in a task (non-blocking)\n");
-
- /*
- * Give the semaphore many times and then make sure that it can only be
- * taken that many times.
- */
-
- for (i = 0; i < 32; i++) {
- nano_task_sem_give(&testSem);
- }
-
- for (i = 0; i < 32; i++) {
- if (nano_task_sem_take(&testSem, TICKS_NONE) != 1) {
- TC_ERROR(" *** Expected nano_task_sem_take() to succeed, not fail\n");
- goto errorReturn;
- }
- }
-
- if (nano_task_sem_take(&testSem, TICKS_NONE) != 0) {
- TC_ERROR(" *** Expected nano_task_sem_take() to fail, not succeed!\n");
- goto errorReturn;
- }
-
- return TC_PASS;
-
-errorReturn:
- return TC_FAIL;
-}
-
-/**
- *
- * @brief Perform tests that wait on a semaphore
- *
- * This routine works with fiberEntry() to perform the tests that wait on
- * a semaphore.
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int testSemWait(void)
-{
- if (fiberDetectedFailure != 0) {
- TC_ERROR(" *** Failure detected in the fiber.");
- return TC_FAIL;
- }
-
- nano_task_sem_give(&testSem); /* Wake the fiber. */
-
- if (semTestState != STS_TASK_WOKE_FIBER) {
- TC_ERROR(" *** Expected task to wake fiber. It did not.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("Semaphore from the task woke the fiber\n");
-
- nano_task_sem_take(&testSem, TICKS_UNLIMITED); /* Wait on <testSem> */
-
- if (semTestState != STS_FIBER_WOKE_TASK) {
- TC_ERROR(" *** Expected fiber to wake task. It did not.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("Semaphore from the fiber woke the task\n");
-
- nano_task_sem_take(&testSem, TICKS_UNLIMITED); /* Wait on <testSem> again. */
-
- if (semTestState != STS_ISR_WOKE_TASK) {
- TC_ERROR(" *** Expected ISR to wake task. It did not.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("Semaphore from the ISR woke the task.\n");
- return TC_PASS;
-}
-
-/*
- * Multiple-waiters test
- *
- * NUM_WAITERS fibers pend on the multi_waiters semaphore, then the task give
- * the semaphore NUM_WAITERS times. Each time, the first fiber in the queue
- * wakes up, is context-switched to, and gives the reply_multi_waiters
- * semaphore, for a total of NUM_WAITERS times. The task finally must be able
- * to obtain the reply_multi_waiters semaphore NUM_WAITERS times.
- */
-#define NUM_WAITERS 3
-static char __stack fiber_multi_waiters_stacks[NUM_WAITERS][FIBER_STACKSIZE];
-
-/**
- *
- * @brief Fiber entry point for multiple-waiters test
- *
- * @return N/A
- */
-
-static void fiber_multi_waiters(int arg1, int arg2)
-{
- TC_PRINT("multiple-waiter fiber %d trying to get semaphore...\n", arg1);
- nano_fiber_sem_take(&multi_waiters, TICKS_UNLIMITED);
- TC_PRINT("multiple-waiter fiber %d acquired semaphore, sending reply\n",
- arg1);
- nano_fiber_sem_give(&reply_multi_waiters);
-}
-
-/**
- *
- * @brief Task part of multiple-waiter test, repeatable
- *
- * @return N/A
- */
-
-static int do_test_multiple_waiters(void)
-{
- int ii;
-
- /* pend all fibers one the same semaphore */
- for (ii = 0; ii < NUM_WAITERS; ii++) {
- task_fiber_start(fiber_multi_waiters_stacks[ii], FIBER_STACKSIZE,
- fiber_multi_waiters, ii, 0, FIBER_PRIORITY, 0);
- }
-
- /* wake up all the fibers: the task is preempted each time */
- for (ii = 0; ii < NUM_WAITERS; ii++) {
- nano_task_sem_give(&multi_waiters);
- }
-
- /* reply_multi_waiters will have been given once for each fiber */
- for (ii = 0; ii < NUM_WAITERS; ii++) {
- if (!nano_task_sem_take(&reply_multi_waiters, TICKS_NONE)) {
- TC_ERROR(" *** Cannot take sem supposedly given by waiters.\n");
- return TC_FAIL;
- }
- }
-
- TC_PRINT("Task took multi-waiter reply semaphore %d times, as expected.\n",
- NUM_WAITERS);
-
- if (nano_task_sem_take(&multi_waiters, TICKS_NONE)) {
- TC_ERROR(" *** multi_waiters should have been empty.\n");
- return TC_FAIL;
- }
-
- if (nano_task_sem_take(&reply_multi_waiters, TICKS_NONE)) {
- TC_ERROR(" *** reply_multi_waiters should have been empty.\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point for multiple-waiters test
- *
- * @return N/A
- */
-
-static int test_multiple_waiters(void)
-{
- TC_PRINT("First pass\n");
- if (do_test_multiple_waiters() == TC_FAIL) {
- TC_ERROR(" *** First pass test failed.\n");
- return TC_FAIL;
- }
-
- /*
- * Verify a wait q that has been emptied has been reset correctly, so
- * redo the test.
- */
-
- TC_PRINT("Second pass\n");
- if (do_test_multiple_waiters() == TC_FAIL) {
- TC_ERROR(" *** Second pass test failed.\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/* timeout tests
- *
- * Test the nano_xxx_sem_wait_timeout() APIs.
- *
- * First, the task waits with a timeout and times out. Then it wait with a
- * timeout, but gets the semaphore in time.
- *
- * Then, multiple timeout tests are done for the fibers, to test the ordering
- * of queueing/dequeueing when timeout occurs, first on one semaphore, then on
- * multiple semaphores.
- *
- * Finally, multiple fibers pend on one semaphore, and they all get the
- * semaphore in time, except the last one: this tests that the timeout is
- * recomputed correctly when timeouts are aborted.
- */
-
-#include <tc_nano_timeout_common.h>
-
-static struct nano_sem sem_timeout[2];
-struct nano_fifo timeout_order_fifo;
-
-struct reply_packet {
- void *link_in_fifo;
- int reply;
-};
-
-struct timeout_order_data {
- void *link_in_fifo;
- struct nano_sem *sem;
- int32_t timeout;
- int timeout_order;
- int q_order;
-};
-
-struct timeout_order_data timeout_order_data[] = {
- {0, &sem_timeout[0], TIMEOUT(2), 2, 0},
- {0, &sem_timeout[0], TIMEOUT(4), 4, 1},
- {0, &sem_timeout[0], TIMEOUT(0), 0, 2},
- {0, &sem_timeout[0], TIMEOUT(1), 1, 3},
- {0, &sem_timeout[0], TIMEOUT(3), 3, 4},
-};
-
-struct timeout_order_data timeout_order_data_mult_sem[] = {
- {0, &sem_timeout[1], TIMEOUT(0), 0, 0},
- {0, &sem_timeout[0], TIMEOUT(3), 3, 1},
- {0, &sem_timeout[0], TIMEOUT(5), 5, 2},
- {0, &sem_timeout[1], TIMEOUT(8), 8, 3},
- {0, &sem_timeout[1], TIMEOUT(7), 7, 4},
- {0, &sem_timeout[0], TIMEOUT(1), 1, 5},
- {0, &sem_timeout[0], TIMEOUT(6), 6, 6},
- {0, &sem_timeout[0], TIMEOUT(2), 2, 7},
- {0, &sem_timeout[1], TIMEOUT(4), 4, 8},
-};
-
-#define TIMEOUT_ORDER_NUM_FIBERS ARRAY_SIZE(timeout_order_data_mult_sem)
-static char __stack timeout_stacks[TIMEOUT_ORDER_NUM_FIBERS][FIBER_STACKSIZE];
-
-/* a fiber sleeps then gives a semaphore */
-static void test_fiber_give_timeout(int sem, int timeout)
-{
- fiber_sleep((int32_t)timeout);
- nano_fiber_sem_give((struct nano_sem *)sem);
-}
-
-/* a fiber pends on a semaphore then times out */
-static void test_fiber_pend_and_timeout(int data, int unused)
-{
- struct timeout_order_data *the_data = (void *)data;
- int32_t orig_ticks = sys_tick_get();
- int rv;
-
- ARG_UNUSED(unused);
-
- rv = nano_fiber_sem_take(the_data->sem, the_data->timeout);
- if (rv) {
- TC_ERROR(" *** timeout of %d did not time out.\n",
- the_data->timeout);
- return;
- }
- if (!is_timeout_in_range(orig_ticks, the_data->timeout)) {
- return;
- }
-
- nano_fiber_fifo_put(&timeout_order_fifo, the_data);
-}
-
-/* the task spins several fibers that pend and timeout on sempahores */
-static int test_multiple_fibers_pending(struct timeout_order_data *test_data,
- int test_data_size)
-{
- int ii;
-
- for (ii = 0; ii < test_data_size; ii++) {
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_timeout,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
- }
-
- for (ii = 0; ii < test_data_size; ii++) {
- struct timeout_order_data *data =
- nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
-
- if (data->timeout_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, sem: %p) as expected\n",
- data->q_order, data->timeout, data->sem);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/* a fiber pends on a semaphore with a timeout and gets the semaphore in time */
-static void test_fiber_pend_and_get_sem(int data, int unused)
-{
- struct timeout_order_data *the_data = (void *)data;
- int rv;
-
- ARG_UNUSED(unused);
-
- rv = nano_fiber_sem_take(the_data->sem, the_data->timeout);
- if (!rv) {
- TC_PRINT(" *** fiber (q order: %d, t/o: %d, sem: %p) timed out!\n",
- the_data->q_order, the_data->timeout, the_data->sem);
- return;
- }
-
- nano_fiber_fifo_put(&timeout_order_fifo, the_data);
-}
-
-/* the task spins fibers that get the sem in time, except the last one */
-static int test_multiple_fibers_get_sem(struct timeout_order_data *test_data,
- int test_data_size)
-{
- struct timeout_order_data *data;
- int ii;
-
- for (ii = 0; ii < test_data_size-1; ii++) {
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_get_sem,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
- }
- task_fiber_start(timeout_stacks[ii], FIBER_STACKSIZE,
- test_fiber_pend_and_timeout,
- (int)&test_data[ii], 0,
- FIBER_PRIORITY, 0);
-
- for (ii = 0; ii < test_data_size-1; ii++) {
- nano_task_sem_give(test_data[ii].sem);
-
- data = nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
-
- if (data->q_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, sem: %p) as expected\n",
- data->q_order, data->timeout, data->sem);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->q_order, ii);
- return TC_FAIL;
- }
- }
-
- data = nano_task_fifo_get(&timeout_order_fifo, TICKS_UNLIMITED);
- if (data->q_order == ii) {
- TC_PRINT(" got fiber (q order: %d, t/o: %d, sem: %p) as expected\n",
- data->q_order, data->timeout, data->sem);
- } else {
- TC_ERROR(" *** fiber %d woke up, expected %d\n",
- data->timeout_order, ii);
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-static void test_fiber_ticks_special_values(int packet, int special_value)
-{
- struct reply_packet *reply_packet = (void *)packet;
-
- reply_packet->reply =
- nano_fiber_sem_take(&sem_timeout[0], special_value);
- nano_fiber_fifo_put(&timeout_order_fifo, reply_packet);
-}
-
-/* the timeout test entry point */
-static int test_timeout(void)
-{
- int64_t orig_ticks;
- int32_t timeout;
- int rv;
- int test_data_size;
- struct reply_packet reply_packet;
-
- nano_sem_init(&sem_timeout[0]);
- nano_sem_init(&sem_timeout[1]);
- nano_fifo_init(&timeout_order_fifo);
-
- /* test nano_task_sem_take() with timeout */
- timeout = 10;
- orig_ticks = sys_tick_get();
- rv = nano_task_sem_take(&sem_timeout[0], timeout);
- if (rv) {
- TC_ERROR(" *** timeout of %d did not time out.\n", timeout);
- return TC_FAIL;
- }
- if ((sys_tick_get() - orig_ticks) < timeout) {
- TC_ERROR(" *** task did not wait long enough on timeout of %d.\n",
- timeout);
- return TC_FAIL;
- }
-
- /* test nano_task_sem_take() with timeout of 0 */
-
- rv = nano_task_sem_take(&sem_timeout[0], 0);
- if (rv) {
- TC_ERROR(" *** timeout of 0 did not time out.\n");
- return TC_FAIL;
- }
-
- /* test nano_task_sem_take() with timeout > 0 */
-
- TC_PRINT("test nano_task_sem_take() with timeout > 0\n");
-
- timeout = 3;
- orig_ticks = sys_tick_get();
-
- rv = nano_task_sem_take(&sem_timeout[0], timeout);
-
- if (rv) {
- TC_ERROR(" *** timeout of %d did not time out.\n",
- timeout);
- return TC_FAIL;
- }
-
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- return TC_FAIL;
- }
-
- TC_PRINT("nano_task_sem_take() timed out as expected\n");
-
- /*
- * test nano_task_sem_take() with a timeout and fiber that gives
- * the semaphore on time
- */
-
- timeout = 5;
- orig_ticks = sys_tick_get();
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_give_timeout, (int)&sem_timeout[0],
- timeout,
- FIBER_PRIORITY, 0);
-
- rv = nano_task_sem_take(&sem_timeout[0], (int)(timeout + 5));
- if (!rv) {
- TC_ERROR(" *** timed out even if semaphore was given in time.\n");
- return TC_FAIL;
- }
-
- if (!is_timeout_in_range(orig_ticks, timeout)) {
- return TC_FAIL;
- }
-
- TC_PRINT("nano_task_sem_take() got sem in time, as expected\n");
-
- /*
- * test nano_task_sem_take() with TICKS_NONE and the
- * semaphore unavailable.
- */
-
- if (nano_task_sem_take(&sem_timeout[0], TICKS_NONE)) {
- TC_ERROR("task with TICKS_NONE got sem, but shouldn't have\n");
- return TC_FAIL;
- }
-
- TC_PRINT("task with TICKS_NONE did not get sem, as expected\n");
-
- /*
- * test nano_task_sem_take() with TICKS_NONE and the
- * semaphore available.
- */
-
- nano_task_sem_give(&sem_timeout[0]);
- if (!nano_task_sem_take(&sem_timeout[0], TICKS_NONE)) {
- TC_ERROR("task with TICKS_NONE did not get available sem\n");
- return TC_FAIL;
- }
-
- TC_PRINT("task with TICKS_NONE got available sem, as expected\n");
-
- /*
- * test nano_task_sem_take() with TICKS_UNLIMITED and the
- * semaphore available.
- */
-
- TC_PRINT("Trying to take available sem with TICKS_UNLIMITED:\n"
- " will hang the test if it fails.\n");
-
- nano_task_sem_give(&sem_timeout[0]);
- if (!nano_task_sem_take(&sem_timeout[0], TICKS_UNLIMITED)) {
- TC_ERROR(" *** This will never be hit!!! .\n");
- return TC_FAIL;
- }
-
- TC_PRINT("task with TICKS_UNLIMITED got available sem, as expected\n");
-
- /* test fiber with timeout of TICKS_NONE not getting empty semaphore */
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_NONE, FIBER_PRIORITY, 0);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 0) {
- TC_ERROR(" *** fiber should not have obtained the semaphore.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_NONE did not get sem, as expected\n");
-
- /* test fiber with timeout of TICKS_NONE getting full semaphore */
-
- nano_task_sem_give(&sem_timeout[0]);
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_NONE, FIBER_PRIORITY, 0);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 1) {
- TC_ERROR(" *** fiber should have obtained the semaphore.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_NONE got available sem, as expected\n");
-
- /* test fiber with timeout of TICKS_UNLIMITED getting full semaphore */
-
- nano_task_sem_give(&sem_timeout[0]);
-
- task_fiber_start(timeout_stacks[0], FIBER_STACKSIZE,
- test_fiber_ticks_special_values,
- (int)&reply_packet, TICKS_UNLIMITED, FIBER_PRIORITY, 0);
-
- if (!nano_task_fifo_get(&timeout_order_fifo, TICKS_NONE)) {
- TC_ERROR(" *** fiber should have run and filled the fifo.\n");
- return TC_FAIL;
- }
-
- if (reply_packet.reply != 1) {
- TC_ERROR(" *** fiber should have obtained the semaphore.\n");
- return TC_FAIL;
- }
-
- TC_PRINT("fiber with TICKS_UNLIMITED got available sem, as expected\n");
-
- /* test multiple fibers pending on the same sem with different timeouts */
-
- test_data_size = ARRAY_SIZE(timeout_order_data);
-
- TC_PRINT("testing timeouts of %d fibers on same sem\n", test_data_size);
-
- rv = test_multiple_fibers_pending(timeout_order_data, test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not time out in the right order\n");
- return TC_FAIL;
- }
-
- /* test multiple fibers pending on different sems with different timeouts */
-
- test_data_size = ARRAY_SIZE(timeout_order_data_mult_sem);
-
- TC_PRINT("testing timeouts of %d fibers on different sems\n",
- test_data_size);
-
- rv = test_multiple_fibers_pending(timeout_order_data_mult_sem,
- test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not time out in the right order\n");
- return TC_FAIL;
- }
-
- /*
- * test multiple fibers pending on same sem with different timeouts, but
- * getting the semaphore in time, except the last one.
- */
-
- test_data_size = ARRAY_SIZE(timeout_order_data);
-
- TC_PRINT("testing %d fibers timing out, but obtaining the sem in time\n"
- "(except the last one, which times out)\n",
- test_data_size);
-
- rv = test_multiple_fibers_get_sem(timeout_order_data, test_data_size);
- if (rv != TC_PASS) {
- TC_ERROR(" *** fibers did not get the sem in the right order\n");
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to semaphore tests
- *
- * This is the entry point to the semaphore tests.
- *
- * @return N/A
- */
-
-void main(void)
-{
- int rv; /* return value from tests */
-
- TC_START("Test Nanokernel Semaphores");
-
- initNanoObjects();
-
- rv = testSemTaskNoWait();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- rv = testSemIsrNoWait();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- semTestState = STS_INIT;
-
- /*
- * Start the fiber. The fiber will be given a higher priority than the
- * main task.
- */
-
- task_fiber_start(fiberStack, FIBER_STACKSIZE, fiberEntry,
- 0, 0, FIBER_PRIORITY, 0);
-
- rv = testSemWait();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- rv = test_multiple_waiters();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
- rv = test_timeout();
- if (rv != TC_PASS) {
- goto doneTests;
- }
-
-doneTests:
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_sema/testcase.ini b/samples/nanokernel/test/test_sema/testcase.ini
deleted file mode 100644
index 6be0a8d3a..000000000
--- a/samples/nanokernel/test/test_sema/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-# Not enough SRAM to run this test on quark SE
-platform_exclude = quark_se_sss_ctb arduino_101_sss
diff --git a/samples/nanokernel/test/test_stack/Makefile b/samples/nanokernel/test/test_stack/Makefile
deleted file mode 100644
index ed3337118..000000000
--- a/samples/nanokernel/test/test_stack/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-CONF_FILE = prj.conf
-BOARD ?= qemu_x86
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_stack/README.txt b/samples/nanokernel/test/test_stack/README.txt
deleted file mode 100644
index dfe38afde..000000000
--- a/samples/nanokernel/test/test_stack/README.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-Title: Stack APIs
-
-Description:
-
-This test verifies that the nanokernel stack APIs operate as expected.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel STACK
-Test Task STACK Push
-
-TASK STACK Put Order: 100, 200, 300, 400,
-===================================================================
-Test Fiber STACK Pop
-
-FIBER STACK Pop: count = 0, data is 400
-FIBER STACK Pop: count = 1, data is 300
-FIBER STACK Pop: count = 2, data is 200
-FIBER STACK Pop: count = 3, data is 100
-PASS - fiber1.
-===================================================================
-Test Fiber STACK Push
-
-FIBER STACK Put Order: 400, 300, 200, 100,
-===================================================================
-Test Task STACK Pop
-TASK STACK Pop: count = 0, data is 100
-TASK STACK Pop: count = 1, data is 200
-TASK STACK Pop: count = 2, data is 300
-TASK STACK Pop: count = 3, data is 400
-===================================================================
-Test STACK Pop Wait Interfaces
-
-TASK STACK Push to queue2: 100
-Test Fiber STACK Pop Wait Interfaces
-
-FIBER STACK Pop from queue2: 100
-FIBER STACK Push to queue1: 200
-TASK STACK Pop from queue1: 200
-TASK STACK Push to queue2: 300
-FIBER STACK Pop from queue2: 300
-FIBER STACK Push to queue1: 400
-PASS - testFiberStackPopW.
-===================================================================
-Test ISR STACK (invoked from Fiber)
-
-ISR STACK (running in fiber context) Pop from queue1: 400
-ISR STACK (running in fiber context) Push to queue1:
- 150, 250, 350, 450,
-PASS - testIsrStackFromFiber.
-PASS - fiber2.
-PASS - testTaskStackPopW.
-===================================================================
-Test ISR STACK (invoked from Task)
-
- Pop from queue1: count = 0, data is 450
- Pop from queue1: count = 1, data is 350
- Pop from queue1: count = 2, data is 250
- Pop from queue1: count = 3, data is 150
-
-Test ISR STACK (invoked from Task) - push 450 and pop back 450
-PASS - testIsrStackFromTask.
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_stack/prj.conf b/samples/nanokernel/test/test_stack/prj.conf
deleted file mode 100644
index 2da0bd453..000000000
--- a/samples/nanokernel/test/test_stack/prj.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_IRQ_OFFLOAD=y
diff --git a/samples/nanokernel/test/test_stack/src/Makefile b/samples/nanokernel/test/test_stack/src/Makefile
deleted file mode 100644
index 69ad4761b..000000000
--- a/samples/nanokernel/test/test_stack/src/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-
-obj-y = stack.o
diff --git a/samples/nanokernel/test/test_stack/src/stack.c b/samples/nanokernel/test/test_stack/src/stack.c
deleted file mode 100644
index cd0d0ec1b..000000000
--- a/samples/nanokernel/test/test_stack/src/stack.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (c) 2012-2014 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file
- * @brief Test nanokernel stack APIs
- *
- * This module tests three basic scenarios with the usage of the following
- * STACK routines:
- *
- * nano_fiber_stack_pop, nano_fiber_stack_push
- * nano_task_stack_pop, nano_task_stack_push
- * nano_isr_stack_pop, nano_isr_stack_push
- *
- * Scenario #1
- * Task enters items into a queue, starts the fiber and waits for a semaphore.
- * Fiber extracts all items from the queue and enters some items back into
- * the queue. Fiber gives the semaphore for task to continue. Once the
- * control is returned back to task, task extracts all items from the queue.
- *
- * Scenario #2
- * Task enters an item into queue2, starts a fiber and extract an item from
- * queue1 once the item is there. The fiber will extract an item from queue2
- * once the item is there and and enter an item to queue1. The flow of control
- * goes from task to fiber and so forth.
- *
- * Scenario #3
- * Tests the ISR interfaces. Fiber2 pops an item from queue1 in ISR context.
- * It then enters four items into the queue and finishes execution. Control
- * is returned back to function testTaskStackPopW which also finished it's
- * execution and returned to main. Finally function testIsrStackFromTask is
- * run and it popped all data from queue1, push and pop one last item to the
- * queue. All these are run in ISR context.
- */
-
-#include <tc_util.h>
-#include <arch/cpu.h>
-#include <irq_offload.h>
-
-#include <util_test_common.h>
-
-#define STACKSIZE 2048
-#define NUM_STACK_ELEMENT 4
-#define STARTNUM 1 /* Used to compute data to put in the stack */
-#define MULTIPLIER 100 /* Used to compute data to put in the stack */
-#define MYNUMBER 50 /* Used to compute data to put in the stack */
-#define INVALID_DATA 0 /* Invalid data on stack */
-
-#define TCERR1(count) TC_ERROR("Didn't get back correct data, count %d\n", count)
-#define TCERR2 TC_ERROR("Didn't get back correct data\n")
-#define TCERR3 TC_ERROR("The stack should be empty!\n")
-
-typedef struct {
- struct nano_stack *stack_ptr; /* STACK */
- uint32_t data; /* data to add */
-} ISR_STACK_INFO;
-
-
-char __stack fiberStack1[STACKSIZE];
-char __stack fiberStack2[STACKSIZE];
-char __stack fiberStack3[STACKSIZE];
-
-struct nano_timer timer;
-struct nano_stack nanoStackObj;
-struct nano_stack nanoStackObj2;
-struct nano_sem nanoSemObj; /* Used for transferring control between
- * main and fiber1
- */
-
-uint32_t myData[NUM_STACK_ELEMENT];
-uint32_t myIsrData[NUM_STACK_ELEMENT]; /* Data used for testing
- * nano_isr_stack_push and
- * nanoIsrStatckPop interfaces
- */
-uint32_t stack1[NUM_STACK_ELEMENT];
-uint32_t stack2[NUM_STACK_ELEMENT];
-
-void *timerData[1];
-int retCode = TC_PASS;
-
-static ISR_STACK_INFO isrStackInfo = {&nanoStackObj, 0};
-
-void initData(void);
-void fiber1(void);
-void fiber2(void);
-void initNanoObjects(void);
-void testFiberStackPopW(void);
-void testTaskStackPopW(void);
-/* Isr related functions */
-void isr_stack_push(void *parameter);
-void isr_stack_pop(void *parameter);
-void testIsrStackFromFiber(void);
-void testIsrStackFromTask(void);
-
-
-/**
- *
- * initData
- *
- * Initialize myData and myIsrData arrays.
- *
- * @return none
- */
-
-void initData(void)
-{
- for (int i=0; i< NUM_STACK_ELEMENT; i++) {
- myData[i] = (STARTNUM + i) * MULTIPLIER;
- myIsrData[i] = myData[i] + MYNUMBER;
- }
-} /* initData */
-
-/**
- *
- * @brief Add an item to a STACK
- *
- * This routine is the ISR handler for _trigger_nano_isr_stack_push(). It adds
- * an item to the STACK in the context of an ISR.
- *
- * @param parameter pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_stack_push(void *parameter)
-{
- ISR_STACK_INFO *pInfo = (ISR_STACK_INFO *) parameter;
-
- nano_isr_stack_push(pInfo->stack_ptr, pInfo->data);
-
-} /* isr_stack_push */
-
-static void _trigger_nano_isr_stack_push(void)
-{
- irq_offload(isr_stack_push, &isrStackInfo);
-}
-
-/**
- *
- * @brief Get an item from a STACK
- *
- * This routine is the ISR handler for _trigger_nano_isr_stack_pop(). It gets
- * an item from the STACK in the context of an ISR. If the queue is empty,
- * it sets data to INVALID_DATA.
- *
- * @param parameter pointer to ISR handler parameter
- *
- * @return N/A
- */
-
-void isr_stack_pop(void *parameter)
-{
- ISR_STACK_INFO *pInfo = (ISR_STACK_INFO *) parameter;
-
- if (nano_isr_stack_pop(pInfo->stack_ptr, &(pInfo->data), TICKS_NONE) == 0) {
- /* the stack is empty, set data to INVALID_DATA */
- pInfo->data = INVALID_DATA;
- }
-
-} /* isr_stack_pop */
-
-static void _trigger_nano_isr_stack_pop(void)
-{
- irq_offload(isr_stack_pop, &isrStackInfo);
-}
-
-/**
- *
- * fiber1
- *
- * This is the fiber started from the main task. Gets all items from
- * the STACK queue and puts four items back to the STACK queue. Control is
- * transferred back to the main task.
- *
- * @return N/A
- */
-
-void fiber1(void)
-{
- uint32_t data; /* data used to put and get from the stack queue */
- int count = 0; /* counter */
-
- TC_PRINT("Test Fiber STACK Pop\n\n");
- /* Get all data */
- while (nano_fiber_stack_pop(&nanoStackObj, &data, TICKS_NONE) != 0) {
- TC_PRINT("FIBER STACK Pop: count = %d, data is %d\n", count, data);
- if ((count >= NUM_STACK_ELEMENT) || (data != myData[NUM_STACK_ELEMENT - 1 - count])) {
- TCERR1(count);
- retCode = TC_FAIL;
- return;
- }
- count++;
- }
-
- TC_END_RESULT(retCode);
- PRINT_LINE;
-
- /* Put data */
- TC_PRINT("Test Fiber STACK Push\n");
- TC_PRINT("\nFIBER STACK Put Order: ");
- for (int i=NUM_STACK_ELEMENT; i>0; i--) {
- nano_fiber_stack_push(&nanoStackObj, myData[i-1]);
- TC_PRINT(" %d,", myData[i-1]);
- }
- TC_PRINT("\n");
- PRINT_LINE;
-
- /* Give semaphore to allow the main task to run */
- nano_fiber_sem_give(&nanoSemObj);
-
-} /* fiber1 */
-
-
-
-/**
- *
- * testFiberStackPopW
- *
- * This function tests the stack push and pop wait interfaces in a fiber.
- * It gets data from nanoStackObj2 queue and puts data to nanoStackObj queue.
- *
- * @return N/A
- */
-
-void testFiberStackPopW(void)
-{
- uint32_t data; /* data used to put and get from the stack queue */
- int rc;
-
- TC_PRINT("Test Fiber STACK Pop Wait Interfaces\n\n");
- rc = nano_fiber_stack_pop(&nanoStackObj2, &data, TICKS_UNLIMITED);
- TC_PRINT("FIBER STACK Pop from queue2: %d\n", data);
- /* Verify results */
- if ((rc == 0) || (data != myData[0])) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- data = myData[1];
- TC_PRINT("FIBER STACK Push to queue1: %d\n", data);
- nano_fiber_stack_push(&nanoStackObj, data);
-
- rc = nano_fiber_stack_pop(&nanoStackObj2, &data, TICKS_UNLIMITED);
- TC_PRINT("FIBER STACK Pop from queue2: %d\n", data);
- /* Verify results */
- if ((rc == 0) || (data != myData[2])) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- data = myData[3];
- TC_PRINT("FIBER STACK Push to queue1: %d\n", data);
- nano_fiber_stack_push(&nanoStackObj, data);
-
- TC_END_RESULT(retCode);
-
-} /* testFiberStackPopW */
-
-/**
- *
- * testIsrStackFromFiber
- *
- * This function tests the stack push and pop interfaces in the ISR context.
- * It is invoked from a fiber.
- *
- * We use nanoStackObj queue to push and pop data.
- *
- * @return N/A
- */
-
-void testIsrStackFromFiber(void)
-{
- uint32_t result = INVALID_DATA; /* data used to put and get from the stack queue */
-
- TC_PRINT("Test ISR STACK (invoked from Fiber)\n\n");
-
- /* This is data pushed by function testFiberStackPopW */
- _trigger_nano_isr_stack_pop();
- result = isrStackInfo.data;
- if (result != INVALID_DATA) {
- TC_PRINT("ISR STACK (running in fiber) Pop from queue1: %d\n", result);
- if (result != myData[3]) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
- }
-
- /* Verify that the STACK is empty */
- _trigger_nano_isr_stack_pop();
- result = isrStackInfo.data;
- if (result != INVALID_DATA) {
- TC_PRINT("Pop from queue1: %d\n", result);
- retCode = TC_FAIL;
- TCERR3;
- return;
- }
-
- /* Put more data into STACK */
- TC_PRINT("ISR STACK (running in fiber) Push to queue1:\n");
- for (int i=0; i<NUM_STACK_ELEMENT; i++) {
- isrStackInfo.data = myIsrData[i];
- TC_PRINT(" %d, ", myIsrData[i]);
- _trigger_nano_isr_stack_push();
- }
- TC_PRINT("\n");
-
- /* Set variable to INVALID_DATA to ensure [data] changes */
- isrStackInfo.data = INVALID_DATA;
-
- TC_END_RESULT(retCode);
-
-} /* testIsrStackFromFiber */
-
-/**
- *
- * testIsrStackFromTask
- *
- * This function tests the stack push and pop interfaces in the ISR context.
- * It is invoked from a task.
- *
- * We use nanoStackObj queue to push and pop data.
- *
- * @return N/A
- */
-
-void testIsrStackFromTask(void)
-{
- uint32_t result = INVALID_DATA; /* data used to put and get from the stack queue */
- int count = 0;
-
- TC_PRINT("Test ISR STACK (invoked from Task)\n\n");
-
- /* Get all data */
- _trigger_nano_isr_stack_pop();
- result = isrStackInfo.data;
-
- while (result != INVALID_DATA) {
- TC_PRINT(" Pop from queue1: count = %d, data is %d\n", count, result);
- if ((count >= NUM_STACK_ELEMENT) || (result != myIsrData[NUM_STACK_ELEMENT - count - 1])) {
- TCERR1(count);
- retCode = TC_FAIL;
- return;
- } /* if */
-
- /* Get the next element */
- _trigger_nano_isr_stack_pop();
- result = isrStackInfo.data;
- count++;
- } /* while */
-
-
- /* Put data into stack and get it again */
- isrStackInfo.data = myIsrData[3];
- _trigger_nano_isr_stack_push();
- isrStackInfo.data = INVALID_DATA; /* force variable to a new value */
- /* Get data from stack */
- _trigger_nano_isr_stack_pop();
- result = isrStackInfo.data;
- /* Verify data */
- if (result != myIsrData[3]) {
- TCERR2;
- retCode = TC_FAIL;
- return;
- } else {
- TC_PRINT("\nTest ISR STACK (invoked from Task) - push %d and pop back %d\n",
- myIsrData[3], result);
- }
-
- TC_END_RESULT(retCode);
-}
-
-/**
- *
- * fiber2
- *
- * This is the fiber started from the testTaskStackPopW function.
- *
- * @return N/A
- */
-
-void fiber2(void)
-{
- testFiberStackPopW();
- PRINT_LINE;
- testIsrStackFromFiber();
-
- TC_END_RESULT(retCode);
-}
-
-
-/**
- *
- * testTaskStackPopW
- *
- * This is in the task. It puts data to nanoStackObj2 queue and gets
- * data from nanoStackObj queue.
- *
- * @return N/A
- */
-
-void testTaskStackPopW(void)
-{
- uint32_t data; /* data used to put and get from the stack queue */
- int rc;
-
- PRINT_LINE;
- TC_PRINT("Test STACK Pop Wait Interfaces\n\n");
- data = myData[0];
- TC_PRINT("TASK STACK Push to queue2: %d\n", data);
- nano_task_stack_push(&nanoStackObj2, data);
-
- /* Start fiber */
- task_fiber_start(&fiberStack2[0], STACKSIZE,
- (nano_fiber_entry_t) fiber2, 0, 0, 7, 0);
-
- rc = nano_task_stack_pop(&nanoStackObj, &data, TICKS_UNLIMITED);
- TC_PRINT("TASK STACK Pop from queue1: %d\n", data);
- /* Verify results */
- if ((rc == 0) || (data != myData[1])) {
- retCode = TC_FAIL;
- TCERR2;
- return;
- }
-
- data = myData[2];
- TC_PRINT("TASK STACK Push to queue2: %d\n", data);
- nano_task_stack_push(&nanoStackObj2, data);
-
- TC_END_RESULT(retCode);
-} /* testTaskStackPopW */
-
-/**
- *
- * @brief A fiber to help test nano_task_stack_pop(TICKS_UNLIMITED)
- *
- * This fiber blocks for one second before pushing an item onto the stack.
- * The main task, which was waiting for item from the stack then unblocks.
- *
- * @return N/A
- */
-
-void fiber3(void)
-{
- nano_fiber_timer_start(&timer, SECONDS(1));
- nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
- nano_fiber_stack_push(&nanoStackObj, myData[0]);
-}
-
-/**
- *
- * @brief Initialize nanokernel objects
- *
- * This routine initializes the nanokernel objects used in the STACK tests.
- *
- * @return N/A
- */
-
-void initNanoObjects(void)
-{
- nano_stack_init(&nanoStackObj, stack1);
- nano_stack_init(&nanoStackObj2, stack2);
- nano_sem_init(&nanoSemObj);
- nano_timer_init(&timer, timerData);
-} /* initNanoObjects */
-
-/**
- *
- * @brief Entry point to STACK tests
- *
- * This is the entry point to the STACK tests.
- *
- * @return N/A
- */
-
-void main(void)
-{
- int count = 0; /* counter */
- uint32_t data; /* data used to put and get from the stack queue */
- int rc; /* return code */
-
- TC_START("Test Nanokernel STACK");
-
- /* Initialize data */
- initData();
-
- /* Initialize the queues and semaphore */
- initNanoObjects();
-
- /* Start fiber3 */
- task_fiber_start(&fiberStack3[0], STACKSIZE, (nano_fiber_entry_t) fiber3,
- 0, 0, 7, 0);
- /*
- * While fiber3 blocks (for one second), wait for an item to be pushed
- * onto the stack so that it can be popped. This will put the nanokernel
- * into an idle state.
- */
-
- rc = nano_task_stack_pop(&nanoStackObj, &data, TICKS_UNLIMITED);
- if ((rc == 0) || (data != myData[0])) {
- TC_ERROR("nano_task_stack_pop(TICKS_UNLIMITED) expected 0x%x, but got 0x%x\n",
- myData[0], data);
- retCode = TC_FAIL;
- goto exit;
- }
-
- /* Put data */
- TC_PRINT("Test Task STACK Push\n");
- TC_PRINT("\nTASK STACK Put Order: ");
- for (int i=0; i<NUM_STACK_ELEMENT; i++) {
- nano_task_stack_push(&nanoStackObj, myData[i]);
- TC_PRINT(" %d,", myData[i]);
- }
- TC_PRINT("\n");
-
- PRINT_LINE;
-
- /* Start fiber */
- task_fiber_start(&fiberStack1[0], STACKSIZE,
- (nano_fiber_entry_t) fiber1, 0, 0, 7, 0);
-
- if (retCode == TC_FAIL) {
- goto exit;
- }
-
- /*
- * Wait for fiber1 to complete execution. (Using a semaphore gives
- * the fiber the freedom to do blocking-type operations if it wants to.)
- *
- */
- nano_task_sem_take(&nanoSemObj, TICKS_UNLIMITED);
- TC_PRINT("Test Task STACK Pop\n");
-
- /* Get all data */
- while (nano_task_stack_pop(&nanoStackObj, &data, TICKS_NONE) != 0) {
- TC_PRINT("TASK STACK Pop: count = %d, data is %d\n", count, data);
- if ((count >= NUM_STACK_ELEMENT) || (data != myData[count])) {
- TCERR1(count);
- retCode = TC_FAIL;
- goto exit;
- }
- count++;
- }
-
- /* Test Task Stack Pop Wait interfaces*/
- testTaskStackPopW();
-
- if (retCode == TC_FAIL) {
- goto exit;
- }
-
- PRINT_LINE;
-
- /* Test ISR interfaces */
- testIsrStackFromTask();
- PRINT_LINE;
-
-exit:
- TC_END_RESULT(retCode);
- TC_END_REPORT(retCode);
-}
diff --git a/samples/nanokernel/test/test_stack/testcase.ini b/samples/nanokernel/test/test_stack/testcase.ini
deleted file mode 100644
index 914a14535..000000000
--- a/samples/nanokernel/test/test_stack/testcase.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[test]
-tags = core
diff --git a/samples/nanokernel/test/test_stackprot/Makefile b/samples/nanokernel/test/test_stackprot/Makefile
deleted file mode 100644
index 9e224802b..000000000
--- a/samples/nanokernel/test/test_stackprot/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR = $(ZEPHYR_BASE)/samples/microkernel/test/test_stackprot/src/
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_stackprot/README.txt b/samples/nanokernel/test/test_stackprot/README.txt
deleted file mode 100644
index b024150a6..000000000
--- a/samples/nanokernel/test/test_stackprot/README.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-Title: Stack Protection Support
-
-Description:
-
-This test verifies that stack canaries operate as expected in the nanokernel.
-
----------------------------------------------------------------------------
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Stack Protection Canary
-
-Starts main
-Starts fiber1
-fiber1: Input string is too long and stack overflowed!
-
-***** Stack Check Fail! *****
-Current context ID = 0x00102628
-Faulting instruction address = 0xdeaddead
-Fatal fiber error! Aborting fiber.
-main: Stack ok
-main: Stack ok
-main: Stack ok
-main: Stack ok
-main: Stack ok
-main: Stack ok
-===================================================================
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_stackprot/prj_arc.conf b/samples/nanokernel/test/test_stackprot/prj_arc.conf
deleted file mode 100644
index 30efacabe..000000000
--- a/samples/nanokernel/test/test_stackprot/prj_arc.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-CONFIG_STACK_CANARIES=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/nanokernel/test/test_stackprot/prj_arm.conf b/samples/nanokernel/test/test_stackprot/prj_arm.conf
deleted file mode 100644
index 705015028..000000000
--- a/samples/nanokernel/test/test_stackprot/prj_arm.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_STACK_CANARIES=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/nanokernel/test/test_stackprot/prj_x86.conf b/samples/nanokernel/test/test_stackprot/prj_x86.conf
deleted file mode 100644
index 705015028..000000000
--- a/samples/nanokernel/test/test_stackprot/prj_x86.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_STACK_CANARIES=y
-
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/nanokernel/test/test_stackprot/testcase.ini b/samples/nanokernel/test/test_stackprot/testcase.ini
deleted file mode 100644
index d49ae301e..000000000
--- a/samples/nanokernel/test/test_stackprot/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-arch_whitelist = x86 arm
-
diff --git a/samples/nanokernel/test/test_static_idt/Makefile b/samples/nanokernel/test/test_static_idt/Makefile
deleted file mode 100644
index b7cc132c3..000000000
--- a/samples/nanokernel/test/test_static_idt/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR = $(ZEPHYR_BASE)/samples/microkernel/test/test_static_idt/src/
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_static_idt/README.txt b/samples/nanokernel/test/test_static_idt/README.txt
deleted file mode 100644
index f132753e6..000000000
--- a/samples/nanokernel/test/test_static_idt/README.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-Title: Static IDT Support
-
-Description:
-
-This test verifies that the static IDT feature operates as expected in a
-nanokernel environment.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel static IDT tests
-Testing to see if IDT has address of test stubs()
-Testing to see interrupt handler executes properly
-Testing to see exception handler executes properly
-Testing to see spurious handler executes properly
-- Expect to see unhandled interrupt/exception message
-***** Unhandled exception/interrupt occurred! *****
-Current context ID = 0x00102a68
-Faulting instruction address = 0x00102c50
-Fatal fiber error! Aborting fiber.
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_static_idt/prj_x86.conf b/samples/nanokernel/test/test_static_idt/prj_x86.conf
deleted file mode 100644
index 51f60f531..000000000
--- a/samples/nanokernel/test/test_static_idt/prj_x86.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
-CONFIG_EXCEPTION_DEBUG=n
diff --git a/samples/nanokernel/test/test_static_idt/testcase.ini b/samples/nanokernel/test/test_static_idt/testcase.ini
deleted file mode 100644
index 2c17b4094..000000000
--- a/samples/nanokernel/test/test_static_idt/testcase.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[test]
-tags = core
-arch_whitelist = x86
-
diff --git a/samples/nanokernel/test/test_timer/Makefile b/samples/nanokernel/test/test_timer/Makefile
deleted file mode 100644
index e5444f423..000000000
--- a/samples/nanokernel/test/test_timer/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_timer/README.txt b/samples/nanokernel/test/test_timer/README.txt
deleted file mode 100644
index 80fff21ea..000000000
--- a/samples/nanokernel/test/test_timer/README.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-Title: Timer APIs
-
-Description:
-
-This test verifies that the nanokernel timer APIs operate as expected.
-
----------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
----------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
----------------------------------------------------------------------------
-
-Sample Output:
-
-tc_start() - Test Nanokernel Timer
-Task testing basic timer functionality
- - test expected to take four seconds
-Task testing timers expire in the correct order
- - test expected to take five or six seconds
-Task testing the stopping of timers
- - test expected to take six seconds
-Fiber testing basic timer functionality
- - test expected to take four seconds
-Fiber testing timers expire in the correct order
- - test expected to take five or six seconds
-Task testing the stopping of timers
- - test expected to take six seconds
-Fiber to stop a timer that has a waiting fiber
-Task to stop a timer that has a waiting fiber
-PASS - main.
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_timer/prj_arc.conf b/samples/nanokernel/test/test_timer/prj_arc.conf
deleted file mode 100644
index 9df657136..000000000
--- a/samples/nanokernel/test/test_timer/prj_arc.conf
+++ /dev/null
@@ -1 +0,0 @@
-# use default configuration settings
diff --git a/samples/nanokernel/test/test_timer/prj_arm.conf b/samples/nanokernel/test/test_timer/prj_arm.conf
deleted file mode 100644
index 9df657136..000000000
--- a/samples/nanokernel/test/test_timer/prj_arm.conf
+++ /dev/null
@@ -1 +0,0 @@
-# use default configuration settings
diff --git a/samples/nanokernel/test/test_timer/prj_x86.conf b/samples/nanokernel/test/test_timer/prj_x86.conf
deleted file mode 100644
index 8158ec40f..000000000
--- a/samples/nanokernel/test/test_timer/prj_x86.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# Let stack canaries use non-random number generator.
-# This option is NOT to be used in production code.
-
-CONFIG_TEST_RANDOM_GENERATOR=y
diff --git a/samples/nanokernel/test/test_timer/src/Makefile b/samples/nanokernel/test/test_timer/src/Makefile
deleted file mode 100644
index 6404cba00..000000000
--- a/samples/nanokernel/test/test_timer/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ccflags-y += -I${srctree}/samples/include
-ccflags-$(CONFIG_SOC_QUARK_D2000) += -DFIBER_STACKSIZE=256 -DFIBER2_STACKSIZE=256
-
-obj-y=timer.o
diff --git a/samples/nanokernel/test/test_timer/src/README b/samples/nanokernel/test/test_timer/src/README
deleted file mode 100644
index 7bca49f1c..000000000
--- a/samples/nanokernel/test/test_timer/src/README
+++ /dev/null
@@ -1,42 +0,0 @@
-Starting a timer
- Case 1: Add to an empty timer list
- Case 2: Add to the end of the timer list (big tick value)
- Case 3: Add to the start of the timer list (small tick value)
- Case 4: Add to the middle of the timer list (medium tick value)
-
-Stopping a timer
- No point to stop a non-existent timer
- Case 1: Stop one at the head of the list (nothing waiting on it)
- Case 2: Stop one at the end of the list (nothing waiting on it)
- Case 3: Stop one in the middle of the list (nothing waiting on it)
- Case 4: Stop the last in the list (nothing waiting on it)
- Case 5: Stop a timer that had a fiber waiting on it
-
-Timer Expiry
- Case 1: Timer has expired
- Case 2: Timer has not expired
- Case 3: Wait for a timer to expire
-
-Expired timers can use the sys_tick_get_32() and sys_tick_delta() routines
-to check the results against the timer routines.
-
-This test set does not yet test/verify sys_cycle_get_32()--that must still be
-done.
-
-APIs tested in this test set
-============================
-
-nano_timer_init (implicitly done--called as part of platform init)
-nano_fiber_timer_start
-nano_task_timer_start
-nano_fiber_timer_stop
-nano_task_timer_stop
-nano_fiber_timer_test(TICKS_NONE)
-nano_fiber_timer_test(TICKS_UNLIMITED)
-nano_task_timer_test(TICKS_NONE)
-nano_task_timer_test(TICKS_UNLIMITED)
-
---------------------------------
-nanoTimeInit (implicitly done)
-sys_tick_get_32
-sys_tick_delta
diff --git a/samples/nanokernel/test/test_timer/src/timer.c b/samples/nanokernel/test/test_timer/src/timer.c
deleted file mode 100644
index 6122003d3..000000000
--- a/samples/nanokernel/test/test_timer/src/timer.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * Copyright (c) 2012-2015 Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file
- * @brief Test nanokernel timer APIs
- *
- * This module tests the following timer related routines:
- * nano_timer_init(), nano_fiber_timer_start(), nano_fiber_timer_stop(),
- * nano_fiber_timer_test(), nano_task_timer_start(),
- * nano_task_timer_stop(), nano_task_timer_test(),
- * sys_tick_get_32(), sys_cycle_get_32(), sys_tick_delta()
- */
-
-#include <tc_util.h>
-#include <arch/cpu.h>
-
-#define TWO_SECONDS (2 * sys_clock_ticks_per_sec)
-#define SIX_SECONDS (6 * sys_clock_ticks_per_sec)
-
-#define SHORT_TIMEOUT (1 * sys_clock_ticks_per_sec)
-#define LONG_TIMEOUT (5 * sys_clock_ticks_per_sec)
-#define MID_TIMEOUT (3 * sys_clock_ticks_per_sec)
-
-#ifndef FIBER_STACKSIZE
-#define FIBER_STACKSIZE 2000
-#endif
-#define FIBER_PRIORITY 4
-
-#ifndef FIBER2_STACKSIZE
-#define FIBER2_STACKSIZE 2000
-#endif
-#define FIBER2_PRIORITY 10
-
-typedef void (*timer_start_func)(struct nano_timer *, int);
-typedef void (*timer_stop_func)(struct nano_timer *);
-typedef void* (*timer_test_func)(struct nano_timer *, int32_t);
-
-static struct nano_timer timer;
-static struct nano_timer shortTimer;
-static struct nano_timer longTimer;
-static struct nano_timer midTimer;
-
-static struct nano_sem wakeTask;
-static struct nano_sem wakeFiber;
-
-static void *timerData[1];
-static void *shortTimerData[1];
-static void *longTimerData[1];
-static void *midTimerData[1];
-
-static int fiberDetectedError = 0;
-static char __stack fiberStack[FIBER_STACKSIZE];
-static char __stack fiber2Stack[FIBER2_STACKSIZE];
-
-/**
- *
- * @brief Initialize nanokernel objects
- *
- * This routine initializes the nanokernel objects used in the LIFO tests.
- *
- * @return N/A
- */
-
-void initNanoObjects(void)
-{
- nano_timer_init(&timer, timerData);
- nano_timer_init(&shortTimer, shortTimerData);
- nano_timer_init(&longTimer, longTimerData);
- nano_timer_init(&midTimer, midTimerData);
- nano_sem_init(&wakeTask);
- nano_sem_init(&wakeFiber);
-}
-
-/**
- *
- * @brief Basic checking of time spent waiting upon a timer
- *
- * This routine can be called from a task or a fiber to wait upon a timer.
- * It will busy wait until the current tick ends, at which point it will
- * start and then wait upon a timer. The length of time it spent waiting
- * gets cross-checked with the sys_tick_get_32() and nanoTimeElapsed() APIs.
- * All three are expected to match up, but a tolerance of one (1) tick is
- * considered acceptable.
- *
- * This routine can be considered as testing sys_tick_get_32(),
- * nanoTimeElapsed() and nanoXXXTimerGetW() successful expiration cases.
- *
- * @param startRtn routine to start the timer
- * @param testRtn routine to get and wait for the timer
- * @param pTimer pointer to the timer
- * @param pTimerData pointer to the expected timer data
- * @param ticks number of ticks to wait
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int basicTimerWait(timer_start_func startRtn, timer_test_func testRtn,
- struct nano_timer *pTimer, void *pTimerData, int ticks)
-{
- int64_t reftime; /* reference time for tick delta */
- uint32_t tick; /* current tick */
- uint32_t elapsed_32; /* # of elapsed ticks for 32-bit functions*/
- int64_t elapsed; /* # of elapsed ticks */
- uint32_t duration; /* duration of the test in ticks */
- void *result; /* value returned from timer get routine */
- int busywaited = 0; /* non-zero if <testRtn> returns NULL */
-
- TC_PRINT(" - test expected to take four seconds\n");
-
- tick = sys_tick_get_32();
- while (sys_tick_get_32() == tick) {
- /* Align to a tick boundary */
- }
-
- tick++;
- (void) sys_tick_delta(&reftime);
- startRtn(pTimer, ticks); /* Start the timer */
- result = testRtn(pTimer, TICKS_UNLIMITED);/* Wait for the timer to expire */
-
- elapsed_32 = sys_tick_delta_32(&reftime);
- duration = sys_tick_get_32() - tick;
-
- /*
- * The difference between <duration> and <elapsed> is expected to be zero
- * however, the test is allowing for tolerance of an extra tick in case of
- * timing variations.
- */
-
- if ((result != pTimerData) ||
- (duration - elapsed_32 > 1) || ((duration - ticks) > 1)) {
- return TC_FAIL;
- }
-
- /* Check that the non-wait-timer-get routine works properly. */
- tick = sys_tick_get_32();
- while (sys_tick_get_32() == tick) {
- /* Align to a tick boundary */
- }
-
- tick++;
- (void) sys_tick_delta(&reftime);
- startRtn(pTimer, ticks); /* Start the timer */
- while ((result = testRtn(pTimer, TICKS_NONE)) == NULL) {
- busywaited = 1;
- }
- elapsed = sys_tick_delta(&reftime);
- duration = sys_tick_get_32() - tick;
-
- if ((busywaited != 1) || (result != pTimerData) ||
- (duration - elapsed > 1) || ((duration - ticks) > 1)) {
- return TC_FAIL;
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Start four timers
- *
- * This routine starts four timers.
- * The first (<timer>) is added to an empty list of timers.
- * The second (<longTimer>) is added to the end of the list of timers.
- * The third (<shortTimer>) is added to the head of the list of timers.
- * The fourth (<midTimer>) is added to the middle of the list of timers.
- *
- * Four timers are used so that the various paths can be tested.
- *
- * @param startRtn routine to start the timers
- *
- * @return N/A
- */
-
-void startTimers(timer_start_func startRtn)
-{
- int tick; /* current tick */
-
- tick = sys_tick_get_32();
- while (sys_tick_get_32() == tick) {
- /* Wait for the end of the tick */
- }
-
- startRtn(&timer, TWO_SECONDS);
- startRtn(&longTimer, LONG_TIMEOUT);
- startRtn(&shortTimer, SHORT_TIMEOUT);
- startRtn(&midTimer, MID_TIMEOUT);
-}
-
-/**
- *
- * @brief Busy wait while checking timers expire in the correct order
- *
- * This routine checks that the four timers created using startTimers() finish
- * in the correct order. It busy waits on all four timers waiting until they
- * expire. The timers are expected to expire in the following order:
- * <shortTimer>, <timer>, <midTimer>, <longTimer>
- *
- * @param testRtn timer wait routine (fiber or task)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int busyWaitTimers(timer_test_func testRtn)
-{
- int numExpired = 0; /* # of expired timers */
- void *result; /* value returned from <testRtn> */
- uint32_t ticks; /* tick by which time test should be complete */
-
- TC_PRINT(" - test expected to take five or six seconds\n");
-
- ticks = sys_tick_get_32() + SIX_SECONDS;
- while ((numExpired != 4) && (sys_tick_get_32() < ticks)) {
- result = testRtn(&timer, TICKS_NONE);
- if (result != NULL) {
- numExpired++;
- if ((result != timerData) || (numExpired != 2)) {
- TC_ERROR("Expected <timer> to expire 2nd, not 0x%x\n",
- result);
- return TC_FAIL;
- }
- }
-
- result = testRtn(&shortTimer, TICKS_NONE);
- if (result != NULL) {
- numExpired++;
- if ((result != shortTimerData) || (numExpired != 1)) {
- TC_ERROR("Expected <shortTimer> to expire 1st, not 0x%x\n",
- result);
- return TC_FAIL;
- }
- }
-
- result = testRtn(&midTimer, TICKS_NONE);
- if (result != NULL) {
- numExpired++;
- if ((result != midTimerData) || (numExpired != 3)) {
- TC_ERROR("Expected <midTimer> to expire 3rd, not 0x%x\n",
- result);
- return TC_FAIL;
- }
- }
-
- result = testRtn(&longTimer, TICKS_NONE);
- if (result != NULL) {
- numExpired++;
- if ((result != longTimerData) || (numExpired != 4)) {
- TC_ERROR("Expected <longTimer> to expire 4th, not 0x%x\n",
- result);
- return TC_FAIL;
- }
- }
- }
-
- return (sys_tick_get_32() < ticks) ? TC_PASS : TC_FAIL;
-}
-
-/**
- *
- * @brief Stop the four timers and make sure they did not expire
- *
- * This routine stops the four started timers and then checks the timers for
- * six seconds to make sure that they did not fire. The four timers will be
- * stopped in the reverse order in which they were started. Doing so will
- * exercise the code that removes timers from important locations in the list;
- * these include the middle, the head, the tail, and the last item.
- *
- * @param stopRtn routine to stop timer (fiber or task)
- * @param testRtn timer wait routine (fiber or task)
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int stopTimers(timer_stop_func stopRtn, timer_test_func testRtn)
-{
- int startTick; /* tick at which test starts */
- int endTick; /* tick by which test should be completed */
-
- stopRtn(&midTimer);
- stopRtn(&shortTimer);
- stopRtn(&longTimer);
- stopRtn(&timer);
-
- TC_PRINT(" - test expected to take six seconds\n");
-
- startTick = sys_tick_get_32();
- while (sys_tick_get_32() == startTick) {
- }
- startTick++;
- endTick = startTick + SIX_SECONDS;
-
- while (sys_tick_get_32() < endTick) {
- if ((testRtn(&timer, TICKS_NONE) != NULL) ||
- (testRtn(&shortTimer, TICKS_NONE) != NULL) ||
- (testRtn(&midTimer, TICKS_NONE) != NULL) ||
- (testRtn(&longTimer, TICKS_NONE) != NULL)) {
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point for the second fiber
- *
- * The second fiber has a lower priority than the first, but is still given
- * precedence over the task.
- *
- * @param arg1 unused
- * @param arg2 unused
- *
- * @return N/A
- */
-
-static void fiber2Entry(int arg1, int arg2)
-{
- ARG_UNUSED(arg1);
- ARG_UNUSED(arg2);
-
- nano_fiber_timer_stop(&timer);
-}
-
-/**
- *
- * @brief Entry point for the fiber portion of the timer tests
- *
- * NOTE: The fiber portion of the tests have higher priority than the task
- * portion of the tests.
- *
- * @param arg1 unused
- * @param arg2 unused
- *
- * @return N/A
- */
-
-static void fiberEntry(int arg1, int arg2)
-{
- int rv; /* return value from a test */
- void *result; /* return value from timer wait routine */
-
- ARG_UNUSED(arg1);
- ARG_UNUSED(arg2);
-
- TC_PRINT("Fiber testing basic timer functionality\n");
-
- rv = basicTimerWait(nano_fiber_timer_start, nano_fiber_timer_test,
- &timer, timerData, TWO_SECONDS);
-
- nano_fiber_sem_give(&wakeTask);
- if (rv != TC_PASS) {
- fiberDetectedError = 1;
- return;
- }
- /* Wait forever - let task run */
- nano_fiber_sem_take(&wakeFiber, TICKS_UNLIMITED);
-
- /* Check that timers expire in the correct order */
- TC_PRINT("Fiber testing timers expire in the correct order\n");
- startTimers(nano_fiber_timer_start);
- rv = busyWaitTimers(nano_fiber_timer_test);
- nano_fiber_sem_give(&wakeTask);
- if (rv != TC_PASS) {
- fiberDetectedError = 2;
- return;
- }
- /* Wait forever - let task run */
- nano_fiber_sem_take(&wakeFiber, TICKS_UNLIMITED);
-
- /* Check that timers can be stopped */
- TC_PRINT("Task testing the stopping of timers\n");
- startTimers(nano_fiber_timer_start);
- rv = stopTimers(nano_fiber_timer_stop, nano_fiber_timer_test);
- nano_fiber_sem_give(&wakeTask);
- if (rv != TC_PASS) {
- fiberDetectedError = 3;
- return;
- }
- /* Wait forever - let task run */
- nano_fiber_sem_take(&wakeFiber, TICKS_UNLIMITED);
-
- /* Fiber to wait on a timer that will be stopped by another fiber */
- TC_PRINT("Fiber to stop a timer that has a waiting fiber\n");
- fiber_fiber_start(fiber2Stack, FIBER2_STACKSIZE, fiber2Entry,
- 0, 0, FIBER2_PRIORITY, 0);
- nano_fiber_timer_start(&timer, TWO_SECONDS); /* Start timer */
- result = nano_fiber_timer_test(&timer, TICKS_UNLIMITED); /* Wait on timer */
- /* Control switches to newly created fiber #2 before coming back. */
- if (result != NULL) {
- fiberDetectedError = 4;
- nano_fiber_sem_give(&wakeTask);
- return;
- }
-
- /* Fiber to wait on timer that will be stopped by the task */
- TC_PRINT("Task to stop a timer that has a waiting fiber\n");
- nano_fiber_sem_give(&wakeTask);
- nano_fiber_timer_start(&timer, TWO_SECONDS);
- result = nano_fiber_timer_test(&timer, TICKS_UNLIMITED);
- if (result != NULL) {
- fiberDetectedError = 5;
- return;
- }
-
- nano_fiber_sem_give(&wakeTask);
-}
-
-/**
- *
- * @brief Test the sys_cycle_get_32() API
- *
- * @return TC_PASS on success, TC_FAIL on failure
- */
-
-int sys_cycle_get_32Test(void)
-{
- uint32_t timeStamp1;
- uint32_t timeStamp2;
- int i;
-
- timeStamp2 = sys_cycle_get_32();
- for (i = 0; i < 1000000; i++) {
- timeStamp1 = timeStamp2;
- timeStamp2 = sys_cycle_get_32();
-
- if (timeStamp2 < timeStamp1) {
- TC_ERROR("Timestamp value not increasing with successive calls\n");
- return TC_FAIL;
- }
- }
-
- return TC_PASS;
-}
-
-/**
- *
- * @brief Entry point to timer tests
- *
- * This is the entry point to the timer tests.
- *
- * @return N/A
- */
-
-void main(void)
-{
- int rv; /* return value from tests */
-
- TC_START("Test Nanokernel Timer");
-
- initNanoObjects();
-
- TC_PRINT("Task testing basic timer functionality\n");
- rv = basicTimerWait(nano_task_timer_start, nano_task_timer_test,
- &timer, timerData, TWO_SECONDS);
- if (rv != TC_PASS) {
- TC_ERROR("Task-level of waiting for timers failed\n");
- goto doneTests;
- }
-
- /* Check that timers expire in the correct order */
- TC_PRINT("Task testing timers expire in the correct order\n");
- startTimers(nano_task_timer_start);
- rv = busyWaitTimers(nano_task_timer_test);
- if (rv != TC_PASS) {
- TC_ERROR("Task-level timer expiration order failed\n");
- goto doneTests;
- }
-
- /* Check that timers can be stopped */
- TC_PRINT("Task testing the stopping of timers\n");
- startTimers(nano_task_timer_start);
- rv = stopTimers(nano_task_timer_stop, nano_task_timer_test);
- if (rv != TC_PASS) {
- TC_ERROR("Task-level stopping of timers test failed\n");
- goto doneTests;
- }
-
- /*
- * Start the fiber. The fiber will be given a higher priority than the
- * main task.
- */
-
- task_fiber_start(fiberStack, FIBER_STACKSIZE, fiberEntry,
- 0, 0, FIBER_PRIORITY, 0);
-
- nano_task_sem_take(&wakeTask, TICKS_UNLIMITED);
-
- if (fiberDetectedError == 1) {
- TC_ERROR("Fiber-level of waiting for timers failed\n");
- rv = TC_FAIL;
- goto doneTests;
- }
-
- nano_task_sem_give(&wakeFiber);
- nano_task_sem_take(&wakeTask, TICKS_UNLIMITED);
-
- if (fiberDetectedError == 2) {
- TC_ERROR("Fiber-level timer expiration order failed\n");
- rv = TC_FAIL;
- goto doneTests;
- }
-
- nano_task_sem_give(&wakeFiber);
- nano_task_sem_take(&wakeTask, TICKS_UNLIMITED);
-
- if (fiberDetectedError == 3) {
- TC_ERROR("Fiber-level stopping of timers test failed\n");
- rv = TC_FAIL;
- goto doneTests;
- }
-
- nano_task_sem_give(&wakeFiber);
- nano_task_sem_take(&wakeTask, TICKS_UNLIMITED);
- if (fiberDetectedError == 4) {
- TC_ERROR("Fiber stopping a timer waited upon by a fiber failed\n");
- rv = TC_FAIL;
- goto doneTests;
- }
- nano_task_timer_stop(&timer);
-
- if (fiberDetectedError == 5) {
- TC_ERROR("Task stopping a timer waited upon by a fiber failed\n");
- rv = TC_FAIL;
- goto doneTests;
- }
-
- nano_task_sem_take(&wakeTask, TICKS_UNLIMITED);
-
-#if 0
- /*
- * Due to recent changes in the i8253 file that correct an issue on real
- * hardware, this test will fail when run under QEMU. On QEMU, the i8253
- * timer can at appear to run backwards. This can generate a false
- * failure detection when this test is run under QEMU as part of the
- * standard sanity/regression checks. This suggests that the test is not
- * of high enough quality to be included during the standard sanity/
- * regression checks.
- */
-
- TC_PRINT("Task testing of sys_cycle_get_32()\n");
- rv = sys_cycle_get_32Test();
- if (rv != TC_PASS) {
- TC_ERROR("sys_cycle_get_32Test() failed\n");
- goto doneTests;
- }
-#endif
-
-doneTests:
- TC_END_RESULT(rv);
- TC_END_REPORT(rv);
-}
diff --git a/samples/nanokernel/test/test_timer/testcase.ini b/samples/nanokernel/test/test_timer/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/nanokernel/test/test_timer/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-
diff --git a/samples/nanokernel/test/test_xip/Makefile b/samples/nanokernel/test/test_xip/Makefile
deleted file mode 100644
index 6e6b98115..000000000
--- a/samples/nanokernel/test/test_xip/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-KERNEL_TYPE = nano
-BOARD ?= qemu_x86
-CONF_FILE = prj_$(ARCH).conf
-SOURCE_DIR = $(ZEPHYR_BASE)/samples/microkernel/test/test_xip/src/
-
-include $(ZEPHYR_BASE)/Makefile.inc
diff --git a/samples/nanokernel/test/test_xip/README.txt b/samples/nanokernel/test/test_xip/README.txt
deleted file mode 100644
index 4699222bd..000000000
--- a/samples/nanokernel/test/test_xip/README.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-Title: Execute in Place (XIP) Support
-
-Description:
-
-This test verifies XIP is working in the nanokernel.
-
---------------------------------------------------------------------------------
-
-Building and Running Project:
-
-This nanokernel project outputs to the console. It can be built and executed
-on QEMU as follows:
-
- make qemu
-
---------------------------------------------------------------------------------
-
-Troubleshooting:
-
-Problems caused by out-dated project information can be addressed by
-issuing one of the following commands then rebuilding the project:
-
- make clean # discard results of previous builds
- # but keep existing configuration info
-or
- make pristine # discard results of previous builds
- # and restore pre-defined configuration info
-
---------------------------------------------------------------------------------
-
-Sample Output:
-
-Starting XIP tests
-===================================================================
-Test globals
-===================================================================
-PROJECT EXECUTION SUCCESSFUL
diff --git a/samples/nanokernel/test/test_xip/prj_arc.conf b/samples/nanokernel/test/test_xip/prj_arc.conf
deleted file mode 100644
index 05cd975ce..000000000
--- a/samples/nanokernel/test/test_xip/prj_arc.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# enable XIP.
-CONFIG_XIP=y
diff --git a/samples/nanokernel/test/test_xip/prj_arm.conf b/samples/nanokernel/test/test_xip/prj_arm.conf
deleted file mode 100644
index 31961fa9c..000000000
--- a/samples/nanokernel/test/test_xip/prj_arm.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# Disable enhanced security and enable XIP.
-CONFIG_XIP=y
diff --git a/samples/nanokernel/test/test_xip/prj_x86.conf b/samples/nanokernel/test/test_xip/prj_x86.conf
deleted file mode 100644
index 31961fa9c..000000000
--- a/samples/nanokernel/test/test_xip/prj_x86.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# Disable enhanced security and enable XIP.
-CONFIG_XIP=y
diff --git a/samples/nanokernel/test/test_xip/testcase.ini b/samples/nanokernel/test/test_xip/testcase.ini
deleted file mode 100644
index 2e4e88518..000000000
--- a/samples/nanokernel/test/test_xip/testcase.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test]
-tags = core
-