From 689913555d9ccc871b4830cf79fefc75769672ec Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 2 Feb 2026 12:52:23 -0700 Subject: [PATCH] testsuites/sptests: reformat with clang-format Updates #3860. Updates #5358. --- testsuites/sptests/sp01/init.c | 13 +- testsuites/sptests/sp01/system.h | 12 +- testsuites/sptests/sp01/task1.c | 6 +- testsuites/sptests/sp02/init.c | 46 +- testsuites/sptests/sp02/preempt.c | 4 +- testsuites/sptests/sp02/system.h | 28 +- testsuites/sptests/sp02/task1.c | 18 +- testsuites/sptests/sp02/task2.c | 6 +- testsuites/sptests/sp02/task3.c | 6 +- testsuites/sptests/sp03/init.c | 4 +- testsuites/sptests/sp03/system.h | 16 +- testsuites/sptests/sp03/task1.c | 6 +- testsuites/sptests/sp03/task2.c | 6 +- testsuites/sptests/sp04/init.c | 48 +- testsuites/sptests/sp04/system.h | 44 +- testsuites/sptests/sp04/task1.c | 44 +- testsuites/sptests/sp04/task2.c | 6 +- testsuites/sptests/sp04/task3.c | 6 +- testsuites/sptests/sp04/tswitch.c | 28 +- testsuites/sptests/sp05/init.c | 46 +- testsuites/sptests/sp05/system.h | 24 +- testsuites/sptests/sp05/task1.c | 19 +- testsuites/sptests/sp05/task2.c | 6 +- testsuites/sptests/sp05/task3.c | 6 +- testsuites/sptests/sp06/init.c | 46 +- testsuites/sptests/sp06/system.h | 24 +- testsuites/sptests/sp06/task1.c | 6 +- testsuites/sptests/sp06/task2.c | 2 +- testsuites/sptests/sp06/task3.c | 4 +- testsuites/sptests/sp07/init.c | 57 +- testsuites/sptests/sp07/system.h | 58 +- testsuites/sptests/sp07/task1.c | 20 +- testsuites/sptests/sp07/task2.c | 23 +- testsuites/sptests/sp07/task3.c | 6 +- testsuites/sptests/sp07/task4.c | 6 +- testsuites/sptests/sp07/taskexit.c | 4 +- testsuites/sptests/sp07/tcreate.c | 7 +- testsuites/sptests/sp07/tdelete.c | 7 +- testsuites/sptests/sp07/trestart.c | 7 +- testsuites/sptests/sp07/tstart.c | 7 +- testsuites/sptests/sp08/init.c | 87 +- testsuites/sptests/sp11/init.c | 4 +- testsuites/sptests/sp11/system.h | 56 +- testsuites/sptests/sp11/task1.c | 104 +- testsuites/sptests/sp11/task2.c | 14 +- testsuites/sptests/sp11/timer.c | 28 +- testsuites/sptests/sp12/init.c | 22 +- testsuites/sptests/sp12/pridrv.c | 41 +- testsuites/sptests/sp12/pritask.c | 35 +- testsuites/sptests/sp12/system.h | 55 +- testsuites/sptests/sp12/task1.c | 11 +- testsuites/sptests/sp12/task2.c | 5 +- testsuites/sptests/sp12/task3.c | 4 +- testsuites/sptests/sp12/task4.c | 4 +- testsuites/sptests/sp12/task5.c | 4 +- testsuites/sptests/sp13/fillbuff.c | 17 +- testsuites/sptests/sp13/init.c | 10 +- testsuites/sptests/sp13/putbuff.c | 15 +- testsuites/sptests/sp13/system.h | 59 +- testsuites/sptests/sp13/task1.c | 122 +- testsuites/sptests/sp13/task2.c | 19 +- testsuites/sptests/sp13/task3.c | 16 +- testsuites/sptests/sp14/asr.c | 10 +- testsuites/sptests/sp14/init.c | 8 +- testsuites/sptests/sp14/system.h | 57 +- testsuites/sptests/sp14/task1.c | 36 +- testsuites/sptests/sp14/task2.c | 17 +- testsuites/sptests/sp15/init.c | 14 +- testsuites/sptests/sp15/system.h | 38 +- testsuites/sptests/sp15/task1.c | 24 +- testsuites/sptests/sp16/init.c | 14 +- testsuites/sptests/sp16/system.h | 82 +- testsuites/sptests/sp16/task1.c | 36 +- testsuites/sptests/sp16/task2.c | 18 +- testsuites/sptests/sp16/task3.c | 10 +- testsuites/sptests/sp16/task4.c | 14 +- testsuites/sptests/sp16/task5.c | 14 +- testsuites/sptests/sp17/asr.c | 4 +- testsuites/sptests/sp17/init.c | 8 +- testsuites/sptests/sp17/system.h | 29 +- testsuites/sptests/sp17/task1.c | 9 +- testsuites/sptests/sp17/task2.c | 4 +- testsuites/sptests/sp18/init.c | 30 +- testsuites/sptests/sp19/first.c | 10 +- testsuites/sptests/sp19/fptask.c | 13 +- testsuites/sptests/sp19/fptest.h | 226 +- testsuites/sptests/sp19/init.c | 57 +- testsuites/sptests/sp19/inttest.h | 220 +- testsuites/sptests/sp19/system.h | 33 +- testsuites/sptests/sp19/task1.c | 6 +- testsuites/sptests/sp20/getall.c | 6 +- testsuites/sptests/sp20/init.c | 24 +- testsuites/sptests/sp20/system.h | 28 +- testsuites/sptests/sp20/task1.c | 58 +- testsuites/sptests/sp2038/init.c | 171 +- testsuites/sptests/sp21/init.c | 89 +- testsuites/sptests/sp22/delay.c | 4 +- testsuites/sptests/sp22/init.c | 10 +- testsuites/sptests/sp22/system.h | 28 +- testsuites/sptests/sp22/task1.c | 18 +- testsuites/sptests/sp23/init.c | 13 +- testsuites/sptests/sp23/system.h | 32 +- testsuites/sptests/sp23/task1.c | 12 +- testsuites/sptests/sp24/init.c | 27 +- testsuites/sptests/sp24/resume.c | 4 +- testsuites/sptests/sp24/system.h | 26 +- testsuites/sptests/sp24/task1.c | 6 +- testsuites/sptests/sp25/init.c | 8 +- testsuites/sptests/sp25/system.h | 32 +- testsuites/sptests/sp25/task1.c | 58 +- testsuites/sptests/sp26/init.c | 4 +- testsuites/sptests/sp26/system.h | 16 +- testsuites/sptests/sp26/task1.c | 129 +- testsuites/sptests/sp27/sp27impl.h | 109 +- testsuites/sptests/sp29/init.c | 152 +- testsuites/sptests/sp30/init.c | 29 +- testsuites/sptests/sp30/resume.c | 4 +- testsuites/sptests/sp30/system.h | 26 +- testsuites/sptests/sp30/task1.c | 8 +- testsuites/sptests/sp31/delay.c | 4 +- testsuites/sptests/sp31/init.c | 10 +- testsuites/sptests/sp31/system.h | 28 +- testsuites/sptests/sp31/task1.c | 89 +- testsuites/sptests/sp32/init.c | 71 +- testsuites/sptests/sp33/init.c | 118 +- testsuites/sptests/sp34/changepri.c | 119 +- testsuites/sptests/sp35/priinv.c | 337 +-- testsuites/sptests/sp37/init.c | 201 +- testsuites/sptests/sp37/system.h | 12 +- testsuites/sptests/sp38/init.c | 39 +- testsuites/sptests/sp38/system.h | 8 +- testsuites/sptests/sp40/init.c | 34 +- testsuites/sptests/sp41/init.c | 8 +- testsuites/sptests/sp42/init.c | 120 +- testsuites/sptests/sp43/init.c | 300 ++- testsuites/sptests/sp43/system.h | 10 +- testsuites/sptests/sp44/init.c | 60 +- testsuites/sptests/sp45/init.c | 43 +- testsuites/sptests/sp46/init.c | 47 +- testsuites/sptests/sp47/init.c | 38 +- testsuites/sptests/sp48/init.c | 37 +- testsuites/sptests/sp49/init.c | 14 +- testsuites/sptests/sp50/init.c | 26 +- testsuites/sptests/sp51/init.c | 61 +- testsuites/sptests/sp52/sp52impl.h | 54 +- testsuites/sptests/sp54/init.c | 12 +- testsuites/sptests/sp55/init.c | 32 +- testsuites/sptests/sp56/init.c | 39 +- testsuites/sptests/sp57/init.c | 40 +- testsuites/sptests/sp58/init.c | 40 +- testsuites/sptests/sp59/init.c | 54 +- testsuites/sptests/sp60/init.c | 37 +- testsuites/sptests/sp62/init.c | 60 +- testsuites/sptests/sp63/init.c | 73 +- testsuites/sptests/sp64/init.c | 23 +- testsuites/sptests/sp65/sp65impl.h | 77 +- testsuites/sptests/sp67/init.c | 50 +- testsuites/sptests/sp68/init.c | 292 +- testsuites/sptests/sp69/init.c | 38 +- testsuites/sptests/sp70/init.c | 26 +- testsuites/sptests/sp71/init.c | 21 +- testsuites/sptests/sp72/init.c | 21 +- testsuites/sptests/sp73/init.c | 58 +- testsuites/sptests/sp74/init.c | 20 +- testsuites/sptests/sp75/init.c | 28 +- testsuites/sptests/sp76/init.c | 26 +- testsuites/sptests/sp77/init.c | 31 +- testsuites/sptests/spassoc01/init.c | 115 +- testsuites/sptests/spatomic01/init.c | 311 +-- testsuites/sptests/spcache01/init.c | 411 +-- testsuites/sptests/spcbssched01/init.c | 40 +- testsuites/sptests/spcbssched01/system.h | 16 +- testsuites/sptests/spcbssched01/task1.c | 6 +- testsuites/sptests/spcbssched02/init.c | 278 +- testsuites/sptests/spcbssched02/system.h | 34 +- .../sptests/spcbssched02/task_periodic.c | 103 +- testsuites/sptests/spcbssched03/cbsparams.h | 26 +- testsuites/sptests/spcbssched03/init.c | 12 +- testsuites/sptests/spcbssched03/system.h | 48 +- .../sptests/spcbssched03/tasks_aperiodic.c | 22 +- .../sptests/spcbssched03/tasks_periodic.c | 128 +- testsuites/sptests/spchain/init.c | 206 +- testsuites/sptests/spclock_err01/delay.c | 4 +- testsuites/sptests/spclock_err01/init.c | 30 +- testsuites/sptests/spclock_err01/system.h | 42 +- testsuites/sptests/spclock_err02/init.c | 20 +- testsuites/sptests/spclock_todhook01/init.c | 116 +- testsuites/sptests/spconfig01/init.c | 62 +- testsuites/sptests/spconfig02/init.c | 413 +-- testsuites/sptests/spconsole01/init.c | 234 +- testsuites/sptests/spcontext01/init.c | 208 +- testsuites/sptests/spcpucounter01/init.c | 177 +- testsuites/sptests/spcpuset01/init.c | 93 +- testsuites/sptests/spcpuset01/system.h | 14 +- testsuites/sptests/spcpuset01/test.c | 108 +- testsuites/sptests/spedfsched01/init.c | 40 +- testsuites/sptests/spedfsched01/system.h | 16 +- testsuites/sptests/spedfsched01/task1.c | 6 +- testsuites/sptests/spedfsched02/getall.c | 6 +- testsuites/sptests/spedfsched02/init.c | 26 +- testsuites/sptests/spedfsched02/system.h | 28 +- testsuites/sptests/spedfsched02/task1.c | 96 +- testsuites/sptests/spedfsched03/edfparams.h | 26 +- testsuites/sptests/spedfsched03/init.c | 12 +- testsuites/sptests/spedfsched03/system.h | 48 +- .../sptests/spedfsched03/tasks_aperiodic.c | 32 +- .../sptests/spedfsched03/tasks_periodic.c | 63 +- testsuites/sptests/spedfsched04/init.c | 72 +- testsuites/sptests/spedfsched05/init.c | 772 +++--- testsuites/sptests/sperror01/init.c | 21 +- testsuites/sptests/sperror02/init.c | 18 +- testsuites/sptests/sperror03/init.c | 17 +- testsuites/sptests/spevent_err03/init.c | 16 +- testsuites/sptests/spevent_err03/system.h | 24 +- testsuites/sptests/speventsystem01/init.c | 80 +- testsuites/sptests/speventtransient01/init.c | 70 +- testsuites/sptests/spextensions01/init.c | 331 ++- testsuites/sptests/spfatal01/init.c | 16 +- testsuites/sptests/spfatal03/init.c | 26 +- testsuites/sptests/spfatal04/init.c | 11 +- testsuites/sptests/spfatal05/init.c | 16 +- testsuites/sptests/spfatal09/init.c | 8 +- testsuites/sptests/spfatal10/init.c | 14 +- testsuites/sptests/spfatal11/init.c | 14 +- testsuites/sptests/spfatal12/init.c | 10 +- testsuites/sptests/spfatal14/init.c | 10 +- testsuites/sptests/spfatal15/init.c | 10 +- testsuites/sptests/spfatal26/init.c | 7 +- testsuites/sptests/spfatal28/init.c | 18 +- testsuites/sptests/spfatal29/init.c | 28 +- testsuites/sptests/spfatal30/init.c | 22 +- testsuites/sptests/spfatal31/init.c | 40 +- testsuites/sptests/spfatal32/init.c | 4 +- testsuites/sptests/spfatal33/init.c | 3 +- testsuites/sptests/spfatal35/init.c | 9 +- .../sptests/spfatal_support/spfatalimpl.h | 67 +- testsuites/sptests/spfifo01/init.c | 22 +- testsuites/sptests/spfifo02/init.c | 55 +- testsuites/sptests/spfifo03/init.c | 184 +- testsuites/sptests/spfifo04/init.c | 26 +- testsuites/sptests/spfifo05/init.c | 110 +- testsuites/sptests/spfreechain01/init.c | 64 +- testsuites/sptests/spglobalcon02/init.c | 51 +- testsuites/sptests/spheapprot/init.c | 143 +- testsuites/sptests/spinternalerror01/init.c | 21 +- testsuites/sptests/spinternalerror02/init.c | 26 +- testsuites/sptests/spintr_err01/init.c | 75 +- testsuites/sptests/spintr_err01/isr.c | 4 +- testsuites/sptests/spintr_err01/system.h | 42 +- .../spintrcritical01/spintrcritical01impl.h | 47 +- testsuites/sptests/spintrcritical08/init.c | 48 +- testsuites/sptests/spintrcritical09/init.c | 29 +- testsuites/sptests/spintrcritical10/init.c | 211 +- .../spintrcritical11/spintrcritical11impl.h | 42 +- .../spintrcritical13/spintrcritical13impl.h | 49 +- testsuites/sptests/spintrcritical15/init.c | 40 +- testsuites/sptests/spintrcritical16/init.c | 26 +- testsuites/sptests/spintrcritical18/init.c | 24 +- testsuites/sptests/spintrcritical20/init.c | 101 +- testsuites/sptests/spintrcritical21/init.c | 24 +- testsuites/sptests/spintrcritical22/init.c | 100 +- testsuites/sptests/spintrcritical23/init.c | 109 +- testsuites/sptests/spintrcritical24/init.c | 104 +- testsuites/sptests/splinkersets01/content.c | 4 +- testsuites/sptests/splinkersets01/init.c | 296 +-- testsuites/sptests/splinkersets01/item-a.c | 2 +- testsuites/sptests/splinkersets01/item-ca.c | 2 +- testsuites/sptests/splinkersets01/sets.c | 8 +- .../sptests/splinkersets01/splinkersets01.h | 28 +- testsuites/sptests/spmisc01/init.c | 190 +- testsuites/sptests/spmisc01/spmisc01.h | 6 +- testsuites/sptests/spmisc01/strong.c | 6 +- testsuites/sptests/spmkdir/init.c | 68 +- testsuites/sptests/spmountmgr01/init.c | 28 +- testsuites/sptests/spmrsp01/init.c | 258 +- testsuites/sptests/spmsgq_err01/init.c | 58 +- testsuites/sptests/spmsgq_err01/system.h | 42 +- testsuites/sptests/spmsgq_err02/init.c | 58 +- testsuites/sptests/spmsgq_err02/system.h | 46 +- testsuites/sptests/spmsgq_err02/task3.c | 6 +- testsuites/sptests/spmutex01/init.c | 792 +++--- testsuites/sptests/spnsext01/init.c | 54 +- testsuites/sptests/spntp01/init.c | 6 +- testsuites/sptests/spobjgetnext/init.c | 51 +- testsuites/sptests/spobjgetnext/system.h | 10 +- testsuites/sptests/sppagesize/init.c | 18 +- testsuites/sptests/sppartition_err01/init.c | 47 +- testsuites/sptests/sppartition_err01/system.h | 4 +- testsuites/sptests/sppercpudata01/init.c | 286 +- testsuites/sptests/sppercpudata01/item.c | 2 +- .../sptests/sppercpudata01/sppercpudata01.h | 2 +- testsuites/sptests/spport_err01/init.c | 68 +- testsuites/sptests/spport_err01/system.h | 38 +- testsuites/sptests/sppps01/init.c | 84 +- testsuites/sptests/spprintk/init.c | 58 +- testsuites/sptests/spprivenv01/init.c | 48 +- testsuites/sptests/spprofiling01/init.c | 87 +- testsuites/sptests/spqreslib/init.c | 185 +- testsuites/sptests/spqreslib/system.h | 28 +- testsuites/sptests/spqreslib/task_periodic.c | 102 +- testsuites/sptests/spratemon_err01/init.c | 12 +- testsuites/sptests/spratemon_err01/screen10.c | 20 +- testsuites/sptests/spratemon_err01/system.h | 46 +- testsuites/sptests/spratemon_err01/task4.c | 4 +- testsuites/sptests/sprbtree01/init.c | 2339 +++++++++-------- testsuites/sptests/spregion_err01/init.c | 123 +- testsuites/sptests/spregion_err01/system.h | 4 +- testsuites/sptests/sprmsched01/init.c | 70 +- testsuites/sptests/sprmsched02/init.c | 56 +- testsuites/sptests/spscheduler01/init.c | 772 +++--- testsuites/sptests/spsem01/init.c | 127 +- testsuites/sptests/spsem02/init.c | 162 +- testsuites/sptests/spsem03/init.c | 82 +- testsuites/sptests/spsem_err01/init.c | 57 +- testsuites/sptests/spsem_err01/system.h | 38 +- testsuites/sptests/spsem_err02/init.c | 32 +- testsuites/sptests/spsem_err02/system.h | 28 +- testsuites/sptests/spsem_err02/task2.c | 4 +- testsuites/sptests/spsignal_err01/init.c | 4 +- testsuites/sptests/spsignal_err01/isr.c | 4 +- testsuites/sptests/spsignal_err01/system.h | 42 +- testsuites/sptests/spsimplesched01/init.c | 70 +- testsuites/sptests/spsimplesched02/init.c | 70 +- testsuites/sptests/spsimplesched03/init.c | 18 +- testsuites/sptests/spsize/getint.c | 6 +- testsuites/sptests/spsize/init.c | 26 +- testsuites/sptests/spsize/size.c | 760 +++--- testsuites/sptests/spsize/system.h | 14 +- testsuites/sptests/spstdthreads01/init.c | 396 ++- testsuites/sptests/spstkalloc/init.c | 53 +- testsuites/sptests/spstkalloc02/init.c | 69 +- testsuites/sptests/spstkalloc03/init.c | 53 +- testsuites/sptests/spstkalloc04/init.c | 33 +- testsuites/sptests/spsysinit01/init.c | 748 +++--- testsuites/sptests/spsyslock01/init.c | 810 +++--- testsuites/sptests/sptask_err01/init.c | 16 +- testsuites/sptests/sptask_err01/system.h | 28 +- testsuites/sptests/sptask_err01/task2.c | 4 +- testsuites/sptests/sptask_err02/init.c | 27 +- testsuites/sptests/sptask_err02/system.h | 8 +- testsuites/sptests/sptask_err03/init.c | 63 +- testsuites/sptests/sptask_err03/system.h | 26 +- testsuites/sptests/sptask_err04/init.c | 34 +- testsuites/sptests/sptask_err04/system.h | 14 +- testsuites/sptests/sptask_err04/task1.c | 17 +- testsuites/sptests/sptasknopreempt01/init.c | 28 +- testsuites/sptests/spthread01/init.c | 309 +-- testsuites/sptests/spthreadlife01/init.c | 299 ++- testsuites/sptests/spthreadq01/init.c | 226 +- testsuites/sptests/sptimecounter01/init.c | 180 +- testsuites/sptests/sptimecounter02/init.c | 169 +- testsuites/sptests/sptimecounter03/init.c | 37 +- testsuites/sptests/sptimecounter04/init.c | 38 +- testsuites/sptests/sptimer_err01/init.c | 37 +- testsuites/sptests/sptimer_err02/init.c | 56 +- testsuites/sptests/sptimerserver01/init.c | 68 +- testsuites/sptests/sptimespec01/init.c | 280 +- testsuites/sptests/sptls01/init.c | 106 +- testsuites/sptests/sptls03/init.c | 14 +- testsuites/sptests/sptls04/init.c | 18 +- testsuites/sptests/sptree01/init.c | 2 +- testsuites/sptests/sptree01/sys/tree.h | 1637 ++++++------ testsuites/sptests/spunlimited01/init.c | 10 +- testsuites/sptests/spversion01/init.c | 20 +- testsuites/sptests/spwatchdog/delay.c | 5 +- testsuites/sptests/spwatchdog/init.c | 77 +- testsuites/sptests/spwatchdog/system.h | 28 +- testsuites/sptests/spwatchdog/task1.c | 10 +- testsuites/sptests/spwkspace/init.c | 36 +- 369 files changed, 14041 insertions(+), 13943 deletions(-) diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c index aad58338eb..a6b6919148 100644 --- a/testsuites/sptests/sp01/init.c +++ b/testsuites/sptests/sp01/init.c @@ -35,10 +35,11 @@ const char rtems_test_name[] = "SP 1"; -static RTEMS_NOINIT RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char -Task_1_storage[ - RTEMS_TASK_STORAGE_SIZE( 2 * RTEMS_MINIMUM_STACK_SIZE, RTEMS_FLOATING_POINT ) -]; +static RTEMS_NOINIT RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) +char Task_1_storage[ RTEMS_TASK_STORAGE_SIZE( + 2 * RTEMS_MINIMUM_STACK_SIZE, + RTEMS_FLOATING_POINT +) ]; static const rtems_task_config Task_1_config = { .name = rtems_build_name( 'T', 'A', '1', ' ' ), @@ -51,9 +52,7 @@ static const rtems_task_config Task_1_config = { .attributes = RTEMS_FLOATING_POINT }; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp01/system.h b/testsuites/sptests/sp01/system.h index 782fd929a7..599c6bb006 100644 --- a/testsuites/sptests/sp01/system.h +++ b/testsuites/sptests/sp01/system.h @@ -30,13 +30,9 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1_through_3( - rtems_task_argument argument -); +rtems_task Task_1_through_3( rtems_task_argument argument ); /* configuration information */ @@ -59,8 +55,8 @@ rtems_task Task_1_through_3( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) +#define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE 1 #include diff --git a/testsuites/sptests/sp01/task1.c b/testsuites/sptests/sp01/task1.c index 13d55de3f4..8dff9f9e08 100644 --- a/testsuites/sptests/sp01/task1.c +++ b/testsuites/sptests/sp01/task1.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_1_through_3( - rtems_task_argument index -) +rtems_task Task_1_through_3( rtems_task_argument index ) { rtems_time_of_day time; rtems_status_code status; @@ -46,7 +44,7 @@ rtems_task Task_1_through_3( ticks = RTEMS_MILLISECONDS_TO_TICKS( index * 5 * 1000 ); - while( FOREVER ) { + while ( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); diff --git a/testsuites/sptests/sp02/init.c b/testsuites/sptests/sp02/init.c index 54bcee3ace..76594bca80 100644 --- a/testsuites/sptests/sp02/init.c +++ b/testsuites/sptests/sp02/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP 2"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -63,37 +61,37 @@ rtems_task Init( status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); status = rtems_task_create( - Task_name[ 1 ], - 3, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + 3, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_create( - Task_name[ 2 ], - 3, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 2 ] + Task_name[ 2 ], + 3, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); directive_failed( status, "rtems_task_create of TA2" ); status = rtems_task_create( - Task_name[ 3 ], - 3, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 3 ] + Task_name[ 3 ], + 3, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "rtems_task_create of TA3" ); diff --git a/testsuites/sptests/sp02/preempt.c b/testsuites/sptests/sp02/preempt.c index a2f32ead5a..7edd5aedb9 100644 --- a/testsuites/sptests/sp02/preempt.c +++ b/testsuites/sptests/sp02/preempt.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Preempt_task( - rtems_task_argument argument -) +rtems_task Preempt_task( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp02/system.h b/testsuites/sptests/sp02/system.h index 0f23f013a8..36cf13547d 100644 --- a/testsuites/sptests/sp02/system.h +++ b/testsuites/sptests/sp02/system.h @@ -30,25 +30,15 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Preempt_task( - rtems_task_argument argument -); +rtems_task Preempt_task( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); /* configuration information */ @@ -58,19 +48,19 @@ rtems_task Task_3( #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 /* * Deliberately configure the IDLE Task's stack as greater than minimum * so it will have to be increased. */ -#define CONFIGURE_IDLE_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_IDLE_TASK_STACK_SIZE ( 2 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/sp02/task1.c b/testsuites/sptests/sp02/task1.c index 7179478f80..07615a7e9d 100644 --- a/testsuites/sptests/sp02/task1.c +++ b/testsuites/sptests/sp02/task1.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -42,7 +40,7 @@ rtems_task Task_1( rtems_id tid3; rtems_status_code status; rtems_name tid2_name; - uint32_t previous_priority; + uint32_t previous_priority; puts( "TA1 - rtems_task_wake_after - sleep 1 second" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); @@ -52,19 +50,23 @@ rtems_task Task_1( directive_failed( status, "rtems_task_ident of TA2" ); printf( - "TA1 - rtems_task_ident - tid of TA2 (0x%.8" PRIxrtems_id ")\n", tid2 + "TA1 - rtems_task_ident - tid of TA2 (0x%.8" PRIxrtems_id ")\n", + tid2 ); status = rtems_object_get_classic_name( tid2, &tid2_name ); directive_failed( status, "rtems_object_get_classic_name of TA2" ); - printf( "TA1 - rtems_get_classic_name - id -> name of TA2 %sOK\n", - (tid2_name != Task_name[2]) ? "NOT " : "" ); + printf( + "TA1 - rtems_get_classic_name - id -> name of TA2 %sOK\n", + ( tid2_name != Task_name[ 2 ] ) ? "NOT " : "" + ); status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 ); directive_failed( status, "rtems_task_ident of TA3" ); printf( - "TA1 - rtems_task_ident - tid of TA3 (0x%.8" PRIxrtems_id ")\n", tid3 + "TA1 - rtems_task_ident - tid of TA3 (0x%.8" PRIxrtems_id ")\n", + tid3 ); status = rtems_task_set_priority( tid3, 2, &previous_priority ); diff --git a/testsuites/sptests/sp02/task2.c b/testsuites/sptests/sp02/task2.c index d657af7194..98213dac67 100644 --- a/testsuites/sptests/sp02/task2.c +++ b/testsuites/sptests/sp02/task2.c @@ -32,15 +32,13 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; rtems_status_code status; puts( "TA2 - rtems_task_wake_after - sleep 1 minute" ); - status = rtems_task_wake_after( 60*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 60 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after in TA2" ); } diff --git a/testsuites/sptests/sp02/task3.c b/testsuites/sptests/sp02/task3.c index 674e5c5a03..7293ce1a26 100644 --- a/testsuites/sptests/sp02/task3.c +++ b/testsuites/sptests/sp02/task3.c @@ -32,16 +32,14 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; rtems_status_code status; puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" ); - status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after in TA3" ); puts( "TA3 - rtems_task_delete - delete self" ); diff --git a/testsuites/sptests/sp03/init.c b/testsuites/sptests/sp03/init.c index 0ddc0bda92..3532d0aed5 100644 --- a/testsuites/sptests/sp03/init.c +++ b/testsuites/sptests/sp03/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP 3"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp03/system.h b/testsuites/sptests/sp03/system.h index ff28a9cc5f..ba2ffe0b2c 100644 --- a/testsuites/sptests/sp03/system.h +++ b/testsuites/sptests/sp03/system.h @@ -30,17 +30,11 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); /* configuration information */ @@ -51,8 +45,8 @@ rtems_task Task_2( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) -#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) +#define CONFIGURE_MAXIMUM_TASKS 3 #include diff --git a/testsuites/sptests/sp03/task1.c b/testsuites/sptests/sp03/task1.c index 1160da77ec..63dba4b7a9 100644 --- a/testsuites/sptests/sp03/task1.c +++ b/testsuites/sptests/sp03/task1.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -53,7 +51,7 @@ rtems_task Task_1( put_name( name, FALSE ); print_time( " sets clock: ", &time, "\n" ); - while( FOREVER ) { + while ( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); diff --git a/testsuites/sptests/sp03/task2.c b/testsuites/sptests/sp03/task2.c index 9b01977cef..1af17c2ee0 100644 --- a/testsuites/sptests/sp03/task2.c +++ b/testsuites/sptests/sp03/task2.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; @@ -45,7 +43,7 @@ rtems_task Task_2( status = rtems_object_get_classic_name( rtems_task_self(), &name ); directive_failed( status, "rtems_object_get_classic_name" ); - while( FOREVER ) { + while ( FOREVER ) { status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); diff --git a/testsuites/sptests/sp04/init.c b/testsuites/sptests/sp04/init.c index 625d5f0f7e..3170230d25 100644 --- a/testsuites/sptests/sp04/init.c +++ b/testsuites/sptests/sp04/init.c @@ -59,9 +59,7 @@ rtems_extensions_table Extensions = { .thread_terminate = NULL }; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -74,7 +72,7 @@ rtems_task Init( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' ); + Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' ); status = rtems_extension_create( Extension_name[ 1 ], @@ -83,41 +81,41 @@ rtems_task Init( ); directive_failed( status, "rtems_extension_create" ); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); Run_count[ 1 ] = 0; Run_count[ 2 ] = 0; Run_count[ 3 ] = 0; status = rtems_task_create( - Task_name[ 1 ], - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_PREEMPT|RTEMS_TIMESLICE, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_PREEMPT | RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_create( - Task_name[ 2 ], - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_PREEMPT|RTEMS_TIMESLICE, - RTEMS_GLOBAL, - &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_PREEMPT | RTEMS_TIMESLICE, + RTEMS_GLOBAL, + &Task_id[ 2 ] ); directive_failed( status, "rtems_task_create of TA2" ); status = rtems_task_create( - Task_name[ 3 ], - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_PREEMPT|RTEMS_TIMESLICE, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 3 ] + Task_name[ 3 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_PREEMPT | RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "rtems_task_create of TA3" ); diff --git a/testsuites/sptests/sp04/system.h b/testsuites/sptests/sp04/system.h index 242a17ea61..effd0058f1 100644 --- a/testsuites/sptests/sp04/system.h +++ b/testsuites/sptests/sp04/system.h @@ -34,55 +34,44 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); -void Task_switch( - rtems_tcb *unused, - rtems_tcb *heir -); +void Task_switch( rtems_tcb *unused, rtems_tcb *heir ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) -#define CONFIGURE_MAXIMUM_TASKS 4 -#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) +#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TIMERS 1 #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ TEST_EXTERN rtems_id Extension_id[ 4 ]; -TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ /* array of task run counts */ -TEST_EXTERN volatile uint32_t Run_count[ 4 ]; +TEST_EXTERN volatile uint32_t Run_count[ 4 ]; /* * Keep track of task switches @@ -94,8 +83,7 @@ struct taskSwitchLog { }; extern struct taskSwitchLog taskSwitchLog[]; -extern unsigned int taskSwitchLogIndex; -extern volatile int testsFinished; - +extern unsigned int taskSwitchLogIndex; +extern volatile int testsFinished; /* end of include file */ diff --git a/testsuites/sptests/sp04/task1.c b/testsuites/sptests/sp04/task1.c index 5c32bb0b21..65e2753c2b 100644 --- a/testsuites/sptests/sp04/task1.c +++ b/testsuites/sptests/sp04/task1.c @@ -41,15 +41,14 @@ #include "system.h" -static void -showTaskSwitches (void) +static void showTaskSwitches( void ) { unsigned int i; unsigned int switches = taskSwitchLogIndex; - for (i = 0 ; i < switches ; i++) { - put_name( Task_name[taskSwitchLog[i].taskIndex], FALSE ); - print_time( "- ", &taskSwitchLog[i].when, "\n" ); + for ( i = 0; i < switches; i++ ) { + put_name( Task_name[ taskSwitchLog[ i ].taskIndex ], FALSE ); + print_time( "- ", &taskSwitchLog[ i ].when, "\n" ); } } @@ -71,8 +70,8 @@ static void high_task( rtems_task_argument arg ) sc = rtems_event_transient_send( Task_id[ 1 ] ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_task_suspend(RTEMS_SELF); - rtems_test_assert(0); + rtems_task_suspend( RTEMS_SELF ); + rtems_test_assert( 0 ); } static void low_task( rtems_task_argument arg ) @@ -82,8 +81,8 @@ static void low_task( rtems_task_argument arg ) rtems_test_assert( test_no_preempt_step == 1 ); test_no_preempt_step = 2; - rtems_task_suspend(RTEMS_SELF); - rtems_test_assert(0); + rtems_task_suspend( RTEMS_SELF ); + rtems_test_assert( 0 ); } static void no_preempt_timer( rtems_id id, void *arg ) @@ -106,7 +105,7 @@ static void no_preempt_timer( rtems_id id, void *arg ) static void test_no_preempt( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; rtems_test_assert( test_no_preempt_step == 0 ); @@ -157,19 +156,17 @@ static void test_no_preempt( void ) rtems_test_assert( test_no_preempt_step == 3 ); } -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; - uint32_t seconds; - uint32_t old_seconds; + uint32_t seconds; + uint32_t old_seconds; rtems_mode previous_mode; rtems_time_of_day time; rtems_status_code status; - uint32_t start_time; - uint32_t end_time; + uint32_t start_time; + uint32_t end_time; puts( "TA1 - rtems_task_suspend - on Task 2" ); status = rtems_task_suspend( Task_id[ 2 ] ); @@ -184,12 +181,13 @@ rtems_task Task_1( puts( "TA1 - killing time" ); - for ( ; ; ) { + for ( ;; ) { status = rtems_clock_get_seconds_since_epoch( &end_time ); directive_failed( status, "rtems_clock_get_seconds_since_epoch" ); - if ( end_time > (start_time + 2) ) + if ( end_time > ( start_time + 2 ) ) { break; + } } puts( "TA1 - rtems_task_resume - on Task 2" ); @@ -216,7 +214,7 @@ rtems_task Task_1( old_seconds = time.second; - for ( seconds = 0 ; seconds < 6 ; ) { + for ( seconds = 0; seconds < 6; ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); @@ -236,16 +234,16 @@ rtems_task Task_1( directive_failed( status, "rtems_task_mode" ); while ( !testsFinished ); - showTaskSwitches (); + showTaskSwitches(); puts( "TA1 - rtems_extension_delete - successful" ); - status = rtems_extension_delete( Extension_id[1] ); + status = rtems_extension_delete( Extension_id[ 1 ] ); directive_failed( status, "rtems_extension_delete" ); test_no_preempt(); TEST_END(); - rtems_test_exit (0); + rtems_test_exit( 0 ); } } } diff --git a/testsuites/sptests/sp04/task2.c b/testsuites/sptests/sp04/task2.c index c507394dcf..f6dda0fc85 100644 --- a/testsuites/sptests/sp04/task2.c +++ b/testsuites/sptests/sp04/task2.c @@ -41,11 +41,9 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; - while( FOREVER ); + while ( FOREVER ); } diff --git a/testsuites/sptests/sp04/task3.c b/testsuites/sptests/sp04/task3.c index ba5778932d..952a946651 100644 --- a/testsuites/sptests/sp04/task3.c +++ b/testsuites/sptests/sp04/task3.c @@ -41,11 +41,9 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; - while( FOREVER ); + while ( FOREVER ); } diff --git a/testsuites/sptests/sp04/tswitch.c b/testsuites/sptests/sp04/tswitch.c index 2a7732e76c..8b4a019dcf 100644 --- a/testsuites/sptests/sp04/tswitch.c +++ b/testsuites/sptests/sp04/tswitch.c @@ -38,24 +38,21 @@ */ #define MAX_TASK_SWITCH_LOGS 25 -struct taskSwitchLog taskSwitchLog[MAX_TASK_SWITCH_LOGS]; -unsigned int taskSwitchLogIndex; -volatile int testsFinished; +struct taskSwitchLog taskSwitchLog[ MAX_TASK_SWITCH_LOGS ]; +unsigned int taskSwitchLogIndex; +volatile int testsFinished; -void Task_switch( - rtems_tcb *unused, - rtems_tcb *heir -) +void Task_switch( rtems_tcb *unused, rtems_tcb *heir ) { (void) unused; - uint32_t index; + uint32_t index; rtems_time_of_day time; rtems_status_code status; - index = task_number( heir->Object.id ) - task_number( Task_id[1] ) + 1; + index = task_number( heir->Object.id ) - task_number( Task_id[ 1 ] ) + 1; - switch( index ) { + switch ( index ) { case 1: case 2: case 3: @@ -64,13 +61,14 @@ void Task_switch( status = rtems_clock_get_tod( &time ); directive_failed_with_level( status, "rtems_clock_get_tod", 1 ); - if (taskSwitchLogIndex < MAX_TASK_SWITCH_LOGS ) { - taskSwitchLog[taskSwitchLogIndex].taskIndex = index; - taskSwitchLog[taskSwitchLogIndex].when = time; + if ( taskSwitchLogIndex < MAX_TASK_SWITCH_LOGS ) { + taskSwitchLog[ taskSwitchLogIndex ].taskIndex = index; + taskSwitchLog[ taskSwitchLogIndex ].when = time; taskSwitchLogIndex++; } - if ( time.second >= 16 ) - testsFinished = 1; + if ( time.second >= 16 ) { + testsFinished = 1; + } break; case 0: diff --git a/testsuites/sptests/sp05/init.c b/testsuites/sptests/sp05/init.c index cfa0dfa758..f3cb1812d6 100644 --- a/testsuites/sptests/sp05/init.c +++ b/testsuites/sptests/sp05/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 5"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,37 +55,37 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); status = rtems_task_create( - Task_name[ 1 ], - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_create( - Task_name[ 2 ], - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); directive_failed( status, "rtems_task_create of TA2" ); status = rtems_task_create( - Task_name[ 3 ], - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 3 ] + Task_name[ 3 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "rtems_task_create of TA3" ); diff --git a/testsuites/sptests/sp05/system.h b/testsuites/sptests/sp05/system.h index c8ef19efb2..908584609b 100644 --- a/testsuites/sptests/sp05/system.h +++ b/testsuites/sptests/sp05/system.h @@ -34,39 +34,31 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/sp05/task1.c b/testsuites/sptests/sp05/task1.c index 2e0fa3f652..13fa92fb7c 100644 --- a/testsuites/sptests/sp05/task1.c +++ b/testsuites/sptests/sp05/task1.c @@ -43,15 +43,13 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; rtems_id tid2; rtems_id tid3; - uint32_t pass; + uint32_t pass; rtems_status_code status; status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 ); @@ -60,19 +58,18 @@ rtems_task Task_1( status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 ); directive_failed( status, "rtems_task_ident of TA3" ); - for ( pass=1 ; pass <= 3 ; pass++ ) { - + for ( pass = 1; pass <= 3; pass++ ) { puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); - status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after of TA1" ); puts( "TA1 - rtems_task_suspend - suspend TA3" ); status = rtems_task_suspend( tid3 ); if ( pass == 1 ) { fatal_directive_status( - status, - RTEMS_ALREADY_SUSPENDED, - "rtems_task_suspend of TA3" + status, + RTEMS_ALREADY_SUSPENDED, + "rtems_task_suspend of TA3" ); } else { directive_failed( status, "rtems_task_suspend of TA3" ); @@ -83,7 +80,7 @@ rtems_task Task_1( directive_failed( status, "rtems_task_resume of TA2" ); puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); - status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - rtems_task_suspend - suspend TA2" ); diff --git a/testsuites/sptests/sp05/task2.c b/testsuites/sptests/sp05/task2.c index 254d2963f2..61ad939929 100644 --- a/testsuites/sptests/sp05/task2.c +++ b/testsuites/sptests/sp05/task2.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; @@ -53,7 +51,7 @@ rtems_task Task_2( status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend of TA2" ); - while( FOREVER ) { + while ( FOREVER ) { puts( "TA2 - rtems_task_wake_after - sleep 1 second" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after of TA2" ); diff --git a/testsuites/sptests/sp05/task3.c b/testsuites/sptests/sp05/task3.c index 342ab68d3a..f7122cdb37 100644 --- a/testsuites/sptests/sp05/task3.c +++ b/testsuites/sptests/sp05/task3.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; @@ -53,7 +51,7 @@ rtems_task Task_3( status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend of TA3" ); - while( FOREVER ) { + while ( FOREVER ) { puts( "TA3 - rtems_task_wake_after - sleep 1 second" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after of TA3" ); diff --git a/testsuites/sptests/sp06/init.c b/testsuites/sptests/sp06/init.c index 646a03ec13..b2d25467fa 100644 --- a/testsuites/sptests/sp06/init.c +++ b/testsuites/sptests/sp06/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 6"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -58,40 +56,40 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); Argument = 0; Restart_argument = 1; status = rtems_task_create( - Task_name[ 1 ], - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_create( - Task_name[ 2 ], - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); directive_failed( status, "rtems_task_create of TA2" ); status = rtems_task_create( - Task_name[ 3 ], - 10, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 3 ] + Task_name[ 3 ], + 10, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "rtems_task_create of TA3" ); diff --git a/testsuites/sptests/sp06/system.h b/testsuites/sptests/sp06/system.h index 41624899f2..2931ad00c8 100644 --- a/testsuites/sptests/sp06/system.h +++ b/testsuites/sptests/sp06/system.h @@ -34,40 +34,32 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ TEST_EXTERN rtems_task_argument Argument; /* generic task argument */ TEST_EXTERN rtems_task_argument Restart_argument; /* task 1 restart argument */ diff --git a/testsuites/sptests/sp06/task1.c b/testsuites/sptests/sp06/task1.c index 61d8c38881..f30ef05550 100644 --- a/testsuites/sptests/sp06/task1.c +++ b/testsuites/sptests/sp06/task1.c @@ -41,11 +41,9 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { - uint32_t pass; + uint32_t pass; rtems_status_code status; puts( "TA1 - is beginning to run" ); diff --git a/testsuites/sptests/sp06/task2.c b/testsuites/sptests/sp06/task2.c index 706859292c..f69d48bac8 100644 --- a/testsuites/sptests/sp06/task2.c +++ b/testsuites/sptests/sp06/task2.c @@ -51,7 +51,7 @@ rtems_task Task_2( rtems_task_argument argument ) directive_failed( status, "rtems_task_wake_after" ); } - while( FOREVER ) { + while ( FOREVER ) { puts( "TA2 - rtems_task_wake_after - sleep 1/2 second" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() / 2 ); directive_failed( status, "rtems_task_wake_after" ); diff --git a/testsuites/sptests/sp06/task3.c b/testsuites/sptests/sp06/task3.c index 409f098bb4..391a03da7c 100644 --- a/testsuites/sptests/sp06/task3.c +++ b/testsuites/sptests/sp06/task3.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp07/init.c b/testsuites/sptests/sp07/init.c index d7a6bb26d6..3cb3077feb 100644 --- a/testsuites/sptests/sp07/init.c +++ b/testsuites/sptests/sp07/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP 7"; -static void Task_harmless_extension_one( - rtems_tcb *unused_one -) +static void Task_harmless_extension_one( rtems_tcb *unused_one ) { (void) unused_one; @@ -90,9 +88,7 @@ rtems_extensions_table Extensions = { .thread_terminate = NULL }; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -101,23 +97,32 @@ rtems_task Init( TEST_BEGIN(); - Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', '1' ); - Extension_name[ 2 ] = rtems_build_name( 'E', 'X', 'T', '2' ); + Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', '1' ); + Extension_name[ 2 ] = rtems_build_name( 'E', 'X', 'T', '2' ); - puts ( "rtems_extension_create - bad table -- RTEMS_INVALID_ADDRESS" ); + puts( "rtems_extension_create - bad table -- RTEMS_INVALID_ADDRESS" ); status = rtems_extension_create( 0xa5a5a5a5, NULL, &id ); fatal_directive_status( - status, RTEMS_INVALID_ADDRESS, "rtems_extension_create" ); + status, + RTEMS_INVALID_ADDRESS, + "rtems_extension_create" + ); - puts ( "rtems_extension_create - bad id pointer -- RTEMS_INVALID_ADDRESS" ); + puts( "rtems_extension_create - bad id pointer -- RTEMS_INVALID_ADDRESS" ); status = rtems_extension_create( 0xa5a5a5a5, &Extensions, NULL ); fatal_directive_status( - status, RTEMS_INVALID_ADDRESS, "rtems_extension_create" ); + status, + RTEMS_INVALID_ADDRESS, + "rtems_extension_create" + ); - puts ( "rtems_extension_create - bad name -- RTEMS_INVALID_NAME" ); + puts( "rtems_extension_create - bad name -- RTEMS_INVALID_NAME" ); status = rtems_extension_create( 0, &Extensions, &id ); fatal_directive_status( - status, RTEMS_INVALID_NAME, "rtems_extension_create #1" ); + status, + RTEMS_INVALID_NAME, + "rtems_extension_create #1" + ); puts( "rtems_extension_create - first one -- OK" ); status = rtems_extension_create( @@ -135,7 +140,7 @@ rtems_task Init( ); directive_failed( status, "rtems_extension_create #2" ); - puts ( "rtems_extension_create -- RTEMS_TOO_MANY" ); + puts( "rtems_extension_create -- RTEMS_TOO_MANY" ); status = rtems_extension_create( 0xa5a5a5a5, &Extensions, &id ); fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_extension_create" ); @@ -151,16 +156,20 @@ rtems_task Init( "rtems_extension_delete #2 bad" ); - puts ( "rtems_extension_ident -- OK" ); - status = rtems_extension_ident( Extension_name[1], &id ); + puts( "rtems_extension_ident -- OK" ); + status = rtems_extension_ident( Extension_name[ 1 ], &id ); directive_failed( status, "rtems_extension_ident" ); - puts ( "rtems_extension_ident - bad name -- RTEMS_INVALID_NAME" ); - status = rtems_extension_ident( Extension_name[2], &id ); - fatal_directive_status( status, RTEMS_INVALID_NAME, "rtems_extension_ident" ); + puts( "rtems_extension_ident - bad name -- RTEMS_INVALID_NAME" ); + status = rtems_extension_ident( Extension_name[ 2 ], &id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_extension_ident" + ); - puts ( "rtems_extension_ident - bad name -- RTEMS_INVALID_ADDRESS" ); - status = rtems_extension_ident( Extension_name[2], NULL ); + puts( "rtems_extension_ident - bad name -- RTEMS_INVALID_ADDRESS" ); + status = rtems_extension_ident( Extension_name[ 2 ], NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -202,7 +211,7 @@ rtems_task Init( directive_failed( status, "rtems_task_create of TA2" ); assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 ); -#define TA3_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 4u) +#define TA3_PRIORITY ( RTEMS_MAXIMUM_PRIORITY - 4u ) status = rtems_task_create( Task_name[ 3 ], TA3_PRIORITY, @@ -214,7 +223,7 @@ rtems_task Init( directive_failed( status, "rtems_task_create of TA3" ); assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 | 0x8 ); -#define TA4_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u) +#define TA4_PRIORITY ( RTEMS_MAXIMUM_PRIORITY - 1u ) status = rtems_task_create( Task_name[ 4 ], TA4_PRIORITY, diff --git a/testsuites/sptests/sp07/system.h b/testsuites/sptests/sp07/system.h index bcd7b50d1c..13e106b8e4 100644 --- a/testsuites/sptests/sp07/system.h +++ b/testsuites/sptests/sp07/system.h @@ -34,74 +34,50 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); -rtems_task Task_4( - rtems_task_argument argument -); +rtems_task Task_4( rtems_task_argument argument ); -bool Task_create_extension( - rtems_tcb *unused, - rtems_tcb *created_task -); +bool Task_create_extension( rtems_tcb *unused, rtems_tcb *created_task ); -void Task_delete_extension( - rtems_tcb *running_task, - rtems_tcb *deleted_task -); +void Task_delete_extension( rtems_tcb *running_task, rtems_tcb *deleted_task ); -void Task_restart_extension( - rtems_tcb *unused, - rtems_tcb *restarted_task -); +void Task_restart_extension( rtems_tcb *unused, rtems_tcb *restarted_task ); -void Task_start_extension( - rtems_tcb *unused, - rtems_tcb *started_task -); +void Task_start_extension( rtems_tcb *unused, rtems_tcb *started_task ); -void Task_exit_extension( - rtems_tcb *running_task -); +void Task_exit_extension( rtems_tcb *running_task ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 2 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 2 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE) -#define CONFIGURE_MAXIMUM_TASKS 5 +#define CONFIGURE_EXTRA_TASK_STACKS ( 4 * RTEMS_MINIMUM_STACK_SIZE ) +#define CONFIGURE_MAXIMUM_TASKS 5 #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 5 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 5 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 5 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 5 ]; /* array of task names */ TEST_EXTERN rtems_id Extension_id[ 4 ]; -TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */ TEST_EXTERN int Task_created[ RTEMS_ARRAY_SIZE( Task_id ) ]; diff --git a/testsuites/sptests/sp07/task1.c b/testsuites/sptests/sp07/task1.c index f03dd33162..d24257b4df 100644 --- a/testsuites/sptests/sp07/task1.c +++ b/testsuites/sptests/sp07/task1.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -50,17 +48,19 @@ rtems_task Task_1( directive_failed( status, "rtems_task_set_priority" ); printf( "TA1 - rtems_task_set_priority - get initial " - "priority of self: %02" PRIdrtems_task_priority "\n", + "priority of self: %02" PRIdrtems_task_priority "\n", the_priority ); - while( FOREVER ) { + while ( FOREVER ) { if ( --the_priority == 0 ) { puts( "TA1 - rtems_task_suspend - suspend TA2" ); status = rtems_task_suspend( Task_id[ 2 ] ); directive_failed( status, "rtems_task_suspend" ); - puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" ); + puts( + "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" + ); status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); @@ -72,13 +72,13 @@ rtems_task Task_1( printf( "TA1 - rtems_task_set_priority - set TA2's priority: " - "%02" PRIdrtems_task_priority "\n", + "%02" PRIdrtems_task_priority "\n", the_priority ); status = rtems_task_set_priority( - Task_id[ 2 ], - the_priority, - &previous_priority + Task_id[ 2 ], + the_priority, + &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); } diff --git a/testsuites/sptests/sp07/task2.c b/testsuites/sptests/sp07/task2.c index 81aa79d012..d84b3de91b 100644 --- a/testsuites/sptests/sp07/task2.c +++ b/testsuites/sptests/sp07/task2.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; @@ -49,36 +47,37 @@ rtems_task Task_2( ); directive_failed( status, "rtems_task_set_priority" ); - while( FOREVER ) { + while ( FOREVER ) { if ( --the_priority == 0 ) { puts( "TA2 - rtems_task_suspend - suspend TA1" ); status = rtems_task_suspend( Task_id[ 1 ] ); directive_failed( status, "rtems_task_suspend" ); - puts( "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" ); + puts( + "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" + ); status = rtems_task_set_priority( Task_id[ 1 ], 5, &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); - status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */ + status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */ directive_failed( status, "rtems_task_delete of TA1" ); assert_extension_counts( &Task_deleted[ 0 ], 0x0 ); - status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */ + status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */ directive_failed( status, "rtems_task_delete of TA3" ); assert_extension_counts( &Task_deleted[ 0 ], 0x0 ); rtems_task_exit(); } else { - printf( "TA2 - rtems_task_set_priority - set TA1's priority: " - "%02" PRIdrtems_task_priority "\n", + "%02" PRIdrtems_task_priority "\n", the_priority ); status = rtems_task_set_priority( - Task_id[ 1 ], - the_priority, - &previous_priority + Task_id[ 1 ], + the_priority, + &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); } diff --git a/testsuites/sptests/sp07/task3.c b/testsuites/sptests/sp07/task3.c index 3233813e83..e713f8861f 100644 --- a/testsuites/sptests/sp07/task3.c +++ b/testsuites/sptests/sp07/task3.c @@ -41,15 +41,13 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; rtems_status_code status; - while( FOREVER ) { + while ( FOREVER ) { status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); } diff --git a/testsuites/sptests/sp07/task4.c b/testsuites/sptests/sp07/task4.c index 3020f355cb..113030c266 100644 --- a/testsuites/sptests/sp07/task4.c +++ b/testsuites/sptests/sp07/task4.c @@ -42,14 +42,12 @@ #include "system.h" -rtems_task Task_4( - rtems_task_argument argument -) +rtems_task Task_4( rtems_task_argument argument ) { (void) argument; rtems_status_code status; - rtems_id id; + rtems_id id; assert_extension_counts( &Task_created[ 0 ], 0x2 | 0x4 | 0x8 | 0x10 ); assert_extension_counts( &Task_started[ 0 ], 0x2 | 0x4 | 0x8 | 0x10 ); diff --git a/testsuites/sptests/sp07/taskexit.c b/testsuites/sptests/sp07/taskexit.c index 8d21b516ae..8c6cae5194 100644 --- a/testsuites/sptests/sp07/taskexit.c +++ b/testsuites/sptests/sp07/taskexit.c @@ -39,9 +39,7 @@ #include "system.h" -void Task_exit_extension( - rtems_tcb *running_task -) +void Task_exit_extension( rtems_tcb *running_task ) { if ( task_number( running_task->Object.id ) > 0 ) { puts_nocr( "RTEMS_TASK_EXITTED - extension invoked for " ); diff --git a/testsuites/sptests/sp07/tcreate.c b/testsuites/sptests/sp07/tcreate.c index ee8f07b117..d60d3df577 100644 --- a/testsuites/sptests/sp07/tcreate.c +++ b/testsuites/sptests/sp07/tcreate.c @@ -41,16 +41,13 @@ #include "system.h" -bool Task_create_extension( - rtems_tcb *unused, - rtems_tcb *created_task -) +bool Task_create_extension( rtems_tcb *unused, rtems_tcb *created_task ) { (void) unused; ssize_t task = task_number( created_task->Object.id ); - if (task > 0) { + if ( task > 0 ) { ++Task_created[ task ]; } diff --git a/testsuites/sptests/sp07/tdelete.c b/testsuites/sptests/sp07/tdelete.c index 59fe9eeb68..1e2a4a8475 100644 --- a/testsuites/sptests/sp07/tdelete.c +++ b/testsuites/sptests/sp07/tdelete.c @@ -41,14 +41,11 @@ #include "system.h" -void Task_delete_extension( - rtems_tcb *running_task, - rtems_tcb *deleted_task -) +void Task_delete_extension( rtems_tcb *running_task, rtems_tcb *deleted_task ) { ssize_t task = task_number( deleted_task->Object.id ); - if (task > 0) { + if ( task > 0 ) { ++Task_deleted[ task ]; } diff --git a/testsuites/sptests/sp07/trestart.c b/testsuites/sptests/sp07/trestart.c index f235520de3..bf791bbe04 100644 --- a/testsuites/sptests/sp07/trestart.c +++ b/testsuites/sptests/sp07/trestart.c @@ -41,16 +41,13 @@ #include "system.h" -void Task_restart_extension( - rtems_tcb *unused, - rtems_tcb *restarted_task -) +void Task_restart_extension( rtems_tcb *unused, rtems_tcb *restarted_task ) { (void) unused; ssize_t task = task_number( restarted_task->Object.id ); - if (task > 0) { + if ( task > 0 ) { ++Task_restarted[ task ]; } } diff --git a/testsuites/sptests/sp07/tstart.c b/testsuites/sptests/sp07/tstart.c index 6bedd377ee..774da5a2a2 100644 --- a/testsuites/sptests/sp07/tstart.c +++ b/testsuites/sptests/sp07/tstart.c @@ -41,16 +41,13 @@ #include "system.h" -void Task_start_extension( - rtems_tcb *unused, - rtems_tcb *started_task -) +void Task_start_extension( rtems_tcb *unused, rtems_tcb *started_task ) { (void) unused; ssize_t task = task_number( started_task->Object.id ); - if (task > 0) { + if ( task > 0 ) { ++Task_started[ task ]; } } diff --git a/testsuites/sptests/sp08/init.c b/testsuites/sptests/sp08/init.c index 508f7fc2f7..a1590e6ae0 100644 --- a/testsuites/sptests/sp08/init.c +++ b/testsuites/sptests/sp08/init.c @@ -37,16 +37,14 @@ const char rtems_test_name[] = "SP 8"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -#define PRIxrtems_mode PRIx32 +#define PRIxrtems_mode PRIx32 #define put_mode( _comment, _output_mode ) \ - printf( "%s %08" PRIxrtems_mode "\n", _comment, _output_mode ); + printf( "%s %08" PRIxrtems_mode "\n", _comment, _output_mode ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -55,7 +53,7 @@ rtems_task Init( TEST_BEGIN(); -/* BEGINNING OF RTEMS_ASR */ + /* BEGINNING OF RTEMS_ASR */ status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); @@ -64,42 +62,30 @@ rtems_task Init( previous_mode ); - status = rtems_task_mode( - RTEMS_NO_ASR, - RTEMS_ASR_MASK, - &previous_mode - ); + status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); put_mode( "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", previous_mode ); - status = rtems_task_mode( - RTEMS_NO_ASR, - RTEMS_ASR_MASK, - &previous_mode - ); + status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); put_mode( "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", previous_mode ); - status = rtems_task_mode( - RTEMS_ASR, - RTEMS_ASR_MASK, - &previous_mode - ); + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); put_mode( "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", previous_mode ); -/* END OF RTEMS_ASR */ + /* END OF RTEMS_ASR */ -/* BEGINNING OF RTEMS_TIMESLICE */ + /* BEGINNING OF RTEMS_TIMESLICE */ status = rtems_task_mode( RTEMS_NO_TIMESLICE, @@ -145,9 +131,9 @@ rtems_task Init( previous_mode ); -/* END OF RTEMS_TIMESLICE */ + /* END OF RTEMS_TIMESLICE */ -/* BEGINNING OF RTEMS_PREEMPT */ + /* BEGINNING OF RTEMS_PREEMPT */ status = rtems_task_mode( RTEMS_PREEMPT, @@ -198,7 +184,7 @@ rtems_task Init( /* BEGINNING OF RTEMS_INTERRUPT_LEVEL */ #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE status = rtems_task_mode( - RTEMS_INTERRUPT_LEVEL(3), + RTEMS_INTERRUPT_LEVEL( 3 ), RTEMS_INTERRUPT_MASK, &previous_mode ); @@ -209,7 +195,7 @@ rtems_task Init( ); status = rtems_task_mode( - RTEMS_INTERRUPT_LEVEL(5), + RTEMS_INTERRUPT_LEVEL( 5 ), RTEMS_INTERRUPT_MASK, &previous_mode ); @@ -226,20 +212,19 @@ rtems_task Init( ); fatal_directive_status( status, RTEMS_NOT_IMPLEMENTED, "rtems_task_mode" ); #endif -/* END OF RTEMS_INTERRUPT_LEVEL */ + /* END OF RTEMS_INTERRUPT_LEVEL */ -/* BEGINNING OF COMBINATIONS */ + /* BEGINNING OF COMBINATIONS */ status = rtems_task_mode( #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE - RTEMS_INTERRUPT_LEVEL(0) | + RTEMS_INTERRUPT_LEVEL( 0 ) | #else - RTEMS_INTERRUPT_LEVEL(3) | + RTEMS_INTERRUPT_LEVEL( 3 ) | #endif - RTEMS_NO_ASR | - RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, - RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | - RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + RTEMS_NO_ASR | RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | RTEMS_TIMESLICE_MASK | + RTEMS_PREEMPT_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); @@ -250,14 +235,13 @@ rtems_task Init( status = rtems_task_mode( #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE - RTEMS_INTERRUPT_LEVEL(0) | + RTEMS_INTERRUPT_LEVEL( 0 ) | #else - RTEMS_INTERRUPT_LEVEL(3) | + RTEMS_INTERRUPT_LEVEL( 3 ) | #endif - RTEMS_NO_ASR | - RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, - RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | - RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + RTEMS_NO_ASR | RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | RTEMS_TIMESLICE_MASK | + RTEMS_PREEMPT_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); @@ -267,9 +251,10 @@ rtems_task Init( ); status = rtems_task_mode( - RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT, - RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | - RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + RTEMS_INTERRUPT_LEVEL( 0 ) | RTEMS_ASR | RTEMS_NO_TIMESLICE | + RTEMS_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | RTEMS_TIMESLICE_MASK | + RTEMS_PREEMPT_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); @@ -278,9 +263,9 @@ rtems_task Init( previous_mode ); -/* END OF COMBINATIONS */ + /* END OF COMBINATIONS */ -/* BEGINNING OF CURRENT MODE */ + /* BEGINNING OF CURRENT MODE */ status = rtems_task_mode( RTEMS_CURRENT_MODE, @@ -293,9 +278,9 @@ rtems_task Init( previous_mode ); -/* END OF CURRENT MODE */ + /* END OF CURRENT MODE */ -/* TEST BEING IN A SYSTEM STATE OTHER THAN UP */ + /* TEST BEING IN A SYSTEM STATE OTHER THAN UP */ puts( "TA1 - FORCE system state to before multitasking" ); _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); @@ -322,7 +307,7 @@ rtems_task Init( puts( "TA1 - Restore system state" ); _System_state_Set( SYSTEM_STATE_UP ); -/* END OF TEST BEING IN A SYSTEM STATE OTHER THAN UP */ + /* END OF TEST BEING IN A SYSTEM STATE OTHER THAN UP */ TEST_END(); rtems_test_exit( 0 ); @@ -332,7 +317,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp11/init.c b/testsuites/sptests/sp11/init.c index 32d4d34ee1..d048dce281 100644 --- a/testsuites/sptests/sp11/init.c +++ b/testsuites/sptests/sp11/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 11"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp11/system.h b/testsuites/sptests/sp11/system.h index e717eae143..53cd564040 100644 --- a/testsuites/sptests/sp11/system.h +++ b/testsuites/sptests/sp11/system.h @@ -34,51 +34,45 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); rtems_timer_service_routine TA1_send_18_to_self_5_seconds( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); rtems_timer_service_routine TA1_send_8_to_self_60_seconds( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); rtems_timer_service_routine TA1_send_9_to_self_60_seconds( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); rtems_timer_service_routine TA1_send_10_to_self( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); rtems_timer_service_routine TA1_send_1_to_self_every_second( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); rtems_timer_service_routine TA1_send_11_to_self( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); rtems_timer_service_routine TA2_send_10_to_self( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); /* configuration information */ @@ -86,24 +80,24 @@ rtems_timer_service_routine TA2_send_10_to_self( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_TIMERS 6 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_TIMERS 6 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (2 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 2 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 7 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 7 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 7 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 7 ]; /* array of timer names */ /* end of include file */ diff --git a/testsuites/sptests/sp11/task1.c b/testsuites/sptests/sp11/task1.c index 0aa4acb365..5675274958 100644 --- a/testsuites/sptests/sp11/task1.c +++ b/testsuites/sptests/sp11/task1.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -49,7 +47,7 @@ rtems_task Task_1( puts( "TA1 - rtems_event_receive - waiting forever on " - "RTEMS_EVENT_14 and RTEMS_EVENT_15" + "RTEMS_EVENT_14 and RTEMS_EVENT_15" ); status = rtems_event_receive( RTEMS_EVENT_14 | RTEMS_EVENT_15, @@ -60,7 +58,7 @@ rtems_task Task_1( directive_failed( status, "rtems_event_receive" ); printf( "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - " - "eventout => %08" PRIxrtems_event_set "\n", + "eventout => %08" PRIxrtems_event_set "\n", eventout ); @@ -70,7 +68,7 @@ rtems_task Task_1( puts( "TA1 - rtems_event_receive - waiting with 10 second timeout " - "on RTEMS_EVENT_14" + "on RTEMS_EVENT_14" ); status = rtems_event_receive( RTEMS_EVENT_14, @@ -81,7 +79,7 @@ rtems_task Task_1( directive_failed( status, "rtems_event_receive" ); printf( "TA1 - RTEMS_EVENT_14 received - eventout => " - "%08" PRIxrtems_event_set "\n", + "%08" PRIxrtems_event_set "\n", eventout ); @@ -93,7 +91,9 @@ rtems_task Task_1( directive_failed( status, "rtems_clock_get_tod" ); print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" ); - puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds"); + puts( + "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds" + ); status = rtems_timer_fire_after( Timer_id[ 1 ], 5 * rtems_clock_get_ticks_per_second(), @@ -102,7 +102,7 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_after 5 seconds" ); - puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" ); + puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" ); status = rtems_event_receive( RTEMS_EVENT_18, RTEMS_DEFAULT_OPTIONS, @@ -125,7 +125,7 @@ rtems_task Task_1( puts( "TA1 - rtems_event_receive - RTEMS_EVENT_3 or " - "RTEMS_EVENT_22 - NO_WAIT and ANY" + "RTEMS_EVENT_22 - NO_WAIT and ANY" ); status = rtems_event_receive( RTEMS_EVENT_3 | RTEMS_EVENT_22, @@ -143,9 +143,9 @@ rtems_task Task_1( status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 ); directive_failed( status, "rtems_event_send" ); - puts ( - "TA1 - rtems_event_receive - RTEMS_EVENT_4 or " - "RTEMS_EVENT_5 - forever and ANY" + puts( + "TA1 - rtems_event_receive - RTEMS_EVENT_4 or " + "RTEMS_EVENT_5 - forever and ANY" ); status = rtems_event_receive( RTEMS_EVENT_4 | RTEMS_EVENT_5, @@ -156,10 +156,12 @@ rtems_task Task_1( directive_failed( status, "rtems_event_receive" ); printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08" PRIxrtems_event_set "\n", - eventout + eventout ); - puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds"); + puts( + "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds" + ); status = rtems_timer_fire_after( Timer_id[ 1 ], 5 * rtems_clock_get_ticks_per_second(), @@ -168,11 +170,15 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_after 5 seconds" ); - puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18"); + puts( + "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18" + ); status = rtems_timer_cancel( Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_cancel" ); - puts( "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds"); + puts( + "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds" + ); status = rtems_timer_fire_after( Timer_id[ 1 ], 60 * rtems_clock_get_ticks_per_second(), @@ -181,7 +187,9 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_after 60 seconds" ); - puts( "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds"); + puts( + "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds" + ); status = rtems_timer_fire_after( Timer_id[ 2 ], 60 * rtems_clock_get_ticks_per_second(), @@ -201,7 +209,9 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_after 60 seconds" ); - puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" ); + puts( + "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" + ); status = rtems_timer_cancel( Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_cancel" ); @@ -221,7 +231,6 @@ rtems_task Task_1( directive_failed( status, "rtems_timer_fire_after 1 second" ); for ( index = 0; index < 3; index++ ) { - status = rtems_event_receive( RTEMS_EVENT_1, RTEMS_EVENT_ANY, @@ -234,9 +243,9 @@ rtems_task Task_1( directive_failed( status, "rtems_clock_get_tod" ); printf( - "TA1 - RTEMS_EVENT_1 received - eventout => %08" - PRIxrtems_event_set " - ", - eventout + "TA1 - RTEMS_EVENT_1 received - eventout => %08" PRIxrtems_event_set + " - ", + eventout ); print_time( "at ", &time, "\n" ); @@ -244,10 +253,11 @@ rtems_task Task_1( status = rtems_timer_reset( Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_reset" ); }; - } - puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" ); + puts( + "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" + ); status = rtems_timer_cancel( Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_cancel" ); @@ -271,7 +281,7 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_when 1 day" ); - time.hour = 8; /* so code below has correct time/date */ + time.hour = 8; /* so code below has correct time/date */ time.day = 14; puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" ); status = rtems_timer_fire_when( @@ -282,7 +292,9 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_when 2 days" ); - puts("TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day"); + puts( + "TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day" + ); status = rtems_timer_cancel( Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_cancel" ); @@ -318,7 +330,7 @@ rtems_task Task_1( directive_failed( status, "rtems_event_receive" ); printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08" PRIxrtems_event_set "\n", - eventout + eventout ); puts( "TA1 - rtems_event_send/rtems_event_receive combination" ); @@ -346,7 +358,7 @@ rtems_task Task_1( time.day = 13; puts( "TA1 - rtems_event_receive all outstanding events" ); - status = rtems_event_receive( + status = rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_NO_WAIT | RTEMS_EVENT_ANY, 0, @@ -384,16 +396,20 @@ rtems_task Task_1( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - status = rtems_event_receive( + status = rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_NO_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &eventout ); - if ( eventout ) - printf( "ERROR -0x%08" PRIxrtems_event_set " events received\n", eventout ); - else + if ( eventout ) { + printf( + "ERROR -0x%08" PRIxrtems_event_set " events received\n", + eventout + ); + } else { puts( "TA1 - no events received" ); + } fatal_directive_status( status, RTEMS_UNSATISFIED, @@ -407,19 +423,25 @@ rtems_task Task_1( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - status = rtems_event_receive( + status = rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_NO_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &eventout ); - if ( eventout == RTEMS_EVENT_10 ) + if ( eventout == RTEMS_EVENT_10 ) { puts( "TA1 - RTEMS_EVENT_10 received" ); - else - printf( "ERROR -0x%08" PRIxrtems_event_set " events received\n", eventout ); + } else { + printf( + "ERROR -0x%08" PRIxrtems_event_set " events received\n", + eventout + ); + } directive_failed( status, "rtems_event_receive all events" ); - puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks"); + puts( + "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks" + ); status = rtems_timer_fire_after( Timer_id[ 1 ], 100, @@ -428,7 +450,9 @@ rtems_task Task_1( ); directive_failed( status, "rtems_timer_fire_after 100 ticks" ); - puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks"); + puts( + "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks" + ); status = rtems_timer_fire_after( Timer_id[ 1 ], 200, @@ -446,7 +470,7 @@ rtems_task Task_1( puts( "TA1 - rtems_event_receive - RTEMS_EVENT_4 AND RTEMS_EVENT_5 - UNSATISFIED" ); - status = rtems_event_receive( + status = rtems_event_receive( RTEMS_EVENT_4 | RTEMS_EVENT_5, RTEMS_NO_WAIT | RTEMS_EVENT_ALL, RTEMS_NO_TIMEOUT, diff --git a/testsuites/sptests/sp11/task2.c b/testsuites/sptests/sp11/task2.c index bbfb01aa99..43e76fe40c 100644 --- a/testsuites/sptests/sp11/task2.c +++ b/testsuites/sptests/sp11/task2.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; @@ -55,7 +53,7 @@ rtems_task Task_2( directive_failed( status, "rtems_event_receive" ); printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08" PRIxrtems_event_set "\n", - eventout + eventout ); puts( @@ -66,7 +64,7 @@ rtems_task Task_2( puts( "TA2 - rtems_event_receive - RTEMS_EVENT_17 or " - "RTEMS_EVENT_18 - forever and ANY" + "RTEMS_EVENT_18 - forever and ANY" ); status = rtems_event_receive( RTEMS_EVENT_17 | RTEMS_EVENT_18, @@ -77,7 +75,7 @@ rtems_task Task_2( directive_failed( status, "rtems_event_receive" ); printf( "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - " - "eventout => %08" PRIxrtems_event_set "\n", + "eventout => %08" PRIxrtems_event_set "\n", eventout ); @@ -116,7 +114,7 @@ rtems_task Task_2( printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08" PRIxrtems_event_set "\n", - eventout + eventout ); print_time( "TA2 - rtems_clock_get_tod - ", &time, "\n" ); @@ -140,7 +138,7 @@ rtems_task Task_2( directive_failed( status, "rtems_event_receive" ); printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08" PRIxrtems_event_set "\n", - eventout + eventout ); puts( "TA2 - rtems_task_delete - deletes self" ); diff --git a/testsuites/sptests/sp11/timer.c b/testsuites/sptests/sp11/timer.c index 1ab69f51c5..789683b30b 100644 --- a/testsuites/sptests/sp11/timer.c +++ b/testsuites/sptests/sp11/timer.c @@ -40,8 +40,8 @@ #include "system.h" rtems_timer_service_routine TA1_send_18_to_self_5_seconds( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -54,8 +54,8 @@ rtems_timer_service_routine TA1_send_18_to_self_5_seconds( } rtems_timer_service_routine TA1_send_8_to_self_60_seconds( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -68,8 +68,8 @@ rtems_timer_service_routine TA1_send_8_to_self_60_seconds( } rtems_timer_service_routine TA1_send_9_to_self_60_seconds( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -82,8 +82,8 @@ rtems_timer_service_routine TA1_send_9_to_self_60_seconds( } rtems_timer_service_routine TA1_send_10_to_self( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -96,8 +96,8 @@ rtems_timer_service_routine TA1_send_10_to_self( } rtems_timer_service_routine TA1_send_1_to_self_every_second( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -110,8 +110,8 @@ rtems_timer_service_routine TA1_send_1_to_self_every_second( } rtems_timer_service_routine TA1_send_11_to_self( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -124,8 +124,8 @@ rtems_timer_service_routine TA1_send_11_to_self( } rtems_timer_service_routine TA2_send_10_to_self( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; diff --git a/testsuites/sptests/sp12/init.c b/testsuites/sptests/sp12/init.c index 84d05b0a4e..9a93846d34 100644 --- a/testsuites/sptests/sp12/init.c +++ b/testsuites/sptests/sp12/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 12"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,11 +55,11 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' ); Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' ); @@ -69,9 +67,9 @@ rtems_task Init( Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' ); Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' ); - Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); - Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); - Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); status = rtems_semaphore_create( Semaphore_name[ 1 ], @@ -104,7 +102,7 @@ rtems_task Init( Priority_test_driver( 0 ); puts( "INIT - Backward priority queue test" ); - Priority_test_driver( (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u ); + Priority_test_driver( ( RTEMS_MAXIMUM_PRIORITY / 2u ) + 1u ); puts( "INIT - Binary Semaphore and Priority Inheritance Test" ); diff --git a/testsuites/sptests/sp12/pridrv.c b/testsuites/sptests/sp12/pridrv.c index 33b454125e..8db29d2b5e 100644 --- a/testsuites/sptests/sp12/pridrv.c +++ b/testsuites/sptests/sp12/pridrv.c @@ -32,24 +32,22 @@ #include "system.h" -void Priority_test_driver( - rtems_task_priority priority_base -) +void Priority_test_driver( rtems_task_priority priority_base ) { rtems_task_priority previous_priority; uint32_t index; rtems_status_code status; - for ( index = 1 ; index <= 5 ; index++ ) { + for ( index = 1; index <= 5; index++ ) { switch ( index ) { - case 1: - case 2: - case 3: - Task_priority[ index ] = priority_base + index; - break; - default: - Task_priority[ index ] = priority_base + 3; - break; + case 1: + case 2: + case 3: + Task_priority[ index ] = priority_base + index; + break; + default: + Task_priority[ index ] = priority_base + 3; + break; } status = rtems_task_create( @@ -61,11 +59,10 @@ void Priority_test_driver( &Priority_task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); - } if ( priority_base == 0 ) { - for ( index = 1 ; index <= 5 ; index++ ) { + for ( index = 1; index <= 5; index++ ) { status = rtems_task_start( Priority_task_id[ index ], Priority_task, @@ -74,7 +71,7 @@ void Priority_test_driver( directive_failed( status, "rtems_task_start loop" ); } } else { - for ( index = 5 ; index >= 1 ; index-- ) { + for ( index = 5; index >= 1; index-- ) { status = rtems_task_start( Priority_task_id[ index ], Priority_task, @@ -93,10 +90,10 @@ void Priority_test_driver( &previous_priority ); printf( - "PDRV - change priority of PRI5 from %" PRIdrtems_task_priority - " to %" PRIdrtems_task_priority "\n", - previous_priority, - priority_base + 4 + "PDRV - change priority of PRI5 from %" PRIdrtems_task_priority + " to %" PRIdrtems_task_priority "\n", + previous_priority, + priority_base + 4 ); directive_failed( status, "PDRV rtems_task_set_priority" ); } @@ -108,7 +105,7 @@ void Priority_test_driver( directive_failed( status, "PDRV rtems_task_set_priority CURRENT" ); printf( "PDRV - priority of PRI5 is %" PRIdrtems_task_priority "\n", - previous_priority + previous_priority ); } } @@ -118,7 +115,7 @@ void Priority_test_driver( directive_failed( status, "rtems_task_wake_after after loop" ); if ( priority_base == 0 ) { - for ( index = 1 ; index <= 5 ; index++ ) { + for ( index = 1; index <= 5; index++ ) { status = rtems_semaphore_release( Semaphore_id[ 2 ] ); directive_failed( status, "rtems_semaphore_release loop" ); } @@ -135,7 +132,7 @@ void Priority_test_driver( status = rtems_task_delete( Priority_task_id[ 5 ] ); directive_failed( status, "rtems_task_delete of PRI5" ); } else { - for ( index = 1 ; index <= 5 ; index++ ) { + for ( index = 1; index <= 5; index++ ) { status = rtems_task_delete( Priority_task_id[ index ] ); directive_failed( status, "rtems_task_delete loop" ); } diff --git a/testsuites/sptests/sp12/pritask.c b/testsuites/sptests/sp12/pritask.c index 33f2c0a4c9..17f7f95c71 100644 --- a/testsuites/sptests/sp12/pritask.c +++ b/testsuites/sptests/sp12/pritask.c @@ -32,9 +32,7 @@ #include "system.h" -rtems_task Priority_task( - rtems_task_argument its_index_arg -) +rtems_task Priority_task( rtems_task_argument its_index_arg ) { rtems_interval timeout; rtems_task_priority its_priority; @@ -46,10 +44,11 @@ rtems_task Priority_task( its_index = (int) its_index_arg; its_priority = Task_priority[ its_index ]; - if ( its_priority < 3 ) + if ( its_priority < 3 ) { timeout = 5 * rtems_clock_get_ticks_per_second(); - else + } else { timeout = RTEMS_NO_TIMEOUT; + } put_name( Priority_task_name[ its_index ], FALSE ); puts( " - rtems_semaphore_obtain - wait forever on SM2" ); @@ -64,8 +63,8 @@ rtems_task Priority_task( if ( its_priority < PRIORITY_INHERIT_BASE_PRIORITY ) { printf( "PRI%d - WHY AM I HERE? (pri=%" PRIdrtems_task_priority ")", - its_index, - its_priority + its_index, + its_priority ); rtems_test_exit( 0 ); } @@ -76,29 +75,33 @@ rtems_task Priority_task( rtems_task_priority old_priority; puts( "Set priority of self while holding resource" ); - status = - rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority ); + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &priority + ); directive_failed( status, "rtems_task_set_priority get current" ); status = rtems_task_set_priority( RTEMS_SELF, priority, &old_priority ); directive_failed( status, "rtems_task_set_priority with resource" ); if ( priority != old_priority ) { printf( "priority != old_priority (%" PRIdrtems_task_priority - " != %" PRIdrtems_task_priority ")\n", - priority, - old_priority + " != %" PRIdrtems_task_priority ")\n", + priority, + old_priority ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } } - if ( its_index == 5 ) + if ( its_index == 5 ) { puts( "PRI5 - rtems_task_suspend - until all priority tasks blocked" ); + } status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend" ); puts( "PRI5 - rtems_task_delete - all tasks waiting on SM2" ); - for ( index = 1 ; index < 5 ; index++ ) { + for ( index = 1; index < 5; index++ ) { status = rtems_task_delete( Priority_task_id[ index ] ); directive_failed( status, "rtems_task_delete loop" ); } @@ -127,7 +130,7 @@ rtems_task Priority_task( directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" ); printf( "PRI5 - priority of PRI5 is %" PRIdrtems_task_priority "\n", - current_priority + current_priority ); (void) rtems_task_suspend( RTEMS_SELF ); diff --git a/testsuites/sptests/sp12/system.h b/testsuites/sptests/sp12/system.h index f81e492154..0495ee4855 100644 --- a/testsuites/sptests/sp12/system.h +++ b/testsuites/sptests/sp12/system.h @@ -36,68 +36,51 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -void Priority_test_driver( - rtems_task_priority priority_base -); +void Priority_test_driver( rtems_task_priority priority_base ); -rtems_task Priority_task( - rtems_task_argument its_index -); +rtems_task Priority_task( rtems_task_argument its_index ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); -rtems_task Task_4( - rtems_task_argument argument -); +rtems_task Task_4( rtems_task_argument argument ); -rtems_task Task5( - rtems_task_argument argument -); +rtems_task Task5( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) -#define CONFIGURE_MAXIMUM_TASKS 8 -#define CONFIGURE_MAXIMUM_SEMAPHORES 10 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) +#define CONFIGURE_MAXIMUM_TASKS 8 +#define CONFIGURE_MAXIMUM_SEMAPHORES 10 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (6 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 6 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ -TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ - -TEST_EXTERN rtems_id Priority_task_id[ 6 ]; /* array of task ids */ -TEST_EXTERN rtems_name Priority_task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Priority_task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Priority_task_name[ 6 ]; /* array of task names */ TEST_EXTERN rtems_task_priority Task_priority[ 6 ]; -TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ +TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ +TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ /* end of include file */ diff --git a/testsuites/sptests/sp12/task1.c b/testsuites/sptests/sp12/task1.c index f830d2aa42..23ff37dd38 100644 --- a/testsuites/sptests/sp12/task1.c +++ b/testsuites/sptests/sp12/task1.c @@ -40,9 +40,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -54,7 +52,10 @@ rtems_task Task_1( RTEMS_SEARCH_ALL_NODES, &smid ); - printf( "TA1 - rtems_semaphore_ident - smid => %08" PRIxrtems_id "\n", smid ); + printf( + "TA1 - rtems_semaphore_ident - smid => %08" PRIxrtems_id "\n", + smid + ); directive_failed( status, "rtems_semaphore_ident of SM1" ); puts( "TA1 - rtems_semaphore_obtain - wait forever on SM2" ); @@ -132,7 +133,7 @@ rtems_task Task_1( RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 5 ] - ); + ); directive_failed( status, "rtems_task_create of TA5" ); status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); diff --git a/testsuites/sptests/sp12/task2.c b/testsuites/sptests/sp12/task2.c index 06c29df6cc..5bd0c6496d 100644 --- a/testsuites/sptests/sp12/task2.c +++ b/testsuites/sptests/sp12/task2.c @@ -35,16 +35,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp12/task3.c b/testsuites/sptests/sp12/task3.c index 4603a85945..6ab0edd89b 100644 --- a/testsuites/sptests/sp12/task3.c +++ b/testsuites/sptests/sp12/task3.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp12/task4.c b/testsuites/sptests/sp12/task4.c index f0ca086833..529d062669 100644 --- a/testsuites/sptests/sp12/task4.c +++ b/testsuites/sptests/sp12/task4.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_4( - rtems_task_argument argument -) +rtems_task Task_4( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp12/task5.c b/testsuites/sptests/sp12/task5.c index 308f7820c6..b12f1bdf76 100644 --- a/testsuites/sptests/sp12/task5.c +++ b/testsuites/sptests/sp12/task5.c @@ -42,9 +42,7 @@ #include "system.h" -rtems_task Task5( - rtems_task_argument argument -) +rtems_task Task5( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp13/fillbuff.c b/testsuites/sptests/sp13/fillbuff.c index e5e5834290..ba3b19eb40 100644 --- a/testsuites/sptests/sp13/fillbuff.c +++ b/testsuites/sptests/sp13/fillbuff.c @@ -42,20 +42,17 @@ #include "system.h" -void Fill_buffer( - char *source, - long *buffer -) +void Fill_buffer( char *source, long *buffer ) { - char *p; + char *p; size_t i; - int j; + int j; p = source; - for ( i = 0 ; i < MESSAGE_SIZE / sizeof(long) ; i++ ) { - buffer[i] = 0; - for ( j = sizeof(long) - 1; j >= 0; j-- ) { - buffer[i] |= *p++ << (8 * j); + for ( i = 0; i < MESSAGE_SIZE / sizeof( long ); i++ ) { + buffer[ i ] = 0; + for ( j = sizeof( long ) - 1; j >= 0; j-- ) { + buffer[ i ] |= *p++ << ( 8 * j ); } } } diff --git a/testsuites/sptests/sp13/init.c b/testsuites/sptests/sp13/init.c index 023b11d64a..058e75b89d 100644 --- a/testsuites/sptests/sp13/init.c +++ b/testsuites/sptests/sp13/init.c @@ -58,9 +58,7 @@ static const rtems_message_queue_config Queue_3_config = { .attributes = RTEMS_GLOBAL }; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -68,9 +66,9 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); status = rtems_task_create( Task_name[ 1 ], diff --git a/testsuites/sptests/sp13/putbuff.c b/testsuites/sptests/sp13/putbuff.c index 0bc9d7c51f..af74ba3910 100644 --- a/testsuites/sptests/sp13/putbuff.c +++ b/testsuites/sptests/sp13/putbuff.c @@ -41,18 +41,17 @@ #include "system.h" -void Put_buffer( - void *buffer -) +void Put_buffer( void *buffer ) { - int i, j; - char c; + int i, j; + char c; long *b = buffer; - for ( i = 0; i < (int) (MESSAGE_SIZE / sizeof(long)); i++ ) { - for ( j = sizeof(long) - 1; j >= 0; j-- ) { - if ( (c = (char)(b[i] >> (8 * j)) & 0xFF) == 0 ) + for ( i = 0; i < (int) ( MESSAGE_SIZE / sizeof( long ) ); i++ ) { + for ( j = sizeof( long ) - 1; j >= 0; j-- ) { + if ( ( c = (char) ( b[ i ] >> ( 8 * j ) ) & 0xFF ) == 0 ) { return; + } printf( "%c", c ); } } diff --git a/testsuites/sptests/sp13/system.h b/testsuites/sptests/sp13/system.h index 522ac9db41..c1677a8ad8 100644 --- a/testsuites/sptests/sp13/system.h +++ b/testsuites/sptests/sp13/system.h @@ -34,51 +34,39 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -void Fill_buffer( - char source[], - long *buffer -); +void Fill_buffer( char source[], long *buffer ); -void Put_buffer( - void *buffer -); +void Put_buffer( void *buffer ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Queue_id[ 4 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Queue_name[ 4 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 4 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 4 ]; /* array of queue names */ /* test configuration */ -#define MESSAGE_SIZE (sizeof(long) * 4) /* must be multiple of sizeof(long) */ +#define MESSAGE_SIZE \ + ( sizeof( long ) * 4 ) /* must be multiple of sizeof(long) */ /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -107,14 +95,17 @@ TEST_EXTERN rtems_name Queue_name[ 4 ]; /* array of queue names */ * ignore Q2 and the last instance of Q1 since enough memory is * free when the third instance of Q1 is created. */ -#define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, MESSAGE_SIZE ) + \ - /* Q2 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 10, MESSAGE_SIZE ) + \ - /* Q3 is statically allocated */ \ - /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, 20 ) + \ - /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2, 1030 ) +#define CONFIGURE_MESSAGE_BUFFER_MEMORY \ + /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, MESSAGE_SIZE ) + \ + /* Q2 */ \ + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( \ + 10, \ + MESSAGE_SIZE \ + ) + /* Q3 is statically allocated */ /* Q1 */ \ + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, 20 ) + \ + /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2, 1030 ) -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) #include diff --git a/testsuites/sptests/sp13/task1.c b/testsuites/sptests/sp13/task1.c index c704ed50d3..400620e1f7 100644 --- a/testsuites/sptests/sp13/task1.c +++ b/testsuites/sptests/sp13/task1.c @@ -31,40 +31,31 @@ #endif #include "system.h" -#include /* for memcmp */ +#include /* for memcmp */ -void dope_buffer( - unsigned char *buff, - int buff_size, - unsigned char v -); +void dope_buffer( unsigned char *buff, int buff_size, unsigned char v ); -unsigned char big_send_buffer[2048]; -unsigned char big_receive_buffer[2048]; +unsigned char big_send_buffer[ 2048 ]; +unsigned char big_receive_buffer[ 2048 ]; -long buffer[ MESSAGE_SIZE / sizeof(long) ]; +long buffer[ MESSAGE_SIZE / sizeof( long ) ]; -void dope_buffer( - unsigned char *buff, - int buff_size, - unsigned char v -) +void dope_buffer( unsigned char *buff, int buff_size, unsigned char v ) { int i; unsigned char ch; - ch = (' ' + (v % (0x7f - ' '))); + ch = ( ' ' + ( v % ( 0x7f - ' ' ) ) ); - for (i=0; i= 0x7f) + if ( ch >= 0x7f ) { ch = ' '; + } } } -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -83,7 +74,7 @@ rtems_task Task_1( ); printf( "TA1 - rtems_message_queue_ident - qid => %08" PRIxrtems_id "\n", - qid + qid ); directive_failed( status, "rtems_message_queue_ident" ); @@ -98,7 +89,7 @@ rtems_task Task_1( directive_failed( status, "rtems_message_queue_send" ); puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); - status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); Fill_buffer( "BUFFER 3 TO Q 1", buffer ); @@ -107,7 +98,7 @@ rtems_task Task_1( directive_failed( status, "rtems_message_queue_send" ); puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); - status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); Fill_buffer( "BUFFER 1 TO Q 2", buffer ); @@ -116,7 +107,7 @@ rtems_task Task_1( directive_failed( status, "rtems_message_queue_send" ); puts_nocr( "TA1 - rtems_message_queue_receive - receive from queue 1 - " ); - puts ( "10 second timeout" ); + puts( "10 second timeout" ); status = rtems_message_queue_receive( Queue_id[ 1 ], buffer, @@ -139,7 +130,7 @@ rtems_task Task_1( directive_failed( status, "rtems_message_queue_send" ); puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); - status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() ); + status = rtems_task_wake_after( 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); Fill_buffer( "BUFFER 2 TO Q 3", buffer ); @@ -162,10 +153,10 @@ rtems_task Task_1( status = rtems_message_queue_urgent( Queue_id[ 3 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_urgent" ); - for ( index = 1 ; index <= 4 ; index++ ) { + for ( index = 1; index <= 4; index++ ) { puts( "TA1 - rtems_message_queue_receive - receive from queue 3 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 3 ], @@ -187,7 +178,7 @@ rtems_task Task_1( puts( "TA1 - rtems_message_queue_receive - receive from queue 2 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 2 ], @@ -235,11 +226,11 @@ rtems_task Task_1( directive_failed( status, "rtems_message_queue_send" ); /* this broadcast should have no effect on the queue */ - Fill_buffer( "NO BUFFER TO Q1", (long *)buffer ); + Fill_buffer( "NO BUFFER TO Q1", (long *) buffer ); puts( "TA1 - rtems_message_queue_broadcast - NO BUFFER TO Q1" ); status = rtems_message_queue_broadcast( Queue_id[ 1 ], - (long (*)[4])buffer, + (long ( * )[ 4 ]) buffer, 16, &count ); @@ -262,7 +253,9 @@ rtems_task Task_1( puts( "TA1 - rtems_message_queue_send until all message buffers consumed" ); while ( FOREVER ) { status = rtems_message_queue_send( Queue_id[ 3 ], buffer, MESSAGE_SIZE ); - if ( status == RTEMS_TOO_MANY ) break; + if ( status == RTEMS_TOO_MANY ) { + break; + } directive_failed( status, "rtems_message_queue_send loop" ); } @@ -279,10 +272,14 @@ rtems_task Task_1( RTEMS_DEFAULT_ATTRIBUTES, &Queue_id[ 1 ] ); - directive_failed( status, "rtems_message_queue_create of Q1; 20 bytes each" ); + directive_failed( + status, + "rtems_message_queue_create of Q1; 20 bytes each" + ); status = rtems_message_queue_send( Queue_id[ 1 ], big_send_buffer, 40 ); - fatal_directive_status(status, + fatal_directive_status( + status, RTEMS_INVALID_SIZE, "expected RTEMS_INVALID_SIZE" ); @@ -292,16 +289,16 @@ rtems_task Task_1( directive_failed( status, "rtems_message_queue_delete" ); puts( "TA1 - rtems_message_queue_create - variable sizes " ); - for (queue_size = 1; queue_size < 1030; queue_size++) { + for ( queue_size = 1; queue_size < 1030; queue_size++ ) { status = rtems_message_queue_create( Queue_name[ 1 ], - 2, /* just 2 msgs each */ + 2, /* just 2 msgs each */ queue_size, RTEMS_DEFAULT_ATTRIBUTES, &Queue_id[ 1 ] ); - if (status != RTEMS_SUCCESSFUL) { - printf("TA1 - msq que size: %zu\n", queue_size); + if ( status != RTEMS_SUCCESSFUL ) { + printf( "TA1 - msq que size: %zu\n", queue_size ); directive_failed( status, "rtems_message_queue_create of Q1" ); } @@ -310,18 +307,18 @@ rtems_task Task_1( } puts( "TA1 - rtems_message_queue_create and send - variable sizes " ); - for (queue_size = 1; queue_size < 1030; queue_size++) { + for ( queue_size = 1; queue_size < 1030; queue_size++ ) { status = rtems_message_queue_create( Queue_name[ 1 ], - 2, /* just 2 msgs each */ + 2, /* just 2 msgs each */ queue_size, RTEMS_DEFAULT_ATTRIBUTES, &Queue_id[ 1 ] ); directive_failed( status, "rtems_message_queue_create of Q1" ); - dope_buffer(big_send_buffer, sizeof(big_send_buffer), queue_size); - memset(big_receive_buffer, 'Z', sizeof(big_receive_buffer)); + dope_buffer( big_send_buffer, sizeof( big_send_buffer ), queue_size ); + memset( big_receive_buffer, 'Z', sizeof( big_receive_buffer ) ); /* send a msg too big */ status = rtems_message_queue_send( @@ -339,8 +336,9 @@ rtems_task Task_1( status = rtems_message_queue_send( Queue_id[ 1 ], big_send_buffer, - queue_size); - directive_failed(status, "rtems_message_queue_send exact size"); + queue_size + ); + directive_failed( status, "rtems_message_queue_send exact size" ); /* now read and verify the message just sent */ status = rtems_message_queue_receive( @@ -350,29 +348,31 @@ rtems_task Task_1( RTEMS_DEFAULT_OPTIONS, 1 * rtems_clock_get_ticks_per_second() ); - directive_failed(status, "rtems_message_queue_receive exact size"); - if (size != queue_size) { - puts("TA1 - exact size size match failed"); - rtems_test_exit(1); + directive_failed( status, "rtems_message_queue_receive exact size" ); + if ( size != queue_size ) { + puts( "TA1 - exact size size match failed" ); + rtems_test_exit( 1 ); } - if (memcmp(big_send_buffer, big_receive_buffer, size) != 0) { - puts("TA1 - exact size data match failed"); - rtems_test_exit(1); + if ( memcmp( big_send_buffer, big_receive_buffer, size ) != 0 ) { + puts( "TA1 - exact size data match failed" ); + rtems_test_exit( 1 ); } - for (cp = (big_receive_buffer + size); - cp < (big_receive_buffer + sizeof(big_receive_buffer)); - cp++) { - if (*cp != 'Z') { - puts("TA1 - exact size overrun match failed"); - rtems_test_exit(1); - } - } + for ( + cp = ( big_receive_buffer + size ); + cp < ( big_receive_buffer + sizeof( big_receive_buffer ) ); + cp++ + ) { + if ( *cp != 'Z' ) { + puts( "TA1 - exact size overrun match failed" ); + rtems_test_exit( 1 ); + } + } - /* all done with this one; delete it */ - status = rtems_message_queue_delete( Queue_id[ 1 ] ); - directive_failed( status, "rtems_message_queue_delete" ); + /* all done with this one; delete it */ + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); } TEST_END(); diff --git a/testsuites/sptests/sp13/task2.c b/testsuites/sptests/sp13/task2.c index f1579ffd5e..ca8b174f72 100644 --- a/testsuites/sptests/sp13/task2.c +++ b/testsuites/sptests/sp13/task2.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; @@ -69,7 +67,7 @@ rtems_task Task_2( puts( "TA2 - rtems_message_queue_receive - receive from queue 1 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 1 ], @@ -85,8 +83,8 @@ rtems_task Task_2( puts( "TA2 - rtems_message_queue_receive - receive from queue 1 - " - "RTEMS_WAIT FOREVER" - ); + "RTEMS_WAIT FOREVER" + ); status = rtems_message_queue_receive( Queue_id[ 1 ], buffer, @@ -105,7 +103,7 @@ rtems_task Task_2( puts( "TA2 - rtems_message_queue_receive - receive from queue 2 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 2 ], @@ -119,14 +117,14 @@ rtems_task Task_2( Put_buffer( buffer ); new_line; - Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer ); + Fill_buffer( "BUFFER 2 TO Q 2", (long *) buffer ); puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" ); status = rtems_message_queue_send( Queue_id[ 2 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send" ); puts( "TA2 - rtems_message_queue_receive - receive from queue 1 - " - "10 second timeout" + "10 second timeout" ); status = rtems_message_queue_receive( Queue_id[ 1 ], @@ -142,7 +140,7 @@ rtems_task Task_2( puts( "TA2 - rtems_message_queue_receive - receive from queue 3 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 3 ], @@ -155,5 +153,4 @@ rtems_task Task_2( puts_nocr( "TA2 - buffer received: " ); Put_buffer( buffer ); new_line; - } diff --git a/testsuites/sptests/sp13/task3.c b/testsuites/sptests/sp13/task3.c index 73e1018d54..02c9f9a686 100644 --- a/testsuites/sptests/sp13/task3.c +++ b/testsuites/sptests/sp13/task3.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; @@ -54,11 +52,11 @@ rtems_task Task_3( puts( "TA3 - rtems_message_queue_receive - receive from queue 2 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 2 ], - (long (*)[4])buffer, + (long ( * )[ 4 ]) buffer, &size, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT @@ -68,23 +66,23 @@ rtems_task Task_3( Put_buffer( buffer ); new_line; - Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer ); + Fill_buffer( "BUFFER 3 TO Q 1", (long *) buffer ); puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" ); status = rtems_message_queue_broadcast( Queue_id[ 1 ], - (long (*)[4])buffer, + (long ( * )[ 4 ]) buffer, 16, &count ); printf( "TA3 - number of tasks awakened = %02" PRIu32 "\n", count ); puts( "TA3 - rtems_message_queue_receive - receive from queue 3 - " - "RTEMS_WAIT FOREVER" + "RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 3 ], - (long (*)[4])buffer, + (long ( * )[ 4 ]) buffer, &size, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT diff --git a/testsuites/sptests/sp14/asr.c b/testsuites/sptests/sp14/asr.c index 9a1c82f04e..86354ebc91 100644 --- a/testsuites/sptests/sp14/asr.c +++ b/testsuites/sptests/sp14/asr.c @@ -33,17 +33,15 @@ #include "system.h" #include "tmacros.h" -rtems_asr Process_asr( - rtems_signal_set the_signal_set -) +rtems_asr Process_asr( rtems_signal_set the_signal_set ) { rtems_status_code status; printf( "ASR - ENTRY - signal => %08" PRIxrtems_signal_set "\n", - the_signal_set + the_signal_set ); - switch( the_signal_set ) { + switch ( the_signal_set ) { case RTEMS_SIGNAL_16: case RTEMS_SIGNAL_17: case RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19: @@ -60,6 +58,6 @@ rtems_asr Process_asr( } printf( "ASR - EXIT - signal => %08" PRIxrtems_signal_set "\n", - the_signal_set + the_signal_set ); } diff --git a/testsuites/sptests/sp14/init.c b/testsuites/sptests/sp14/init.c index 7d50023136..3bb9fac1a8 100644 --- a/testsuites/sptests/sp14/init.c +++ b/testsuites/sptests/sp14/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 14"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,8 +55,8 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); status = rtems_task_create( Task_name[ 1 ], diff --git a/testsuites/sptests/sp14/system.h b/testsuites/sptests/sp14/system.h index 307fc8e5c3..1711d11af1 100644 --- a/testsuites/sptests/sp14/system.h +++ b/testsuites/sptests/sp14/system.h @@ -34,64 +34,53 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_timer_service_routine Signal_3_to_task_1( - rtems_id id, - void *pointer -); +rtems_timer_service_routine Signal_3_to_task_1( rtems_id id, void *pointer ); -rtems_asr Process_asr( - rtems_signal_set the_signal_set -); +rtems_asr Process_asr( rtems_signal_set the_signal_set ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */ -TEST_EXTERN volatile uint32_t Signals_sent; - /* set to TRUE to indicate that a */ - /* signal set has been sent from */ - /* an ISR to the executing task */ +TEST_EXTERN volatile uint32_t Signals_sent; +/* set to TRUE to indicate that a */ +/* signal set has been sent from */ +/* an ISR to the executing task */ -TEST_EXTERN volatile uint32_t Asr_fired; - /* set to TRUE to indicate that the */ - /* RTEMS_ASR has executed and was */ - /* passed the correct signal set */ +TEST_EXTERN volatile uint32_t Asr_fired; +/* set to TRUE to indicate that the */ +/* RTEMS_ASR has executed and was */ +/* passed the correct signal set */ -TEST_EXTERN volatile rtems_id Timer_got_this_id; +TEST_EXTERN volatile rtems_id Timer_got_this_id; -TEST_EXTERN volatile void *Timer_got_this_pointer; +TEST_EXTERN volatile void *Timer_got_this_pointer; /* end of include file */ diff --git a/testsuites/sptests/sp14/task1.c b/testsuites/sptests/sp14/task1.c index 3d92a9e726..81b11ef1da 100644 --- a/testsuites/sptests/sp14/task1.c +++ b/testsuites/sptests/sp14/task1.c @@ -32,37 +32,32 @@ #include "system.h" -rtems_timer_service_routine Signal_3_to_task_1( - rtems_id id, - void *pointer -) +rtems_timer_service_routine Signal_3_to_task_1( rtems_id id, void *pointer ) { rtems_status_code status; status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 ); directive_failed_with_level( status, "rtems_signal_send of 3", 1 ); - Timer_got_this_id = id; + Timer_got_this_id = id; Timer_got_this_pointer = pointer; Signals_sent = TRUE; } -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; rtems_mode previous_mode; rtems_status_code status; -#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE +#if defined( RTEMS_SMP ) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 0 )" ); - status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(0) ); + status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL( 0 ) ); #else puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" ); - status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) ); + status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL( 3 ) ); #endif directive_failed( status, "rtems_signal_catch" ); @@ -101,29 +96,30 @@ rtems_task Task_1( puts( "TA1 - waiting for signal to arrive" ); Signals_sent = FALSE; - Asr_fired = FALSE; + Asr_fired = FALSE; - while ( Signals_sent == FALSE ) - ; + while ( Signals_sent == FALSE ); - if ( Timer_got_this_id == Timer_id[ 1 ] && - Timer_got_this_pointer == Task_1 ) + if ( + Timer_got_this_id == Timer_id[ 1 ] && Timer_got_this_pointer == Task_1 + ) { puts( "TA1 - timer routine got the correct arguments" ); - else + } else { printf( - "TA1 - timer got (0x%" PRIxrtems_id ", %p) instead of (0x%" - PRIxrtems_id ", %p)!!!!\n", + "TA1 - timer got (0x%" PRIxrtems_id ", %p) instead of (0x%" PRIxrtems_id + ", %p)!!!!\n", Timer_got_this_id, Timer_got_this_pointer, Timer_id[ 1 ], Task_1 ); + } puts( "TA1 - rtems_task_mode - enable ASRs" ); status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); - status = rtems_task_wake_after(2 * rtems_clock_get_ticks_per_second()); + status = rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - rtems_signal_catch - asraddr of NULL" ); diff --git a/testsuites/sptests/sp14/task2.c b/testsuites/sptests/sp14/task2.c index dbbd53bbe0..bbc109eb36 100644 --- a/testsuites/sptests/sp14/task2.c +++ b/testsuites/sptests/sp14/task2.c @@ -41,15 +41,13 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; rtems_status_code status; - status = rtems_task_wake_after(rtems_clock_get_ticks_per_second()); + status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1" ); @@ -60,15 +58,20 @@ rtems_task Task_2( status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); - puts("TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1"); - status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 ); + puts( + "TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1" + ); + status = rtems_signal_send( + Task_id[ 1 ], + RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 + ); directive_failed( status, "rtems_signal_send" ); puts( "TA2 - rtems_task_wake_after - yield processor" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); - status = rtems_task_wake_after(2 * rtems_clock_get_ticks_per_second()); + status = rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); TEST_END(); diff --git a/testsuites/sptests/sp15/init.c b/testsuites/sptests/sp15/init.c index a59f9bbe56..27c0f7df74 100644 --- a/testsuites/sptests/sp15/init.c +++ b/testsuites/sptests/sp15/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 15"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,10 +55,10 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); - Partition_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); + Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + Partition_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); status = rtems_task_create( Task_name[ 1 ], @@ -75,7 +73,7 @@ rtems_task Init( status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); directive_failed( status, "rtems_task_start of TA1" ); - puts("INIT - rtems_partition_create - partition 1"); + puts( "INIT - rtems_partition_create - partition 1" ); status = rtems_partition_create( Partition_name[ 1 ], Area_1, @@ -86,7 +84,7 @@ rtems_task Init( ); directive_failed( status, "rtems_partition_create of PT1" ); - puts("INIT - rtems_partition_create - partition 2"); + puts( "INIT - rtems_partition_create - partition 2" ); status = rtems_partition_create( Partition_name[ 2 ], Area_2, diff --git a/testsuites/sptests/sp15/system.h b/testsuites/sptests/sp15/system.h index 0af8fa486b..b5ae575623 100644 --- a/testsuites/sptests/sp15/system.h +++ b/testsuites/sptests/sp15/system.h @@ -34,22 +34,18 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_PARTITIONS 2 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_PARTITIONS 2 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -59,21 +55,25 @@ rtems_task Task_1( /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ TEST_EXTERN rtems_id Partition_id[ 4 ]; /* array of partition ids */ TEST_EXTERN rtems_name Partition_name[ 4 ]; /* array of partition names */ -TEST_EXTERN uint8_t Area_1[4096] CPU_STRUCTURE_ALIGNMENT; -TEST_EXTERN uint8_t Area_2[274] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_1[ 4096 ] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_2[ 274 ] CPU_STRUCTURE_ALIGNMENT; -#define Put_address_from_area_1( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long)((uint8_t *)(_to_be_printed) - Area_1 ) ) +#define Put_address_from_area_1( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_1 ) \ + ) -#define Put_address_from_area_2( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long)((uint8_t *)(_to_be_printed) - Area_2 ) ) +#define Put_address_from_area_2( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_2 ) \ + ) /* end of include file */ diff --git a/testsuites/sptests/sp15/task1.c b/testsuites/sptests/sp15/task1.c index f712b94a45..e44b59e428 100644 --- a/testsuites/sptests/sp15/task1.c +++ b/testsuites/sptests/sp15/task1.c @@ -40,19 +40,17 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; - rtems_id ptid_1; - rtems_id ptid_2; - void *buffer_address_1; - void *buffer_address_2; - void *buffer_address_3; - void *buffer_address_4; - rtems_status_code status; + rtems_id ptid_1; + rtems_id ptid_2; + void *buffer_address_1; + void *buffer_address_2; + void *buffer_address_3; + void *buffer_address_4; + rtems_status_code status; puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " ); status = rtems_partition_ident( @@ -136,13 +134,11 @@ rtems_task Task_1( status = rtems_partition_return_buffer( ptid_2, buffer_address_4 ); directive_failed( status, "rtems_partition_return_buffer" ); - puts( "TA1 - rtems_partition_delete - delete partition 1" - ); + puts( "TA1 - rtems_partition_delete - delete partition 1" ); status = rtems_partition_delete( ptid_1 ); directive_failed( status, "rtems_partition_delete" ); - puts( "TA1 - rtems_partition_delete - delete partition 2" - ); + puts( "TA1 - rtems_partition_delete - delete partition 2" ); status = rtems_partition_delete( ptid_2 ); directive_failed( status, "rtems_partition_delete" ); diff --git a/testsuites/sptests/sp16/init.c b/testsuites/sptests/sp16/init.c index ac9005ab5e..3981a3f595 100644 --- a/testsuites/sptests/sp16/init.c +++ b/testsuites/sptests/sp16/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 16"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,11 +55,11 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); status = rtems_task_create( Task_name[ 1 ], diff --git a/testsuites/sptests/sp16/system.h b/testsuites/sptests/sp16/system.h index 51f6aae008..bca12b675e 100644 --- a/testsuites/sptests/sp16/system.h +++ b/testsuites/sptests/sp16/system.h @@ -34,75 +34,71 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); -rtems_task Task_4( - rtems_task_argument argument -); +rtems_task Task_4( rtems_task_argument argument ); -rtems_task Task5( - rtems_task_argument argument -); +rtems_task Task5( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 -#define CONFIGURE_MAXIMUM_REGIONS 4 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_REGIONS 4 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ -TEST_EXTERN rtems_id Region_id[ 5 ]; /* array of region ids */ -TEST_EXTERN rtems_name Region_name[ 5 ]; /* array of region names */ +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Region_id[ 5 ]; /* array of region ids */ +TEST_EXTERN rtems_name Region_name[ 5 ]; /* array of region names */ -TEST_EXTERN uint8_t Area_1[4096] CPU_STRUCTURE_ALIGNMENT; -TEST_EXTERN uint8_t Area_2[4096] CPU_STRUCTURE_ALIGNMENT; -TEST_EXTERN uint8_t Area_3[4096] CPU_STRUCTURE_ALIGNMENT; -TEST_EXTERN uint8_t Area_4[8192] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_1[ 4096 ] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_2[ 4096 ] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_3[ 4096 ] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_4[ 8192 ] CPU_STRUCTURE_ALIGNMENT; -#define BASE_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2u) + 1u) +#define BASE_PRIORITY ( ( RTEMS_MAXIMUM_PRIORITY / 2u ) + 1u ) -#define Put_address_from_area_1( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long) ((uint8_t *)(_to_be_printed) - Area_1 ) ) +#define Put_address_from_area_1( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_1 ) \ + ) -#define Put_address_from_area_2( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long) ((uint8_t *)(_to_be_printed) - Area_2 ) ) +#define Put_address_from_area_2( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_2 ) \ + ) -#define Put_address_from_area_3( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long) ((uint8_t *)(_to_be_printed) - Area_3 ) ) +#define Put_address_from_area_3( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_3 ) \ + ) -#define Put_address_from_area_4( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long) ((uint8_t *)(_to_be_printed) - Area_4 ) ) +#define Put_address_from_area_4( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_4 ) \ + ) /* end of include file */ diff --git a/testsuites/sptests/sp16/task1.c b/testsuites/sptests/sp16/task1.c index 9d8fea666d..f22462d081 100644 --- a/testsuites/sptests/sp16/task1.c +++ b/testsuites/sptests/sp16/task1.c @@ -40,18 +40,16 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; - rtems_id rnid; - void *segment_address_1; - void *segment_address_2; - void *segment_address_3; - void *segment_address_4; - rtems_status_code status; + rtems_id rnid; + void *segment_address_1; + void *segment_address_2; + void *segment_address_3; + void *segment_address_4; + rtems_status_code status; status = rtems_region_ident( Region_name[ 1 ], &rnid ); printf( "TA1 - rtems_region_ident - rnid => %08" PRIxrtems_id "\n", rnid ); @@ -86,7 +84,7 @@ rtems_task Task_1( new_line; puts_nocr( "TA1 - rtems_region_get_segment - get 3080 byte segment " ); - puts ( "from region 1 - NO_WAIT" ); + puts( "from region 1 - NO_WAIT" ); status = rtems_region_get_segment( Region_id[ 1 ], 3080, @@ -113,7 +111,7 @@ rtems_task Task_1( puts( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " - "segment from region 1" + "segment from region 1" ); status = rtems_region_get_segment( Region_id[ 1 ], @@ -186,7 +184,7 @@ rtems_task Task_1( directive_failed( status, "rtems_task_wake_after" ); puts_nocr( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " ); - puts ( "segment from region 1"); + puts( "segment from region 1" ); status = rtems_region_get_segment( Region_id[ 1 ], 3072, @@ -236,9 +234,9 @@ rtems_task Task_1( new_line; puts( - "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" + "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" ); - status = rtems_region_get_segment( + status = rtems_region_get_segment( Region_id[ 4 ], 3072, RTEMS_NO_WAIT, @@ -253,11 +251,7 @@ rtems_task Task_1( puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" ); puts( "TA1 - rtems_region_extend - extend region 4 by 1" ); - status = rtems_region_extend( - Region_id[ 4 ], - &Area_4[4096], - 1 - ); + status = rtems_region_extend( Region_id[ 4 ], &Area_4[ 4096 ], 1 ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -268,13 +262,13 @@ rtems_task Task_1( puts( "TA1 - rtems_region_extend - extend region 4 by 4K - 1" ); status = rtems_region_extend( Region_id[ 4 ], - (char *) &Area_4[4096] + 1, + (char *) &Area_4[ 4096 ] + 1, 4096 - 1 ); directive_failed( status, "rtems_region_extend" ); puts( - "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" + "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" ); status = rtems_region_get_segment( Region_id[ 4 ], diff --git a/testsuites/sptests/sp16/task2.c b/testsuites/sptests/sp16/task2.c index fb2a5ccb42..b4884e1f9a 100644 --- a/testsuites/sptests/sp16/task2.c +++ b/testsuites/sptests/sp16/task2.c @@ -41,16 +41,14 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_task_priority previous_priority; - void *segment_address_1; - void *segment_address_2; + rtems_status_code status; + rtems_task_priority previous_priority; + void *segment_address_1; + void *segment_address_2; puts( "TA2 - rtems_region_get_segment - wait on 2K segment from region 1" ); status = rtems_region_get_segment( @@ -76,12 +74,12 @@ rtems_task Task_2( puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); status = rtems_task_set_priority( RTEMS_SELF, - BASE_PRIORITY-1, + BASE_PRIORITY - 1, &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); - puts("TA2 - rtems_region_get_segment - wait on 3750 byte segment"); + puts( "TA2 - rtems_region_get_segment - wait on 3750 byte segment" ); status = rtems_region_get_segment( Region_id[ 2 ], 3750, @@ -90,7 +88,7 @@ rtems_task Task_2( &segment_address_2 ); directive_failed( status, "rtems_region_get_segment" ); - puts_nocr( "TA2 - got segment from region 2 - "); + puts_nocr( "TA2 - got segment from region 2 - " ); Put_address_from_area_2( segment_address_2 ); new_line; diff --git a/testsuites/sptests/sp16/task3.c b/testsuites/sptests/sp16/task3.c index 3fa4c816c3..9d460690c7 100644 --- a/testsuites/sptests/sp16/task3.c +++ b/testsuites/sptests/sp16/task3.c @@ -41,15 +41,13 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - void *segment_address_1; - void *segment_address_2; + rtems_status_code status; + void *segment_address_1; + void *segment_address_2; puts( "TA3 - rtems_region_get_segment - wait on 3750 byte segment from region 2" diff --git a/testsuites/sptests/sp16/task4.c b/testsuites/sptests/sp16/task4.c index be1ecf8dac..1d50e57ca7 100644 --- a/testsuites/sptests/sp16/task4.c +++ b/testsuites/sptests/sp16/task4.c @@ -41,17 +41,17 @@ #include "system.h" -rtems_task Task_4( - rtems_task_argument argument -) +rtems_task Task_4( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - void *segment_address_1; - void *segment_address_2; + rtems_status_code status; + void *segment_address_1; + void *segment_address_2; - puts( "TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); + puts( + "TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1" + ); status = rtems_region_get_segment( Region_id[ 1 ], 1536, diff --git a/testsuites/sptests/sp16/task5.c b/testsuites/sptests/sp16/task5.c index ab780de488..1468c5f0e5 100644 --- a/testsuites/sptests/sp16/task5.c +++ b/testsuites/sptests/sp16/task5.c @@ -41,17 +41,17 @@ #include "system.h" -rtems_task Task5( - rtems_task_argument argument -) +rtems_task Task5( rtems_task_argument argument ) { (void) argument; - void *segment_address_1; - void *segment_address_2; - rtems_status_code status; + void *segment_address_1; + void *segment_address_2; + rtems_status_code status; - puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); + puts( + "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" + ); status = rtems_region_get_segment( Region_id[ 1 ], 1536, diff --git a/testsuites/sptests/sp17/asr.c b/testsuites/sptests/sp17/asr.c index 48bc5521bd..97e9c0577c 100644 --- a/testsuites/sptests/sp17/asr.c +++ b/testsuites/sptests/sp17/asr.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_asr Process_asr( - rtems_signal_set signal_set -) +rtems_asr Process_asr( rtems_signal_set signal_set ) { (void) signal_set; diff --git a/testsuites/sptests/sp17/init.c b/testsuites/sptests/sp17/init.c index 38e71d4231..6ce1485bcf 100644 --- a/testsuites/sptests/sp17/init.c +++ b/testsuites/sptests/sp17/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 17"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,8 +55,8 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); Task_2_preempted = FALSE; diff --git a/testsuites/sptests/sp17/system.h b/testsuites/sptests/sp17/system.h index 0f78218560..e5e9b3f7b1 100644 --- a/testsuites/sptests/sp17/system.h +++ b/testsuites/sptests/sp17/system.h @@ -34,30 +34,23 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_asr Process_asr( - rtems_signal_set signal_set -); +rtems_asr Process_asr( rtems_signal_set signal_set ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MICROSECONDS_PER_TICK RTEMS_MILLISECONDS_TO_MICROSECONDS(25) -#define CONFIGURE_TICKS_PER_TIMESLICE 1000 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MICROSECONDS_PER_TICK \ + RTEMS_MILLISECONDS_TO_MICROSECONDS( 25 ) +#define CONFIGURE_TICKS_PER_TIMESLICE 1000 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -67,9 +60,9 @@ rtems_task Task_2( /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN uint32_t Task_2_preempted; +TEST_EXTERN uint32_t Task_2_preempted; /* end of include file */ diff --git a/testsuites/sptests/sp17/task1.c b/testsuites/sptests/sp17/task1.c index 2a04ddda47..41b1c3f230 100644 --- a/testsuites/sptests/sp17/task1.c +++ b/testsuites/sptests/sp17/task1.c @@ -44,9 +44,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -60,10 +58,11 @@ rtems_task Task_1( status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_16 ); directive_failed( status, "rtems_signal_send" ); - if ( Task_2_preempted == TRUE ) + if ( Task_2_preempted == TRUE ) { puts( "TA1 - TA2 correctly preempted me" ); + } - puts("TA1 - Got Back!!!"); + puts( "TA1 - Got Back!!!" ); TEST_END(); rtems_test_exit( 0 ); diff --git a/testsuites/sptests/sp17/task2.c b/testsuites/sptests/sp17/task2.c index 74fbd49b83..620466ec75 100644 --- a/testsuites/sptests/sp17/task2.c +++ b/testsuites/sptests/sp17/task2.c @@ -44,9 +44,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp18/init.c b/testsuites/sptests/sp18/init.c index 3c9ae2a155..73ef2c2719 100644 --- a/testsuites/sptests/sp18/init.c +++ b/testsuites/sptests/sp18/init.c @@ -37,11 +37,9 @@ const char rtems_test_name[] = "SP 18"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -61,8 +59,7 @@ rtems_task Init( ++stack_size; puts( "Init - rtems_task_create - Unsatisfied on Extensions" ); - while (1) { - + while ( 1 ) { sc = rtems_task_create( rtems_build_name( 'T', 'E', 'S', 'T' ), 1, @@ -72,8 +69,9 @@ rtems_task Init( &task_id ); - if ( sc == RTEMS_SUCCESSFUL ) + if ( sc == RTEMS_SUCCESSFUL ) { break; + } fatal_directive_status( sc, RTEMS_UNSATISFIED, "rtems_task_create" ); @@ -84,12 +82,14 @@ rtems_task Init( rtems_test_assert( ok ); stack_size -= 8; - if ( stack_size <= RTEMS_MINIMUM_STACK_SIZE ) - break; + if ( stack_size <= RTEMS_MINIMUM_STACK_SIZE ) { + break; + } } - if ( sc != RTEMS_SUCCESSFUL ) - rtems_test_exit(0); + if ( sc != RTEMS_SUCCESSFUL ) { + rtems_test_exit( 0 ); + } /* * Verify heap is still in same shape after we free the task @@ -105,7 +105,7 @@ rtems_task Init( rtems_workspace_greedy_free( greedy ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -113,9 +113,9 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 20 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 20 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp19/first.c b/testsuites/sptests/sp19/first.c index f602c927e4..ca486ae419 100644 --- a/testsuites/sptests/sp19/first.c +++ b/testsuites/sptests/sp19/first.c @@ -34,14 +34,12 @@ #include "fptest.h" #include "inttest.h" -rtems_task First_FP_task( - rtems_task_argument argument -) +rtems_task First_FP_task( rtems_task_argument argument ) { rtems_status_code status; rtems_id tid; rtems_time_of_day time; - uint32_t task_index; + uint32_t task_index; INTEGER_DECLARE; FP_DECLARE; @@ -60,9 +58,9 @@ rtems_task First_FP_task( ); put_name( Task_name[ task_index ], FALSE ); #if ( RTEMS_HAS_HARDWARE_FP == 1 ) - printf( " - float base = (%g)\n", FP_factors[ task_index ] ); + printf( " - float base = (%g)\n", FP_factors[ task_index ] ); #else - printf( " - float base = (NA)\n" ); + printf( " - float base = (NA)\n" ); #endif if ( argument == 0 ) { diff --git a/testsuites/sptests/sp19/fptask.c b/testsuites/sptests/sp19/fptask.c index 635a2190ff..825bb93fdf 100644 --- a/testsuites/sptests/sp19/fptask.c +++ b/testsuites/sptests/sp19/fptask.c @@ -34,9 +34,7 @@ #include "fptest.h" #include "inttest.h" -rtems_task FP_task( - rtems_task_argument argument -) +rtems_task FP_task( rtems_task_argument argument ) { (void) argument; @@ -64,10 +62,9 @@ rtems_task FP_task( put_name( Task_name[ task_index ], FALSE ); printf( " - float base = (%g)\n", FP_factors[ task_index ] ); - previous_seconds = (uint32_t)-1; - - while( FOREVER ) { + previous_seconds = (uint32_t) -1; + while ( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); @@ -84,7 +81,7 @@ rtems_task FP_task( rtems_test_exit( 0 ); } - if (previous_seconds != time.second) { + if ( previous_seconds != time.second ) { put_name( Task_name[ task_index ], FALSE ); print_time( " - rtems_clock_get_tod - ", &time, "\n" ); previous_seconds = time.second; @@ -97,7 +94,7 @@ rtems_task FP_task( * so that we likely are interrupted * After that, we go to sleep for a second at a time */ - if (time.second >= 4) { + if ( time.second >= 4 ) { status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); } diff --git a/testsuites/sptests/sp19/fptest.h b/testsuites/sptests/sp19/fptest.h index c9dd5351ac..1a06b1393e 100644 --- a/testsuites/sptests/sp19/fptest.h +++ b/testsuites/sptests/sp19/fptest.h @@ -43,127 +43,129 @@ * POSSIBILITY OF SUCH DAMAGE. */ - #ifndef __FPTEST_h #define __FPTEST_h #include -#define FP_DECLARE \ - double fp01 = 1.0; \ - double fp02 = 2.0; \ - double fp03 = 3.0; \ - double fp04 = 4.0; \ - double fp05 = 5.0; \ - double fp06 = 6.0; \ - double fp07 = 7.0; \ - double fp08 = 8.0; \ - double fp09 = 9.0; \ - double fp10 = 10.0; \ - double fp11 = 11.0; \ - double fp12 = 12.0; \ - double fp13 = 13.0; \ - double fp14 = 14.0; \ - double fp15 = 15.0; \ - double fp16 = 16.0; \ - double fp17 = 17.0; \ - double fp18 = 18.0; \ - double fp19 = 19.0; \ - double fp20 = 20.0; \ - double fp21 = 21.0; \ - double fp22 = 22.0; \ - double fp23 = 23.0; \ - double fp24 = 24.0; \ - double fp25 = 25.0; \ - double fp26 = 26.0; \ - double fp27 = 27.0; \ - double fp28 = 28.0; \ - double fp29 = 29.0; \ - double fp30 = 30.0; \ - double fp31 = 31.0; \ - double fp32 = 32.0 +#define FP_DECLARE \ + double fp01 = 1.0; \ + double fp02 = 2.0; \ + double fp03 = 3.0; \ + double fp04 = 4.0; \ + double fp05 = 5.0; \ + double fp06 = 6.0; \ + double fp07 = 7.0; \ + double fp08 = 8.0; \ + double fp09 = 9.0; \ + double fp10 = 10.0; \ + double fp11 = 11.0; \ + double fp12 = 12.0; \ + double fp13 = 13.0; \ + double fp14 = 14.0; \ + double fp15 = 15.0; \ + double fp16 = 16.0; \ + double fp17 = 17.0; \ + double fp18 = 18.0; \ + double fp19 = 19.0; \ + double fp20 = 20.0; \ + double fp21 = 21.0; \ + double fp22 = 22.0; \ + double fp23 = 23.0; \ + double fp24 = 24.0; \ + double fp25 = 25.0; \ + double fp26 = 26.0; \ + double fp27 = 27.0; \ + double fp28 = 28.0; \ + double fp29 = 29.0; \ + double fp30 = 30.0; \ + double fp31 = 31.0; \ + double fp32 = 32.0 #define FP_LOAD( _factor ) \ - do { \ - fp01 += _factor; \ - fp02 += _factor; \ - fp03 += _factor; \ - fp04 += _factor; \ - fp05 += _factor; \ - fp06 += _factor; \ - fp07 += _factor; \ - fp08 += _factor; \ - fp09 += _factor; \ - fp10 += _factor; \ - fp11 += _factor; \ - fp12 += _factor; \ - fp13 += _factor; \ - fp14 += _factor; \ - fp15 += _factor; \ - fp16 += _factor; \ - fp17 += _factor; \ - fp18 += _factor; \ - fp19 += _factor; \ - fp20 += _factor; \ - fp21 += _factor; \ - fp22 += _factor; \ - fp23 += _factor; \ - fp24 += _factor; \ - fp25 += _factor; \ - fp26 += _factor; \ - fp27 += _factor; \ - fp28 += _factor; \ - fp29 += _factor; \ - fp30 += _factor; \ - fp31 += _factor; \ - fp32 += _factor; \ - } while (0) + do { \ + fp01 += _factor; \ + fp02 += _factor; \ + fp03 += _factor; \ + fp04 += _factor; \ + fp05 += _factor; \ + fp06 += _factor; \ + fp07 += _factor; \ + fp08 += _factor; \ + fp09 += _factor; \ + fp10 += _factor; \ + fp11 += _factor; \ + fp12 += _factor; \ + fp13 += _factor; \ + fp14 += _factor; \ + fp15 += _factor; \ + fp16 += _factor; \ + fp17 += _factor; \ + fp18 += _factor; \ + fp19 += _factor; \ + fp20 += _factor; \ + fp21 += _factor; \ + fp22 += _factor; \ + fp23 += _factor; \ + fp24 += _factor; \ + fp25 += _factor; \ + fp26 += _factor; \ + fp27 += _factor; \ + fp28 += _factor; \ + fp29 += _factor; \ + fp30 += _factor; \ + fp31 += _factor; \ + fp32 += _factor; \ + } while ( 0 ) -#define EPSILON (0.0005) -#define FPABS(d) (((d) < 0.0) ? -(d) : (d)) -#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON) +#define EPSILON ( 0.0005 ) +#define FPABS( d ) ( ( ( d ) < 0.0 ) ? -( d ) : ( d ) ) +#define FPNEQ( a, b ) ( FPABS( ( a ) - ( b ) ) > EPSILON ) -#define FP_CHECK_ONE( _v, _base, _factor ) \ - if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \ - printf("%" PRIu32 ": " #_v " wrong -- (%g not %g)\n", \ - task_index, (_v), (_base + _factor)); \ - } +#define FP_CHECK_ONE( _v, _base, _factor ) \ + if ( FPNEQ( ( _v ), ( ( _base ) + ( _factor ) ) ) ) { \ + printf( \ + "%" PRIu32 ": " #_v " wrong -- (%g not %g)\n", \ + task_index, \ + ( _v ), \ + ( _base + _factor ) \ + ); \ + } - -#define FP_CHECK( _factor ) \ - do { \ - FP_CHECK_ONE( fp01, 1.0, (_factor) ); \ - FP_CHECK_ONE( fp02, 2.0, (_factor) ); \ - FP_CHECK_ONE( fp03, 3.0, (_factor) ); \ - FP_CHECK_ONE( fp04, 4.0, (_factor) ); \ - FP_CHECK_ONE( fp05, 5.0, (_factor) ); \ - FP_CHECK_ONE( fp06, 6.0, (_factor) ); \ - FP_CHECK_ONE( fp07, 7.0, (_factor) ); \ - FP_CHECK_ONE( fp08, 8.0, (_factor) ); \ - FP_CHECK_ONE( fp09, 9.0, (_factor) ); \ - FP_CHECK_ONE( fp10, 10.0, (_factor) ); \ - FP_CHECK_ONE( fp11, 11.0, (_factor) ); \ - FP_CHECK_ONE( fp12, 12.0, (_factor) ); \ - FP_CHECK_ONE( fp13, 13.0, (_factor) ); \ - FP_CHECK_ONE( fp14, 14.0, (_factor) ); \ - FP_CHECK_ONE( fp15, 15.0, (_factor) ); \ - FP_CHECK_ONE( fp16, 16.0, (_factor) ); \ - FP_CHECK_ONE( fp17, 17.0, (_factor) ); \ - FP_CHECK_ONE( fp18, 18.0, (_factor) ); \ - FP_CHECK_ONE( fp19, 19.0, (_factor) ); \ - FP_CHECK_ONE( fp20, 20.0, (_factor) ); \ - FP_CHECK_ONE( fp21, 21.0, (_factor) ); \ - FP_CHECK_ONE( fp22, 22.0, (_factor) ); \ - FP_CHECK_ONE( fp23, 23.0, (_factor) ); \ - FP_CHECK_ONE( fp24, 24.0, (_factor) ); \ - FP_CHECK_ONE( fp25, 25.0, (_factor) ); \ - FP_CHECK_ONE( fp26, 26.0, (_factor) ); \ - FP_CHECK_ONE( fp27, 27.0, (_factor) ); \ - FP_CHECK_ONE( fp28, 28.0, (_factor) ); \ - FP_CHECK_ONE( fp29, 29.0, (_factor) ); \ - FP_CHECK_ONE( fp30, 30.0, (_factor) ); \ - FP_CHECK_ONE( fp31, 31.0, (_factor) ); \ - FP_CHECK_ONE( fp32, 32.0, (_factor) ); \ - } while (0) +#define FP_CHECK( _factor ) \ + do { \ + FP_CHECK_ONE( fp01, 1.0, ( _factor ) ); \ + FP_CHECK_ONE( fp02, 2.0, ( _factor ) ); \ + FP_CHECK_ONE( fp03, 3.0, ( _factor ) ); \ + FP_CHECK_ONE( fp04, 4.0, ( _factor ) ); \ + FP_CHECK_ONE( fp05, 5.0, ( _factor ) ); \ + FP_CHECK_ONE( fp06, 6.0, ( _factor ) ); \ + FP_CHECK_ONE( fp07, 7.0, ( _factor ) ); \ + FP_CHECK_ONE( fp08, 8.0, ( _factor ) ); \ + FP_CHECK_ONE( fp09, 9.0, ( _factor ) ); \ + FP_CHECK_ONE( fp10, 10.0, ( _factor ) ); \ + FP_CHECK_ONE( fp11, 11.0, ( _factor ) ); \ + FP_CHECK_ONE( fp12, 12.0, ( _factor ) ); \ + FP_CHECK_ONE( fp13, 13.0, ( _factor ) ); \ + FP_CHECK_ONE( fp14, 14.0, ( _factor ) ); \ + FP_CHECK_ONE( fp15, 15.0, ( _factor ) ); \ + FP_CHECK_ONE( fp16, 16.0, ( _factor ) ); \ + FP_CHECK_ONE( fp17, 17.0, ( _factor ) ); \ + FP_CHECK_ONE( fp18, 18.0, ( _factor ) ); \ + FP_CHECK_ONE( fp19, 19.0, ( _factor ) ); \ + FP_CHECK_ONE( fp20, 20.0, ( _factor ) ); \ + FP_CHECK_ONE( fp21, 21.0, ( _factor ) ); \ + FP_CHECK_ONE( fp22, 22.0, ( _factor ) ); \ + FP_CHECK_ONE( fp23, 23.0, ( _factor ) ); \ + FP_CHECK_ONE( fp24, 24.0, ( _factor ) ); \ + FP_CHECK_ONE( fp25, 25.0, ( _factor ) ); \ + FP_CHECK_ONE( fp26, 26.0, ( _factor ) ); \ + FP_CHECK_ONE( fp27, 27.0, ( _factor ) ); \ + FP_CHECK_ONE( fp28, 28.0, ( _factor ) ); \ + FP_CHECK_ONE( fp29, 29.0, ( _factor ) ); \ + FP_CHECK_ONE( fp30, 30.0, ( _factor ) ); \ + FP_CHECK_ONE( fp31, 31.0, ( _factor ) ); \ + FP_CHECK_ONE( fp32, 32.0, ( _factor ) ); \ + } while ( 0 ) #endif diff --git a/testsuites/sptests/sp19/init.c b/testsuites/sptests/sp19/init.c index 5aeeaff364..7bdc5b2faa 100644 --- a/testsuites/sptests/sp19/init.c +++ b/testsuites/sptests/sp19/init.c @@ -58,9 +58,7 @@ void thread_switch_extension( Thread_Control *executing, Thread_Control *heir ) } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -68,12 +66,12 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); - Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' ); status = rtems_task_create( Task_name[ 1 ], @@ -157,28 +155,27 @@ rtems_task Init( * Load "task dependent factors" in the context areas */ + FP_factors[ 0 ] = 0.0; + FP_factors[ 1 ] = 1000.1; + FP_factors[ 2 ] = 2000.2; + FP_factors[ 3 ] = 3000.3; + FP_factors[ 4 ] = 4000.4; + FP_factors[ 5 ] = 5000.5; + FP_factors[ 6 ] = 6000.6; + FP_factors[ 7 ] = 7000.7; + FP_factors[ 8 ] = 8000.8; + FP_factors[ 9 ] = 9000.9; - FP_factors[0] = 0.0; - FP_factors[1] = 1000.1; - FP_factors[2] = 2000.2; - FP_factors[3] = 3000.3; - FP_factors[4] = 4000.4; - FP_factors[5] = 5000.5; - FP_factors[6] = 6000.6; - FP_factors[7] = 7000.7; - FP_factors[8] = 8000.8; - FP_factors[9] = 9000.9; - - INTEGER_factors[0] = 0x0000; - INTEGER_factors[1] = 0x1000; - INTEGER_factors[2] = 0x2000; - INTEGER_factors[3] = 0x3000; - INTEGER_factors[4] = 0x4000; - INTEGER_factors[5] = 0x5000; - INTEGER_factors[6] = 0x6000; - INTEGER_factors[7] = 0x7000; - INTEGER_factors[8] = 0x8000; - INTEGER_factors[9] = 0x9000; + INTEGER_factors[ 0 ] = 0x0000; + INTEGER_factors[ 1 ] = 0x1000; + INTEGER_factors[ 2 ] = 0x2000; + INTEGER_factors[ 3 ] = 0x3000; + INTEGER_factors[ 4 ] = 0x4000; + INTEGER_factors[ 5 ] = 0x5000; + INTEGER_factors[ 6 ] = 0x6000; + INTEGER_factors[ 7 ] = 0x7000; + INTEGER_factors[ 8 ] = 0x8000; + INTEGER_factors[ 9 ] = 0x9000; rtems_task_exit(); } diff --git a/testsuites/sptests/sp19/inttest.h b/testsuites/sptests/sp19/inttest.h index 1f07090547..1e066c3af8 100644 --- a/testsuites/sptests/sp19/inttest.h +++ b/testsuites/sptests/sp19/inttest.h @@ -40,128 +40,126 @@ * POSSIBILITY OF SUCH DAMAGE. */ - #ifndef __INTEGER_TEST_h #define __INTEGER_TEST_h #include #define REG_VARIABLE uint32_t -#define INTEGER_DECLARE \ - REG_VARIABLE int01 = 1; \ - REG_VARIABLE int02 = 2; \ - REG_VARIABLE int03 = 3; \ - REG_VARIABLE int04 = 4; \ - REG_VARIABLE int05 = 5; \ - REG_VARIABLE int06 = 6; \ - REG_VARIABLE int07 = 7; \ - REG_VARIABLE int08 = 8; \ - REG_VARIABLE int09 = 9; \ - REG_VARIABLE int10 = 10; \ - REG_VARIABLE int11 = 11; \ - REG_VARIABLE int12 = 12; \ - REG_VARIABLE int13 = 13; \ - REG_VARIABLE int14 = 14; \ - REG_VARIABLE int15 = 15; \ - REG_VARIABLE int16 = 16; \ - REG_VARIABLE int17 = 17; \ - REG_VARIABLE int18 = 18; \ - REG_VARIABLE int19 = 19; \ - REG_VARIABLE int20 = 20; \ - REG_VARIABLE int21 = 21; \ - REG_VARIABLE int22 = 22; \ - REG_VARIABLE int23 = 23; \ - REG_VARIABLE int24 = 24; \ - REG_VARIABLE int25 = 25; \ - REG_VARIABLE int26 = 26; \ - REG_VARIABLE int27 = 27; \ - REG_VARIABLE int28 = 28; \ - REG_VARIABLE int29 = 29; \ - REG_VARIABLE int30 = 30; \ - REG_VARIABLE int31 = 31; \ - REG_VARIABLE int32 = 32 +#define INTEGER_DECLARE \ + REG_VARIABLE int01 = 1; \ + REG_VARIABLE int02 = 2; \ + REG_VARIABLE int03 = 3; \ + REG_VARIABLE int04 = 4; \ + REG_VARIABLE int05 = 5; \ + REG_VARIABLE int06 = 6; \ + REG_VARIABLE int07 = 7; \ + REG_VARIABLE int08 = 8; \ + REG_VARIABLE int09 = 9; \ + REG_VARIABLE int10 = 10; \ + REG_VARIABLE int11 = 11; \ + REG_VARIABLE int12 = 12; \ + REG_VARIABLE int13 = 13; \ + REG_VARIABLE int14 = 14; \ + REG_VARIABLE int15 = 15; \ + REG_VARIABLE int16 = 16; \ + REG_VARIABLE int17 = 17; \ + REG_VARIABLE int18 = 18; \ + REG_VARIABLE int19 = 19; \ + REG_VARIABLE int20 = 20; \ + REG_VARIABLE int21 = 21; \ + REG_VARIABLE int22 = 22; \ + REG_VARIABLE int23 = 23; \ + REG_VARIABLE int24 = 24; \ + REG_VARIABLE int25 = 25; \ + REG_VARIABLE int26 = 26; \ + REG_VARIABLE int27 = 27; \ + REG_VARIABLE int28 = 28; \ + REG_VARIABLE int29 = 29; \ + REG_VARIABLE int30 = 30; \ + REG_VARIABLE int31 = 31; \ + REG_VARIABLE int32 = 32 #define INTEGER_LOAD( _factor ) \ - do { \ - int01 += _factor; \ - int02 += _factor; \ - int03 += _factor; \ - int04 += _factor; \ - int05 += _factor; \ - int06 += _factor; \ - int07 += _factor; \ - int08 += _factor; \ - int09 += _factor; \ - int10 += _factor; \ - int11 += _factor; \ - int12 += _factor; \ - int13 += _factor; \ - int14 += _factor; \ - int15 += _factor; \ - int16 += _factor; \ - int17 += _factor; \ - int18 += _factor; \ - int19 += _factor; \ - int20 += _factor; \ - int21 += _factor; \ - int22 += _factor; \ - int23 += _factor; \ - int24 += _factor; \ - int25 += _factor; \ - int26 += _factor; \ - int27 += _factor; \ - int28 += _factor; \ - int29 += _factor; \ - int30 += _factor; \ - int31 += _factor; \ - int32 += _factor; \ - } while (0) + do { \ + int01 += _factor; \ + int02 += _factor; \ + int03 += _factor; \ + int04 += _factor; \ + int05 += _factor; \ + int06 += _factor; \ + int07 += _factor; \ + int08 += _factor; \ + int09 += _factor; \ + int10 += _factor; \ + int11 += _factor; \ + int12 += _factor; \ + int13 += _factor; \ + int14 += _factor; \ + int15 += _factor; \ + int16 += _factor; \ + int17 += _factor; \ + int18 += _factor; \ + int19 += _factor; \ + int20 += _factor; \ + int21 += _factor; \ + int22 += _factor; \ + int23 += _factor; \ + int24 += _factor; \ + int25 += _factor; \ + int26 += _factor; \ + int27 += _factor; \ + int28 += _factor; \ + int29 += _factor; \ + int30 += _factor; \ + int31 += _factor; \ + int32 += _factor; \ + } while ( 0 ) -#define INTEGER_CHECK_ONE( _v, _base, _factor ) \ - if ( (_v) != ((_base) + (_factor)) ) { \ - printf( \ +#define INTEGER_CHECK_ONE( _v, _base, _factor ) \ + if ( ( _v ) != ( ( _base ) + ( _factor ) ) ) { \ + printf( \ "%" PRIu32 ": " #_v " wrong -- (0x%" PRIx32 " not 0x%" PRIx32 ")\n", \ - task_index, \ - (_v), \ - (_base + _factor) \ - ); \ + task_index, \ + ( _v ), \ + ( _base + _factor ) \ + ); \ } - -#define INTEGER_CHECK( _factor ) \ - do { \ - INTEGER_CHECK_ONE( int01, 1, (_factor) ); \ - INTEGER_CHECK_ONE( int02, 2, (_factor) ); \ - INTEGER_CHECK_ONE( int03, 3, (_factor) ); \ - INTEGER_CHECK_ONE( int04, 4, (_factor) ); \ - INTEGER_CHECK_ONE( int05, 5, (_factor) ); \ - INTEGER_CHECK_ONE( int06, 6, (_factor) ); \ - INTEGER_CHECK_ONE( int07, 7, (_factor) ); \ - INTEGER_CHECK_ONE( int08, 8, (_factor) ); \ - INTEGER_CHECK_ONE( int09, 9, (_factor) ); \ - INTEGER_CHECK_ONE( int10, 10, (_factor) ); \ - INTEGER_CHECK_ONE( int11, 11, (_factor) ); \ - INTEGER_CHECK_ONE( int12, 12, (_factor) ); \ - INTEGER_CHECK_ONE( int13, 13, (_factor) ); \ - INTEGER_CHECK_ONE( int14, 14, (_factor) ); \ - INTEGER_CHECK_ONE( int15, 15, (_factor) ); \ - INTEGER_CHECK_ONE( int16, 16, (_factor) ); \ - INTEGER_CHECK_ONE( int17, 17, (_factor) ); \ - INTEGER_CHECK_ONE( int18, 18, (_factor) ); \ - INTEGER_CHECK_ONE( int19, 19, (_factor) ); \ - INTEGER_CHECK_ONE( int20, 20, (_factor) ); \ - INTEGER_CHECK_ONE( int21, 21, (_factor) ); \ - INTEGER_CHECK_ONE( int22, 22, (_factor) ); \ - INTEGER_CHECK_ONE( int23, 23, (_factor) ); \ - INTEGER_CHECK_ONE( int24, 24, (_factor) ); \ - INTEGER_CHECK_ONE( int25, 25, (_factor) ); \ - INTEGER_CHECK_ONE( int26, 26, (_factor) ); \ - INTEGER_CHECK_ONE( int27, 27, (_factor) ); \ - INTEGER_CHECK_ONE( int28, 28, (_factor) ); \ - INTEGER_CHECK_ONE( int29, 29, (_factor) ); \ - INTEGER_CHECK_ONE( int30, 30, (_factor) ); \ - INTEGER_CHECK_ONE( int31, 31, (_factor) ); \ - INTEGER_CHECK_ONE( int32, 32, (_factor) ); \ - } while (0) +#define INTEGER_CHECK( _factor ) \ + do { \ + INTEGER_CHECK_ONE( int01, 1, ( _factor ) ); \ + INTEGER_CHECK_ONE( int02, 2, ( _factor ) ); \ + INTEGER_CHECK_ONE( int03, 3, ( _factor ) ); \ + INTEGER_CHECK_ONE( int04, 4, ( _factor ) ); \ + INTEGER_CHECK_ONE( int05, 5, ( _factor ) ); \ + INTEGER_CHECK_ONE( int06, 6, ( _factor ) ); \ + INTEGER_CHECK_ONE( int07, 7, ( _factor ) ); \ + INTEGER_CHECK_ONE( int08, 8, ( _factor ) ); \ + INTEGER_CHECK_ONE( int09, 9, ( _factor ) ); \ + INTEGER_CHECK_ONE( int10, 10, ( _factor ) ); \ + INTEGER_CHECK_ONE( int11, 11, ( _factor ) ); \ + INTEGER_CHECK_ONE( int12, 12, ( _factor ) ); \ + INTEGER_CHECK_ONE( int13, 13, ( _factor ) ); \ + INTEGER_CHECK_ONE( int14, 14, ( _factor ) ); \ + INTEGER_CHECK_ONE( int15, 15, ( _factor ) ); \ + INTEGER_CHECK_ONE( int16, 16, ( _factor ) ); \ + INTEGER_CHECK_ONE( int17, 17, ( _factor ) ); \ + INTEGER_CHECK_ONE( int18, 18, ( _factor ) ); \ + INTEGER_CHECK_ONE( int19, 19, ( _factor ) ); \ + INTEGER_CHECK_ONE( int20, 20, ( _factor ) ); \ + INTEGER_CHECK_ONE( int21, 21, ( _factor ) ); \ + INTEGER_CHECK_ONE( int22, 22, ( _factor ) ); \ + INTEGER_CHECK_ONE( int23, 23, ( _factor ) ); \ + INTEGER_CHECK_ONE( int24, 24, ( _factor ) ); \ + INTEGER_CHECK_ONE( int25, 25, ( _factor ) ); \ + INTEGER_CHECK_ONE( int26, 26, ( _factor ) ); \ + INTEGER_CHECK_ONE( int27, 27, ( _factor ) ); \ + INTEGER_CHECK_ONE( int28, 28, ( _factor ) ); \ + INTEGER_CHECK_ONE( int29, 29, ( _factor ) ); \ + INTEGER_CHECK_ONE( int30, 30, ( _factor ) ); \ + INTEGER_CHECK_ONE( int31, 31, ( _factor ) ); \ + INTEGER_CHECK_ONE( int32, 32, ( _factor ) ); \ + } while ( 0 ) #endif diff --git a/testsuites/sptests/sp19/system.h b/testsuites/sptests/sp19/system.h index e99c2a22b6..e3adc63d87 100644 --- a/testsuites/sptests/sp19/system.h +++ b/testsuites/sptests/sp19/system.h @@ -34,49 +34,40 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task First_FP_task( - rtems_task_argument argument -); +rtems_task First_FP_task( rtems_task_argument argument ); -rtems_task FP_task( - rtems_task_argument argument -); +rtems_task FP_task( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 7 +#define CONFIGURE_MAXIMUM_TASKS 7 void thread_switch_extension( Thread_Control *, Thread_Control * ); #define CONFIGURE_INITIAL_EXTENSIONS \ - { .thread_switch = thread_switch_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .thread_switch = thread_switch_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (24 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 24 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */ -TEST_EXTERN double FP_factors[ 10 ]; /* FP "uniqueness" factors */ +TEST_EXTERN double FP_factors[ 10 ]; /* FP "uniqueness" factors */ -TEST_EXTERN uint32_t INTEGER_factors[ 10 ]; /* INT "uniqueness" factors */ +TEST_EXTERN uint32_t INTEGER_factors[ 10 ]; /* INT "uniqueness" factors */ /* end of include file */ diff --git a/testsuites/sptests/sp19/task1.c b/testsuites/sptests/sp19/task1.c index e48bd05467..49acc15bc5 100644 --- a/testsuites/sptests/sp19/task1.c +++ b/testsuites/sptests/sp19/task1.c @@ -33,9 +33,7 @@ #include "system.h" #include "inttest.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -58,7 +56,7 @@ rtems_task Task_1( INTEGER_factors[ task_index ] ); - while( FOREVER ) { + while ( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); diff --git a/testsuites/sptests/sp20/getall.c b/testsuites/sptests/sp20/getall.c index b4b63597fb..4ac8f0d6a7 100644 --- a/testsuites/sptests/sp20/getall.c +++ b/testsuites/sptests/sp20/getall.c @@ -59,6 +59,10 @@ void Get_all_counters() Count.count[ 5 ] = 0; Count.count[ 6 ] = 0; - status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode ); + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" ); } diff --git a/testsuites/sptests/sp20/init.c b/testsuites/sptests/sp20/init.c index 8e2e48e7e2..3ce7846bcc 100644 --- a/testsuites/sptests/sp20/init.c +++ b/testsuites/sptests/sp20/init.c @@ -50,30 +50,28 @@ const char rtems_test_name[] = "SP 20"; void end_of_test( void ) { TEST_END(); - fsync(STDOUT_FILENO); + fsync( STDOUT_FILENO ); rtems_test_exit( 0 ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; uint32_t index; rtems_status_code status; - rtems_print_printer_fprintf(&rtems_test_printer, stdout); + rtems_print_printer_fprintf( &rtems_test_printer, stdout ); TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); - Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); - for ( index = 1 ; index <= 6 ; index++ ) { + for ( index = 1; index <= 6; index++ ) { status = rtems_task_create( Task_name[ index ], Priorities[ index ], @@ -85,7 +83,7 @@ rtems_task Init( directive_failed( status, "rtems_task_create loop" ); } - for ( index = 1 ; index <= 6 ; index++ ) { + for ( index = 1; index <= 6; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_6, index ); directive_failed( status, "rtems_task_start loop" ); } diff --git a/testsuites/sptests/sp20/system.h b/testsuites/sptests/sp20/system.h index f0e339def4..7a580f6b1e 100644 --- a/testsuites/sptests/sp20/system.h +++ b/testsuites/sptests/sp20/system.h @@ -35,18 +35,14 @@ /* types */ struct counters { - uint32_t count[7]; + uint32_t count[ 7 ]; }; /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1_through_6( - rtems_task_argument argument -); +rtems_task Task_1_through_6( rtems_task_argument argument ); void Get_all_counters( void ); @@ -57,12 +53,12 @@ void Get_all_counters( void ); #define CONFIGURE_MICROSECONDS_PER_TICK 100000 -#define CONFIGURE_MAXIMUM_TASKS 8 -#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_TASKS 8 +#define CONFIGURE_MAXIMUM_PERIODS 10 -#define CONFIGURE_INIT_TASK_PRIORITY 10 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT +#define CONFIGURE_INIT_TASK_PRIORITY 10 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -72,12 +68,12 @@ void Get_all_counters( void ); /* global variables */ -TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */ -TEST_EXTERN struct counters Count; /* iteration counters */ +TEST_EXTERN struct counters Count; /* iteration counters */ TEST_EXTERN struct counters Temporary_count; -extern rtems_task_priority Priorities[ 7 ]; +extern rtems_task_priority Priorities[ 7 ]; void end_of_test( void ); diff --git a/testsuites/sptests/sp20/task1.c b/testsuites/sptests/sp20/task1.c index c8072a0181..08c6a9f928 100644 --- a/testsuites/sptests/sp20/task1.c +++ b/testsuites/sptests/sp20/task1.c @@ -37,12 +37,12 @@ /* runtime of TA6 should be shorter than TA5 */ -#define TA6_ITERATIONS 10 +#define TA6_ITERATIONS 10 #define TA6_PERIOD_FACTOR 10 -uint32_t Periods[7] = { 0, 2, 2, 2, 2, 100, 0 }; -uint32_t Iterations[7] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS }; -rtems_task_priority Priorities[7] = { 0, 1, 1, 3, 4, 5, 1 }; +uint32_t Periods[ 7 ] = { 0, 2, 2, 2, 2, 100, 0 }; +uint32_t Iterations[ 7 ] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS }; +rtems_task_priority Priorities[ 7 ] = { 0, 1, 1, 3, 4, 5, 1 }; static char *name( size_t i, char buf[ 4 ] ) { @@ -57,9 +57,7 @@ static char *name( size_t i, char buf[ 4 ] ) return &buf[ 0 ]; } -rtems_task Task_1_through_6( - rtems_task_argument argument -) +rtems_task Task_1_through_6( rtems_task_argument argument ) { rtems_id rmid; rtems_id test_rmid; @@ -88,8 +86,8 @@ rtems_task Task_1_through_6( if ( rmid != test_rmid ) { rtems_test_printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", - rmid, - test_rmid + rmid, + test_rmid ); rtems_test_exit( 0 ); } @@ -117,7 +115,7 @@ rtems_task Task_1_through_6( } break; case 5: - pass = 0; + pass = 0; failed = 0; status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); @@ -126,13 +124,12 @@ rtems_task Task_1_through_6( Get_all_counters(); while ( FOREVER ) { - status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" ); Get_all_counters(); - for( index = 1 ; index <= 4 ; index++ ) { + for ( index = 1; index <= 4; index++ ) { if ( Temporary_count.count[ index ] != Iterations[ index ] ) { rtems_test_printf( "%s - FAIL - Actual=%" PRIu32 ", Expected=%" PRIu32 "\n", @@ -144,8 +141,9 @@ rtems_task Task_1_through_6( } } - if ( failed == 5 ) + if ( failed == 5 ) { rtems_test_exit( 0 ); + } pass += 1; @@ -154,43 +152,45 @@ rtems_task Task_1_through_6( if ( pass == 10 ) { end_of_test(); } - } break; case 6: /* test changing periods */ { - uint32_t time[TA6_ITERATIONS+1]; + uint32_t time[ TA6_ITERATIONS + 1 ]; rtems_interval period; - period = 1*TA6_PERIOD_FACTOR; - status = rtems_rate_monotonic_period( rmid, period); + period = 1 * TA6_PERIOD_FACTOR; + status = rtems_rate_monotonic_period( rmid, period ); directive_failed( status, "rtems_rate_monotonic_period of TA6" ); - time[0] = _Watchdog_Ticks_since_boot; /* timestamp */ + time[ 0 ] = _Watchdog_Ticks_since_boot; /* timestamp */ /*rtems_test_printf("%d - %d\n", period, time[0]);*/ - for (index = 1; index <= TA6_ITERATIONS; index++) { - period = (index+1)*TA6_PERIOD_FACTOR; - status = rtems_rate_monotonic_period( rmid, period); + for ( index = 1; index <= TA6_ITERATIONS; index++ ) { + period = ( index + 1 ) * TA6_PERIOD_FACTOR; + status = rtems_rate_monotonic_period( rmid, period ); directive_failed( status, "rtems_rate_monotonic_period of TA6" ); - time[index] = _Watchdog_Ticks_since_boot; /* timestamp */ + time[ index ] = _Watchdog_Ticks_since_boot; /* timestamp */ /*rtems_test_printf("%d - %d\n", period, time[index]);*/ } - for (index = 1; index <= TA6_ITERATIONS; index++) { - rtems_interval meas = time[index] - time[index-1]; - period = index*TA6_PERIOD_FACTOR; + for ( index = 1; index <= TA6_ITERATIONS; index++ ) { + rtems_interval meas = time[ index ] - time[ index - 1 ]; + period = index * TA6_PERIOD_FACTOR; rtems_test_printf( "TA6 - Actual: %" PRIdrtems_interval - " Expected: %" PRIdrtems_interval, + " Expected: %" PRIdrtems_interval, meas, period ); - if (period == meas) rtems_test_printf(" - OK\n"); - else rtems_test_printf(" - FAILED\n"); + if ( period == meas ) { + rtems_test_printf( " - OK\n" ); + } else { + rtems_test_printf( " - FAILED\n" ); + } } } - rtems_task_suspend(RTEMS_SELF); + rtems_task_suspend( RTEMS_SELF ); break; } } diff --git a/testsuites/sptests/sp2038/init.c b/testsuites/sptests/sp2038/init.c index 4a831f87ac..84e1b304f1 100644 --- a/testsuites/sptests/sp2038/init.c +++ b/testsuites/sptests/sp2038/init.c @@ -40,11 +40,11 @@ const char rtems_test_name[] = "SP 2038"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL) +#define ASSERT_SC( sc ) rtems_test_assert( ( sc ) == RTEMS_SUCCESSFUL ) -static const uint32_t sample_seconds [] = { +static const uint32_t sample_seconds[] = { 571213695UL, 602836095UL, 634372095UL, @@ -177,134 +177,117 @@ static const rtems_time_of_day problem_2038 = { .second = 8 }; -static const rtems_time_of_day tod_to_seconds_base = { - .year = 0, - .month = 2, - .day = 7, - .hour = 6, - .minute = 28, - .second = 15 -}; +static const rtems_time_of_day tod_to_seconds_base = + { .year = 0, .month = 2, .day = 7, .hour = 6, .minute = 28, .second = 15 }; -static const rtems_time_of_day problem_2100 = { - .year = 2100, - .month = 2, - .day = 28, - .hour = 0, - .minute = 0, - .second = 0 -}; +static const rtems_time_of_day problem_2100 = + { .year = 2100, .month = 2, .day = 28, .hour = 0, .minute = 0, .second = 0 }; -static const rtems_time_of_day problem_2100_2 = { - .year = 2100, - .month = 2, - .day = 29, - .hour = 0, - .minute = 0, - .second = 0 -}; +static const rtems_time_of_day problem_2100_2 = + { .year = 2100, .month = 2, .day = 29, .hour = 0, .minute = 0, .second = 0 }; -static void test_tod_to_seconds(void) +static void test_tod_to_seconds( void ) { rtems_status_code sc = RTEMS_SUCCESSFUL; - size_t i = 0; - size_t n = sizeof(sample_seconds) / sizeof(sample_seconds [0]); + size_t i = 0; + size_t n = sizeof( sample_seconds ) / sizeof( sample_seconds[ 0 ] ); - for (i = 0; i < n; ++i) { + for ( i = 0; i < n; ++i ) { rtems_time_of_day tod = tod_to_seconds_base; - uint32_t seconds = 0; - rtems_interval seconds_as_interval = 0; + uint32_t seconds = 0; + rtems_interval seconds_as_interval = 0; tod.year = 1988 + i; - seconds = _TOD_To_seconds(&tod); - rtems_test_assert(seconds == sample_seconds [i]); + seconds = _TOD_To_seconds( &tod ); + rtems_test_assert( seconds == sample_seconds[ i ] ); - sc = rtems_clock_set(&tod); - ASSERT_SC(sc); + sc = rtems_clock_set( &tod ); + ASSERT_SC( sc ); - sc = rtems_clock_get_seconds_since_epoch(&seconds_as_interval); - ASSERT_SC(sc); - rtems_test_assert(seconds_as_interval == sample_seconds [i]); + sc = rtems_clock_get_seconds_since_epoch( &seconds_as_interval ); + ASSERT_SC( sc ); + rtems_test_assert( seconds_as_interval == sample_seconds[ i ] ); } } -static void test_problem_year(void) +static void test_problem_year( void ) { rtems_status_code sc = RTEMS_SUCCESSFUL; - bool time_t_is_32_bit = sizeof(time_t) == 4; + bool time_t_is_32_bit = sizeof( time_t ) == 4; - if (time_t_is_32_bit) { + if ( time_t_is_32_bit ) { const rtems_time_of_day *nearly_problem = NULL; const rtems_time_of_day *problem = NULL; - rtems_time_of_day now; + rtems_time_of_day now; nearly_problem = &nearly_problem_2038; problem = &problem_2038; - sc = rtems_clock_set(nearly_problem); - ASSERT_SC(sc); - sc = rtems_clock_get_tod(&now); - ASSERT_SC(sc); - rtems_test_assert(memcmp(&now, nearly_problem, sizeof(now)) == 0); + sc = rtems_clock_set( nearly_problem ); + ASSERT_SC( sc ); + sc = rtems_clock_get_tod( &now ); + ASSERT_SC( sc ); + rtems_test_assert( memcmp( &now, nearly_problem, sizeof( now ) ) == 0 ); - sc = rtems_clock_set(problem); - ASSERT_SC(sc); - sc = rtems_clock_get_tod(&now); - ASSERT_SC(sc); - rtems_test_assert(memcmp(&now, problem, sizeof(now)) == 0); + sc = rtems_clock_set( problem ); + ASSERT_SC( sc ); + sc = rtems_clock_get_tod( &now ); + ASSERT_SC( sc ); + rtems_test_assert( memcmp( &now, problem, sizeof( now ) ) == 0 ); } } -static void test_leap_year(void) +static void test_leap_year( void ) { - rtems_status_code test_status; - const rtems_time_of_day *problem = &problem_2100; - const rtems_time_of_day *problem2 = &problem_2100_2; - // 2100 is not a leap year, so it should have 28 days - test_status = _TOD_Validate(problem, TOD_ENABLE_TICKS_VALIDATION); - rtems_test_assert(test_status == RTEMS_INVALID_CLOCK); - test_status = _TOD_Validate(problem2, TOD_ENABLE_TICKS_VALIDATION); - rtems_test_assert(test_status == RTEMS_INVALID_CLOCK); + rtems_status_code test_status; + const rtems_time_of_day *problem = &problem_2100; + const rtems_time_of_day *problem2 = &problem_2100_2; + // 2100 is not a leap year, so it should have 28 days + test_status = _TOD_Validate( problem, TOD_ENABLE_TICKS_VALIDATION ); + rtems_test_assert( test_status == RTEMS_INVALID_CLOCK ); + test_status = _TOD_Validate( problem2, TOD_ENABLE_TICKS_VALIDATION ); + rtems_test_assert( test_status == RTEMS_INVALID_CLOCK ); } -static bool test_year_is_leap_year(uint32_t year) +static bool test_year_is_leap_year( uint32_t year ) { - return (((year % 4) == 0) && ((year % 100) != 0)) || ((year % 400) == 0); + return ( ( ( year % 4 ) == 0 ) && ( ( year % 100 ) != 0 ) ) || + ( ( year % 400 ) == 0 ); } -static void test_every_day(void) +static void test_every_day( void ) { - rtems_time_of_day every_day = { - .year = 1970, - .month = 1, - .day = 1, - .hour = 0, - .minute = 1, - .second = 2 - }; - const int days_per_month[2][12] = { - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } - }; - rtems_status_code sc = RTEMS_SUCCESSFUL; - rtems_time_of_day now; + rtems_time_of_day every_day = { + .year = 1970, + .month = 1, + .day = 1, + .hour = 0, + .minute = 1, + .second = 2 + }; + const int days_per_month[ 2 ][ 12 ] = { + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } + }; + rtems_status_code sc = RTEMS_SUCCESSFUL; + rtems_time_of_day now; - for (every_day.year = 1988; every_day.year <= 2099; ++every_day.year) { - int leap_year = test_year_is_leap_year(every_day.year) ? 1 : 0; - for (every_day.month = 1; every_day.month <= 12; ++every_day.month) { - uint32_t days = days_per_month[leap_year][every_day.month - 1]; - for (every_day.day = 1; every_day.day <= days; ++every_day.day) { - sc = rtems_clock_set(&every_day); - ASSERT_SC(sc); - sc = rtems_clock_get_tod(&now); - ASSERT_SC(sc); - rtems_test_assert(memcmp(&now, &every_day, sizeof(now)) == 0); - } - } + for ( every_day.year = 1988; every_day.year <= 2099; ++every_day.year ) { + int leap_year = test_year_is_leap_year( every_day.year ) ? 1 : 0; + for ( every_day.month = 1; every_day.month <= 12; ++every_day.month ) { + uint32_t days = days_per_month[ leap_year ][ every_day.month - 1 ]; + for ( every_day.day = 1; every_day.day <= days; ++every_day.day ) { + sc = rtems_clock_set( &every_day ); + ASSERT_SC( sc ); + sc = rtems_clock_get_tod( &now ); + ASSERT_SC( sc ); + rtems_test_assert( memcmp( &now, &every_day, sizeof( now ) ) == 0 ); + } } + } } -rtems_task Init(rtems_task_argument argument) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -317,7 +300,7 @@ rtems_task Init(rtems_task_argument argument) TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER diff --git a/testsuites/sptests/sp21/init.c b/testsuites/sptests/sp21/init.c index fec4e3428a..0451f58bb1 100644 --- a/testsuites/sptests/sp21/init.c +++ b/testsuites/sptests/sp21/init.c @@ -38,24 +38,23 @@ const char rtems_test_name[] = "SP 21"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -void do_test_io_manager(void); -void do_test_zero_driver(void); +rtems_task Init( rtems_task_argument argument ); +void do_test_io_manager( void ); +void do_test_zero_driver( void ); #define PRIurtems_device_major_number PRIu32 -#define STUB_DRIVER_MAJOR 1 -#define ZERO_DRIVER_MAJOR 2 -#define NO_DRIVER_MAJOR 3 -#define INVALID_DRIVER_MAJOR UINT32_MAX +#define STUB_DRIVER_MAJOR 1 +#define ZERO_DRIVER_MAJOR 2 +#define NO_DRIVER_MAJOR 3 +#define INVALID_DRIVER_MAJOR UINT32_MAX /* driver entries to use with io_register */ rtems_driver_address_table GoodDriver = DEVNULL_DRIVER_TABLE_ENTRY; -rtems_driver_address_table BadDriver_Nothing = { - NULL, NULL, NULL, NULL, NULL, NULL -}; +rtems_driver_address_table BadDriver_Nothing = + { NULL, NULL, NULL, NULL, NULL, NULL }; -void do_test_io_manager(void) +void do_test_io_manager( void ) { rtems_status_code status; rtems_device_major_number registered; @@ -127,11 +126,7 @@ void do_test_io_manager(void) puts( "rtems_io_initialize - RTEMS_INVALID_NUMBER" ); status = rtems_io_open( INVALID_DRIVER_MAJOR, 0, NULL ); - fatal_directive_status( - status, - RTEMS_INVALID_NUMBER, - "rtems_io_open" - ); + fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_io_open" ); puts( "rtems_io_open - RTEMS_INVALID_NUMBER" ); /* @@ -145,9 +140,7 @@ void do_test_io_manager(void) RTEMS_INVALID_ADDRESS, "rtems_io_register_driver" ); - puts( - "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL registered" - ); + puts( "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL registered" ); status = rtems_io_register_driver( 0, NULL, ®istered ); fatal_directive_status( @@ -155,9 +148,7 @@ void do_test_io_manager(void) RTEMS_INVALID_ADDRESS, "rtems_io_register_driver" ); - puts( - "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL device" - ); + puts( "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - NULL device" ); status = rtems_io_register_driver( 0, &BadDriver_Nothing, ®istered ); fatal_directive_status( @@ -165,12 +156,13 @@ void do_test_io_manager(void) RTEMS_INVALID_ADDRESS, "rtems_io_register_driver" ); - puts( - "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - no callouts" - ); + puts( "rtems_io_register_driver - RTEMS_INVALID_ADDRESS - no callouts" ); status = rtems_io_register_driver( - INVALID_DRIVER_MAJOR, &GoodDriver, ®istered ); + INVALID_DRIVER_MAJOR, + &GoodDriver, + ®istered + ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, @@ -184,14 +176,13 @@ void do_test_io_manager(void) puts( "rtems_io_register_driver - RTEMS_SUCCESSFUL - overwrite NULL" ); status = rtems_io_register_driver( 0, &GoodDriver, ®istered ); - if ( status == RTEMS_SUCCESSFUL ) + if ( status == RTEMS_SUCCESSFUL ) { printf( - "registered major = %" PRIurtems_device_major_number "\n", registered ); - fatal_directive_status( - status, - RTEMS_TOO_MANY, - "rtems_io_register_driver" - ); + "registered major = %" PRIurtems_device_major_number "\n", + registered + ); + } + fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_io_register_driver" ); puts( "rtems_io_register_driver - RTEMS_TOO_MANY - no slots" ); /* there should be a driver at major 1 -- clock, console, or stub */ @@ -201,9 +192,7 @@ void do_test_io_manager(void) RTEMS_RESOURCE_IN_USE, "rtems_io_register_driver" ); - puts( - "rtems_io_register_driver - RTEMS_RESOURCE_IN_USE - major in use" - ); + puts( "rtems_io_register_driver - RTEMS_RESOURCE_IN_USE - major in use" ); /* this should unregister the device driver we registered above */ status = rtems_io_unregister_driver( registered_worked ); @@ -211,19 +200,13 @@ void do_test_io_manager(void) puts( "rtems_io_unregister_driver - RTEMS_SUCCESSFUL" ); } -void do_test_zero_driver(void) +void do_test_zero_driver( void ) { - rtems_status_code sc = RTEMS_SUCCESSFUL; - char in = 'I'; - rtems_libio_rw_args_t rw_in = { - .buffer = &in, - .count = sizeof(in) - }; - char out = 'O'; - rtems_libio_rw_args_t rw_out = { - .buffer = &out, - .count = sizeof(out) - }; + rtems_status_code sc = RTEMS_SUCCESSFUL; + char in = 'I'; + rtems_libio_rw_args_t rw_in = { .buffer = &in, .count = sizeof( in ) }; + char out = 'O'; + rtems_libio_rw_args_t rw_out = { .buffer = &out, .count = sizeof( out ) }; puts( "----- TESTING THE ZERO DRIVER CHECKS -----" ); @@ -239,20 +222,18 @@ void do_test_zero_driver(void) sc = rtems_io_read( ZERO_DRIVER_MAJOR, 0, &rw_in ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( in == 0 ); - rtems_test_assert( rw_in.bytes_moved == sizeof(in) ); + rtems_test_assert( rw_in.bytes_moved == sizeof( in ) ); sc = rtems_io_write( ZERO_DRIVER_MAJOR, 0, &rw_out ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( out == 'O' ); - rtems_test_assert( rw_out.bytes_moved == sizeof(out) ); + rtems_test_assert( rw_out.bytes_moved == sizeof( out ) ); sc = rtems_io_control( ZERO_DRIVER_MAJOR, 0, NULL ); rtems_test_assert( sc == RTEMS_IO_ERROR ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -274,7 +255,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER #define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp22/delay.c b/testsuites/sptests/sp22/delay.c index e4d1f0ce79..d5c43ae70c 100644 --- a/testsuites/sptests/sp22/delay.c +++ b/testsuites/sptests/sp22/delay.c @@ -41,8 +41,8 @@ #include "system.h" rtems_timer_service_routine Delayed_resume( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; diff --git a/testsuites/sptests/sp22/init.c b/testsuites/sptests/sp22/init.c index 29216866ba..7a16db45a2 100644 --- a/testsuites/sptests/sp22/init.c +++ b/testsuites/sptests/sp22/init.c @@ -47,14 +47,12 @@ const char rtems_test_name[] = "SP 22"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_time_of_day time; - rtems_status_code status; + rtems_time_of_day time; + rtems_status_code status; TEST_BEGIN(); @@ -63,7 +61,7 @@ rtems_task Init( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); status = rtems_task_create( diff --git a/testsuites/sptests/sp22/system.h b/testsuites/sptests/sp22/system.h index 16a2d5a93d..ae7361d1bd 100644 --- a/testsuites/sptests/sp22/system.h +++ b/testsuites/sptests/sp22/system.h @@ -34,44 +34,40 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_resume( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); void Print_time( void ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 2 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 2 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ /* end of include file */ diff --git a/testsuites/sptests/sp22/task1.c b/testsuites/sptests/sp22/task1.c index e1c704b0f4..e863aaefff 100644 --- a/testsuites/sptests/sp22/task1.c +++ b/testsuites/sptests/sp22/task1.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -51,14 +49,14 @@ rtems_task Task_1( rtems_time_of_day time; rtems_status_code status; -/* Get id */ + /* Get id */ puts( "TA1 - rtems_timer_ident - identing timer 1" ); status = rtems_timer_ident( Timer_name[ 1 ], &tmid ); directive_failed( status, "rtems_timer_ident" ); printf( "TA1 - timer 1 has id (0x%" PRIxrtems_id ")\n", tmid ); -/* after which is allowed to fire */ + /* after which is allowed to fire */ Print_time(); @@ -77,7 +75,7 @@ rtems_task Task_1( Print_time(); -/* after which is reset and allowed to fire */ + /* after which is reset and allowed to fire */ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_fire_after( @@ -115,7 +113,7 @@ rtems_task Task_1( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); -/* after which is canceled */ + /* after which is canceled */ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_fire_after( @@ -130,7 +128,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); -/* when which is allowed to fire */ + /* when which is allowed to fire */ Print_time(); @@ -149,7 +147,7 @@ rtems_task Task_1( Print_time(); -/* when which is canceled */ + /* when which is canceled */ status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); @@ -170,7 +168,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); -/* delete */ + /* delete */ puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); diff --git a/testsuites/sptests/sp23/init.c b/testsuites/sptests/sp23/init.c index be5a1f7e58..c04d4151df 100644 --- a/testsuites/sptests/sp23/init.c +++ b/testsuites/sptests/sp23/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 23"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,7 +55,7 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); status = rtems_task_create( Task_name[ 1 ], @@ -83,9 +81,10 @@ rtems_task Init( ); directive_failed( status, "rtems_port_create of DP1" ); - printf( "INIT - rtems_port_create - DP1 - int = %p ext = %p\n", - Internal_port_area, - External_port_area + printf( + "INIT - rtems_port_create - DP1 - int = %p ext = %p\n", + Internal_port_area, + External_port_area ); rtems_task_exit(); diff --git a/testsuites/sptests/sp23/system.h b/testsuites/sptests/sp23/system.h index b0debbc262..4c1028fd27 100644 --- a/testsuites/sptests/sp23/system.h +++ b/testsuites/sptests/sp23/system.h @@ -34,43 +34,39 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_PORTS 1 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_PORTS 1 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -#define Internal_port_area ((uint8_t *) 0x00001000) -#define External_port_area ((uint8_t *) 0x00002000) +#define Internal_port_area ( (uint8_t *) 0x00001000 ) +#define External_port_area ( (uint8_t *) 0x00002000 ) -#define Below_port_area ((uint8_t *) 0x00000500) -#define Above_port_area ((uint8_t *) 0x00003000) +#define Below_port_area ( (uint8_t *) 0x00000500 ) +#define Above_port_area ( (uint8_t *) 0x00003000 ) /* end of include file */ diff --git a/testsuites/sptests/sp23/task1.c b/testsuites/sptests/sp23/task1.c index d58b3b5015..d475fd08bb 100644 --- a/testsuites/sptests/sp23/task1.c +++ b/testsuites/sptests/sp23/task1.c @@ -42,16 +42,14 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; - rtems_id dpid; - void *to_be_converted; - void *converted; - rtems_status_code status; + rtems_id dpid; + void *to_be_converted; + void *converted; + rtems_status_code status; status = rtems_port_ident( Port_name[ 1 ], &dpid ); directive_failed( status, "rtems_port_ident" ); diff --git a/testsuites/sptests/sp24/init.c b/testsuites/sptests/sp24/init.c index a7430fdbde..490d297716 100644 --- a/testsuites/sptests/sp24/init.c +++ b/testsuites/sptests/sp24/init.c @@ -47,14 +47,12 @@ const char rtems_test_name[] = "SP 24"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_time_of_day time; - uint32_t index; + uint32_t index; rtems_status_code status; TEST_BEGIN(); @@ -64,15 +62,15 @@ rtems_task Init( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); - Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); - Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); + Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); - for ( index = 1 ; index <= 3 ; index++ ) { + for ( index = 1; index <= 3; index++ ) { status = rtems_task_create( Task_name[ index ], 1, @@ -83,14 +81,11 @@ rtems_task Init( ); directive_failed( status, "rtems_task_create loop" ); - status = rtems_timer_create( - Timer_name[ index ], - &Timer_id[ index ] - ); + status = rtems_timer_create( Timer_name[ index ], &Timer_id[ index ] ); directive_failed( status, "rtems_timer_create loop" ); } - for ( index = 1 ; index <= 3 ; index++ ) { + for ( index = 1; index <= 3; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); directive_failed( status, "rtems_task_start loop" ); } diff --git a/testsuites/sptests/sp24/resume.c b/testsuites/sptests/sp24/resume.c index 9f8c8d0984..65219d1969 100644 --- a/testsuites/sptests/sp24/resume.c +++ b/testsuites/sptests/sp24/resume.c @@ -41,8 +41,8 @@ #include "system.h" rtems_timer_service_routine Resume_task( - rtems_id timer_id, - void *ignored_address + rtems_id timer_id, + void *ignored_address ) { (void) ignored_address; diff --git a/testsuites/sptests/sp24/system.h b/testsuites/sptests/sp24/system.h index 0b4915644d..e6c752e538 100644 --- a/testsuites/sptests/sp24/system.h +++ b/testsuites/sptests/sp24/system.h @@ -34,41 +34,37 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Resume_task( - rtems_id timer_id, - void *ignored_address + rtems_id timer_id, + void *ignored_address ); -rtems_task Task_1_through_3( - rtems_task_argument argument -); +rtems_task Task_1_through_3( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 -#define CONFIGURE_MAXIMUM_TIMERS 3 +#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TIMERS 3 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ /* end of include file */ diff --git a/testsuites/sptests/sp24/task1.c b/testsuites/sptests/sp24/task1.c index 85273158a9..2c387a0a9a 100644 --- a/testsuites/sptests/sp24/task1.c +++ b/testsuites/sptests/sp24/task1.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_1_through_3( - rtems_task_argument argument -) +rtems_task Task_1_through_3( rtems_task_argument argument ) { rtems_id tid; rtems_time_of_day time; @@ -52,7 +50,7 @@ rtems_task Task_1_through_3( status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident of self" ); - while ( FOREVER ) { + while ( FOREVER ) { status = rtems_timer_fire_after( Timer_id[ argument ], task_number( tid ) * 5 * rtems_clock_get_ticks_per_second(), diff --git a/testsuites/sptests/sp25/init.c b/testsuites/sptests/sp25/init.c index abebede8fe..5b849999e2 100644 --- a/testsuites/sptests/sp25/init.c +++ b/testsuites/sptests/sp25/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 25"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -57,7 +55,7 @@ rtems_task Init( TEST_BEGIN(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); status = rtems_task_create( Task_name[ 1 ], @@ -72,7 +70,7 @@ rtems_task Init( status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); directive_failed( status, "rtems_task_start of TA1" ); - Region_name[ 1 ] = rtems_build_name('R', 'N', '0', '1'); + Region_name[ 1 ] = rtems_build_name( 'R', 'N', '0', '1' ); status = rtems_region_create( Region_name[ 1 ], diff --git a/testsuites/sptests/sp25/system.h b/testsuites/sptests/sp25/system.h index 682aa7e12d..4aa710b734 100644 --- a/testsuites/sptests/sp25/system.h +++ b/testsuites/sptests/sp25/system.h @@ -34,21 +34,17 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -58,18 +54,20 @@ rtems_task Task_1( /* global variables */ -TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ -TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */ -TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */ +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Region_id[ 2 ]; /* array of region ids */ +TEST_EXTERN rtems_name Region_name[ 2 ]; /* array of region names */ /* test will fail... segment sizes need to be reworked for <=32K buffer */ -TEST_EXTERN uint8_t Area_1[20*1024] CPU_STRUCTURE_ALIGNMENT; +TEST_EXTERN uint8_t Area_1[ 20 * 1024 ] CPU_STRUCTURE_ALIGNMENT; -#define BASE_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2u) + 1u) +#define BASE_PRIORITY ( ( RTEMS_MAXIMUM_PRIORITY / 2u ) + 1u ) -#define Put_address_from_area_1( _to_be_printed ) \ - printf( "0x%08lx", \ - (unsigned long) ((uint8_t *)(_to_be_printed) - Area_1 ) ) +#define Put_address_from_area_1( _to_be_printed ) \ + printf( \ + "0x%08lx", \ + (unsigned long) ( (uint8_t *) ( _to_be_printed ) - Area_1 ) \ + ) /* end of include file */ diff --git a/testsuites/sptests/sp25/task1.c b/testsuites/sptests/sp25/task1.c index 6dbedd1a60..20939bb3ed 100644 --- a/testsuites/sptests/sp25/task1.c +++ b/testsuites/sptests/sp25/task1.c @@ -32,29 +32,27 @@ #include "system.h" -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; - void *address_1; - void *address_2; - void *address_3; - void *address_4; - void *address_5; - void *address_6; - void *address_7; - void *address_8; - rtems_id region_id; - Heap_Information_block region_info; - uintptr_t segment_size; - rtems_status_code status; + void *address_1; + void *address_2; + void *address_3; + void *address_4; + void *address_5; + void *address_6; + void *address_7; + void *address_8; + rtems_id region_id; + Heap_Information_block region_info; + uintptr_t segment_size; + rtems_status_code status; /* Obtain the region id */ - status = rtems_region_ident(Region_name[ 1 ], ®ion_id); + status = rtems_region_ident( Region_name[ 1 ], ®ion_id ); printf( "TA1 - rtems_region_ident - 0x%08" PRIxrtems_id "\n", region_id ); - directive_failed(status, "rtems_region_ident of RN01"); + directive_failed( status, "rtems_region_ident of RN01" ); /* Get a 64 byte segment from the region */ puts( @@ -76,8 +74,12 @@ rtems_task Task_1( puts_nocr( "TA1 - rtems_region_get_segment_size from - " ); Put_address_from_area_1( address_1 ); new_line; - status = rtems_region_get_segment_size(region_id, address_1, &segment_size); - directive_failed(status, "rtems_region_get_segment_size of segment 1"); + status = rtems_region_get_segment_size( + region_id, + address_1, + &segment_size + ); + directive_failed( status, "rtems_region_get_segment_size of segment 1" ); printf( "TA1 - got segment size of %" PRIuPTR "\n", segment_size ); /* Get a 128 byte segment from the region */ @@ -196,8 +198,12 @@ rtems_task Task_1( puts_nocr( "TA1 - rtems_region_get_segment_size from - " ); Put_address_from_area_1( address_8 ); new_line; - status = rtems_region_get_segment_size(region_id, address_8, &segment_size); - directive_failed(status, "rtems_region_get_segment_size of segment 8"); + status = rtems_region_get_segment_size( + region_id, + address_8, + &segment_size + ); + directive_failed( status, "rtems_region_get_segment_size of segment 8" ); printf( "TA1 - got segment size of %" PRIuPTR "\n", segment_size ); /* Get information about the region */ @@ -205,8 +211,8 @@ rtems_task Task_1( "TA1 - rtems_region_get_information - 0x%08" PRIxrtems_id "\n", region_id ); - status = rtems_region_get_information(region_id, ®ion_info); - directive_failed(status, "rtems_region_get_information of RN01"); + status = rtems_region_get_information( region_id, ®ion_info ); + directive_failed( status, "rtems_region_get_information of RN01" ); printf( "TA1 - got information - free = %" PRIuPTR ", used = %" PRIuPTR "\n", region_info.Free.number, @@ -217,8 +223,8 @@ rtems_task Task_1( "TA1 - rtems_region_get_free_information - 0x%08" PRIxrtems_id "\n", region_id ); - status = rtems_region_get_free_information(region_id, ®ion_info); - directive_failed(status, "rtems_region_get_free_information of RN01"); + status = rtems_region_get_free_information( region_id, ®ion_info ); + directive_failed( status, "rtems_region_get_free_information of RN01" ); printf( "TA1 - got free information - free = %" PRIuPTR ", used = %" PRIuPTR "\n", region_info.Free.number, @@ -298,7 +304,7 @@ rtems_task Task_1( address_5 = 0; puts( "TA1 - rtems_region_delete - walks heap if debug enabled" ); - rtems_region_delete(Region_id[ 1 ]); + rtems_region_delete( Region_id[ 1 ] ); TEST_END(); rtems_test_exit( 0 ); diff --git a/testsuites/sptests/sp26/init.c b/testsuites/sptests/sp26/init.c index 830d258b01..e48e2e16ea 100644 --- a/testsuites/sptests/sp26/init.c +++ b/testsuites/sptests/sp26/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SP 26"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sp26/system.h b/testsuites/sptests/sp26/system.h index 4a1a5e6479..13f0a8169e 100644 --- a/testsuites/sptests/sp26/system.h +++ b/testsuites/sptests/sp26/system.h @@ -34,20 +34,18 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -void task1(void); +void task1( void ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_EXTRA_TASK_STACKS (5 * 3 * RTEMS_MINIMUM_STACK_SIZE) -#define CONFIGURE_MAXIMUM_TASKS 5 -#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_EXTRA_TASK_STACKS ( 5 * 3 * RTEMS_MINIMUM_STACK_SIZE ) +#define CONFIGURE_MAXIMUM_TASKS 5 +#define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -57,8 +55,8 @@ void task1(void); /* global variables */ -TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */ #define BASE_PRIORITY 140 diff --git a/testsuites/sptests/sp26/task1.c b/testsuites/sptests/sp26/task1.c index 91b4796119..68fa9ce487 100644 --- a/testsuites/sptests/sp26/task1.c +++ b/testsuites/sptests/sp26/task1.c @@ -36,115 +36,122 @@ static rtems_id taskId1; static rtems_id taskId2; -rtems_interval ticksPerSecond; +rtems_interval ticksPerSecond; #include "system.h" -static int -isSuspended (rtems_id tid) +static int isSuspended( rtems_id tid ) { rtems_status_code sc; - sc = rtems_task_is_suspended (tid); - if (sc == RTEMS_ALREADY_SUSPENDED) + sc = rtems_task_is_suspended( tid ); + if ( sc == RTEMS_ALREADY_SUSPENDED ) { return 1; - if (sc != RTEMS_SUCCESSFUL) - printf ("rtems_task_is_suspended: %s\n", rtems_status_text (sc)); + } + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "rtems_task_is_suspended: %s\n", rtems_status_text( sc ) ); + } return 0; } -static void -subTask1 (rtems_task_argument arg) +static void subTask1( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - rtems_task_wake_after (ticksPerSecond * 3); - sc = rtems_event_send (taskId2, 1); - if (sc != RTEMS_SUCCESSFUL) { - printf ("subTask1 - Can't send event (%d)\n", sc); - rtems_task_suspend (RTEMS_SELF); + rtems_task_wake_after( ticksPerSecond * 3 ); + sc = rtems_event_send( taskId2, 1 ); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "subTask1 - Can't send event (%d)\n", sc ); + rtems_task_suspend( RTEMS_SELF ); } - rtems_task_wake_after (ticksPerSecond * 3); - printf ("subTask1 - Event sent\n"); - rtems_task_suspend (RTEMS_SELF); - printf ("subTask1 - Back to task 1\n"); - rtems_task_wake_after (ticksPerSecond * 3); - rtems_task_suspend (RTEMS_SELF); + rtems_task_wake_after( ticksPerSecond * 3 ); + printf( "subTask1 - Event sent\n" ); + rtems_task_suspend( RTEMS_SELF ); + printf( "subTask1 - Back to task 1\n" ); + rtems_task_wake_after( ticksPerSecond * 3 ); + rtems_task_suspend( RTEMS_SELF ); } -static void -subTask2 (rtems_task_argument arg) +static void subTask2( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - rtems_event_set ev; + rtems_event_set ev; - rtems_task_wake_after (ticksPerSecond * 1); + rtems_task_wake_after( ticksPerSecond * 1 ); sc = rtems_event_receive( 1, - RTEMS_WAIT|RTEMS_EVENT_ANY, + RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &ev ); - if (sc != RTEMS_SUCCESSFUL) { - printf ("subTask2 - Can't receive event (%d)\n", sc); - rtems_task_suspend (RTEMS_SELF); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "subTask2 - Can't receive event (%d)\n", sc ); + rtems_task_suspend( RTEMS_SELF ); } - printf ("subTask2 - Task 1 suspended? - should be 0: %d\n", - isSuspended (taskId1)); - rtems_task_wake_after (ticksPerSecond * 4); - printf ("subTask2 - Task 1 suspended? - should be 1: %d\n", - isSuspended (taskId1)); - rtems_task_resume (taskId1); - printf ("subTask2 - Task 1 suspended? - should be 0: %d\n", - isSuspended (taskId1)); - rtems_task_wake_after (ticksPerSecond * 4); - printf ("subTask2 - Task 1 suspended? - should be 1: %d\n", - isSuspended (taskId1)); + printf( + "subTask2 - Task 1 suspended? - should be 0: %d\n", + isSuspended( taskId1 ) + ); + rtems_task_wake_after( ticksPerSecond * 4 ); + printf( + "subTask2 - Task 1 suspended? - should be 1: %d\n", + isSuspended( taskId1 ) + ); + rtems_task_resume( taskId1 ); + printf( + "subTask2 - Task 1 suspended? - should be 0: %d\n", + isSuspended( taskId1 ) + ); + rtems_task_wake_after( ticksPerSecond * 4 ); + printf( + "subTask2 - Task 1 suspended? - should be 1: %d\n", + isSuspended( taskId1 ) + ); TEST_END(); rtems_test_exit( 0 ); } -static void -createTask (char c, rtems_id *tid) +static void createTask( char c, rtems_id *tid ) { rtems_status_code sc; - sc = rtems_task_create (rtems_build_name('S','u','b',c), + sc = rtems_task_create( + rtems_build_name( 'S', 'u', 'b', c ), RTEMS_MAXIMUM_PRIORITY - 1u, RTEMS_MINIMUM_STACK_SIZE * 4, - RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0), - RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL, - tid); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't create task (%d)\n", sc); - rtems_task_suspend (RTEMS_SELF); + RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR | + RTEMS_INTERRUPT_LEVEL( 0 ), + RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, + tid + ); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "Can't create task (%d)\n", sc ); + rtems_task_suspend( RTEMS_SELF ); } } -static void -startTask (rtems_id tid, rtems_task_entry entry_point) +static void startTask( rtems_id tid, rtems_task_entry entry_point ) { rtems_status_code sc; - sc = rtems_task_start (tid, entry_point, 0); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't start task (%d)\n", sc); - rtems_task_suspend (RTEMS_SELF); + sc = rtems_task_start( tid, entry_point, 0 ); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "Can't start task (%d)\n", sc ); + rtems_task_suspend( RTEMS_SELF ); } } -void -task1 (void) +void task1( void ) { ticksPerSecond = rtems_clock_get_ticks_per_second(); - createTask ('1', &taskId1); - createTask ('2', &taskId2); - startTask (taskId1, subTask1); - startTask (taskId2, subTask2); - rtems_task_suspend (RTEMS_SELF); + createTask( '1', &taskId1 ); + createTask( '2', &taskId2 ); + startTask( taskId1, subTask1 ); + startTask( taskId2, subTask2 ); + rtems_task_suspend( RTEMS_SELF ); } diff --git a/testsuites/sptests/sp27/sp27impl.h b/testsuites/sptests/sp27/sp27impl.h index 734db4a3ec..ff7ddc57ee 100644 --- a/testsuites/sptests/sp27/sp27impl.h +++ b/testsuites/sptests/sp27/sp27impl.h @@ -39,106 +39,108 @@ #include /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -void starttask(int arg); -rtems_task subtask(rtems_task_argument arg); -void doTest(void); +rtems_task Init( rtems_task_argument argument ); +void starttask( int arg ); +rtems_task subtask( rtems_task_argument arg ); +void doTest( void ); #define NTASK 4 -#if defined(USE_COUNTING_SEMAPHORE) +#if defined( USE_COUNTING_SEMAPHORE ) #define TEST_NAME "27a" #define TEST_SEMAPHORE_TYPE "counting" #define TEST_SEMAPHORE_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES #else - #define TEST_NAME "27" - #define TEST_SEMAPHORE_TYPE "binary" - #define TEST_SEMAPHORE_ATTRIBUTES (RTEMS_LOCAL| \ - RTEMS_BINARY_SEMAPHORE|RTEMS_NO_INHERIT_PRIORITY| \ - RTEMS_NO_PRIORITY_CEILING|RTEMS_FIFO) + #define TEST_NAME "27" + #define TEST_SEMAPHORE_TYPE "binary" + #define TEST_SEMAPHORE_ATTRIBUTES \ + ( RTEMS_LOCAL | RTEMS_BINARY_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | \ + RTEMS_NO_PRIORITY_CEILING | RTEMS_FIFO ) #endif const char rtems_test_name[] = "SP " TEST_NAME; -rtems_id semaphore; -volatile int flags[NTASK]; +rtems_id semaphore; +volatile int flags[ NTASK ]; -rtems_task subtask( - rtems_task_argument arg -) +rtems_task subtask( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - for (;;) { - flags[arg]++; - sc = rtems_semaphore_obtain(semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc == RTEMS_SUCCESSFUL) - puts("Obtained semaphore -- and should not have done so!"); - else if (sc != RTEMS_UNSATISFIED) - printf("Can't get semaphore: %s\n", rtems_status_text(sc)); + for ( ;; ) { + flags[ arg ]++; + sc = rtems_semaphore_obtain( semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + if ( sc == RTEMS_SUCCESSFUL ) { + puts( "Obtained semaphore -- and should not have done so!" ); + } else if ( sc != RTEMS_UNSATISFIED ) { + printf( "Can't get semaphore: %s\n", rtems_status_text( sc ) ); + } } } -void starttask( - int arg -) +void starttask( int arg ) { (void) arg; - rtems_id tid; - rtems_status_code sc; + rtems_id tid; + rtems_status_code sc; rtems_task_priority priority; - rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); - sc = rtems_task_create(rtems_build_name('S', 'R', 'V', arg + 'A'), + rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority ); + sc = rtems_task_create( + rtems_build_name( 'S', 'R', 'V', arg + 'A' ), priority, RTEMS_MINIMUM_STACK_SIZE, - RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0), - RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL, - &tid); + RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR | + RTEMS_INTERRUPT_LEVEL( 0 ), + RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, + &tid + ); directive_failed( sc, "task create" ); - sc = rtems_task_start(tid, subtask, (rtems_task_argument) arg); + sc = rtems_task_start( tid, subtask, (rtems_task_argument) arg ); directive_failed( sc, "task start" ); } -void doTest(void) +void doTest( void ) { rtems_status_code sc; int pass, i; sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'F'), + rtems_build_name( 'S', 'E', 'M', 'F' ), 0, TEST_SEMAPHORE_ATTRIBUTES, 0, - &semaphore); + &semaphore + ); directive_failed( sc, "semaphore create" ); - for (i = 0 ; i < NTASK ; i++) - flags[i] = 0; + for ( i = 0; i < NTASK; i++ ) { + flags[ i ] = 0; + } - for (i = 0 ; i < NTASK ; i++) - starttask(i); + for ( i = 0; i < NTASK; i++ ) { + starttask( i ); + } - for (pass = 1 ; pass < 10 ; pass++) { - rtems_task_wake_after(1); - for (i = 0 ; i < NTASK ; i++) { - if (flags[i] != pass) - printf("flags[%d] = %d -- expected %d\n", i, flags[i], pass); + for ( pass = 1; pass < 10; pass++ ) { + rtems_task_wake_after( 1 ); + for ( i = 0; i < NTASK; i++ ) { + if ( flags[ i ] != pass ) { + printf( "flags[%d] = %d -- expected %d\n", i, flags[ i ], pass ); + } } - sc = rtems_semaphore_flush(semaphore); + sc = rtems_semaphore_flush( semaphore ); directive_failed( sc, "semaphore flush" ); } - printf("Flushed all waiting tasks\n" ); + printf( "Flushed all waiting tasks\n" ); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -147,7 +149,7 @@ rtems_task Init( doTest(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /**************** START OF CONFIGURATION INFORMATION ****************/ @@ -159,12 +161,11 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 6 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_TASKS 6 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INIT #include /**************** END OF CONFIGURATION INFORMATION ****************/ - diff --git a/testsuites/sptests/sp29/init.c b/testsuites/sptests/sp29/init.c index 42a3f9205d..3ad794c4ca 100644 --- a/testsuites/sptests/sp29/init.c +++ b/testsuites/sptests/sp29/init.c @@ -33,7 +33,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -43,7 +42,7 @@ const char rtems_test_name[] = "SP 29"; -rtems_task Init (rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); #define CONFIGURE_EXTRA_TASK_STACKS RTEMS_MINIMUM_STACK_SIZE @@ -53,8 +52,8 @@ rtems_task Init (rtems_task_argument argument); #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 #define CONFIGURE_INIT @@ -67,142 +66,145 @@ rtems_task Init (rtems_task_argument argument); #include "tmacros.h" rtems_interval ticksPerSecond; -rtems_task subtask(rtems_task_argument arg); -void startTask(rtems_id arg); +rtems_task subtask( rtems_task_argument arg ); +void startTask( rtems_id arg ); -rtems_task -subtask (rtems_task_argument arg) +rtems_task subtask( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - rtems_id sem = (rtems_id)arg; + rtems_id sem = (rtems_id) arg; - for (;;) { - rtems_task_wake_after (ticksPerSecond * 2); + for ( ;; ) { + rtems_task_wake_after( ticksPerSecond * 2 ); - sc = rtems_semaphore_release (sem); - if (sc != RTEMS_SUCCESSFUL) { + sc = rtems_semaphore_release( sem ); + if ( sc != RTEMS_SUCCESSFUL ) { printf( - "%d: Can't release semaphore: %s\n", __LINE__, - rtems_status_text (sc) + "%d: Can't release semaphore: %s\n", + __LINE__, + rtems_status_text( sc ) ); } } } -void -startTask (rtems_id arg) +void startTask( rtems_id arg ) { rtems_id tid; rtems_status_code sc; - sc = rtems_task_create (rtems_build_name ('S', 'R', 'V', 'A'), + sc = rtems_task_create( + rtems_build_name( 'S', 'R', 'V', 'A' ), RTEMS_MAXIMUM_PRIORITY - 1u, RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_PREEMPT|RTEMS_NO_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0), - RTEMS_NO_FLOATING_POINT|RTEMS_LOCAL, + RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_NO_ASR | + RTEMS_INTERRUPT_LEVEL( 0 ), + RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, &tid ); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't create task: %s\n", rtems_status_text (sc)); - rtems_task_suspend (RTEMS_SELF); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "Can't create task: %s\n", rtems_status_text( sc ) ); + rtems_task_suspend( RTEMS_SELF ); } - sc = rtems_task_start (tid, subtask, arg); - if (sc != RTEMS_SUCCESSFUL) { - printf ("Can't start task: %s\n", rtems_status_text (sc)); - rtems_task_suspend (RTEMS_SELF); + sc = rtems_task_start( tid, subtask, arg ); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "Can't start task: %s\n", rtems_status_text( sc ) ); + rtems_task_suspend( RTEMS_SELF ); } } -rtems_task Init (rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - int i; - rtems_id semrec, semnorec; + int i; + rtems_id semrec, semnorec; rtems_status_code sc; - rtems_interval then, now; + rtems_interval then, now; TEST_BEGIN(); puts( "This test only prints on errors." ); ticksPerSecond = rtems_clock_get_ticks_per_second(); - if (ticksPerSecond <= 0) { + if ( ticksPerSecond <= 0 ) { printf( "Invalid ticks per second: %" PRIdrtems_interval "\n", ticksPerSecond ); - exit (1); + exit( 1 ); } - sc = rtems_semaphore_create (rtems_build_name ('S', 'M', 'r', 'c'), + sc = rtems_semaphore_create( + rtems_build_name( 'S', 'M', 'r', 'c' ), 1, - RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY| \ - RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, + RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | + RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, &semrec ); directive_failed( sc, "create recursive lock" ); - sc = rtems_semaphore_create (rtems_build_name ('S', 'M', 'n', 'c'), + sc = rtems_semaphore_create( + rtems_build_name( 'S', 'M', 'n', 'c' ), 1, - RTEMS_PRIORITY|RTEMS_SIMPLE_BINARY_SEMAPHORE|RTEMS_NO_INHERIT_PRIORITY| \ - RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, + RTEMS_PRIORITY | RTEMS_SIMPLE_BINARY_SEMAPHORE | + RTEMS_NO_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, &semnorec ); directive_failed( sc, "create non-recursive lock" ); - sc = rtems_semaphore_obtain (semrec, RTEMS_NO_WAIT, 0); + sc = rtems_semaphore_obtain( semrec, RTEMS_NO_WAIT, 0 ); directive_failed( sc, "obtain recursive lock" ); - sc = rtems_semaphore_obtain (semrec, RTEMS_NO_WAIT, 0); + sc = rtems_semaphore_obtain( semrec, RTEMS_NO_WAIT, 0 ); directive_failed( sc, "reobtain recursive lock" ); - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + sc = rtems_semaphore_obtain( semnorec, RTEMS_NO_WAIT, 0 ); directive_failed( sc, "reobtain recursive lock" ); - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc == RTEMS_SUCCESSFUL) { + sc = rtems_semaphore_obtain( semnorec, RTEMS_NO_WAIT, 0 ); + if ( sc == RTEMS_SUCCESSFUL ) { printf( "%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", __LINE__ ); - rtems_test_exit(1); + rtems_test_exit( 1 ); } - sc = rtems_semaphore_release (semnorec); + sc = rtems_semaphore_release( semnorec ); directive_failed( sc, "release non-recursive lock" ); - sc = rtems_semaphore_release (semnorec); + sc = rtems_semaphore_release( semnorec ); directive_failed( sc, "re-release non-recursive lock" ); - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + sc = rtems_semaphore_obtain( semnorec, RTEMS_NO_WAIT, 0 ); directive_failed( sc, "obtain non-recursive lock" ); - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); - if (sc == RTEMS_SUCCESSFUL) { + sc = rtems_semaphore_obtain( semnorec, RTEMS_NO_WAIT, 0 ); + if ( sc == RTEMS_SUCCESSFUL ) { printf( "%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", __LINE__ ); - } else if (sc != RTEMS_UNSATISFIED) { + } else if ( sc != RTEMS_UNSATISFIED ) { printf( "%d: Reobtain non-recursive-lock semaphore failed, but error is " - "%d (%s), not RTEMS_UNSATISFIED.\n", + "%d (%s), not RTEMS_UNSATISFIED.\n", __LINE__, sc, - rtems_status_text (sc) + rtems_status_text( sc ) ); } - sc = rtems_semaphore_release (semnorec); + sc = rtems_semaphore_release( semnorec ); directive_failed( sc, "release non-recursive lock" ); - sc = rtems_semaphore_release (semnorec); + sc = rtems_semaphore_release( semnorec ); directive_failed( sc, "rerelease non-recursive lock" ); - sc = rtems_semaphore_obtain (semnorec, RTEMS_NO_WAIT, 0); + sc = rtems_semaphore_obtain( semnorec, RTEMS_NO_WAIT, 0 ); directive_failed( sc, "obtain non-recursive lock" ); /* @@ -210,59 +212,55 @@ rtems_task Init (rtems_task_argument ignored) * Then the timeout error will be returned. */ then = rtems_clock_get_ticks_since_boot(); - sc = rtems_semaphore_obtain (semnorec, RTEMS_WAIT, 5); + sc = rtems_semaphore_obtain( semnorec, RTEMS_WAIT, 5 ); now = rtems_clock_get_ticks_since_boot(); - if (sc == RTEMS_SUCCESSFUL) { + if ( sc == RTEMS_SUCCESSFUL ) { printf( "%d: Reobtain non-recursive-lock semaphore -- and should not have.\n", __LINE__ ); - } else if (sc != RTEMS_TIMEOUT) { + } else if ( sc != RTEMS_TIMEOUT ) { printf( "%d: Reobtain non-recursive-lock semaphore failed, but error is " - "%d (%s), not RTEMS_TIMEOUT.\n", + "%d (%s), not RTEMS_TIMEOUT.\n", __LINE__, sc, - rtems_status_text (sc) + rtems_status_text( sc ) ); } - if ((then - now) < 4) { + if ( ( then - now ) < 4 ) { printf( "%d: Reobtain non-recursive-lock semaphore failed without timeout.\n", __LINE__ ); } - startTask (semnorec); + startTask( semnorec ); then = rtems_clock_get_ticks_since_boot(); - for (i = 0 ; i < 5 ; i++) { + for ( i = 0; i < 5; i++ ) { rtems_interval diff; - sc = rtems_semaphore_obtain( - semnorec, - RTEMS_WAIT, - RTEMS_NO_TIMEOUT - ); + sc = rtems_semaphore_obtain( semnorec, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); now = rtems_clock_get_ticks_since_boot(); - diff = (now - then); + diff = ( now - then ); then = now; - if (sc != RTEMS_SUCCESSFUL) { + if ( sc != RTEMS_SUCCESSFUL ) { printf( "%d: Failed to obtain non-recursive-lock semaphore: %s\n", __LINE__, - rtems_status_text (sc) + rtems_status_text( sc ) ); - } else if (diff < (rtems_interval) (2 * ticksPerSecond)) { + } else if ( diff < (rtems_interval) ( 2 * ticksPerSecond ) ) { printf( - "%d: Obtained obtain non-recursive-lock semaphore too quickly -- %" - PRIdrtems_interval " ticks not %" PRIdrtems_interval " ticks\n", + "%d: Obtained obtain non-recursive-lock semaphore too quickly -- %" PRIdrtems_interval + " ticks not %" PRIdrtems_interval " ticks\n", __LINE__, diff, - (2 * ticksPerSecond) + ( 2 * ticksPerSecond ) ); } } TEST_END(); - rtems_test_exit (0); + rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/sp30/init.c b/testsuites/sptests/sp30/init.c index b61bbbaccc..d7fb77084e 100644 --- a/testsuites/sptests/sp30/init.c +++ b/testsuites/sptests/sp30/init.c @@ -47,14 +47,12 @@ const char rtems_test_name[] = "SP 30"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_time_of_day time; - uint32_t index; + uint32_t index; rtems_status_code status; TEST_BEGIN(); @@ -67,7 +65,7 @@ rtems_task Init( /* initiate with bad priority */ puts( "timer_initiate_server -- INVALID_PRIORITY" ); status = rtems_timer_initiate_server( - UINT32_C(0x80000000), + UINT32_C( 0x80000000 ), RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); @@ -101,15 +99,15 @@ rtems_task Init( * Create test tasks */ - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); - Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); - Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); + Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); - for ( index = 1 ; index <= 3 ; index++ ) { + for ( index = 1; index <= 3; index++ ) { status = rtems_task_create( Task_name[ index ], 1, @@ -120,14 +118,11 @@ rtems_task Init( ); directive_failed( status, "rtems_task_create loop" ); - status = rtems_timer_create( - Timer_name[ index ], - &Timer_id[ index ] - ); + status = rtems_timer_create( Timer_name[ index ], &Timer_id[ index ] ); directive_failed( status, "rtems_timer_create loop" ); } - for ( index = 1 ; index <= 3 ; index++ ) { + for ( index = 1; index <= 3; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); directive_failed( status, "rtems_task_start loop" ); } diff --git a/testsuites/sptests/sp30/resume.c b/testsuites/sptests/sp30/resume.c index 65d0c95b60..6b4c3e0503 100644 --- a/testsuites/sptests/sp30/resume.c +++ b/testsuites/sptests/sp30/resume.c @@ -41,8 +41,8 @@ #include "system.h" rtems_timer_service_routine Resume_task( - rtems_id timer_id, - void *ignored_address + rtems_id timer_id, + void *ignored_address ) { (void) ignored_address; diff --git a/testsuites/sptests/sp30/system.h b/testsuites/sptests/sp30/system.h index c19bb62423..b7031aeba6 100644 --- a/testsuites/sptests/sp30/system.h +++ b/testsuites/sptests/sp30/system.h @@ -34,41 +34,37 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Resume_task( - rtems_id timer_id, - void *ignored_address + rtems_id timer_id, + void *ignored_address ); -rtems_task Task_1_through_3( - rtems_task_argument argument -); +rtems_task Task_1_through_3( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 5 -#define CONFIGURE_MAXIMUM_TIMERS 3 +#define CONFIGURE_MAXIMUM_TASKS 5 +#define CONFIGURE_MAXIMUM_TIMERS 3 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 4 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 4 ]; /* array of timer names */ /* end of include file */ diff --git a/testsuites/sptests/sp30/task1.c b/testsuites/sptests/sp30/task1.c index 4891dab141..0637200461 100644 --- a/testsuites/sptests/sp30/task1.c +++ b/testsuites/sptests/sp30/task1.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_1_through_3( - rtems_task_argument argument -) +rtems_task Task_1_through_3( rtems_task_argument argument ) { rtems_id tid; rtems_time_of_day time; @@ -52,10 +50,10 @@ rtems_task Task_1_through_3( status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident of self" ); - while ( FOREVER ) { + while ( FOREVER ) { status = rtems_timer_server_fire_after( Timer_id[ argument ], - (task_number( tid ) - 1) * 5 * rtems_clock_get_ticks_per_second(), + ( task_number( tid ) - 1 ) * 5 * rtems_clock_get_ticks_per_second(), Resume_task, (void *) &tid ); diff --git a/testsuites/sptests/sp31/delay.c b/testsuites/sptests/sp31/delay.c index fa7301055b..33eee45b9f 100644 --- a/testsuites/sptests/sp31/delay.c +++ b/testsuites/sptests/sp31/delay.c @@ -41,8 +41,8 @@ #include "system.h" rtems_timer_service_routine Delayed_resume( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; diff --git a/testsuites/sptests/sp31/init.c b/testsuites/sptests/sp31/init.c index d3cd6007d0..70bbc223ea 100644 --- a/testsuites/sptests/sp31/init.c +++ b/testsuites/sptests/sp31/init.c @@ -47,14 +47,12 @@ const char rtems_test_name[] = "SP 31"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_time_of_day time; - rtems_status_code status; + rtems_time_of_day time; + rtems_status_code status; TEST_BEGIN(); @@ -70,7 +68,7 @@ rtems_task Init( ); directive_failed( status, "rtems_timer_initiate_server" ); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); diff --git a/testsuites/sptests/sp31/system.h b/testsuites/sptests/sp31/system.h index 7cc1ac7a27..db2c419ca0 100644 --- a/testsuites/sptests/sp31/system.h +++ b/testsuites/sptests/sp31/system.h @@ -34,44 +34,40 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_resume( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); void Print_time( void ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_TIMERS 2 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_TIMERS 2 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 3 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 3 ]; /* array of timer names */ /* end of include file */ diff --git a/testsuites/sptests/sp31/task1.c b/testsuites/sptests/sp31/task1.c index a535188f38..b37824775d 100644 --- a/testsuites/sptests/sp31/task1.c +++ b/testsuites/sptests/sp31/task1.c @@ -37,15 +37,15 @@ #include rtems_timer_service_routine Should_not_fire_TSR( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); volatile int TSR_fired; rtems_timer_service_routine Should_not_fire_TSR( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -55,8 +55,8 @@ rtems_timer_service_routine Should_not_fire_TSR( } static rtems_timer_service_routine Do_nothing( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -65,19 +65,17 @@ static rtems_timer_service_routine Do_nothing( /* Do nothing */ } -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; - rtems_id tmid; - rtems_id tmid2; - rtems_time_of_day time; - rtems_status_code status; - rtems_timer_information info; + rtems_id tmid; + rtems_id tmid2; + rtems_time_of_day time; + rtems_status_code status; + rtems_timer_information info; -/* Get id */ + /* Get id */ puts( "TA1 - rtems_timer_ident - identing timer 1" ); status = rtems_timer_ident( Timer_name[ 1 ], &tmid ); @@ -89,13 +87,17 @@ rtems_task Task_1( directive_failed( status, "rtems_timer_ident" ); printf( "TA1 - timer 2 has id (0x%" PRIxrtems_id ")\n", tmid2 ); -/* make sure insertion does not unintentionally fire a timer per PR147 */ + /* make sure insertion does not unintentionally fire a timer per PR147 */ TSR_fired = 0; puts( "TA1 - rtems_timer_server_fire_after - 1 second" ); status = rtems_timer_server_fire_after( - tmid, rtems_clock_get_ticks_per_second(), Should_not_fire_TSR, NULL ); + tmid, + rtems_clock_get_ticks_per_second(), + Should_not_fire_TSR, + NULL + ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_task_wake_after - 1/2 second" ); @@ -105,12 +107,16 @@ rtems_task Task_1( directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second" ); status = rtems_timer_server_fire_after( - tmid2, rtems_clock_get_ticks_per_second() / 2, Should_not_fire_TSR, NULL ); + tmid2, + rtems_clock_get_ticks_per_second() / 2, + Should_not_fire_TSR, + NULL + ); directive_failed( status, "rtems_timer_server_fire_after" ); if ( TSR_fired ) { puts( "TA1 - TSR fired and should not have!" ); - rtems_test_exit(1); + rtems_test_exit( 1 ); } puts( "TA1 - rtems_timer_cancel - timer 1" ); @@ -121,16 +127,23 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid2 ); directive_failed( status, "rtems_timer_cancel" ); - -/* now check that rescheduling an active timer works OK. */ + /* now check that rescheduling an active timer works OK. */ puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" ); status = rtems_timer_server_fire_after( - tmid, 30 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); + tmid, + 30 * rtems_clock_get_ticks_per_second(), + Delayed_resume, + NULL + ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" ); status = rtems_timer_server_fire_after( - tmid2, 60 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); + tmid2, + 60 * rtems_clock_get_ticks_per_second(), + Delayed_resume, + NULL + ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); @@ -145,7 +158,11 @@ rtems_task Task_1( puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" ); status = rtems_timer_server_fire_after( - tmid2, 60 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); + tmid2, + 60 * rtems_clock_get_ticks_per_second(), + Delayed_resume, + NULL + ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); @@ -161,14 +178,18 @@ rtems_task Task_1( puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" ); status = rtems_timer_server_fire_after( - tmid2, 60 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); + tmid2, + 60 * rtems_clock_get_ticks_per_second(), + Delayed_resume, + NULL + ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); directive_failed( status, "rtems_timer_get_information" ); printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", - info.start_time + info.initial + info.start_time + info.initial ); puts( "TA1 - rtems_timer_cancel - timer 1" ); @@ -179,7 +200,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid2 ); directive_failed( status, "rtems_timer_cancel" ); -/* after which is allowed to fire */ + /* after which is allowed to fire */ Print_time(); @@ -198,7 +219,7 @@ rtems_task Task_1( Print_time(); -/* after which is reset and allowed to fire */ + /* after which is reset and allowed to fire */ puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_after( @@ -236,7 +257,7 @@ rtems_task Task_1( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); -/* after which is canceled */ + /* after which is canceled */ puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_after( @@ -251,7 +272,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); -/* when which is allowed to fire */ + /* when which is allowed to fire */ Print_time(); @@ -270,7 +291,7 @@ rtems_task Task_1( Print_time(); -/* when which is canceled */ + /* when which is canceled */ status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); @@ -291,7 +312,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); -/* TOD timer insert with non empty TOD timer chain */ + /* TOD timer insert with non empty TOD timer chain */ status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); @@ -322,7 +343,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid2 ); directive_failed( status, "rtems_timer_cancel" ); -/* TOD chain processing with time wrap */ + /* TOD chain processing with time wrap */ time.second = 30; @@ -352,7 +373,7 @@ rtems_task Task_1( status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); -/* delete */ + /* delete */ puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); diff --git a/testsuites/sptests/sp32/init.c b/testsuites/sptests/sp32/init.c index a9d938d078..b8987be40e 100644 --- a/testsuites/sptests/sp32/init.c +++ b/testsuites/sptests/sp32/init.c @@ -30,78 +30,72 @@ #include "config.h" #endif -#include /* includes bsp.h, stdio, etc... */ +#include /* includes bsp.h, stdio, etc... */ const char rtems_test_name[] = "SP 32"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument ignored -) { +rtems_task Init( rtems_task_argument ignored ) +{ (void) ignored; - rtems_status_code status; - rtems_interval timestamps[6], - wantintervals[5] = { 1, 50, 200, 25, 3 }; - rtems_name period_name = rtems_build_name('P','E','R','a'); - rtems_id period_id; - int loopy; + rtems_status_code status; + rtems_interval timestamps[ 6 ], wantintervals[ 5 ] = { 1, 50, 200, 25, 3 }; + rtems_name period_name = rtems_build_name( 'P', 'E', 'R', 'a' ); + rtems_id period_id; + int loopy; TEST_BEGIN(); /* create period */ - status = rtems_rate_monotonic_create( - period_name, - &period_id - ); - directive_failed(status, "rate_monotonic_create"); + status = rtems_rate_monotonic_create( period_name, &period_id ); + directive_failed( status, "rate_monotonic_create" ); /* start period with initial value */ - status = rtems_rate_monotonic_period( period_id, wantintervals[0] ); - directive_failed(status, "rate_monotonic_period #1"); + status = rtems_rate_monotonic_period( period_id, wantintervals[ 0 ] ); + directive_failed( status, "rate_monotonic_period #1" ); /* get our first timestamp */ - timestamps[0] = rtems_clock_get_ticks_since_boot(); + timestamps[ 0 ] = rtems_clock_get_ticks_since_boot(); /* loop through and gather more timestamps */ - for (loopy = 1; loopy < 5; loopy++) { + for ( loopy = 1; loopy < 5; loopy++ ) { + status = rtems_rate_monotonic_period( period_id, wantintervals[ loopy ] ); + directive_failed( status, "rate_monotonic_period #2" ); - status = rtems_rate_monotonic_period( period_id, wantintervals[loopy] ); - directive_failed(status, "rate_monotonic_period #2"); - - timestamps[loopy] = rtems_clock_get_ticks_since_boot(); + timestamps[ loopy ] = rtems_clock_get_ticks_since_boot(); } /* block one last time */ status = rtems_rate_monotonic_period( period_id, 1 ); - directive_failed(status, "rate_monotonic_period #3"); + directive_failed( status, "rate_monotonic_period #3" ); /* get one last timestamp */ - timestamps[loopy] = rtems_clock_get_ticks_since_boot(); + timestamps[ loopy ] = rtems_clock_get_ticks_since_boot(); /* cancel the period */ - status = rtems_rate_monotonic_cancel(period_id); - directive_failed(status, "rate_monotonic_cancel"); + status = rtems_rate_monotonic_cancel( period_id ); + directive_failed( status, "rate_monotonic_cancel" ); /* delete it */ - status = rtems_rate_monotonic_delete(period_id); - directive_failed(status, "rate_monotonic_delete"); + status = rtems_rate_monotonic_delete( period_id ); + directive_failed( status, "rate_monotonic_delete" ); /* tabulate and print results */ - for (loopy = 0; loopy < 5; loopy++) { + for ( loopy = 0; loopy < 5; loopy++ ) { printf( - "period %d: measured %" PRIdrtems_interval " tick(s), wanted %" - PRIdrtems_interval "\n", + "period %d: measured %" PRIdrtems_interval + " tick(s), wanted %" PRIdrtems_interval "\n", loopy, - timestamps[loopy+1] - timestamps[loopy], - wantintervals[loopy] + timestamps[ loopy + 1 ] - timestamps[ loopy ], + wantintervals[ loopy ] ); } TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -110,12 +104,11 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 #define CONFIGURE_MICROSECONDS_PER_TICK 100000 #define CONFIGURE_INIT #include - diff --git a/testsuites/sptests/sp33/init.c b/testsuites/sptests/sp33/init.c index 47f486528f..6e2fc458db 100644 --- a/testsuites/sptests/sp33/init.c +++ b/testsuites/sptests/sp33/init.c @@ -30,12 +30,12 @@ #include "config.h" #endif -#include /* includes bsp.h, stdio, etc... */ +#include /* includes bsp.h, stdio, etc... */ const char rtems_test_name[] = "SP 33"; /* prototype */ -rtems_task Init (rtems_task_argument ignored); +rtems_task Init( rtems_task_argument ignored ); #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -43,23 +43,19 @@ rtems_task Init (rtems_task_argument ignored); #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 5 -#define CONFIGURE_MAXIMUM_BARRIERS 1 +#define CONFIGURE_MAXIMUM_TASKS 5 +#define CONFIGURE_MAXIMUM_BARRIERS 1 #define CONFIGURE_INIT -rtems_task Waiter( - rtems_task_argument number -); +rtems_task Waiter( rtems_task_argument number ); -rtems_id Barrier; +rtems_id Barrier; int SuccessfulCase; int DeletedCase; -rtems_task Waiter( - rtems_task_argument number -) +rtems_task Waiter( rtems_task_argument number ) { rtems_status_code status; int waiter = (int) number; @@ -70,7 +66,7 @@ rtems_task Waiter( printf( "Waiter %d back from barrier\n", waiter ); if ( SuccessfulCase == TRUE ) { - directive_failed(status, "rtems_barrier_wait"); + directive_failed( status, "rtems_barrier_wait" ); } else if ( DeletedCase == TRUE ) { fatal_directive_status( status, @@ -84,18 +80,16 @@ rtems_task Waiter( #include -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - rtems_name name = rtems_build_name('B','A','R','1'); + rtems_name name = rtems_build_name( 'B', 'A', 'R', '1' ); uint32_t released; uint32_t waiting; rtems_id testId; - rtems_id Tasks[CONFIGURE_MAXIMUM_TASKS-1]; + rtems_id Tasks[ CONFIGURE_MAXIMUM_TASKS - 1 ]; uint32_t i; TEST_BEGIN(); @@ -136,7 +130,10 @@ rtems_task Init( /* Create barrier with automatic release and 0 maximum waiters */ puts( "Create barrier with automatic release and 0 max waiters" ); status = rtems_barrier_create( - name, RTEMS_BARRIER_AUTOMATIC_RELEASE, 0, &Barrier + name, + RTEMS_BARRIER_AUTOMATIC_RELEASE, + 0, + &Barrier ); fatal_directive_status( status, @@ -147,7 +144,11 @@ rtems_task Init( /* create barrier with bad name */ puts( "rtems_barrier_create - bad name - INVALID_NAME" ); status = rtems_barrier_create( - 0, RTEMS_BARRIER_AUTOMATIC_RELEASE, 1, &Barrier); + 0, + RTEMS_BARRIER_AUTOMATIC_RELEASE, + 1, + &Barrier + ); fatal_directive_status( status, RTEMS_INVALID_NAME, @@ -156,7 +157,12 @@ rtems_task Init( /* create barrier with bad id return address */ puts( "rtems_barrier_create - NULL barrier ID - INVALID_ADDRESS" ); - status = rtems_barrier_create(name, RTEMS_BARRIER_AUTOMATIC_RELEASE, 1, NULL); + status = rtems_barrier_create( + name, + RTEMS_BARRIER_AUTOMATIC_RELEASE, + 1, + NULL + ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -166,7 +172,7 @@ rtems_task Init( /* Create barrier */ puts( "rtems_barrier_create - OK" ); status = rtems_barrier_create( name, RTEMS_DEFAULT_ATTRIBUTES, 0, &Barrier ); - directive_failed(status, "rtems_barrier_create"); + directive_failed( status, "rtems_barrier_create" ); /* Check for creating too many */ puts( "rtems_barrier_create - too many" ); @@ -179,7 +185,7 @@ rtems_task Init( puts( "Check barrier ident" ); status = rtems_barrier_ident( name, &testId ); - directive_failed(status, "rtems_barrier_ident"); + directive_failed( status, "rtems_barrier_ident" ); if ( testId != Barrier ) { printf( "ERROR -- rtems_barrier_create -- did not get Id expected\n" ); exit( 0 ); @@ -204,13 +210,13 @@ rtems_task Init( /* Release no tasks */ status = rtems_barrier_release( Barrier, &released ); - directive_failed(status, "rtems_barrier_release"); + directive_failed( status, "rtems_barrier_release" ); if ( released != 0 ) { printf( "ERROR -- rtems_barrier_release -- released != 0, = %" PRIu32, released ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* Get number waiting with bad return pointer */ @@ -226,22 +232,22 @@ rtems_task Init( /* number of waiting tasks must be 0 */ status = rtems_barrier_get_number_waiting( Barrier, &waiting ); - directive_failed(status, "rtems_barrier_get_number_waiting"); + directive_failed( status, "rtems_barrier_get_number_waiting" ); if ( waiting != 0 ) { printf( "ERROR -- rtems_barrier_get_number_waiting -- waiting != 0, = %" PRIu32, waiting ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* Create some tasks to wait for the barrier */ SuccessfulCase = TRUE; - DeletedCase = FALSE; + DeletedCase = FALSE; puts( "\n*** Testing manual release of barrier ***" ); - for (i=0 ; i<(CONFIGURE_MAXIMUM_TASKS-1) ; i++) { + for ( i = 0; i < ( CONFIGURE_MAXIMUM_TASKS - 1 ); i++ ) { status = rtems_task_create( - rtems_build_name('W','A','I','T'), + rtems_build_name( 'W', 'A', 'I', 'T' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, @@ -256,61 +262,60 @@ rtems_task Init( puts( "Delay to let Waiters block" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); - directive_failed(status, "rtems_task_wake_after"); + directive_failed( status, "rtems_task_wake_after" ); /* Gets the number of tasks that are waiting at the barrier */ puts( "Getting the number of tasks that are waiting at the barrier" ); status = rtems_barrier_get_number_waiting( Barrier, &waiting ); - printf("Number of tasks waiting at the barrier: %" PRIu32 "\n", waiting); - directive_failed(status, "rtems_barrier_get_number_waiting" ); + printf( "Number of tasks waiting at the barrier: %" PRIu32 "\n", waiting ); + directive_failed( status, "rtems_barrier_get_number_waiting" ); if ( waiting != ( CONFIGURE_MAXIMUM_TASKS - 1 ) ) { printf( "ERROR -- rtems_barrier_get_number_waiting -- waiting != %d, = %" PRIu32, ( CONFIGURE_MAXIMUM_TASKS - 1 ), waiting ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* Release tasks which were waiting */ puts( "Releasing tasks" ); status = rtems_barrier_release( Barrier, &released ); - directive_failed(status, "rtems_barrier_release"); - if ( released != (CONFIGURE_MAXIMUM_TASKS-1) ) { + directive_failed( status, "rtems_barrier_release" ); + if ( released != ( CONFIGURE_MAXIMUM_TASKS - 1 ) ) { printf( "ERROR -- rtems_barrier_release -- released != %d, = %" PRIu32, - (CONFIGURE_MAXIMUM_TASKS-1), + ( CONFIGURE_MAXIMUM_TASKS - 1 ), released ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "Delay to let Waiters print a message" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); - directive_failed(status, "rtems_task_wake_after"); + directive_failed( status, "rtems_task_wake_after" ); /* Gets the number of tasks that are waiting at the barrier */ puts( "Getting the number of tasks that are waiting at the barrier" ); status = rtems_barrier_get_number_waiting( Barrier, &waiting ); - printf("Number of tasks waiting at the barrier: %" PRIu32 "\n", waiting); - directive_failed(status, "rtems_barrier_get_number_waiting" ); + printf( "Number of tasks waiting at the barrier: %" PRIu32 "\n", waiting ); + directive_failed( status, "rtems_barrier_get_number_waiting" ); if ( waiting != 0 ) { printf( "ERROR -- rtems_barrier_get_number_waiting -- waiting != %d, = %" PRIu32, 0, waiting ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - /* Create some tasks to wait for the barrier */ SuccessfulCase = FALSE; - DeletedCase = TRUE; + DeletedCase = TRUE; puts( "\n*** Testing Deletion of barrier ***" ); - for (i=0 ; i<(CONFIGURE_MAXIMUM_TASKS-1) ; i++) { + for ( i = 0; i < ( CONFIGURE_MAXIMUM_TASKS - 1 ); i++ ) { status = rtems_task_create( - rtems_build_name('W','A','I','T'), + rtems_build_name( 'W', 'A', 'I', 'T' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, @@ -325,30 +330,33 @@ rtems_task Init( puts( "Delay to let Waiters block" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); - directive_failed(status, "rtems_task_wake_after"); + directive_failed( status, "rtems_task_wake_after" ); puts( "rtems_barrier_delete - OK" ); status = rtems_barrier_delete( Barrier ); - directive_failed(status, "rtems_barrier_delete"); + directive_failed( status, "rtems_barrier_delete" ); puts( "Delay to let Waiters print a message" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); - directive_failed(status, "rtems_task_wake_after"); + directive_failed( status, "rtems_task_wake_after" ); /* Create barrier with automatic release */ puts( "rtems_barrier_create - OK" ); status = rtems_barrier_create( - name, RTEMS_BARRIER_AUTOMATIC_RELEASE, CONFIGURE_MAXIMUM_TASKS-1, &Barrier + name, + RTEMS_BARRIER_AUTOMATIC_RELEASE, + CONFIGURE_MAXIMUM_TASKS - 1, + &Barrier ); - directive_failed(status, "rtems_barrier_create"); + directive_failed( status, "rtems_barrier_create" ); /* Create some tasks to wait for the barrier */ SuccessfulCase = TRUE; - DeletedCase = FALSE; + DeletedCase = FALSE; puts( "\n*** Testing automatic release of barrier ***" ); - for (i=0 ; i<(CONFIGURE_MAXIMUM_TASKS-1) ; i++) { + for ( i = 0; i < ( CONFIGURE_MAXIMUM_TASKS - 1 ); i++ ) { status = rtems_task_create( - rtems_build_name('W','A','I','T'), + rtems_build_name( 'W', 'A', 'I', 'T' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, @@ -363,9 +371,9 @@ rtems_task Init( puts( "Delay to let task wait on barrier" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); - directive_failed(status, "rtems_task_wake_after"); + directive_failed( status, "rtems_task_wake_after" ); /* the end */ TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/sp34/changepri.c b/testsuites/sptests/sp34/changepri.c index ecbda94c0f..064dfab61a 100644 --- a/testsuites/sptests/sp34/changepri.c +++ b/testsuites/sptests/sp34/changepri.c @@ -58,34 +58,43 @@ const char rtems_test_name[] = "SP 34"; -rtems_task BlockingTasks(rtems_task_argument arg); -rtems_task Init(rtems_task_argument ignored); -const char *CallerName(void); +rtems_task BlockingTasks( rtems_task_argument arg ); +rtems_task Init( rtems_task_argument ignored ); +const char *CallerName( void ); /* * CallerName -- print the calling tasks name or id as configured */ -const char *CallerName(void) +const char *CallerName( void ) { - static char buffer[32]; + static char buffer[ 32 ]; Thread_Control *executing = _Thread_Get_executing(); -#if defined(TEST_PRINT_TASK_ID) - sprintf( buffer, "0x%08x -- %d", - rtems_task_self(), _Thread_Get_priority( executing ) ); +#if defined( TEST_PRINT_TASK_ID ) + sprintf( + buffer, + "0x%08x -- %d", + rtems_task_self(), + _Thread_Get_priority( executing ) + ); #else volatile union { - uint32_t u; - unsigned char c[4]; + uint32_t u; + unsigned char c[ 4 ]; } TempName; - #if defined(TEST_ON_RTEMS_45) - TempName.u = *(uint32_t *)executing->Object.name; + #if defined( TEST_ON_RTEMS_45 ) + TempName.u = *(uint32_t *) executing->Object.name; #else - TempName.u = executing->Object.name.name_u32; + TempName.u = executing->Object.name.name_u32; #endif - sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control, - TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3], - _Thread_Get_priority( executing ) + sprintf( + buffer, + "%c%c%c%c -- %" PRIdPriority_Control, + TempName.c[ 0 ], + TempName.c[ 1 ], + TempName.c[ 2 ], + TempName.c[ 3 ], + _Thread_Get_priority( executing ) ); #endif return buffer; @@ -94,37 +103,45 @@ const char *CallerName(void) #define NUMBER_OF_BLOCKING_TASKS 5 /* RTEMS ids of blocking threads */ -rtems_id Blockers[NUMBER_OF_BLOCKING_TASKS]; +rtems_id Blockers[ NUMBER_OF_BLOCKING_TASKS ]; /* Semaphore they are all blocked on */ -rtems_id Semaphore; +rtems_id Semaphore; -rtems_task BlockingTasks(rtems_task_argument arg) +rtems_task BlockingTasks( rtems_task_argument arg ) { rtems_status_code status; rtems_task_priority pri = (rtems_task_priority) arg; rtems_task_priority opri; rtems_task_priority npri; - status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &opri); + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &opri + ); directive_failed( status, "rtems_task_set_priority" ); printf( "semaphore_obtain -- BlockingTask %" PRIdrtems_task_priority - " @ pri=%" PRIdrtems_task_priority ") blocks\n", + " @ pri=%" PRIdrtems_task_priority ") blocks\n", pri, opri ); - status = rtems_semaphore_obtain(Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); directive_failed( status, "rtems_semaphore_obtain" ); /* priority should have changed while blocked */ - status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &npri); + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &npri + ); directive_failed( status, "rtems_task_set_priority" ); printf( "semaphore_obtain -- BlockingTask %" PRIdrtems_task_priority - " @ pri=%" PRIdrtems_task_priority ") returns\n", + " @ pri=%" PRIdrtems_task_priority ") returns\n", pri, npri ); @@ -136,43 +153,43 @@ rtems_task BlockingTasks(rtems_task_argument arg) /********************** INITIALIZATION *********************/ /*************************************************************************/ -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; - int i; + rtems_status_code status; + int i; TEST_BEGIN(); /* Create synchronisation semaphore for LocalHwIsr -> Test Tasks */ status = rtems_semaphore_create( - rtems_build_name ('S', 'E', 'M', '1'), /* name */ - 0, /* initial count = 0 */ - RTEMS_LOCAL | - RTEMS_COUNTING_SEMAPHORE | - RTEMS_PRIORITY, + rtems_build_name( 'S', 'E', 'M', '1' ), /* name */ + 0, /* initial count = 0 */ + RTEMS_LOCAL | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, 0, - &Semaphore); /* *id */ + &Semaphore + ); /* *id */ directive_failed( status, "rtems_semaphore_create" ); /* Create and start all tasks in the test */ - for (i = 0; i < NUMBER_OF_BLOCKING_TASKS; i++) { + for ( i = 0; i < NUMBER_OF_BLOCKING_TASKS; i++ ) { status = rtems_task_create( - rtems_build_name('B','L','K','0'+i), /* Name */ - (rtems_task_priority) 2+i, /* Priority */ - RTEMS_MINIMUM_STACK_SIZE*2, /* Stack size (8KB) */ - RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ - RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ - &Blockers[i]); /* Assigned ID */ + rtems_build_name( 'B', 'L', 'K', '0' + i ), /* Name */ + (rtems_task_priority) 2 + i, /* Priority */ + RTEMS_MINIMUM_STACK_SIZE * 2, /* Stack size (8KB) */ + RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ + &Blockers[ i ] + ); /* Assigned ID */ directive_failed( status, "rtems_task_create (BLKn)" ); - printf( "Blockers[%d] Id = 0x%08" PRIxrtems_id "\n", i, Blockers[i] ); + printf( "Blockers[%d] Id = 0x%08" PRIxrtems_id "\n", i, Blockers[ i ] ); status = rtems_task_start( - Blockers[i], + Blockers[ i ], BlockingTasks, - (rtems_task_argument)i + (rtems_task_argument) i ); directive_failed( status, "rtems_task_start (BLKn)" ); } @@ -181,19 +198,19 @@ rtems_task Init(rtems_task_argument ignored) directive_failed( status, "rtems_task_wake_after" ); puts( "rtems_task_set_priority -- invert priorities of tasks" ); - for (i = 0; i < NUMBER_OF_BLOCKING_TASKS; i++) { + for ( i = 0; i < NUMBER_OF_BLOCKING_TASKS; i++ ) { rtems_task_priority opri; rtems_task_priority npri; - npri = (rtems_task_priority) (2 + NUMBER_OF_BLOCKING_TASKS - i - 1); + npri = (rtems_task_priority) ( 2 + NUMBER_OF_BLOCKING_TASKS - i - 1 ); - status = rtems_task_set_priority(Blockers[i], npri, &opri); + status = rtems_task_set_priority( Blockers[ i ], npri, &opri ); directive_failed( status, "rtems_task_set_priority" ); } - for (i = 0; i < NUMBER_OF_BLOCKING_TASKS; i++) { + for ( i = 0; i < NUMBER_OF_BLOCKING_TASKS; i++ ) { puts( "rtems_semaphore_release -- OK" ); - status = rtems_semaphore_release(Semaphore); + status = rtems_semaphore_release( Semaphore ); directive_failed( status, "rtems_semaphore_release" ); status = rtems_task_wake_after( 100 ); @@ -202,7 +219,7 @@ rtems_task Init(rtems_task_argument ignored) /* exit the test */ TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -215,9 +232,9 @@ rtems_task Init(rtems_task_argument ignored) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_EXTRA_TASK_STACKS \ - (RTEMS_MINIMUM_STACK_SIZE * NUMBER_OF_BLOCKING_TASKS) + ( RTEMS_MINIMUM_STACK_SIZE * NUMBER_OF_BLOCKING_TASKS ) -#define CONFIGURE_MAXIMUM_TASKS 6 +#define CONFIGURE_MAXIMUM_TASKS 6 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 #include diff --git a/testsuites/sptests/sp35/priinv.c b/testsuites/sptests/sp35/priinv.c index 4447221cec..081e367b9e 100644 --- a/testsuites/sptests/sp35/priinv.c +++ b/testsuites/sptests/sp35/priinv.c @@ -39,7 +39,7 @@ /* #define TEST_ON_TASK_ID */ /* define this if you are (1) on a ERC32 and (2) want a SW ISR trigger */ -#if defined(__sparc__) +#if defined( __sparc__ ) /* #define TEST_USE_ISR */ #endif @@ -61,47 +61,56 @@ const char rtems_test_name[] = "SP 35"; -#if defined(TEST_EXIT_AFTER_ITERATIONS) +#if defined( TEST_EXIT_AFTER_ITERATIONS ) volatile uint32_t Iterations = 0; #endif -const char *CallerName(void); +const char *CallerName( void ); /* Task entry point prototypes */ -rtems_task Init(rtems_task_argument ignored); -rtems_task Medium_Exec(rtems_task_argument TaskArg); -rtems_task Low_Exec(rtems_task_argument TaskArg); -rtems_task High_Exec(rtems_task_argument TaskArg); -rtems_task LocalHwSim_Exec(rtems_task_argument TaskArg); +rtems_task Init( rtems_task_argument ignored ); +rtems_task Medium_Exec( rtems_task_argument TaskArg ); +rtems_task Low_Exec( rtems_task_argument TaskArg ); +rtems_task High_Exec( rtems_task_argument TaskArg ); +rtems_task LocalHwSim_Exec( rtems_task_argument TaskArg ); /* ISR that signals that HW has completed */ -rtems_isr LocalHwIsr(/*in*/ rtems_vector_number Vector); +rtems_isr LocalHwIsr( /*in*/ rtems_vector_number Vector ); /* Test driver functions */ -void AccessLocalHw(void); -void AccessRemoteHw(void); +void AccessLocalHw( void ); +void AccessRemoteHw( void ); -const char *CallerName(void) +const char *CallerName( void ) { - static char buffer[32]; + static char buffer[ 32 ]; Thread_Control *executing = _Thread_Get_executing(); -#if defined(TEST_PRINT_TASK_ID) - sprintf( buffer, "0x%08x -- %d", - rtems_task_self(), _Thread_Get_priority( executing ) ); +#if defined( TEST_PRINT_TASK_ID ) + sprintf( + buffer, + "0x%08x -- %d", + rtems_task_self(), + _Thread_Get_priority( executing ) + ); #else volatile union { - uint32_t u; - unsigned char c[4]; + uint32_t u; + unsigned char c[ 4 ]; } TempName; - #if defined(TEST_ON_RTEMS_45) - TempName.u = *(uint32_t *)executing->Object.name; + #if defined( TEST_ON_RTEMS_45 ) + TempName.u = *(uint32_t *) executing->Object.name; #else - TempName.u = (uint32_t) executing->Object.name.name_u32; + TempName.u = (uint32_t) executing->Object.name.name_u32; #endif - sprintf( buffer, "%c%c%c%c -- %" PRIdPriority_Control, - TempName.c[0], TempName.c[1], TempName.c[2], TempName.c[3], - _Thread_Get_priority( executing ) + sprintf( + buffer, + "%c%c%c%c -- %" PRIdPriority_Control, + TempName.c[ 0 ], + TempName.c[ 1 ], + TempName.c[ 2 ], + TempName.c[ 3 ], + _Thread_Get_priority( executing ) ); #endif return buffer; @@ -110,190 +119,193 @@ const char *CallerName(void) #define NofMediumTask_C 3 /* RTEMS identifiers */ -rtems_id TaMedium[NofMediumTask_C]; /* Medium-prio tasks accessing */ - /* the common local HW */ -rtems_id TaHwSim; /* HW simulator */ -rtems_id TaLow; /* Low-prio task accessing common */ - /* remote HW */ -rtems_id TaHigh; /* High-prio task accessing common */ - /* remote HW */ - - -rtems_id LocalHwSync_S; /* Syncrhonize task to local HW */ -rtems_id LocalHwAccess_R; /* Execlusive access to the local HW */ -rtems_id RemoteHwAccess_R; /* Execlusive access to the remote HW */ +rtems_id TaMedium[ NofMediumTask_C ]; /* Medium-prio tasks accessing */ + /* the common local HW */ +rtems_id TaHwSim; /* HW simulator */ +rtems_id TaLow; /* Low-prio task accessing common */ + /* remote HW */ +rtems_id TaHigh; /* High-prio task accessing common */ + /* remote HW */ +rtems_id LocalHwSync_S; /* Syncrhonize task to local HW */ +rtems_id LocalHwAccess_R; /* Execlusive access to the local HW */ +rtems_id RemoteHwAccess_R; /* Execlusive access to the remote HW */ /* The following variable triggers simulated HW activity */ volatile bool StartHw = false; -rtems_task Medium_Exec(rtems_task_argument TaskArg) +rtems_task Medium_Exec( rtems_task_argument TaskArg ) { - printf("Medium_Exec (%" PRIdrtems_task_argument ") begins...\n", TaskArg); + printf( "Medium_Exec (%" PRIdrtems_task_argument ") begins...\n", TaskArg ); - rtems_task_wake_after(50); + rtems_task_wake_after( 50 ); - while(1) { + while ( 1 ) { AccessLocalHw(); } /* JRS - task does not get here */ - printf("Medium_Exec (%" PRIdrtems_task_argument ") ends...\n", TaskArg); - while(1) { - rtems_task_wake_after(10000); + printf( "Medium_Exec (%" PRIdrtems_task_argument ") ends...\n", TaskArg ); + while ( 1 ) { + rtems_task_wake_after( 10000 ); } } -rtems_task High_Exec(rtems_task_argument TaskArg) +rtems_task High_Exec( rtems_task_argument TaskArg ) { - printf("High_Exec (%" PRIdrtems_task_argument ") begins...\n", TaskArg); + printf( "High_Exec (%" PRIdrtems_task_argument ") begins...\n", TaskArg ); /* Delay more than the Low-prio task so that Remote HW access resource is * taken before call to AccesRemoteHw. */ - rtems_task_wake_after(250); + rtems_task_wake_after( 250 ); - while(1) { + while ( 1 ) { AccessRemoteHw(); } /* JRS - task does not get here */ - printf("High_Exec (%" PRIdrtems_task_argument ") ends...\n", TaskArg); - while(1) { - rtems_task_wake_after(10000); + printf( "High_Exec (%" PRIdrtems_task_argument ") ends...\n", TaskArg ); + while ( 1 ) { + rtems_task_wake_after( 10000 ); } /* task does not get here */ } -rtems_task Low_Exec(rtems_task_argument TaskArg) +rtems_task Low_Exec( rtems_task_argument TaskArg ) { - printf("Low_Exec (%" PRIdrtems_task_argument ") begins...\n", TaskArg); + printf( "Low_Exec (%" PRIdrtems_task_argument ") begins...\n", TaskArg ); /* Delay less than High-prio task so that we take the remote HW access * resource before it does it. However, delay longer than the mid-prio * tasks so that we know for certain that they have taken control over * the local HW access. */ - rtems_task_wake_after(100); + rtems_task_wake_after( 100 ); - while(1) { + while ( 1 ) { AccessRemoteHw(); } /* JRS - task does not get here */ - printf("Low_Exec (%" PRIdrtems_task_argument ") ends...\n", TaskArg); - while(1) { - rtems_task_wake_after(10000); + printf( "Low_Exec (%" PRIdrtems_task_argument ") ends...\n", TaskArg ); + while ( 1 ) { + rtems_task_wake_after( 10000 ); } } - -rtems_task LocalHwSim_Exec(rtems_task_argument TaskArg) +rtems_task LocalHwSim_Exec( rtems_task_argument TaskArg ) { (void) TaskArg; #if 0 int ISRCount = 0; #endif - printf("LocalHwSim_Exec begins...\n"); + printf( "LocalHwSim_Exec begins...\n" ); - while(1) { - if (StartHw) { + while ( 1 ) { + if ( StartHw ) { /* A test task has activated the HW, wait for a while and then * generate an interrupt */ - rtems_task_wake_after(100); + rtems_task_wake_after( 100 ); StartHw = FALSE; -#if defined(TEST_USE_ISR) - __asm__ volatile ("ta 5"); - __asm__ volatile ("nop"); - __asm__ volatile ("nop"); +#if defined( TEST_USE_ISR ) + __asm__ volatile( "ta 5" ); + __asm__ volatile( "nop" ); + __asm__ volatile( "nop" ); #else LocalHwIsr( 0x85 ); #endif } - } - printf("LocalHwSim_Exec ends...\n"); - while(1) { - rtems_task_wake_after(10000); + printf( "LocalHwSim_Exec ends...\n" ); + while ( 1 ) { + rtems_task_wake_after( 10000 ); } } - -rtems_isr LocalHwIsr(/*in*/ rtems_vector_number Vector) +rtems_isr LocalHwIsr( /*in*/ rtems_vector_number Vector ) { (void) Vector; rtems_status_code status; /* Signal synchroniztion semaphore to invoke waiting task */ - status = rtems_semaphore_release(LocalHwSync_S); - if (status != RTEMS_SUCCESSFUL) { + status = rtems_semaphore_release( LocalHwSync_S ); + if ( status != RTEMS_SUCCESSFUL ) { printf( "LocalHwISR release %d\n", status ); - while(1); /* Error */ + while ( 1 ); /* Error */ } return; } -void AccessLocalHw(void) +void AccessLocalHw( void ) { - rtems_status_code Sts; + rtems_status_code Sts; - printf(" AccessLocalHw called by %s\n", CallerName()); + printf( " AccessLocalHw called by %s\n", CallerName() ); /* Obtain exclusive access to local HW, Start HW, Wait for completion, * Release access */ - Sts = rtems_semaphore_obtain(LocalHwAccess_R, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + Sts = rtems_semaphore_obtain( + LocalHwAccess_R, + RTEMS_WAIT, + RTEMS_NO_TIMEOUT + ); directive_failed( Sts, "rtems_semaphore_obtain(LocalHwAccess_R...)" ); StartHw = TRUE; - Sts = rtems_semaphore_obtain(LocalHwSync_S, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + Sts = rtems_semaphore_obtain( LocalHwSync_S, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); directive_failed( Sts, "rtems_semaphore_obtain(LocalHwAccess_R...)" ); - Sts = rtems_semaphore_release(LocalHwAccess_R); + Sts = rtems_semaphore_release( LocalHwAccess_R ); directive_failed( Sts, "rtems_semaphore_release(LocalHwAccess_R)" ); - printf(" AccessLocalHw returns to %s\n", CallerName()); - #if defined(TEST_EXIT_AFTER_ITERATIONS) - if ( ++Iterations == 10 ) { - TEST_END(); - exit(0); - } + printf( " AccessLocalHw returns to %s\n", CallerName() ); + #if defined( TEST_EXIT_AFTER_ITERATIONS ) + if ( ++Iterations == 10 ) { + TEST_END(); + exit( 0 ); + } #endif return; } -void AccessRemoteHw(void) +void AccessRemoteHw( void ) { - rtems_status_code Sts; + rtems_status_code Sts; - printf("AccessRemoteHw called by %s\n", CallerName()); + printf( "AccessRemoteHw called by %s\n", CallerName() ); /* Obtain exclusive access to remote HW, Start HW, Wait for completion, * Release access */ - Sts = rtems_semaphore_obtain(RemoteHwAccess_R, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + Sts = rtems_semaphore_obtain( + RemoteHwAccess_R, + RTEMS_WAIT, + RTEMS_NO_TIMEOUT + ); directive_failed( Sts, "rtems_semaphore_obtain(RemoteHwAccess_R...)" ); /* Carry out the remote access via the Local HW interface */ - printf("AccessRemoteHw access local %s\n", CallerName()); + printf( "AccessRemoteHw access local %s\n", CallerName() ); AccessLocalHw(); - Sts = rtems_semaphore_release(RemoteHwAccess_R); + Sts = rtems_semaphore_release( RemoteHwAccess_R ); directive_failed( Sts, "rtems_semaphore_release(RemoreHwAccess_R" ); - printf("AccessRemoteHw returns to %s\n", CallerName()); + printf( "AccessRemoteHw returns to %s\n", CallerName() ); return; } @@ -302,13 +314,13 @@ void AccessRemoteHw(void) /*************************************************************************/ /* The Init operation (the Init-task) */ -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; -#if defined(TEST_USE_ISR) - rtems_isr_entry DummyIsr; +#if defined( TEST_USE_ISR ) + rtems_isr_entry DummyIsr; #endif int i; @@ -316,72 +328,70 @@ rtems_task Init(rtems_task_argument ignored) /* Create synchronisation semaphore for LocalHwIsr -> Test Tasks */ status = rtems_semaphore_create( - rtems_build_name ('S', 'Y', 'N', 'C'), /* name */ - 0, /* initial count = 0 */ - RTEMS_LOCAL | - RTEMS_SIMPLE_BINARY_SEMAPHORE | - RTEMS_NO_INHERIT_PRIORITY | - RTEMS_NO_PRIORITY_CEILING | - RTEMS_FIFO, + rtems_build_name( 'S', 'Y', 'N', 'C' ), /* name */ + 0, /* initial count = 0 */ + RTEMS_LOCAL | RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | + RTEMS_NO_PRIORITY_CEILING | RTEMS_FIFO, 0, - &LocalHwSync_S); /* *id */ + &LocalHwSync_S + ); /* *id */ directive_failed( status, "rtems_semaphore_create (SYNC)" ); printf( "Sync Mutex Id = 0x%08" PRIxrtems_id "\n", LocalHwSync_S ); /* Create resource semaphore for exclusive access to the local HW */ status = rtems_semaphore_create( - rtems_build_name ('R', 'E', 'S', '1'), /* name */ - 1, /* count */ - RTEMS_PRIORITY | - RTEMS_BINARY_SEMAPHORE | - RTEMS_INHERIT_PRIORITY | - RTEMS_LOCAL, /* attribute_set */ - 1, /* insignificant */ /* priority_ceiling */ - &LocalHwAccess_R); /* *id */ + rtems_build_name( 'R', 'E', 'S', '1' ), /* name */ + 1, /* count */ + RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | + RTEMS_LOCAL, /* attribute_set */ + 1, + /* insignificant */ /* priority_ceiling */ + &LocalHwAccess_R + ); /* *id */ directive_failed( status, "rtems_semaphore_create (RES1)" ); printf( "Local Mutex Id = 0x%08" PRIxrtems_id "\n", LocalHwAccess_R ); /* Create resource semaphore for exclusive access to the remote HW */ status = rtems_semaphore_create( - rtems_build_name ('R', 'E', 'S', '2'), /* name */ - 1, /* count */ - RTEMS_PRIORITY | - RTEMS_BINARY_SEMAPHORE | - RTEMS_INHERIT_PRIORITY | - RTEMS_LOCAL, /* attribute_set */ - 1, /* insignificant */ /* priority_ceiling */ - &RemoteHwAccess_R); /* *id */ + rtems_build_name( 'R', 'E', 'S', '2' ), /* name */ + 1, /* count */ + RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | + RTEMS_LOCAL, /* attribute_set */ + 1, + /* insignificant */ /* priority_ceiling */ + &RemoteHwAccess_R + ); /* *id */ directive_failed( status, "rtems_semaphore_create (RES2)" ); printf( "Remote Mutex Id = 0x%08" PRIxrtems_id "\n", RemoteHwAccess_R ); -#if defined(TEST_USE_ISR) +#if defined( TEST_USE_ISR ) /* Install ISR for HW/SW synchronization, use ta 0x85 which is synchronous */ - status = rtems_interrupt_catch(LocalHwIsr, 0x85 + 0x100, &DummyIsr); + status = rtems_interrupt_catch( LocalHwIsr, 0x85 + 0x100, &DummyIsr ); directive_failed( status, "rtems_interrupt_catch" ); #endif - - printf("Ending Init-task\n"); + printf( "Ending Init-task\n" ); /* Create and start all tasks in the test */ /* -- Medium-prio Test Tasks --- */ - for (i = 0; i < NofMediumTask_C; i++) { -#define MEDIUM_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2u) + 1u) + for ( i = 0; i < NofMediumTask_C; i++ ) { +#define MEDIUM_PRIORITY ( ( RTEMS_MAXIMUM_PRIORITY / 2u ) + 1u ) status = rtems_task_create( - rtems_build_name('M','E','D','0'+i), /* Name */ - MEDIUM_PRIORITY, /* Priority */ - RTEMS_MINIMUM_STACK_SIZE*2, /* Stack size (8KB) */ - RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ - RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ - &TaMedium[i]); /* Assigned ID */ + rtems_build_name( 'M', 'E', 'D', '0' + i ), /* Name */ + MEDIUM_PRIORITY, /* Priority */ + RTEMS_MINIMUM_STACK_SIZE * 2, /* Stack size (8KB) */ + RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ + &TaMedium[ i ] + ); /* Assigned ID */ directive_failed( status, "rtems_task_create (MEDn)" ); - printf( "TaMedium[%d] Id = 0x%08" PRIxrtems_id "\n", i, TaMedium[i] ); + printf( "TaMedium[%d] Id = 0x%08" PRIxrtems_id "\n", i, TaMedium[ i ] ); status = rtems_task_start( - TaMedium[i], + TaMedium[ i ], Medium_Exec, (rtems_task_argument) i ); @@ -389,49 +399,52 @@ rtems_task Init(rtems_task_argument ignored) } /* -- High-prio Test Task --- */ -#define HIGH_PRIORITY ((RTEMS_MAXIMUM_PRIORITY / 2u)) +#define HIGH_PRIORITY (( RTEMS_MAXIMUM_PRIORITY / 2u )) status = rtems_task_create( - rtems_build_name('H','I','G','H'), /* Name */ - HIGH_PRIORITY, /* Priority */ - RTEMS_MINIMUM_STACK_SIZE*2, /* Stack size (8KB) */ - RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ - RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ - &TaHigh); /* Assigned ID */ + rtems_build_name( 'H', 'I', 'G', 'H' ), /* Name */ + HIGH_PRIORITY, /* Priority */ + RTEMS_MINIMUM_STACK_SIZE * 2, /* Stack size (8KB) */ + RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ + &TaHigh + ); /* Assigned ID */ directive_failed( status, "rtems_task_create (HIGH)" ); printf( "TaHigh Id = 0x%08" PRIxrtems_id "\n", TaHigh ); - status = rtems_task_start(TaHigh, High_Exec, 0); + status = rtems_task_start( TaHigh, High_Exec, 0 ); directive_failed( status, "rtems_task_start (HIGH)" ); /* -- Low-prio Test Task --- */ -#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u) +#define LOW_PRIORITY ( RTEMS_MAXIMUM_PRIORITY - 1u ) status = rtems_task_create( - rtems_build_name('L','O','W',' '), /* Name */ - LOW_PRIORITY, /* Priority */ - RTEMS_MINIMUM_STACK_SIZE*2, /* Stack size (8KB) */ - RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ - RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ - &TaLow); /* Assigned ID */ + rtems_build_name( 'L', 'O', 'W', ' ' ), /* Name */ + LOW_PRIORITY, /* Priority */ + RTEMS_MINIMUM_STACK_SIZE * 2, /* Stack size (8KB) */ + RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ + &TaLow + ); /* Assigned ID */ directive_failed( status, "rtems_task_create (LOW)" ); printf( "TaLow Id = 0x%08" PRIxrtems_id "\n", TaLow ); - status = rtems_task_start(TaLow, Low_Exec, 0); + status = rtems_task_start( TaLow, Low_Exec, 0 ); directive_failed( status, "rtems_task_start (LOW)" ); /* -- HW Simulator Task --- */ -#define HWTASK_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 2u) +#define HWTASK_PRIORITY ( RTEMS_MAXIMUM_PRIORITY - 2u ) status = rtems_task_create( - rtems_build_name('H','W','S','M'), /* Name */ - HWTASK_PRIORITY, /* Priority */ - RTEMS_MINIMUM_STACK_SIZE*2, /* Stack size (8KB) */ - RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ - RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ - &TaHwSim); /* Assigned ID */ + rtems_build_name( 'H', 'W', 'S', 'M' ), /* Name */ + HWTASK_PRIORITY, /* Priority */ + RTEMS_MINIMUM_STACK_SIZE * 2, /* Stack size (8KB) */ + RTEMS_DEFAULT_MODES | RTEMS_NO_ASR, /* Mode */ + RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, /* Attributes */ + &TaHwSim + ); /* Assigned ID */ directive_failed( status, "rtems_task_create (HWSM)" ); printf( "TaHwSim Id = 0x%08" PRIxrtems_id "\n", TaHwSim ); - status = rtems_task_start(TaHwSim, LocalHwSim_Exec, 0); + status = rtems_task_start( TaHwSim, LocalHwSim_Exec, 0 ); directive_failed( status, "rtems_task_start (HWSM)" ); /* Destroy the Init task (and let the ready tasks start running) */ @@ -447,9 +460,9 @@ rtems_task Init(rtems_task_argument ignored) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (RTEMS_MINIMUM_STACK_SIZE * 3) +#define CONFIGURE_EXTRA_TASK_STACKS ( RTEMS_MINIMUM_STACK_SIZE * 3 ) -#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TASKS 10 #define CONFIGURE_MAXIMUM_SEMAPHORES 10 #include diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c index e9a29b885d..d2b4778e53 100644 --- a/testsuites/sptests/sp37/init.c +++ b/testsuites/sptests/sp37/init.c @@ -45,25 +45,13 @@ const char rtems_test_name[] = "SP 37"; /* prototypes */ -void test_interrupt_inline(void); -void check_isr_in_progress_inline(void); -rtems_task blocked_task(rtems_task_argument argument); -rtems_timer_service_routine test_unblock_task( - rtems_id timer, - void *arg -); -rtems_timer_service_routine test_unblock_task( - rtems_id timer, - void *arg -); -void check_isr_worked( - char *s, - int result -); -rtems_timer_service_routine test_isr_in_progress( - rtems_id timer, - void *arg -); +void test_interrupt_inline( void ); +void check_isr_in_progress_inline( void ); +rtems_task blocked_task( rtems_task_argument argument ); +rtems_timer_service_routine test_unblock_task( rtems_id timer, void *arg ); +rtems_timer_service_routine test_unblock_task( rtems_id timer, void *arg ); +void check_isr_worked( char *s, int result ); +rtems_timer_service_routine test_isr_in_progress( rtems_id timer, void *arg ); /* test bodies */ @@ -84,7 +72,7 @@ RTEMS_SYSINIT_ITEM( typedef struct { ISR_Level actual_level; - rtems_id master_task_id; + rtems_id master_task_id; } test_isr_level_context; static void isr_level_check_task( rtems_task_argument arg ) @@ -92,32 +80,30 @@ static void isr_level_check_task( rtems_task_argument arg ) (void) arg; test_isr_level_context *ctx = (test_isr_level_context *) arg; - rtems_status_code sc; + rtems_status_code sc; ctx->actual_level = _ISR_Get_level(); - sc = rtems_event_send( ctx->master_task_id, TEST_ISR_EVENT ); + sc = rtems_event_send( ctx->master_task_id, TEST_ISR_EVENT ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - ( void ) rtems_task_suspend( RTEMS_SELF ); + (void) rtems_task_suspend( RTEMS_SELF ); rtems_test_assert( 0 ); } static void test_isr_level_for_new_threads( ISR_Level last_proper_level ) { - ISR_Level mask = CPU_MODES_INTERRUPT_MASK; - ISR_Level current; - test_isr_level_context ctx = { - .master_task_id = rtems_task_self() - }; + ISR_Level mask = CPU_MODES_INTERRUPT_MASK; + ISR_Level current; + test_isr_level_context ctx = { .master_task_id = rtems_task_self() }; - for ( current = 0 ; current <= mask ; ++current ) { - rtems_mode initial_modes; - rtems_id id; + for ( current = 0; current <= mask; ++current ) { + rtems_mode initial_modes; + rtems_id id; rtems_status_code sc; - rtems_event_set events; + rtems_event_set events; - initial_modes = RTEMS_INTERRUPT_LEVEL(current); + initial_modes = RTEMS_INTERRUPT_LEVEL( current ); #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE if ( initial_modes != 0 ) { @@ -128,7 +114,7 @@ static void test_isr_level_for_new_threads( ISR_Level last_proper_level ) ctx.actual_level = 0xffffffff; sc = rtems_task_create( - rtems_build_name('I', 'S', 'R', 'L'), + rtems_build_name( 'I', 'S', 'R', 'L' ), RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, initial_modes, @@ -159,7 +145,7 @@ static void test_isr_level_for_new_threads( ISR_Level last_proper_level ) rtems_test_assert( ctx.actual_level == last_proper_level ); } - sc = rtems_task_delete( id ) ; + sc = rtems_task_delete( id ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } } @@ -177,7 +163,7 @@ static void test_isr_level( void ) _ISR_Set_level( current ); rtems_test_assert( _ISR_Get_level() == current ); - for ( current = current + 1 ; current <= mask ; ++current ) { + for ( current = current + 1; current <= mask; ++current ) { ISR_Level actual; _ISR_Set_level( current ); @@ -192,7 +178,7 @@ static void test_isr_level( void ) last_proper_level = current - 1; - for ( current = current + 1 ; current <= mask ; ++current ) { + for ( current = current + 1; current <= mask; ++current ) { _ISR_Set_level( current ); rtems_test_assert( _ISR_Get_level() == current ); } @@ -209,19 +195,19 @@ static void test_isr_level( void ) static void test_isr_locks( void ) { static const char name[] = "test"; - ISR_Level normal_interrupt_level = _ISR_Get_level(); + ISR_Level normal_interrupt_level = _ISR_Get_level(); #if ISR_LOCK_NEEDS_OBJECT ISR_lock_Control initialized = ISR_LOCK_INITIALIZER( name ); ISR_lock_Control zero_initialized; union { ISR_lock_Control lock; - uint8_t bytes[ sizeof( ISR_lock_Control ) ]; + uint8_t bytes[ sizeof( ISR_lock_Control ) ]; } container; - size_t i; + size_t i; const uint8_t *bytes; #endif ISR_lock_Context lock_context; - ISR_Level interrupt_level; + ISR_Level interrupt_level; #if ISR_LOCK_NEEDS_OBJECT memset( &container, 0xff, sizeof( container ) ); @@ -261,18 +247,18 @@ static void test_isr_locks( void ) rtems_test_assert( normal_interrupt_level == _ISR_Get_level() ); -#if defined(RTEMS_DEBUG) +#if defined( RTEMS_DEBUG ) _ISR_lock_ISR_disable( &lock_context ); #endif interrupt_level = _ISR_Get_level(); _ISR_lock_Acquire( &container.lock, &lock_context ); rtems_test_assert( interrupt_level == _ISR_Get_level() ); -#if !defined(RTEMS_DEBUG) +#if !defined( RTEMS_DEBUG ) rtems_test_assert( normal_interrupt_level == _ISR_Get_level() ); #endif _ISR_lock_Release( &container.lock, &lock_context ); rtems_test_assert( interrupt_level == _ISR_Get_level() ); -#if defined(RTEMS_DEBUG) +#if defined( RTEMS_DEBUG ) _ISR_lock_ISR_enable( &lock_context ); #endif @@ -285,7 +271,7 @@ static void test_isr_locks( void ) static rtems_mode get_interrupt_level( void ) { rtems_status_code sc; - rtems_mode mode; + rtems_mode mode; sc = rtems_task_mode( RTEMS_CURRENT_MODE, RTEMS_CURRENT_MODE, &mode ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); @@ -295,22 +281,24 @@ static rtems_mode get_interrupt_level( void ) static void test_interrupt_locks( void ) { - rtems_mode normal_interrupt_level = get_interrupt_level(); - rtems_interrupt_lock initialized = RTEMS_INTERRUPT_LOCK_INITIALIZER("test"); + rtems_mode normal_interrupt_level = get_interrupt_level(); + rtems_interrupt_lock initialized = RTEMS_INTERRUPT_LOCK_INITIALIZER( + "test" + ); union { rtems_interrupt_lock lock; - uint8_t bytes[ sizeof( rtems_interrupt_lock ) ]; - } container = {0}; + uint8_t bytes[ sizeof( rtems_interrupt_lock ) ]; + } container = { 0 }; rtems_interrupt_lock_context lock_context; - size_t i; - const uint8_t *initialized_bytes; + size_t i; + const uint8_t *initialized_bytes; rtems_interrupt_lock_initialize( &container.lock, "test" ); initialized_bytes = (const uint8_t *) &initialized; for ( i = 0; i < sizeof( container ); ++i ) { if ( container.bytes[ i ] != 0xff ) { - rtems_test_assert( container.bytes[ i ] == initialized_bytes[ i] ); + rtems_test_assert( container.bytes[ i ] == initialized_bytes[ i ] ); } } @@ -333,7 +321,7 @@ static void test_interrupt_locks( void ) static void test_clock_tick_functions( void ) { rtems_interrupt_level level; - Watchdog_Interval saved_ticks; + Watchdog_Interval saved_ticks; rtems_interrupt_local_disable( level ); @@ -381,7 +369,7 @@ static void test_clock_tick_functions( void ) rtems_interrupt_local_enable( level ); } -void test_interrupt_inline(void) +void test_interrupt_inline( void ) { rtems_interrupt_level level; rtems_interrupt_level level_1; @@ -399,7 +387,7 @@ void test_interrupt_inline(void) rtems_test_exit( 0 ); } -#if !defined(RTEMS_SMP) +#if !defined( RTEMS_SMP ) puts( "interrupt disable (use inline)" ); rtems_interrupt_disable( level ); @@ -431,7 +419,7 @@ void test_interrupt_inline(void) puts( "interrupt level mode (use inline)" ); level_mode_body = rtems_interrupt_level_body( level ); - level_mode_macro = RTEMS_INTERRUPT_LEVEL(level); + level_mode_macro = RTEMS_INTERRUPT_LEVEL( level ); if ( level_mode_macro == level_mode_body ) { puts( "test case working.." ); } @@ -441,27 +429,24 @@ volatile int isr_in_progress_body; volatile int isr_in_progress_inline; -void check_isr_in_progress_inline(void) +void check_isr_in_progress_inline( void ) { isr_in_progress_inline = rtems_interrupt_is_in_progress() ? 1 : 2; } -void check_isr_worked( - char *s, - int result -) +void check_isr_worked( char *s, int result ) { - switch (result) { + switch ( result ) { case 0: printf( "isr_in_progress(%s) timer did not fire\n", s ); - rtems_test_exit(0); + rtems_test_exit( 0 ); break; case 1: printf( "isr_in_progress(%s) from ISR -- OK\n", s ); break; default: - printf( "isr_in_progress(%s) from ISR -- returned bad value\n", s); - rtems_test_exit(0); + printf( "isr_in_progress(%s) from ISR -- returned bad value\n", s ); + rtems_test_exit( 0 ); break; } } @@ -469,13 +454,11 @@ void check_isr_worked( volatile int blocked_task_status; rtems_id blocked_task_id; -rtems_task blocked_task( - rtems_task_argument argument -) +rtems_task blocked_task( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; + rtems_status_code status; puts( "Blocking task... suspending self" ); blocked_task_status = 1; @@ -492,16 +475,13 @@ rtems_task blocked_task( * If we are in an ISR, then this is a normal clock tick. * If we are not, then it is the test case. */ -rtems_timer_service_routine test_unblock_task( - rtems_id timer, - void *arg -) +rtems_timer_service_routine test_unblock_task( rtems_id timer, void *arg ) { (void) arg; - bool in_isr; - rtems_status_code status; - Per_CPU_Control *cpu_self; + bool in_isr; + rtems_status_code status; + Per_CPU_Control *cpu_self; in_isr = rtems_interrupt_is_in_progress(); status = rtems_task_is_suspended( blocked_task_id ); @@ -511,7 +491,7 @@ rtems_timer_service_routine test_unblock_task( return; } - if ( (status != RTEMS_ALREADY_SUSPENDED) ) { + if (( status != RTEMS_ALREADY_SUSPENDED )) { status = rtems_timer_fire_after( timer, 1, test_unblock_task, NULL ); directive_failed( status, "timer_fire_after failed" ); return; @@ -525,17 +505,17 @@ rtems_timer_service_routine test_unblock_task( } #undef rtems_interrupt_disable -extern rtems_interrupt_level rtems_interrupt_disable(void); +extern rtems_interrupt_level rtems_interrupt_disable( void ); #undef rtems_interrupt_enable -extern void rtems_interrupt_enable(rtems_interrupt_level previous_level); +extern void rtems_interrupt_enable( rtems_interrupt_level previous_level ); #undef rtems_interrupt_flash -extern void rtems_interrupt_flash(rtems_interrupt_level previous_level); +extern void rtems_interrupt_flash( rtems_interrupt_level previous_level ); #undef rtems_interrupt_is_in_progress -extern bool rtems_interrupt_is_in_progress(void); +extern bool rtems_interrupt_is_in_progress( void ); -static void test_interrupt_body(void) +static void test_interrupt_body( void ) { -#if !defined(RTEMS_SMP) +#if !defined( RTEMS_SMP ) rtems_interrupt_level level_0; rtems_interrupt_level level_1; rtems_mode level_mode_body; @@ -558,7 +538,7 @@ static void test_interrupt_body(void) level_mode_body = rtems_interrupt_level_body( level_0 ); level_mode_macro = RTEMS_INTERRUPT_LEVEL( level_0 ); if ( level_mode_macro == level_mode_body ) { - puts("test seems to work"); + puts( "test seems to work" ); } /* @@ -577,10 +557,7 @@ static void test_interrupt_body(void) #endif /* RTEMS_SMP */ } -rtems_timer_service_routine test_isr_in_progress( - rtems_id timer, - void *arg -) +rtems_timer_service_routine test_isr_in_progress( rtems_id timer, void *arg ) { (void) timer; (void) arg; @@ -590,16 +567,14 @@ rtems_timer_service_routine test_isr_in_progress( isr_in_progress_body = rtems_interrupt_is_in_progress() ? 1 : 2; } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_time_of_day time; - rtems_status_code status; - rtems_id timer; - int i; + rtems_time_of_day time; + rtems_status_code status; + rtems_id timer; + int i; TEST_BEGIN(); @@ -658,28 +633,28 @@ rtems_task Init( directive_failed( status, "timer_fire_after failed" ); /* we expect to be preempted from this call */ - for ( i=0 ; i<100 && blocked_task_status != 3 ; i++ ) { + for ( i = 0; i < 100 && blocked_task_status != 3; i++ ) { status = rtems_clock_tick(); directive_failed( status, "rtems_clock_tick" ); } switch ( blocked_task_status ) { - case -1: - puts( - "clock_tick with task preempt -- task blocked, timer did not fire" - ); - rtems_test_exit(0); - break; - case 1: - puts( "clock_tick with task preempt -- timer fired case 1" ); - rtems_test_exit(0); - break; - case 2: - puts( "clock_tick with task preempt -- timer fired case 2" ); - rtems_test_exit(0); - break; - case 3: - puts( "clock_tick from task level with preempt -- OK" ); - break; + case -1: + puts( + "clock_tick with task preempt -- task blocked, timer did not fire" + ); + rtems_test_exit( 0 ); + break; + case 1: + puts( "clock_tick with task preempt -- timer fired case 1" ); + rtems_test_exit( 0 ); + break; + case 2: + puts( "clock_tick with task preempt -- timer fired case 2" ); + rtems_test_exit( 0 ); + break; + case 3: + puts( "clock_tick from task level with preempt -- OK" ); + break; } test_interrupt_inline(); diff --git a/testsuites/sptests/sp37/system.h b/testsuites/sptests/sp37/system.h index 25df9b4115..3a1516fdec 100644 --- a/testsuites/sptests/sp37/system.h +++ b/testsuites/sptests/sp37/system.h @@ -38,9 +38,7 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ @@ -52,11 +50,11 @@ rtems_task Init( #define CONFIGURE_MICROSECONDS_PER_TICK US_PER_TICK #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_PRIORITY 2 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT +#define CONFIGURE_INIT_TASK_PRIORITY 2 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 1 #include diff --git a/testsuites/sptests/sp38/init.c b/testsuites/sptests/sp38/init.c index 5cf17695d4..926195c748 100644 --- a/testsuites/sptests/sp38/init.c +++ b/testsuites/sptests/sp38/init.c @@ -40,31 +40,23 @@ const char rtems_test_name[] = "SP 38"; volatile bool signal_sent; volatile bool signal_processed; -rtems_id main_task; -void signal_handler(rtems_signal_set signals); -rtems_timer_service_routine test_signal_from_isr( - rtems_id timer, - void *arg -); +rtems_id main_task; +void signal_handler( rtems_signal_set signals ); +rtems_timer_service_routine test_signal_from_isr( rtems_id timer, void *arg ); -void signal_handler( - rtems_signal_set signals -) +void signal_handler( rtems_signal_set signals ) { (void) signals; signal_processed = TRUE; } -rtems_timer_service_routine test_signal_from_isr( - rtems_id timer, - void *arg -) +rtems_timer_service_routine test_signal_from_isr( rtems_id timer, void *arg ) { (void) timer; (void) arg; - rtems_status_code status; + rtems_status_code status; status = rtems_signal_send( main_task, 0x0a0b0c0d ); directive_failed_with_level( status, "rtems_signal_send", 1 ); @@ -72,16 +64,14 @@ rtems_timer_service_routine test_signal_from_isr( signal_sent = TRUE; } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_id timer; - rtems_interval start; - rtems_interval now; + rtems_status_code status; + rtems_id timer; + rtems_interval start; + rtems_interval now; TEST_BEGIN(); @@ -110,14 +100,15 @@ rtems_task Init( status = rtems_timer_fire_after( timer, 10, test_signal_from_isr, NULL ); directive_failed( status, "timer_fire_after failed" ); - while (1) { + while ( 1 ) { now = rtems_clock_get_ticks_since_boot(); - if ( (now-start) > 100 ) { + if ( ( now - start ) > 100 ) { puts( "Signal from ISR did not get processed\n" ); rtems_test_exit( 0 ); } - if ( signal_processed ) + if ( signal_processed ) { break; + } } puts( "Signal sent from ISR has been processed" ); diff --git a/testsuites/sptests/sp38/system.h b/testsuites/sptests/sp38/system.h index 91ff72c66e..dd7d699629 100644 --- a/testsuites/sptests/sp38/system.h +++ b/testsuites/sptests/sp38/system.h @@ -34,9 +34,7 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ @@ -47,8 +45,8 @@ rtems_task Init( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TIMERS 1 #include diff --git a/testsuites/sptests/sp40/init.c b/testsuites/sptests/sp40/init.c index 0df66de7db..a6fcbd36b5 100644 --- a/testsuites/sptests/sp40/init.c +++ b/testsuites/sptests/sp40/init.c @@ -41,12 +41,12 @@ const char rtems_test_name[] = "SP 40"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); static rtems_device_driver test_open( - rtems_device_major_number minor, - rtems_device_minor_number major, - void *ignored + rtems_device_major_number minor, + rtems_device_minor_number major, + void *ignored ) { (void) minor; @@ -66,20 +66,18 @@ static rtems_driver_address_table test_driver = { }; #define test_interrupt_context_enter( level ) \ - do { \ - rtems_interrupt_local_disable( level ); \ - ++_ISR_Nest_level; \ - } while (0) + do { \ + rtems_interrupt_local_disable( level ); \ + ++_ISR_Nest_level; \ + } while ( 0 ) #define test_interrupt_context_leave( level ) \ - do { \ - --_ISR_Nest_level; \ - rtems_interrupt_local_enable( level ); \ - } while (0) + do { \ + --_ISR_Nest_level; \ + rtems_interrupt_local_enable( level ); \ + } while ( 0 ) -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -87,8 +85,8 @@ rtems_task Init( rtems_device_major_number registered; rtems_device_major_number registered_not; rtems_device_major_number invalid_major = _IO_Number_of_drivers + 1; - rtems_interrupt_level level; - bool do_interrupt_context_test = true; + rtems_interrupt_level level; + bool do_interrupt_context_test = true; TEST_BEGIN(); @@ -210,7 +208,7 @@ rtems_task Init( /* more one more driver slot than are statically configured */ #define CONFIGURE_MAXIMUM_DRIVERS 2 -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp41/init.c b/testsuites/sptests/sp41/init.c index 5fa8ada132..6852f9b61e 100644 --- a/testsuites/sptests/sp41/init.c +++ b/testsuites/sptests/sp41/init.c @@ -52,9 +52,7 @@ static void iterator( Thread_Control *thread ) (void) thread; } -static rtems_task Init( - rtems_task_argument ignored -) +static rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -85,7 +83,7 @@ static rtems_task Init( rtems_iterate_over_all_threads( iterator ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -93,7 +91,7 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp42/init.c b/testsuites/sptests/sp42/init.c index 22a6ad1141..0bdef35423 100644 --- a/testsuites/sptests/sp42/init.c +++ b/testsuites/sptests/sp42/init.c @@ -48,25 +48,53 @@ const char rtems_test_name[] = "SP 42"; * Somewhat randomly sorted to ensure than if discipline is FIFO, run-time * behavior won't be the same when released. */ -static const rtems_task_priority Priorities_High[MAX_TASKS] = { - 37, 37, 37, 37, /* backward - more 2-n */ - 2, 2, 2, 2, /* forward - multiple are on 2-n chain */ - 4, 3, /* forward - search forward arbitrary */ - 3, 3, 3, 3, /* forward - more 2-n */ - 38, 37, /* backward - search backward arbitrary */ - 34, 34, 34, 34, /* backward - multple on 2-n chain */ +static const rtems_task_priority Priorities_High[ MAX_TASKS ] = { + 37, + 37, + 37, + 37, /* backward - more 2-n */ + 2, + 2, + 2, + 2, /* forward - multiple are on 2-n chain */ + 4, + 3, /* forward - search forward arbitrary */ + 3, + 3, + 3, + 3, /* forward - more 2-n */ + 38, + 37, /* backward - search backward arbitrary */ + 34, + 34, + 34, + 34, /* backward - multple on 2-n chain */ }; -static const rtems_task_priority Priorities_Low[MAX_TASKS] = { - 13, 13, 13, 13, /* backward - more 2-n */ - 2, 2, 2, 2, /* forward - multiple are on 2-n chain */ - 4, 3, /* forward - search forward arbitrary */ - 3, 3, 3, 3, /* forward - more 2-n */ - 14, 13, /* backward - search backward arbitrary */ - 12, 12, 12, 12, /* backward - multple on 2-n chain */ +static const rtems_task_priority Priorities_Low[ MAX_TASKS ] = { + 13, + 13, + 13, + 13, /* backward - more 2-n */ + 2, + 2, + 2, + 2, /* forward - multiple are on 2-n chain */ + 4, + 3, /* forward - search forward arbitrary */ + 3, + 3, + 3, + 3, /* forward - more 2-n */ + 14, + 13, /* backward - search backward arbitrary */ + 12, + 12, + 12, + 12, /* backward - multple on 2-n chain */ }; -static const rtems_task_argument Obtain_order[2][MAX_TASKS] = { +static const rtems_task_argument Obtain_order[ 2 ][ MAX_TASKS ] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }, { 4, 5, 6, 7, 9, 10, 11, 12, 13, 8, 16, 17, 18, 19, 0, 1, 2, 3, 15, 14 } }; @@ -80,14 +108,9 @@ static rtems_name Task_name[ MAX_TASKS ]; static rtems_task_argument Obtain_counter; -static enum { - FIFO, - PRIORITY -} Variant; +static enum { FIFO, PRIORITY } Variant; -static rtems_task Locker_task( - rtems_task_argument task_index -) +static rtems_task Locker_task( rtems_task_argument task_index ) { rtems_id tid; rtems_status_code status; @@ -124,7 +147,7 @@ static rtems_task Locker_task( static void do_test( rtems_attribute attr, - bool extract /* TRUE if extract, not release */ + bool extract /* TRUE if extract, not release */ ) { rtems_status_code status; @@ -134,20 +157,20 @@ static void do_test( Obtain_counter = 0; status = rtems_semaphore_create( - rtems_build_name( 'S', 'E', 'M', '0' ), /* name = SEM0 */ - 0, /* locked */ - RTEMS_BINARY_SEMAPHORE | attr, /* mutex w/desired discipline */ - 0, /* IGNORED */ + rtems_build_name( 'S', 'E', 'M', '0' ), /* name = SEM0 */ + 0, /* locked */ + RTEMS_BINARY_SEMAPHORE | attr, /* mutex w/desired discipline */ + 0, /* IGNORED */ &Semaphore ); directive_failed( status, "rtems_semaphore_create" ); - for (i = 0 ; i < MAX_TASKS ; i++ ) { + for ( i = 0; i < MAX_TASKS; i++ ) { Task_name[ i ] = rtems_build_name( - 'T', - 'A', - '0' + (char)(i/10), - '0' + (char)(i%10) + 'T', + 'A', + '0' + (char) ( i / 10 ), + '0' + (char) ( i % 10 ) ); status = rtems_task_create( @@ -165,8 +188,8 @@ static void do_test( } if ( extract ) { - for (i = 0 ; i< MAX_TASKS ; i++ ) { - status = rtems_task_delete( Task_id[ i ] ); + for ( i = 0; i < MAX_TASKS; i++ ) { + status = rtems_task_delete( Task_id[ i ] ); directive_failed( status, "rtems_task_delete" ); } } @@ -185,38 +208,40 @@ static void do_test( directive_failed( status, "rtems_semaphore_delete" ); } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_task_priority prio; - rtems_status_code status; + rtems_status_code status; TEST_BEGIN(); Master = rtems_task_self(); - if (RTEMS_MAXIMUM_PRIORITY >= 255) + if ( RTEMS_MAXIMUM_PRIORITY >= 255 ) { Priorities = Priorities_High; - else if (RTEMS_MAXIMUM_PRIORITY >= 15) + } else if ( RTEMS_MAXIMUM_PRIORITY >= 15 ) { Priorities = Priorities_Low; - else { + } else { puts( "Test needs at least 16 configured priority levels" ); rtems_test_exit( 0 ); } prio = RTEMS_MAXIMUM_PRIORITY - 1; - status = rtems_task_set_priority(RTEMS_SELF, prio, &prio); + status = rtems_task_set_priority( RTEMS_SELF, prio, &prio ); directive_failed( status, "rtems_task_set_priority" ); - if ( sizeof(Priorities_Low) / sizeof(rtems_task_priority) != MAX_TASKS ) { + if ( + sizeof( Priorities_Low ) / sizeof( rtems_task_priority ) != MAX_TASKS + ) { puts( "Priorities_Low table does not have right number of entries" ); rtems_test_exit( 0 ); } - if ( sizeof(Priorities_High) / sizeof(rtems_task_priority) != MAX_TASKS ) { + if ( + sizeof( Priorities_High ) / sizeof( rtems_task_priority ) != MAX_TASKS + ) { puts( "Priorities_High table does not have right number of entries" ); rtems_test_exit( 0 ); } @@ -234,7 +259,7 @@ static rtems_task Init( do_test( RTEMS_PRIORITY, FALSE ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /**************** START OF CONFIGURATION INFORMATION ****************/ @@ -244,8 +269,8 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS MAX_TASKS+1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_TASKS MAX_TASKS + 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES @@ -256,4 +281,3 @@ static rtems_task Init( #include /**************** END OF CONFIGURATION INFORMATION ****************/ - diff --git a/testsuites/sptests/sp43/init.c b/testsuites/sptests/sp43/init.c index 3fdfdd70b1..40a306975e 100644 --- a/testsuites/sptests/sp43/init.c +++ b/testsuites/sptests/sp43/init.c @@ -50,64 +50,60 @@ const char rtems_test_name[] = "SP 43"; #undef rtems_object_id_get_node void print_class_info( - int api, - int class, + int api, + int class, rtems_object_api_class_information *info ); -void change_name( - rtems_id id, - const char *newName, - bool printable -); +void change_name( rtems_id id, const char *newName, bool printable ); -rtems_id main_task; -rtems_name main_name; +rtems_id main_task; +rtems_name main_name; void print_class_info( - int api, - int class, + int api, + int class, rtems_object_api_class_information *info ) { printf( "%s API %s Information\n" - " minimum id : 0x%08" PRIxrtems_id - " maximum id: 0x%08" PRIxrtems_id "\n" + " minimum id : 0x%08" PRIxrtems_id " maximum id: 0x%08" PRIxrtems_id + "\n" " maximum : %7" PRIu32 " available : %" PRIu32 "\n" " auto_extend : %s\n", - rtems_object_get_api_name(api), - rtems_object_get_api_class_name(api, class), + rtems_object_get_api_name( api ), + rtems_object_get_api_class_name( api, class ), info->minimum_id, info->maximum_id, info->maximum, info->unallocated, - ((info->auto_extend) ? "yes" : "no") + ( ( info->auto_extend ) ? "yes" : "no" ) ); } -void change_name( - rtems_id id, - const char *newName, - bool printable -) +void change_name( rtems_id id, const char *newName, bool printable ) { - rtems_status_code sc; - char name[ 5 ]; - char *ptr; - const char *c; + rtems_status_code sc; + char name[ 5 ]; + char *ptr; + const char *c; printf( "rtems_object_set_name - change name of init task to " ); - if ( printable ) + if ( printable ) { printf( "(%s)\n", newName ); - else { + } else { printf( "(" ); - for (c=newName ; *c ; ) { - if (isprint((unsigned char)*c)) printf( "%c", *c ); - else printf( "0x%02x", *c ); - c++; - if ( *c ) - printf( "-" ); + for ( c = newName; *c; ) { + if ( isprint( (unsigned char) *c ) ) { + printf( "%c", *c ); + } else { + printf( "0x%02x", *c ); + } + c++; + if ( *c ) { + printf( "-" ); + } } printf( ")\n" ); } @@ -121,25 +117,23 @@ void change_name( puts( " - name returned by rtems_object_get_classic_name" ); ptr = rtems_object_get_name( id, 5, name ); - rtems_test_assert(ptr != NULL); + rtems_test_assert( ptr != NULL ); printf( "rtems_object_get_name returned (%s) for init task\n", ptr ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code sc; - rtems_id tmpId; - rtems_name tmpName; - char name[5]; - char *ptr; - const char newName[5] = "New1"; - char tmpNameString[5]; - int part; - rtems_object_api_class_information info; + rtems_status_code sc; + rtems_id tmpId; + rtems_name tmpName; + char name[ 5 ]; + char *ptr; + const char newName[ 5 ] = "New1"; + char tmpNameString[ 5 ]; + int part; + rtems_object_api_class_information info; TEST_BEGIN(); @@ -195,13 +189,12 @@ rtems_task Init( put_name( tmpName, FALSE ); puts( " - rtems_build_name for TEMP" ); - /* * rtems_object_get_name - cases */ puts( "rtems_object_get_name - bad id for class with instances" ); ptr = rtems_object_get_name( main_task + 5, 5, name ); - rtems_test_assert(ptr == NULL); + rtems_test_assert( ptr == NULL ); puts( "rtems_object_get_name - bad id for class without instances" ); ptr = rtems_object_get_name( @@ -209,22 +202,22 @@ rtems_task Init( 5, name ); - rtems_test_assert(ptr == NULL); + rtems_test_assert( ptr == NULL ); puts( "rtems_object_get_name - bad length" ); ptr = rtems_object_get_name( main_task, 0, name ); - rtems_test_assert(ptr == NULL); + rtems_test_assert( ptr == NULL ); puts( "rtems_object_get_name - bad pointer" ); ptr = rtems_object_get_name( main_task, 5, NULL ); - rtems_test_assert(ptr == NULL); + rtems_test_assert( ptr == NULL ); ptr = rtems_object_get_name( main_task, 5, name ); - rtems_test_assert(ptr != NULL); + rtems_test_assert( ptr != NULL ); printf( "rtems_object_get_name returned (%s) for init task id\n", ptr ); ptr = rtems_object_get_name( RTEMS_SELF, 5, name ); - rtems_test_assert(ptr != NULL); + rtems_test_assert( ptr != NULL ); printf( "rtems_object_get_name returned (%s) for RTEMS_SELF\n", ptr ); /* @@ -242,19 +235,11 @@ rtems_task Init( puts( "rtems_object_set_name - INVALID_ID (bad API)" ); tmpId = rtems_build_id( 0xff, OBJECTS_RTEMS_TASKS, 1, 1 ), sc = rtems_object_set_name( tmpId, newName ); - fatal_directive_status( - sc, - RTEMS_INVALID_ID, - "rtems_object_set_name #1" - ); + fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_object_set_name #1" ); puts( "rtems_object_set_name - INVALID_ID (bad index)" ); sc = rtems_object_set_name( main_task + 10, newName ); - fatal_directive_status( - sc, - RTEMS_INVALID_ID, - "rtems_object_set_name #2" - ); + fatal_directive_status( sc, RTEMS_INVALID_ID, "rtems_object_set_name #2" ); /* * rtems_object_set_name - change name of init task in various ways. @@ -262,29 +247,28 @@ rtems_task Init( * This is strange but pushes the SuperCore code to do different things. */ - change_name( main_task, "New1", TRUE ); + change_name( main_task, "New1", TRUE ); change_name( main_task, "Ne1", TRUE ); change_name( main_task, "N1", TRUE ); change_name( main_task, "N", TRUE ); change_name( main_task, "", TRUE ); - tmpNameString[0] = 'N'; - tmpNameString[1] = 0x07; - tmpNameString[2] = 0x09; - tmpNameString[3] = '1'; - tmpNameString[4] = '\0'; + tmpNameString[ 0 ] = 'N'; + tmpNameString[ 1 ] = 0x07; + tmpNameString[ 2 ] = 0x09; + tmpNameString[ 3 ] = '1'; + tmpNameString[ 4 ] = '\0'; change_name( main_task, tmpNameString, FALSE ); /* * Change object name using SELF ID */ - change_name( RTEMS_SELF, "SELF", TRUE ); + change_name( RTEMS_SELF, "SELF", TRUE ); ptr = rtems_object_get_name( main_task, 5, name ); - rtems_test_assert(ptr != NULL); + rtems_test_assert( ptr != NULL ); printf( "rtems_object_get_name returned (%s) for init task id\n", ptr ); - /* * Exercise id build and extraction routines */ @@ -313,58 +297,103 @@ rtems_task Init( * API/Class min/max routines */ - printf( "rtems_object_id_api_minimum returned %d\n", - rtems_object_id_api_minimum() ); - printf( "rtems_object_id_api_maximum returned %d\n", - rtems_object_id_api_maximum() ); + printf( + "rtems_object_id_api_minimum returned %d\n", + rtems_object_id_api_minimum() + ); + printf( + "rtems_object_id_api_maximum returned %d\n", + rtems_object_id_api_maximum() + ); - printf( "rtems_object_api_minimum_class(0) returned %d\n", - rtems_object_api_minimum_class(0) ); - printf( "rtems_object_api_maximum_class(0) returned %d\n", - rtems_object_api_maximum_class(0) ); + printf( + "rtems_object_api_minimum_class(0) returned %d\n", + rtems_object_api_minimum_class( 0 ) + ); + printf( + "rtems_object_api_maximum_class(0) returned %d\n", + rtems_object_api_maximum_class( 0 ) + ); - printf( "rtems_object_api_minimum_class(0) returned %d\n", - rtems_object_api_minimum_class(0) ); - printf( "rtems_object_api_maximum_class(0) returned %d\n", - rtems_object_api_maximum_class(0) ); - printf( "rtems_object_api_minimum_class(255) returned %d\n", - rtems_object_api_minimum_class(255) ); - printf( "rtems_object_api_maximum_class(255) returned %d\n", - rtems_object_api_maximum_class(255) ); + printf( + "rtems_object_api_minimum_class(0) returned %d\n", + rtems_object_api_minimum_class( 0 ) + ); + printf( + "rtems_object_api_maximum_class(0) returned %d\n", + rtems_object_api_maximum_class( 0 ) + ); + printf( + "rtems_object_api_minimum_class(255) returned %d\n", + rtems_object_api_minimum_class( 255 ) + ); + printf( + "rtems_object_api_maximum_class(255) returned %d\n", + rtems_object_api_maximum_class( 255 ) + ); - printf( "rtems_object_api_minimum_class(OBJECTS_INTERNAL_API) returned %d\n", - rtems_object_api_minimum_class(OBJECTS_INTERNAL_API) ); - printf( "rtems_object_api_maximum_class(OBJECTS_INTERNAL_API) returned %d\n", - rtems_object_api_maximum_class(OBJECTS_INTERNAL_API) ); + printf( + "rtems_object_api_minimum_class(OBJECTS_INTERNAL_API) returned %d\n", + rtems_object_api_minimum_class( OBJECTS_INTERNAL_API ) + ); + printf( + "rtems_object_api_maximum_class(OBJECTS_INTERNAL_API) returned %d\n", + rtems_object_api_maximum_class( OBJECTS_INTERNAL_API ) + ); - printf( "rtems_object_api_minimum_class(OBJECTS_CLASSIC_API) returned %d\n", - rtems_object_api_minimum_class(OBJECTS_CLASSIC_API) ); - printf( "rtems_object_api_maximum_class(OBJECTS_CLASSIC_API) returned %d\n", - rtems_object_api_maximum_class(OBJECTS_CLASSIC_API) ); + printf( + "rtems_object_api_minimum_class(OBJECTS_CLASSIC_API) returned %d\n", + rtems_object_api_minimum_class( OBJECTS_CLASSIC_API ) + ); + printf( + "rtems_object_api_maximum_class(OBJECTS_CLASSIC_API) returned %d\n", + rtems_object_api_maximum_class( OBJECTS_CLASSIC_API ) + ); /* * API and class name tests */ - printf( "rtems_object_get_api_name(0) = %s\n", rtems_object_get_api_name(0) ); - printf( "rtems_object_get_api_name(255) = %s\n", - rtems_object_get_api_name(255)); + printf( + "rtems_object_get_api_name(0) = %s\n", + rtems_object_get_api_name( 0 ) + ); + printf( + "rtems_object_get_api_name(255) = %s\n", + rtems_object_get_api_name( 255 ) + ); - printf( "rtems_object_get_api_name(INTERNAL_API) = %s\n", - rtems_object_get_api_name(OBJECTS_INTERNAL_API) ); - printf( "rtems_object_get_api_name(CLASSIC_API) = %s\n", - rtems_object_get_api_name(OBJECTS_CLASSIC_API) ); + printf( + "rtems_object_get_api_name(INTERNAL_API) = %s\n", + rtems_object_get_api_name( OBJECTS_INTERNAL_API ) + ); + printf( + "rtems_object_get_api_name(CLASSIC_API) = %s\n", + rtems_object_get_api_name( OBJECTS_CLASSIC_API ) + ); - printf( "rtems_object_get_api_class_name(0, RTEMS_TASKS) = %s\n", - rtems_object_get_api_class_name( 0, OBJECTS_RTEMS_TASKS ) ); - printf( "rtems_object_get_api_class_name(CLASSIC_API, 0) = %s\n", - rtems_object_get_api_class_name( OBJECTS_CLASSIC_API, 0 ) ); - printf("rtems_object_get_api_class_name(INTERNAL_API, THREADS) = %s\n", + printf( + "rtems_object_get_api_class_name(0, RTEMS_TASKS) = %s\n", + rtems_object_get_api_class_name( 0, OBJECTS_RTEMS_TASKS ) + ); + printf( + "rtems_object_get_api_class_name(CLASSIC_API, 0) = %s\n", + rtems_object_get_api_class_name( OBJECTS_CLASSIC_API, 0 ) + ); + printf( + "rtems_object_get_api_class_name(INTERNAL_API, THREADS) = %s\n", rtems_object_get_api_class_name( - OBJECTS_INTERNAL_API, OBJECTS_INTERNAL_THREADS)); - printf("rtems_object_get_api_class_name(CLASSIC_API, RTEMS_BARRIERS) = %s\n", + OBJECTS_INTERNAL_API, + OBJECTS_INTERNAL_THREADS + ) + ); + printf( + "rtems_object_get_api_class_name(CLASSIC_API, RTEMS_BARRIERS) = %s\n", rtems_object_get_api_class_name( - OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS)); + OBJECTS_CLASSIC_API, + OBJECTS_RTEMS_BARRIERS + ) + ); /* * Class information @@ -372,7 +401,10 @@ rtems_task Init( puts( "rtems_object_get_class_information - INVALID_ADDRESS" ); sc = rtems_object_get_class_information( - OBJECTS_INTERNAL_API, OBJECTS_INTERNAL_THREADS, NULL ); + OBJECTS_INTERNAL_API, + OBJECTS_INTERNAL_THREADS, + NULL + ); fatal_directive_status( sc, RTEMS_INVALID_ADDRESS, @@ -380,8 +412,11 @@ rtems_task Init( ); puts( "rtems_object_get_class_information - INVALID_NUMBER (bad API)" ); - sc = - rtems_object_get_class_information(0, OBJECTS_INTERNAL_THREADS, &info); + sc = rtems_object_get_class_information( + 0, + OBJECTS_INTERNAL_THREADS, + &info + ); fatal_directive_status( sc, RTEMS_INVALID_NUMBER, @@ -397,8 +432,7 @@ rtems_task Init( ); puts( "rtems_object_get_class_information - INVALID_NUMBER (class=0)" ); - sc = rtems_object_get_class_information( - OBJECTS_INTERNAL_API, 0, &info ); + sc = rtems_object_get_class_information( OBJECTS_INTERNAL_API, 0, &info ); fatal_directive_status( sc, RTEMS_INVALID_NUMBER, @@ -406,9 +440,9 @@ rtems_task Init( ); puts( - "rtems_object_get_class_information - INVALID_NUMBER (class too high)" ); - sc = rtems_object_get_class_information( - OBJECTS_INTERNAL_API, 0xff, &info); + "rtems_object_get_class_information - INVALID_NUMBER (class too high)" + ); + sc = rtems_object_get_class_information( OBJECTS_INTERNAL_API, 0xff, &info ); fatal_directive_status( sc, RTEMS_INVALID_NUMBER, @@ -417,19 +451,21 @@ rtems_task Init( puts( "rtems_object_get_class_information - Classic Tasks - OK" ); sc = rtems_object_get_class_information( - OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, &info ); + OBJECTS_CLASSIC_API, + OBJECTS_RTEMS_TASKS, + &info + ); directive_failed( sc, "rtems_object_get_class_information" ); print_class_info( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, &info ); puts( "rtems_object_get_class_information - Classic Timers - OK" ); - sc = rtems_timer_create(0, NULL); - fatal_directive_status( - sc, - RTEMS_INVALID_NAME, - "rtems_timer_create" - ); + sc = rtems_timer_create( 0, NULL ); + fatal_directive_status( sc, RTEMS_INVALID_NAME, "rtems_timer_create" ); sc = rtems_object_get_class_information( - OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, &info ); + OBJECTS_CLASSIC_API, + OBJECTS_RTEMS_TIMERS, + &info + ); directive_failed( sc, "rtems_object_get_class_information" ); print_class_info( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, &info ); @@ -442,13 +478,13 @@ rtems_task Init( * configurable. */ { - rtems_task_priority old_priority; - void *tmp; - int class; - int api; + rtems_task_priority old_priority; + void *tmp; + int class; + int api; class = OBJECTS_INTERNAL_API; - api = OBJECTS_INTERNAL_THREADS; + api = OBJECTS_INTERNAL_THREADS; puts( "rtems_task_set_priority - use valid Idle thread id" ); sc = rtems_task_set_priority( diff --git a/testsuites/sptests/sp43/system.h b/testsuites/sptests/sp43/system.h index 96b122f8ab..b29600523f 100644 --- a/testsuites/sptests/sp43/system.h +++ b/testsuites/sptests/sp43/system.h @@ -34,9 +34,7 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ @@ -47,9 +45,9 @@ rtems_task Init( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 #include /* end of include file */ diff --git a/testsuites/sptests/sp44/init.c b/testsuites/sptests/sp44/init.c index 0828fc4d47..9d69f85d29 100644 --- a/testsuites/sptests/sp44/init.c +++ b/testsuites/sptests/sp44/init.c @@ -31,51 +31,51 @@ const char rtems_test_name[] = "SP 44"; -rtems_task Init(rtems_task_argument ignored); -rtems_task TaskAB_entry(rtems_task_argument me); +rtems_task Init( rtems_task_argument ignored ); +rtems_task TaskAB_entry( rtems_task_argument me ); /*** Task priorities ***/ -#define TASK_A_PRIORITY 10 -#define TASK_B_PRIORITY 10 +#define TASK_A_PRIORITY 10 +#define TASK_B_PRIORITY 10 /*** Task names ***/ -#define TASK_A_NAME 1 -#define TASK_B_NAME 2 +#define TASK_A_NAME 1 +#define TASK_B_NAME 2 /*** Task atributes ***/ -#define TASK_A_INITMODE RTEMS_DEFAULT_MODES -#define TASK_B_INITMODE RTEMS_DEFAULT_MODES +#define TASK_A_INITMODE RTEMS_DEFAULT_MODES +#define TASK_B_INITMODE RTEMS_DEFAULT_MODES /*** Task generic parameters ***/ -#define TASK_A_STACKSIZE RTEMS_MINIMUM_STACK_SIZE -#define TASK_A_MODEATTR RTEMS_DEFAULT_ATTRIBUTES -#define TASK_B_STACKSIZE RTEMS_MINIMUM_STACK_SIZE -#define TASK_B_MODEATTR RTEMS_DEFAULT_ATTRIBUTES +#define TASK_A_STACKSIZE RTEMS_MINIMUM_STACK_SIZE +#define TASK_A_MODEATTR RTEMS_DEFAULT_ATTRIBUTES +#define TASK_B_STACKSIZE RTEMS_MINIMUM_STACK_SIZE +#define TASK_B_MODEATTR RTEMS_DEFAULT_ATTRIBUTES volatile uint32_t turn; -rtems_id TaskA_id, TaskB_id; +rtems_id TaskA_id, TaskB_id; /* TASK A/B */ -rtems_task TaskAB_entry(rtems_task_argument me) +rtems_task TaskAB_entry( rtems_task_argument me ) { static rtems_mode previous_mode_set; rtems_status_code status; - uint32_t iterations = 0; + uint32_t iterations = 0; status = rtems_task_mode( RTEMS_PREEMPT | RTEMS_TIMESLICE, RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK, &previous_mode_set ); - directive_failed(status, "Unable to change task mode."); + directive_failed( status, "Unable to change task mode." ); - while(1) { - if (turn == me) { + while ( 1 ) { + if ( turn == me ) { printf( - "Task #%" PRIdrtems_task_argument "'s turn. Now setting turn to %" - PRIdrtems_task_argument "\n", - me, - 1 - me + "Task #%" PRIdrtems_task_argument + "'s turn. Now setting turn to %" PRIdrtems_task_argument "\n", + me, + 1 - me ); if ( ++iterations == 10 ) { @@ -88,7 +88,7 @@ rtems_task TaskAB_entry(rtems_task_argument me) } } -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -105,11 +105,11 @@ rtems_task Init(rtems_task_argument ignored) TASK_A_MODEATTR, &TaskA_id ); - directive_failed(status,"rtems_task_create"); + directive_failed( status, "rtems_task_create" ); /* Start Task A */ - status = rtems_task_start(TaskA_id, TaskAB_entry, 0); - directive_failed(status,"rtems_task_start"); + status = rtems_task_start( TaskA_id, TaskAB_entry, 0 ); + directive_failed( status, "rtems_task_start" ); /* Create Task B */ status = rtems_task_create( @@ -123,16 +123,16 @@ rtems_task Init(rtems_task_argument ignored) directive_failed( status, "rtems_task_create" ); /* Start Task B */ - status = rtems_task_start(TaskB_id, TaskAB_entry, 1); + status = rtems_task_start( TaskB_id, TaskAB_entry, 1 ); directive_failed( status, "rtems_task_start" ); /* Suspend itself */ - status = rtems_task_suspend(RTEMS_SELF); + status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend" ); /* This task is not suposed to be executed anymore */ - printf("\nNOT SUPOSED TO RETURN HERE...\n"); - rtems_test_exit(1); + printf( "\nNOT SUPOSED TO RETURN HERE...\n" ); + rtems_test_exit( 1 ); } /* configuration information */ diff --git a/testsuites/sptests/sp45/init.c b/testsuites/sptests/sp45/init.c index 0a347680db..cdd6c3afa0 100644 --- a/testsuites/sptests/sp45/init.c +++ b/testsuites/sptests/sp45/init.c @@ -34,29 +34,27 @@ const char rtems_test_name[] = "SP 45"; -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Malloc_From_TSR( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); -rtems_id Timer_id[ 3 ]; /* array of timer ids */ -rtems_name Timer_name[ 3 ]; /* array of timer names */ +rtems_id Timer_id[ 3 ]; /* array of timer ids */ +rtems_name Timer_name[ 3 ]; /* array of timer names */ -volatile int TSR_fired; +volatile int TSR_fired; volatile void *TSR_malloc_ptr; rtems_timer_service_routine Malloc_From_TSR( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; (void) ignored_address; - rtems_status_code status; + rtems_status_code status; TSR_fired = 2; puts( "TSR: calling malloc" ); @@ -70,13 +68,11 @@ rtems_timer_service_routine Malloc_From_TSR( directive_failed( status, "rtems_task_wake_after" ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; + rtems_status_code status; TEST_BEGIN(); @@ -123,10 +119,11 @@ rtems_task Init( status = rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); - if ( TSR_fired == 2 && - (TSR_malloc_ptr && TSR_malloc_ptr != (void *)0xa5a5a5) ) + if ( + TSR_fired == 2 && ( TSR_malloc_ptr && TSR_malloc_ptr != (void *) 0xa5a5a5 ) + ) { puts( "TSR appears to have executed OK" ); - else { + } else { printf( "FAILURE ptr=%p TSR_fired=%d\n", TSR_malloc_ptr, TSR_fired ); rtems_test_exit( 0 ); } @@ -138,7 +135,6 @@ rtems_task Init( status = rtems_timer_delete( Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_delete" ); - TEST_END(); rtems_test_exit( 0 ); } @@ -150,15 +146,14 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER /* Two Tasks: Init and Timer Server */ -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 2 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 2 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include - diff --git a/testsuites/sptests/sp46/init.c b/testsuites/sptests/sp46/init.c index c724c40516..427908831c 100644 --- a/testsuites/sptests/sp46/init.c +++ b/testsuites/sptests/sp46/init.c @@ -35,43 +35,36 @@ const char rtems_test_name[] = "SP 46"; -rtems_task Periodic_Task( - rtems_task_argument argument -); -rtems_task Init( - rtems_task_argument argument -); +rtems_task Periodic_Task( rtems_task_argument argument ); +rtems_task Init( rtems_task_argument argument ); volatile int partial_loop = 0; -rtems_task Periodic_Task( - rtems_task_argument argument -) +rtems_task Periodic_Task( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_name period_name = rtems_build_name('P','E','R','a'); - rtems_id period_id; - rtems_interval start; - rtems_interval end; + rtems_status_code status; + rtems_name period_name = rtems_build_name( 'P', 'E', 'R', 'a' ); + rtems_id period_id; + rtems_interval start; + rtems_interval end; puts( "Periodic - Create Period" ); /* create period */ status = rtems_rate_monotonic_create( period_name, &period_id ); - directive_failed(status, "rate_monotonic_create"); + directive_failed( status, "rate_monotonic_create" ); partial_loop = 0; - while (1) { + while ( 1 ) { /* start period with initial value */ status = rtems_rate_monotonic_period( period_id, 25 ); - directive_failed(status, "rate_monotonic_period"); + directive_failed( status, "rate_monotonic_period" ); partial_loop = 0; start = rtems_clock_get_ticks_since_boot(); - end = start + 5; - while ( end <= rtems_clock_get_ticks_since_boot() ) - ; + end = start + 5; + while ( end <= rtems_clock_get_ticks_since_boot() ); partial_loop = 1; @@ -82,14 +75,12 @@ rtems_task Periodic_Task( rtems_task_exit(); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_id task_id; + rtems_status_code status; + rtems_id task_id; TEST_BEGIN(); @@ -97,7 +88,6 @@ rtems_task Init( * Initialize Tasks */ - puts( "INIT - rtems_task_create - creating task 1" ); status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ), @@ -139,7 +129,7 @@ rtems_task Init( /* Two Tasks: Init and Timer Server */ #define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INIT_TASK_PRIORITY 10 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES @@ -147,7 +137,6 @@ rtems_task Init( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include - diff --git a/testsuites/sptests/sp47/init.c b/testsuites/sptests/sp47/init.c index 40de3b5749..ce617b8b03 100644 --- a/testsuites/sptests/sp47/init.c +++ b/testsuites/sptests/sp47/init.c @@ -25,42 +25,44 @@ const char rtems_test_name[] = "SP 47"; -#define PRIXrtems_mode PRIX32 +#define PRIXrtems_mode PRIX32 -rtems_task test_asr(rtems_task_argument unused); -rtems_task Init(rtems_task_argument ignored); +rtems_task test_asr( rtems_task_argument unused ); +rtems_task Init( rtems_task_argument ignored ); -rtems_task test_asr(rtems_task_argument unused) +rtems_task test_asr( rtems_task_argument unused ) { (void) unused; rtems_mode mode; - rtems_task_mode(0, RTEMS_CURRENT_MODE, &mode); + rtems_task_mode( 0, RTEMS_CURRENT_MODE, &mode ); - if ( (mode & RTEMS_NO_ASR) == 0 ) { + if ( ( mode & RTEMS_NO_ASR ) == 0 ) { puts( "ERROR - disable ASR not honored" ); printf( - "mode = 0x%08" PRIXrtems_mode " asr = %s\n", mode, - (mode & RTEMS_NO_ASR) ? "OFF" : "ON" + "mode = 0x%08" PRIXrtems_mode " asr = %s\n", + mode, + ( mode & RTEMS_NO_ASR ) ? "OFF" : "ON" ); - } else + } else { puts( "Creating task with ASR disable mode honored" ); + } TEST_END(); rtems_test_exit( 0 ); } -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; rtems_status_code sc; - rtems_id ti; + rtems_id ti; TEST_BEGIN(); sc = rtems_task_create( - rtems_build_name('t', 's', 't', '0'), + rtems_build_name( 't', 's', 't', '0' ), 100, RTEMS_MINIMUM_STACK_SIZE, RTEMS_NO_ASR, @@ -68,12 +70,12 @@ rtems_task Init(rtems_task_argument ignored) &ti ); - if (sc != RTEMS_SUCCESSFUL) { - printf("rtems_task_create failed: %i\n", sc); - exit(0); + if ( sc != RTEMS_SUCCESSFUL ) { + printf( "rtems_task_create failed: %i\n", sc ); + exit( 0 ); } - rtems_task_start(ti, test_asr, 0); + rtems_task_start( ti, test_asr, 0 ); rtems_task_exit(); } @@ -85,8 +87,8 @@ rtems_task Init(rtems_task_argument ignored) #define CONFIGURE_MICROSECONDS_PER_TICK 10000 -#define CONFIGURE_MAXIMUM_TASKS 64 -#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_TASKS 64 +#define CONFIGURE_MAXIMUM_PERIODS 10 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sp48/init.c b/testsuites/sptests/sp48/init.c index ce2ced96db..f3af5d50fb 100644 --- a/testsuites/sptests/sp48/init.c +++ b/testsuites/sptests/sp48/init.c @@ -37,12 +37,12 @@ const char rtems_test_name[] = "SP 48"; -rtems_task Init(rtems_task_argument ignored); +rtems_task Init( rtems_task_argument ignored ); #define SEMA_COUNT 5000 -rtems_id Semaphores[SEMA_COUNT]; +rtems_id Semaphores[ SEMA_COUNT ]; -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -56,30 +56,31 @@ rtems_task Init(rtems_task_argument ignored) "Largest C program heap block available: %zu\n", malloc_free_space() ); - for (i=0 ; iUser_initialization_tasks_table == NULL ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } static void check_dirty_memory( void ) diff --git a/testsuites/sptests/sp55/init.c b/testsuites/sptests/sp55/init.c index d0675da731..3dd9f9e325 100644 --- a/testsuites/sptests/sp55/init.c +++ b/testsuites/sptests/sp55/init.c @@ -41,18 +41,16 @@ const char rtems_test_name[] = "SP 55"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; - rtems_id id; - int msg = 1; - uint32_t count = 20; + rtems_status_code status; + rtems_id id; + int msg = 1; + uint32_t count = 20; TEST_BEGIN(); @@ -60,22 +58,22 @@ rtems_task Init( status = rtems_message_queue_create( rtems_build_name( 'Q', '1', ' ', ' ' ), 2, - sizeof(int), + sizeof( int ), RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "rtems_message_queue_create" ); puts( "Init - rtems_message_queue_send - make message pending - OK" ); - status = rtems_message_queue_send( id, &msg, sizeof(msg) ); + status = rtems_message_queue_send( id, &msg, sizeof( msg ) ); directive_failed( status, "rtems_message_queue_send" ); puts( "Init - rtems_message_queue_broadcast - with message pending - OK" ); - status = rtems_message_queue_broadcast( id, &msg, sizeof(msg), &count ); + status = rtems_message_queue_broadcast( id, &msg, sizeof( msg ), &count ); directive_failed( status, "rtems_message_queue_broadcast" ); if ( count != 0 ) { puts( "broadcast with message pending FAILED" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "Init - rtems_message_queue_delete - OK" ); @@ -83,7 +81,7 @@ rtems_task Init( directive_failed( status, "rtems_message_queue_delete" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -91,14 +89,14 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2, sizeof(int) ) + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2, sizeof( int ) ) #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/sp56/init.c b/testsuites/sptests/sp56/init.c index 89cd781fa8..b970891ed3 100644 --- a/testsuites/sptests/sp56/init.c +++ b/testsuites/sptests/sp56/init.c @@ -41,13 +41,10 @@ const char rtems_test_name[] = "SP 56"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -bool task_create(Thread_Control *executing, Thread_Control *created); +rtems_task Init( rtems_task_argument argument ); +bool task_create( Thread_Control *executing, Thread_Control *created ); -bool task_create( - Thread_Control *executing, - Thread_Control *created -) +bool task_create( Thread_Control *executing, Thread_Control *created ) { (void) executing; (void) created; @@ -67,15 +64,13 @@ rtems_extensions_table Extensions = { .thread_terminate = NULL }; -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; - rtems_id extension; - rtems_id task_id; + rtems_status_code status; + rtems_id extension; + rtems_id task_id; TEST_BEGIN(); @@ -89,12 +84,12 @@ rtems_task Init( puts( "Init - rtems_task_create - create extension fails - UNSATISFIED" ); status = rtems_task_create( - rtems_build_name( 'T', 'A', '1', ' ' ), - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_TIMESLICE, - RTEMS_FLOATING_POINT, - &task_id + rtems_build_name( 'T', 'A', '1', ' ' ), + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_TIMESLICE, + RTEMS_FLOATING_POINT, + &task_id ); fatal_directive_status( status, RTEMS_UNSATISFIED, "rtems_task_create" ); @@ -102,7 +97,7 @@ rtems_task Init( status = rtems_extension_delete( extension ); directive_failed( status, "rtems_extension_delete" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -110,9 +105,9 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp57/init.c b/testsuites/sptests/sp57/init.c index e89b5c25d8..1f700b0350 100644 --- a/testsuites/sptests/sp57/init.c +++ b/testsuites/sptests/sp57/init.c @@ -41,44 +41,40 @@ const char rtems_test_name[] = "SP 57"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Delay_task(rtems_task_argument ignored); +rtems_task Init( rtems_task_argument argument ); +rtems_task Delay_task( rtems_task_argument ignored ); -rtems_task Delay_task( - rtems_task_argument ignored -) +rtems_task Delay_task( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; + rtems_status_code status; puts( "Delay - rtems_task_wake_after - OK" ); - status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(2000) ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS( 2000 ) ); directive_failed( status, "wake after" ); puts( "ERROR - delay task woke up!!" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; - rtems_id task_id; + rtems_status_code status; + rtems_id task_id; TEST_BEGIN(); puts( "Init - rtems_task_create - delay task - OK" ); status = rtems_task_create( - rtems_build_name( 'T', 'A', '1', ' ' ), - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_OPTIONS, - RTEMS_DEFAULT_ATTRIBUTES, - &task_id + rtems_build_name( 'T', 'A', '1', ' ' ), + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_OPTIONS, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id ); directive_failed( status, "rtems_task_create" ); @@ -87,7 +83,7 @@ rtems_task Init( directive_failed( status, "rtems_task_start" ); puts( "Init - rtems_task_wake_after - let delay task block - OK" ); - status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS( 1000 ) ); directive_failed( status, "rtems_task_wake_after" ); puts( "Init - rtems_task_restart - delay task - OK" ); @@ -95,7 +91,7 @@ rtems_task Init( directive_failed( status, "rtems_task_restart" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -103,7 +99,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp58/init.c b/testsuites/sptests/sp58/init.c index d1733cf9dc..560b1fce7a 100644 --- a/testsuites/sptests/sp58/init.c +++ b/testsuites/sptests/sp58/init.c @@ -38,21 +38,21 @@ const char rtems_test_name[] = "SP 58"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -void timespec_divide_by_zero(void); -void timespec_greater_than_lhs_sec_less(void); +rtems_task Init( rtems_task_argument argument ); +void timespec_divide_by_zero( void ); +void timespec_greater_than_lhs_sec_less( void ); -void timespec_divide_by_zero(void) +void timespec_divide_by_zero( void ) { - struct timespec t1; - struct timespec zero; - uint32_t ival_percentage; - uint32_t fval_percentage; + struct timespec t1; + struct timespec zero; + uint32_t ival_percentage; + uint32_t fval_percentage; - t1.tv_sec = 1; + t1.tv_sec = 1; t1.tv_nsec = 0; - zero.tv_sec = 0; + zero.tv_sec = 0; zero.tv_nsec = 0; ival_percentage = 1234; @@ -64,16 +64,16 @@ void timespec_divide_by_zero(void) rtems_test_assert( fval_percentage == 0 ); } -void timespec_greater_than_lhs_sec_less(void) +void timespec_greater_than_lhs_sec_less( void ) { - struct timespec lhs; - struct timespec rhs; - bool rc; + struct timespec lhs; + struct timespec rhs; + bool rc; - lhs.tv_sec = 100; + lhs.tv_sec = 100; lhs.tv_nsec = 0; - rhs.tv_sec = 101; + rhs.tv_sec = 101; rhs.tv_nsec = 0; puts( "Init - _Timespec_Greater_than - lhs seconds less" ); @@ -81,9 +81,7 @@ void timespec_greater_than_lhs_sec_less(void) rtems_test_assert( rc == false ); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -93,7 +91,7 @@ rtems_task Init( timespec_greater_than_lhs_sec_less(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -101,7 +99,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp59/init.c b/testsuites/sptests/sp59/init.c index 848e8dc826..fe8ba2bf73 100644 --- a/testsuites/sptests/sp59/init.c +++ b/testsuites/sptests/sp59/init.c @@ -35,21 +35,19 @@ const char rtems_test_name[] = "SP 59"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Blocking_task(rtems_task_argument ignored); +rtems_task Init( rtems_task_argument argument ); +rtems_task Blocking_task( rtems_task_argument ignored ); -uint8_t Region_Memory[512] CPU_STRUCTURE_ALIGNMENT; +uint8_t Region_Memory[ 512 ] CPU_STRUCTURE_ALIGNMENT; #define ALLOC_SIZE ( sizeof( Region_Memory ) / 2 ) rtems_id Region; -rtems_task Blocking_task( - rtems_task_argument ignored -) +rtems_task Blocking_task( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; - void *address_1; + rtems_status_code status; + void *address_1; puts( "Blocking_task - wait for memory" ); status = rtems_region_get_segment( @@ -67,34 +65,32 @@ rtems_task Blocking_task( rtems_task_exit(); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code status; - rtems_id task_id; - void *address_1; - rtems_task_priority priority; + rtems_status_code status; + rtems_id task_id; + void *address_1; + rtems_task_priority priority; TEST_BEGIN(); priority = RTEMS_MAXIMUM_PRIORITY / 4; - priority = (priority * 3) + (priority / 2); + priority = ( priority * 3 ) + ( priority / 2 ); printf( "Init - blocking task priority will be %" PRIdrtems_task_priority "\n", - priority + priority ); puts( "Init - rtems_task_create - delay task - OK" ); status = rtems_task_create( - rtems_build_name( 'T', 'A', '1', ' ' ), - priority, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_OPTIONS, - RTEMS_DEFAULT_ATTRIBUTES, - &task_id + rtems_build_name( 'T', 'A', '1', ' ' ), + priority, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_OPTIONS, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id ); directive_failed( status, "rtems_task_create" ); @@ -104,7 +100,7 @@ rtems_task Init( puts( "Init - rtems_region_create - OK" ); status = rtems_region_create( - rtems_build_name('R', 'N', '0', '1'), + rtems_build_name( 'R', 'N', '0', '1' ), Region_Memory, sizeof( Region_Memory ), 64, @@ -124,7 +120,7 @@ rtems_task Init( directive_failed( status, "rtems_region_get_segment" ); puts( "Init - rtems_task_wake_after - let other task block - OK" ); - status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS( 1000 ) ); directive_failed( status, "rtems_task_wake_after" ); puts( "Init - rtems_region_return_segment - return segment" ); @@ -132,11 +128,11 @@ rtems_task Init( directive_failed( status, "rtems_region_return_segment" ); puts( "Init - rtems_task_wake_after - let other task run again - OK" ); - status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS( 1000 ) ); directive_failed( status, "rtems_task_wake_after" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -144,8 +140,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp60/init.c b/testsuites/sptests/sp60/init.c index a99d56ac18..8b3d888bb0 100644 --- a/testsuites/sptests/sp60/init.c +++ b/testsuites/sptests/sp60/init.c @@ -35,17 +35,15 @@ const char rtems_test_name[] = "SP 60"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code sc; - rtems_id period1; - rtems_id period2; + rtems_status_code sc; + rtems_id period1; + rtems_id period2; TEST_BEGIN(); @@ -64,23 +62,32 @@ rtems_task Init( directive_failed( sc, "rtems_rate_monotonic_create 1" ); puts( "Init - rtems_rate_monotonic_period - short period" ); - sc = rtems_rate_monotonic_period(period1, RTEMS_MILLISECONDS_TO_TICKS(200) ); + sc = rtems_rate_monotonic_period( + period1, + RTEMS_MILLISECONDS_TO_TICKS( 200 ) + ); directive_failed( sc, "rtems_rate_monotonic_period" ); puts( "Init - rtems_rate_monotonic_period - long period initiated" ); - sc = rtems_rate_monotonic_period(period2, RTEMS_MILLISECONDS_TO_TICKS(1000) ); + sc = rtems_rate_monotonic_period( + period2, + RTEMS_MILLISECONDS_TO_TICKS( 1000 ) + ); directive_failed( sc, "rtems_rate_monotonic_period" ); puts( "Init - rtems_rate_monotonic_period - long period block" ); - sc = rtems_rate_monotonic_period(period2, RTEMS_MILLISECONDS_TO_TICKS(1000) ); + sc = rtems_rate_monotonic_period( + period2, + RTEMS_MILLISECONDS_TO_TICKS( 1000 ) + ); directive_failed( sc, "rtems_rate_monotonic_period" ); puts( "Init - rtems_rate_monotonic_period - verify long period expired" ); - sc = rtems_rate_monotonic_period(period1, RTEMS_PERIOD_STATUS ); - fatal_directive_status(sc, RTEMS_TIMEOUT, "rtems_task_period status"); + sc = rtems_rate_monotonic_period( period1, RTEMS_PERIOD_STATUS ); + fatal_directive_status( sc, RTEMS_TIMEOUT, "rtems_task_period status" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -88,8 +95,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PERIODS 2 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PERIODS 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp62/init.c b/testsuites/sptests/sp62/init.c index 3c096a81f1..d54f1d56f7 100644 --- a/testsuites/sptests/sp62/init.c +++ b/testsuites/sptests/sp62/init.c @@ -36,26 +36,24 @@ const char rtems_test_name[] = "SP 62"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Blocker(rtems_task_argument ignored); +rtems_task Init( rtems_task_argument argument ); +rtems_task Blocker( rtems_task_argument ignored ); rtems_id Region; -uint32_t Region_Memory[256] CPU_STRUCTURE_ALIGNMENT; +uint32_t Region_Memory[ 256 ] CPU_STRUCTURE_ALIGNMENT; volatile bool case_hit; -#define SECOND_ALLOC (sizeof(Region_Memory) / 2) -#define RESIZE 1 +#define SECOND_ALLOC ( sizeof( Region_Memory ) / 2 ) +#define RESIZE 1 -rtems_task Blocker( - rtems_task_argument ignored -) +rtems_task Blocker( rtems_task_argument ignored ) { (void) ignored; - rtems_status_code sc; - void *segment_address_2; + rtems_status_code sc; + void *segment_address_2; - puts( "Blocker - rtems_region_get_segment - OK"); + puts( "Blocker - rtems_region_get_segment - OK" ); sc = rtems_region_get_segment( Region, SECOND_ALLOC, @@ -74,17 +72,15 @@ rtems_task Blocker( rtems_task_exit(); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_id task_id; - rtems_status_code sc; - void *segment_address_1; - uintptr_t old_size; - size_t first_alloc_size; + rtems_id task_id; + rtems_status_code sc; + void *segment_address_1; + uintptr_t old_size; + size_t first_alloc_size; TEST_BEGIN(); @@ -107,14 +103,14 @@ rtems_task Init( sc = rtems_region_create( rtems_build_name( 'R', 'N', '1', ' ' ), Region_Memory, - sizeof(Region_Memory), + sizeof( Region_Memory ), 16, RTEMS_DEFAULT_ATTRIBUTES, &Region ); directive_failed( sc, "rtems_region_create" ); - puts( "Init - rtems_region_get_segment - OK"); + puts( "Init - rtems_region_get_segment - OK" ); first_alloc_size = sizeof( Region_Memory ); do { --first_alloc_size; @@ -128,24 +124,28 @@ rtems_task Init( } while ( sc == RTEMS_UNSATISFIED || sc == RTEMS_INVALID_SIZE ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - puts( "Init - sleep 1 second for Blocker - OK"); - sleep(1); + puts( "Init - sleep 1 second for Blocker - OK" ); + sleep( 1 ); /* Check resize_segment errors */ sc = rtems_region_resize_segment( - Region, segment_address_1, RESIZE, &old_size); + Region, + segment_address_1, + RESIZE, + &old_size + ); directive_failed( sc, "rtems_region_resize_segment" ); case_hit = false; - puts( "Init - sleep 1 second for Blocker to run again - OK"); - sleep(1); + puts( "Init - sleep 1 second for Blocker to run again - OK" ); + sleep( 1 ); if ( case_hit ) { puts( "Init - successfully resized and unblocked a task" ); } else { puts( "Init - failed to resize and unblock a task" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* @@ -162,7 +162,7 @@ rtems_task Init( rtems_test_assert( sc == RTEMS_SUCCESSFUL ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -170,8 +170,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp63/init.c b/testsuites/sptests/sp63/init.c index 94c98cdf04..1543da05b2 100644 --- a/testsuites/sptests/sp63/init.c +++ b/testsuites/sptests/sp63/init.c @@ -37,19 +37,19 @@ const char rtems_test_name[] = "SP 63"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -void test_case_one(void); -void test_case_two(void); -void test_case_three(void); +rtems_task Init( rtems_task_argument argument ); +void test_case_one( void ); +void test_case_two( void ); +void test_case_three( void ); -uint32_t Memory[256]; -Heap_Control Heap; +uint32_t Memory[ 256 ]; +Heap_Control Heap; /* * Exercise case in heapresize.c around line 125 when new_block_size * < min_block_size */ -void test_case_one(void) +void test_case_one( void ) { uint32_t heap_size; void *ptr1; @@ -58,19 +58,19 @@ void test_case_one(void) Heap_Resize_status hc; puts( "Init - _Heap_Initialize (for test one) - OK" ); - heap_size = _Heap_Initialize( &Heap, Memory, sizeof(Memory), 8 ); + heap_size = _Heap_Initialize( &Heap, Memory, sizeof( Memory ), 8 ); printf( "Init - Heap size=%" PRIu32 "\n", heap_size ); rtems_test_assert( heap_size ); - puts( "Init - _Heap_Allocate - too large size (overflow)- not OK"); + puts( "Init - _Heap_Allocate - too large size (overflow)- not OK" ); ptr1 = _Heap_Allocate( &Heap, UINTPTR_MAX ); rtems_test_assert( !ptr1 ); - puts( "Init - _Heap_Allocate_aligned - OK"); + puts( "Init - _Heap_Allocate_aligned - OK" ); ptr1 = _Heap_Allocate_aligned( &Heap, 64, 32 ); rtems_test_assert( ptr1 ); - puts( "Init - _Heap_Resize_block - OK"); + puts( "Init - _Heap_Resize_block - OK" ); hc = _Heap_Resize_block( &Heap, ptr1, 4, &old, &avail ); rtems_test_assert( !hc ); } @@ -79,7 +79,7 @@ void test_case_one(void) * Exercise case in heapresize.c around line 140 when next_is_used AND * free_block_size < min_block_size. */ -void test_case_two(void) +void test_case_two( void ) { uint32_t heap_size; void *ptr1; @@ -88,15 +88,15 @@ void test_case_two(void) Heap_Resize_status hc; puts( "\nInit - _Heap_Initialize (for test two) - OK" ); - heap_size = _Heap_Initialize( &Heap, Memory, sizeof(Memory), 8 ); + heap_size = _Heap_Initialize( &Heap, Memory, sizeof( Memory ), 8 ); printf( "Init - Heap size=%" PRIu32 "\n", heap_size ); rtems_test_assert( heap_size ); - puts( "Init - _Heap_Allocate_aligned - OK"); + puts( "Init - _Heap_Allocate_aligned - OK" ); ptr1 = _Heap_Allocate_aligned( &Heap, 64, 4 ); rtems_test_assert( ptr1 ); - puts( "Init - _Heap_Resize_block - OK"); + puts( "Init - _Heap_Resize_block - OK" ); hc = _Heap_Resize_block( &Heap, ptr1, 56, &old, &avail ); rtems_test_assert( !hc ); } @@ -104,17 +104,17 @@ void test_case_two(void) /* * Exercise case in heapallocatealigned.c around line 223 when ... */ -void test_case_three(void) +void test_case_three( void ) { - uint32_t heap_size; - void *ptr1; + uint32_t heap_size; + void *ptr1; #if 0 Heap_Resize_status hc; #endif size_t alloc; - int pg, al, sz; + int pg, al, sz; - puts( "Init - _Heap_Allocate_aligned - request impossible - not OK"); + puts( "Init - _Heap_Allocate_aligned - request impossible - not OK" ); #if 0 heap_size = @@ -123,28 +123,29 @@ void test_case_three(void) ptr1 = _Heap_Allocate_aligned( &Heap, 256, 1 << 16 ); #endif #if 1 - for ( sz=32 ; sz <= 80 ; sz+=4 ) { - for ( pg=2 ; pg < 12 ; pg++ ) { - - for ( al=16 ; al >=4 ; al-- ) { - for ( alloc=4 ; alloc < sizeof(Memory)/2 ; alloc+=4 ) { - heap_size = - _Heap_Initialize( &Heap, &Memory[sz], sizeof(Memory)/2, 1 << pg ); + for ( sz = 32; sz <= 80; sz += 4 ) { + for ( pg = 2; pg < 12; pg++ ) { + for ( al = 16; al >= 4; al-- ) { + for ( alloc = 4; alloc < sizeof( Memory ) / 2; alloc += 4 ) { + heap_size = _Heap_Initialize( + &Heap, + &Memory[ sz ], + sizeof( Memory ) / 2, + 1 << pg + ); if ( heap_size != 0 ) { do { - ptr1 = _Heap_Allocate_aligned( &Heap, alloc, 1 < /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Task_1(rtems_task_argument arg); +rtems_task Init( rtems_task_argument argument ); +rtems_task Task_1( rtems_task_argument arg ); -#if defined(INHERIT_CEILING) - #define TEST_NAME "66" - #define TASK_PRIORITY 2 +#if defined( INHERIT_CEILING ) + #define TEST_NAME "66" + #define TASK_PRIORITY 2 #else - #define TEST_NAME "65" - #define TASK_PRIORITY 1 + #define TEST_NAME "65" + #define TASK_PRIORITY 1 #endif const char rtems_test_name[] = "SP " TEST_NAME; -static void assert_priority(rtems_task_priority expected) +static void assert_priority( rtems_task_priority expected ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority prio; - sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(prio == expected); + rtems_test_assert( prio == expected ); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - int status; - rtems_id Mutex_id, Task_id; + int status; + rtems_id Mutex_id, Task_id; TEST_BEGIN(); @@ -75,23 +73,23 @@ rtems_task Init( */ status = rtems_semaphore_create( - rtems_build_name( 's','e','m','1' ), + rtems_build_name( 's', 'e', 'm', '1' ), 0, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING, 1, &Mutex_id ); - rtems_test_assert(status == RTEMS_SUCCESSFUL); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); - assert_priority(1); + assert_priority( 1 ); - status = rtems_semaphore_release(Mutex_id); - rtems_test_assert(status == RTEMS_SUCCESSFUL); + status = rtems_semaphore_release( Mutex_id ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); - assert_priority(TASK_PRIORITY); + assert_priority( TASK_PRIORITY ); - status = rtems_semaphore_delete(Mutex_id); - rtems_test_assert(status == RTEMS_SUCCESSFUL); + status = rtems_semaphore_delete( Mutex_id ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); /* * Create binary semaphore (a.k.a. Mutex) with Priority Ceiling @@ -100,7 +98,7 @@ rtems_task Init( puts( "Creating semaphore" ); status = rtems_semaphore_create( - rtems_build_name( 's','e','m','1' ), + rtems_build_name( 's', 'e', 'm', '1' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING, 1, @@ -113,7 +111,8 @@ rtems_task Init( directive_failed( status, "rtems_semaphore_obtain" ); puts( "Calling rtems_task_create" ); - status = rtems_task_create( rtems_build_name( 'T', 'A', 'S', '1' ), + status = rtems_task_create( + rtems_build_name( 'T', 'A', 'S', '1' ), TASK_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, @@ -123,10 +122,14 @@ rtems_task Init( directive_failed( status, "rtems_task_create" ); puts( "Calling rtems_task_start" ); - status = rtems_task_start( Task_id, Task_1, (rtems_task_argument)&Mutex_id ); + status = rtems_task_start( + Task_id, + Task_1, + (rtems_task_argument) &Mutex_id + ); directive_failed( status, "rtems_task_start" ); - sleep(1); + sleep( 1 ); puts( "Calling semaphore release" ); status = rtems_semaphore_release( Mutex_id ); @@ -134,15 +137,13 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } -rtems_task Task_1( - rtems_task_argument arg -) +rtems_task Task_1( rtems_task_argument arg ) { - int status_in_task; - rtems_id *Mutex_id = (rtems_id *)arg; + int status_in_task; + rtems_id *Mutex_id = (rtems_id *) arg; puts( "Init Task_1: Obtaining semaphore" ); status_in_task = rtems_semaphore_obtain( @@ -159,9 +160,9 @@ rtems_task Task_1( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_INIT_TASK_PRIORITY TASK_PRIORITY +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_INIT_TASK_PRIORITY TASK_PRIORITY #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp67/init.c b/testsuites/sptests/sp67/init.c index 40d676ceb6..ee13b75f21 100644 --- a/testsuites/sptests/sp67/init.c +++ b/testsuites/sptests/sp67/init.c @@ -48,10 +48,10 @@ const char rtems_test_name[] = "SP 67"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine TIMER_service_routine( - rtems_id ignored_id, - void *user_data + rtems_id ignored_id, + void *user_data ); volatile bool _timer_passage_1 = FALSE; @@ -59,19 +59,17 @@ volatile bool _timer_passage_2 = FALSE; /*timer Routine*/ rtems_timer_service_routine TIMER_service_routine( - rtems_id ignored_id, - void *user_data + rtems_id ignored_id, + void *user_data ) { (void) ignored_id; - bool *passed = (bool *)user_data; + bool *passed = (bool *) user_data; *passed = TRUE; } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -85,11 +83,17 @@ rtems_task Init( /* create Timer */ puts( "Init - create timer 1" ); - status = rtems_timer_create( rtems_build_name('T', 'M', '1', ' '), &timer1 ); + status = rtems_timer_create( + rtems_build_name( 'T', 'M', '1', ' ' ), + &timer1 + ); directive_failed( status, "rtems_timer_create #1" ); puts( "Init - create timer 2" ); - status = rtems_timer_create( rtems_build_name('T', 'M', '2', ' '), &timer2 ); + status = rtems_timer_create( + rtems_build_name( 'T', 'M', '2', ' ' ), + &timer2 + ); directive_failed( status, "rtems_timer_create #1" ); /* Manipulate the time */ @@ -112,7 +116,7 @@ rtems_task Init( timer1, 10, TIMER_service_routine, - (void*) &_timer_passage_1 + (void *) &_timer_passage_1 ); directive_failed( status, "rtems_timer_server_fire_after" ); @@ -120,26 +124,26 @@ rtems_task Init( timer2, 20, TIMER_service_routine, - (void*) &_timer_passage_2 + (void *) &_timer_passage_2 ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_task_wake_after( 15 ); directive_failed( status, "task wake_after" ); - if (!_timer_passage_1) { - puts( "Timer 1 FAILED to fire after wrapping time"); - rtems_test_exit(0); + if ( !_timer_passage_1 ) { + puts( "Timer 1 FAILED to fire after wrapping time" ); + rtems_test_exit( 0 ); } - puts( "Server Timer 1 fired after wrapping ticks since boot-- OK"); + puts( "Server Timer 1 fired after wrapping ticks since boot-- OK" ); - if (_timer_passage_2) { - puts( "Timer 2 fired and should not have after wrapping time"); - rtems_test_exit(0); + if ( _timer_passage_2 ) { + puts( "Timer 2 fired and should not have after wrapping time" ); + rtems_test_exit( 0 ); } TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration stuff */ @@ -147,8 +151,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sp68/init.c b/testsuites/sptests/sp68/init.c index 0b8fc41aa7..1b0e4c0012 100644 --- a/testsuites/sptests/sp68/init.c +++ b/testsuites/sptests/sp68/init.c @@ -42,15 +42,15 @@ const char rtems_test_name[] = "SP 68"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); #define TIMER_COUNT 6 -#define OBTAIN 0 -#define RELEASE 1 -#define INTERRUPT 2 -#define DELAYED 3 -#define SERVER_TRIGGERED 4 +#define OBTAIN 0 +#define RELEASE 1 +#define INTERRUPT 2 +#define DELAYED 3 +#define SERVER_TRIGGERED 4 #define INTERRUPT_TRIGGERED 5 #define T0 0 @@ -69,7 +69,7 @@ static volatile bool delayed_happened; static volatile bool server_triggered_happened; static volatile bool interrupt_triggered_happened; -static rtems_id timer [TIMER_COUNT]; +static rtems_id timer[ TIMER_COUNT ]; static rtems_id semaphore; static rtems_id mutex; @@ -93,7 +93,7 @@ static volatile enum resource_type { TASK_WAKE_AFTER } resource_type; -static const char *const resource_type_desc [] = { +static const char *const resource_type_desc[] = { "SEMAPHORE", "MUTEX", "MESSAGE QUEUE", @@ -103,118 +103,128 @@ static const char *const resource_type_desc [] = { "TASK WAKE AFTER" }; -static void assert_time(rtems_interval expected) +static void assert_time( rtems_interval expected ) { - rtems_test_assert((rtems_clock_get_ticks_since_boot() - start) == expected); + rtems_test_assert( + ( rtems_clock_get_ticks_since_boot() - start ) == expected + ); } -static void obtain_callback(rtems_id timer_id, void *arg) +static void obtain_callback( rtems_id timer_id, void *arg ) { (void) timer_id; (void) arg; rtems_status_code sc = RTEMS_SUCCESSFUL; - char buf [1]; - size_t size = sizeof(buf); - void *new_region_item = NULL; - rtems_event_set events = 0; + char buf[ 1 ]; + size_t size = sizeof( buf ); + void *new_region_item = NULL; + rtems_event_set events = 0; - assert_time(T1); + assert_time( T1 ); rtems_test_assert( - !release_happened - && !interrupt_happened - && !delayed_happened - && !interrupt_triggered_happened - && !server_triggered_happened + !release_happened && !interrupt_happened && !delayed_happened && + !interrupt_triggered_happened && !server_triggered_happened ); obtain_try = true; - switch (resource_type) { + switch ( resource_type ) { case SEMAPHORE: - sc = rtems_semaphore_obtain(semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + sc = rtems_semaphore_obtain( semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); break; case MUTEX: - sc = rtems_semaphore_obtain(mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + sc = rtems_semaphore_obtain( mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); break; case MESSAGE_QUEUE: sc = rtems_message_queue_receive( - message_queue, buf, &size, RTEMS_WAIT, RTEMS_NO_TIMEOUT); + message_queue, + buf, + &size, + RTEMS_WAIT, + RTEMS_NO_TIMEOUT + ); break; case REGION: sc = rtems_region_get_segment( - region, 1, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &new_region_item); + region, + 1, + RTEMS_WAIT, + RTEMS_NO_TIMEOUT, + &new_region_item + ); break; case EVENT: timer_server_id = rtems_task_self(); sc = rtems_event_receive( - RTEMS_EVENT_0, RTEMS_EVENT_ALL | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); + RTEMS_EVENT_0, + RTEMS_EVENT_ALL | RTEMS_WAIT, + RTEMS_NO_TIMEOUT, + &events + ); break; case BARRIER: - sc = rtems_barrier_wait(barrier, RTEMS_NO_TIMEOUT); + sc = rtems_barrier_wait( barrier, RTEMS_NO_TIMEOUT ); break; case TASK_WAKE_AFTER: - sc = rtems_task_wake_after(T4 - T1); + sc = rtems_task_wake_after( T4 - T1 ); break; default: - rtems_test_assert(false); + rtems_test_assert( false ); break; } - directive_failed(sc, "obtain"); + directive_failed( sc, "obtain" ); obtain_done = true; } -static void release_callback(rtems_id timer_id, void *arg) +static void release_callback( rtems_id timer_id, void *arg ) { (void) timer_id; (void) arg; rtems_status_code sc = RTEMS_SUCCESSFUL; - char buf [1] = { 0 }; - size_t size = sizeof(buf); - uint32_t released = 0; + char buf[ 1 ] = { 0 }; + size_t size = sizeof( buf ); + uint32_t released = 0; - assert_time(T4); + assert_time( T4 ); rtems_test_assert( - obtain_try - && interrupt_happened - && !delayed_happened - && !interrupt_triggered_happened - && !server_triggered_happened + obtain_try && interrupt_happened && !delayed_happened && + !interrupt_triggered_happened && !server_triggered_happened ); - switch (resource_type) { + switch ( resource_type ) { case SEMAPHORE: - sc = rtems_semaphore_release(semaphore); + sc = rtems_semaphore_release( semaphore ); break; case MUTEX: - sc = rtems_semaphore_release(mutex); + sc = rtems_semaphore_release( mutex ); break; case MESSAGE_QUEUE: - sc = rtems_message_queue_send(message_queue, buf, size); + sc = rtems_message_queue_send( message_queue, buf, size ); break; case EVENT: - sc = rtems_event_send(timer_server_id, RTEMS_EVENT_0); + sc = rtems_event_send( timer_server_id, RTEMS_EVENT_0 ); break; case BARRIER: - sc = rtems_barrier_release(barrier, &released); + sc = rtems_barrier_release( barrier, &released ); break; case TASK_WAKE_AFTER: sc = RTEMS_SUCCESSFUL; break; default: - rtems_test_assert(false); + rtems_test_assert( false ); break; } - directive_failed_with_level(sc, "release", 1); + directive_failed_with_level( sc, "release", 1 ); release_happened = true; } -static void interrupt_triggered_callback(rtems_id timer_id, void *arg) +static void interrupt_triggered_callback( rtems_id timer_id, void *arg ) { (void) timer_id; (void) arg; @@ -223,93 +233,82 @@ static void interrupt_triggered_callback(rtems_id timer_id, void *arg) * This callback is scheduled to fire at T3, but is delayed due to the * blocked obtain callback. */ - assert_time(T4); + assert_time( T4 ); rtems_test_assert( - obtain_done - && release_happened - && interrupt_happened - && !server_triggered_happened + obtain_done && release_happened && interrupt_happened && + !server_triggered_happened ); interrupt_triggered_happened = true; } -static void interrupt_callback(rtems_id timer_id, void *arg) +static void interrupt_callback( rtems_id timer_id, void *arg ) { (void) timer_id; (void) arg; rtems_status_code sc = RTEMS_SUCCESSFUL; - assert_time(T2); + assert_time( T2 ); rtems_test_assert( - obtain_try - && !obtain_done - && !release_happened - && !delayed_happened - && !interrupt_triggered_happened - && !server_triggered_happened + obtain_try && !obtain_done && !release_happened && !delayed_happened && + !interrupt_triggered_happened && !server_triggered_happened ); sc = rtems_timer_server_fire_after( - timer [INTERRUPT_TRIGGERED], + timer[ INTERRUPT_TRIGGERED ], T3 - T2, interrupt_triggered_callback, NULL ); - directive_failed_with_level(sc, "rtems_timer_server_fire_after", -1); + directive_failed_with_level( sc, "rtems_timer_server_fire_after", -1 ); interrupt_happened = true; } -static void server_triggered_callback(rtems_id timer_id, void *arg) +static void server_triggered_callback( rtems_id timer_id, void *arg ) { (void) timer_id; (void) arg; - assert_time(T5); + assert_time( T5 ); rtems_test_assert( - obtain_done - && release_happened - && interrupt_happened - && delayed_happened - && interrupt_triggered_happened + obtain_done && release_happened && interrupt_happened && + delayed_happened && interrupt_triggered_happened ); server_triggered_happened = true; } -static void delayed_callback(rtems_id timer_id, void *arg) +static void delayed_callback( rtems_id timer_id, void *arg ) { (void) timer_id; (void) arg; rtems_status_code sc = RTEMS_SUCCESSFUL; - assert_time(T4); + assert_time( T4 ); rtems_test_assert( - obtain_done - && release_happened - && interrupt_happened - && !server_triggered_happened + obtain_done && release_happened && interrupt_happened && + !server_triggered_happened ); sc = rtems_timer_server_fire_after( - timer [SERVER_TRIGGERED], + timer[ SERVER_TRIGGERED ], T5 - T4, server_triggered_callback, NULL ); - directive_failed(sc, "rtems_timer_server_fire_after"); + directive_failed( sc, "rtems_timer_server_fire_after" ); delayed_happened = true; } -static void test_reset(void) +static void test_reset( void ) { rtems_status_code sc = RTEMS_SUCCESSFUL; @@ -322,112 +321,106 @@ static void test_reset(void) server_triggered_happened = false; /* Synchronize with tick */ - sc = rtems_task_wake_after(1); - directive_failed(sc, "rtems_task_wake_after"); + sc = rtems_task_wake_after( 1 ); + directive_failed( sc, "rtems_task_wake_after" ); start = rtems_clock_get_ticks_since_boot(); } -static void test_case(enum resource_type rt) +static void test_case( enum resource_type rt ) { rtems_status_code sc = RTEMS_SUCCESSFUL; - printf("test case: %s\n", resource_type_desc [rt]); + printf( "test case: %s\n", resource_type_desc[ rt ] ); resource_type = rt; test_reset(); sc = rtems_timer_server_fire_after( - timer [OBTAIN], + timer[ OBTAIN ], T1 - T0, obtain_callback, NULL ); - directive_failed(sc, "rtems_timer_server_fire_after"); + directive_failed( sc, "rtems_timer_server_fire_after" ); sc = rtems_timer_fire_after( - timer [INTERRUPT], + timer[ INTERRUPT ], T2 - T0, interrupt_callback, NULL ); - directive_failed(sc, "rtems_timer_fire_after"); + directive_failed( sc, "rtems_timer_fire_after" ); sc = rtems_timer_server_fire_after( - timer [DELAYED], + timer[ DELAYED ], T3 - T0, delayed_callback, NULL ); - directive_failed(sc, "rtems_timer_server_fire_after"); + directive_failed( sc, "rtems_timer_server_fire_after" ); - if (resource_type != REGION) { + if ( resource_type != REGION ) { sc = rtems_timer_fire_after( - timer [RELEASE], + timer[ RELEASE ], T4 - T0, release_callback, NULL ); - directive_failed(sc, "rtems_timer_fire_after"); + directive_failed( sc, "rtems_timer_fire_after" ); - assert_time(T0); + assert_time( T0 ); - sc = rtems_task_wake_after(T6 - T0); - directive_failed(sc, "task_wake_after"); + sc = rtems_task_wake_after( T6 - T0 ); + directive_failed( sc, "task_wake_after" ); } else { - sc = rtems_task_wake_after(T4 - T0); - directive_failed(sc, "task_wake_after"); + sc = rtems_task_wake_after( T4 - T0 ); + directive_failed( sc, "task_wake_after" ); - assert_time(T4); + assert_time( T4 ); rtems_test_assert( - obtain_try - && interrupt_happened - && !delayed_happened - && !interrupt_triggered_happened - && !server_triggered_happened + obtain_try && interrupt_happened && !delayed_happened && + !interrupt_triggered_happened && !server_triggered_happened ); - sc = rtems_region_return_segment(region, region_item); - directive_failed(sc, "rtems_region_return_segment"); + sc = rtems_region_return_segment( region, region_item ); + directive_failed( sc, "rtems_region_return_segment" ); release_happened = true; - sc = rtems_task_wake_after(T6 - T4); - directive_failed(sc, "task_wake_after"); + sc = rtems_task_wake_after( T6 - T4 ); + directive_failed( sc, "task_wake_after" ); } - assert_time(T6); + assert_time( T6 ); rtems_test_assert( - obtain_done - && interrupt_happened - && release_happened - && delayed_happened - && interrupt_triggered_happened - && server_triggered_happened + obtain_done && interrupt_happened && release_happened && + delayed_happened && interrupt_triggered_happened && + server_triggered_happened ); } -rtems_task Init(rtems_task_argument argument) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code sc = RTEMS_SUCCESSFUL; - char region_area [256]; + rtems_status_code sc = RTEMS_SUCCESSFUL; + char region_area[ 256 ]; enum resource_type rt = SEMAPHORE; - void *new_region_item = NULL; - size_t i = 0; + void *new_region_item = NULL; + size_t i = 0; TEST_BEGIN(); - for (i = 0; i < TIMER_COUNT; ++i) { + for ( i = 0; i < TIMER_COUNT; ++i ) { sc = rtems_timer_create( - rtems_build_name('T', 'I', 'M', '0' + i), - &timer [i] + rtems_build_name( 'T', 'I', 'M', '0' + i ), + &timer[ i ] ); - directive_failed(sc, "rtems_timer_create"); + directive_failed( sc, "rtems_timer_create" ); } sc = rtems_timer_initiate_server( @@ -435,79 +428,84 @@ rtems_task Init(rtems_task_argument argument) RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); - directive_failed(sc, "rtems_timer_initiate_server"); + directive_failed( sc, "rtems_timer_initiate_server" ); sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 0, RTEMS_LOCAL | RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE, 0, &semaphore ); - directive_failed(sc, "rtems_semaphore_create"); + directive_failed( sc, "rtems_semaphore_create" ); sc = rtems_semaphore_create( - rtems_build_name('M', 'U', 'T', 'X'), + rtems_build_name( 'M', 'U', 'T', 'X' ), 0, RTEMS_LOCAL | RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE, 0, &mutex ); - directive_failed(sc, "rtems_semaphore_create"); + directive_failed( sc, "rtems_semaphore_create" ); sc = rtems_message_queue_create( - rtems_build_name('M', 'S', 'G', 'Q'), + rtems_build_name( 'M', 'S', 'G', 'Q' ), 1, 1, RTEMS_LOCAL | RTEMS_FIFO, &message_queue ); - directive_failed(sc, "rtems_message_queue_create"); + directive_failed( sc, "rtems_message_queue_create" ); sc = rtems_region_create( - rtems_build_name('R', 'E', 'G', 'I'), + rtems_build_name( 'R', 'E', 'G', 'I' ), region_area, - sizeof(region_area), + sizeof( region_area ), 1, RTEMS_LOCAL | RTEMS_FIFO, ®ion ); - directive_failed(sc, "rtems_region_create"); + directive_failed( sc, "rtems_region_create" ); do { region_item = new_region_item; sc = rtems_region_get_segment( - region, 1, RTEMS_NO_WAIT, 0, &new_region_item); - } while (sc == RTEMS_SUCCESSFUL); + region, + 1, + RTEMS_NO_WAIT, + 0, + &new_region_item + ); + } while ( sc == RTEMS_SUCCESSFUL ); sc = rtems_barrier_create( - rtems_build_name('B', 'A', 'R', 'R'), + rtems_build_name( 'B', 'A', 'R', 'R' ), RTEMS_LOCAL | RTEMS_FIFO, 2, &barrier ); - directive_failed(sc, "rtems_barrier_create"); + directive_failed( sc, "rtems_barrier_create" ); - while (rt <= TASK_WAKE_AFTER) { - test_case(rt); + while ( rt <= TASK_WAKE_AFTER ) { + test_case( rt ); ++rt; } TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS TIMER_COUNT -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS TIMER_COUNT +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1) -#define CONFIGURE_MAXIMUM_REGIONS 1 + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 1, 1 ) +#define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_MAXIMUM_BARRIERS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/init.c index e581db4926..863e4b75e0 100644 --- a/testsuites/sptests/sp69/init.c +++ b/testsuites/sptests/sp69/init.c @@ -37,30 +37,25 @@ const char rtems_test_name[] = "SP 69"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_id period_id; - rtems_name period_name; - rtems_rate_monotonic_period_status period_status; - rtems_status_code status; - rtems_rate_monotonic_period_statistics statistics; - uint32_t i; + rtems_id period_id; + rtems_name period_name; + rtems_rate_monotonic_period_status period_status; + rtems_status_code status; + rtems_rate_monotonic_period_statistics statistics; + uint32_t i; - period_name = rtems_build_name('P','E','R','1'); + period_name = rtems_build_name( 'P', 'E', 'R', '1' ); TEST_BEGIN(); /* create period */ - status = rtems_rate_monotonic_create( - period_name, - &period_id - ); + status = rtems_rate_monotonic_create( period_name, &period_id ); directive_failed( status, "rate_monotonic_create" ); /* @@ -88,7 +83,9 @@ rtems_task Init( /* * Check normal get_status results. */ - puts( "rtems_rate_monotonic_get_status - verify values of an active period" ); + puts( + "rtems_rate_monotonic_get_status - verify values of an active period" + ); rtems_test_spin_until_next_tick(); status = rtems_rate_monotonic_period( period_id, 100 ); directive_failed( status, "rate_monotonic_period" ); @@ -134,7 +131,7 @@ rtems_task Init( status = rtems_rate_monotonic_period( period_id, 50 ); directive_failed( status, "rate_monotonic_period above loop" ); - for ( i=1 ; i <= 3 ; i++ ) { + for ( i = 1; i <= 3; i++ ) { status = rtems_task_wake_after( 100 ); directive_failed( status, "rtems_task_wake_after(100)" ); @@ -169,7 +166,7 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -177,14 +174,13 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE - #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/sp70/init.c b/testsuites/sptests/sp70/init.c index 8932aaa155..6774a00032 100644 --- a/testsuites/sptests/sp70/init.c +++ b/testsuites/sptests/sp70/init.c @@ -36,13 +36,13 @@ const char rtems_test_name[] = "SP 70"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -void create_helper(int task); -void delete_helper(int task); - -rtems_id TaskID[10]; +rtems_task Init( rtems_task_argument argument ); +void create_helper( int task ); +void delete_helper( int task ); -void create_helper(int task) +rtems_id TaskID[ 10 ]; + +void create_helper( int task ) { rtems_status_code status; @@ -53,23 +53,21 @@ void create_helper(int task) RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &TaskID[task] + &TaskID[ task ] ); directive_failed( status, "rtems_task_create" ); } -void delete_helper(int task) +void delete_helper( int task ) { rtems_status_code status; printf( "Deleting task %d\n", task ); - status = rtems_task_delete( TaskID[task] ); + status = rtems_task_delete( TaskID[ task ] ); directive_failed( status, "rtems_task_delete" ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -94,7 +92,7 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -103,7 +101,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_UNIFIED_WORK_AREAS -#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(1) +#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited( 1 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp71/init.c b/testsuites/sptests/sp71/init.c index 352d5f5635..0a8084d78d 100644 --- a/testsuites/sptests/sp71/init.c +++ b/testsuites/sptests/sp71/init.c @@ -26,7 +26,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#if !defined(PER_ALLOCATION) +#if !defined( PER_ALLOCATION ) #define PER_ALLOCATION 8000 #endif @@ -40,11 +40,9 @@ const char rtems_test_name[] = "SP 71"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -63,11 +61,12 @@ rtems_task Init( 1024, &id ); - if ( status == RTEMS_TOO_MANY ) + if ( status == RTEMS_TOO_MANY ) { break; + } directive_failed( status, "rtems_task_create" ); created++; - } while (1); + } while ( 1 ); printf( "%zu ports created using %d per allocation -- need %ld\n", @@ -76,13 +75,13 @@ rtems_task Init( (long) OBJECTS_ID_FINAL_INDEX ); - if ( (created + PER_ALLOCATION) > OBJECTS_ID_FINAL_INDEX ) { + if ( ( created + PER_ALLOCATION ) > OBJECTS_ID_FINAL_INDEX ) { puts( "Test case hit" ); TEST_END(); } else { puts( "Test case NOT hit" ); } - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -90,8 +89,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PORTS rtems_resource_unlimited(PER_ALLOCATION) +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PORTS rtems_resource_unlimited( PER_ALLOCATION ) #define CONFIGURE_UNIFIED_WORK_AREAS #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sp72/init.c b/testsuites/sptests/sp72/init.c index 94e959ae9b..1ad6051991 100644 --- a/testsuites/sptests/sp72/init.c +++ b/testsuites/sptests/sp72/init.c @@ -36,14 +36,12 @@ const char rtems_test_name[] = "SP 72"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Test_task(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); +rtems_task Test_task( rtems_task_argument argument ); rtems_id Semaphore_id; -rtems_task Test_task( - rtems_task_argument argument -) +rtems_task Test_task( rtems_task_argument argument ) { (void) argument; @@ -56,12 +54,9 @@ rtems_task Test_task( rtems_clock_get_ticks_per_second() * 10 ); directive_failed( status, "obtain" ); - } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -88,7 +83,7 @@ rtems_task Init( &task_id ); directive_failed( status, "rtems_task_create" ); - + status = rtems_task_start( task_id, Test_task, 0 ); directive_failed( status, "rtems_task_start" ); @@ -102,7 +97,7 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -110,8 +105,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp73/init.c b/testsuites/sptests/sp73/init.c index e4d080165b..01cb742828 100644 --- a/testsuites/sptests/sp73/init.c +++ b/testsuites/sptests/sp73/init.c @@ -37,22 +37,20 @@ const char rtems_test_name[] = "SP 73"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Test_task(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); +rtems_task Test_task( rtems_task_argument argument ); -rtems_id Task_id[ 4 ]; /* array of task ids */ -rtems_name Task_name[ 4 ]; /* array of task names */ +rtems_id Task_id[ 4 ]; /* array of task ids */ +rtems_name Task_name[ 4 ]; /* array of task names */ -rtems_task Test_task( - rtems_task_argument arg -) +rtems_task Test_task( rtems_task_argument arg ) { rtems_time_of_day time; uint32_t task_index; rtems_status_code status; task_index = arg; - for ( ; ; ) { + for ( ;; ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "get tod" ); @@ -69,9 +67,7 @@ rtems_task Test_task( } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -81,13 +77,13 @@ rtems_task Init( TEST_BEGIN(); - time.year = 1988; - time.month = 12; - time.day = 31; - time.hour = 9; + time.year = 1988; + time.month = 12; + time.day = 31; + time.hour = 9; time.minute = 0; time.second = 0; - time.ticks = 0; + time.ticks = 0; status = rtems_clock_set( &time ); @@ -96,20 +92,32 @@ rtems_task Init( Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); status = rtems_task_create( - Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "create 1" ); status = rtems_task_create( - Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); directive_failed( status, "create 2" ); status = rtems_task_create( - Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] + Task_name[ 3 ], + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "create 3" ); @@ -124,7 +132,7 @@ rtems_task Init( status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); directive_failed( status, "start 3" ); - status = rtems_task_set_priority(Task_id[1], 1, &old); + status = rtems_task_set_priority( Task_id[ 1 ], 1, &old ); directive_failed( status, "set priority" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); @@ -138,9 +146,9 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 -#define CONFIGURE_INIT_TASK_PRIORITY 2 +#define CONFIGURE_INIT_TASK_PRIORITY 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp74/init.c b/testsuites/sptests/sp74/init.c index bb725b163a..6b51d2a366 100644 --- a/testsuites/sptests/sp74/init.c +++ b/testsuites/sptests/sp74/init.c @@ -35,12 +35,10 @@ const char rtems_test_name[] = "SP 74"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Test_task(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); +rtems_task Test_task( rtems_task_argument argument ); -rtems_task Test_task( - rtems_task_argument index -) +rtems_task Test_task( rtems_task_argument index ) { (void) index; @@ -50,14 +48,12 @@ rtems_task Test_task( rtems_test_exit( 0 ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_id id; + rtems_status_code status; + rtems_id id; TEST_BEGIN(); @@ -88,8 +84,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_INIT_TASK_PRIORITY 2 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_INIT_TASK_PRIORITY 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sp75/init.c b/testsuites/sptests/sp75/init.c index c19c8703ff..a151048b7f 100644 --- a/testsuites/sptests/sp75/init.c +++ b/testsuites/sptests/sp75/init.c @@ -36,28 +36,26 @@ const char rtems_test_name[] = "SP 75"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code sc; - rtems_id mutex; - Per_CPU_Control *cpu_self; + rtems_status_code sc; + rtems_id mutex; + Per_CPU_Control *cpu_self; TEST_BEGIN(); sc = rtems_semaphore_create( - rtems_build_name('M', 'U', 'T', 'X'), + rtems_build_name( 'M', 'U', 'T', 'X' ), 0, RTEMS_BINARY_SEMAPHORE, 0, &mutex ); - directive_failed(sc, "rtems_semaphore_create"); + directive_failed( sc, "rtems_semaphore_create" ); /* * Call semaphore obtain with dispatching disabled. Reenable @@ -66,12 +64,12 @@ rtems_task Init( */ puts( "rtems_semaphore_obtain - with dispatching disabled" ); cpu_self = _Thread_Dispatch_disable(); - sc = rtems_semaphore_obtain(mutex, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT); - _Thread_Dispatch_enable(cpu_self); - directive_failed(sc, "rtems_semaphore_obtain"); + sc = rtems_semaphore_obtain( mutex, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT ); + _Thread_Dispatch_enable( cpu_self ); + directive_failed( sc, "rtems_semaphore_obtain" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -79,8 +77,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sp76/init.c b/testsuites/sptests/sp76/init.c index 0b8c83fa9d..a02f7aaf66 100644 --- a/testsuites/sptests/sp76/init.c +++ b/testsuites/sptests/sp76/init.c @@ -34,14 +34,12 @@ const char rtems_test_name[] = "SP 76"; -static rtems_task High_task( - rtems_task_argument index -) +static rtems_task High_task( rtems_task_argument index ) { (void) index; - rtems_status_code status; - rtems_name name; + rtems_status_code status; + rtems_name name; status = rtems_object_get_classic_name( rtems_task_self(), &name ); directive_failed( status, "rtems_object_get_classic_name" ); @@ -53,24 +51,20 @@ static rtems_task High_task( rtems_test_exit( 0 ); } -static rtems_task Equal_task( - rtems_task_argument index -) +static rtems_task Equal_task( rtems_task_argument index ) { (void) index; rtems_test_assert( 0 ); } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_id id; - rtems_task_priority old; + rtems_status_code status; + rtems_id id; + rtems_task_priority old; TEST_BEGIN(); @@ -123,8 +117,8 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_INIT_TASK_PRIORITY 2 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_INIT_TASK_PRIORITY 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sp77/init.c b/testsuites/sptests/sp77/init.c index 8cd33bd106..6e378ff661 100644 --- a/testsuites/sptests/sp77/init.c +++ b/testsuites/sptests/sp77/init.c @@ -15,32 +15,33 @@ const char rtems_test_name[] = "SP 77"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); rtems_status_code status; - rtems_id id; + rtems_id id; status = rtems_message_queue_create( - rtems_build_name( 'M', 'Q' , 'T', '1'), + rtems_build_name( 'M', 'Q', 'T', '1' ), 2, - SIZE_MAX-2, + SIZE_MAX - 2, RTEMS_DEFAULT_ATTRIBUTES, - &id + &id + ); + + fatal_directive_check_status_only( + status, + RTEMS_INVALID_SIZE, + "attempt to create message queue return: " ); - - fatal_directive_check_status_only(status , RTEMS_INVALID_SIZE , - "attempt to create message queue return: "); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -48,7 +49,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE @@ -56,8 +57,8 @@ rtems_task Init( #define CONFIGURE_INIT #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MESSAGE_BUFFER_MEMORY (CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( \ - 2,SIZE_MAX)) +#define CONFIGURE_MESSAGE_BUFFER_MEMORY \ + ( CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2, SIZE_MAX ) ) #include /* end of file */ diff --git a/testsuites/sptests/spassoc01/init.c b/testsuites/sptests/spassoc01/init.c index 4e14339c84..0a4b22c4e7 100644 --- a/testsuites/sptests/spassoc01/init.c +++ b/testsuites/sptests/spassoc01/init.c @@ -39,41 +39,38 @@ const char rtems_test_name[] = "SPASSOC 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -const rtems_assoc_t assoc_table_null[] = - { - { NULL , 0 , 0 }, - { "zero" , 1 , 8 }, - { "one" , 2 , 4 }, - { "two" , 4 , 2 }, - { "three" , 8 , 1 }, - { NULL , -1, -1 } - }; +const rtems_assoc_t assoc_table_null[] = { + { NULL, 0, 0 }, + { "zero", 1, 8 }, + { "one", 2, 4 }, + { "two", 4, 2 }, + { "three", 8, 1 }, + { NULL, -1, -1 } +}; -const rtems_assoc_t assoc_table_default[] = - { - { "(default)", 0 , 0 }, - { "zero" , 1 , 8 }, - { "one" , 2 , 4 }, - { "two" , 4 , 2 }, - { "three" , 8 , 1 }, - { NULL , -1, -1 } - }; +const rtems_assoc_t assoc_table_default[] = { + { "(default)", 0, 0 }, + { "zero", 1, 8 }, + { "one", 2, 4 }, + { "two", 4, 2 }, + { "three", 8, 1 }, + { NULL, -1, -1 } +}; -const rtems_assoc_t assoc_table[] = - { - { "zero" , 1 , 8 }, - { "one" , 2 , 4 }, - { "two" , 4 , 2 }, - { "three", 8 , 1 }, - { NULL , -1, -1 } - }; +const rtems_assoc_t assoc_table[] = { + { "zero", 1, 8 }, + { "one", 2, 4 }, + { "two", 4, 2 }, + { "three", 8, 1 }, + { NULL, -1, -1 } +}; -uint32_t local; -uint32_t remote; +uint32_t local; +uint32_t remote; const rtems_assoc_t *assoc_item; -char *name; +char *name; static void reset_name( void ) { @@ -82,12 +79,9 @@ static void reset_name( void ) static void test_assoc_32_to_string( void ) { - static const rtems_assoc_32_pair pairs[] = { - { 1, "A" }, - { 2, "LOOOOONG" }, - { 4, "C" } - }; - char buf[4]; + static const rtems_assoc_32_pair pairs[] = + { { 1, "A" }, { 2, "LOOOOONG" }, { 4, "C" } }; + char buf[ 4 ]; size_t len; len = rtems_assoc_32_to_string( @@ -139,13 +133,11 @@ static void test_assoc_32_to_string( void ) rtems_test_assert( strcmp( buf, "A:L" ) == 0 ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - name = malloc(40); + name = malloc( 40 ); TEST_BEGIN(); puts( "Init - get local by name -- OK" ); @@ -175,50 +167,49 @@ rtems_task Init( reset_name(); puts( "Init - get name by local bitfield -- OK" ); name = rtems_assoc_name_by_local_bitfield( assoc_table, 1, name ); - rtems_test_assert ( !strcmp( name, "zero" ) ); + rtems_test_assert( !strcmp( name, "zero" ) ); reset_name(); puts( "Init - get name by local bitfield -- OK" ); name = rtems_assoc_name_by_local_bitfield( assoc_table, 3, name ); - rtems_test_assert ( !strcmp( name, "zero one" ) ); + rtems_test_assert( !strcmp( name, "zero one" ) ); reset_name(); puts( "Init - get name by local bitfield -- expect\"\"" ); name = rtems_assoc_name_by_local_bitfield( assoc_table, 0, name ); - rtems_test_assert ( !strcmp( name, "" ) ); - + rtems_test_assert( !strcmp( name, "" ) ); + reset_name(); puts( "Init - get name by local -- OK" ); - rtems_test_assert( !strcmp( rtems_assoc_name_by_local( assoc_table, 1 ), - "zero" ) ); - + rtems_test_assert( + !strcmp( rtems_assoc_name_by_local( assoc_table, 1 ), "zero" ) + ); + reset_name(); puts( "Init - get name by local -- using bad value" ); puts( rtems_assoc_name_by_local( assoc_table, 0 ) ); reset_name(); puts( "Init - get name by remote bitfield -- OK" ); - name = - rtems_assoc_name_by_remote_bitfield( assoc_table, 1, name ); - rtems_test_assert ( !strcmp( name, "three" ) ); + name = rtems_assoc_name_by_remote_bitfield( assoc_table, 1, name ); + rtems_test_assert( !strcmp( name, "three" ) ); reset_name(); puts( "Init - get name by remote bitfield -- OK" ); - name = - rtems_assoc_name_by_remote_bitfield( assoc_table, 3, name ); - rtems_test_assert ( !strcmp( name, "three two" ) ); + name = rtems_assoc_name_by_remote_bitfield( assoc_table, 3, name ); + rtems_test_assert( !strcmp( name, "three two" ) ); reset_name(); puts( "Init - get name by remote bitfield -- expect\"\"" ); - name = - rtems_assoc_name_by_remote_bitfield( assoc_table, 0, name ); - rtems_test_assert ( !strcmp( name, "" ) ); - + name = rtems_assoc_name_by_remote_bitfield( assoc_table, 0, name ); + rtems_test_assert( !strcmp( name, "" ) ); + reset_name(); puts( "Init - get name by remote -- OK" ); - rtems_test_assert( !strcmp( rtems_assoc_name_by_remote( assoc_table, 1 ), - "three" ) ); - + rtems_test_assert( + !strcmp( rtems_assoc_name_by_remote( assoc_table, 1 ), "three" ) + ); + reset_name(); puts( "Init - get name by remote -- using bad value" ); puts( rtems_assoc_name_by_remote( assoc_table, 0 ) ); @@ -301,7 +292,7 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -309,7 +300,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT diff --git a/testsuites/sptests/spatomic01/init.c b/testsuites/sptests/spatomic01/init.c index 6e2ef770c7..1b8b62ee75 100644 --- a/testsuites/sptests/spatomic01/init.c +++ b/testsuites/sptests/spatomic01/init.c @@ -37,220 +37,225 @@ const char rtems_test_name[] = "SPATOMIC 1"; typedef struct { - Atomic_Uint uint_atomic; + Atomic_Uint uint_atomic; Atomic_Uintptr uintptr_atomic; - Atomic_Ulong ulong_atomic; + Atomic_Ulong ulong_atomic; } test_context; static test_context test_instance; -static void test_static_and_dynamic_initialization(void) +static void test_static_and_dynamic_initialization( void ) { - #if (__SIZEOF_INT__ == 2) + #if ( __SIZEOF_INT__ == 2 ) #define UINT_CONSTANT 0xc0feU #else #define UINT_CONSTANT 0xc01dc0feU #endif - static Atomic_Uint static_uint = ATOMIC_INITIALIZER_UINT(UINT_CONSTANT); - static Atomic_Ulong static_ulong = ATOMIC_INITIALIZER_ULONG(0xdeadbeefUL); - static Atomic_Uintptr static_uintptr = - ATOMIC_INITIALIZER_UINTPTR((uintptr_t) &static_uintptr); - static Atomic_Flag static_flag = ATOMIC_INITIALIZER_FLAG; + static Atomic_Uint static_uint = ATOMIC_INITIALIZER_UINT( UINT_CONSTANT ); + static Atomic_Ulong static_ulong = ATOMIC_INITIALIZER_ULONG( 0xdeadbeefUL ); + static Atomic_Uintptr static_uintptr = ATOMIC_INITIALIZER_UINTPTR( + (uintptr_t) &static_uintptr + ); + static Atomic_Flag static_flag = ATOMIC_INITIALIZER_FLAG; - Atomic_Uint stack_uint; - Atomic_Ulong stack_ulong; + Atomic_Uint stack_uint; + Atomic_Ulong stack_ulong; Atomic_Uintptr stack_uintptr; - Atomic_Flag stack_flag; + Atomic_Flag stack_flag; - puts("=== static and dynamic initialization test case ==="); + puts( "=== static and dynamic initialization test case ===" ); - _Atomic_Init_uint(&stack_uint, UINT_CONSTANT); - _Atomic_Init_ulong(&stack_ulong, 0xdeadbeefUL); - _Atomic_Init_uintptr(&stack_uintptr, (uintptr_t) &static_uintptr); - _Atomic_Flag_clear(&stack_flag, ATOMIC_ORDER_RELAXED); + _Atomic_Init_uint( &stack_uint, UINT_CONSTANT ); + _Atomic_Init_ulong( &stack_ulong, 0xdeadbeefUL ); + _Atomic_Init_uintptr( &stack_uintptr, (uintptr_t) &static_uintptr ); + _Atomic_Flag_clear( &stack_flag, ATOMIC_ORDER_RELAXED ); rtems_test_assert( - memcmp(&stack_uint, &static_uint, sizeof(stack_uint)) == 0 + memcmp( &stack_uint, &static_uint, sizeof( stack_uint ) ) == 0 ); rtems_test_assert( - memcmp(&stack_ulong, &static_ulong, sizeof(stack_ulong)) == 0 + memcmp( &stack_ulong, &static_ulong, sizeof( stack_ulong ) ) == 0 ); rtems_test_assert( - memcmp(&stack_uintptr, &static_uintptr, sizeof(stack_uintptr)) == 0 + memcmp( &stack_uintptr, &static_uintptr, sizeof( stack_uintptr ) ) == 0 ); rtems_test_assert( - memcmp(&stack_flag, &static_flag, sizeof(stack_flag)) == 0 + memcmp( &stack_flag, &static_flag, sizeof( stack_flag ) ) == 0 ); rtems_test_assert( - _Atomic_Load_uint(&stack_uint, ATOMIC_ORDER_RELAXED) == 0xc01dc0feU + _Atomic_Load_uint( &stack_uint, ATOMIC_ORDER_RELAXED ) == 0xc01dc0feU ); rtems_test_assert( - _Atomic_Load_ulong(&stack_ulong, ATOMIC_ORDER_RELAXED) == 0xdeadbeefUL + _Atomic_Load_ulong( &stack_ulong, ATOMIC_ORDER_RELAXED ) == 0xdeadbeefUL ); rtems_test_assert( - _Atomic_Load_uintptr(&stack_uintptr, ATOMIC_ORDER_RELAXED) - == (uintptr_t) &static_uintptr + _Atomic_Load_uintptr( &stack_uintptr, ATOMIC_ORDER_RELAXED ) == + (uintptr_t) &static_uintptr ); rtems_test_assert( - !_Atomic_Flag_test_and_set(&stack_flag, ATOMIC_ORDER_RELAXED) + !_Atomic_Flag_test_and_set( &stack_flag, ATOMIC_ORDER_RELAXED ) ); } -typedef void (*simple_test_body)(test_context *ctx); +typedef void ( *simple_test_body )( test_context *ctx ); -static void test_simple_atomic_add_body(test_context *ctx) +static void test_simple_atomic_add_body( test_context *ctx ) { - unsigned int ia = 8, ib = 4; - unsigned int ic; - uintptr_t pa = 42, pb = 24; - uintptr_t pc; + unsigned int ia = 8, ib = 4; + unsigned int ic; + uintptr_t pa = 42, pb = 24; + uintptr_t pc; unsigned long a = 2, b = 1; unsigned long c; - puts("=== atomic simple add test case ==="); + puts( "=== atomic simple add test case ===" ); - _Atomic_Store_uint(&ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_add_uint(&ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED); - ic = _Atomic_Load_uint(&ctx->uint_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(ic == (ia + ib)); + _Atomic_Store_uint( &ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_add_uint( &ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED ); + ic = _Atomic_Load_uint( &ctx->uint_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( ic == ( ia + ib ) ); - _Atomic_Store_uintptr(&ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_add_uintptr(&ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED); - pc = _Atomic_Load_uintptr(&ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(pc == (pa + pb)); + _Atomic_Store_uintptr( &ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_add_uintptr( &ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED ); + pc = _Atomic_Load_uintptr( &ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( pc == ( pa + pb ) ); - _Atomic_Store_ulong(&ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_add_ulong(&ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED); - c = _Atomic_Load_ulong(&ctx->ulong_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(c == (a + b)); + _Atomic_Store_ulong( &ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_add_ulong( &ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED ); + c = _Atomic_Load_ulong( &ctx->ulong_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( c == ( a + b ) ); } -static void test_simple_atomic_sub_body(test_context *ctx) +static void test_simple_atomic_sub_body( test_context *ctx ) { - unsigned int ia = 8, ib = 4; - unsigned int ic; - uintptr_t pa = 42, pb = 24; - uintptr_t pc; + unsigned int ia = 8, ib = 4; + unsigned int ic; + uintptr_t pa = 42, pb = 24; + uintptr_t pc; unsigned long a = 2, b = 1; unsigned long c; - puts("=== atomic simple sub test case ==="); + puts( "=== atomic simple sub test case ===" ); - _Atomic_Store_uint(&ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_sub_uint(&ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED); - ic = _Atomic_Load_uint(&ctx->uint_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(ic == (ia - ib)); + _Atomic_Store_uint( &ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_sub_uint( &ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED ); + ic = _Atomic_Load_uint( &ctx->uint_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( ic == ( ia - ib ) ); - _Atomic_Store_uintptr(&ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_sub_uintptr(&ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED); - pc = _Atomic_Load_uintptr(&ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(pc == (pa - pb)); + _Atomic_Store_uintptr( &ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_sub_uintptr( &ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED ); + pc = _Atomic_Load_uintptr( &ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( pc == ( pa - pb ) ); - _Atomic_Store_ulong(&ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_sub_ulong(&ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED); - c = _Atomic_Load_ulong(&ctx->ulong_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(c == (a - b)); + _Atomic_Store_ulong( &ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_sub_ulong( &ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED ); + c = _Atomic_Load_ulong( &ctx->ulong_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( c == ( a - b ) ); } -static void test_simple_atomic_or_body(test_context *ctx) +static void test_simple_atomic_or_body( test_context *ctx ) { - unsigned int ia = 8, ib = 4; - unsigned int ic; - uintptr_t pa = 42, pb = 24; - uintptr_t pc; + unsigned int ia = 8, ib = 4; + unsigned int ic; + uintptr_t pa = 42, pb = 24; + uintptr_t pc; unsigned long a = 2, b = 1; unsigned long c; - puts("=== atomic simple or test case ==="); + puts( "=== atomic simple or test case ===" ); - _Atomic_Store_uint(&ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_or_uint(&ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED); - ic = _Atomic_Load_uint(&ctx->uint_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(ic == (ia | ib)); + _Atomic_Store_uint( &ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_or_uint( &ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED ); + ic = _Atomic_Load_uint( &ctx->uint_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( ic == ( ia | ib ) ); - _Atomic_Store_uintptr(&ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_or_uintptr(&ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED); - pc = _Atomic_Load_uintptr(&ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(pc == (pa | pb)); + _Atomic_Store_uintptr( &ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_or_uintptr( &ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED ); + pc = _Atomic_Load_uintptr( &ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( pc == ( pa | pb ) ); - _Atomic_Store_ulong(&ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_or_ulong(&ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED); - c = _Atomic_Load_ulong(&ctx->ulong_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(c == (a | b)); + _Atomic_Store_ulong( &ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_or_ulong( &ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED ); + c = _Atomic_Load_ulong( &ctx->ulong_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( c == ( a | b ) ); } -static void test_simple_atomic_and_body(test_context *ctx) +static void test_simple_atomic_and_body( test_context *ctx ) { - unsigned int ia = 8, ib = 4; - unsigned int ic; - uintptr_t pa = 42, pb = 24; - uintptr_t pc; + unsigned int ia = 8, ib = 4; + unsigned int ic; + uintptr_t pa = 42, pb = 24; + uintptr_t pc; unsigned long a = 2, b = 1; unsigned long c; - puts("=== atomic simple and test case ==="); + puts( "=== atomic simple and test case ===" ); - _Atomic_Store_uint(&ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_and_uint(&ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED); - ic = _Atomic_Load_uint(&ctx->uint_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(ic == (ia & ib)); + _Atomic_Store_uint( &ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_and_uint( &ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED ); + ic = _Atomic_Load_uint( &ctx->uint_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( ic == ( ia & ib ) ); - _Atomic_Store_uintptr(&ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_and_uintptr(&ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED); - pc = _Atomic_Load_uintptr(&ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(pc == (pa & pb)); + _Atomic_Store_uintptr( &ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_and_uintptr( &ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED ); + pc = _Atomic_Load_uintptr( &ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( pc == ( pa & pb ) ); - _Atomic_Store_ulong(&ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED); - _Atomic_Fetch_and_ulong(&ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED); - c = _Atomic_Load_ulong(&ctx->ulong_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(c == (a & b)); + _Atomic_Store_ulong( &ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED ); + _Atomic_Fetch_and_ulong( &ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED ); + c = _Atomic_Load_ulong( &ctx->ulong_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( c == ( a & b ) ); } -static void test_simple_atomic_exchange_body(test_context *ctx) +static void test_simple_atomic_exchange_body( test_context *ctx ) { - unsigned int ia = 8, ib = 4; - unsigned int ic; - uintptr_t pa = 42, pb = 24; - uintptr_t pc; + unsigned int ia = 8, ib = 4; + unsigned int ic; + uintptr_t pa = 42, pb = 24; + uintptr_t pc; unsigned long a = 2, b = 1; unsigned long c; - puts("=== atomic simple exchange test case ==="); + puts( "=== atomic simple exchange test case ===" ); - _Atomic_Store_uint(&ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED); - ic = _Atomic_Exchange_uint(&ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED); - rtems_test_assert(ic == ia); - ic = _Atomic_Load_uint(&ctx->uint_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(ic == ib); + _Atomic_Store_uint( &ctx->uint_atomic, ia, ATOMIC_ORDER_RELAXED ); + ic = _Atomic_Exchange_uint( &ctx->uint_atomic, ib, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( ic == ia ); + ic = _Atomic_Load_uint( &ctx->uint_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( ic == ib ); - _Atomic_Store_uintptr(&ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED); - pc = _Atomic_Exchange_uintptr(&ctx->uintptr_atomic, pb, ATOMIC_ORDER_RELAXED); - rtems_test_assert(pc == pa); - pc = _Atomic_Load_uintptr(&ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(pc == pb); + _Atomic_Store_uintptr( &ctx->uintptr_atomic, pa, ATOMIC_ORDER_RELAXED ); + pc = _Atomic_Exchange_uintptr( + &ctx->uintptr_atomic, + pb, + ATOMIC_ORDER_RELAXED + ); + rtems_test_assert( pc == pa ); + pc = _Atomic_Load_uintptr( &ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( pc == pb ); - _Atomic_Store_ulong(&ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED); - c = _Atomic_Exchange_ulong(&ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED); - rtems_test_assert(c == a); - c = _Atomic_Load_ulong(&ctx->ulong_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(c == b); + _Atomic_Store_ulong( &ctx->ulong_atomic, a, ATOMIC_ORDER_RELAXED ); + c = _Atomic_Exchange_ulong( &ctx->ulong_atomic, b, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( c == a ); + c = _Atomic_Load_ulong( &ctx->ulong_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( c == b ); } -static void test_simple_atomic_compare_exchange_body(test_context *ctx) +static void test_simple_atomic_compare_exchange_body( test_context *ctx ) { - unsigned int ei; - unsigned int vi; - uintptr_t ep; - uintptr_t vp; + unsigned int ei; + unsigned int vi; + uintptr_t ep; + uintptr_t vp; unsigned long el; unsigned long vl; - bool success; + bool success; - puts("=== atomic simple compare exchange test case ==="); + puts( "=== atomic simple compare exchange test case ===" ); - _Atomic_Store_uint(&ctx->uint_atomic, 1, ATOMIC_ORDER_RELAXED); + _Atomic_Store_uint( &ctx->uint_atomic, 1, ATOMIC_ORDER_RELAXED ); ei = 2; success = _Atomic_Compare_exchange_uint( &ctx->uint_atomic, @@ -259,8 +264,8 @@ static void test_simple_atomic_compare_exchange_body(test_context *ctx) ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED ); - rtems_test_assert(!success); - rtems_test_assert(ei == 1); + rtems_test_assert( !success ); + rtems_test_assert( ei == 1 ); success = _Atomic_Compare_exchange_uint( &ctx->uint_atomic, &ei, @@ -268,11 +273,11 @@ static void test_simple_atomic_compare_exchange_body(test_context *ctx) ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED ); - rtems_test_assert(success); - vi = _Atomic_Load_uint(&ctx->uint_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(vi == 3); + rtems_test_assert( success ); + vi = _Atomic_Load_uint( &ctx->uint_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( vi == 3 ); - _Atomic_Store_uintptr(&ctx->uintptr_atomic, 111, ATOMIC_ORDER_RELAXED); + _Atomic_Store_uintptr( &ctx->uintptr_atomic, 111, ATOMIC_ORDER_RELAXED ); ep = 211; success = _Atomic_Compare_exchange_uintptr( &ctx->uintptr_atomic, @@ -281,8 +286,8 @@ static void test_simple_atomic_compare_exchange_body(test_context *ctx) ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED ); - rtems_test_assert(!success); - rtems_test_assert(ep == 111); + rtems_test_assert( !success ); + rtems_test_assert( ep == 111 ); success = _Atomic_Compare_exchange_uintptr( &ctx->uintptr_atomic, &ep, @@ -290,11 +295,11 @@ static void test_simple_atomic_compare_exchange_body(test_context *ctx) ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED ); - rtems_test_assert(success); - vp = _Atomic_Load_uintptr(&ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(vp == 311); + rtems_test_assert( success ); + vp = _Atomic_Load_uintptr( &ctx->uintptr_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( vp == 311 ); - _Atomic_Store_ulong(&ctx->ulong_atomic, 10, ATOMIC_ORDER_RELAXED); + _Atomic_Store_ulong( &ctx->ulong_atomic, 10, ATOMIC_ORDER_RELAXED ); el = 11; success = _Atomic_Compare_exchange_ulong( &ctx->ulong_atomic, @@ -303,8 +308,8 @@ static void test_simple_atomic_compare_exchange_body(test_context *ctx) ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED ); - rtems_test_assert(!success); - rtems_test_assert(el == 10); + rtems_test_assert( !success ); + rtems_test_assert( el == 10 ); success = _Atomic_Compare_exchange_ulong( &ctx->ulong_atomic, &el, @@ -312,9 +317,9 @@ static void test_simple_atomic_compare_exchange_body(test_context *ctx) ATOMIC_ORDER_RELAXED, ATOMIC_ORDER_RELAXED ); - rtems_test_assert(success); - vl = _Atomic_Load_ulong(&ctx->ulong_atomic, ATOMIC_ORDER_RELAXED); - rtems_test_assert(vl == 12); + rtems_test_assert( success ); + vl = _Atomic_Load_ulong( &ctx->ulong_atomic, ATOMIC_ORDER_RELAXED ); + rtems_test_assert( vl == 12 ); } static const simple_test_body simple_test_bodies[] = { @@ -326,21 +331,21 @@ static const simple_test_body simple_test_bodies[] = { test_simple_atomic_compare_exchange_body, }; -#define SIMPLE_TEST_COUNT RTEMS_ARRAY_SIZE(simple_test_bodies) +#define SIMPLE_TEST_COUNT RTEMS_ARRAY_SIZE( simple_test_bodies ) -static void simple_tests(void) +static void simple_tests( void ) { test_context *ctx = &test_instance; - size_t test; + size_t test; - for (test = 0; test < SIMPLE_TEST_COUNT; ++test) { - const simple_test_body *test_body = &simple_test_bodies[test]; + for ( test = 0; test < SIMPLE_TEST_COUNT; ++test ) { + const simple_test_body *test_body = &simple_test_bodies[ test ]; - (*test_body)(ctx); + ( *test_body )( ctx ); } } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -350,7 +355,7 @@ static void Init(rtems_task_argument arg) simple_tests(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/spcache01/init.c b/testsuites/sptests/spcache01/init.c index 64d42a0b73..3e9516c9d8 100644 --- a/testsuites/sptests/spcache01/init.c +++ b/testsuites/sptests/spcache01/init.c @@ -45,74 +45,98 @@ const char rtems_test_name[] = "SPCACHE 1"; #define I() _CPU_Instruction_no_operation() -#define I8() I(); I(); I(); I(); I(); I(); I(); I() +#define I8() \ + I(); \ + I(); \ + I(); \ + I(); \ + I(); \ + I(); \ + I(); \ + I() -#define I64() I8(); I8(); I8(); I8(); I8(); I8(); I8(); I8() +#define I64() \ + I8(); \ + I8(); \ + I8(); \ + I8(); \ + I8(); \ + I8(); \ + I8(); \ + I8() -#define I512() I64(); I64(); I64(); I64(); I64(); I64(); I64(); I64() +#define I512() \ + I64(); \ + I64(); \ + I64(); \ + I64(); \ + I64(); \ + I64(); \ + I64(); \ + I64() -CPU_STRUCTURE_ALIGNMENT static int data[1024]; +CPU_STRUCTURE_ALIGNMENT static int data[ 1024 ]; static bool do_longjmp; static jmp_buf instruction_invalidate_return_context; -static void test_data_flush_and_invalidate(void) +static void test_data_flush_and_invalidate( void ) { - if (rtems_cache_get_data_line_size() > 0) { - RTEMS_INTERRUPT_LOCK_DECLARE(, lock) + if ( rtems_cache_get_data_line_size() > 0 ) { + RTEMS_INTERRUPT_LOCK_DECLARE(, lock ) rtems_interrupt_lock_context lock_context; - volatile int *vdata = &data[0]; - int n = 32; - int i; - size_t data_size = n * sizeof(data[0]); - bool write_through; + volatile int *vdata = &data[ 0 ]; + int n = 32; + int i; + size_t data_size = n * sizeof( data[ 0 ] ); + bool write_through; - printf("data cache flush and invalidate test\n"); + printf( "data cache flush and invalidate test\n" ); - rtems_interrupt_lock_initialize(&lock, "test"); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_initialize( &lock, "test" ); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - for (i = 0; i < n; ++i) { - vdata[i] = i; + for ( i = 0; i < n; ++i ) { + vdata[ i ] = i; } - rtems_cache_flush_multiple_data_lines(&data[0], data_size); + rtems_cache_flush_multiple_data_lines( &data[ 0 ], data_size ); - for (i = 0; i < n; ++i) { - rtems_test_assert(vdata[i] == i); + for ( i = 0; i < n; ++i ) { + rtems_test_assert( vdata[ i ] == i ); } - for (i = 0; i < n; ++i) { - vdata[i] = ~i; + for ( i = 0; i < n; ++i ) { + vdata[ i ] = ~i; } - rtems_cache_invalidate_multiple_data_lines(&data[0], data_size); + rtems_cache_invalidate_multiple_data_lines( &data[ 0 ], data_size ); - write_through = vdata[0] == ~0; - if (write_through) { - for (i = 0; i < n; ++i) { - rtems_test_assert(vdata[i] == ~i); + write_through = vdata[ 0 ] == ~0; + if ( write_through ) { + for ( i = 0; i < n; ++i ) { + rtems_test_assert( vdata[ i ] == ~i ); } } else { - for (i = 0; i < n; ++i) { - rtems_test_assert(vdata[i] == i); + for ( i = 0; i < n; ++i ) { + rtems_test_assert( vdata[ i ] == i ); } } - for (i = 0; i < n; ++i) { - vdata[i] = ~i; + for ( i = 0; i < n; ++i ) { + vdata[ i ] = ~i; } - rtems_cache_flush_multiple_data_lines(&data[0], data_size); - rtems_cache_invalidate_multiple_data_lines(&data[0], data_size); + rtems_cache_flush_multiple_data_lines( &data[ 0 ], data_size ); + rtems_cache_invalidate_multiple_data_lines( &data[ 0 ], data_size ); - for (i = 0; i < n; ++i) { - rtems_test_assert(vdata[i] == ~i); + for ( i = 0; i < n; ++i ) { + rtems_test_assert( vdata[ i ] == ~i ); } - rtems_interrupt_lock_release(&lock, &lock_context); - rtems_interrupt_lock_destroy(&lock); + rtems_interrupt_lock_release( &lock, &lock_context ); + rtems_interrupt_lock_destroy( &lock ); printf( "data cache operations by line passed the test (%s cache detected)\n", @@ -121,16 +145,16 @@ static void test_data_flush_and_invalidate(void) } else { printf( "skip data cache flush and invalidate test" - " due to cache line size of zero\n" + " due to cache line size of zero\n" ); } /* Make sure these are nops */ - rtems_cache_flush_multiple_data_lines(NULL, 0); - rtems_cache_invalidate_multiple_data_lines(NULL, 0); + rtems_cache_flush_multiple_data_lines( NULL, 0 ); + rtems_cache_invalidate_multiple_data_lines( NULL, 0 ); } -static uint64_t do_some_work(void) +static uint64_t do_some_work( void ) { rtems_counter_ticks a; rtems_counter_ticks b; @@ -142,97 +166,97 @@ static uint64_t do_some_work(void) I512(); b = rtems_counter_read(); - d = rtems_counter_difference(b, a); + d = rtems_counter_difference( b, a ); - return rtems_counter_ticks_to_nanoseconds(d); + return rtems_counter_ticks_to_nanoseconds( d ); } -static uint64_t load(void) +static uint64_t load( void ) { rtems_counter_ticks a; rtems_counter_ticks b; rtems_counter_ticks d; - size_t i; - volatile int *vdata = &data[0]; + size_t i; + volatile int *vdata = &data[ 0 ]; a = rtems_counter_read(); - for (i = 0; i < RTEMS_ARRAY_SIZE(data); ++i) { - vdata[i]; + for ( i = 0; i < RTEMS_ARRAY_SIZE( data ); ++i ) { + vdata[ i ]; } b = rtems_counter_read(); - d = rtems_counter_difference(b, a); + d = rtems_counter_difference( b, a ); - return rtems_counter_ticks_to_nanoseconds(d); + return rtems_counter_ticks_to_nanoseconds( d ); } -static uint64_t store(void) +static uint64_t store( void ) { rtems_counter_ticks a; rtems_counter_ticks b; rtems_counter_ticks d; - size_t i; - volatile int *vdata = &data[0]; + size_t i; + volatile int *vdata = &data[ 0 ]; a = rtems_counter_read(); - for (i = 0; i < RTEMS_ARRAY_SIZE(data); ++i) { - vdata[i] = 0; + for ( i = 0; i < RTEMS_ARRAY_SIZE( data ); ++i ) { + vdata[ i ] = 0; } b = rtems_counter_read(); - d = rtems_counter_difference(b, a); + d = rtems_counter_difference( b, a ); - return rtems_counter_ticks_to_nanoseconds(d); + return rtems_counter_ticks_to_nanoseconds( d ); } -static bool cache_invalidate_wrapper(void) +static bool cache_invalidate_wrapper( void ) { - if (setjmp(instruction_invalidate_return_context) == 0) { - rtems_cache_invalidate_multiple_instruction_lines(do_some_work, 4096); + if ( setjmp( instruction_invalidate_return_context ) == 0 ) { + rtems_cache_invalidate_multiple_instruction_lines( do_some_work, 4096 ); return false; } return true; } -static void test_timing(void) +static void test_timing( void ) { - RTEMS_INTERRUPT_LOCK_DECLARE(, lock) + RTEMS_INTERRUPT_LOCK_DECLARE(, lock ) rtems_interrupt_lock_context lock_context; - size_t data_size = sizeof(data); - uint64_t d[3]; - uint32_t cache_level; - size_t cache_size; - bool exception; + size_t data_size = sizeof( data ); + uint64_t d[ 3 ]; + uint32_t cache_level; + size_t cache_size; + bool exception; - rtems_interrupt_lock_initialize(&lock, "test"); + rtems_interrupt_lock_initialize( &lock, "test" ); printf( "data cache line size %zi bytes\n" "data cache size %zi bytes\n", rtems_cache_get_data_line_size(), - rtems_cache_get_data_cache_size(0) + rtems_cache_get_data_cache_size( 0 ) ); cache_level = 1; - cache_size = rtems_cache_get_data_cache_size(cache_level); - while (cache_size > 0) { + cache_size = rtems_cache_get_data_cache_size( cache_level ); + while ( cache_size > 0 ) { printf( "data cache level %" PRIu32 " size %zi bytes\n", cache_level, cache_size ); ++cache_level; - cache_size = rtems_cache_get_data_cache_size(cache_level); + cache_size = rtems_cache_get_data_cache_size( cache_level ); } - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = load(); - d[1] = load(); + d[ 0 ] = load(); + d[ 1 ] = load(); rtems_cache_flush_entire_data(); - d[2] = load(); + d[ 2 ] = load(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "load %zi bytes with flush entire data\n" @@ -240,19 +264,19 @@ static void test_timing(void) " duration with warm cache %" PRIu64 " ns\n" " duration with flushed cache %" PRIu64 " ns\n", data_size, - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = load(); - d[1] = load(); - rtems_cache_flush_multiple_data_lines(&data[0], sizeof(data)); - d[2] = load(); + d[ 0 ] = load(); + d[ 1 ] = load(); + rtems_cache_flush_multiple_data_lines( &data[ 0 ], sizeof( data ) ); + d[ 2 ] = load(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "load %zi bytes with flush multiple data\n" @@ -260,19 +284,19 @@ static void test_timing(void) " duration with warm cache %" PRIu64 " ns\n" " duration with flushed cache %" PRIu64 " ns\n", data_size, - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = load(); - d[1] = load(); - rtems_cache_invalidate_multiple_data_lines(&data[0], sizeof(data)); - d[2] = load(); + d[ 0 ] = load(); + d[ 1 ] = load(); + rtems_cache_invalidate_multiple_data_lines( &data[ 0 ], sizeof( data ) ); + d[ 2 ] = load(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "load %zi bytes with invalidate multiple data\n" @@ -280,19 +304,19 @@ static void test_timing(void) " duration with warm cache %" PRIu64 " ns\n" " duration with invalidated cache %" PRIu64 " ns\n", data_size, - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = store(); - d[1] = store(); + d[ 0 ] = store(); + d[ 1 ] = store(); rtems_cache_flush_entire_data(); - d[2] = store(); + d[ 2 ] = store(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "store %zi bytes with flush entire data\n" @@ -300,19 +324,19 @@ static void test_timing(void) " duration with warm cache %" PRIu64 " ns\n" " duration with flushed cache %" PRIu64 " ns\n", data_size, - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = store(); - d[1] = store(); - rtems_cache_flush_multiple_data_lines(&data[0], sizeof(data)); - d[2] = store(); + d[ 0 ] = store(); + d[ 1 ] = store(); + rtems_cache_flush_multiple_data_lines( &data[ 0 ], sizeof( data ) ); + d[ 2 ] = store(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "store %zi bytes with flush multiple data\n" @@ -320,19 +344,19 @@ static void test_timing(void) " duration with warm cache %" PRIu64 " ns\n" " duration with flushed cache %" PRIu64 " ns\n", data_size, - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = store(); - d[1] = store(); - rtems_cache_invalidate_multiple_data_lines(&data[0], sizeof(data)); - d[2] = store(); + d[ 0 ] = store(); + d[ 1 ] = store(); + rtems_cache_invalidate_multiple_data_lines( &data[ 0 ], sizeof( data ) ); + d[ 2 ] = store(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "store %zi bytes with invalidate multiple data\n" @@ -340,53 +364,53 @@ static void test_timing(void) " duration with warm cache %" PRIu64 " ns\n" " duration with invalidated cache %" PRIu64 " ns\n", data_size, - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); printf( "instruction cache line size %zi bytes\n" "instruction cache size %zi bytes\n", rtems_cache_get_instruction_line_size(), - rtems_cache_get_instruction_cache_size(0) + rtems_cache_get_instruction_cache_size( 0 ) ); cache_level = 1; - cache_size = rtems_cache_get_instruction_cache_size(cache_level); - while (cache_size > 0) { + cache_size = rtems_cache_get_instruction_cache_size( cache_level ); + while ( cache_size > 0 ) { printf( "instruction cache level %" PRIu32 " size %zi bytes\n", cache_level, cache_size ); ++cache_level; - cache_size = rtems_cache_get_instruction_cache_size(cache_level); + cache_size = rtems_cache_get_instruction_cache_size( cache_level ); } - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = do_some_work(); - d[1] = do_some_work(); + d[ 0 ] = do_some_work(); + d[ 1 ] = do_some_work(); rtems_cache_invalidate_entire_instruction(); - d[2] = do_some_work(); + d[ 2 ] = do_some_work(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "invalidate entire instruction\n" " duration with normal cache %" PRIu64 " ns\n" " duration with warm cache %" PRIu64 " ns\n" " duration with invalidated cache %" PRIu64 " ns\n", - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - rtems_interrupt_lock_acquire(&lock, &lock_context); + rtems_interrupt_lock_acquire( &lock, &lock_context ); - d[0] = do_some_work(); - d[1] = do_some_work(); + d[ 0 ] = do_some_work(); + d[ 1 ] = do_some_work(); do_longjmp = true; @@ -394,104 +418,104 @@ static void test_timing(void) do_longjmp = false; - d[2] = do_some_work(); + d[ 2 ] = do_some_work(); - rtems_interrupt_lock_release(&lock, &lock_context); + rtems_interrupt_lock_release( &lock, &lock_context ); printf( "invalidate multiple instruction\n" " duration with normal cache %" PRIu64 " ns\n" " duration with warm cache %" PRIu64 " ns\n" " duration with invalidated cache %" PRIu64 " ns\n", - d[0], - d[1], - d[2] + d[ 0 ], + d[ 1 ], + d[ 2 ] ); - if (exception) { + if ( exception ) { printf( "rtems_cache_invalidate_multiple_data_lines() generated an exception\n" ); } - rtems_interrupt_lock_destroy(&lock); + rtems_interrupt_lock_destroy( &lock ); } -static void test_cache_aligned_alloc(void) +static void test_cache_aligned_alloc( void ) { - void *p0; - void *p1; + void *p0; + void *p1; size_t cls; - printf("test rtems_cache_aligned_malloc()\n"); + printf( "test rtems_cache_aligned_malloc()\n" ); - p0 = rtems_cache_aligned_malloc(1); - p1 = rtems_cache_aligned_malloc(1); + p0 = rtems_cache_aligned_malloc( 1 ); + p1 = rtems_cache_aligned_malloc( 1 ); - rtems_test_assert(p0 != NULL); - rtems_test_assert(p1 != NULL); + rtems_test_assert( p0 != NULL ); + rtems_test_assert( p1 != NULL ); cls = rtems_cache_get_data_line_size(); - if (cls > 0) { - size_t m = cls - 1; + if ( cls > 0 ) { + size_t m = cls - 1; uintptr_t a0 = (uintptr_t) p0; uintptr_t a1 = (uintptr_t) p1; - rtems_test_assert(a1 - a0 > cls); - rtems_test_assert((a0 & m) == 0); - rtems_test_assert((a1 & m) == 0); + rtems_test_assert( a1 - a0 > cls ); + rtems_test_assert( ( a0 & m ) == 0 ); + rtems_test_assert( ( a1 & m ) == 0 ); } - free(p0); - free(p1); + free( p0 ); + free( p1 ); } #define AREA_SIZE 256 -static char cache_coherent_area_0[AREA_SIZE]; +static char cache_coherent_area_0[ AREA_SIZE ]; -static char cache_coherent_area_1[AREA_SIZE]; +static char cache_coherent_area_1[ AREA_SIZE ]; -static char cache_coherent_area_2[AREA_SIZE]; +static char cache_coherent_area_2[ AREA_SIZE ]; -static void add_area(void *begin) +static void add_area( void *begin ) { - rtems_cache_coherent_add_area(NULL, 0); - rtems_cache_coherent_add_area(begin, AREA_SIZE); + rtems_cache_coherent_add_area( NULL, 0 ); + rtems_cache_coherent_add_area( begin, AREA_SIZE ); } -static void test_cache_coherent_alloc(void) +static void test_cache_coherent_alloc( void ) { - void *p0; - void *p1; + void *p0; + void *p1; System_state_Codes previous_state; - printf("test cache coherent allocation\n"); + printf( "test cache coherent allocation\n" ); - p0 = rtems_cache_coherent_allocate(1, 0, 0); - rtems_test_assert(p0 != NULL); + p0 = rtems_cache_coherent_allocate( 1, 0, 0 ); + rtems_test_assert( p0 != NULL ); - rtems_cache_coherent_free(p0); + rtems_cache_coherent_free( p0 ); - p0 = rtems_cache_coherent_allocate(1, 0, 0); - rtems_test_assert(p0 != NULL); + p0 = rtems_cache_coherent_allocate( 1, 0, 0 ); + rtems_test_assert( p0 != NULL ); - add_area(&cache_coherent_area_0[0]); - add_area(&cache_coherent_area_1[0]); + add_area( &cache_coherent_area_0[ 0 ] ); + add_area( &cache_coherent_area_1[ 0 ] ); previous_state = _System_state_Get(); - _System_state_Set(previous_state + 1); - add_area(&cache_coherent_area_2[0]); - _System_state_Set(previous_state); + _System_state_Set( previous_state + 1 ); + add_area( &cache_coherent_area_2[ 0 ] ); + _System_state_Set( previous_state ); - p1 = rtems_cache_coherent_allocate(1, 0, 0); - rtems_test_assert(p1 != NULL); + p1 = rtems_cache_coherent_allocate( 1, 0, 0 ); + rtems_test_assert( p1 != NULL ); - rtems_cache_coherent_free(p0); - rtems_cache_coherent_free(p1); + rtems_cache_coherent_free( p0 ); + rtems_cache_coherent_free( p1 ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -504,21 +528,21 @@ static void Init(rtems_task_argument arg) TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { (void) always_set_to_false; (void) error; - if (source == RTEMS_FATAL_SOURCE_EXCEPTION && do_longjmp) { - _ISR_Set_level(0); - longjmp(instruction_invalidate_return_context, 1); + if ( source == RTEMS_FATAL_SOURCE_EXCEPTION && do_longjmp ) { + _ISR_Set_level( 0 ); + longjmp( instruction_invalidate_return_context, 1 ); } } @@ -528,8 +552,7 @@ static void fatal_extension( #define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spcbssched01/init.c b/testsuites/sptests/spcbssched01/init.c index b7c5c4552c..d03e28a886 100644 --- a/testsuites/sptests/spcbssched01/init.c +++ b/testsuites/sptests/spcbssched01/init.c @@ -47,9 +47,7 @@ const char rtems_test_name[] = "SPCBSSCHED 1"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -67,32 +65,32 @@ rtems_task Init( Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); status = rtems_task_create( - Task_name[ 1 ], - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_create( - Task_name[ 2 ], - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); directive_failed( status, "rtems_task_create of TA2" ); status = rtems_task_create( - Task_name[ 3 ], - 1, - RTEMS_MINIMUM_STACK_SIZE * 3, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 3 ] + Task_name[ 3 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 3, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "rtems_task_create of TA3" ); diff --git a/testsuites/sptests/spcbssched01/system.h b/testsuites/sptests/spcbssched01/system.h index b2d6b3f6b9..dde20fb35a 100644 --- a/testsuites/sptests/spcbssched01/system.h +++ b/testsuites/sptests/spcbssched01/system.h @@ -34,13 +34,9 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1_through_3( - rtems_task_argument argument -); +rtems_task Task_1_through_3( rtems_task_argument argument ); /* configuration information */ @@ -53,14 +49,14 @@ rtems_task Task_1_through_3( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE) -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_EXTRA_TASK_STACKS ( 4 * RTEMS_MINIMUM_STACK_SIZE ) +#define CONFIGURE_MAXIMUM_TASKS 4 #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/spcbssched01/task1.c b/testsuites/sptests/spcbssched01/task1.c index 76071f399d..01f4bd1a30 100644 --- a/testsuites/sptests/spcbssched01/task1.c +++ b/testsuites/sptests/spcbssched01/task1.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_1_through_3( - rtems_task_argument argument -) +rtems_task Task_1_through_3( rtems_task_argument argument ) { (void) argument; @@ -57,7 +55,7 @@ rtems_task Task_1_through_3( ticks = RTEMS_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); - while( FOREVER ) { + while ( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); diff --git a/testsuites/sptests/spcbssched02/init.c b/testsuites/sptests/spcbssched02/init.c index 7f22d8ff43..08d0495d5f 100644 --- a/testsuites/sptests/spcbssched02/init.c +++ b/testsuites/sptests/spcbssched02/init.c @@ -36,19 +36,17 @@ const char rtems_test_name[] = "SPCBSSCHED 2"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_cbs_server_id server_id, server_id2; - time_t approved_budget, exec_time, abs_time, remaining_budget; + rtems_status_code status; + rtems_cbs_server_id server_id, server_id2; + time_t approved_budget, exec_time, abs_time, remaining_budget; rtems_cbs_parameters params, params1, params3; Priority = 30; - Period = 30; + Period = 30; Execution = 10; Phase = 0; @@ -85,153 +83,258 @@ rtems_task Init( directive_failed( status, "rtems_task_create loop" ); printf( "Init: Initializing the CBS\n" ); - if ( rtems_cbs_initialize() ) + if ( rtems_cbs_initialize() ) { printf( "ERROR: CBS INITIALIZATION FAILED\n" ); + } /* Error checks for Create server and Destroy server */ printf( "Init: Create server and Destroy server\n" ); - if ( rtems_cbs_destroy_server( -5 ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_destroy_server( -5 ) != SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_destroy_server( 5 ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_destroy_server( 5 ) != SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_destroy_server( 0 ) != SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( rtems_cbs_destroy_server( 0 ) != SCHEDULER_CBS_ERROR_NOSERVER ) { printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_create_server( ¶ms1, NULL, &server_id ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_create_server( ¶ms1, NULL, &server_id ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_create_server( ¶ms3, NULL, &server_id ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_create_server( ¶ms3, NULL, &server_id ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id2 ) ) + } + if ( rtems_cbs_create_server( ¶ms, NULL, &server_id2 ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) + } + if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) + } + if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) != - SCHEDULER_CBS_ERROR_FULL ) + } + if ( + rtems_cbs_create_server( ¶ms, NULL, &server_id ) != + SCHEDULER_CBS_ERROR_FULL + ) { printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Attach thread and Detach thread */ printf( "Init: Attach thread\n" ); - if ( rtems_cbs_attach_thread( -5, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_attach_thread( -5, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_attach_thread( 5, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_attach_thread( 5, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_attach_thread( server_id, 1234 ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_attach_thread( server_id, 1234 ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) ) + } + if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); - if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_FULL ) + } + if ( + rtems_cbs_attach_thread( server_id, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_FULL + ) { printf( "ERROR: ATTACH THREAD AGAIN PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_attach_thread( server_id, Task_id ) != - SCHEDULER_CBS_ERROR_FULL ) + } + if ( + rtems_cbs_attach_thread( server_id, Task_id ) != SCHEDULER_CBS_ERROR_FULL + ) { printf( "ERROR: ATTACH THREAD TO FULL SERVER PASSED UNEXPECTEDLY \n" ); - if ( rtems_cbs_destroy_server( server_id ) ) + } + if ( rtems_cbs_destroy_server( server_id ) ) { printf( "ERROR: DESTROY SERVER WITH THREAD ATTACHED FAILED\n" ); - if ( rtems_cbs_attach_thread( server_id, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_attach_thread( server_id, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); + } printf( "Init: Detach thread\n" ); - if ( rtems_cbs_detach_thread( -5, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_detach_thread( -5, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_detach_thread( 5, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_detach_thread( 5, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_detach_thread( server_id2, 1234 ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_detach_thread( server_id2, 1234 ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY \n" ); - if ( rtems_cbs_detach_thread( server_id, RTEMS_SELF ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_detach_thread( server_id, RTEMS_SELF ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY4\n" ); + } rtems_cbs_destroy_server( server_id2 ); /* Error checks for Set parameters and Get parameters */ printf( "Init: Set parameters and Get parameters\n" ); - if ( rtems_cbs_set_parameters( -5, ¶ms ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_set_parameters( -5, ¶ms ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_set_parameters( 5, ¶ms ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_set_parameters( 5, ¶ms ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_set_parameters( server_id, ¶ms ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_set_parameters( server_id, ¶ms ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); + } - if ( rtems_cbs_get_parameters( -5, ¶ms ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_get_parameters( -5, ¶ms ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_parameters( 5, ¶ms ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_get_parameters( 5, ¶ms ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_parameters( server_id, ¶ms ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_get_parameters( server_id, ¶ms ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: GET PARAMETERS PASSED UNEXPECTEDLY\n" ); + } - if ( rtems_cbs_set_parameters( server_id, ¶ms1 ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_set_parameters( server_id, ¶ms1 ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_set_parameters( server_id, ¶ms3 ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_set_parameters( server_id, ¶ms3 ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: SET PARAMETERS PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get server id */ printf( "Init: Get server id\n" ); - if ( rtems_cbs_get_server_id( RTEMS_SELF, &server_id ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + if ( + rtems_cbs_get_server_id( RTEMS_SELF, &server_id ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: GET SERVER ID PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get approved budget */ printf( "Init: Get approved budget\n" ); - if ( rtems_cbs_get_approved_budget( -5, &approved_budget ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_get_approved_budget( -5, &approved_budget ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_approved_budget( 5, &approved_budget ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_get_approved_budget( 5, &approved_budget ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_get_approved_budget( server_id, &approved_budget ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get remaining budget */ printf( "Init: Get remaining budget\n" ); - if ( rtems_cbs_get_remaining_budget( -5, &remaining_budget ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_get_remaining_budget( -5, &remaining_budget ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_remaining_budget( 5, &remaining_budget ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_get_remaining_budget( 5, &remaining_budget ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get execution time */ printf( "Init: Get execution time\n" ); - if ( rtems_cbs_get_execution_time( -5, &exec_time, &abs_time ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + if ( + rtems_cbs_get_execution_time( -5, &exec_time, &abs_time ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_execution_time( 5, &exec_time, &abs_time ) != - SCHEDULER_CBS_ERROR_INVALID_PARAMETER ) + } + if ( + rtems_cbs_get_execution_time( 5, &exec_time, &abs_time ) != + SCHEDULER_CBS_ERROR_INVALID_PARAMETER + ) { printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" ); - if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) != - SCHEDULER_CBS_ERROR_NOSERVER ) + } + if ( + rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) != + SCHEDULER_CBS_ERROR_NOSERVER + ) { printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" ); + } /* Restart CBS library */ printf( "Init: Cleaning up CBS\n" ); - if ( rtems_cbs_cleanup() ) + if ( rtems_cbs_cleanup() ) { printf( "ERROR: CBS CLEANUP FAILED\n" ); + } printf( "Init: Initializing the CBS\n" ); - if ( rtems_cbs_initialize() ) + if ( rtems_cbs_initialize() ) { printf( "ERROR: CBS INITIALIZATION FAILED\n" ); + } /* Start periodic tasks */ printf( "Init: Starting periodic task\n" ); @@ -243,15 +346,18 @@ rtems_task Init( rtems_task_wake_after( 130 ); printf( "Init: Checking server with a deleted task\n" ); - if ( rtems_cbs_get_execution_time( 0, &exec_time, &abs_time ) ) + if ( rtems_cbs_get_execution_time( 0, &exec_time, &abs_time ) ) { printf( "ERROR: GET EXECUTION TIME FAILED\n" ); - if ( rtems_cbs_get_remaining_budget( 0, &remaining_budget) ) + } + if ( rtems_cbs_get_remaining_budget( 0, &remaining_budget ) ) { printf( "ERROR: GET REMAINING BUDGET FAILED\n" ); + } - if ( rtems_cbs_cleanup() ) + if ( rtems_cbs_cleanup() ) { printf( "ERROR: CBS CLEANUP\n" ); + } - fflush(stdout); + fflush( stdout ); TEST_END(); rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/spcbssched02/system.h b/testsuites/sptests/spcbssched02/system.h index 1a916428f5..67a5735a15 100644 --- a/testsuites/sptests/spcbssched02/system.h +++ b/testsuites/sptests/spcbssched02/system.h @@ -34,13 +34,9 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_Periodic( - rtems_task_argument argument -); +rtems_task Task_Periodic( rtems_task_argument argument ); /* configuration information */ @@ -49,16 +45,16 @@ rtems_task Task_Periodic( #define CONFIGURE_MICROSECONDS_PER_TICK 20000 -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_PERIODS 10 -#define CONFIGURE_INIT_TASK_PRIORITY 100 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INIT_TASK_PRIORITY 100 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (6 * 4 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 6 * 4 * RTEMS_MINIMUM_STACK_SIZE ) #define CONFIGURE_SCHEDULER_CBS @@ -71,13 +67,13 @@ rtems_task Task_Periodic( /* global variables */ -TEST_EXTERN rtems_id Task_id; -TEST_EXTERN rtems_name Task_name; -TEST_EXTERN rtems_id Task_id2; -TEST_EXTERN rtems_name Task_name2; +TEST_EXTERN rtems_id Task_id; +TEST_EXTERN rtems_name Task_name; +TEST_EXTERN rtems_id Task_id2; +TEST_EXTERN rtems_name Task_name2; TEST_EXTERN rtems_task_priority Priority; -TEST_EXTERN time_t Period; -TEST_EXTERN time_t Execution; -TEST_EXTERN time_t Phase; +TEST_EXTERN time_t Period; +TEST_EXTERN time_t Execution; +TEST_EXTERN time_t Phase; /* end of include file */ diff --git a/testsuites/sptests/spcbssched02/task_periodic.c b/testsuites/sptests/spcbssched02/task_periodic.c index 6272728bb3..ebf138c9ac 100644 --- a/testsuites/sptests/spcbssched02/task_periodic.c +++ b/testsuites/sptests/spcbssched02/task_periodic.c @@ -31,9 +31,7 @@ #include "system.h" -rtems_task Task_Periodic( - rtems_task_argument argument -) +rtems_task Task_Periodic( rtems_task_argument argument ) { rtems_id rmid; rtems_status_code status; @@ -42,69 +40,90 @@ rtems_task Task_Periodic( int start, stop, now; - rtems_cbs_server_id server_id = 0, tsid; + rtems_cbs_server_id server_id = 0, tsid; rtems_cbs_parameters params, tparams; params.deadline = Period; - params.budget = Execution+1; + params.budget = Execution + 1; /* Taks 1 will be attached to a server, task 2 not. */ if ( argument == 1 ) { printf( "Periodic task: Create server and Attach thread\n" ); - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) + if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( rtems_cbs_attach_thread( server_id, Task_id ) ) + } + if ( rtems_cbs_attach_thread( server_id, Task_id ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); + } printf( "Periodic task: ID and Get parameters\n" ); - if ( rtems_cbs_get_server_id( Task_id, &tsid ) ) + if ( rtems_cbs_get_server_id( Task_id, &tsid ) ) { printf( "ERROR: GET SERVER ID FAILED\n" ); - if ( tsid != server_id ) + } + if ( tsid != server_id ) { printf( "ERROR: SERVER ID MISMATCH\n" ); - if ( rtems_cbs_get_parameters( server_id, &tparams ) ) + } + if ( rtems_cbs_get_parameters( server_id, &tparams ) ) { printf( "ERROR: GET PARAMETERS FAILED\n" ); - if ( params.deadline != tparams.deadline || - params.budget != tparams.budget ) + } + if ( + params.deadline != tparams.deadline || params.budget != tparams.budget + ) { printf( "ERROR: PARAMETERS MISMATCH\n" ); + } printf( "Periodic task: Detach thread and Destroy server\n" ); - if ( rtems_cbs_detach_thread( server_id, Task_id ) ) + if ( rtems_cbs_detach_thread( server_id, Task_id ) ) { printf( "ERROR: DETACH THREAD FAILED\n" ); - if ( rtems_cbs_destroy_server( server_id ) ) + } + if ( rtems_cbs_destroy_server( server_id ) ) { printf( "ERROR: DESTROY SERVER FAILED\n" ); - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) + } + if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); + } printf( "Periodic task: Remaining budget and Execution time\n" ); - if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) ) + if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) ) { printf( "ERROR: GET REMAINING BUDGET FAILED\n" ); - if ( remaining_budget != params.budget ) + } + if ( remaining_budget != params.budget ) { printf( "ERROR: REMAINING BUDGET MISMATCH\n" ); - if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) ) + } + if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) ) { printf( "ERROR: GET EXECUTION TIME FAILED\n" ); + } printf( "Periodic task: Set parameters\n" ); - if ( rtems_cbs_attach_thread( server_id, Task_id ) ) + if ( rtems_cbs_attach_thread( server_id, Task_id ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); + } params.deadline = Period * 2; - params.budget = Execution * 2 +1; - if ( rtems_cbs_set_parameters( server_id, ¶ms ) ) + params.budget = Execution * 2 + 1; + if ( rtems_cbs_set_parameters( server_id, ¶ms ) ) { printf( "ERROR: SET PARAMS FAILED\n" ); - if ( rtems_cbs_get_parameters( server_id, &tparams ) ) + } + if ( rtems_cbs_get_parameters( server_id, &tparams ) ) { printf( "ERROR: GET PARAMS FAILED\n" ); - if ( params.deadline != tparams.deadline || - params.budget != tparams.budget ) + } + if ( + params.deadline != tparams.deadline || params.budget != tparams.budget + ) { printf( "ERROR: PARAMS MISMATCH\n" ); + } params.deadline = Period; - params.budget = Execution+1; - if ( rtems_cbs_set_parameters( server_id, ¶ms ) ) + params.budget = Execution + 1; + if ( rtems_cbs_set_parameters( server_id, ¶ms ) ) { printf( "ERROR: SET PARAMS FAILED\n" ); - if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) ) + } + if ( rtems_cbs_get_approved_budget( server_id, &approved_budget ) ) { printf( "ERROR: GET APPROVED BUDGET FAILED\n" ); + } printf( "Periodic task: Approved budget\n" ); - if ( approved_budget != params.budget ) + if ( approved_budget != params.budget ) { printf( "ERROR: APPROVED BUDGET MISMATCH\n" ); + } } status = rtems_rate_monotonic_create( argument, &rmid ); @@ -116,23 +135,32 @@ rtems_task Task_Periodic( directive_failed( status, "rtems_task_wake_after" ); while ( FOREVER ) { - if ( rtems_rate_monotonic_period(rmid, Period) == RTEMS_TIMEOUT ) + if ( rtems_rate_monotonic_period( rmid, Period ) == RTEMS_TIMEOUT ) { printf( "P%" PRIdPTR " - Deadline miss\n", argument ); + } start = rtems_clock_get_ticks_since_boot(); printf( "P%" PRIdPTR "-S ticks:%d\n", argument, start ); - if ( start > 4*Period+Phase ) break; /* stop */ + if ( start > 4 * Period + Phase ) { + break; /* stop */ + } /* active computing */ - while(FOREVER) { + while ( FOREVER ) { now = rtems_clock_get_ticks_since_boot(); - if ( now >= start + Execution ) break; + if ( now >= start + Execution ) { + break; + } if ( server_id != 0 ) { - if ( rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) ) + if ( + rtems_cbs_get_execution_time( server_id, &exec_time, &abs_time ) + ) { printf( "ERROR: GET EXECUTION TIME FAILED\n" ); - if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget) ) + } + if ( rtems_cbs_get_remaining_budget( server_id, &remaining_budget ) ) { printf( "ERROR: GET REMAINING BUDGET FAILED\n" ); - if ( (remaining_budget + exec_time) > (Execution + 1) ) { + } + if ( ( remaining_budget + exec_time ) > ( Execution + 1 ) ) { printf( "ERROR: REMAINING BUDGET AND EXECUTION TIME MISMATCH\n" ); rtems_test_exit( 0 ); } @@ -145,7 +173,10 @@ rtems_task Task_Periodic( /* delete period and SELF */ status = rtems_rate_monotonic_delete( rmid ); if ( status != RTEMS_SUCCESSFUL ) { - printf("rtems_rate_monotonic_delete failed with status of %d.\n", status); + printf( + "rtems_rate_monotonic_delete failed with status of %d.\n", + status + ); rtems_test_exit( 0 ); } printf( "Periodic task: Deleting self\n" ); diff --git a/testsuites/sptests/spcbssched03/cbsparams.h b/testsuites/sptests/spcbssched03/cbsparams.h index 6876d52785..49cc2856b0 100644 --- a/testsuites/sptests/spcbssched03/cbsparams.h +++ b/testsuites/sptests/spcbssched03/cbsparams.h @@ -39,21 +39,23 @@ #include "system.h" -rtems_task_priority Priorities[1+NUM_TASKS]= { 0, 30, 40, 50, 70, 254, 254 }; +rtems_task_priority Priorities[ 1 + NUM_TASKS ] = + { 0, 30, 40, 50, 70, 254, 254 }; -uint32_t Periods[1+NUM_PERIODIC_TASKS] = { 0, 30, 40, 50, 70 }; +uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ] = { 0, 30, 40, 50, 70 }; -uint32_t Execution[1+NUM_TASKS] = { 0, 10, 10, 10, 10, 100, 5 }; +uint32_t Execution[ 1 + NUM_TASKS ] = { 0, 10, 10, 10, 10, 100, 5 }; -uint32_t Phases[1+NUM_TASKS] = { 0, 0, 0, 0, 0, 7, 4 }; +uint32_t Phases[ 1 + NUM_TASKS ] = { 0, 0, 0, 0, 0, 7, 4 }; -#define build_task_name() do { \ -Task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );\ -Task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );\ -Task_name[ 3 ] = rtems_build_name( 'P', 'T', '3', ' ' );\ -Task_name[ 4 ] = rtems_build_name( 'P', 'T', '4', ' ' );\ -Task_name[ 5 ] = rtems_build_name( 'A', 'T', '5', ' ' );\ -Task_name[ 6 ] = rtems_build_name( 'A', 'T', '6', ' ' );\ -} while(0) +#define build_task_name() \ + do { \ + Task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); \ + Task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); \ + Task_name[ 3 ] = rtems_build_name( 'P', 'T', '3', ' ' ); \ + Task_name[ 4 ] = rtems_build_name( 'P', 'T', '4', ' ' ); \ + Task_name[ 5 ] = rtems_build_name( 'A', 'T', '5', ' ' ); \ + Task_name[ 6 ] = rtems_build_name( 'A', 'T', '6', ' ' ); \ + } while ( 0 ) #endif diff --git a/testsuites/sptests/spcbssched03/init.c b/testsuites/sptests/spcbssched03/init.c index 76a73d2192..c4777eb5bd 100644 --- a/testsuites/sptests/spcbssched03/init.c +++ b/testsuites/sptests/spcbssched03/init.c @@ -36,20 +36,18 @@ const char rtems_test_name[] = "SPCBSSCHED 3"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - uint32_t index; + uint32_t index; rtems_status_code status; TEST_BEGIN(); build_task_name(); - for ( index = 1 ; index <= NUM_TASKS ; index++ ) { + for ( index = 1; index <= NUM_TASKS; index++ ) { status = rtems_task_create( Task_name[ index ], Priorities[ index ], @@ -63,12 +61,12 @@ rtems_task Init( rtems_cbs_initialize(); - for ( index = 1 ; index <= NUM_PERIODIC_TASKS ; index++ ) { + for ( index = 1; index <= NUM_PERIODIC_TASKS; index++ ) { status = rtems_task_start( Task_id[ index ], Tasks_Periodic, index ); directive_failed( status, "rtems_task_start loop" ); } - for ( index = NUM_PERIODIC_TASKS+1 ; index <= NUM_TASKS ; index++ ) { + for ( index = NUM_PERIODIC_TASKS + 1; index <= NUM_TASKS; index++ ) { status = rtems_task_start( Task_id[ index ], Tasks_Aperiodic, index ); directive_failed( status, "rtems_task_start loop" ); } diff --git a/testsuites/sptests/spcbssched03/system.h b/testsuites/sptests/spcbssched03/system.h index d939d837cb..3da4be50b6 100644 --- a/testsuites/sptests/spcbssched03/system.h +++ b/testsuites/sptests/spcbssched03/system.h @@ -34,17 +34,11 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Tasks_Periodic( - rtems_task_argument argument -); +rtems_task Tasks_Periodic( rtems_task_argument argument ); -rtems_task Tasks_Aperiodic( - rtems_task_argument argument -); +rtems_task Tasks_Aperiodic( rtems_task_argument argument ); /* configuration information */ @@ -53,16 +47,16 @@ rtems_task Tasks_Aperiodic( #define CONFIGURE_MICROSECONDS_PER_TICK 20000 -#define CONFIGURE_MAXIMUM_TASKS 7 -#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_TASKS 7 +#define CONFIGURE_MAXIMUM_PERIODS 10 -#define CONFIGURE_INIT_TASK_PRIORITY 100 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INIT_TASK_PRIORITY 100 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (6 * 4 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 6 * 4 * RTEMS_MINIMUM_STACK_SIZE ) #define CONFIGURE_SCHEDULER_CBS @@ -73,20 +67,20 @@ rtems_task Tasks_Aperiodic( #include #include -#define JOBS_PER_HP (389) -#define HP_LENGTH (420) -#define NUM_PERIODIC_TASKS (4) -#define NUM_APERIODIC_TASKS (2) -#define NUM_TASKS ( NUM_PERIODIC_TASKS + NUM_APERIODIC_TASKS ) +#define JOBS_PER_HP ( 389 ) +#define HP_LENGTH ( 420 ) +#define NUM_PERIODIC_TASKS ( 4 ) +#define NUM_APERIODIC_TASKS ( 2 ) +#define NUM_TASKS ( NUM_PERIODIC_TASKS + NUM_APERIODIC_TASKS ) /* global variables */ -TEST_EXTERN rtems_id Task_id[ 1+NUM_TASKS ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 1+NUM_TASKS ]; /* array of task names */ -TEST_EXTERN rtems_task_priority Priorities[ 1+NUM_TASKS ]; -TEST_EXTERN uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ]; -TEST_EXTERN uint32_t Phases[1 + NUM_TASKS]; -TEST_EXTERN uint32_t Execution[1 + NUM_TASKS]; -TEST_EXTERN bool Violating_task[1 + NUM_PERIODIC_TASKS]; +TEST_EXTERN rtems_id Task_id[ 1 + NUM_TASKS ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 1 + NUM_TASKS ]; /* array of task names */ +TEST_EXTERN rtems_task_priority Priorities[ 1 + NUM_TASKS ]; +TEST_EXTERN uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ]; +TEST_EXTERN uint32_t Phases[ 1 + NUM_TASKS ]; +TEST_EXTERN uint32_t Execution[ 1 + NUM_TASKS ]; +TEST_EXTERN bool Violating_task[ 1 + NUM_PERIODIC_TASKS ]; /* end of include file */ diff --git a/testsuites/sptests/spcbssched03/tasks_aperiodic.c b/testsuites/sptests/spcbssched03/tasks_aperiodic.c index 249e6ff4e6..b3ecf72f28 100644 --- a/testsuites/sptests/spcbssched03/tasks_aperiodic.c +++ b/testsuites/sptests/spcbssched03/tasks_aperiodic.c @@ -31,31 +31,31 @@ #include "system.h" -rtems_task Tasks_Aperiodic( - rtems_task_argument argument -) +rtems_task Tasks_Aperiodic( rtems_task_argument argument ) { rtems_status_code status; - rtems_interval start, stop, now; + rtems_interval start, stop, now; put_name( Task_name[ argument ], FALSE ); - status = rtems_task_wake_after( 2 + Phases[argument] ); + status = rtems_task_wake_after( 2 + Phases[ argument ] ); directive_failed( status, "rtems_task_wake_after" ); start = rtems_clock_get_ticks_since_boot(); - printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start); + printf( "AT%" PRIdPTR "-S ticks:%d\n", argument, start ); /* active computing */ - while(FOREVER) { + while ( FOREVER ) { now = rtems_clock_get_ticks_since_boot(); - if (now >= start + Execution[argument]) break; + if ( now >= start + Execution[ argument ] ) { + break; + } } stop = rtems_clock_get_ticks_since_boot(); - printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop); + printf( "P%" PRIdPTR "-F ticks:%d\n", argument, stop ); /* delete SELF */ - fflush(stdout); - printf( "Killing task %" PRIdPTR "\n", argument); + fflush( stdout ); + printf( "Killing task %" PRIdPTR "\n", argument ); rtems_task_exit(); } diff --git a/testsuites/sptests/spcbssched03/tasks_periodic.c b/testsuites/sptests/spcbssched03/tasks_periodic.c index 193dd5994c..6e8b3c5d45 100644 --- a/testsuites/sptests/spcbssched03/tasks_periodic.c +++ b/testsuites/sptests/spcbssched03/tasks_periodic.c @@ -34,11 +34,9 @@ #include /* forward declarations to avoid warnings */ -void overrun_handler_task_4(rtems_cbs_server_id server_id); +void overrun_handler_task_4( rtems_cbs_server_id server_id ); -void overrun_handler_task_4( - rtems_cbs_server_id server_id -) +void overrun_handler_task_4( rtems_cbs_server_id server_id ) { (void) server_id; @@ -48,9 +46,7 @@ void overrun_handler_task_4( return; } -rtems_task Tasks_Periodic( - rtems_task_argument argument -) +rtems_task Tasks_Periodic( rtems_task_argument argument ) { (void) argument; @@ -61,64 +57,85 @@ rtems_task Tasks_Periodic( rtems_interval start, stop, now; - rtems_cbs_server_id server_id, tsid; + rtems_cbs_server_id server_id, tsid; rtems_cbs_parameters params, tparams; params.deadline = Periods[ argument ]; - params.budget = Execution[ argument ]+1; + params.budget = Execution[ argument ] + 1; if ( argument == 4 ) { - if ( rtems_cbs_create_server( ¶ms, &overrun_handler_task_4, &server_id )) + if ( + rtems_cbs_create_server( ¶ms, &overrun_handler_task_4, &server_id ) + ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - } - else { - if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) + } + } else { + if ( rtems_cbs_create_server( ¶ms, NULL, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); + } } - if ( rtems_cbs_attach_thread( server_id, Task_id[ argument ] ) ) + if ( rtems_cbs_attach_thread( server_id, Task_id[ argument ] ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); - if ( rtems_cbs_get_server_id( Task_id[ argument ], &tsid ) ) + } + if ( rtems_cbs_get_server_id( Task_id[ argument ], &tsid ) ) { printf( "ERROR: GET SERVER ID FAILED\n" ); - if ( tsid != server_id ) + } + if ( tsid != server_id ) { printf( "ERROR: SERVER ID MISMATCH\n" ); - if ( rtems_cbs_get_parameters( server_id, &tparams ) ) + } + if ( rtems_cbs_get_parameters( server_id, &tparams ) ) { printf( "ERROR: GET PARAMETERS FAILED\n" ); - if ( params.deadline != tparams.deadline || - params.budget != tparams.budget ) + } + if ( + params.deadline != tparams.deadline || params.budget != tparams.budget + ) { printf( "ERROR: PARAMETERS MISMATCH\n" ); + } status = rtems_rate_monotonic_create( argument, &rmid ); directive_failed( status, "rtems_rate_monotonic_create" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", - rmid ); + printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid ); status = rtems_rate_monotonic_ident( argument, &test_rmid ); directive_failed( status, "rtems_rate_monotonic_ident" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", - test_rmid ); + printf( + "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", + test_rmid + ); if ( rmid != test_rmid ) { - printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" - PRIxrtems_id ")\n", rmid, test_rmid ); - rtems_test_exit( 0 ); + printf( + "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", + rmid, + test_rmid + ); + rtems_test_exit( 0 ); } put_name( Task_name[ argument ], FALSE ); - printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", - rmid, Periods[ argument ] ); + printf( + "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", + rmid, + Periods[ argument ] + ); - status = rtems_task_wake_after( 2 + Phases[argument] ); + status = rtems_task_wake_after( 2 + Phases[ argument ] ); directive_failed( status, "rtems_task_wake_after" ); - while (FOREVER) { - if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT) - printf("P%" PRIdPTR " - Deadline miss\n", argument); + while ( FOREVER ) { + if ( + rtems_rate_monotonic_period( rmid, Periods[ argument ] ) == RTEMS_TIMEOUT + ) { + printf( "P%" PRIdPTR " - Deadline miss\n", argument ); + } start = rtems_clock_get_ticks_since_boot(); - printf("P%" PRIdPTR "-S ticks:%d\n", argument, start); - if ( start >= 2*HP_LENGTH ) break; /* stop */ + printf( "P%" PRIdPTR "-S ticks:%d\n", argument, start ); + if ( start >= 2 * HP_LENGTH ) { + break; /* stop */ + } /* Specific scenario for task 4: tries to exceed announced budget, the task priority has to be pulled down to background. */ @@ -129,17 +146,21 @@ rtems_task Tasks_Periodic( } /* Specific scenario for task 3: changes scheduling parameters. */ if ( !scenario_done && argument == 3 && now >= 250 ) { - Periods[ argument ] = Periods[ argument ] * 2; + Periods[ argument ] = Periods[ argument ] * 2; Execution[ argument ] = Execution[ argument ] * 2; params.deadline = Periods[ argument ]; - params.budget = Execution[ argument ]+1; - if ( rtems_cbs_set_parameters( server_id, ¶ms) ) + params.budget = Execution[ argument ] + 1; + if ( rtems_cbs_set_parameters( server_id, ¶ms ) ) { printf( "ERROR: SET PARAMETERS FAILED\n" ); - if ( rtems_cbs_get_parameters( server_id, &tparams ) ) + } + if ( rtems_cbs_get_parameters( server_id, &tparams ) ) { printf( "ERROR: GET PARAMETERS FAILED\n" ); - if ( params.deadline != tparams.deadline || - params.budget != tparams.budget ) + } + if ( + params.deadline != tparams.deadline || params.budget != tparams.budget + ) { printf( "ERROR: PARAMETERS MISMATCH\n" ); + } scenario_done = 1; } /* Specific scenario for task 2: late unblock after being blocked by @@ -148,31 +169,40 @@ rtems_task Tasks_Periodic( Violating_task[ argument ] = 1; scenario_done = 1; } - if (argument == 2 && Violating_task[ argument ]) + if ( argument == 2 && Violating_task[ argument ] ) { rtems_task_wake_after( 10 ); + } /* active computing */ - while(FOREVER) { + while ( FOREVER ) { now = rtems_clock_get_ticks_since_boot(); - if ( argument == 4 && !Violating_task[ argument ] && - (now >= start + Execution[argument])) + if ( + argument == 4 && !Violating_task[ argument ] && + ( now >= start + Execution[ argument ] ) + ) { break; - if ( argument != 4 && (now >= start + Execution[argument]) ) + } + if ( argument != 4 && ( now >= start + Execution[ argument ] ) ) { break; + } } stop = rtems_clock_get_ticks_since_boot(); - printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop); + printf( "P%" PRIdPTR "-F ticks:%d\n", argument, stop ); } /* delete period and SELF */ status = rtems_rate_monotonic_delete( rmid ); if ( status != RTEMS_SUCCESSFUL ) { - printf("rtems_rate_monotonic_delete failed with status of %d.\n",status); + printf( + "rtems_rate_monotonic_delete failed with status of %d.\n", + status + ); rtems_test_exit( 0 ); } - if ( rtems_cbs_cleanup() ) + if ( rtems_cbs_cleanup() ) { printf( "ERROR: CBS CLEANUP\n" ); - fflush(stdout); + } + fflush( stdout ); TEST_END(); rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/spchain/init.c b/testsuites/sptests/spchain/init.c index f0e7973fb6..dbd126e58f 100644 --- a/testsuites/sptests/spchain/init.c +++ b/testsuites/sptests/spchain/init.c @@ -35,7 +35,7 @@ const char rtems_test_name[] = "SPCHAIN"; -static void test_chain_init_one(void) +static void test_chain_init_one( void ) { Chain_Control chain; Chain_Node node; @@ -59,29 +59,29 @@ static void test_chain_init_one(void) static void update_registry_and_extract( Chain_Iterator_registry *reg, - Chain_Node *n + Chain_Node *n ) { _Chain_Iterator_registry_update( reg, n ); _Chain_Extract_unprotected( n ); } -static Chain_Iterator_registry static_reg = - CHAIN_ITERATOR_REGISTRY_INITIALIZER( static_reg ); +static Chain_Iterator_registry + static_reg = CHAIN_ITERATOR_REGISTRY_INITIALIZER( static_reg ); static void test_chain_iterator( void ) { - Chain_Control chain; + Chain_Control chain; Chain_Iterator_registry reg; - Chain_Iterator fit; - Chain_Iterator bit; - Chain_Node a; - Chain_Node b; - Chain_Node c; + Chain_Iterator fit; + Chain_Iterator bit; + Chain_Node a; + Chain_Node b; + Chain_Node c; puts( "INIT - Verify Chain_Iterator" ); - rtems_test_assert( _Chain_Is_empty( &static_reg.Iterators )); + rtems_test_assert( _Chain_Is_empty( &static_reg.Iterators ) ); _Chain_Initialize_empty( &chain ); _Chain_Initialize_node( &a ); @@ -91,13 +91,13 @@ static void test_chain_iterator( void ) _Chain_Iterator_initialize( &chain, ®, &fit, CHAIN_ITERATOR_FORWARD ); _Chain_Iterator_initialize( &chain, ®, &bit, CHAIN_ITERATOR_BACKWARD ); - rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain )); - rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain )); + rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain ) ); + rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain ) ); _Chain_Iterator_set_position( &fit, _Chain_Head( &chain ) ); _Chain_Iterator_set_position( &bit, _Chain_Tail( &chain ) ); - rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain )); - rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain )); + rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain ) ); + rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain ) ); _Chain_Append_unprotected( &chain, &a ); rtems_test_assert( _Chain_Iterator_next( &fit ) == &a ); @@ -144,8 +144,8 @@ static void test_chain_iterator( void ) rtems_test_assert( _Chain_Iterator_next( &bit ) == &c ); update_registry_and_extract( ®, &c ); - rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain )); - rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain )); + rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain ) ); + rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain ) ); _Chain_Append_unprotected( &chain, &a ); rtems_test_assert( _Chain_Iterator_next( &fit ) == &a ); @@ -168,20 +168,20 @@ static void test_chain_iterator( void ) rtems_test_assert( _Chain_Iterator_next( &bit ) == &a ); update_registry_and_extract( ®, &a ); - rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain )); - rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain )); + rtems_test_assert( _Chain_Iterator_next( &fit ) == _Chain_Tail( &chain ) ); + rtems_test_assert( _Chain_Iterator_next( &bit ) == _Chain_Head( &chain ) ); - rtems_test_assert( !_Chain_Is_empty( ®.Iterators )); + rtems_test_assert( !_Chain_Is_empty( ®.Iterators ) ); _Chain_Iterator_destroy( &fit ); - rtems_test_assert( !_Chain_Is_empty( ®.Iterators )); + rtems_test_assert( !_Chain_Is_empty( ®.Iterators ) ); _Chain_Iterator_destroy( &bit ); - rtems_test_assert( _Chain_Is_empty( ®.Iterators )); + rtems_test_assert( _Chain_Is_empty( ®.Iterators ) ); } /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -#define EVENT RTEMS_EVENT_13 +#define EVENT RTEMS_EVENT_13 #define TIMEOUT 1 typedef struct { @@ -194,10 +194,11 @@ static rtems_chain_control one_node_chain; static rtems_chain_node node_of_one_node_chain = RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( &one_node_chain ); -static rtems_chain_control one_node_chain = - RTEMS_CHAIN_INITIALIZER_ONE_NODE( &node_of_one_node_chain ); +static rtems_chain_control one_node_chain = RTEMS_CHAIN_INITIALIZER_ONE_NODE( + &node_of_one_node_chain +); -static void test_chain_control_initializer(void) +static void test_chain_control_initializer( void ) { rtems_chain_control chain = RTEMS_CHAIN_INITIALIZER_EMPTY( chain ); @@ -213,47 +214,42 @@ static void test_chain_control_initializer(void) rtems_chain_immutable_last( &one_node_chain ) == &node_of_one_node_chain ); rtems_test_assert( - rtems_chain_immutable_head( &one_node_chain ) - == rtems_chain_immutable_previous( &node_of_one_node_chain ) + rtems_chain_immutable_head( &one_node_chain ) == + rtems_chain_immutable_previous( &node_of_one_node_chain ) ); rtems_test_assert( - rtems_chain_immutable_tail( &one_node_chain ) - == rtems_chain_immutable_next( &node_of_one_node_chain ) + rtems_chain_immutable_tail( &one_node_chain ) == + rtems_chain_immutable_next( &node_of_one_node_chain ) ); } -static void test_chain_control_layout(void) +static void test_chain_control_layout( void ) { Chain_Control chain; puts( "INIT - Verify rtems_chain_control layout" ); rtems_test_assert( - sizeof(Chain_Control) - == sizeof(Chain_Node) + sizeof(Chain_Node *) + sizeof( Chain_Control ) == sizeof( Chain_Node ) + sizeof( Chain_Node * ) ); + rtems_test_assert( sizeof( Chain_Control ) == 3 * sizeof( Chain_Node * ) ); rtems_test_assert( - sizeof(Chain_Control) - == 3 * sizeof(Chain_Node *) - ); - rtems_test_assert( - _Chain_Previous( _Chain_Head( &chain ) ) - == _Chain_Next( _Chain_Tail( &chain ) ) + _Chain_Previous( _Chain_Head( &chain ) ) == + _Chain_Next( _Chain_Tail( &chain ) ) ); #if !defined( RTEMS_SMP ) rtems_test_assert( - sizeof(Chain_Control) - == sizeof(rtems_chain_control) + sizeof( Chain_Control ) == sizeof( rtems_chain_control ) ); #endif } -static void test_chain_get_with_wait(void) +static void test_chain_get_with_wait( void ) { - rtems_status_code sc = RTEMS_SUCCESSFUL; + rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_chain_control chain; - rtems_chain_node *p = (rtems_chain_node *) 1; + rtems_chain_node *p = (rtems_chain_node *) 1; puts( "INIT - Verify rtems_chain_get_with_wait" ); rtems_chain_initialize_empty( &chain ); @@ -262,11 +258,11 @@ static void test_chain_get_with_wait(void) rtems_test_assert( p == NULL ); } -static void test_chain_first_and_last(void) +static void test_chain_first_and_last( void ) { - rtems_chain_control chain; - rtems_chain_node node1, node2; - rtems_chain_node *cnode; + rtems_chain_control chain; + rtems_chain_node node1, node2; + rtems_chain_node *cnode; rtems_chain_initialize_empty( &chain ); rtems_chain_initialize_node( &node1 ); @@ -275,11 +271,11 @@ static void test_chain_first_and_last(void) rtems_chain_insert( &node1, &node2 ); puts( "INIT - Verify rtems_chain_is_first" ); - cnode = rtems_chain_first(&chain); + cnode = rtems_chain_first( &chain ); rtems_test_assert( rtems_chain_is_first( cnode ) ); puts( "INIT - Verify rtems_chain_is_last" ); - cnode = rtems_chain_last(&chain); + cnode = rtems_chain_last( &chain ); rtems_test_assert( rtems_chain_is_last( cnode ) ); cnode = rtems_chain_get_first_unprotected( &chain ); @@ -290,14 +286,14 @@ static void test_chain_first_and_last(void) rtems_test_assert( cnode == &node2 ); } -static void test_chain_with_notification(void) +static void test_chain_with_notification( void ) { - rtems_status_code sc = RTEMS_SUCCESSFUL; + rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_chain_control chain; - rtems_chain_node a; - rtems_chain_node b; - rtems_chain_node *p = (rtems_chain_node *) 1; - rtems_event_set out = 0; + rtems_chain_node a; + rtems_chain_node b; + rtems_chain_node *p = (rtems_chain_node *) 1; + rtems_event_set out = 0; puts( "INIT - Verify rtems_chain_append_with_notification" ); rtems_chain_initialize_empty( &chain ); @@ -360,11 +356,21 @@ static void test_chain_with_notification(void) rtems_chain_append( &chain, &b ); rtems_chain_append( &chain, &a ); - sc = rtems_chain_get_with_notification(&chain, rtems_task_self(), EVENT, &p); + sc = rtems_chain_get_with_notification( + &chain, + rtems_task_self(), + EVENT, + &p + ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( p == &b ); - sc = rtems_chain_get_with_notification(&chain, rtems_task_self(), EVENT, &p); + sc = rtems_chain_get_with_notification( + &chain, + rtems_task_self(), + EVENT, + &p + ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( p == &a ); sc = rtems_event_receive( @@ -377,14 +383,14 @@ static void test_chain_with_notification(void) rtems_test_assert( out == EVENT ); } -static void test_chain_with_empty_check(void) +static void test_chain_with_empty_check( void ) { rtems_chain_control chain; - rtems_chain_node a; - rtems_chain_node b; - rtems_chain_node c; - rtems_chain_node *p; - bool empty; + rtems_chain_node a; + rtems_chain_node b; + rtems_chain_node c; + rtems_chain_node *p; + bool empty; puts( "INIT - Verify rtems_chain_append_with_empty_check" ); rtems_chain_initialize_empty( &chain ); @@ -424,12 +430,12 @@ static void test_chain_with_empty_check(void) rtems_test_assert( p == &b ); } -static void test_chain_node_count(void) +static void test_chain_node_count( void ) { rtems_chain_control chain; - rtems_chain_node nodes[3]; - size_t count; - size_t i; + rtems_chain_node nodes[ 3 ]; + size_t count; + size_t i; puts( "INIT - Verify rtems_chain_node_count_unprotected" ); @@ -437,9 +443,9 @@ static void test_chain_node_count(void) count = rtems_chain_node_count_unprotected( &chain ); rtems_test_assert( count == 0 ); - for (i = 0; i < RTEMS_ARRAY_SIZE( nodes ); ++i) { + for ( i = 0; i < RTEMS_ARRAY_SIZE( nodes ); ++i ) { rtems_chain_initialize_node( &nodes[ i ] ); - rtems_chain_append_unprotected( &chain, &nodes[i] ); + rtems_chain_append_unprotected( &chain, &nodes[ i ] ); count = rtems_chain_node_count_unprotected( &chain ); rtems_test_assert( count == i + 1 ); } @@ -463,12 +469,12 @@ static void insert_ordered( Chain_Control *chain, Chain_Node *node ) static void test_chain_insert_ordered( void ) { - Chain_Control chain = CHAIN_INITIALIZER_EMPTY(chain); - Chain_Node nodes[5]; + Chain_Control chain = CHAIN_INITIALIZER_EMPTY( chain ); + Chain_Node nodes[ 5 ]; const Chain_Node *tail; const Chain_Node *node; - size_t n = RTEMS_ARRAY_SIZE( nodes ); - size_t i; + size_t n = RTEMS_ARRAY_SIZE( nodes ); + size_t i; puts( "INIT - Verify _Chain_Insert_ordered_unprotected" ); @@ -476,11 +482,11 @@ static void test_chain_insert_ordered( void ) _Chain_Initialize_node( &nodes[ i ] ); } - insert_ordered( &chain, &nodes[4] ); - insert_ordered( &chain, &nodes[2] ); - insert_ordered( &chain, &nodes[0] ); - insert_ordered( &chain, &nodes[3] ); - insert_ordered( &chain, &nodes[1] ); + insert_ordered( &chain, &nodes[ 4 ] ); + insert_ordered( &chain, &nodes[ 2 ] ); + insert_ordered( &chain, &nodes[ 0 ] ); + insert_ordered( &chain, &nodes[ 3 ] ); + insert_ordered( &chain, &nodes[ 1 ] ); tail = _Chain_Immutable_tail( &chain ); node = _Chain_Immutable_first( &chain ); @@ -494,16 +500,14 @@ static void test_chain_insert_ordered( void ) rtems_test_assert( i == n ); } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_chain_control chain1; - rtems_chain_node *p; - test_node node1, node2; - int id; + rtems_chain_control chain1; + rtems_chain_node *p; + test_node node1, node2; + int id; TEST_BEGIN(); @@ -519,18 +523,20 @@ rtems_task Init( rtems_chain_append( &chain1, &node1.Node ); rtems_chain_insert( &node1.Node, &node2.Node ); - for ( p = rtems_chain_first(&chain1), id = 1 ; - !rtems_chain_is_tail(&chain1, p) ; - p = p->next , id++ ) { - test_node *t = (test_node *)p; - if ( id > 2 ) { - puts( "INIT - TOO MANY NODES ON CHAIN" ); - rtems_test_exit(0); - } - if ( t->id != id ) { - puts( "INIT - ERROR ON CHAIN ID MISMATCH" ); - rtems_test_exit(0); - } + for ( + p = rtems_chain_first( &chain1 ), id = 1; + !rtems_chain_is_tail( &chain1, p ); + p = p->next, id++ + ) { + test_node *t = (test_node *) p; + if ( id > 2 ) { + puts( "INIT - TOO MANY NODES ON CHAIN" ); + rtems_test_exit( 0 ); + } + if ( t->id != id ) { + puts( "INIT - ERROR ON CHAIN ID MISMATCH" ); + rtems_test_exit( 0 ); + } } test_chain_init_one(); @@ -545,7 +551,7 @@ rtems_task Init( test_chain_iterator(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ diff --git a/testsuites/sptests/spclock_err01/delay.c b/testsuites/sptests/spclock_err01/delay.c index b87a9b240c..ac129ed5fc 100644 --- a/testsuites/sptests/spclock_err01/delay.c +++ b/testsuites/sptests/spclock_err01/delay.c @@ -41,8 +41,8 @@ #include "system.h" rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; diff --git a/testsuites/sptests/spclock_err01/init.c b/testsuites/sptests/spclock_err01/init.c index d38d1d79ef..8c7f7aadde 100644 --- a/testsuites/sptests/spclock_err01/init.c +++ b/testsuites/sptests/spclock_err01/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP CLOCK ERROR 2"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -45,9 +43,9 @@ rtems_task Init( rtems_interval interval; struct timeval tv; rtems_status_code status; - + TEST_BEGIN(); - + puts( "TA1 - rtems_clock_get_tod - RTEMS_INVALID_ADDRESS" ); status = rtems_clock_get_tod( NULL ); fatal_directive_status( @@ -56,13 +54,13 @@ rtems_task Init( "rtems_clock_get_tod NULL param" ); -/* errors before clock is set */ + /* errors before clock is set */ status = rtems_clock_get_tod( &time ); if ( status == RTEMS_SUCCESSFUL ) { puts( - "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -- " - "DID BSP SET THE TIME OF DAY?" + "TA1 - rtems_clock_get_tod - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" ); } else { fatal_directive_status( @@ -84,8 +82,8 @@ rtems_task Init( status = rtems_clock_get_seconds_since_epoch( &interval ); if ( status == RTEMS_SUCCESSFUL ) { puts( - "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -- " - "DID BSP SET THE TIME OF DAY?" + "TA1 - rtems_clock_get_seconds_since_epoch - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" ); } else { fatal_directive_status( @@ -124,8 +122,8 @@ rtems_task Init( status = rtems_clock_get_tod_timeval( &tv ); if ( status == RTEMS_SUCCESSFUL ) { puts( - "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -- " - "DID BSP SET THE TIME OF DAY?" + "TA1 - rtems_clock_get_tod_timeval - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" ); } else { fatal_directive_status( @@ -206,7 +204,13 @@ rtems_task Init( puts( " - RTEMS_INVALID_CLOCK" ); build_time( - &time, 2, 5, 1988, 8, 30, 45, + &time, + 2, + 5, + 1988, + 8, + 30, + 45, rtems_clock_get_ticks_per_second() + 1 ); print_time( "TA1 - rtems_clock_set - ", &time, "" ); diff --git a/testsuites/sptests/spclock_err01/system.h b/testsuites/sptests/spclock_err01/system.h index 9866d39e7e..a8e46b902f 100644 --- a/testsuites/sptests/spclock_err01/system.h +++ b/testsuites/sptests/spclock_err01/system.h @@ -35,13 +35,11 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); /* configuration information */ @@ -49,40 +47,40 @@ rtems_timer_service_routine Delayed_routine( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spclock_err02/init.c b/testsuites/sptests/spclock_err02/init.c index c4a11c84d7..1a5999c70c 100644 --- a/testsuites/sptests/spclock_err02/init.c +++ b/testsuites/sptests/spclock_err02/init.c @@ -36,11 +36,9 @@ const char rtems_test_name[] = "SPCLOCK_ERR 2"; /* forward declaration to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -49,42 +47,42 @@ rtems_task Init( rtems_time_of_day time; rtems_status_code status; - status = rtems_io_close( 0xffff, 0x0000, NULL); + status = rtems_io_close( 0xffff, 0x0000, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_io_close with bad major number" ); puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" ); - status = rtems_io_control( 0xffff, 0x00000, NULL); + status = rtems_io_control( 0xffff, 0x00000, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_io_close with bad major number" ); puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" ); - status = rtems_io_initialize( 0xffff, 0x00000, NULL); + status = rtems_io_initialize( 0xffff, 0x00000, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_io_initialize with bad major number" ); puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" ); - status = rtems_io_open( 0xffff, 0x00000, NULL); + status = rtems_io_open( 0xffff, 0x00000, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_io_open with bad major number" ); puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" ); - status = rtems_io_read( 0xffff, 0x00000, NULL); + status = rtems_io_read( 0xffff, 0x00000, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_io_read with bad major number" ); puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" ); - status = rtems_io_write( 0xffff, 0x0ffff, NULL); + status = rtems_io_write( 0xffff, 0x0ffff, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, @@ -144,7 +142,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spclock_todhook01/init.c b/testsuites/sptests/spclock_todhook01/init.c index 34483c32f4..6e93ea1cc2 100644 --- a/testsuites/sptests/spclock_todhook01/init.c +++ b/testsuites/sptests/spclock_todhook01/init.c @@ -34,7 +34,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ - #include #include @@ -48,39 +47,37 @@ const char rtems_test_name[] = "SPCLOCK TOD HOOK 1"; typedef struct test_case { - bool do_settime; - bool use_posix; - bool do_hook1; - bool do_hook2; - struct tm tm; + bool do_settime; + bool use_posix; + bool do_hook1; + bool do_hook2; + struct tm tm; } testcase_t; -#define TM(_sec, _min, _hour, _mday, _mon, _year ) \ - { \ - .tm_sec = (_sec), \ - .tm_min = (_min), \ - .tm_hour = (_hour), \ - .tm_mday = (_mday), \ - .tm_mon = (_mon), \ - .tm_year = (_year) \ - } +#define TM( _sec, _min, _hour, _mday, _mon, _year ) \ + { .tm_sec = ( _sec ), \ + .tm_min = ( _min ), \ + .tm_hour = ( _hour ), \ + .tm_mday = ( _mday ), \ + .tm_mon = ( _mon ), \ + .tm_year = ( _year ) } testcase_t Cases[] = { /* should not trigger hooks when time not set */ { false, false, false, false, TM( 0, 0, 9, 31, 11, 88 ) }, - { false, false, true, true, TM( 0, 0, 9, 24, 5, 95 ) }, + { false, false, true, true, TM( 0, 0, 9, 24, 5, 95 ) }, /* should trigger hook when time is set with Classic API rtems_clock_set */ - { true, false, false, false, TM( 0, 0, 9, 24, 5, 95 ) }, - { true, false, false, false, TM( 0, 0, 9, 31, 11, 88 ) }, - { true, false, true, false, TM( 0, 0, 9, 31, 11, 88 ) }, - { true, false, true, true, TM( 0, 0, 9, 24, 5, 105 ) }, + { true, false, false, false, TM( 0, 0, 9, 24, 5, 95 ) }, + { true, false, false, false, TM( 0, 0, 9, 31, 11, 88 ) }, + { true, false, true, false, TM( 0, 0, 9, 31, 11, 88 ) }, + { true, false, true, true, TM( 0, 0, 9, 24, 5, 105 ) }, /* should trigger hook when time is set with POSIX API clock_settime */ - { true, true, false, false, TM( 0, 0, 9, 24, 5, 95 ) }, - { true, true, false, false, TM( 0, 9, 6, 14, 2, 114 ) }, - { true, true, true, false, TM( 0, 0, 9, 31, 11, 88 ) }, - { true, true, true, true, TM( 0, 0, 9, 24, 5, 105 ) }, + { true, true, false, false, TM( 0, 0, 9, 24, 5, 95 ) }, + { true, true, false, false, TM( 0, 9, 6, 14, 2, 114 ) }, + { true, true, true, false, TM( 0, 0, 9, 31, 11, 88 ) }, + { true, true, true, true, TM( 0, 0, 9, 24, 5, 105 ) }, }; -#define NUM_CASES (sizeof(Cases)/sizeof(testcase_t)) +#define NUM_CASES ( sizeof( Cases ) / sizeof( testcase_t ) ) static struct timespec tod_set; @@ -122,21 +119,21 @@ static Status_Control tod_hook2( * * Assume no hooks registered at begining. Unregister if needed at the end. */ -static void do_positive_case(int i) +static void do_positive_case( int i ) { - testcase_t *testcase = &Cases[i]; - TOD_Hook hook1; - TOD_Hook hook2; + testcase_t *testcase = &Cases[ i ]; + TOD_Hook hook1; + TOD_Hook hook2; #ifdef TEST_DEBUG - printf( - "%d: do_settime=%d use_posix=%d do_hook1=%d do_hook2=%d\n", - i, - testcase->do_settime, - testcase->use_posix, - testcase->do_hook1, - testcase->do_hook2 - ); + printf( + "%d: do_settime=%d use_posix=%d do_hook1=%d do_hook2=%d\n", + i, + testcase->do_settime, + testcase->use_posix, + testcase->do_hook1, + testcase->do_hook2 + ); #endif _Chain_Initialize_node( &hook1.Node ); @@ -163,9 +160,9 @@ static void do_positive_case(int i) * Now set the time and if registered, let the handlers fire */ if ( testcase->do_settime == true ) { - rtems_time_of_day time; - rtems_status_code status; - struct tm *tm = &testcase->tm; + rtems_time_of_day time; + rtems_status_code status; + struct tm *tm = &testcase->tm; tod_set.tv_sec = mktime( tm ); tod_set.tv_nsec = 0; @@ -187,7 +184,7 @@ static void do_positive_case(int i) int rc; rc = clock_settime( CLOCK_REALTIME, &tod_set ); - rtems_test_assert( rc == 0 ); + rtems_test_assert( rc == 0 ); } } @@ -203,11 +200,11 @@ static void do_positive_case(int i) } #ifdef TEST_DEBUG - printf( - " hook1_executed=%d hook2_executed=%d\n", - hook1_executed, - hook2_executed - ); + printf( + " hook1_executed=%d hook2_executed=%d\n", + hook1_executed, + hook2_executed + ); #endif /* @@ -247,13 +244,12 @@ static Status_Control tod_hook_error( * * Assume no hooks registered at begining. Unregister if needed at the end. */ -static void do_negative_case(bool use_posix) +static void do_negative_case( bool use_posix ) { - TOD_Hook hook_error; - rtems_time_of_day time; - rtems_status_code status; - struct tm *tm = &Cases[0].tm; - + TOD_Hook hook_error; + rtems_time_of_day time; + rtems_status_code status; + struct tm *tm = &Cases[ 0 ].tm; _Chain_Initialize_node( &hook_error.Node ); hook_error.handler = tod_hook_error; @@ -288,8 +284,8 @@ static void do_negative_case(bool use_posix) int rc; rc = clock_settime( CLOCK_REALTIME, &tod_set ); - rtems_test_assert( rc == -1 ); - rtems_test_assert( errno == EPERM ); + rtems_test_assert( rc == -1 ); + rtems_test_assert( errno == EPERM ); } /* @@ -303,8 +299,7 @@ static void do_negative_case(bool use_posix) rtems_test_assert( hook_error_executed == true ); } - -static rtems_task Init(rtems_task_argument ignored) +static rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -314,17 +309,17 @@ static rtems_task Init(rtems_task_argument ignored) TEST_BEGIN(); // test positive cases - for (i=0 ; i < NUM_CASES ; i++) { + for ( i = 0; i < NUM_CASES; i++ ) { do_positive_case( i ); } // test error cases - do_negative_case(false); - do_negative_case(true); + do_negative_case( false ); + do_negative_case( true ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -338,4 +333,3 @@ static rtems_task Init(rtems_task_argument ignored) #define CONFIGURE_INIT #include - diff --git a/testsuites/sptests/spconfig01/init.c b/testsuites/sptests/spconfig01/init.c index c95b558e4d..79f5e598bb 100644 --- a/testsuites/sptests/spconfig01/init.c +++ b/testsuites/sptests/spconfig01/init.c @@ -24,19 +24,19 @@ const char rtems_test_name[] = "SPCONFIG 1"; static int counter; -static void checkpoint(int expected_counter) +static void checkpoint( int expected_counter ) { int current_counter; current_counter = counter; - rtems_test_assert(current_counter == expected_counter); + rtems_test_assert( current_counter == expected_counter ); counter = current_counter + 1; } static rtems_status_code bsp_prerequisite_drivers_init( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg + void *arg ) { (void) major; @@ -44,14 +44,14 @@ static rtems_status_code bsp_prerequisite_drivers_init( (void) arg; TEST_BEGIN(); - checkpoint(0); + checkpoint( 0 ); return RTEMS_SUCCESSFUL; } static rtems_status_code app_prerequisite_drivers_init( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg + void *arg ) { (void) major; @@ -59,14 +59,14 @@ static rtems_status_code app_prerequisite_drivers_init( (void) arg; struct stat st; - int rv; + int rv; - checkpoint(1); + checkpoint( 1 ); errno = 0; - rv = stat("/dev/null", &st); - rtems_test_assert(rv == -1); - rtems_test_assert(errno == ENOENT); + rv = stat( "/dev/null", &st ); + rtems_test_assert( rv == -1 ); + rtems_test_assert( errno == ENOENT ); return RTEMS_SUCCESSFUL; } @@ -74,7 +74,7 @@ static rtems_status_code app_prerequisite_drivers_init( static rtems_status_code app_extra_drivers_init( rtems_device_major_number major, rtems_device_minor_number minor, - void *arg + void *arg ) { (void) major; @@ -82,49 +82,49 @@ static rtems_status_code app_extra_drivers_init( (void) arg; struct stat st; - int rv; + int rv; - checkpoint(2); + checkpoint( 2 ); - rv = stat("/dev/null", &st); - rtems_test_assert(rv == 0); + rv = stat( "/dev/null", &st ); + rtems_test_assert( rv == 0 ); return RTEMS_SUCCESSFUL; } -static void test_stack_config(void) +static void test_stack_config( void ) { pthread_attr_t attr; - size_t stack_size; - int eno; + size_t stack_size; + int eno; rtems_test_assert( rtems_configuration_get_interrupt_stack_size() == CPU_STACK_MINIMUM_SIZE ); - eno = pthread_getattr_np(pthread_self(), &attr); - rtems_test_assert(eno == 0); + eno = pthread_getattr_np( pthread_self(), &attr ); + rtems_test_assert( eno == 0 ); - eno = pthread_attr_getstacksize(&attr, &stack_size); - rtems_test_assert(eno == 0); - rtems_test_assert(stack_size >= 2 * CPU_STACK_MINIMUM_SIZE); + eno = pthread_attr_getstacksize( &attr, &stack_size ); + rtems_test_assert( eno == 0 ); + rtems_test_assert( stack_size >= 2 * CPU_STACK_MINIMUM_SIZE ); rtems_test_assert( - stack_size <= 2 * CPU_STACK_MINIMUM_SIZE + CPU_STACK_ALIGNMENT - - CPU_HEAP_ALIGNMENT + stack_size <= + 2 * CPU_STACK_MINIMUM_SIZE + CPU_STACK_ALIGNMENT - CPU_HEAP_ALIGNMENT ); - eno = pthread_attr_destroy(&attr); - rtems_test_assert(eno == 0); + eno = pthread_attr_destroy( &attr ); + rtems_test_assert( eno == 0 ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; - checkpoint(3); + checkpoint( 3 ); test_stack_config(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* @@ -156,7 +156,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MINIMUM_TASK_STACK_SIZE (2 * CPU_STACK_MINIMUM_SIZE) +#define CONFIGURE_MINIMUM_TASK_STACK_SIZE ( 2 * CPU_STACK_MINIMUM_SIZE ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spconfig02/init.c b/testsuites/sptests/spconfig02/init.c index 924de2de92..269abdf2ca 100644 --- a/testsuites/sptests/spconfig02/init.c +++ b/testsuites/sptests/spconfig02/init.c @@ -18,251 +18,249 @@ const char rtems_test_name[] = "SPCONFIG 2"; -static const rtems_name name = rtems_build_name('N', 'A', 'M', 'E'); +static const rtems_name name = rtems_build_name( 'N', 'A', 'M', 'E' ); -static void test_barrier_create(void) +static void test_barrier_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id); - rtems_test_assert(sc == RTEMS_TOO_MANY); + sc = rtems_barrier_create( name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id ); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_barrier_delete(void) +static void test_barrier_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_barrier_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_barrier_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0); - sc = rtems_barrier_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0 ); + sc = rtems_barrier_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_barrier_get(void) +static void test_barrier_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_barrier_wait(0, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_barrier_wait( 0, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0); - sc = rtems_barrier_wait(id, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_BARRIERS, 1, 0 ); + sc = rtems_barrier_wait( id, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_message_queue_create(void) +static void test_message_queue_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_message_queue_create( - name, + sc = rtems_message_queue_create( name, 1, 1, RTEMS_DEFAULT_ATTRIBUTES, &id ); + rtems_test_assert( sc == RTEMS_TOO_MANY ); +} + +static void test_message_queue_delete( void ) +{ + rtems_status_code sc; + rtems_id id; + + sc = rtems_message_queue_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + + id = rtems_build_id( + OBJECTS_CLASSIC_API, + OBJECTS_RTEMS_MESSAGE_QUEUES, 1, - 1, - RTEMS_DEFAULT_ATTRIBUTES, - &id + 0 ); - rtems_test_assert(sc == RTEMS_TOO_MANY); + sc = rtems_message_queue_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_message_queue_delete(void) +static void test_message_queue_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; + uint32_t count; - sc = rtems_message_queue_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_message_queue_flush( 0, &count ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_MESSAGE_QUEUES, 1, 0); - sc = rtems_message_queue_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( + OBJECTS_CLASSIC_API, + OBJECTS_RTEMS_MESSAGE_QUEUES, + 1, + 0 + ); + sc = rtems_message_queue_flush( id, &count ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_message_queue_get(void) +static void test_partition_create( void ) { rtems_status_code sc; - rtems_id id; - uint32_t count; - - sc = rtems_message_queue_flush(0, &count); - rtems_test_assert(sc == RTEMS_INVALID_ID); - - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_MESSAGE_QUEUES, 1, 0); - sc = rtems_message_queue_flush(id, &count); - rtems_test_assert(sc == RTEMS_INVALID_ID); -} - -static void test_partition_create(void) -{ - rtems_status_code sc; - rtems_id id; - long buf[32]; + rtems_id id; + long buf[ 32 ]; sc = rtems_partition_create( name, buf, - sizeof(buf), - sizeof(buf), + sizeof( buf ), + sizeof( buf ), RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_TOO_MANY); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_partition_delete(void) +static void test_partition_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_partition_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_partition_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PARTITIONS, 1, 0); - sc = rtems_partition_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PARTITIONS, 1, 0 ); + sc = rtems_partition_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_partition_get(void) +static void test_partition_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_partition_return_buffer(0, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_partition_return_buffer( 0, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PARTITIONS, 1, 0); - sc = rtems_partition_return_buffer(id, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PARTITIONS, 1, 0 ); + sc = rtems_partition_return_buffer( id, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_rate_monotonic_create(void) +static void test_rate_monotonic_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_rate_monotonic_create(name, &id); - rtems_test_assert(sc == RTEMS_TOO_MANY); + sc = rtems_rate_monotonic_create( name, &id ); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_rate_monotonic_delete(void) +static void test_rate_monotonic_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_rate_monotonic_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_rate_monotonic_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PERIODS, 1, 0); - sc = rtems_rate_monotonic_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PERIODS, 1, 0 ); + sc = rtems_rate_monotonic_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_rate_monotonic_get(void) +static void test_rate_monotonic_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_rate_monotonic_cancel(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_rate_monotonic_cancel( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PERIODS, 1, 0); - sc = rtems_rate_monotonic_cancel(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_PERIODS, 1, 0 ); + sc = rtems_rate_monotonic_cancel( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_region_create(void) +static void test_region_create( void ) { rtems_status_code sc; - rtems_id id; - long buf[32]; + rtems_id id; + long buf[ 32 ]; sc = rtems_region_create( name, buf, - sizeof(buf), + sizeof( buf ), 1, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_TOO_MANY); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_region_delete(void) +static void test_region_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_region_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_region_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS, 1, 0); - sc = rtems_region_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS, 1, 0 ); + sc = rtems_region_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_region_get(void) +static void test_region_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_region_return_segment(0, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_region_return_segment( 0, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS, 1, 0); - sc = rtems_region_return_segment(id, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_REGIONS, 1, 0 ); + sc = rtems_region_return_segment( id, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_semaphore_create(void) +static void test_semaphore_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_semaphore_create( - name, - 0, - RTEMS_DEFAULT_ATTRIBUTES, - 0, - &id - ); - rtems_test_assert(sc == RTEMS_TOO_MANY); + sc = rtems_semaphore_create( name, 0, RTEMS_DEFAULT_ATTRIBUTES, 0, &id ); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_semaphore_delete(void) +static void test_semaphore_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_semaphore_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_semaphore_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES, 1, 0); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES, 1, 0 ); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_semaphore_get(void) +static void test_semaphore_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_semaphore_release(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_semaphore_release( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES, 1, 0); - sc = rtems_semaphore_release(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_SEMAPHORES, 1, 0 ); + sc = rtems_semaphore_release( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_task_create(void) +static void test_task_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_task_create( name, @@ -272,137 +270,144 @@ static void test_task_create(void) RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_TOO_MANY); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_task_delete(void) +static void test_task_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0); - sc = rtems_task_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0 ); + sc = rtems_task_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_task_get(void) +static void test_task_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0); - sc = rtems_task_resume(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TASKS, 1, 0 ); + sc = rtems_task_resume( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_timer_create(void) +static void test_timer_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_timer_create(name, &id); - rtems_test_assert(sc == RTEMS_TOO_MANY); + sc = rtems_timer_create( name, &id ); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_timer_delete(void) +static void test_timer_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_timer_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_timer_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, 1, 0); - sc = rtems_timer_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, 1, 0 ); + sc = rtems_timer_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_timer_get(void) +static void test_timer_get( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_timer_reset(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_timer_reset( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, 1, 0); - sc = rtems_timer_reset(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_TIMERS, 1, 0 ); + sc = rtems_timer_reset( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_user_extensions_create(void) +static void test_user_extensions_create( void ) { - rtems_status_code sc; - rtems_id id; + rtems_status_code sc; + rtems_id id; rtems_extensions_table table; - memset(&table, 0, sizeof(table)); - sc = rtems_extension_create(name, &table, &id); - rtems_test_assert(sc == RTEMS_TOO_MANY); + memset( &table, 0, sizeof( table ) ); + sc = rtems_extension_create( name, &table, &id ); + rtems_test_assert( sc == RTEMS_TOO_MANY ); } -static void test_user_extensions_delete(void) +static void test_user_extensions_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_extension_delete(0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_extension_delete( 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - id = rtems_build_id(OBJECTS_CLASSIC_API, OBJECTS_RTEMS_EXTENSIONS, 1, 0); - sc = rtems_extension_delete(id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + id = rtems_build_id( OBJECTS_CLASSIC_API, OBJECTS_RTEMS_EXTENSIONS, 1, 0 ); + sc = rtems_extension_delete( id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_id_to_name(rtems_id api, rtems_id cls, rtems_id idx, bool *found) +static void test_id_to_name( + rtems_id api, + rtems_id cls, + rtems_id idx, + bool *found +) { rtems_status_code sc; - rtems_id id; - rtems_name name_of_id; + rtems_id id; + rtems_name name_of_id; - id = rtems_build_id(api, cls, 1, idx); - sc = rtems_object_get_classic_name(id, &name_of_id); + id = rtems_build_id( api, cls, 1, idx ); + sc = rtems_object_get_classic_name( id, &name_of_id ); - if (sc == RTEMS_SUCCESSFUL) { - if (name_of_id == rtems_build_name('U', 'I', '1', ' ')) { - rtems_test_assert(id == rtems_task_self()); - rtems_test_assert(!found[0]); - found[0] = true; + if ( sc == RTEMS_SUCCESSFUL ) { + if ( name_of_id == rtems_build_name( 'U', 'I', '1', ' ' ) ) { + rtems_test_assert( id == rtems_task_self() ); + rtems_test_assert( !found[ 0 ] ); + found[ 0 ] = true; } else { - rtems_test_assert(name_of_id == rtems_build_name('I', 'D', 'L', 'E')); - rtems_test_assert(!found[1]); - found[1] = true; + rtems_test_assert( + name_of_id == rtems_build_name( 'I', 'D', 'L', 'E' ) + ); + rtems_test_assert( !found[ 1 ] ); + found[ 1 ] = true; } } else { - rtems_test_assert(sc == RTEMS_INVALID_ID); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } } -static void test_some_id_to_name(void) +static void test_some_id_to_name( void ) { rtems_id api; - bool found[2]; + bool found[ 2 ]; - found[0] = false; - found[1] = false; + found[ 0 ] = false; + found[ 1 ] = false; - for (api = 0; api < 8; ++api) { + for ( api = 0; api < 8; ++api ) { rtems_id cls; - for (cls = 0; cls < 32; ++cls) { - test_id_to_name(api, cls, 0, found); - test_id_to_name(api, cls, 1, found); - test_id_to_name(api, cls, 2, found); - test_id_to_name(api, cls, 65534, found); - test_id_to_name(api, cls, 65535, found); + for ( cls = 0; cls < 32; ++cls ) { + test_id_to_name( api, cls, 0, found ); + test_id_to_name( api, cls, 1, found ); + test_id_to_name( api, cls, 2, found ); + test_id_to_name( api, cls, 65534, found ); + test_id_to_name( api, cls, 65535, found ); } } - rtems_test_assert(found[0]); - rtems_test_assert(found[1]); + rtems_test_assert( found[ 0 ] ); + rtems_test_assert( found[ 1 ] ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -434,12 +439,12 @@ static void Init(rtems_task_argument arg) test_user_extensions_delete(); test_some_id_to_name(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } -static void before_object_information_initialization(void) +static void before_object_information_initialization( void ) { - rtems_print_printer_printk(&rtems_test_printer); + rtems_print_printer_printk( &rtems_test_printer ); TEST_BEGIN(); test_barrier_get(); test_message_queue_get(); diff --git a/testsuites/sptests/spconsole01/init.c b/testsuites/sptests/spconsole01/init.c index a610babf91..494c4e884d 100644 --- a/testsuites/sptests/spconsole01/init.c +++ b/testsuites/sptests/spconsole01/init.c @@ -27,18 +27,18 @@ const char rtems_test_name[] = "SPCONSOLE 1"; #define LINE_LEN 79 -static const char n_line[LINE_LEN + 1] = -"nNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNn"; +static const char n_line[ LINE_LEN + 1 ] = + "nNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNn"; -static const char b_line[LINE_LEN + 1] = -"bBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBb"; +static const char b_line[ LINE_LEN + 1 ] = + "bBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBb"; -static const char e_line[LINE_LEN + 1] = -"eEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEe"; +static const char e_line[ LINE_LEN + 1 ] = + "eEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEeEe"; typedef struct { - speed_t speed; - uint32_t value; + speed_t speed; + uint32_t value; const char *msg; } speed_desc; @@ -53,260 +53,260 @@ static const speed_desc speeds[] = { #define BITS_PER_CHAR 10 typedef struct { - int fd; + int fd; struct termios saved_term; struct termios term; - char buf[9600 / BITS_PER_CHAR]; - rtems_id done; + char buf[ 9600 / BITS_PER_CHAR ]; + rtems_id done; } test_context; static test_context test_instance; -static void drain(test_context *ctx) +static void drain( test_context *ctx ) { int rv; - rv = tcdrain(ctx->fd); - rtems_test_assert(rv == 0); + rv = tcdrain( ctx->fd ); + rtems_test_assert( rv == 0 ); /* Ensure that a hardware transmit FIFO of reasonable size is empty */ - rv = usleep(200000); - rtems_test_assert(rv == 0); + rv = usleep( 200000 ); + rtems_test_assert( rv == 0 ); } -static void do_begin(test_context *ctx, const char *msg) +static void do_begin( test_context *ctx, const char *msg ) { - puts(n_line); - puts(msg); - puts(b_line); - drain(ctx); + puts( n_line ); + puts( msg ); + puts( b_line ); + drain( ctx ); } -static void do_end(test_context *ctx) +static void do_end( test_context *ctx ) { int rv; - drain(ctx); + drain( ctx ); - rv = cfsetspeed(&ctx->term, cfgetospeed(&ctx->saved_term)); - rtems_test_assert(rv == 0); + rv = cfsetspeed( &ctx->term, cfgetospeed( &ctx->saved_term ) ); + rtems_test_assert( rv == 0 ); - rv = tcsetattr(ctx->fd, TCSANOW, &ctx->term); - rtems_test_assert(rv == 0); + rv = tcsetattr( ctx->fd, TCSANOW, &ctx->term ); + rtems_test_assert( rv == 0 ); - puts(""); - puts(e_line); + puts( "" ); + puts( e_line ); } -static void test_steps_one_task(test_context *ctx, char c) +static void test_steps_one_task( test_context *ctx, char c ) { - char buf[128]; + char buf[ 128 ]; size_t i; - for (i = 0; i < RTEMS_ARRAY_SIZE(buf); ++i) { + for ( i = 0; i < RTEMS_ARRAY_SIZE( buf ); ++i ) { size_t r; - char *p; + char *p; - buf[i] = '\n'; + buf[ i ] = '\n'; r = i; p = buf; - while (r > 0) { + while ( r > 0 ) { ssize_t m; - m = write(ctx->fd, p, r); - rtems_test_assert(m > 0); + m = write( ctx->fd, p, r ); + rtems_test_assert( m > 0 ); r -= (size_t) m; p += (size_t) m; } - if (i > 1) { - buf[i - 2] = c; + if ( i > 1 ) { + buf[ i - 2 ] = c; } - if (i > 0) { - buf[i - 1] = '\r'; + if ( i > 0 ) { + buf[ i - 1 ] = '\r'; } } } -static void test_speeds(test_context *ctx) +static void test_speeds( test_context *ctx ) { size_t i; - for (i = 0; i < RTEMS_ARRAY_SIZE(speeds); ++i) { + for ( i = 0; i < RTEMS_ARRAY_SIZE( speeds ); ++i ) { uint64_t t0; uint64_t t1; - size_t n; - size_t r; - int rv; + size_t n; + size_t r; + int rv; - do_begin(ctx, speeds[i].msg); + do_begin( ctx, speeds[ i ].msg ); - rv = cfsetspeed(&ctx->term, speeds[i].speed); - rtems_test_assert(rv == 0); + rv = cfsetspeed( &ctx->term, speeds[ i ].speed ); + rtems_test_assert( rv == 0 ); - rv = tcsetattr(ctx->fd, TCSANOW, &ctx->term); - rtems_test_assert(rv == 0); + rv = tcsetattr( ctx->fd, TCSANOW, &ctx->term ); + rtems_test_assert( rv == 0 ); - n = speeds[i].value / BITS_PER_CHAR; + n = speeds[ i ].value / BITS_PER_CHAR; r = n; t0 = rtems_clock_get_uptime_nanoseconds(); - while (r > 0) { + while ( r > 0 ) { ssize_t m; - m = write(ctx->fd, ctx->buf, MIN(sizeof(ctx->buf), r)); - rtems_test_assert(m > 0); + m = write( ctx->fd, ctx->buf, MIN( sizeof( ctx->buf ), r ) ); + rtems_test_assert( m > 0 ); r -= (size_t) m; } - rv = tcdrain(ctx->fd); - rtems_test_assert(rv == 0); + rv = tcdrain( ctx->fd ); + rtems_test_assert( rv == 0 ); t1 = rtems_clock_get_uptime_nanoseconds(); - do_end(ctx); + do_end( ctx ); - printf("transmitted chars: %zu\n", n); + printf( "transmitted chars: %zu\n", n ); printf( "transmitted bits (1 start, 8 data, 1 stop): %zu\n", n * BITS_PER_CHAR ); - printf("actual transmit time: %10" PRIu64 "ns\n", t1 - t0); - printf("expected transmit time: 1000000000ns\n"); + printf( "actual transmit time: %10" PRIu64 "ns\n", t1 - t0 ); + printf( "expected transmit time: 1000000000ns\n" ); } } -static void task(test_context *ctx, char c) +static void task( test_context *ctx, char c ) { rtems_status_code sc; - test_steps_one_task(ctx, c); + test_steps_one_task( ctx, c ); - sc = rtems_semaphore_release(ctx->done); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->done ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_task_suspend(RTEMS_SELF); + rtems_task_suspend( RTEMS_SELF ); } -static void task_y(rtems_task_argument arg) +static void task_y( rtems_task_argument arg ) { test_context *ctx; ctx = (test_context *) arg; - task(ctx, 'Y'); + task( ctx, 'Y' ); } -static void task_z(rtems_task_argument arg) +static void task_z( rtems_task_argument arg ) { test_context *ctx; ctx = (test_context *) arg; - task(ctx, 'z'); + task( ctx, 'z' ); } -static void test(test_context *ctx) +static void test( test_context *ctx ) { - int rv; + int rv; rtems_status_code sc; - rtems_id y; - rtems_id z; + rtems_id y; + rtems_id z; sc = rtems_semaphore_create( - rtems_build_name('D', 'O', 'N', 'E'), + rtems_build_name( 'D', 'O', 'N', 'E' ), 0, RTEMS_COUNTING_SEMAPHORE, 0, &ctx->done ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - ctx->fd = open(CONSOLE_DEVICE_NAME, O_RDWR); - rtems_test_assert(ctx->fd >= 0); + ctx->fd = open( CONSOLE_DEVICE_NAME, O_RDWR ); + rtems_test_assert( ctx->fd >= 0 ); - rv = tcgetattr(ctx->fd, &ctx->saved_term); - rtems_test_assert(rv == 0); + rv = tcgetattr( ctx->fd, &ctx->saved_term ); + rtems_test_assert( rv == 0 ); ctx->term = ctx->saved_term; - cfmakeraw(&ctx->term); + cfmakeraw( &ctx->term ); - rv = tcsetattr(ctx->fd, TCSANOW, &ctx->term); - rtems_test_assert(rv == 0); + rv = tcsetattr( ctx->fd, TCSANOW, &ctx->term ); + rtems_test_assert( rv == 0 ); - memset(&ctx->buf, 'd', sizeof(ctx->buf)); + memset( &ctx->buf, 'd', sizeof( ctx->buf ) ); - do_begin(ctx, "steps one task"); - test_steps_one_task(ctx, 'x'); - do_end(ctx); + do_begin( ctx, "steps one task" ); + test_steps_one_task( ctx, 'x' ); + do_end( ctx ); - do_begin(ctx, "steps three tasks"); + do_begin( ctx, "steps three tasks" ); sc = rtems_task_create( - rtems_build_name(' ', ' ', ' ', 'Y'), + rtems_build_name( ' ', ' ', ' ', 'Y' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &y ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(y, task_y, (rtems_task_argument) ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( y, task_y, (rtems_task_argument) ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name(' ', ' ', ' ', 'Z'), + rtems_build_name( ' ', ' ', ' ', 'Z' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &z ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(z, task_z, (rtems_task_argument) ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( z, task_z, (rtems_task_argument) ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - test_steps_one_task(ctx, 'x'); + test_steps_one_task( ctx, 'x' ); - sc = rtems_semaphore_obtain(ctx->done, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->done, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_obtain(ctx->done, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->done, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - do_end(ctx); + do_end( ctx ); - test_speeds(ctx); + test_speeds( ctx ); - rv = close(ctx->fd); - rtems_test_assert(rv == 0); + rv = close( ctx->fd ); + rtems_test_assert( rv == 0 ); - sc = rtems_task_delete(y); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( y ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(z); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( z ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_delete(ctx->done); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( ctx->done ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; TEST_BEGIN(); - rtems_print_printer_fprintf_putc(&rtems_test_printer); - test(&test_instance); + rtems_print_printer_fprintf_putc( &rtems_test_printer ); + test( &test_instance ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER @@ -314,13 +314,13 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 4 -#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_TASKS 3 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spcontext01/init.c b/testsuites/sptests/spcontext01/init.c index 5ca397e6c9..06d0256f24 100644 --- a/testsuites/sptests/spcontext01/init.c +++ b/testsuites/sptests/spcontext01/init.c @@ -45,67 +45,67 @@ const char rtems_test_name[] = "SPCONTEXT 1"; typedef struct { rtems_id control_task; - rtems_id validate_tasks[3]; + rtems_id validate_tasks[ 3 ]; rtems_id timer; - size_t task_index; - int iteration_counter; + size_t task_index; + int iteration_counter; } test_context; static test_context test_instance; -static void validate_task(rtems_task_argument arg) +static void validate_task( rtems_task_argument arg ) { - _CPU_Context_validate(arg); - rtems_test_assert(0); + _CPU_Context_validate( arg ); + rtems_test_assert( 0 ); } static void start_validate_task( - rtems_id *id, - uintptr_t pattern, + rtems_id *id, + uintptr_t pattern, rtems_task_priority priority, - bool fp_unit + bool fp_unit ) { rtems_status_code sc; - rtems_attribute fpu_state; + rtems_attribute fpu_state; fpu_state = fp_unit ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES; sc = rtems_task_create( - rtems_build_name('V', 'A', 'L', 'I'), + rtems_build_name( 'V', 'A', 'L', 'I' ), priority, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, fpu_state, id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(*id, validate_task, pattern); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( *id, validate_task, pattern ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void reset_timer_or_finish(test_context *self, rtems_id timer) +static void reset_timer_or_finish( test_context *self, rtems_id timer ) { rtems_status_code sc; - int i = self->iteration_counter; + int i = self->iteration_counter; - if (i < ITERATION_COUNT) { + if ( i < ITERATION_COUNT ) { self->iteration_counter = i + 1; - sc = rtems_timer_reset(timer); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_reset( timer ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } else { - sc = rtems_event_send(self->control_task, FINISH_EVENT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( self->control_task, FINISH_EVENT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } } -static void switch_priorities(test_context *self) +static void switch_priorities( test_context *self ) { rtems_status_code sc; - size_t index = self->task_index; - size_t next = (index + 1) % RTEMS_ARRAY_SIZE(self->validate_tasks); + size_t index = self->task_index; + size_t next = ( index + 1 ) % RTEMS_ARRAY_SIZE( self->validate_tasks ); size_t task_current_high = index; size_t task_next_high = next; rtems_task_priority priority; @@ -113,48 +113,56 @@ static void switch_priorities(test_context *self) self->task_index = next; sc = rtems_task_set_priority( - self->validate_tasks[task_next_high], + self->validate_tasks[ task_next_high ], PRIORITY_HIGH, &priority ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_set_priority( - self->validate_tasks[task_current_high], + self->validate_tasks[ task_current_high ], PRIORITY_LOW, &priority ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void clobber_and_switch_timer(rtems_id timer, void *arg) +static void clobber_and_switch_timer( rtems_id timer, void *arg ) { (void) timer; - uintptr_t pattern = (uintptr_t) 0xffffffffffffffffU; + uintptr_t pattern = (uintptr_t) 0xffffffffffffffffU; test_context *self = arg; - reset_timer_or_finish(self, self->timer); - switch_priorities(self); + reset_timer_or_finish( self, self->timer ); + switch_priorities( self ); - _CPU_Context_volatile_clobber(pattern); + _CPU_Context_volatile_clobber( pattern ); } -static void start_timer(test_context *self) +static void start_timer( test_context *self ) { rtems_status_code sc; - sc = rtems_timer_create(rtems_build_name('C', 'L', 'S', 'W'), &self->timer); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_create( + rtems_build_name( 'C', 'L', 'S', 'W' ), + &self->timer + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_fire_after(self->timer, 2, clobber_and_switch_timer, self); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_fire_after( + self->timer, + 2, + clobber_and_switch_timer, + self + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void wait_for_finish(void) +static void wait_for_finish( void ) { rtems_status_code sc; - rtems_event_set out; + rtems_event_set out; sc = rtems_event_receive( FINISH_EVENT, @@ -162,145 +170,150 @@ static void wait_for_finish(void) RTEMS_NO_TIMEOUT, &out ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == FINISH_EVENT); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == FINISH_EVENT ); } static void test( test_context *self, - bool task_0_fpu, - bool task_1_fpu, - bool task_2_fpu + bool task_0_fpu, + bool task_1_fpu, + bool task_2_fpu ) { rtems_status_code sc; - uintptr_t pattern_0 = (uintptr_t) 0xaaaaaaaaaaaaaaaaU; - uintptr_t pattern_1 = (uintptr_t) 0x5555555555555555U; - uintptr_t pattern_2 = (uintptr_t) 0x0000000000000000U; + uintptr_t pattern_0 = (uintptr_t) 0xaaaaaaaaaaaaaaaaU; + uintptr_t pattern_1 = (uintptr_t) 0x5555555555555555U; + uintptr_t pattern_2 = (uintptr_t) 0x0000000000000000U; - memset(self, 0, sizeof(*self)); + memset( self, 0, sizeof( *self ) ); self->control_task = rtems_task_self(); start_validate_task( - &self->validate_tasks[0], + &self->validate_tasks[ 0 ], pattern_0, PRIORITY_HIGH, task_0_fpu ); start_validate_task( - &self->validate_tasks[1], + &self->validate_tasks[ 1 ], pattern_1, PRIORITY_LOW, task_1_fpu ); start_validate_task( - &self->validate_tasks[2], + &self->validate_tasks[ 2 ], pattern_2, PRIORITY_LOW, task_2_fpu ); - start_timer(self); + start_timer( self ); wait_for_finish(); - sc = rtems_task_delete(self->validate_tasks[0]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( self->validate_tasks[ 0 ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(self->validate_tasks[1]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( self->validate_tasks[ 1 ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(self->validate_tasks[2]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( self->validate_tasks[ 2 ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_delete(self->timer); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_delete( self->timer ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_context_is_executing(void) +static void test_context_is_executing( void ) { -#if defined(RTEMS_SMP) +#if defined( RTEMS_SMP ) /* * Provide a stack area, since on some architectures the top/bottom of stack * is initialized by _CPU_Context_Initialize(). */ - static char stack[1024]; + static char stack[ 1024 ]; Context_Control context; - bool is_executing; + bool is_executing; - memset(&context, 0, sizeof(context)); + memset( &context, 0, sizeof( context ) ); - is_executing = _CPU_Context_Get_is_executing(&context); - rtems_test_assert(!is_executing); + is_executing = _CPU_Context_Get_is_executing( &context ); + rtems_test_assert( !is_executing ); - _CPU_Context_Set_is_executing(&context, true); - is_executing = _CPU_Context_Get_is_executing(&context); - rtems_test_assert(is_executing); + _CPU_Context_Set_is_executing( &context, true ); + is_executing = _CPU_Context_Get_is_executing( &context ); + rtems_test_assert( is_executing ); - _CPU_Context_Set_is_executing(&context, false); - is_executing = _CPU_Context_Get_is_executing(&context); - rtems_test_assert(!is_executing); + _CPU_Context_Set_is_executing( &context, false ); + is_executing = _CPU_Context_Get_is_executing( &context ); + rtems_test_assert( !is_executing ); - _CPU_Context_Set_is_executing(&context, true); + _CPU_Context_Set_is_executing( &context, true ); _CPU_Context_Initialize( &context, - (void *) &stack[0], - sizeof(stack), + (void *) &stack[ 0 ], + sizeof( stack ), 0, NULL, false, NULL ); - is_executing = _CPU_Context_Get_is_executing(&context); - rtems_test_assert(is_executing); + is_executing = _CPU_Context_Get_is_executing( &context ); + rtems_test_assert( is_executing ); #endif } -static bool is_fp(int i) +static bool is_fp( int i ) { return i != 0; } -static const char *desc(int i) +static const char *desc( int i ) { - return is_fp(i) ? "F" : "N"; + return is_fp( i ) ? "F" : "N"; } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; test_context *self = &test_instance; - int i; - int j; - int k; + int i; + int j; + int k; TEST_BEGIN(); test_context_is_executing(); - for (i = 0; i < 2; ++i) { - for (j = 0; j < 2; ++j) { - for (k = 0; k < 2; ++k) { - printf("Test configuration %s %s %s... ", desc(i), desc(j), desc(k)); - test(self, is_fp(i), is_fp(j), is_fp(k)); - printf("done\n"); + for ( i = 0; i < 2; ++i ) { + for ( j = 0; j < 2; ++j ) { + for ( k = 0; k < 2; ++k ) { + printf( + "Test configuration %s %s %s... ", + desc( i ), + desc( j ), + desc( k ) + ); + test( self, is_fp( i ), is_fp( j ), is_fp( k ) ); + printf( "done\n" ); } } } TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } -static void switch_extension(Thread_Control *executing, Thread_Control *heir) +static void switch_extension( Thread_Control *executing, Thread_Control *heir ) { (void) executing; (void) heir; uintptr_t pattern = (uintptr_t) 0xffffffffffffffffU; - _CPU_Context_volatile_clobber(pattern); + _CPU_Context_volatile_clobber( pattern ); } #define CONFIGURE_MICROSECONDS_PER_TICK 1000 @@ -308,12 +321,11 @@ static void switch_extension(Thread_Control *executing, Thread_Control *heir) #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_MAXIMUM_TIMERS 1 #define CONFIGURE_INITIAL_EXTENSIONS \ - { .thread_switch = switch_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .thread_switch = switch_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spcpucounter01/init.c b/testsuites/sptests/spcpucounter01/init.c index 3e29ba9ba0..c6c7abec40 100644 --- a/testsuites/sptests/spcpucounter01/init.c +++ b/testsuites/sptests/spcpucounter01/init.c @@ -44,98 +44,100 @@ const char rtems_test_name[] = "SPCPUCOUNTER 1"; #define N 10 typedef struct { - rtems_counter_ticks delay_ns_t[N][2]; - rtems_counter_ticks delay_ticks_t[N][2]; - rtems_counter_ticks overhead_t[N][5]; + rtems_counter_ticks delay_ns_t[ N ][ 2 ]; + rtems_counter_ticks delay_ticks_t[ N ][ 2 ]; + rtems_counter_ticks overhead_t[ N ][ 5 ]; rtems_counter_ticks overhead_delta; } test_context; static test_context test_instance; -static rtems_interval sync_with_clock_tick(void) +static rtems_interval sync_with_clock_tick( void ) { rtems_interval start = rtems_clock_get_ticks_since_boot(); rtems_interval current; do { current = rtems_clock_get_ticks_since_boot(); - } while (current == start); + } while ( current == start ); return current; } -static void test_converter(void) +static void test_converter( void ) { CPU_Counter_ticks frequency; CPU_Counter_ticks frequency2; - uint64_t ns; - int64_t sbt; + uint64_t ns; + int64_t sbt; - frequency = rtems_counter_nanoseconds_to_ticks(1000000000); - ns = rtems_counter_ticks_to_nanoseconds(frequency); + frequency = rtems_counter_nanoseconds_to_ticks( 1000000000 ); + ns = rtems_counter_ticks_to_nanoseconds( frequency ); - printf("CPU counter frequency: %" PRIu32 "Hz\n", frequency); - printf("nanoseconds for frequency count ticks: %" PRIu64 "\n", ns); + printf( "CPU counter frequency: %" PRIu32 "Hz\n", frequency ); + printf( "nanoseconds for frequency count ticks: %" PRIu64 "\n", ns ); - rtems_test_assert(ns == 1000000000); + rtems_test_assert( ns == 1000000000 ); - sbt = rtems_counter_ticks_to_sbintime(frequency); - rtems_test_assert(sbt == (INT64_C(1) << 32)); + sbt = rtems_counter_ticks_to_sbintime( frequency ); + rtems_test_assert( sbt == ( INT64_C( 1 ) << 32 ) ); - frequency2 = rtems_counter_sbintime_to_ticks(sbt); - rtems_test_assert(frequency == frequency2); + frequency2 = rtems_counter_sbintime_to_ticks( sbt ); + rtems_test_assert( frequency == frequency2 ); } -static void test_delay_nanoseconds(test_context *ctx) +static void test_delay_nanoseconds( test_context *ctx ) { int i; - for (i = 0; i < N; ++i) { + for ( i = 0; i < N; ++i ) { rtems_counter_ticks t0; rtems_counter_ticks t1; - rtems_interval tick; + rtems_interval tick; tick = sync_with_clock_tick(); t0 = rtems_counter_read(); - rtems_counter_delay_nanoseconds(NS_PER_TICK); + rtems_counter_delay_nanoseconds( NS_PER_TICK ); t1 = rtems_counter_read(); - ctx->delay_ns_t[i][0] = t0; - ctx->delay_ns_t[i][1] = t1; + ctx->delay_ns_t[ i ][ 0 ] = t0; + ctx->delay_ns_t[ i ][ 1 ] = t1; - rtems_test_assert(tick < rtems_clock_get_ticks_since_boot()); + rtems_test_assert( tick < rtems_clock_get_ticks_since_boot() ); } } -static void test_delay_ticks(test_context *ctx) +static void test_delay_ticks( test_context *ctx ) { - rtems_counter_ticks ticks = rtems_counter_nanoseconds_to_ticks(NS_PER_TICK); + rtems_counter_ticks ticks = rtems_counter_nanoseconds_to_ticks( + NS_PER_TICK + ); int i; - for (i = 0; i < N; ++i) { + for ( i = 0; i < N; ++i ) { rtems_counter_ticks t0; rtems_counter_ticks t1; - rtems_interval tick; + rtems_interval tick; tick = sync_with_clock_tick(); t0 = rtems_counter_read(); - rtems_counter_delay_ticks(ticks); + rtems_counter_delay_ticks( ticks ); t1 = rtems_counter_read(); - ctx->delay_ticks_t[i][0] = t0; - ctx->delay_ticks_t[i][1] = t1; + ctx->delay_ticks_t[ i ][ 0 ] = t0; + ctx->delay_ticks_t[ i ][ 1 ] = t1; - rtems_test_assert(tick < rtems_clock_get_ticks_since_boot()); + rtems_test_assert( tick < rtems_clock_get_ticks_since_boot() ); } } -static void test_overheads(test_context *ctx) +static void test_overheads( test_context *ctx ) { int i; - for (i = 0; i < N; ++i) { + for ( i = 0; i < N; ++i ) { rtems_counter_ticks t0; rtems_counter_ticks t1; rtems_counter_ticks t2; @@ -145,33 +147,33 @@ static void test_overheads(test_context *ctx) t0 = rtems_counter_read(); t1 = rtems_counter_read(); - d = rtems_counter_difference(t1, t0); + d = rtems_counter_difference( t1, t0 ); t2 = rtems_counter_read(); - rtems_counter_delay_nanoseconds(0); + rtems_counter_delay_nanoseconds( 0 ); t3 = rtems_counter_read(); - rtems_counter_delay_ticks(0); + rtems_counter_delay_ticks( 0 ); t4 = rtems_counter_read(); - ctx->overhead_t[i][0] = t0; - ctx->overhead_t[i][1] = t1; - ctx->overhead_t[i][2] = t2; - ctx->overhead_t[i][3] = t3; - ctx->overhead_t[i][4] = t4; + ctx->overhead_t[ i ][ 0 ] = t0; + ctx->overhead_t[ i ][ 1 ] = t1; + ctx->overhead_t[ i ][ 2 ] = t2; + ctx->overhead_t[ i ][ 3 ] = t3; + ctx->overhead_t[ i ][ 4 ] = t4; ctx->overhead_delta = d; } } static void report_overhead( - const char *name, + const char *name, rtems_counter_ticks t1, rtems_counter_ticks t0 ) { rtems_counter_ticks d; - uint64_t ns; + uint64_t ns; - d = rtems_counter_difference(t1, t0); - ns = rtems_counter_ticks_to_nanoseconds(d); + d = rtems_counter_difference( t1, t0 ); + ns = rtems_counter_ticks_to_nanoseconds( d ); printf( "overhead %s: %" PRIu64 " ticks, %" PRIu64 "ns\n", @@ -181,14 +183,14 @@ static void report_overhead( ); } -static uint64_t large_delta_to_ns(rtems_counter_ticks d) +static uint64_t large_delta_to_ns( rtems_counter_ticks d ) { uint64_t ns; - ns = rtems_counter_ticks_to_nanoseconds(d); + ns = rtems_counter_ticks_to_nanoseconds( d ); /* Special case for CPU counters using the clock driver counter */ - if (ns < rtems_configuration_get_nanoseconds_per_tick()) { + if ( ns < rtems_configuration_get_nanoseconds_per_tick() ) { printf( "warning: the RTEMS counter seems to be unable to\n" " measure intervals greater than the clock tick interval\n" @@ -200,78 +202,97 @@ static uint64_t large_delta_to_ns(rtems_counter_ticks d) return ns; } -static void test_report(test_context *ctx) +static void test_report( test_context *ctx ) { - double ns_per_tick = NS_PER_TICK; + double ns_per_tick = NS_PER_TICK; rtems_counter_ticks d; - uint64_t ns; - size_t i; + uint64_t ns; + size_t i; - printf("test delay nanoseconds (%i times)\n", N); + printf( "test delay nanoseconds (%i times)\n", N ); - for (i = 0; i < N; ++i) { - d = rtems_counter_difference(ctx->delay_ns_t[i][1], ctx->delay_ns_t[i][0]); - ns = large_delta_to_ns(d); + for ( i = 0; i < N; ++i ) { + d = rtems_counter_difference( + ctx->delay_ns_t[ i ][ 1 ], + ctx->delay_ns_t[ i ][ 0 ] + ); + ns = large_delta_to_ns( d ); printf( "ns busy wait duration: %" PRIu64 "ns\n" "ns busy wait relative to clock tick: %f\n", ns, - (ns - ns_per_tick) / ns_per_tick + ( ns - ns_per_tick ) / ns_per_tick ); } - printf("test delay ticks (%i times)\n", N); + printf( "test delay ticks (%i times)\n", N ); - for (i = 0; i < N; ++i) { + for ( i = 0; i < N; ++i ) { d = rtems_counter_difference( - ctx->delay_ticks_t[i][1], - ctx->delay_ticks_t[i][0] + ctx->delay_ticks_t[ i ][ 1 ], + ctx->delay_ticks_t[ i ][ 0 ] ); - ns = large_delta_to_ns(d); + ns = large_delta_to_ns( d ); printf( "ticks busy wait duration: %" PRIu64 "ns\n" "ticks busy wait relative to clock tick: %f\n", ns, - (ns - ns_per_tick) / ns_per_tick + ( ns - ns_per_tick ) / ns_per_tick ); } - printf("test overheads (%i times)\n", N); + printf( "test overheads (%i times)\n", N ); - for (i = 0; i < N; ++i) { - report_overhead("read", ctx->overhead_t[i][1], ctx->overhead_t[i][0]); - report_overhead("difference", ctx->overhead_t[i][2], ctx->overhead_t[i][1]); - report_overhead("delay ns", ctx->overhead_t[i][3], ctx->overhead_t[i][2]); - report_overhead("delay ticks", ctx->overhead_t[i][4], ctx->overhead_t[i][3]); + for ( i = 0; i < N; ++i ) { + report_overhead( + "read", + ctx->overhead_t[ i ][ 1 ], + ctx->overhead_t[ i ][ 0 ] + ); + report_overhead( + "difference", + ctx->overhead_t[ i ][ 2 ], + ctx->overhead_t[ i ][ 1 ] + ); + report_overhead( + "delay ns", + ctx->overhead_t[ i ][ 3 ], + ctx->overhead_t[ i ][ 2 ] + ); + report_overhead( + "delay ticks", + ctx->overhead_t[ i ][ 4 ], + ctx->overhead_t[ i ][ 3 ] + ); } } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; test_context *ctx = &test_instance; - rtems_print_printer_fprintf_putc(&rtems_test_printer); + rtems_print_printer_fprintf_putc( &rtems_test_printer ); TEST_BEGIN(); - test_delay_nanoseconds(ctx); - test_delay_ticks(ctx); - test_overheads(ctx); + test_delay_nanoseconds( ctx ); + test_delay_ticks( ctx ); + test_overheads( ctx ); test_converter(); - test_report(ctx); + test_report( ctx ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MICROSECONDS_PER_TICK (NS_PER_TICK / 1000) +#define CONFIGURE_MICROSECONDS_PER_TICK ( NS_PER_TICK / 1000 ) #define CONFIGURE_MAXIMUM_TASKS 1 diff --git a/testsuites/sptests/spcpuset01/init.c b/testsuites/sptests/spcpuset01/init.c index 9e25e7f2d0..87e06008da 100644 --- a/testsuites/sptests/spcpuset01/init.c +++ b/testsuites/sptests/spcpuset01/init.c @@ -50,7 +50,7 @@ const char rtems_test_name[] = "SPCPUSET 1"; -static void test_cpu_zero_case_1(void) +static void test_cpu_zero_case_1( void ) { size_t i; @@ -58,17 +58,16 @@ static void test_cpu_zero_case_1(void) * Set to all zeros and verify */ puts( "Exercise CPU_ZERO, CPU_ISSET, and CPU_COUNT" ); - CPU_ZERO(&set3); + CPU_ZERO( &set3 ); /* test if all bits clear */ - for (i=0 ; i - /* * Keep the names and IDs in global variables so another task can use them. */ - /* * Handy macros and static inline functions */ diff --git a/testsuites/sptests/spcpuset01/test.c b/testsuites/sptests/spcpuset01/test.c index 371bfbd227..1112f83d70 100644 --- a/testsuites/sptests/spcpuset01/test.c +++ b/testsuites/sptests/spcpuset01/test.c @@ -46,11 +46,11 @@ #include #include "system.h" -void test_cpu_and_case_1(size_t cpu1, size_t cpu2); -void test_cpu_nand_case_1(size_t cpu1, size_t cpu2); -void test_cpu_or_case_1(size_t cpu1, size_t cpu2); -void test_cpu_xor_case_1(size_t cpu1, size_t cpu2); -static void test_logic01_setup(size_t cpu1, size_t cpu2); +void test_cpu_and_case_1( size_t cpu1, size_t cpu2 ); +void test_cpu_nand_case_1( size_t cpu1, size_t cpu2 ); +void test_cpu_or_case_1( size_t cpu1, size_t cpu2 ); +void test_cpu_xor_case_1( size_t cpu1, size_t cpu2 ); +static void test_logic01_setup( size_t cpu1, size_t cpu2 ); /* * Make these global so they can always be referenced. Optimization tends @@ -60,8 +60,7 @@ cpu_set_t set1; cpu_set_t set2; cpu_set_t set3; - -void test_cpu_and_case_1(size_t cpu1, size_t cpu2) +void test_cpu_and_case_1( size_t cpu1, size_t cpu2 ) { (void) cpu1; (void) cpu2; @@ -70,19 +69,19 @@ void test_cpu_and_case_1(size_t cpu1, size_t cpu2) /* AND set1 and set2 */ DPRINT( "Exercise CPU_AND with bits %zd,%zd\n", cpu1, cpu2 ); - CPU_AND(&set3, &set1, &set2); + CPU_AND( &set3, &set1, &set2 ); /* test if all bits clear except cpu1 */ - for (i=0 ; i /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/spedfsched01/task1.c b/testsuites/sptests/spedfsched01/task1.c index 76071f399d..01f4bd1a30 100644 --- a/testsuites/sptests/spedfsched01/task1.c +++ b/testsuites/sptests/spedfsched01/task1.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_1_through_3( - rtems_task_argument argument -) +rtems_task Task_1_through_3( rtems_task_argument argument ) { (void) argument; @@ -57,7 +55,7 @@ rtems_task Task_1_through_3( ticks = RTEMS_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); - while( FOREVER ) { + while ( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); diff --git a/testsuites/sptests/spedfsched02/getall.c b/testsuites/sptests/spedfsched02/getall.c index 9525db0c51..4ac8f0d6a7 100644 --- a/testsuites/sptests/spedfsched02/getall.c +++ b/testsuites/sptests/spedfsched02/getall.c @@ -60,9 +60,9 @@ void Get_all_counters() Count.count[ 6 ] = 0; status = rtems_task_mode( - RTEMS_PREEMPT, - RTEMS_PREEMPT_MASK, - &previous_mode + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode ); directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" ); } diff --git a/testsuites/sptests/spedfsched02/init.c b/testsuites/sptests/spedfsched02/init.c index 49d5d93750..40fcc38988 100644 --- a/testsuites/sptests/spedfsched02/init.c +++ b/testsuites/sptests/spedfsched02/init.c @@ -47,12 +47,12 @@ const char rtems_test_name[] = "SPEDFSCHED 2"; -rtems_task_priority Prio[7] = { 0, 2, 2, 2, 2, 100, 1 }; +rtems_task_priority Prio[ 7 ] = { 0, 2, 2, 2, 2, 100, 1 }; static void test_period_create_delete( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_rate_monotonic_create( rtems_build_name( 'R', 'T', 'M', 'N' ), @@ -64,13 +64,11 @@ static void test_period_create_delete( void ) rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - uint32_t index; + uint32_t index; rtems_status_code status; Priorities = Prio; @@ -79,14 +77,14 @@ rtems_task Init( test_period_create_delete(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); - Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); - for ( index = 1 ; index <= 6 ; index++ ) { + for ( index = 1; index <= 6; index++ ) { status = rtems_task_create( Task_name[ index ], Priorities[ index ], @@ -98,7 +96,7 @@ rtems_task Init( directive_failed( status, "rtems_task_create loop" ); } - for ( index = 1 ; index <= 6 ; index++ ) { + for ( index = 1; index <= 6; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_6, index ); directive_failed( status, "rtems_task_start loop" ); } diff --git a/testsuites/sptests/spedfsched02/system.h b/testsuites/sptests/spedfsched02/system.h index b4c49811d9..925422caa7 100644 --- a/testsuites/sptests/spedfsched02/system.h +++ b/testsuites/sptests/spedfsched02/system.h @@ -35,18 +35,14 @@ /* types */ struct counters { - uint32_t count[7]; + uint32_t count[ 7 ]; }; /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1_through_6( - rtems_task_argument argument -); +rtems_task Task_1_through_6( rtems_task_argument argument ); void Get_all_counters( void ); @@ -57,12 +53,12 @@ void Get_all_counters( void ); #define CONFIGURE_MICROSECONDS_PER_TICK 20000 -#define CONFIGURE_MAXIMUM_TASKS 7 -#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_TASKS 7 +#define CONFIGURE_MAXIMUM_PERIODS 10 -#define CONFIGURE_INIT_TASK_PRIORITY 10 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INIT_TASK_PRIORITY 10 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE @@ -72,11 +68,11 @@ void Get_all_counters( void ); /* global variables */ -TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */ -TEST_EXTERN struct counters Count; /* iteration counters */ -TEST_EXTERN struct counters Temporary_count; +TEST_EXTERN struct counters Count; /* iteration counters */ +TEST_EXTERN struct counters Temporary_count; TEST_EXTERN rtems_task_priority *Priorities; /* end of include file */ diff --git a/testsuites/sptests/spedfsched02/task1.c b/testsuites/sptests/spedfsched02/task1.c index 991279f08b..ed1462a7ae 100644 --- a/testsuites/sptests/spedfsched02/task1.c +++ b/testsuites/sptests/spedfsched02/task1.c @@ -45,15 +45,13 @@ /* runtime of TA6 should be shorter than TA5 */ -#define TA6_ITERATIONS 10 +#define TA6_ITERATIONS 10 #define TA6_PERIOD_FACTOR 10 -uint32_t Periods[7] = { 0, 2, 2, 2, 2, 100, 0 }; -uint32_t Iterations[7] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS }; +uint32_t Periods[ 7 ] = { 0, 2, 2, 2, 2, 100, 0 }; +uint32_t Iterations[ 7 ] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS }; -rtems_task Task_1_through_6( - rtems_task_argument argument -) +rtems_task Task_1_through_6( rtems_task_argument argument ) { rtems_id rmid; rtems_id test_rmid; @@ -65,24 +63,31 @@ rtems_task Task_1_through_6( status = rtems_rate_monotonic_create( argument, &rmid ); directive_failed( status, "rtems_rate_monotonic_create" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", - rmid ); + printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid ); status = rtems_rate_monotonic_ident( argument, &test_rmid ); directive_failed( status, "rtems_rate_monotonic_ident" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", - test_rmid ); + printf( + "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", + test_rmid + ); if ( rmid != test_rmid ) { - printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", - rmid, test_rmid ); - rtems_test_exit( 0 ); + printf( + "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", + rmid, + test_rmid + ); + rtems_test_exit( 0 ); } put_name( Task_name[ argument ], FALSE ); - printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", - rmid, Periods[ argument ] ); + printf( + "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", + rmid, + Periods[ argument ] + ); status = rtems_task_wake_after( 2 ); directive_failed( status, "rtems_task_wake_after" ); @@ -100,7 +105,7 @@ rtems_task Task_1_through_6( } break; case 5: - pass = 0; + pass = 0; failed = 0; status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); @@ -109,26 +114,27 @@ rtems_task Task_1_through_6( Get_all_counters(); while ( FOREVER ) { - status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" ); Get_all_counters(); - for( index = 1 ; index <= 4 ; index++ ) { + for ( index = 1; index <= 4; index++ ) { if ( Temporary_count.count[ index ] != Iterations[ index ] ) { puts_nocr( "FAIL -- " ); - put_name ( Task_name[ index ], FALSE ); - printf ( " Actual=%" PRIu32 ", Expected=%" PRIu32 "\n", - Temporary_count.count[ index ], - Iterations[ index ] - ); + put_name( Task_name[ index ], FALSE ); + printf( + " Actual=%" PRIu32 ", Expected=%" PRIu32 "\n", + Temporary_count.count[ index ], + Iterations[ index ] + ); failed += 1; } } - if ( failed == 5 ) + if ( failed == 5 ) { rtems_test_exit( 0 ); + } pass += 1; @@ -140,41 +146,45 @@ rtems_task Task_1_through_6( TEST_END(); rtems_test_exit( 0 ); } - } break; case 6: /* test changing periods */ { - uint32_t time[TA6_ITERATIONS+1]; + uint32_t time[ TA6_ITERATIONS + 1 ]; rtems_interval period; - period = 1*TA6_PERIOD_FACTOR; - status = rtems_rate_monotonic_period( rmid, period); + period = 1 * TA6_PERIOD_FACTOR; + status = rtems_rate_monotonic_period( rmid, period ); directive_failed( status, "rtems_rate_monotonic_period of TA6" ); - time[0] = _Watchdog_Ticks_since_boot; /* timestamp */ + time[ 0 ] = _Watchdog_Ticks_since_boot; /* timestamp */ /*printf("%d - %d\n", period, time[0]);*/ - for (index = 1; index <= TA6_ITERATIONS; index++) - { - period = (index+1)*TA6_PERIOD_FACTOR; - status = rtems_rate_monotonic_period( rmid, period); + for ( index = 1; index <= TA6_ITERATIONS; index++ ) { + period = ( index + 1 ) * TA6_PERIOD_FACTOR; + status = rtems_rate_monotonic_period( rmid, period ); directive_failed( status, "rtems_rate_monotonic_period of TA6" ); - time[index] = _Watchdog_Ticks_since_boot; /* timestamp */ + time[ index ] = _Watchdog_Ticks_since_boot; /* timestamp */ /*printf("%d - %d\n", period, time[index]);*/ } - for (index = 1; index <= TA6_ITERATIONS; index++) - { - rtems_interval meas = time[index] - time[index-1]; - period = index*TA6_PERIOD_FACTOR; - printf( "TA6 - Actual: %" PRIdrtems_interval " Expected: %" - PRIdrtems_interval, meas, period ); - if (period == meas) printf(" - OK\n"); - else printf(" - FAILED\n"); + for ( index = 1; index <= TA6_ITERATIONS; index++ ) { + rtems_interval meas = time[ index ] - time[ index - 1 ]; + period = index * TA6_PERIOD_FACTOR; + printf( + "TA6 - Actual: %" PRIdrtems_interval + " Expected: %" PRIdrtems_interval, + meas, + period + ); + if ( period == meas ) { + printf( " - OK\n" ); + } else { + printf( " - FAILED\n" ); + } } } - rtems_task_suspend(RTEMS_SELF); + rtems_task_suspend( RTEMS_SELF ); break; } } diff --git a/testsuites/sptests/spedfsched03/edfparams.h b/testsuites/sptests/spedfsched03/edfparams.h index 2c55d6e368..b4270a189b 100644 --- a/testsuites/sptests/spedfsched03/edfparams.h +++ b/testsuites/sptests/spedfsched03/edfparams.h @@ -39,21 +39,23 @@ #include "system.h" -rtems_task_priority Priorities[1+NUM_TASKS]= { 0, 30, 40, 50, 70, 254, 254 }; +rtems_task_priority Priorities[ 1 + NUM_TASKS ] = + { 0, 30, 40, 50, 70, 254, 254 }; -uint32_t Periods[1+NUM_PERIODIC_TASKS] = { 0, 30, 40, 50, 70 }; +uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ] = { 0, 30, 40, 50, 70 }; -uint32_t Execution[1+NUM_TASKS] = { 0, 10, 10, 10, 10, 100, 5 }; +uint32_t Execution[ 1 + NUM_TASKS ] = { 0, 10, 10, 10, 10, 100, 5 }; -uint32_t Phases[1+NUM_TASKS] = { 0, 0, 0, 0, 0, 7, 4 }; +uint32_t Phases[ 1 + NUM_TASKS ] = { 0, 0, 0, 0, 0, 7, 4 }; -#define build_task_name() do { \ -Task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' );\ -Task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' );\ -Task_name[ 3 ] = rtems_build_name( 'P', 'T', '3', ' ' );\ -Task_name[ 4 ] = rtems_build_name( 'P', 'T', '4', ' ' );\ -Task_name[ 5 ] = rtems_build_name( 'A', 'T', '5', ' ' );\ -Task_name[ 6 ] = rtems_build_name( 'A', 'T', '6', ' ' );\ -} while(0) +#define build_task_name() \ + do { \ + Task_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); \ + Task_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); \ + Task_name[ 3 ] = rtems_build_name( 'P', 'T', '3', ' ' ); \ + Task_name[ 4 ] = rtems_build_name( 'P', 'T', '4', ' ' ); \ + Task_name[ 5 ] = rtems_build_name( 'A', 'T', '5', ' ' ); \ + Task_name[ 6 ] = rtems_build_name( 'A', 'T', '6', ' ' ); \ + } while ( 0 ) #endif diff --git a/testsuites/sptests/spedfsched03/init.c b/testsuites/sptests/spedfsched03/init.c index 214da7c059..87fa790f93 100644 --- a/testsuites/sptests/spedfsched03/init.c +++ b/testsuites/sptests/spedfsched03/init.c @@ -36,20 +36,18 @@ const char rtems_test_name[] = "SPEDFSCHED 3"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - uint32_t index; + uint32_t index; rtems_status_code status; TEST_BEGIN(); build_task_name(); - for ( index = 1 ; index <= NUM_TASKS ; index++ ) { + for ( index = 1; index <= NUM_TASKS; index++ ) { status = rtems_task_create( Task_name[ index ], Priorities[ index ], @@ -61,12 +59,12 @@ rtems_task Init( directive_failed( status, "rtems_task_create loop" ); } - for ( index = 1 ; index <= NUM_PERIODIC_TASKS ; index++ ) { + for ( index = 1; index <= NUM_PERIODIC_TASKS; index++ ) { status = rtems_task_start( Task_id[ index ], Tasks_Periodic, index ); directive_failed( status, "rtems_task_start loop" ); } - for ( index = NUM_PERIODIC_TASKS+1 ; index <= NUM_TASKS ; index++ ) { + for ( index = NUM_PERIODIC_TASKS + 1; index <= NUM_TASKS; index++ ) { status = rtems_task_start( Task_id[ index ], Tasks_Aperiodic, index ); directive_failed( status, "rtems_task_start loop" ); } diff --git a/testsuites/sptests/spedfsched03/system.h b/testsuites/sptests/spedfsched03/system.h index 02010f241d..1b0ff3349d 100644 --- a/testsuites/sptests/spedfsched03/system.h +++ b/testsuites/sptests/spedfsched03/system.h @@ -34,17 +34,11 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Tasks_Periodic( - rtems_task_argument argument -); +rtems_task Tasks_Periodic( rtems_task_argument argument ); -rtems_task Tasks_Aperiodic( - rtems_task_argument argument -); +rtems_task Tasks_Aperiodic( rtems_task_argument argument ); /* configuration information */ @@ -53,17 +47,17 @@ rtems_task Tasks_Aperiodic( #define CONFIGURE_MICROSECONDS_PER_TICK 20000 -#define CONFIGURE_MAXIMUM_TASKS 7 -#define CONFIGURE_MAXIMUM_PERIODS 10 -#define CONFIGURE_MAXIMUM_PRIORITY 512 +#define CONFIGURE_MAXIMUM_TASKS 7 +#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_PRIORITY 512 -#define CONFIGURE_INIT_TASK_PRIORITY 100 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INIT_TASK_PRIORITY 100 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (6 * 4 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 6 * 4 * RTEMS_MINIMUM_STACK_SIZE ) #define CONFIGURE_SCHEDULER_EDF @@ -73,19 +67,19 @@ rtems_task Tasks_Aperiodic( #include #include -#define JOBS_PER_HP (389) -#define HP_LENGTH (420) -#define NUM_PERIODIC_TASKS (4) -#define NUM_APERIODIC_TASKS (2) -#define NUM_TASKS ( NUM_PERIODIC_TASKS + NUM_APERIODIC_TASKS ) +#define JOBS_PER_HP ( 389 ) +#define HP_LENGTH ( 420 ) +#define NUM_PERIODIC_TASKS ( 4 ) +#define NUM_APERIODIC_TASKS ( 2 ) +#define NUM_TASKS ( NUM_PERIODIC_TASKS + NUM_APERIODIC_TASKS ) /* global variables */ -TEST_EXTERN rtems_id Task_id[ 1+NUM_TASKS ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 1+NUM_TASKS ]; /* array of task names */ -TEST_EXTERN rtems_task_priority Priorities[ 1+NUM_TASKS ]; -TEST_EXTERN uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ]; -TEST_EXTERN uint32_t Phases[1 + NUM_TASKS]; -TEST_EXTERN uint32_t Execution[1 + NUM_TASKS]; +TEST_EXTERN rtems_id Task_id[ 1 + NUM_TASKS ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 1 + NUM_TASKS ]; /* array of task names */ +TEST_EXTERN rtems_task_priority Priorities[ 1 + NUM_TASKS ]; +TEST_EXTERN uint32_t Periods[ 1 + NUM_PERIODIC_TASKS ]; +TEST_EXTERN uint32_t Phases[ 1 + NUM_TASKS ]; +TEST_EXTERN uint32_t Execution[ 1 + NUM_TASKS ]; /* end of include file */ diff --git a/testsuites/sptests/spedfsched03/tasks_aperiodic.c b/testsuites/sptests/spedfsched03/tasks_aperiodic.c index 50407455c3..c855562e46 100644 --- a/testsuites/sptests/spedfsched03/tasks_aperiodic.c +++ b/testsuites/sptests/spedfsched03/tasks_aperiodic.c @@ -37,38 +37,38 @@ #include "system.h" -rtems_task Tasks_Aperiodic( - rtems_task_argument argument -) +rtems_task Tasks_Aperiodic( rtems_task_argument argument ) { - rtems_status_code status; - rtems_interval start; - rtems_interval stop; - rtems_interval now; + rtems_status_code status; + rtems_interval start; + rtems_interval stop; + rtems_interval now; put_name( Task_name[ argument ], FALSE ); - status = rtems_task_wake_after( 2 + Phases[argument] ); + status = rtems_task_wake_after( 2 + Phases[ argument ] ); directive_failed( status, "rtems_task_wake_after" ); if ( argument == 6 ) { - rtems_task_suspend( Task_id[5] ); - rtems_task_resume( Task_id[5] ); + rtems_task_suspend( Task_id[ 5 ] ); + rtems_task_resume( Task_id[ 5 ] ); } start = rtems_clock_get_ticks_since_boot(); - printf("AT%" PRIdPTR "-S ticks:%d\n", argument, start); + printf( "AT%" PRIdPTR "-S ticks:%d\n", argument, start ); /* active computing */ - while(FOREVER) { + while ( FOREVER ) { now = rtems_clock_get_ticks_since_boot(); - if (now >= start + Execution[argument]) break; + if ( now >= start + Execution[ argument ] ) { + break; + } } stop = rtems_clock_get_ticks_since_boot(); - printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop); + printf( "P%" PRIdPTR "-F ticks:%d\n", argument, stop ); /* delete SELF */ - fflush(stdout); - printf( "Killing task %" PRIdPTR "\n", argument); + fflush( stdout ); + printf( "Killing task %" PRIdPTR "\n", argument ); rtems_task_exit(); } diff --git a/testsuites/sptests/spedfsched03/tasks_periodic.c b/testsuites/sptests/spedfsched03/tasks_periodic.c index 7387e2c2c6..46275ef8d2 100644 --- a/testsuites/sptests/spedfsched03/tasks_periodic.c +++ b/testsuites/sptests/spedfsched03/tasks_periodic.c @@ -38,9 +38,7 @@ #include "system.h" -rtems_task Tasks_Periodic( - rtems_task_argument argument -) +rtems_task Tasks_Periodic( rtems_task_argument argument ) { rtems_id rmid; rtems_id test_rmid; @@ -56,23 +54,27 @@ rtems_task Tasks_Periodic( status = rtems_rate_monotonic_create( argument, &rmid ); directive_failed( status, "rtems_rate_monotonic_create" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", - rmid ); + printf( "- rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id "\n", rmid ); status = rtems_rate_monotonic_ident( argument, &test_rmid ); directive_failed( status, "rtems_rate_monotonic_ident" ); put_name( Task_name[ argument ], FALSE ); - printf( "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", - test_rmid ); + printf( + "- rtems_rate_monotonic_ident id = 0x%08" PRIxrtems_id "\n", + test_rmid + ); if ( rmid != test_rmid ) { - printf( "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" - PRIxrtems_id ")\n", rmid, test_rmid ); - rtems_test_exit( 0 ); + printf( + "RMID's DO NOT MATCH (0x%" PRIxrtems_id " and 0x%" PRIxrtems_id ")\n", + rmid, + test_rmid + ); + rtems_test_exit( 0 ); } task_id = Task_id[ argument ]; - status = rtems_task_get_scheduler( task_id, &sched_id); + status = rtems_task_get_scheduler( task_id, &sched_id ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); status = rtems_scheduler_get_maximum_priority( sched_id, &prio_max ); @@ -80,41 +82,54 @@ rtems_task Tasks_Periodic( rtems_test_assert( prio_max == CONFIGURE_MAXIMUM_PRIORITY ); put_name( Task_name[ argument ], FALSE ); - printf( "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", - rmid, Periods[ argument ] ); + printf( + "- (0x%08" PRIxrtems_id ") period %" PRIu32 "\n", + rmid, + Periods[ argument ] + ); - status = rtems_task_wake_after( 2 + Phases[argument] ); + status = rtems_task_wake_after( 2 + Phases[ argument ] ); directive_failed( status, "rtems_task_wake_after" ); - while (FOREVER) { - if (rtems_rate_monotonic_period(rmid, Periods[argument])==RTEMS_TIMEOUT) - printf("P%" PRIdPTR " - Deadline miss\n", argument); + while ( FOREVER ) { + if ( + rtems_rate_monotonic_period( rmid, Periods[ argument ] ) == RTEMS_TIMEOUT + ) { + printf( "P%" PRIdPTR " - Deadline miss\n", argument ); + } status = rtems_task_get_priority( task_id, sched_id, &prio_cur ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); rtems_test_assert( prio_cur == 0 ); start = rtems_clock_get_ticks_since_boot(); - printf("P%" PRIdPTR "-S ticks:%d\n", argument, start); - if ( start >= 2*HP_LENGTH ) break; /* stop */ + printf( "P%" PRIdPTR "-S ticks:%d\n", argument, start ); + if ( start >= 2 * HP_LENGTH ) { + break; /* stop */ + } /* active computing */ /* using periodic statistics */ - while(FOREVER) { + while ( FOREVER ) { now = rtems_clock_get_ticks_since_boot(); - if (now >= start + Execution[argument]) break; + if ( now >= start + Execution[ argument ] ) { + break; + } } stop = rtems_clock_get_ticks_since_boot(); - printf("P%" PRIdPTR "-F ticks:%d\n", argument, stop); + printf( "P%" PRIdPTR "-F ticks:%d\n", argument, stop ); } /* delete period and SELF */ status = rtems_rate_monotonic_delete( rmid ); if ( status != RTEMS_SUCCESSFUL ) { - printf("rtems_rate_monotonic_delete failed with status of %d.\n",status); + printf( + "rtems_rate_monotonic_delete failed with status of %d.\n", + status + ); rtems_test_exit( 0 ); } - fflush(stdout); + fflush( stdout ); TEST_END(); rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/spedfsched04/init.c b/testsuites/sptests/spedfsched04/init.c index 1c736a4829..392a0e2699 100644 --- a/testsuites/sptests/spedfsched04/init.c +++ b/testsuites/sptests/spedfsched04/init.c @@ -36,30 +36,28 @@ const char rtems_test_name[] = "SPEDFSCHED 4"; -static const uint32_t Periods[] = { 500, 550 }; -static const uint32_t Iterations[] = { 400, 450 }; +static const uint32_t Periods[] = { 500, 550 }; +static const uint32_t Iterations[] = { 400, 450 }; static const rtems_name Task_name[] = { rtems_build_name( 'T', 'A', '1', ' ' ), rtems_build_name( 'T', 'A', '2', ' ' ) }; -static const rtems_task_priority Prio[3] = { 2, 5 }; -static const uint32_t testnumber = 9; /* stop condition */ +static const rtems_task_priority Prio[ 3 ] = { 2, 5 }; +static const uint32_t testnumber = 9; /* stop condition */ static uint32_t tsk_counter[] = { 0, 0 }; -static rtems_id Task_id[ 2 ]; +static rtems_id Task_id[ 2 ]; /** * @brief Task body */ -static rtems_task Task( - rtems_task_argument argument -) +static rtems_task Task( rtems_task_argument argument ) { - rtems_status_code status; - rtems_id RM_period; - rtems_id selfid=rtems_task_self(); - rtems_rate_monotonic_period_status period_status; - uint32_t flag=0; + rtems_status_code status; + rtems_id RM_period; + rtems_id selfid = rtems_task_self(); + rtems_rate_monotonic_period_status period_status; + uint32_t flag = 0; /* create period */ status = rtems_rate_monotonic_create( Task_name[ argument ], &RM_period ); @@ -73,9 +71,9 @@ static rtems_task Task( /* Do some work */ rtems_test_spin_for_ticks( Iterations[ argument ] ); - if( argument == 1 ){ - if( status == RTEMS_TIMEOUT ){ - if( flag == 0 ){ + if ( argument == 1 ) { + if ( status == RTEMS_TIMEOUT ) { + if ( flag == 0 ) { puts( "First time RTEMS_TIMEOUT" ); puts( "Task 2 should have 2 postponed job due to preemption." ); rtems_test_assert( period_status.postponed_jobs_count == 2 ); @@ -92,7 +90,7 @@ static rtems_task Task( status = rtems_rate_monotonic_get_status( RM_period, &period_status ); directive_failed( status, "rate_monotonic_get_status" ); - if( tsk_counter[ argument ] == testnumber ){ + if ( tsk_counter[ argument ] == testnumber ) { TEST_END(); status = rtems_rate_monotonic_delete( RM_period ); directive_failed( status, "rtems_rate_monotonic_delete" ); @@ -100,10 +98,10 @@ static rtems_task Task( } } - tsk_counter[ argument ]+=1; - if ( argument == 0 ){ - if( tsk_counter[ argument ] == 3 ){ - puts("Task 1 has released 3 jobs and finished."); + tsk_counter[ argument ] += 1; + if ( argument == 0 ) { + if ( tsk_counter[ argument ] == 3 ) { + puts( "Task 1 has released 3 jobs and finished." ); status = rtems_rate_monotonic_delete( RM_period ); directive_failed( status, "rtems_rate_monotonic_delete" ); status = rtems_task_delete( selfid ); @@ -113,47 +111,47 @@ static rtems_task Task( } } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; - uint32_t index; + uint32_t index; rtems_status_code status; TEST_BEGIN(); - /* Create two tasks */ - for ( index = 0; index < RTEMS_ARRAY_SIZE(Task_name); ++index ){ + for ( index = 0; index < RTEMS_ARRAY_SIZE( Task_name ); ++index ) { status = rtems_task_create( - Task_name[ index ], Prio[index], RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ index ] + Task_name[ index ], + Prio[ index ], + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); } /* After creating the periods for tasks, start to run them sequencially. */ - for ( index = 0; index < RTEMS_ARRAY_SIZE(Task_name); ++index ){ - status = rtems_task_start( Task_id[ index ], Task, index); - directive_failed( status, "rtems_task_start loop"); + for ( index = 0; index < RTEMS_ARRAY_SIZE( Task_name ); ++index ) { + status = rtems_task_start( Task_id[ index ], Task, index ); + directive_failed( status, "rtems_task_start loop" ); } rtems_task_exit(); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_PERIODS 2 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_PERIODS 2 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_SCHEDULER_EDF -#define CONFIGURE_INITIAL_EXTENSIONS \ - RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_INIT diff --git a/testsuites/sptests/spedfsched05/init.c b/testsuites/sptests/spedfsched05/init.c index 3894f41506..6f63e0cddc 100644 --- a/testsuites/sptests/spedfsched05/init.c +++ b/testsuites/sptests/spedfsched05/init.c @@ -44,11 +44,11 @@ const char rtems_test_name[] = "SPEDFSCHED 5"; -#define BLUE rtems_build_name('b', 'l', 'u', 'e') +#define BLUE rtems_build_name( 'b', 'l', 'u', 'e' ) -#define RED rtems_build_name('r', 'e', 'd', ' ') +#define RED rtems_build_name( 'r', 'e', 'd', ' ' ) -#define BIG_NUM_CPUS (2 * CHAR_BIT * sizeof(cpu_set_t)) +#define BIG_NUM_CPUS ( 2 * CHAR_BIT * sizeof( cpu_set_t ) ) static const rtems_id invalid_id = 1; @@ -56,667 +56,719 @@ static rtems_id master_id; static rtems_id sema_id; -static void assert_eno(rtems_status_code sc, int eno) +static void assert_eno( rtems_status_code sc, int eno ) { - switch (sc) { + switch ( sc ) { case RTEMS_SUCCESSFUL: - rtems_test_assert(eno == 0); + rtems_test_assert( eno == 0 ); break; case RTEMS_INVALID_ADDRESS: - rtems_test_assert(eno == EFAULT); + rtems_test_assert( eno == EFAULT ); break; case RTEMS_INVALID_ID: - rtems_test_assert(eno == ESRCH); + rtems_test_assert( eno == ESRCH ); break; case RTEMS_INVALID_NUMBER: case RTEMS_INVALID_SIZE: - rtems_test_assert(eno == EINVAL); + rtems_test_assert( eno == EINVAL ); break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); } } static rtems_status_code task_get_affinity( - rtems_id id, - size_t cpusetsize, + rtems_id id, + size_t cpusetsize, cpu_set_t *cpuset ) { rtems_status_code sc; - int eno; - cpu_set_t *cpusetbig; + int eno; + cpu_set_t *cpusetbig; - sc = rtems_task_get_affinity(id, cpusetsize, cpuset); + sc = rtems_task_get_affinity( id, cpusetsize, cpuset ); - if (cpuset != NULL) { - cpusetbig = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbig != NULL); + if ( cpuset != NULL ) { + cpusetbig = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbig != NULL ); - memcpy(cpusetbig, cpuset, cpusetsize); + memcpy( cpusetbig, cpuset, cpusetsize ); } else { cpusetbig = NULL; } - eno = pthread_getaffinity_np(id, cpusetsize, cpusetbig); + eno = pthread_getaffinity_np( id, cpusetsize, cpusetbig ); - if (cpuset != NULL) { - rtems_test_assert(CPU_EQUAL_S(cpusetsize, cpusetbig, cpuset)); - CPU_FREE(cpusetbig); + if ( cpuset != NULL ) { + rtems_test_assert( CPU_EQUAL_S( cpusetsize, cpusetbig, cpuset ) ); + CPU_FREE( cpusetbig ); } - assert_eno(sc, eno); + assert_eno( sc, eno ); return sc; } static rtems_status_code task_set_affinity( - rtems_id id, - size_t cpusetsize, + rtems_id id, + size_t cpusetsize, const cpu_set_t *cpuset ) { rtems_status_code sc; - int eno; + int eno; - sc = rtems_task_set_affinity(id, cpusetsize, cpuset); - eno = pthread_setaffinity_np(id, cpusetsize, cpuset); - assert_eno(sc, eno); + sc = rtems_task_set_affinity( id, cpusetsize, cpuset ); + eno = pthread_setaffinity_np( id, cpusetsize, cpuset ); + assert_eno( sc, eno ); return sc; } -static void test_task_get_set_affinity(void) +static void test_task_get_set_affinity( void ) { - rtems_id self_id = rtems_task_self(); - rtems_id task_id; + rtems_id self_id = rtems_task_self(); + rtems_id task_id; rtems_status_code sc; - cpu_set_t cpusetone; - cpu_set_t cpusetall; - cpu_set_t cpuset; - size_t cpusetbigsize = CPU_ALLOC_SIZE(BIG_NUM_CPUS); - cpu_set_t *cpusetbigone; - cpu_set_t *cpusetbig; + cpu_set_t cpusetone; + cpu_set_t cpusetall; + cpu_set_t cpuset; + size_t cpusetbigsize = CPU_ALLOC_SIZE( BIG_NUM_CPUS ); + cpu_set_t *cpusetbigone; + cpu_set_t *cpusetbig; - CPU_ZERO(&cpusetone); - CPU_SET(0, &cpusetone); + CPU_ZERO( &cpusetone ); + CPU_SET( 0, &cpusetone ); - CPU_FILL(&cpusetall); + CPU_FILL( &cpusetall ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_get_affinity(RTEMS_SELF, sizeof(cpuset), NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = task_get_affinity( RTEMS_SELF, sizeof( cpuset ), NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = task_set_affinity(RTEMS_SELF, sizeof(cpuset), NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = task_set_affinity( RTEMS_SELF, sizeof( cpuset ), NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = task_get_affinity(RTEMS_SELF, 0, &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_SIZE); + sc = task_get_affinity( RTEMS_SELF, 0, &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_SIZE ); - sc = task_set_affinity(RTEMS_SELF, 0, &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + sc = task_set_affinity( RTEMS_SELF, 0, &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_NUMBER ); - sc = task_get_affinity(invalid_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = task_get_affinity( invalid_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = task_set_affinity(invalid_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = task_set_affinity( invalid_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = task_get_affinity(RTEMS_SELF, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( RTEMS_SELF, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - sc = task_set_affinity(RTEMS_SELF, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( RTEMS_SELF, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_set_affinity(self_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( self_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_set_affinity(task_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( task_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_get_affinity(task_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( task_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - sc = task_set_affinity(RTEMS_SELF, sizeof(cpusetall), &cpusetall); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( RTEMS_SELF, sizeof( cpusetall ), &cpusetall ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_get_affinity(task_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( task_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - cpusetbigone = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbigone != NULL); + cpusetbigone = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbigone != NULL ); - cpusetbig = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbig != NULL); + cpusetbig = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbig != NULL ); - CPU_ZERO_S(cpusetbigsize, cpusetbigone); - CPU_SET_S(0, cpusetbigsize, cpusetbigone); + CPU_ZERO_S( cpusetbigsize, cpusetbigone ); + CPU_SET_S( 0, cpusetbigsize, cpusetbigone ); - sc = task_get_affinity(task_id, cpusetbigsize, cpusetbig); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( task_id, cpusetbigsize, cpusetbig ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL_S(cpusetbigsize, cpusetbig, cpusetbigone)); + rtems_test_assert( CPU_EQUAL_S( cpusetbigsize, cpusetbig, cpusetbigone ) ); - sc = task_set_affinity(task_id, cpusetbigsize, cpusetbig); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( task_id, cpusetbigsize, cpusetbig ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - CPU_FREE(cpusetbig); - CPU_FREE(cpusetbigone); + CPU_FREE( cpusetbig ); + CPU_FREE( cpusetbigone ); } -static rtems_task_priority set_prio(rtems_id id, rtems_task_priority prio) +static rtems_task_priority set_prio( rtems_id id, rtems_task_priority prio ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority old_prio; old_prio = 0xffffffff; - sc = rtems_task_set_priority(id, prio, &old_prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_priority( id, prio, &old_prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); return old_prio; } -static void forbidden_task(rtems_task_argument arg) +static void forbidden_task( rtems_task_argument arg ) { (void) arg; - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void restart_task(rtems_task_argument arg) +static void restart_task( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - if (arg == 0) { - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 2); + if ( arg == 0 ) { + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 2 ); - rtems_task_restart(RTEMS_SELF, 1); - } else if (arg == 1) { + rtems_task_restart( RTEMS_SELF, 1 ); + } else if ( arg == 1 ) { rtems_id scheduler_id; - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 2); + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 2 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(RTEMS_SELF, scheduler_id, 4); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( RTEMS_SELF, scheduler_id, 4 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 4); + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 4 ); - rtems_task_restart(RTEMS_SELF, 2); + rtems_task_restart( RTEMS_SELF, 2 ); } else { - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 4); + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 4 ); - rtems_task_resume(master_id); + rtems_task_resume( master_id ); } - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void sema_task(rtems_task_argument arg) +static void sema_task( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - sc = rtems_semaphore_obtain(sema_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( sema_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void test_task_get_set_scheduler(void) +static void test_task_get_set_scheduler( void ) { rtems_status_code sc; - rtems_id self_id = rtems_task_self(); - rtems_name name = BLUE; - rtems_id scheduler_id; - rtems_id scheduler_by_name; - rtems_id task_id; - rtems_id mtx_id; + rtems_id self_id = rtems_task_self(); + rtems_name name = BLUE; + rtems_id scheduler_id; + rtems_id scheduler_by_name; + rtems_id task_id; + rtems_id mtx_id; - sc = rtems_scheduler_ident(name, &scheduler_by_name); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( name, &scheduler_by_name ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_get_scheduler(RTEMS_SELF, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_task_get_scheduler( RTEMS_SELF, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_task_get_scheduler(invalid_id, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_task_get_scheduler( invalid_id, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); scheduler_id = 0; - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == scheduler_by_name); + rtems_test_assert( scheduler_id == scheduler_by_name ); scheduler_id = 0; - sc = rtems_task_get_scheduler(self_id, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( self_id, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == scheduler_by_name); + rtems_test_assert( scheduler_id == scheduler_by_name ); - sc = rtems_task_set_scheduler(invalid_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_task_set_scheduler( invalid_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_task_set_scheduler(self_id, invalid_id, 1); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_task_set_scheduler( self_id, invalid_id, 1 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, UINT32_C(0x80000000)); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + sc = rtems_task_set_scheduler( + self_id, + scheduler_id, + UINT32_C( 0x80000000 ) + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name(' ', 'M', 'T', 'X'), + rtems_build_name( ' ', 'M', 'T', 'X' ), 0, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0, &mtx_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_release(mtx_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( mtx_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(self_id, RTEMS_CURRENT_PRIORITY) == 1); + rtems_test_assert( set_prio( self_id, RTEMS_CURRENT_PRIORITY ) == 1 ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(self_id, RTEMS_CURRENT_PRIORITY) == 2); + rtems_test_assert( set_prio( self_id, RTEMS_CURRENT_PRIORITY ) == 2 ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(self_id, RTEMS_CURRENT_PRIORITY) == 1); + rtems_test_assert( set_prio( self_id, RTEMS_CURRENT_PRIORITY ) == 1 ); - sc = rtems_semaphore_delete(mtx_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( mtx_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); scheduler_id = 0; - sc = rtems_task_get_scheduler(task_id, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( task_id, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == scheduler_by_name); + rtems_test_assert( scheduler_id == scheduler_by_name ); - sc = rtems_task_set_scheduler(task_id, scheduler_id, 2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( task_id, scheduler_id, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task_id, forbidden_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, forbidden_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(task_id, scheduler_id, 2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( task_id, scheduler_id, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task_id, restart_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, restart_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_suspend(self_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_suspend( self_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 0, RTEMS_COUNTING_SEMAPHORE, 0, &sema_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task_id, sema_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, sema_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_wake_after(1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_wake_after( 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(task_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_task_set_scheduler( task_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - sc = rtems_semaphore_delete(sema_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( sema_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_scheduler_ident(void) +static void test_scheduler_ident( void ) { rtems_status_code sc; - rtems_id expected_id = rtems_build_id(7, 1, 1, 1); - rtems_id scheduler_id; - rtems_name name = BLUE; - rtems_name invalid_name = RED; - cpu_set_t s; + rtems_id expected_id = rtems_build_id( 7, 1, 1, 1 ); + rtems_id scheduler_id; + rtems_name name = BLUE; + rtems_name invalid_name = RED; + cpu_set_t s; - sc = rtems_scheduler_ident(name, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_ident( name, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_ident(invalid_name, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_NAME); + sc = rtems_scheduler_ident( invalid_name, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_NAME ); scheduler_id = 0; - sc = rtems_scheduler_ident(name, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( name, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == expected_id); + rtems_test_assert( scheduler_id == expected_id ); - sc = rtems_scheduler_ident_by_processor(1, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_ident_by_processor( 1, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_ident_by_processor(1, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_NAME); + sc = rtems_scheduler_ident_by_processor( 1, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_NAME ); scheduler_id = 0; - sc = rtems_scheduler_ident_by_processor(0, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident_by_processor( 0, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == expected_id); + rtems_test_assert( scheduler_id == expected_id ); - CPU_ZERO(&s); - CPU_SET(1, &s); - sc = rtems_scheduler_ident_by_processor_set(sizeof(s), &s, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + CPU_ZERO( &s ); + CPU_SET( 1, &s ); + sc = rtems_scheduler_ident_by_processor_set( sizeof( s ), &s, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_ident_by_processor_set(1, &s, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_SIZE); + sc = rtems_scheduler_ident_by_processor_set( 1, &s, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_SIZE ); - sc = rtems_scheduler_ident_by_processor_set(sizeof(s), &s, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_NAME); + sc = rtems_scheduler_ident_by_processor_set( + sizeof( s ), + &s, + &scheduler_id + ); + rtems_test_assert( sc == RTEMS_INVALID_NAME ); - CPU_SET(0, &s); + CPU_SET( 0, &s ); scheduler_id = 0; - sc = rtems_scheduler_ident_by_processor_set(sizeof(s), &s, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident_by_processor_set( + sizeof( s ), + &s, + &scheduler_id + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == expected_id); + rtems_test_assert( scheduler_id == expected_id ); } -static void test_scheduler_get_max_prio(void) +static void test_scheduler_get_max_prio( void ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority priority; - rtems_id scheduler_id; + rtems_id scheduler_id; priority = 0; - sc = rtems_scheduler_get_maximum_priority(invalid_id, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 0); + sc = rtems_scheduler_get_maximum_priority( invalid_id, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 0 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_get_maximum_priority(scheduler_id, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_get_maximum_priority( scheduler_id, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); priority = 0; - sc = rtems_scheduler_get_maximum_priority(scheduler_id, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority == 255); + sc = rtems_scheduler_get_maximum_priority( scheduler_id, &priority ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority == 255 ); } -static void test_scheduler_map_to_posix(void) +static void test_scheduler_map_to_posix( void ) { rtems_status_code sc; - int posix_priority; - rtems_id scheduler_id; + int posix_priority; + rtems_id scheduler_id; posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(invalid_id, 1, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( invalid_id, 1, &posix_priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( posix_priority == 123 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 1, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_map_priority_to_posix( scheduler_id, 1, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 0, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 0, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( posix_priority == 123 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 255, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 255, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( posix_priority == 123 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 256, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 256, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( posix_priority == 123 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 1, &posix_priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(posix_priority == 254); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 1, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( posix_priority == 254 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 254, &posix_priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(posix_priority == 1); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 254, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( posix_priority == 1 ); } -static void test_scheduler_map_from_posix(void) +static void test_scheduler_map_from_posix( void ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority priority; - rtems_id scheduler_id; + rtems_id scheduler_id; priority = 123; - sc = rtems_scheduler_map_priority_from_posix(invalid_id, 1, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( invalid_id, 1, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 123 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 1, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 1, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, -1, &priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, -1, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( priority == 123 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 0, &priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 0, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( priority == 123 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 255, &priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 255, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( priority == 123 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 1, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority == 254); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 1, &priority ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority == 254 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 254, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority == 1); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 254, &priority ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority == 1 ); } -static void test_scheduler_get_processors(void) +static void test_scheduler_get_processors( void ) { rtems_status_code sc; - rtems_name name = BLUE; - rtems_id scheduler_id; - cpu_set_t cpusetone; - cpu_set_t cpuset; - size_t cpusetbigsize = CPU_ALLOC_SIZE(BIG_NUM_CPUS); - cpu_set_t *cpusetbigone; - cpu_set_t *cpusetbig; + rtems_name name = BLUE; + rtems_id scheduler_id; + cpu_set_t cpusetone; + cpu_set_t cpuset; + size_t cpusetbigsize = CPU_ALLOC_SIZE( BIG_NUM_CPUS ); + cpu_set_t *cpusetbigone; + cpu_set_t *cpusetbig; - CPU_ZERO(&cpusetone); - CPU_SET(0, &cpusetone); + CPU_ZERO( &cpusetone ); + CPU_SET( 0, &cpusetone ); - sc = rtems_scheduler_ident(name, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( name, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_get_processor_set(scheduler_id, sizeof(cpuset), NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_get_processor_set( + scheduler_id, + sizeof( cpuset ), + NULL + ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_get_processor_set(invalid_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_scheduler_get_processor_set( + invalid_id, + sizeof( cpuset ), + &cpuset + ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_scheduler_get_processor_set(scheduler_id, 0, &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_SIZE); + sc = rtems_scheduler_get_processor_set( scheduler_id, 0, &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_SIZE ); - sc = rtems_scheduler_get_processor_set(scheduler_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_get_processor_set( + scheduler_id, + sizeof( cpuset ), + &cpuset + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - cpusetbigone = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbigone != NULL); + cpusetbigone = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbigone != NULL ); - cpusetbig = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbig != NULL); + cpusetbig = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbig != NULL ); - CPU_ZERO_S(cpusetbigsize, cpusetbigone); - CPU_SET_S(0, cpusetbigsize, cpusetbigone); + CPU_ZERO_S( cpusetbigsize, cpusetbigone ); + CPU_SET_S( 0, cpusetbigsize, cpusetbigone ); - sc = rtems_scheduler_get_processor_set(scheduler_id, cpusetbigsize, cpusetbig); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_get_processor_set( + scheduler_id, + cpusetbigsize, + cpusetbig + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL_S(cpusetbigsize, cpusetbig, cpusetbigone)); + rtems_test_assert( CPU_EQUAL_S( cpusetbigsize, cpusetbig, cpusetbigone ) ); - CPU_FREE(cpusetbig); - CPU_FREE(cpusetbigone); + CPU_FREE( cpusetbig ); + CPU_FREE( cpusetbigone ); } -static void test_scheduler_add_remove_processors(void) +static void test_scheduler_add_remove_processors( void ) { rtems_status_code sc; - rtems_id scheduler_id; + rtems_id scheduler_id; - sc = rtems_scheduler_ident(BLUE, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( BLUE, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_add_processor(invalid_id, 0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_scheduler_add_processor( invalid_id, 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_scheduler_remove_processor(invalid_id, 0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_scheduler_remove_processor( invalid_id, 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_scheduler_add_processor(scheduler_id, 1); - rtems_test_assert(sc == RTEMS_NOT_CONFIGURED); + sc = rtems_scheduler_add_processor( scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_NOT_CONFIGURED ); - sc = rtems_scheduler_remove_processor(scheduler_id, 1); - rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + sc = rtems_scheduler_remove_processor( scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_INVALID_NUMBER ); - sc = rtems_scheduler_add_processor(scheduler_id, 0); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_scheduler_add_processor( scheduler_id, 0 ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - sc = rtems_scheduler_remove_processor(scheduler_id, 0); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_scheduler_remove_processor( scheduler_id, 0 ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); } -static void test_task_get_priority(void) +static void test_task_get_priority( void ) { - rtems_status_code sc; - rtems_id scheduler_id; + rtems_status_code sc; + rtems_id scheduler_id; rtems_task_priority priority; rtems_task_priority priority_2; - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_get_priority(RTEMS_SELF, scheduler_id, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_task_get_priority( RTEMS_SELF, scheduler_id, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); priority = 0; - sc = rtems_task_get_priority(RTEMS_SELF, invalid_id, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 0); + sc = rtems_task_get_priority( RTEMS_SELF, invalid_id, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 0 ); - sc = rtems_task_get_priority(invalid_id, scheduler_id, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 0); + sc = rtems_task_get_priority( invalid_id, scheduler_id, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 0 ); - sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority != 0); + sc = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &priority + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority != 0 ); priority_2 = 0; - sc = rtems_task_get_priority(RTEMS_SELF, scheduler_id, &priority_2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority_2 == priority); + sc = rtems_task_get_priority( RTEMS_SELF, scheduler_id, &priority_2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority_2 == priority ); priority_2 = 0; - sc = rtems_task_get_priority(rtems_task_self(), scheduler_id, &priority_2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority_2 == priority); + sc = rtems_task_get_priority( rtems_task_self(), scheduler_id, &priority_2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority_2 == priority ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -724,7 +776,7 @@ static void Init(rtems_task_argument arg) TEST_BEGIN(); - rtems_resource_snapshot_take(&snapshot); + rtems_resource_snapshot_take( &snapshot ); master_id = rtems_task_self(); @@ -738,10 +790,10 @@ static void Init(rtems_task_argument arg) test_scheduler_add_remove_processors(); test_task_get_priority(); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_SCHEDULER_EDF @@ -749,7 +801,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sperror01/init.c b/testsuites/sptests/sperror01/init.c index d04eed83b4..fee235e165 100644 --- a/testsuites/sptests/sperror01/init.c +++ b/testsuites/sptests/sperror01/init.c @@ -39,33 +39,30 @@ const char rtems_test_name[] = "SPERROR 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { if ( - source == RTEMS_FATAL_SOURCE_EXIT - && !always_set_to_false - && error == ENOMEM + source == RTEMS_FATAL_SOURCE_EXIT && !always_set_to_false && + error == ENOMEM ) { TEST_END(); } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); errno = -1; - rtems_error(RTEMS_ERROR_ERRNO, "Dummy: Resources unavailable"); + rtems_error( RTEMS_ERROR_ERRNO, "Dummy: Resources unavailable" ); errno = ENOMEM; rtems_error( @@ -80,7 +77,7 @@ rtems_task Init( "Dummy: Resources unavailable\n" ); - rtems_test_assert(0); + rtems_test_assert( 0 ); } /* configuration information */ @@ -88,7 +85,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS \ { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sperror02/init.c b/testsuites/sptests/sperror02/init.c index 83c62268cb..c724bc8675 100644 --- a/testsuites/sptests/sperror02/init.c +++ b/testsuites/sptests/sperror02/init.c @@ -39,26 +39,22 @@ const char rtems_test_name[] = "SPERROR 2"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { if ( - source == RTEMS_FATAL_SOURCE_EXIT - && !always_set_to_false - && error == 1 + source == RTEMS_FATAL_SOURCE_EXIT && !always_set_to_false && error == 1 ) { TEST_END(); } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -70,7 +66,7 @@ rtems_task Init( "Dummy: Resources unavailable\n" ); - rtems_test_assert(0); + rtems_test_assert( 0 ); } /* configuration information */ @@ -78,7 +74,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS \ { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sperror03/init.c b/testsuites/sptests/sperror03/init.c index f2174344ec..6143690915 100644 --- a/testsuites/sptests/sperror03/init.c +++ b/testsuites/sptests/sperror03/init.c @@ -39,28 +39,25 @@ static const char fmt[] = "Dummy panic\n"; static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { if ( - source == RTEMS_FATAL_SOURCE_PANIC - && !always_set_to_false - && error == (rtems_fatal_code) fmt + source == RTEMS_FATAL_SOURCE_PANIC && !always_set_to_false && + error == (rtems_fatal_code) fmt ) { TEST_END(); } } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); rtems_panic( fmt ); - rtems_test_assert(0); + rtems_test_assert( 0 ); } /* configuration information */ @@ -68,7 +65,7 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS \ { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spevent_err03/init.c b/testsuites/sptests/spevent_err03/init.c index b2cb8963a2..c003b67102 100644 --- a/testsuites/sptests/spevent_err03/init.c +++ b/testsuites/sptests/spevent_err03/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP EVENT ERROR 3"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -46,9 +44,9 @@ rtems_task Init( struct timeval tv; time_t seconds; rtems_status_code status; - + TEST_BEGIN(); - + status = rtems_event_receive( RTEMS_EVENT_16, RTEMS_NO_WAIT, @@ -95,11 +93,7 @@ rtems_task Init( 3 * rtems_clock_get_ticks_per_second(), &event_out ); - fatal_directive_status( - status, - RTEMS_TIMEOUT, - "rtems_event_receive" - ); + fatal_directive_status( status, RTEMS_TIMEOUT, "rtems_event_receive" ); puts( "TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT" ); status = rtems_event_send( 100, RTEMS_EVENT_16 ); @@ -124,7 +118,7 @@ rtems_task Init( directive_failed( status, "clock_get_tod_timeval OK" ); seconds = tv.tv_sec; - printf( "TA1 - current time - %s\n", ctime(&seconds) ); + printf( "TA1 - current time - %s\n", ctime( &seconds ) ); TEST_END(); } diff --git a/testsuites/sptests/spevent_err03/system.h b/testsuites/sptests/spevent_err03/system.h index 00a74d1931..bd4bf43574 100644 --- a/testsuites/sptests/spevent_err03/system.h +++ b/testsuites/sptests/spevent_err03/system.h @@ -35,32 +35,30 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/speventsystem01/init.c b/testsuites/sptests/speventsystem01/init.c index 33e643f058..9a1b98ba2c 100644 --- a/testsuites/sptests/speventsystem01/init.c +++ b/testsuites/sptests/speventsystem01/init.c @@ -37,81 +37,81 @@ const char rtems_test_name[] = "SPEVENTSYSTEM 1"; #define EVENT RTEMS_EVENT_0 -static void test_with_normal_and_system_event(void) +static void test_with_normal_and_system_event( void ) { rtems_status_code sc; - rtems_event_set out; + rtems_event_set out; /* Assert no events pending */ - sc = rtems_event_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); - sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_system_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); /* Send system event */ - sc = rtems_event_system_send(rtems_task_self(), EVENT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_system_send( rtems_task_self(), EVENT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); out = 0; - sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == EVENT); + sc = rtems_event_system_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == EVENT ); /* Send normal event */ - sc = rtems_event_send(rtems_task_self(), EVENT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( rtems_task_self(), EVENT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); out = 0; - sc = rtems_event_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == EVENT); + sc = rtems_event_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == EVENT ); - sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_system_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); } -static void test_with_timeout(void) +static void test_with_timeout( void ) { rtems_status_code sc; - rtems_event_set out; + rtems_event_set out; - sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_system_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); - sc = rtems_event_system_receive(EVENT, RTEMS_WAIT, 1, &out); - rtems_test_assert(sc == RTEMS_TIMEOUT); + sc = rtems_event_system_receive( EVENT, RTEMS_WAIT, 1, &out ); + rtems_test_assert( sc == RTEMS_TIMEOUT ); - sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_system_receive( EVENT, RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); } -static void test_with_invalid_receiver(void) +static void test_with_invalid_receiver( void ) { rtems_status_code sc; - sc = rtems_event_system_send(0xffff, EVENT); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_event_system_send( 0xffff, EVENT ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); } -static void test_with_invalid_address(void) +static void test_with_invalid_address( void ) { rtems_status_code sc; - sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_event_system_receive( EVENT, RTEMS_NO_WAIT, 0, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); } -static void test_get_pending_events(void) +static void test_get_pending_events( void ) { rtems_status_code sc; - rtems_event_set out; + rtems_event_set out; sc = rtems_event_system_receive( RTEMS_PENDING_EVENTS, @@ -119,11 +119,11 @@ static void test_get_pending_events(void) 0, &out ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == 0); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == 0 ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -137,7 +137,7 @@ static void Init(rtems_task_argument arg) TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/speventtransient01/init.c b/testsuites/sptests/speventtransient01/init.c index 5f86241c44..8081e85f87 100644 --- a/testsuites/sptests/speventtransient01/init.c +++ b/testsuites/sptests/speventtransient01/init.c @@ -37,87 +37,87 @@ const char rtems_test_name[] = "SPEVENTTRANSIENT 1"; typedef struct { rtems_id client; - bool complete; + bool complete; } request; -static void server_task(rtems_task_argument arg) +static void server_task( rtems_task_argument arg ) { rtems_status_code sc; - request *req = (request *) arg; + request *req = (request *) arg; req->complete = true; - sc = rtems_event_transient_send(req->client); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( req->client ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_task_exit(); } -static void test_with_request_server(void) +static void test_with_request_server( void ) { rtems_status_code sc; - rtems_id id; - request req; + rtems_id id; + request req; - sc = rtems_event_transient_receive(RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_transient_receive( RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); req.client = rtems_task_self(); req.complete = false; sc = rtems_task_create( - rtems_build_name('S', 'E', 'R', 'V'), + rtems_build_name( 'S', 'E', 'R', 'V' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(id, server_task, (rtems_task_argument) &req); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( id, server_task, (rtems_task_argument) &req ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(req.complete); + rtems_test_assert( req.complete ); } -static void test_with_request_self(void) +static void test_with_request_self( void ) { rtems_status_code sc; - sc = rtems_event_transient_receive(RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_transient_receive( RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); - sc = rtems_event_transient_send(rtems_task_self()); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( rtems_task_self() ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_transient_receive(RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_event_transient_clear(); - sc = rtems_event_transient_receive(RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_transient_receive( RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); } -static void test_with_timeout(void) +static void test_with_timeout( void ) { rtems_status_code sc; - sc = rtems_event_transient_receive(RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_transient_receive( RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); - sc = rtems_event_transient_receive(RTEMS_WAIT, 1); - rtems_test_assert(sc == RTEMS_TIMEOUT); + sc = rtems_event_transient_receive( RTEMS_WAIT, 1 ); + rtems_test_assert( sc == RTEMS_TIMEOUT ); - sc = rtems_event_transient_receive(RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_event_transient_receive( RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -129,7 +129,7 @@ static void Init(rtems_task_argument arg) TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/spextensions01/init.c b/testsuites/sptests/spextensions01/init.c index 2b7863e526..ce9b26163c 100644 --- a/testsuites/sptests/spextensions01/init.c +++ b/testsuites/sptests/spextensions01/init.c @@ -30,429 +30,426 @@ static int active_extensions = 2; static rtems_id master_task; -static bool before_initialization(void) +static bool before_initialization( void ) { - return _System_state_Is_before_initialization(_System_state_Get()); + return _System_state_Is_before_initialization( _System_state_Get() ); } -static bool before_multitasking(void) +static bool before_multitasking( void ) { - return _System_state_Is_before_multitasking(_System_state_Get()); + return _System_state_Is_before_multitasking( _System_state_Get() ); } -static bool life_protected(void) +static bool life_protected( void ) { Thread_Control *executing; executing = _Thread_Get_executing(); - return executing == NULL - || (executing->Life.state & THREAD_LIFE_PROTECTED) != 0; + return executing == NULL || + ( executing->Life.state & THREAD_LIFE_PROTECTED ) != 0; } -static void assert_normal_thread_context(void) +static void assert_normal_thread_context( void ) { - assert(_Thread_Dispatch_is_enabled()); - assert(!_RTEMS_Allocator_is_owner()); - assert(!life_protected()); + assert( _Thread_Dispatch_is_enabled() ); + assert( !_RTEMS_Allocator_is_owner() ); + assert( !life_protected() ); } -static void assert_life_protected_thread_context(void) +static void assert_life_protected_thread_context( void ) { - assert(_Thread_Dispatch_is_enabled() || before_multitasking()); - assert(!_RTEMS_Allocator_is_owner()); - assert(life_protected() || before_multitasking()); + assert( _Thread_Dispatch_is_enabled() || before_multitasking() ); + assert( !_RTEMS_Allocator_is_owner() ); + assert( life_protected() || before_multitasking() ); } -static void assert_allocator_protected_thread_context(void) +static void assert_allocator_protected_thread_context( void ) { assert( - _Thread_Dispatch_is_enabled() || - before_initialization() || + _Thread_Dispatch_is_enabled() || before_initialization() || before_multitasking() ); - assert(_RTEMS_Allocator_is_owner()); - assert(life_protected()); + assert( _RTEMS_Allocator_is_owner() ); + assert( life_protected() ); } -static void assert_thread_dispatch_disabled_context(void) +static void assert_thread_dispatch_disabled_context( void ) { - assert(!_Thread_Dispatch_is_enabled()); - assert(!_RTEMS_Allocator_is_owner()); - assert(!life_protected()); + assert( !_Thread_Dispatch_is_enabled() ); + assert( !_RTEMS_Allocator_is_owner() ); + assert( !life_protected() ); } -static void assert_forward_order(int index) +static void assert_forward_order( int index ) { - assert((counter % active_extensions) == index); + assert( ( counter % active_extensions ) == index ); ++counter; } -static void assert_reverse_order(int index) +static void assert_reverse_order( int index ) { - assert((counter % active_extensions) == (active_extensions - 1 - index)); + assert( + ( counter % active_extensions ) == ( active_extensions - 1 - index ) + ); ++counter; } -static bool zero_thread_create(rtems_tcb *a, rtems_tcb *b) +static bool zero_thread_create( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(0); + assert_forward_order( 0 ); assert_allocator_protected_thread_context(); return true; } -static void zero_thread_start(rtems_tcb *a, rtems_tcb *b) +static void zero_thread_start( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(0); + assert_forward_order( 0 ); assert_thread_dispatch_disabled_context(); } -static void zero_thread_restart(rtems_tcb *a, rtems_tcb *b) +static void zero_thread_restart( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(0); + assert_forward_order( 0 ); assert_life_protected_thread_context(); } -static void zero_thread_delete(rtems_tcb *a, rtems_tcb *b) +static void zero_thread_delete( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_reverse_order(0); + assert_reverse_order( 0 ); assert_allocator_protected_thread_context(); } -static void zero_thread_switch(rtems_tcb *a, rtems_tcb *b) +static void zero_thread_switch( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(0); + assert_forward_order( 0 ); } -static void zero_thread_begin(rtems_tcb *a) +static void zero_thread_begin( rtems_tcb *a ) { (void) a; - assert_forward_order(0); + assert_forward_order( 0 ); assert_normal_thread_context(); } -static void zero_thread_exitted(rtems_tcb *a) +static void zero_thread_exitted( rtems_tcb *a ) { (void) a; - assert_forward_order(0); + assert_forward_order( 0 ); assert_normal_thread_context(); } static void zero_fatal( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { (void) always_set_to_false; (void) code; - if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_forward_order(0); + if ( source == RTEMS_FATAL_SOURCE_EXIT ) { + assert_forward_order( 0 ); } } -static void zero_thread_terminate(rtems_tcb *a) +static void zero_thread_terminate( rtems_tcb *a ) { (void) a; - assert_reverse_order(0); + assert_reverse_order( 0 ); assert_life_protected_thread_context(); } -static bool one_thread_create(rtems_tcb *a, rtems_tcb *b) +static bool one_thread_create( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(1); + assert_forward_order( 1 ); assert_allocator_protected_thread_context(); return true; } -static void one_thread_start(rtems_tcb *a, rtems_tcb *b) +static void one_thread_start( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(1); + assert_forward_order( 1 ); assert_thread_dispatch_disabled_context(); } -static void one_thread_restart(rtems_tcb *a, rtems_tcb *b) +static void one_thread_restart( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(1); + assert_forward_order( 1 ); assert_life_protected_thread_context(); } -static void one_thread_delete(rtems_tcb *a, rtems_tcb *b) +static void one_thread_delete( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_reverse_order(1); + assert_reverse_order( 1 ); assert_allocator_protected_thread_context(); } -static void one_thread_switch(rtems_tcb *a, rtems_tcb *b) +static void one_thread_switch( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(1); + assert_forward_order( 1 ); } -static void one_thread_begin(rtems_tcb *a) +static void one_thread_begin( rtems_tcb *a ) { (void) a; - assert_forward_order(1); + assert_forward_order( 1 ); assert_normal_thread_context(); } -static void one_thread_exitted(rtems_tcb *a) +static void one_thread_exitted( rtems_tcb *a ) { (void) a; - assert_forward_order(1); + assert_forward_order( 1 ); assert_normal_thread_context(); } static void one_fatal( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { (void) always_set_to_false; (void) code; - if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_forward_order(1); + if ( source == RTEMS_FATAL_SOURCE_EXIT ) { + assert_forward_order( 1 ); } } -static void one_thread_terminate(rtems_tcb *a) +static void one_thread_terminate( rtems_tcb *a ) { (void) a; - assert_reverse_order(1); + assert_reverse_order( 1 ); assert_life_protected_thread_context(); } -static bool two_thread_create(rtems_tcb *a, rtems_tcb *b) +static bool two_thread_create( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(2); + assert_forward_order( 2 ); assert_allocator_protected_thread_context(); return true; } -static void two_thread_start(rtems_tcb *a, rtems_tcb *b) +static void two_thread_start( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(2); + assert_forward_order( 2 ); assert_thread_dispatch_disabled_context(); } -static void two_thread_restart(rtems_tcb *a, rtems_tcb *b) +static void two_thread_restart( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(2); + assert_forward_order( 2 ); assert_life_protected_thread_context(); } -static void two_thread_delete(rtems_tcb *a, rtems_tcb *b) +static void two_thread_delete( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_reverse_order(2); + assert_reverse_order( 2 ); assert_allocator_protected_thread_context(); } -static void two_thread_switch(rtems_tcb *a, rtems_tcb *b) +static void two_thread_switch( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(2); + assert_forward_order( 2 ); } -static void two_thread_begin(rtems_tcb *a) +static void two_thread_begin( rtems_tcb *a ) { (void) a; - assert_forward_order(2); + assert_forward_order( 2 ); assert_normal_thread_context(); } -static void two_thread_exitted(rtems_tcb *a) +static void two_thread_exitted( rtems_tcb *a ) { (void) a; - assert_forward_order(2); + assert_forward_order( 2 ); assert_normal_thread_context(); } static void two_fatal( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { (void) always_set_to_false; (void) code; - if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_forward_order(2); + if ( source == RTEMS_FATAL_SOURCE_EXIT ) { + assert_forward_order( 2 ); } } -static void two_thread_terminate(rtems_tcb *a) +static void two_thread_terminate( rtems_tcb *a ) { (void) a; - assert_reverse_order(2); + assert_reverse_order( 2 ); assert_life_protected_thread_context(); } -static bool three_thread_create(rtems_tcb *a, rtems_tcb *b) +static bool three_thread_create( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(3); + assert_forward_order( 3 ); assert_allocator_protected_thread_context(); return true; } -static void three_thread_start(rtems_tcb *a, rtems_tcb *b) +static void three_thread_start( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(3); + assert_forward_order( 3 ); assert_thread_dispatch_disabled_context(); } -static void three_thread_restart(rtems_tcb *a, rtems_tcb *b) +static void three_thread_restart( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(3); + assert_forward_order( 3 ); assert_life_protected_thread_context(); } -static void three_thread_delete(rtems_tcb *a, rtems_tcb *b) +static void three_thread_delete( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_reverse_order(3); + assert_reverse_order( 3 ); assert_allocator_protected_thread_context(); } -static void three_thread_switch(rtems_tcb *a, rtems_tcb *b) +static void three_thread_switch( rtems_tcb *a, rtems_tcb *b ) { (void) a; (void) b; - assert_forward_order(3); + assert_forward_order( 3 ); } -static void three_thread_begin(rtems_tcb *a) +static void three_thread_begin( rtems_tcb *a ) { (void) a; - assert_forward_order(3); + assert_forward_order( 3 ); assert_normal_thread_context(); } -static void three_thread_exitted(rtems_tcb *a) +static void three_thread_exitted( rtems_tcb *a ) { (void) a; - assert_forward_order(3); + assert_forward_order( 3 ); assert_normal_thread_context(); } static void three_fatal( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { (void) always_set_to_false; (void) code; - if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_forward_order(3); - assert(counter == 68); + if ( source == RTEMS_FATAL_SOURCE_EXIT ) { + assert_forward_order( 3 ); + assert( counter == 68 ); TEST_END(); } } -static void three_thread_terminate(rtems_tcb *a) +static void three_thread_terminate( rtems_tcb *a ) { (void) a; - assert_reverse_order(3); + assert_reverse_order( 3 ); assert_life_protected_thread_context(); } -#define ZERO \ - { \ - .thread_create = zero_thread_create, \ - .thread_start = zero_thread_start, \ +#define ZERO \ + { .thread_create = zero_thread_create, \ + .thread_start = zero_thread_start, \ .thread_restart = zero_thread_restart, \ - .thread_delete = zero_thread_delete, \ - .thread_switch = zero_thread_switch, \ - .thread_begin = zero_thread_begin, \ + .thread_delete = zero_thread_delete, \ + .thread_switch = zero_thread_switch, \ + .thread_begin = zero_thread_begin, \ .thread_exitted = zero_thread_exitted, \ - .fatal = zero_fatal, \ - .thread_terminate = zero_thread_terminate \ - } + .fatal = zero_fatal, \ + .thread_terminate = zero_thread_terminate } -#define ONE \ - { \ - .thread_create = one_thread_create, \ - .thread_start = one_thread_start, \ +#define ONE \ + { .thread_create = one_thread_create, \ + .thread_start = one_thread_start, \ .thread_restart = one_thread_restart, \ - .thread_delete = one_thread_delete, \ - .thread_switch = one_thread_switch, \ - .thread_begin = one_thread_begin, \ + .thread_delete = one_thread_delete, \ + .thread_switch = one_thread_switch, \ + .thread_begin = one_thread_begin, \ .thread_exitted = one_thread_exitted, \ - .fatal = one_fatal, \ - .thread_terminate = one_thread_terminate \ - } + .fatal = one_fatal, \ + .thread_terminate = one_thread_terminate } static const rtems_extensions_table two = { .thread_create = two_thread_create, @@ -478,78 +475,74 @@ static const rtems_extensions_table three = { .thread_terminate = three_thread_terminate }; -static const rtems_extensions_table initial_test = - RTEMS_TEST_INITIAL_EXTENSION; +static const rtems_extensions_table + initial_test = RTEMS_TEST_INITIAL_EXTENSION; #ifdef BSP_INITIAL_EXTENSION -static const rtems_extensions_table initial_bsp = - BSP_INITIAL_EXTENSION; +static const rtems_extensions_table initial_bsp = BSP_INITIAL_EXTENSION; #endif -static void wake_up_master(void) +static void wake_up_master( void ) { rtems_status_code sc; - sc = rtems_event_transient_send(master_task); - assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( master_task ); + assert( sc == RTEMS_SUCCESSFUL ); } -static void wait_for_worker(void) +static void wait_for_worker( void ) { rtems_status_code sc; - sc = rtems_event_transient_receive( - RTEMS_WAIT, - RTEMS_NO_TIMEOUT - ); - assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + assert( sc == RTEMS_SUCCESSFUL ); } -static void worker(rtems_task_argument arg) +static void worker( rtems_task_argument arg ) { (void) arg; wake_up_master(); - (void) rtems_task_suspend(RTEMS_SELF); - assert(false); + (void) rtems_task_suspend( RTEMS_SELF ); + assert( false ); } -static void test(void) +static void test( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; master_task = rtems_task_self(); sc = rtems_extension_create( - rtems_build_name('2', ' ', ' ', ' '), + rtems_build_name( '2', ' ', ' ', ' ' ), &two, &id ); - assert(sc == RTEMS_SUCCESSFUL); + assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_extension_create( - rtems_build_name('3', ' ', ' ', ' '), + rtems_build_name( '3', ' ', ' ', ' ' ), &three, &id ); - assert(sc == RTEMS_SUCCESSFUL); + assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_extension_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), &initial_test, &id ); - assert(sc == RTEMS_SUCCESSFUL); + assert( sc == RTEMS_SUCCESSFUL ); #ifdef BSP_INITIAL_EXTENSION sc = rtems_extension_create( - rtems_build_name(' ', 'B', 'S', 'P'), + rtems_build_name( ' ', 'B', 'S', 'P' ), &initial_bsp, &id ); - assert(sc == RTEMS_SUCCESSFUL); + assert( sc == RTEMS_SUCCESSFUL ); #undef BSP_INITIAL_EXTENSION #endif @@ -564,48 +557,48 @@ static void test(void) * increments are missing. */ #ifdef RTEMS_SMP - assert(counter == 12); + assert( counter == 12 ); #else - assert(counter == 10); + assert( counter == 10 ); counter = 12; #endif sc = rtems_task_create( - rtems_build_name('W', 'O', 'R', 'K'), + rtems_build_name( 'W', 'O', 'R', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - assert(sc == RTEMS_SUCCESSFUL); + assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(id, worker, 0); - assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( id, worker, 0 ); + assert( sc == RTEMS_SUCCESSFUL ); wait_for_worker(); - sc = rtems_task_restart(id, 0); - assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_restart( id, 0 ); + assert( sc == RTEMS_SUCCESSFUL ); wait_for_worker(); - sc = rtems_task_delete(id); - assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( id ); + assert( sc == RTEMS_SUCCESSFUL ); /* Process zombies to trigger delete extensions */ sc = rtems_task_create( - rtems_build_name('N', 'U', 'L', 'L'), + rtems_build_name( 'N', 'U', 'L', 'L' ), 2, SIZE_MAX, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - assert(sc == RTEMS_UNSATISFIED); + assert( sc == RTEMS_UNSATISFIED ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -613,7 +606,7 @@ static void Init(rtems_task_argument arg) test(); - exit(0); + exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/spfatal01/init.c b/testsuites/sptests/spfatal01/init.c index 688ea94f0d..bef8bd2523 100644 --- a/testsuites/sptests/spfatal01/init.c +++ b/testsuites/sptests/spfatal01/init.c @@ -43,18 +43,18 @@ * Classic API Init task create failure */ -#define FATAL_ERROR_TEST_NAME "1" -#define FATAL_ERROR_DESCRIPTION "Classic API Init task create failure" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED +#define FATAL_ERROR_TEST_NAME "1" +#define FATAL_ERROR_DESCRIPTION "Classic API Init task create failure" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED -static void *stack_allocator(size_t unused) +static void *stack_allocator( size_t unused ) { (void) unused; return NULL; } -static void stack_deallocator(void *unused) +static void stack_deallocator( void *unused ) { (void) unused; } @@ -63,9 +63,9 @@ static void stack_deallocator(void *unused) #define CONFIGURE_TASK_STACK_DEALLOCATOR stack_deallocator -static void force_error(void) +static void force_error( void ) { -/* + /* * Case 2: Null entry * Case 3: semaphore_create * _Thread_Dispatch_disable diff --git a/testsuites/sptests/spfatal03/init.c b/testsuites/sptests/spfatal03/init.c index 38177a33f4..0e31e65680 100644 --- a/testsuites/sptests/spfatal03/init.c +++ b/testsuites/sptests/spfatal03/init.c @@ -38,30 +38,28 @@ #define CONFIGURE_MAXIMUM_SEMAPHORES 10 -#define FATAL_ERROR_TEST_NAME "3" -#define FATAL_ERROR_DESCRIPTION "Core Mutex obtain in critical section" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR \ - INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL +#define FATAL_ERROR_TEST_NAME "3" +#define FATAL_ERROR_DESCRIPTION "Core Mutex obtain in critical section" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR \ + INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL -static void force_error(void) +static void force_error( void ) { - rtems_status_code status; - rtems_id mutex; + rtems_id mutex; status = rtems_semaphore_create( - rtems_build_name( 'S','0',' ',' '), + rtems_build_name( 'S', '0', ' ', ' ' ), 0, - RTEMS_LOCAL| - RTEMS_SIMPLE_BINARY_SEMAPHORE, + RTEMS_LOCAL | RTEMS_SIMPLE_BINARY_SEMAPHORE, 0, &mutex ); - directive_failed( status, "rtems_semaphore_create of S0"); - printk("Create semaphore S0\n"); + directive_failed( status, "rtems_semaphore_create of S0" ); + printk( "Create semaphore S0\n" ); - printk("Obtain semaphore in dispatching critical section\n"); + printk( "Obtain semaphore in dispatching critical section\n" ); _Thread_Dispatch_disable(); status = rtems_semaphore_obtain( mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); /* !!! SHOULD NOT RETURN FROM THE ABOVE CALL */ diff --git a/testsuites/sptests/spfatal04/init.c b/testsuites/sptests/spfatal04/init.c index 24d5d10f67..7fb8d60904 100644 --- a/testsuites/sptests/spfatal04/init.c +++ b/testsuites/sptests/spfatal04/init.c @@ -43,13 +43,12 @@ * Classic API Init task create failure */ -#define FATAL_ERROR_TEST_NAME "4" -#define FATAL_ERROR_DESCRIPTION \ - "Classic API call rtems_fatal_error_occurred" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API -#define FATAL_ERROR_EXPECTED_ERROR 0xdead +#define FATAL_ERROR_TEST_NAME "4" +#define FATAL_ERROR_DESCRIPTION "Classic API call rtems_fatal_error_occurred" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_RTEMS_API +#define FATAL_ERROR_EXPECTED_ERROR 0xdead -static void force_error(void) +static void force_error( void ) { rtems_fatal_error_occurred( 0xdead ); /* we will not run this far */ diff --git a/testsuites/sptests/spfatal05/init.c b/testsuites/sptests/spfatal05/init.c index 30fbbd1131..edabb19b74 100644 --- a/testsuites/sptests/spfatal05/init.c +++ b/testsuites/sptests/spfatal05/init.c @@ -36,27 +36,25 @@ #define SPFATAL_TEST_CASE_EXTRA_TASKS 1 -#define FATAL_ERROR_TEST_NAME "5" -#define FATAL_ERROR_DESCRIPTION "Core fall out of a task" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_THREAD_EXITTED +#define FATAL_ERROR_TEST_NAME "5" +#define FATAL_ERROR_DESCRIPTION "Core fall out of a task" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_THREAD_EXITTED rtems_task EmptyTask( rtems_task_argument unused ); -rtems_task EmptyTask( - rtems_task_argument unused -) +rtems_task EmptyTask( rtems_task_argument unused ) { (void) unused; } -static void force_error(void) +static void force_error( void ) { rtems_id id; rtems_status_code status; status = rtems_task_create( - rtems_build_name('T','A','0','1' ), + rtems_build_name( 'T', 'A', '0', '1' ), 4, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, diff --git a/testsuites/sptests/spfatal09/init.c b/testsuites/sptests/spfatal09/init.c index b8fe1f0c3e..d735e8dc1f 100644 --- a/testsuites/sptests/spfatal09/init.c +++ b/testsuites/sptests/spfatal09/init.c @@ -39,10 +39,10 @@ #include -#define FATAL_ERROR_TEST_NAME "9" -#define FATAL_ERROR_DESCRIPTION "Bad heap address to malloc" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_NO_MEMORY_FOR_HEAP +#define FATAL_ERROR_TEST_NAME "9" +#define FATAL_ERROR_DESCRIPTION "Bad heap address to malloc" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_NO_MEMORY_FOR_HEAP static void force_error( void ) { diff --git a/testsuites/sptests/spfatal10/init.c b/testsuites/sptests/spfatal10/init.c index bfe4450608..6caa2fca03 100644 --- a/testsuites/sptests/spfatal10/init.c +++ b/testsuites/sptests/spfatal10/init.c @@ -48,16 +48,16 @@ static inline bool spfatal10_is_expected_error( rtems_fatal_code error ) { - const rtems_assert_context *assert_context = - (const rtems_assert_context *) error; + const rtems_assert_context *assert_context = (const rtems_assert_context *) + error; - return strcmp( assert_context->file, ASSERT_FILE ) == 0 - && assert_context->line == ASSERT_LINE - && strcmp( assert_context->function, ASSERT_FUNC ) == 0 - && strcmp( assert_context->failed_expression, ASSERT_FEXP ) == 0; + return strcmp( assert_context->file, ASSERT_FILE ) == 0 && + assert_context->line == ASSERT_LINE && + strcmp( assert_context->function, ASSERT_FUNC ) == 0 && + strcmp( assert_context->failed_expression, ASSERT_FEXP ) == 0; } -static void force_error(void) +static void force_error( void ) { __assert_func( ASSERT_FILE, ASSERT_LINE, ASSERT_FUNC, ASSERT_FEXP ); diff --git a/testsuites/sptests/spfatal11/init.c b/testsuites/sptests/spfatal11/init.c index a5c9dadba3..054b606d0e 100644 --- a/testsuites/sptests/spfatal11/init.c +++ b/testsuites/sptests/spfatal11/init.c @@ -48,16 +48,16 @@ static inline bool spfatal11_is_expected_error( rtems_fatal_code error ) { - const rtems_assert_context *assert_context = - (const rtems_assert_context *) error; + const rtems_assert_context *assert_context = (const rtems_assert_context *) + error; - return strcmp( assert_context->file, ASSERT_FILE ) == 0 - && assert_context->line == ASSERT_LINE - && assert_context->function == ASSERT_FUNC - && strcmp( assert_context->failed_expression, ASSERT_FEXP ) == 0; + return strcmp( assert_context->file, ASSERT_FILE ) == 0 && + assert_context->line == ASSERT_LINE && + assert_context->function == ASSERT_FUNC && + strcmp( assert_context->failed_expression, ASSERT_FEXP ) == 0; } -static void force_error(void) +static void force_error( void ) { __assert_func( ASSERT_FILE, ASSERT_LINE, ASSERT_FUNC, ASSERT_FEXP ); diff --git a/testsuites/sptests/spfatal12/init.c b/testsuites/sptests/spfatal12/init.c index 19c391df5f..1df69faee9 100644 --- a/testsuites/sptests/spfatal12/init.c +++ b/testsuites/sptests/spfatal12/init.c @@ -37,11 +37,11 @@ #include #include -#define FATAL_ERROR_TEST_NAME "12" -#define FATAL_ERROR_DESCRIPTION \ - "_Heap_Initialize fails during RTEMS initialization" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_TOO_LITTLE_WORKSPACE +#define FATAL_ERROR_TEST_NAME "12" +#define FATAL_ERROR_DESCRIPTION \ + "_Heap_Initialize fails during RTEMS initialization" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_TOO_LITTLE_WORKSPACE static void force_error( void ) { diff --git a/testsuites/sptests/spfatal14/init.c b/testsuites/sptests/spfatal14/init.c index 7fc779c985..9a5b903ceb 100644 --- a/testsuites/sptests/spfatal14/init.c +++ b/testsuites/sptests/spfatal14/init.c @@ -34,14 +34,14 @@ /* generate fatal errors in open_dev_console.c */ -#define FATAL_ERROR_TEST_NAME "14" -#define FATAL_ERROR_DESCRIPTION "fail to open stdout" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED +#define FATAL_ERROR_TEST_NAME "14" +#define FATAL_ERROR_DESCRIPTION "fail to open stdout" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 1 -static void force_error(void) +static void force_error( void ) { /* we will not run this far */ } diff --git a/testsuites/sptests/spfatal15/init.c b/testsuites/sptests/spfatal15/init.c index e4d50a8a08..b1cb287d87 100644 --- a/testsuites/sptests/spfatal15/init.c +++ b/testsuites/sptests/spfatal15/init.c @@ -33,14 +33,14 @@ */ /* generate fatal errors in open_dev_console.c */ -#define FATAL_ERROR_TEST_NAME "15" -#define FATAL_ERROR_DESCRIPTION "fail to open stderr" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED +#define FATAL_ERROR_TEST_NAME "15" +#define FATAL_ERROR_DESCRIPTION "fail to open stderr" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 2 -static void force_error(void) +static void force_error( void ) { /* we will not run this far */ } diff --git a/testsuites/sptests/spfatal26/init.c b/testsuites/sptests/spfatal26/init.c index 07c5ed160c..a9fab7a3b3 100644 --- a/testsuites/sptests/spfatal26/init.c +++ b/testsuites/sptests/spfatal26/init.c @@ -47,8 +47,8 @@ static void Init( rtems_task_argument arg ) static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { if ( source == RTEMS_FATAL_SOURCE_EXIT ) { @@ -64,8 +64,7 @@ static void fatal_extension( } #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/spfatal28/init.c b/testsuites/sptests/spfatal28/init.c index 17da04ff7f..fb365633f0 100644 --- a/testsuites/sptests/spfatal28/init.c +++ b/testsuites/sptests/spfatal28/init.c @@ -31,27 +31,27 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define FATAL_ERROR_TEST_NAME "28" -#define FATAL_ERROR_DESCRIPTION "delete a task with a semaphore in use" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_RESOURCE_IN_USE +#define FATAL_ERROR_TEST_NAME "28" +#define FATAL_ERROR_DESCRIPTION "delete a task with a semaphore in use" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_RESOURCE_IN_USE #define CONFIGURE_MAXIMUM_SEMAPHORES 1 -static void force_error(void) +static void force_error( void ) { -#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) +#if defined( RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT ) rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 0, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_task_exit(); #else diff --git a/testsuites/sptests/spfatal29/init.c b/testsuites/sptests/spfatal29/init.c index 8242c6684e..fdb915e0cc 100644 --- a/testsuites/sptests/spfatal29/init.c +++ b/testsuites/sptests/spfatal29/init.c @@ -31,34 +31,32 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define FATAL_ERROR_TEST_NAME "29" -#define FATAL_ERROR_DESCRIPTION "yield in interrupt context" -#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE -#define FATAL_ERROR_EXPECTED_ERROR INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL +#define FATAL_ERROR_TEST_NAME "29" +#define FATAL_ERROR_DESCRIPTION "yield in interrupt context" +#define FATAL_ERROR_EXPECTED_SOURCE INTERNAL_ERROR_CORE +#define FATAL_ERROR_EXPECTED_ERROR \ + INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL #define CONFIGURE_MAXIMUM_TIMERS 1 -static void timer(rtems_id id, void *arg) +static void timer( rtems_id id, void *arg ) { (void) id; (void) arg; - rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); + rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); } -static void force_error(void) +static void force_error( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_timer_create( - rtems_build_name('T', 'I', 'M', 'E'), - &id - ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_create( rtems_build_name( 'T', 'I', 'M', 'E' ), &id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_fire_after(id, 1, timer, NULL); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_fire_after( id, 1, timer, NULL ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_task_exit(); } diff --git a/testsuites/sptests/spfatal30/init.c b/testsuites/sptests/spfatal30/init.c index ec70a54cc0..96c276948d 100644 --- a/testsuites/sptests/spfatal30/init.c +++ b/testsuites/sptests/spfatal30/init.c @@ -36,7 +36,7 @@ const char rtems_test_name[] = "SPFATAL 30"; #if ( CPU_HARDWARE_FP == TRUE && CPU_ALL_TASKS_ARE_FP == FALSE ) || \ - defined(SPARC_USE_LAZY_FP_SWITCH) + defined( SPARC_USE_LAZY_FP_SWITCH ) #define EXPECTED_FATAL_SOURCE INTERNAL_ERROR_CORE @@ -45,7 +45,7 @@ static bool is_expected_fatal_code( rtems_fatal_code code ) return code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT; } -#elif defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH) +#elif defined( SPARC_USE_SYNCHRONOUS_FP_SWITCH ) #define EXPECTED_FATAL_SOURCE RTEMS_FATAL_SOURCE_EXCEPTION @@ -61,7 +61,7 @@ static bool is_expected_fatal_code( rtems_fatal_code code ) static volatile double f = 1.0; -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -70,32 +70,30 @@ static void Init(rtems_task_argument arg) f *= 123.456; #ifdef EXPECTED_FATAL_SOURCE - rtems_test_assert(0); + rtems_test_assert( 0 ); #else TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); #endif } #ifdef EXPECTED_FATAL_SOURCE static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { if ( - source == EXPECTED_FATAL_SOURCE - && !always_set_to_false - && is_expected_fatal_code( code ) + source == EXPECTED_FATAL_SOURCE && !always_set_to_false && + is_expected_fatal_code( code ) ) { TEST_END(); } } #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #else /* EXPECTED_FATAL_SOURCE */ diff --git a/testsuites/sptests/spfatal31/init.c b/testsuites/sptests/spfatal31/init.c index a89928c687..add8cfbee3 100644 --- a/testsuites/sptests/spfatal31/init.c +++ b/testsuites/sptests/spfatal31/init.c @@ -35,7 +35,7 @@ const char rtems_test_name[] = "SPFATAL 31"; -#if defined(SPARC_USE_LAZY_FP_SWITCH) +#if defined( SPARC_USE_LAZY_FP_SWITCH ) #define EXPECTED_FATAL_SOURCE INTERNAL_ERROR_CORE @@ -44,7 +44,7 @@ static bool is_expected_fatal_code( rtems_fatal_code code ) return code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT; } -#elif defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH) +#elif defined( SPARC_USE_SYNCHRONOUS_FP_SWITCH ) #define EXPECTED_FATAL_SOURCE RTEMS_FATAL_SOURCE_EXCEPTION @@ -60,7 +60,7 @@ static bool is_expected_fatal_code( rtems_fatal_code code ) static volatile double f = 1.0; -static void timer(rtems_id id, void *arg) +static void timer( rtems_id id, void *arg ) { (void) id; (void) arg; @@ -68,51 +68,49 @@ static void timer(rtems_id id, void *arg) f *= 123.456; } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - rtems_id id; + rtems_id id; TEST_BEGIN(); - sc = rtems_timer_create(rtems_build_name('T', 'I', 'M', 'E'), &id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_create( rtems_build_name( 'T', 'I', 'M', 'E' ), &id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_fire_after(id, 1, timer, NULL); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_fire_after( id, 1, timer, NULL ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_wake_after(2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_wake_after( 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); #ifdef EXPECTED_FATAL_SOURCE - rtems_test_assert(0); + rtems_test_assert( 0 ); #else TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); #endif } #ifdef EXPECTED_FATAL_SOURCE static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { if ( - source == EXPECTED_FATAL_SOURCE - && !always_set_to_false - && is_expected_fatal_code( code ) + source == EXPECTED_FATAL_SOURCE && !always_set_to_false && + is_expected_fatal_code( code ) ) { TEST_END(); } } #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #else /* EXPECTED_FATAL_SOURCE */ @@ -122,7 +120,7 @@ static void fatal_extension( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_MAXIMUM_TIMERS 1 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spfatal32/init.c b/testsuites/sptests/spfatal32/init.c index 48979cebd8..636013659e 100644 --- a/testsuites/sptests/spfatal32/init.c +++ b/testsuites/sptests/spfatal32/init.c @@ -44,10 +44,10 @@ */ #pragma GCC diagnostic ignored "-Wfree-nonheap-object" -static void force_error(void) +static void force_error( void ) { uintptr_t invalid = 1; - free((void *) invalid); + free( (void *) invalid ); } #include "../spfatal_support/spfatalimpl.h" diff --git a/testsuites/sptests/spfatal33/init.c b/testsuites/sptests/spfatal33/init.c index f60e3d38d9..26df5b0032 100644 --- a/testsuites/sptests/spfatal33/init.c +++ b/testsuites/sptests/spfatal33/init.c @@ -50,6 +50,7 @@ static void force_error( void ) rtems_test_assert( 0 ); } -#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE RTEMS_TASK_STORAGE_ALIGNMENT +#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE \ + RTEMS_TASK_STORAGE_ALIGNMENT #include "../spfatal_support/spfatalimpl.h" diff --git a/testsuites/sptests/spfatal35/init.c b/testsuites/sptests/spfatal35/init.c index 049aea8c99..5e562ac101 100644 --- a/testsuites/sptests/spfatal35/init.c +++ b/testsuites/sptests/spfatal35/init.c @@ -50,13 +50,13 @@ static void Init( rtems_task_argument arg ) TEST_BEGIN(); _CPU_Instruction_illegal(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code + bool always_set_to_false, + rtems_fatal_code code ) { CPU_Exception_frame *ef; @@ -75,8 +75,7 @@ static void fatal_extension( } #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/spfatal_support/spfatalimpl.h b/testsuites/sptests/spfatal_support/spfatalimpl.h index 560877b45e..88e5972956 100644 --- a/testsuites/sptests/spfatal_support/spfatalimpl.h +++ b/testsuites/sptests/spfatal_support/spfatalimpl.h @@ -34,26 +34,24 @@ rtems_task Init( rtems_task_argument argument ); const char rtems_test_name[] = "SPFATAL " FATAL_ERROR_TEST_NAME; -static void print_test_begin_message(void) +static void print_test_begin_message( void ) { static bool done = false; - if (!done) { + if ( !done ) { done = true; TEST_BEGIN(); } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; print_test_begin_message(); force_error(); printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #ifdef FATAL_ERROR_EXPECTED_ERROR @@ -61,12 +59,12 @@ static void Put_Error( uint32_t source, uint32_t error ) { if ( source == INTERNAL_ERROR_CORE ) { printk( rtems_internal_error_text( error ) ); - } - else if (source == INTERNAL_ERROR_RTEMS_API ){ - if (error > RTEMS_NOT_IMPLEMENTED ) - printk("Unknown Internal RTEMS Error (0x%08" PRIx32 ")", error); - else + } else if ( source == INTERNAL_ERROR_RTEMS_API ) { + if ( error > RTEMS_NOT_IMPLEMENTED ) { + printk( "Unknown Internal RTEMS Error (0x%08" PRIx32 ")", error ); + } else { printk( "%s", rtems_status_text( error ) ); + } } } #endif @@ -80,7 +78,7 @@ static bool is_expected_error( rtems_fatal_code error ) { #ifdef FATAL_ERROR_EXPECTED_ERROR return error == FATAL_ERROR_EXPECTED_ERROR; -#else /* FATAL_ERROR_EXPECTED_ERROR */ +#else /* FATAL_ERROR_EXPECTED_ERROR */ return FATAL_ERROR_EXPECTED_ERROR_CHECK( error ); #endif /* FATAL_ERROR_EXPECTED_ERROR */ } @@ -94,33 +92,33 @@ static void Fatal_extension( print_test_begin_message(); printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION ); - if ( source != FATAL_ERROR_EXPECTED_SOURCE ){ - printk( "ERROR==> Fatal Extension source Expected ("); + if ( source != FATAL_ERROR_EXPECTED_SOURCE ) { + printk( "ERROR==> Fatal Extension source Expected (" ); Put_Source( FATAL_ERROR_EXPECTED_SOURCE ); - printk( ") received ("); + printk( ") received (" ); Put_Source( source ); printk( ")\n" ); } - if ( always_set_to_false ) + if ( always_set_to_false ) { printk( "ERROR==> Fatal Extension is internal set to true expected false\n" ); + } #ifdef FATAL_ERROR_EXPECTED_ERROR - if ( error != FATAL_ERROR_EXPECTED_ERROR ) { - printk( "ERROR==> Fatal Error Expected ("); + if ( error != FATAL_ERROR_EXPECTED_ERROR ) { + printk( "ERROR==> Fatal Error Expected (" ); Put_Error( source, FATAL_ERROR_EXPECTED_ERROR ); - printk( ") received ("); + printk( ") received (" ); Put_Error( source, error ); printk( ")\n" ); } #endif /* FATAL_ERROR_EXPECTED_ERROR */ if ( - source == FATAL_ERROR_EXPECTED_SOURCE - && !always_set_to_false - && is_expected_error( error ) + source == FATAL_ERROR_EXPECTED_SOURCE && !always_set_to_false && + is_expected_error( error ) ) { TEST_END(); } @@ -129,18 +127,16 @@ static void Fatal_extension( #define CONFIGURE_INIT #define CONFIGURE_INITIAL_EXTENSIONS \ - { \ - .thread_create = NULL, \ - .thread_start = NULL, \ - .thread_restart = NULL, \ - .thread_delete = NULL, \ - .thread_switch = NULL, \ - .thread_begin = NULL, \ - .thread_exitted = NULL, \ - .fatal = Fatal_extension, \ - .thread_terminate = NULL \ - }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .thread_create = NULL, \ + .thread_start = NULL, \ + .thread_restart = NULL, \ + .thread_delete = NULL, \ + .thread_switch = NULL, \ + .thread_begin = NULL, \ + .thread_exitted = NULL, \ + .fatal = Fatal_extension, \ + .thread_terminate = NULL }, \ + RTEMS_TEST_INITIAL_EXTENSION /* extra parameters may be in testcase.h */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER @@ -150,8 +146,7 @@ static void Fatal_extension( #ifndef SPFATAL_TEST_CASE_EXTRA_TASKS #define SPFATAL_TEST_CASE_EXTRA_TASKS 0 #endif -#define CONFIGURE_MAXIMUM_TASKS \ - (SPFATAL_TEST_CASE_EXTRA_TASKS + 1) +#define CONFIGURE_MAXIMUM_TASKS ( SPFATAL_TEST_CASE_EXTRA_TASKS + 1 ) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spfifo01/init.c b/testsuites/sptests/spfifo01/init.c index 8880c1c299..b33d1f7bdb 100644 --- a/testsuites/sptests/spfifo01/init.c +++ b/testsuites/sptests/spfifo01/init.c @@ -24,14 +24,14 @@ const char rtems_test_name[] = "SPFIFO 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); #define FIFO_PATH "/fifo01" -static void test_main(void) +static void test_main( void ) { mode_t rwx = S_IRWXU | S_IRWXG | S_IRWXO; - int status; + int status; TEST_BEGIN(); @@ -42,24 +42,24 @@ static void test_main(void) ); errno = 0; - status = mkfifo(FIFO_PATH, rwx); - rtems_test_assert(status == -1); - rtems_test_assert(errno == ENOSYS); + status = mkfifo( FIFO_PATH, rwx ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOSYS ); errno = 0; - status = mknod(FIFO_PATH, S_IFIFO | rwx, 0); - rtems_test_assert(status == -1); - rtems_test_assert(errno == ENOSYS); + status = mknod( FIFO_PATH, S_IFIFO | rwx, 0 ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ENOSYS ); TEST_END(); } -rtems_task Init(rtems_task_argument not_used) +rtems_task Init( rtems_task_argument not_used ) { (void) not_used; test_main(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/spfifo02/init.c b/testsuites/sptests/spfifo02/init.c index c36d12095a..b1b1fd24e7 100644 --- a/testsuites/sptests/spfifo02/init.c +++ b/testsuites/sptests/spfifo02/init.c @@ -44,73 +44,70 @@ const char rtems_test_name[] = "SPFIFO 2"; #define NUM_OPEN_REQ 26 -static void create_fifo(void) +static void create_fifo( void ) { int status; - status = mkfifo("/fifo01", 0777); - rtems_test_assert(status == 0); + status = mkfifo( "/fifo01", 0777 ); + rtems_test_assert( status == 0 ); } -static void open_fifo(int expected, int flags) +static void open_fifo( int expected, int flags ) { int fd; - fd = open("/fifo01", flags); - printf( "expect status=%d errno=%d/(%s)\n", fd, errno, strerror(errno) ); + fd = open( "/fifo01", flags ); + printf( "expect status=%d errno=%d/(%s)\n", fd, errno, strerror( errno ) ); if ( expected ) { - rtems_test_assert(fd == -1); - rtems_test_assert(errno == expected); + rtems_test_assert( fd == -1 ); + rtems_test_assert( errno == expected ); } else { - rtems_test_assert(fd != -1); + rtems_test_assert( fd != -1 ); close( fd ); } } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; void *p; - int num_opens = 0; - int index = 0; + int num_opens = 0; + int index = 0; TEST_BEGIN(); puts( "Creating FIFO" ); create_fifo(); - p = rtems_heap_greedy_allocate(NULL, 0); - puts("Opening FIFO.. expect ENOMEM since no memory is available"); - open_fifo(ENOMEM, O_RDWR); - rtems_heap_greedy_free(p); + p = rtems_heap_greedy_allocate( NULL, 0 ); + puts( "Opening FIFO.. expect ENOMEM since no memory is available" ); + open_fifo( ENOMEM, O_RDWR ); + rtems_heap_greedy_free( p ); puts( "Opening FIFO in RDWR mode. Expect OK" ); - open_fifo(0, O_RDWR); + open_fifo( 0, O_RDWR ); ++num_opens; - puts( "Opening FIFO in non blocking RDONLY mode. Expect OK"); - open_fifo(0, O_RDONLY | O_NONBLOCK); + puts( "Opening FIFO in non blocking RDONLY mode. Expect OK" ); + open_fifo( 0, O_RDONLY | O_NONBLOCK ); ++num_opens; - puts( "Opening FIFO in non blocking WRONLY mode. Expect ENXIO"); - open_fifo(ENXIO, O_WRONLY | O_NONBLOCK); + puts( "Opening FIFO in non blocking WRONLY mode. Expect ENXIO" ); + open_fifo( ENXIO, O_WRONLY | O_NONBLOCK ); ++num_opens; - puts("\nMultiple opens\n"); + puts( "\nMultiple opens\n" ); index = 0; do { - - printf("%d... ", index+1); - open_fifo(0, O_RDONLY | O_NONBLOCK); + printf( "%d... ", index + 1 ); + open_fifo( 0, O_RDONLY | O_NONBLOCK ); ++index; } while ( index < NUM_OPEN_REQ - num_opens ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -118,7 +115,7 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spfifo03/init.c b/testsuites/sptests/spfifo03/init.c index fe996f2501..0e20d165c5 100644 --- a/testsuites/sptests/spfifo03/init.c +++ b/testsuites/sptests/spfifo03/init.c @@ -45,184 +45,178 @@ const char rtems_test_name[] = "SPFIFO 3"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task read_task(rtems_task_argument not_used); -void test_main(void); +rtems_task Init( rtems_task_argument argument ); +rtems_task read_task( rtems_task_argument not_used ); +void test_main( void ); #define SEND_RCV_BUFSIZ 12 rtems_id Barrier; -rtems_task read_task(rtems_task_argument not_used) +rtems_task read_task( rtems_task_argument not_used ) { (void) not_used; int fd = 0; int status = -1; - char recvBuf_r1[SEND_RCV_BUFSIZ] = {0}; - char recvBuf_r2[SEND_RCV_BUFSIZ] = {0}; + char recvBuf_r1[ SEND_RCV_BUFSIZ ] = { 0 }; + char recvBuf_r2[ SEND_RCV_BUFSIZ ] = { 0 }; - puts("\nRead task activated, waiting till writer opens"); + puts( "\nRead task activated, waiting till writer opens" ); status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - sleep(1); + sleep( 1 ); - puts("\nNow, reader opening file(1)"); - fd = open("/tmp/fifo01", O_RDONLY); - if(fd <= 0) { - printf("Error opening file: (%d) :: %s", errno, strerror(errno)); - rtems_test_assert(0); + puts( "\nNow, reader opening file(1)" ); + fd = open( "/tmp/fifo01", O_RDONLY ); + if ( fd <= 0 ) { + printf( "Error opening file: (%d) :: %s", errno, strerror( errno ) ); + rtems_test_assert( 0 ); } - status = read(fd, recvBuf_r1, sizeof(recvBuf_r1)-1); - rtems_test_assert(status == sizeof(recvBuf_r1)-1); + status = read( fd, recvBuf_r1, sizeof( recvBuf_r1 ) - 1 ); + rtems_test_assert( status == sizeof( recvBuf_r1 ) - 1 ); - printf("\n@ receiver (being a unblocked reader): Got %s", recvBuf_r1); + printf( "\n@ receiver (being a unblocked reader): Got %s", recvBuf_r1 ); - status = close(fd); - rtems_test_assert(status == 0); + status = close( fd ); + rtems_test_assert( status == 0 ); status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - - puts("\nReader opening file(2)"); - fd = open("/tmp/fifo01", O_RDONLY); - if(fd <= 0) { - printf("Error opening file: (%d) :: %s", errno, strerror(errno)); - rtems_test_assert(0); + + puts( "\nReader opening file(2)" ); + fd = open( "/tmp/fifo01", O_RDONLY ); + if ( fd <= 0 ) { + printf( "Error opening file: (%d) :: %s", errno, strerror( errno ) ); + rtems_test_assert( 0 ); } - status = read(fd, recvBuf_r2, sizeof(recvBuf_r2)-1); - rtems_test_assert(status == sizeof(recvBuf_r2)-1); + status = read( fd, recvBuf_r2, sizeof( recvBuf_r2 ) - 1 ); + rtems_test_assert( status == sizeof( recvBuf_r2 ) - 1 ); - printf("\n@ receiver (being a blocked reader): Got %s", recvBuf_r2); + printf( "\n@ receiver (being a blocked reader): Got %s", recvBuf_r2 ); - status = close(fd); - rtems_test_assert(status == 0); - - - puts("\nReader done!"); + status = close( fd ); + rtems_test_assert( status == 0 ); + + puts( "\nReader done!" ); status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); rtems_task_exit(); } -void test_main(void) /* Also acts as the write task */ +void test_main( void ) /* Also acts as the write task */ { - rtems_id readTaskID; rtems_name readTaskName; - char sendBuf_r1[SEND_RCV_BUFSIZ] = {0}; - char sendBuf_r2[SEND_RCV_BUFSIZ] = {0}; - int status = -1; - int fd = 0; - + char sendBuf_r1[ SEND_RCV_BUFSIZ ] = { 0 }; + char sendBuf_r2[ SEND_RCV_BUFSIZ ] = { 0 }; + int status = -1; + int fd = 0; strcpy( sendBuf_r1, "SendBuffer1" ); strcpy( sendBuf_r2, "SendBuffer2" ); - memset( &Barrier, 0, sizeof(Barrier) ); - status = rtems_barrier_create ( - rtems_build_name ( 'B', 'A', 'R', 't' ), + memset( &Barrier, 0, sizeof( Barrier ) ); + status = rtems_barrier_create( + rtems_build_name( 'B', 'A', 'R', 't' ), RTEMS_BARRIER_AUTOMATIC_RELEASE, 2, &Barrier - ); + ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); TEST_BEGIN(); - puts("\nCreating a task name and a task"); - readTaskName = rtems_build_name('T','A','r',' '); + puts( "\nCreating a task name and a task" ); + readTaskName = rtems_build_name( 'T', 'A', 'r', ' ' ); status = rtems_task_create( - readTaskName, - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &readTaskID - ); - + readTaskName, + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &readTaskID + ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); - puts("\ncreating directory /tmp"); - status = mkdir("/tmp", 0777); - rtems_test_assert(status == 0); + puts( "\ncreating directory /tmp" ); + status = mkdir( "/tmp", 0777 ); + rtems_test_assert( status == 0 ); - puts("\ncreating fifo file /tmp/fifo01"); - status = mkfifo("/tmp/fifo01", 0777); - rtems_test_assert(status == 0); + puts( "\ncreating fifo file /tmp/fifo01" ); + status = mkfifo( "/tmp/fifo01", 0777 ); + rtems_test_assert( status == 0 ); - puts("\nStarting the read task"); - status = rtems_task_start(readTaskID, read_task, 0); - rtems_test_assert(status == 0); + puts( "\nStarting the read task" ); + status = rtems_task_start( readTaskID, read_task, 0 ); + rtems_test_assert( status == 0 ); status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - puts("\nWriter opening file(1)"); - fd = open("/tmp/fifo01", O_WRONLY); - if(fd <= 0) { - printf("Error opening file: (%d) :: %s", errno, strerror(errno)); - rtems_test_assert(0); + puts( "\nWriter opening file(1)" ); + fd = open( "/tmp/fifo01", O_WRONLY ); + if ( fd <= 0 ) { + printf( "Error opening file: (%d) :: %s", errno, strerror( errno ) ); + rtems_test_assert( 0 ); } - - printf("\n@ sender: %s", sendBuf_r1); - status = write(fd, sendBuf_r1, sizeof(sendBuf_r1)-1); - rtems_test_assert(status == sizeof(sendBuf_r1)-1); + printf( "\n@ sender: %s", sendBuf_r1 ); + status = write( fd, sendBuf_r1, sizeof( sendBuf_r1 ) - 1 ); + rtems_test_assert( status == sizeof( sendBuf_r1 ) - 1 ); + + status = close( fd ); + rtems_test_assert( status == 0 ); - status = close(fd); - rtems_test_assert(status == 0); - status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - sleep(1); + sleep( 1 ); // Reader would have blocked by now - puts("\nWriter opening file(2)"); - fd = open("/tmp/fifo01", O_WRONLY); - if(fd <= 0) { - printf("Error opening file: (%d) :: %s", errno, strerror(errno)); - rtems_test_assert(0); + puts( "\nWriter opening file(2)" ); + fd = open( "/tmp/fifo01", O_WRONLY ); + if ( fd <= 0 ) { + printf( "Error opening file: (%d) :: %s", errno, strerror( errno ) ); + rtems_test_assert( 0 ); } - printf("\n@ sender: %s", sendBuf_r2); - status = write(fd, sendBuf_r2, sizeof(sendBuf_r2)-1); - rtems_test_assert(status == sizeof(sendBuf_r2)-1); + printf( "\n@ sender: %s", sendBuf_r2 ); + status = write( fd, sendBuf_r2, sizeof( sendBuf_r2 ) - 1 ); + rtems_test_assert( status == sizeof( sendBuf_r2 ) - 1 ); - status = close(fd); - rtems_test_assert(status == 0); + status = close( fd ); + rtems_test_assert( status == 0 ); status = rtems_barrier_wait( Barrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); puts( "Removing the fifo" ); - status = unlink("/tmp/fifo01"); - rtems_test_assert(status == 0); - + status = unlink( "/tmp/fifo01" ); + rtems_test_assert( status == 0 ); + puts( "Removing /tmp" ); - status = rmdir("/tmp"); - rtems_test_assert(status == 0); - + status = rmdir( "/tmp" ); + rtems_test_assert( status == 0 ); + TEST_END(); } -rtems_task Init( - rtems_task_argument not_used -) +rtems_task Init( rtems_task_argument not_used ) { (void) not_used; test_main(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER diff --git a/testsuites/sptests/spfifo04/init.c b/testsuites/sptests/spfifo04/init.c index 53ec5195c6..3e3437b6e9 100644 --- a/testsuites/sptests/spfifo04/init.c +++ b/testsuites/sptests/spfifo04/init.c @@ -46,32 +46,30 @@ const char rtems_test_name[] = "SPFIFO 4"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); #define SEND_RCV_BUFSIZ 12 -rtems_task Init( - rtems_task_argument not_used -) +rtems_task Init( rtems_task_argument not_used ) { (void) not_used; - int fd = -1; - int status = -1; + int fd = -1; + int status = -1; off_t offset = 4; - int pipe_length = -1; - int flag = 1; + int pipe_length = -1; + int flag = 1; TEST_BEGIN(); puts( "Init - Creating /fifo" ); status = mkfifo( "/fifo", 0777 ); rtems_test_assert( status == 0 ); - + puts( "Init - Opening /fifo in readonly, non-blocking mode" ); fd = open( "/fifo", O_RDONLY | O_NONBLOCK ); rtems_test_assert( fd != -1 ); - + puts( "Init - Attempt to lseek on fifo -- Expected ESPIPE" ); offset = lseek( fd, offset, SEEK_CUR ); rtems_test_assert( offset == -1 ); @@ -85,7 +83,7 @@ rtems_task Init( puts( "Init - ioctl: FIONBIO -- OK" ); status = ioctl( fd, FIONBIO, &flag ); rtems_test_assert( status == 0 ); - + flag = 0; puts( "Init - ioctl: FIONBIO -- OK" ); status = ioctl( fd, FIONBIO, &flag ); @@ -105,17 +103,17 @@ rtems_task Init( status = ioctl( fd, FIONREAD, &pipe_length ); rtems_test_assert( status == 0 ); rtems_test_assert( pipe_length == 0 ); - + puts( "Init - closing /fifo" ); status = close( fd ); rtems_test_assert( status == 0 ); - + puts( "Init - removing /fifo" ); status = unlink( "/fifo" ); rtems_test_assert( status == 0 ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER diff --git a/testsuites/sptests/spfifo05/init.c b/testsuites/sptests/spfifo05/init.c index 3ad02a0f26..80ce55b5b3 100644 --- a/testsuites/sptests/spfifo05/init.c +++ b/testsuites/sptests/spfifo05/init.c @@ -47,29 +47,29 @@ const char rtems_test_name[] = "SPFIFO 5"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task read_task(rtems_task_argument not_used); +rtems_task Init( rtems_task_argument argument ); +rtems_task read_task( rtems_task_argument not_used ); -#define SEND_RCV_BUFSIZ (PIPE_BUF+20) +#define SEND_RCV_BUFSIZ ( PIPE_BUF + 20 ) rtems_id rBarrier; rtems_id wBarrier; -char recvBuf[SEND_RCV_BUFSIZ] = {0}; -char sendBuf[SEND_RCV_BUFSIZ] = {0}; +char recvBuf[ SEND_RCV_BUFSIZ ] = { 0 }; +char sendBuf[ SEND_RCV_BUFSIZ ] = { 0 }; -rtems_task read_task(rtems_task_argument not_used) +rtems_task read_task( rtems_task_argument not_used ) { (void) not_used; - int fd = 0; - int status = -1; + int fd = 0; + int status = -1; uint32_t released = 0; puts( "read_task - opening /fifo in non-blocking mode" ); fd = open( "/fifo", O_RDONLY | O_NONBLOCK ); - if( fd <= 0 ) { + if ( fd <= 0 ) { printf( "Error opening file: (%d) :: %s\n", errno, strerror( errno ) ); rtems_test_assert( 0 ); } @@ -95,9 +95,9 @@ rtems_task read_task(rtems_task_argument not_used) status = close( fd ); rtems_test_assert( status == 0 ); - puts("read_task - opening /fifo in read-only mode"); + puts( "read_task - opening /fifo in read-only mode" ); fd = open( "/fifo", O_RDONLY ); - if( fd <= 0 ) { + if ( fd <= 0 ) { printf( "Error opening file: (%d) :: %s\n", errno, strerror( errno ) ); rtems_test_assert( 0 ); } @@ -111,7 +111,7 @@ rtems_task read_task(rtems_task_argument not_used) rtems_test_assert( status == 10 ); puts( "read_task - reading from /fifo - OK" ); - status = read( fd, recvBuf+10, 10 ); + status = read( fd, recvBuf + 10, 10 ); rtems_test_assert( status == 10 ); puts( "read_task - waiting at a barrier" ); @@ -119,10 +119,10 @@ rtems_task read_task(rtems_task_argument not_used) rtems_test_assert( status == RTEMS_SUCCESSFUL ); puts( "read_task - reading from /fifo - OK" ); - status = read( fd, recvBuf+20, SEND_RCV_BUFSIZ - 20 ); + status = read( fd, recvBuf + 20, SEND_RCV_BUFSIZ - 20 ); rtems_test_assert( status == SEND_RCV_BUFSIZ - 20 ); - if( strcmp( sendBuf, recvBuf ) ) { + if ( strcmp( sendBuf, recvBuf ) ) { puts( "Sent, received buffer do not match" ); rtems_test_assert( 0 ); } @@ -145,9 +145,7 @@ rtems_task read_task(rtems_task_argument not_used) rtems_task_exit(); } -rtems_task Init( - rtems_task_argument not_used -) +rtems_task Init( rtems_task_argument not_used ) { (void) not_used; @@ -155,46 +153,46 @@ rtems_task Init( rtems_name readTaskName; - int status = -1; - int fd = 0; + int status = -1; + int fd = 0; uint32_t released = 0; - int flag = 1; + int flag = 1; TEST_BEGIN(); memset( sendBuf, '1', SEND_RCV_BUFSIZ - 30 ); memset( sendBuf, '2', 29 ); - sendBuf[SEND_RCV_BUFSIZ-1] = 0; + sendBuf[ SEND_RCV_BUFSIZ - 1 ] = 0; - memset( &rBarrier, 0, sizeof(rBarrier) ); - status = rtems_barrier_create ( - rtems_build_name ( 'B', 'A', 'R', 'r' ), + memset( &rBarrier, 0, sizeof( rBarrier ) ); + status = rtems_barrier_create( + rtems_build_name( 'B', 'A', 'R', 'r' ), RTEMS_BARRIER_MANUAL_RELEASE, 2, &rBarrier - ); + ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); memset( &wBarrier, 0, sizeof( wBarrier ) ); - status = rtems_barrier_create ( - rtems_build_name ( 'B', 'A', 'R', 'w' ), + status = rtems_barrier_create( + rtems_build_name( 'B', 'A', 'R', 'w' ), RTEMS_BARRIER_MANUAL_RELEASE, 2, &wBarrier - ); + ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - readTaskName = rtems_build_name( 'T','A','r',' ' ); + readTaskName = rtems_build_name( 'T', 'A', 'r', ' ' ); status = rtems_task_create( - readTaskName, - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &readTaskID - ); - + readTaskName, + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &readTaskID + ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); puts( "Init - Creating fifo file /fifo" ); @@ -209,15 +207,15 @@ rtems_task Init( status = rtems_barrier_wait( wBarrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - puts("Init - opening the fifo in write only mode -- OK"); - fd = open("/fifo", O_WRONLY); - if(fd <= 0) { - printf("Error opening file: (%d) :: %s\n", errno, strerror(errno)); - rtems_test_assert(0); + puts( "Init - opening the fifo in write only mode -- OK" ); + fd = open( "/fifo", O_WRONLY ); + if ( fd <= 0 ) { + printf( "Error opening file: (%d) :: %s\n", errno, strerror( errno ) ); + rtems_test_assert( 0 ); } puts( "Init - writing to /fifo" ); - status = write(fd, sendBuf, 0 ); + status = write( fd, sendBuf, 0 ); rtems_test_assert( status == 0 ); puts( "Init - releasing the read_task" ); @@ -227,13 +225,13 @@ rtems_task Init( puts( "Init - waiting at a barrier" ); status = rtems_barrier_wait( wBarrier, RTEMS_NO_TIMEOUT ); rtems_test_assert( status == RTEMS_SUCCESSFUL ); - + puts( "Init - writing to /fifo - OK" ); - status = write(fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); + status = write( fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); rtems_test_assert( status == SEND_RCV_BUFSIZ - 30 ); puts( "Init - writing to /fifo - OK" ); - status = write(fd, sendBuf+SEND_RCV_BUFSIZ - 30, 30 ); + status = write( fd, sendBuf + SEND_RCV_BUFSIZ - 30, 30 ); rtems_test_assert( status == 30 ); puts( "Init - releasing the read_task" ); @@ -242,18 +240,18 @@ rtems_task Init( puts( "Init - waiting at a barrier" ); status = rtems_barrier_wait( wBarrier, RTEMS_NO_TIMEOUT ); - rtems_test_assert( status == RTEMS_SUCCESSFUL ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); puts( "Init - converting the write-mode to non-block" ); status = ioctl( fd, FIONBIO, &flag ); rtems_test_assert( status == 0 ); puts( "Init - writing to /fifo - OK" ); - status = write(fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); + status = write( fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); rtems_test_assert( status == SEND_RCV_BUFSIZ - 30 ); - + puts( "Init - writing to /fifo - Expect EAGAIN" ); - status = write(fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); + status = write( fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); rtems_test_assert( status == -1 ); rtems_test_assert( errno == EAGAIN ); @@ -263,10 +261,10 @@ rtems_task Init( puts( "Init - waiting at a barrier" ); status = rtems_barrier_wait( wBarrier, RTEMS_NO_TIMEOUT ); - rtems_test_assert( status == RTEMS_SUCCESSFUL ); + rtems_test_assert( status == RTEMS_SUCCESSFUL ); puts( "Init - writing to /fifo - Expect EPIPE" ); - status = write(fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); + status = write( fd, sendBuf, SEND_RCV_BUFSIZ - 30 ); rtems_test_assert( status == -1 ); rtems_test_assert( errno == EPIPE ); @@ -274,11 +272,11 @@ rtems_task Init( rtems_test_assert( status == 0 ); puts( "Removing the fifo" ); - status = unlink("/fifo"); - rtems_test_assert(status == 0); - + status = unlink( "/fifo" ); + rtems_test_assert( status == 0 ); + TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER diff --git a/testsuites/sptests/spfreechain01/init.c b/testsuites/sptests/spfreechain01/init.c index e616cc0579..4578fbe92d 100644 --- a/testsuites/sptests/spfreechain01/init.c +++ b/testsuites/sptests/spfreechain01/init.c @@ -20,53 +20,55 @@ const char rtems_test_name[] = "SPFREECHAIN 1"; typedef struct { Chain_Node Node; - int x; + int x; } test_node; -static rtems_task Init(rtems_task_argument ignored) +static rtems_task Init( rtems_task_argument ignored ) { - (void) ignored; + (void) ignored; - Freechain_Control fc; - test_node *node; - test_node node2; + Freechain_Control fc; + test_node *node; + test_node node2; - TEST_BEGIN(); + TEST_BEGIN(); - _Freechain_Initialize(&fc, &node2, 1, sizeof(node2)); - rtems_test_assert(!_Freechain_Is_empty(&fc)); - rtems_test_assert(_Chain_Node_count_unprotected(&fc.Free) == 1); - rtems_test_assert(_Chain_First(&fc.Free) == &node2.Node); - rtems_test_assert(_Chain_Last(&fc.Free) == &node2.Node); + _Freechain_Initialize( &fc, &node2, 1, sizeof( node2 ) ); + rtems_test_assert( !_Freechain_Is_empty( &fc ) ); + rtems_test_assert( _Chain_Node_count_unprotected( &fc.Free ) == 1 ); + rtems_test_assert( _Chain_First( &fc.Free ) == &node2.Node ); + rtems_test_assert( _Chain_Last( &fc.Free ) == &node2.Node ); - node = _Freechain_Pop(&fc); - rtems_test_assert(_Freechain_Is_empty(&fc)); - rtems_test_assert(node == &node2); + node = _Freechain_Pop( &fc ); + rtems_test_assert( _Freechain_Is_empty( &fc ) ); + rtems_test_assert( node == &node2 ); - _Freechain_Initialize(&fc, NULL, 0, sizeof(test_node)); - rtems_test_assert(_Freechain_Is_empty(&fc)); + _Freechain_Initialize( &fc, NULL, 0, sizeof( test_node ) ); + rtems_test_assert( _Freechain_Is_empty( &fc ) ); - rtems_test_assert(_Freechain_Get(&fc, NULL, 0, sizeof(test_node)) == NULL); + rtems_test_assert( + _Freechain_Get( &fc, NULL, 0, sizeof( test_node ) ) == NULL + ); - rtems_test_assert(_Freechain_Get(&fc, malloc, 1, SIZE_MAX) == NULL); + rtems_test_assert( _Freechain_Get( &fc, malloc, 1, SIZE_MAX ) == NULL ); - /* check whether freechain put and get works correctly*/ + /* check whether freechain put and get works correctly*/ - _Freechain_Put(&fc, NULL); + _Freechain_Put( &fc, NULL ); - puts( "INIT - Get node from freechain - OK" ); - node = _Freechain_Get(&fc, malloc, 1, sizeof(test_node)); - node->x = 1; + puts( "INIT - Get node from freechain - OK" ); + node = _Freechain_Get( &fc, malloc, 1, sizeof( test_node ) ); + node->x = 1; - puts( "INIT - Put node back to freechain - OK" ); - _Freechain_Put(&fc, node); + puts( "INIT - Put node back to freechain - OK" ); + _Freechain_Put( &fc, node ); - puts( "INIT - Verify freechain node put and get - OK" ); - node = _Freechain_Get(&fc, NULL, 0, sizeof(test_node)); - rtems_test_assert(node->x == 1); + puts( "INIT - Verify freechain node put and get - OK" ); + node = _Freechain_Get( &fc, NULL, 0, sizeof( test_node ) ); + rtems_test_assert( node->x == 1 ); - TEST_END(); - rtems_test_exit(0); + TEST_END(); + rtems_test_exit( 0 ); } /* configuration information */ diff --git a/testsuites/sptests/spglobalcon02/init.c b/testsuites/sptests/spglobalcon02/init.c index f74ef497ba..240894846b 100644 --- a/testsuites/sptests/spglobalcon02/init.c +++ b/testsuites/sptests/spglobalcon02/init.c @@ -18,75 +18,73 @@ const char rtems_test_name[] = "SPGLOBALCON 2"; static int i; -static __attribute__((__constructor__(1000))) void c0(void) +static __attribute__(( __constructor__( 1000 ) )) void c0( void ) { - rtems_test_assert(i == 0); + rtems_test_assert( i == 0 ); ++i; } -static __attribute__((__constructor__(1001))) void c1(void) +static __attribute__(( __constructor__( 1001 ) )) void c1( void ) { - rtems_test_assert(i == 1); + rtems_test_assert( i == 1 ); ++i; } -static __attribute__((__constructor__(1002))) void c2(void) +static __attribute__(( __constructor__( 1002 ) )) void c2( void ) { - rtems_test_assert(i == 2); + rtems_test_assert( i == 2 ); ++i; } -static __attribute__((__constructor__)) void c(void) +static __attribute__(( __constructor__ )) void c( void ) { - rtems_test_assert(i == 3); + rtems_test_assert( i == 3 ); ++i; } -static __attribute__((__destructor__(1000))) void d0(void) +static __attribute__(( __destructor__( 1000 ) )) void d0( void ) { - rtems_test_assert(i == 8); + rtems_test_assert( i == 8 ); ++i; } -static __attribute__((__destructor__(1001))) void d1(void) +static __attribute__(( __destructor__( 1001 ) )) void d1( void ) { - rtems_test_assert(i == 7); + rtems_test_assert( i == 7 ); ++i; } -static __attribute__((__destructor__(1002))) void d2(void) +static __attribute__(( __destructor__( 1002 ) )) void d2( void ) { - rtems_test_assert(i == 6); + rtems_test_assert( i == 6 ); ++i; } -static __attribute__((__destructor__)) void d(void) +static __attribute__(( __destructor__ )) void d( void ) { - rtems_test_assert(i == 5); + rtems_test_assert( i == 5 ); ++i; } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; TEST_BEGIN(); - rtems_test_assert(i == 4); + rtems_test_assert( i == 4 ); ++i; - exit(0); + exit( 0 ); } static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { if ( - source == RTEMS_FATAL_SOURCE_EXIT - && !always_set_to_false - && error == 0 - && i == 9 + source == RTEMS_FATAL_SOURCE_EXIT && !always_set_to_false && error == 0 && + i == 9 ) { TEST_END(); } @@ -98,8 +96,7 @@ static void fatal_extension( #define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spheapprot/init.c b/testsuites/sptests/spheapprot/init.c index 0e0cb1a889..356c181827 100644 --- a/testsuites/sptests/spheapprot/init.c +++ b/testsuites/sptests/spheapprot/init.c @@ -43,108 +43,107 @@ const char rtems_test_name[] = "SPHEAPPROT"; #ifdef HEAP_PROTECTION - static void test_heap_block_error( - Heap_Control *heap, - Heap_Block *block, - Heap_Error_reason reason - ) - { - (void) block; - (void) reason; +static void test_heap_block_error( + Heap_Control *heap, + Heap_Block *block, + Heap_Error_reason reason +) +{ + (void) block; + (void) reason; - bool *error = heap->Protection.handler_data; + bool *error = heap->Protection.handler_data; - *error = true; - } + *error = true; +} - static void test_heap_initialize( - Heap_Control *heap, - void *begin, - uintptr_t size, - bool *error - ) - { - size = _Heap_Initialize(heap, begin, size, 0); - assert(size > 0); +static void test_heap_initialize( + Heap_Control *heap, + void *begin, + uintptr_t size, + bool *error +) +{ + size = _Heap_Initialize( heap, begin, size, 0 ); + assert( size > 0 ); - heap->Protection.handler_data = error; - heap->Protection.block_error = test_heap_block_error; + heap->Protection.handler_data = error; + heap->Protection.block_error = test_heap_block_error; - *error = false; - } + *error = false; +} - static void test_heap_protection(void) - { - Heap_Control heap; - Heap_Block *block = NULL; - char area [512]; - uintptr_t *p = NULL; - uintptr_t max_size = 0; - bool ok = false; - bool error = false; +static void test_heap_protection( void ) +{ + Heap_Control heap; + Heap_Block *block = NULL; + char area[ 512 ]; + uintptr_t *p = NULL; + uintptr_t max_size = 0; + bool ok = false; + bool error = false; - /* Test double free */ + /* Test double free */ - test_heap_initialize(&heap, area, sizeof(area), &error); + test_heap_initialize( &heap, area, sizeof( area ), &error ); - max_size = heap.stats.free_size - - HEAP_BLOCK_HEADER_SIZE + HEAP_ALLOC_BONUS; + max_size = heap.stats.free_size - HEAP_BLOCK_HEADER_SIZE + HEAP_ALLOC_BONUS; - p = _Heap_Allocate(&heap, max_size); - assert(p != NULL); + p = _Heap_Allocate( &heap, max_size ); + assert( p != NULL ); - ok = _Heap_Free(&heap, p); - assert(ok && !error); + ok = _Heap_Free( &heap, p ); + assert( ok && !error ); - ok = _Heap_Free(&heap, p); - assert(ok && error); + ok = _Heap_Free( &heap, p ); + assert( ok && error ); - /* Test begin overwrite */ + /* Test begin overwrite */ - test_heap_initialize(&heap, area, sizeof(area), &error); + test_heap_initialize( &heap, area, sizeof( area ), &error ); - p = _Heap_Allocate(&heap, max_size); - assert(p != NULL); + p = _Heap_Allocate( &heap, max_size ); + assert( p != NULL ); - *(p - 1) = 0; + *( p - 1 ) = 0; - ok = _Heap_Free(&heap, p); - assert(ok && error); + ok = _Heap_Free( &heap, p ); + assert( ok && error ); - /* Test end overwrite */ + /* Test end overwrite */ - test_heap_initialize(&heap, area, sizeof(area), &error); + test_heap_initialize( &heap, area, sizeof( area ), &error ); - p = _Heap_Allocate(&heap, max_size); - assert(p != NULL); + p = _Heap_Allocate( &heap, max_size ); + assert( p != NULL ); - *(uintptr_t *)((char *) p + max_size) = 0; + *(uintptr_t *) ( (char *) p + max_size ) = 0; - ok = _Heap_Free(&heap, p); - assert(ok && error); + ok = _Heap_Free( &heap, p ); + assert( ok && error ); - /* Test use after free */ + /* Test use after free */ - test_heap_initialize(&heap, area, sizeof(area), &error); + test_heap_initialize( &heap, area, sizeof( area ), &error ); - p = _Heap_Allocate(&heap, max_size); - assert(p != NULL); + p = _Heap_Allocate( &heap, max_size ); + assert( p != NULL ); - ok = _Heap_Free(&heap, p); - assert(ok && !error); + ok = _Heap_Free( &heap, p ); + assert( ok && !error ); - *p = 0; + *p = 0; - block = _Heap_Block_of_alloc_area((uintptr_t) p, heap.page_size); - block->Protection_begin.next_delayed_free_block = HEAP_PROTECTION_OBOLUS; - ok = _Heap_Free(&heap, p); - assert(ok && error); - } + block = _Heap_Block_of_alloc_area( (uintptr_t) p, heap.page_size ); + block->Protection_begin.next_delayed_free_block = HEAP_PROTECTION_OBOLUS; + ok = _Heap_Free( &heap, p ); + assert( ok && error ); +} #else - #define test_heap_protection() ((void) 0) + #define test_heap_protection() ( (void) 0 ) #endif -static rtems_task Init(rtems_task_argument argument) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -154,7 +153,7 @@ static rtems_task Init(rtems_task_argument argument) TEST_END(); - exit(0); + exit( 0 ); } #define CONFIGURE_INIT diff --git a/testsuites/sptests/spinternalerror01/init.c b/testsuites/sptests/spinternalerror01/init.c index 740c086e1b..e5884591b4 100644 --- a/testsuites/sptests/spinternalerror01/init.c +++ b/testsuites/sptests/spinternalerror01/init.c @@ -49,22 +49,20 @@ void boot_card( const char *cmdline ) static void fatal_extension( Internal_errors_Source source, - bool always_set_to_false, - Internal_errors_t error + bool always_set_to_false, + Internal_errors_t error ) { TEST_BEGIN(); if ( - source == FATAL_SOURCE - && !always_set_to_false - && error == FATAL_ERROR + source == FATAL_SOURCE && !always_set_to_false && error == FATAL_ERROR ) { TEST_END(); } } -static void *idle_body(uintptr_t ignored) +static void *idle_body( uintptr_t ignored ) { (void) ignored; @@ -75,20 +73,19 @@ static void *idle_body(uintptr_t ignored) return NULL; } -static void *stack_allocate(size_t size) +static void *stack_allocate( size_t size ) { (void) size; return NULL; } -static void stack_free(void *ptr) +static void stack_free( void *ptr ) { (void) ptr; } #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER @@ -100,7 +97,9 @@ static void stack_free(void *ptr) #define CONFIGURE_SCHEDULER -#define CONFIGURE_SCHEDULER_TABLE_ENTRIES { } +#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + { \ + } #define CONFIGURE_TASK_STACK_ALLOCATOR stack_allocate diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c index 747fab6aee..4662ac2c81 100644 --- a/testsuites/sptests/spinternalerror02/init.c +++ b/testsuites/sptests/spinternalerror02/init.c @@ -35,11 +35,11 @@ const char rtems_test_name[] = "SPINTERNALERROR 2"; -static void test_internal_error_text(void) +static void test_internal_error_text( void ) { rtems_fatal_code error = 0; - const char *text = NULL; - const char *text_last; + const char *text = NULL; + const char *text_last; do { text_last = text; @@ -48,16 +48,14 @@ static void test_internal_error_text(void) puts( text ); } while ( text != text_last ); - rtems_test_assert( - error - 3 == INTERNAL_ERROR_LIBIO_STDIN_FD_OPEN_FAILED - ); + rtems_test_assert( error - 3 == INTERNAL_ERROR_LIBIO_STDIN_FD_OPEN_FAILED ); } -static void test_fatal_source_text(void) +static void test_fatal_source_text( void ) { rtems_fatal_source source = 0; - const char *text = NULL; - const char *text_last; + const char *text = NULL; + const char *text_last; do { text_last = text; @@ -69,11 +67,11 @@ static void test_fatal_source_text(void) rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT ); } -static void test_status_text(void) +static void test_status_text( void ) { rtems_status_code code = 0; - const char *text = NULL; - const char *text_last; + const char *text = NULL; + const char *text_last; do { text_last = text; @@ -85,7 +83,7 @@ static void test_status_text(void) rtems_test_assert( code - 3 == RTEMS_PROXY_BLOCKING ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -97,7 +95,7 @@ static void Init(rtems_task_argument arg) TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/spintr_err01/init.c b/testsuites/sptests/spintr_err01/init.c index 025cde62d0..55434607d1 100644 --- a/testsuites/sptests/spintr_err01/init.c +++ b/testsuites/sptests/spintr_err01/init.c @@ -35,52 +35,51 @@ const char rtems_test_name[] = "SP INTERRUPT ERROR 1"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); - #if (CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE) - puts( - "TA1 - rtems_interrupt_catch - " - "bad handler RTEMS_INVALID_ADDRESS -- SKIPPED" - ); - puts( - "TA1 - rtems_interrupt_catch - " - "old isr RTEMS_INVALID_ADDRESS - SKIPPED" ); + #if ( CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE ) + puts( + "TA1 - rtems_interrupt_catch - " + "bad handler RTEMS_INVALID_ADDRESS -- SKIPPED" + ); + puts( + "TA1 - rtems_interrupt_catch - " + "old isr RTEMS_INVALID_ADDRESS - SKIPPED" + ); #else - rtems_status_code status; + rtems_status_code status; - rtems_isr_entry old_service_routine; - status = rtems_interrupt_catch( - Service_routine, - CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER + 1, - &old_service_routine - ); - fatal_directive_status( - status, - RTEMS_INVALID_NUMBER, - "rtems_interrupt_catch with invalid vector" - ); - puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER" ); + rtems_isr_entry old_service_routine; + status = rtems_interrupt_catch( + Service_routine, + CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER + 1, + &old_service_routine + ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_interrupt_catch with invalid vector" + ); + puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER" ); - status = rtems_interrupt_catch( NULL, 3, &old_service_routine ); - fatal_directive_status( - status, - RTEMS_INVALID_ADDRESS, - "rtems_interrupt_catch with invalid handler" - ); - puts( "TA1 - rtems_interrupt_catch - bad handler RTEMS_INVALID_ADDRESS" ); + status = rtems_interrupt_catch( NULL, 3, &old_service_routine ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_interrupt_catch with invalid handler" + ); + puts( "TA1 - rtems_interrupt_catch - bad handler RTEMS_INVALID_ADDRESS" ); - status = rtems_interrupt_catch( Service_routine, 3, NULL ); - fatal_directive_status( - status, - RTEMS_INVALID_ADDRESS, - "rtems_interrupt_catch with invalid old isr pointer" - ); - puts( "TA1 - rtems_interrupt_catch - old isr RTEMS_INVALID_ADDRESS" ); + status = rtems_interrupt_catch( Service_routine, 3, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_interrupt_catch with invalid old isr pointer" + ); + puts( "TA1 - rtems_interrupt_catch - old isr RTEMS_INVALID_ADDRESS" ); #endif TEST_END(); diff --git a/testsuites/sptests/spintr_err01/isr.c b/testsuites/sptests/spintr_err01/isr.c index a397d6967e..ccc9d54846 100644 --- a/testsuites/sptests/spintr_err01/isr.c +++ b/testsuites/sptests/spintr_err01/isr.c @@ -40,9 +40,7 @@ #include "system.h" -rtems_isr Service_routine( - rtems_vector_number ignored -) +rtems_isr Service_routine( rtems_vector_number ignored ) { (void) ignored; } diff --git a/testsuites/sptests/spintr_err01/system.h b/testsuites/sptests/spintr_err01/system.h index af1bac365b..cfbc4f07ea 100644 --- a/testsuites/sptests/spintr_err01/system.h +++ b/testsuites/sptests/spintr_err01/system.h @@ -35,51 +35,47 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_isr Service_routine( - rtems_vector_number ignored -); +rtems_isr Service_routine( rtems_vector_number ignored ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spintrcritical01/spintrcritical01impl.h b/testsuites/sptests/spintrcritical01/spintrcritical01impl.h index 8f18e08d0c..5e5a62a8db 100644 --- a/testsuites/sptests/spintrcritical01/spintrcritical01impl.h +++ b/testsuites/sptests/spintrcritical01/spintrcritical01impl.h @@ -37,31 +37,31 @@ #include -#if defined(FIFO_NO_TIMEOUT) +#if defined( FIFO_NO_TIMEOUT ) #define TEST_NAME "1" #define TEST_STRING FIFOWithoutTimeout #define SEMAPHORE_OBTAIN_TIMEOUT 0 #define SEMAPHORE_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES -#elif defined(FIFO_WITH_TIMEOUT) +#elif defined( FIFO_WITH_TIMEOUT ) #define TEST_NAME "2" #define TEST_STRING FIFOWithTimeout #define SEMAPHORE_OBTAIN_TIMEOUT 10 #define SEMAPHORE_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES -#elif defined(PRIORITY_NO_TIMEOUT) +#elif defined( PRIORITY_NO_TIMEOUT ) #define TEST_NAME "3" #define TEST_STRING PriorityWithoutTimeout #define SEMAPHORE_OBTAIN_TIMEOUT 0 #define SEMAPHORE_ATTRIBUTES RTEMS_PRIORITY -#elif defined(PRIORITY_WITH_TIMEOUT) +#elif defined( PRIORITY_WITH_TIMEOUT ) #define TEST_NAME "4" #define TEST_STRING PriorityWithTimeout #define SEMAPHORE_OBTAIN_TIMEOUT 10 #define SEMAPHORE_ATTRIBUTES RTEMS_PRIORITY -#elif defined(PRIORITY_NO_TIMEOUT_REVERSE) +#elif defined( PRIORITY_NO_TIMEOUT_REVERSE ) #define TEST_NAME "5" #define TEST_STRING PriorityWithoutTimeoutReverse #define SEMAPHORE_OBTAIN_TIMEOUT 0 @@ -86,16 +86,16 @@ static bool is_blocked( Thread_Wait_flags flags ) static bool interrupts_blocking_op( Thread_Wait_flags flags ) { - return flags - == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ); + return flags == + ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ); } static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; - T_interrupt_test_state state; - Thread_Wait_flags flags; - rtems_status_code status; + test_context *ctx; + T_interrupt_test_state state; + Thread_Wait_flags flags; + rtems_status_code status; ctx = arg; flags = _Thread_Wait_flags_get( ctx->thread ); @@ -116,8 +116,8 @@ static T_interrupt_test_state interrupt( void *arg ) static void action( void *arg ) { - test_context *ctx; - rtems_status_code status; + test_context *ctx; + rtems_status_code status; ctx = arg; status = rtems_semaphore_obtain( @@ -128,11 +128,8 @@ static void action( void *arg ) T_quiet_rsc_success( status ); } -static const T_interrupt_test_config config = { - .action = action, - .interrupt = interrupt, - .max_iteration_count = 10000 -}; +static const T_interrupt_test_config config = + { .action = action, .interrupt = interrupt, .max_iteration_count = 10000 }; T_TEST_CASE( RTEMS_XCONCAT( SemaphoreRelease, TEST_STRING ) ) { @@ -168,14 +165,14 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#if defined(PRIORITY_NO_TIMEOUT_REVERSE) - #define CONFIGURE_INIT_TASK_PRIORITY 250 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#if defined( PRIORITY_NO_TIMEOUT_REVERSE ) + #define CONFIGURE_INIT_TASK_PRIORITY 250 #endif -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spintrcritical08/init.c b/testsuites/sptests/spintrcritical08/init.c index d8cf13740b..9fb89f3965 100644 --- a/testsuites/sptests/spintrcritical08/init.c +++ b/testsuites/sptests/spintrcritical08/init.c @@ -47,7 +47,7 @@ typedef struct { Thread_Control *thread; } test_context; -static rtems_rate_monotonic_period_states getState(test_context *ctx) +static rtems_rate_monotonic_period_states getState( test_context *ctx ) { Rate_monotonic_Control *the_period; ISR_lock_Context lock_context; @@ -61,14 +61,14 @@ static rtems_rate_monotonic_period_states getState(test_context *ctx) static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; - Per_CPU_Control *cpu_self; - Watchdog_Header *header; - Watchdog_Control *watchdog; - T_interrupt_test_state state; - Thread_Wait_flags flags; - ISR_Level level; - rtems_rate_monotonic_period_states previous_period_state; + test_context *ctx; + Per_CPU_Control *cpu_self; + Watchdog_Header *header; + Watchdog_Control *watchdog; + T_interrupt_test_state state; + Thread_Wait_flags flags; + ISR_Level level; + rtems_rate_monotonic_period_states previous_period_state; state = T_interrupt_test_get_state(); @@ -99,15 +99,15 @@ static T_interrupt_test_state interrupt( void *arg ) state = T_INTERRUPT_TEST_DONE; } else if ( flags == THREAD_WAIT_STATE_READY ) { T_quiet_true( - previous_period_state == RATE_MONOTONIC_ACTIVE - || previous_period_state == RATE_MONOTONIC_EXPIRED + previous_period_state == RATE_MONOTONIC_ACTIVE || + previous_period_state == RATE_MONOTONIC_EXPIRED ); state = T_INTERRUPT_TEST_EARLY; } else { T_quiet_eq_int( flags, RATE_MONOTONIC_BLOCKED ); T_quiet_true( - previous_period_state == RATE_MONOTONIC_ACTIVE - || previous_period_state == RATE_MONOTONIC_EXPIRED + previous_period_state == RATE_MONOTONIC_ACTIVE || + previous_period_state == RATE_MONOTONIC_EXPIRED ); state = T_INTERRUPT_TEST_LATE; } @@ -117,8 +117,8 @@ static T_interrupt_test_state interrupt( void *arg ) static void prepare( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; @@ -140,8 +140,8 @@ static void prepare( void *arg ) static void action( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; @@ -160,11 +160,11 @@ static const T_interrupt_test_config config = { T_TEST_CASE( RateMonotonicPeriodInterrupt ) { - test_context ctx; - rtems_status_code sc; + test_context ctx; + rtems_status_code sc; T_interrupt_test_state state; - memset( &ctx, 0 , sizeof( ctx ) ); + memset( &ctx, 0, sizeof( ctx ) ); ctx.thread = _Thread_Get_executing(); sc = rtems_rate_monotonic_create( @@ -190,11 +190,11 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MICROSECONDS_PER_TICK 10000 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MICROSECONDS_PER_TICK 10000 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spintrcritical09/init.c b/testsuites/sptests/spintrcritical09/init.c index f63d19ac63..10a7d68632 100644 --- a/testsuites/sptests/spintrcritical09/init.c +++ b/testsuites/sptests/spintrcritical09/init.c @@ -56,11 +56,11 @@ static bool is_interrupt_timeout( test_context *ctx ) static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; - Per_CPU_Control *cpu_self; - Watchdog_Header *header; - Watchdog_Control *watchdog; - T_interrupt_test_state state; + test_context *ctx; + Per_CPU_Control *cpu_self; + Watchdog_Header *header; + Watchdog_Control *watchdog; + T_interrupt_test_state state; ctx = arg; cpu_self = _Per_CPU_Get(); @@ -68,9 +68,8 @@ static T_interrupt_test_state interrupt( void *arg ) watchdog = (Watchdog_Control *) header->first; if ( - watchdog != NULL - && watchdog->expire == cpu_self->Watchdog.ticks - && watchdog->routine == _Thread_Timeout + watchdog != NULL && watchdog->expire == cpu_self->Watchdog.ticks && + watchdog->routine == _Thread_Timeout ) { ISR_Level level; @@ -98,8 +97,8 @@ static T_interrupt_test_state interrupt( void *arg ) static void prepare( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; ctx->early = true; @@ -109,8 +108,8 @@ static void prepare( void *arg ) static void action( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; ctx->early = false; @@ -159,12 +158,12 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spintrcritical10/init.c b/testsuites/sptests/spintrcritical10/init.c index 6db1e477c9..eafc27655d 100644 --- a/testsuites/sptests/spintrcritical10/init.c +++ b/testsuites/sptests/spintrcritical10/init.c @@ -46,7 +46,7 @@ const char rtems_test_name[] = "SPINTRCRITICAL 10"; #define RED RTEMS_EVENT_1 -#define EVENTS (GREEN | RED) +#define EVENTS ( GREEN | RED ) #define DEADBEEF 0xdeadbeef @@ -54,28 +54,29 @@ typedef struct { Thread_Control *thread; } test_context; -static bool blocks_for_event(Thread_Wait_flags flags) +static bool blocks_for_event( Thread_Wait_flags flags ) { - return flags == (THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK) - || flags == (THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_BLOCKED); + return flags == + ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ) || + flags == ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_BLOCKED ); } -static bool interrupts_blocking_op(Thread_Wait_flags flags) +static bool interrupts_blocking_op( Thread_Wait_flags flags ) { - return - flags == (THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK); + return flags == + ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ); } -static T_interrupt_test_state any_satisfy_before_timeout_interrupt(void *arg) +static T_interrupt_test_state any_satisfy_before_timeout_interrupt( void *arg ) { - rtems_status_code sc; - test_context *ctx = arg; - Thread_Control *thread = ctx->thread; - Thread_Wait_flags flags = _Thread_Wait_flags_get(thread); + rtems_status_code sc; + test_context *ctx = arg; + Thread_Control *thread = ctx->thread; + Thread_Wait_flags flags = _Thread_Wait_flags_get( thread ); T_interrupt_test_state state; - if (blocks_for_event(flags)) { - if (interrupts_blocking_op(flags)) { + if ( blocks_for_event( flags ) ) { + if ( interrupts_blocking_op( flags ) ) { state = T_INTERRUPT_TEST_DONE; } else { state = T_INTERRUPT_TEST_LATE; @@ -84,38 +85,46 @@ static T_interrupt_test_state any_satisfy_before_timeout_interrupt(void *arg) rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == DEADBEEF ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - sc = rtems_event_send(thread->Object.id, GREEN); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( thread->Object.id, GREEN ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == GREEN ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - sc = rtems_event_send(thread->Object.id, RED); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( thread->Object.id, RED ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == GREEN ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - _Thread_Timeout(&thread->Timer.Watchdog); + _Thread_Timeout( &thread->Timer.Watchdog ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == GREEN ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - if (state == T_INTERRUPT_TEST_DONE) { + if ( state == T_INTERRUPT_TEST_DONE ) { rtems_test_assert( - _Thread_Wait_flags_get(thread) == THREAD_WAIT_STATE_READY + _Thread_Wait_flags_get( thread ) == THREAD_WAIT_STATE_READY ); } - rtems_test_assert(thread->Wait.count == EVENTS); + rtems_test_assert( thread->Wait.count == EVENTS ); } else { state = T_INTERRUPT_TEST_EARLY; } @@ -123,22 +132,22 @@ static T_interrupt_test_state any_satisfy_before_timeout_interrupt(void *arg) return state; } -static void any_satisfy_before_timeout_action(void *arg) +static void any_satisfy_before_timeout_action( void *arg ) { rtems_status_code sc; - rtems_event_set out; + rtems_event_set out; (void) arg; out = DEADBEEF; - sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ANY | RTEMS_WAIT, 1, &out); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == GREEN); + sc = rtems_event_receive( EVENTS, RTEMS_EVENT_ANY | RTEMS_WAIT, 1, &out ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == GREEN ); out = DEADBEEF; - sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ANY | RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == RED); + sc = rtems_event_receive( EVENTS, RTEMS_EVENT_ANY | RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == RED ); } static const T_interrupt_test_config any_satisfy_before_timeout_config = { @@ -147,26 +156,26 @@ static const T_interrupt_test_config any_satisfy_before_timeout_config = { .max_iteration_count = MAX_ITERATION_COUNT }; -T_TEST_CASE(EventAnySatisfyBeforeTimeout) +T_TEST_CASE( EventAnySatisfyBeforeTimeout ) { - test_context ctx; + test_context ctx; T_interrupt_test_state state; ctx.thread = _Thread_Get_executing(); - state = T_interrupt_test(&any_satisfy_before_timeout_config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &any_satisfy_before_timeout_config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); } -static T_interrupt_test_state all_satisfy_before_timeout_interrupt(void *arg) +static T_interrupt_test_state all_satisfy_before_timeout_interrupt( void *arg ) { - rtems_status_code sc; - test_context *ctx = arg; - Thread_Control *thread = ctx->thread; - Thread_Wait_flags flags = _Thread_Wait_flags_get(thread); + rtems_status_code sc; + test_context *ctx = arg; + Thread_Control *thread = ctx->thread; + Thread_Wait_flags flags = _Thread_Wait_flags_get( thread ); T_interrupt_test_state state; - if (blocks_for_event(flags)) { - if (interrupts_blocking_op(flags)) { + if ( blocks_for_event( flags ) ) { + if ( interrupts_blocking_op( flags ) ) { state = T_INTERRUPT_TEST_DONE; } else { state = T_INTERRUPT_TEST_LATE; @@ -175,38 +184,46 @@ static T_interrupt_test_state all_satisfy_before_timeout_interrupt(void *arg) rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == DEADBEEF ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - sc = rtems_event_send(thread->Object.id, GREEN); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( thread->Object.id, GREEN ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == DEADBEEF ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - sc = rtems_event_send(thread->Object.id, RED); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( thread->Object.id, RED ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == EVENTS ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - _Thread_Timeout(&thread->Timer.Watchdog); + _Thread_Timeout( &thread->Timer.Watchdog ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == EVENTS ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - if (state == T_INTERRUPT_TEST_DONE) { + if ( state == T_INTERRUPT_TEST_DONE ) { rtems_test_assert( - _Thread_Wait_flags_get(thread) == THREAD_WAIT_STATE_READY + _Thread_Wait_flags_get( thread ) == THREAD_WAIT_STATE_READY ); } - rtems_test_assert(thread->Wait.count == EVENTS); + rtems_test_assert( thread->Wait.count == EVENTS ); } else { state = T_INTERRUPT_TEST_EARLY; } @@ -214,17 +231,17 @@ static T_interrupt_test_state all_satisfy_before_timeout_interrupt(void *arg) return state; } -static void all_satisfy_before_timeout_action(void *arg) +static void all_satisfy_before_timeout_action( void *arg ) { (void) arg; rtems_status_code sc; - rtems_event_set out; + rtems_event_set out; out = DEADBEEF; - sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ALL | RTEMS_WAIT, 1, &out); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == EVENTS); + sc = rtems_event_receive( EVENTS, RTEMS_EVENT_ALL | RTEMS_WAIT, 1, &out ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == EVENTS ); } static const T_interrupt_test_config all_satisfy_before_timeout_config = { @@ -233,26 +250,26 @@ static const T_interrupt_test_config all_satisfy_before_timeout_config = { .max_iteration_count = MAX_ITERATION_COUNT }; -T_TEST_CASE(EventAllSatisfyBeforeTimeout) +T_TEST_CASE( EventAllSatisfyBeforeTimeout ) { - test_context ctx; + test_context ctx; T_interrupt_test_state state; ctx.thread = _Thread_Get_executing(); - state = T_interrupt_test(&all_satisfy_before_timeout_config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &all_satisfy_before_timeout_config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); } -static T_interrupt_test_state timeout_before_satisfied_interrupt(void *arg) +static T_interrupt_test_state timeout_before_satisfied_interrupt( void *arg ) { - rtems_status_code sc; - test_context *ctx = arg; - Thread_Control *thread = ctx->thread; - Thread_Wait_flags flags = _Thread_Wait_flags_get(thread); + rtems_status_code sc; + test_context *ctx = arg; + Thread_Control *thread = ctx->thread; + Thread_Wait_flags flags = _Thread_Wait_flags_get( thread ); T_interrupt_test_state state; - if (blocks_for_event(flags)) { - if (interrupts_blocking_op(flags)) { + if ( blocks_for_event( flags ) ) { + if ( interrupts_blocking_op( flags ) ) { state = T_INTERRUPT_TEST_DONE; } else { state = T_INTERRUPT_TEST_LATE; @@ -261,30 +278,32 @@ static T_interrupt_test_state timeout_before_satisfied_interrupt(void *arg) rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == DEADBEEF ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL); + rtems_test_assert( + _Thread_Wait_get_status( thread ) == STATUS_SUCCESSFUL + ); - _Thread_Timeout(&thread->Timer.Watchdog); + _Thread_Timeout( &thread->Timer.Watchdog ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == DEADBEEF ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_TIMEOUT); + rtems_test_assert( _Thread_Wait_get_status( thread ) == STATUS_TIMEOUT ); - sc = rtems_event_send(thread->Object.id, EVENTS); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( thread->Object.id, EVENTS ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( *(rtems_event_set *) thread->Wait.return_argument == DEADBEEF ); - rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_TIMEOUT); + rtems_test_assert( _Thread_Wait_get_status( thread ) == STATUS_TIMEOUT ); - if (state == T_INTERRUPT_TEST_DONE) { + if ( state == T_INTERRUPT_TEST_DONE ) { rtems_test_assert( - _Thread_Wait_flags_get(thread) == THREAD_WAIT_STATE_READY + _Thread_Wait_flags_get( thread ) == THREAD_WAIT_STATE_READY ); } - rtems_test_assert(thread->Wait.count == EVENTS); + rtems_test_assert( thread->Wait.count == EVENTS ); } else { state = T_INTERRUPT_TEST_EARLY; } @@ -292,22 +311,22 @@ static T_interrupt_test_state timeout_before_satisfied_interrupt(void *arg) return state; } -static void timeout_before_satisfied_action(void *arg) +static void timeout_before_satisfied_action( void *arg ) { (void) arg; - rtems_event_set out; + rtems_event_set out; rtems_status_code sc; out = DEADBEEF; - sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ALL | RTEMS_WAIT, 1, &out); - rtems_test_assert(sc == RTEMS_TIMEOUT); - rtems_test_assert(out == DEADBEEF); + sc = rtems_event_receive( EVENTS, RTEMS_EVENT_ALL | RTEMS_WAIT, 1, &out ); + rtems_test_assert( sc == RTEMS_TIMEOUT ); + rtems_test_assert( out == DEADBEEF ); out = DEADBEEF; - sc = rtems_event_receive(EVENTS, RTEMS_EVENT_ALL | RTEMS_NO_WAIT, 0, &out); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(out == EVENTS); + sc = rtems_event_receive( EVENTS, RTEMS_EVENT_ALL | RTEMS_NO_WAIT, 0, &out ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( out == EVENTS ); } static const T_interrupt_test_config timeout_before_satisfied_config = { @@ -316,14 +335,14 @@ static const T_interrupt_test_config timeout_before_satisfied_config = { .max_iteration_count = MAX_ITERATION_COUNT }; -T_TEST_CASE(EventTimeoutBeforeSatisfied) +T_TEST_CASE( EventTimeoutBeforeSatisfied ) { - test_context ctx; + test_context ctx; T_interrupt_test_state state; ctx.thread = _Thread_Get_executing(); - state = T_interrupt_test(&timeout_before_satisfied_config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &timeout_before_satisfied_config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); } static rtems_task Init( rtems_task_argument argument ) @@ -338,11 +357,11 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spintrcritical11/spintrcritical11impl.h b/testsuites/sptests/spintrcritical11/spintrcritical11impl.h index 73f0dd66ba..fe4090db11 100644 --- a/testsuites/sptests/spintrcritical11/spintrcritical11impl.h +++ b/testsuites/sptests/spintrcritical11/spintrcritical11impl.h @@ -37,17 +37,17 @@ #include #include -#if defined(EVENT_ANY) - #define TEST_NAME "11" - #define TEST_STRING Any - #define EVENTS_TO_SEND 0x1 - #define EVENTS_TO_RECEIVE 0x3 +#if defined( EVENT_ANY ) + #define TEST_NAME "11" + #define TEST_STRING Any + #define EVENTS_TO_SEND 0x1 + #define EVENTS_TO_RECEIVE 0x3 -#elif defined(EVENT_ALL) - #define TEST_NAME "12" - #define TEST_STRING All - #define EVENTS_TO_SEND 0x3 - #define EVENTS_TO_RECEIVE 0x3 +#elif defined( EVENT_ALL ) + #define TEST_NAME "12" + #define TEST_STRING All + #define EVENTS_TO_SEND 0x3 + #define EVENTS_TO_RECEIVE 0x3 #else #error "Test Mode not defined" @@ -65,9 +65,9 @@ typedef struct { static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; - T_interrupt_test_state state; - rtems_status_code sc; + test_context *ctx; + T_interrupt_test_state state; + rtems_status_code sc; state = T_interrupt_test_get_state(); @@ -93,23 +93,23 @@ static T_interrupt_test_state interrupt( void *arg ) static void prepare( void *arg ) { - test_context *ctx; - rtems_event_set out; + test_context *ctx; + rtems_event_set out; ctx = arg; ctx->early = true; ctx->late = false; - (void ) rtems_event_receive( RTEMS_PENDING_EVENTS, RTEMS_NO_WAIT, 0, &out ); + (void) rtems_event_receive( RTEMS_PENDING_EVENTS, RTEMS_NO_WAIT, 0, &out ); } static void action( void *arg ) { - test_context *ctx; - rtems_event_set out; + test_context *ctx; + rtems_event_set out; ctx = arg; ctx->early = false; - (void ) rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out ); + (void) rtems_event_receive( EVENTS_TO_RECEIVE, RTEMS_EVENT_ANY, 1, &out ); ctx->late = true; } @@ -145,11 +145,11 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spintrcritical13/spintrcritical13impl.h b/testsuites/sptests/spintrcritical13/spintrcritical13impl.h index 3b7604ac92..605695a7d4 100644 --- a/testsuites/sptests/spintrcritical13/spintrcritical13impl.h +++ b/testsuites/sptests/spintrcritical13/spintrcritical13impl.h @@ -37,15 +37,15 @@ #include #include -#if defined(FIRE_AFTER) - #define TEST_NAME "13" - #define TEST_STRING TimerFireAfterInterrupt - #define TEST_DIRECTIVE rtems_timer_fire_after +#if defined( FIRE_AFTER ) + #define TEST_NAME "13" + #define TEST_STRING TimerFireAfterInterrupt + #define TEST_DIRECTIVE rtems_timer_fire_after -#elif defined(SERVER_FIRE_AFTER) - #define TEST_NAME "14" - #define TEST_STRING TimerServerFireAfterInterrupt - #define TEST_DIRECTIVE rtems_timer_server_fire_after +#elif defined( SERVER_FIRE_AFTER ) + #define TEST_NAME "14" + #define TEST_STRING TimerServerFireAfterInterrupt + #define TEST_DIRECTIVE rtems_timer_server_fire_after #else #error "Test Mode not defined" @@ -54,16 +54,13 @@ const char rtems_test_name[] = "SPINTRCRITICAL " TEST_NAME; typedef struct { - rtems_id timer; - long potential_hits; + rtems_id timer; + long potential_hits; volatile bool early; volatile bool late; } test_context; -static rtems_timer_service_routine TimerMethod( - rtems_id timer, - void *arg -) +static rtems_timer_service_routine TimerMethod( rtems_id timer, void *arg ) { (void) timer; (void) arg; @@ -71,9 +68,9 @@ static rtems_timer_service_routine TimerMethod( static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; - rtems_status_code sc; - T_interrupt_test_state state; + test_context *ctx; + rtems_status_code sc; + T_interrupt_test_state state; state = T_interrupt_test_get_state(); @@ -113,8 +110,8 @@ static void prepare( void *arg ) static void action( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; ctx->early = false; @@ -155,7 +152,7 @@ T_TEST_CASE( TEST_STRING ) static rtems_task Init( rtems_task_argument argument ) { -#if defined(SERVER_FIRE_AFTER) +#if defined( SERVER_FIRE_AFTER ) (void) rtems_timer_initiate_server( RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, @@ -171,14 +168,14 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#if defined(SERVER_FIRE_AFTER) - #define CONFIGURE_MAXIMUM_TASKS 3 +#if defined( SERVER_FIRE_AFTER ) + #define CONFIGURE_MAXIMUM_TASKS 3 #else - #define CONFIGURE_MAXIMUM_TASKS 2 + #define CONFIGURE_MAXIMUM_TASKS 2 #endif -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spintrcritical15/init.c b/testsuites/sptests/spintrcritical15/init.c index 3295b6214b..108530d3c2 100644 --- a/testsuites/sptests/spintrcritical15/init.c +++ b/testsuites/sptests/spintrcritical15/init.c @@ -39,33 +39,33 @@ const char rtems_test_name[] = "SPINTRCRITICAL 15"; -#define INIT_PRIORITY 2 -#define BLOCKER_PRIORITY 1 +#define INIT_PRIORITY 2 +#define BLOCKER_PRIORITY 1 typedef struct { - rtems_id secondary_task_id; - rtems_id semaphore; + rtems_id secondary_task_id; + rtems_id semaphore; Thread_Control *main_thread; } test_context; static rtems_task Secondary_task( rtems_task_argument arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = (test_context *) arg; - while (1) { + while ( 1 ) { sc = rtems_semaphore_obtain( ctx->semaphore, RTEMS_DEFAULT_OPTIONS, 1 ); T_quiet_rsc( sc, RTEMS_TIMEOUT ); } } -static T_interrupt_test_state interrupt(void *arg) +static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; - Thread_Wait_flags flags; - T_interrupt_test_state state; + test_context *ctx; + Thread_Wait_flags flags; + T_interrupt_test_state state; ctx = arg; flags = _Thread_Wait_flags_get( ctx->main_thread ); @@ -87,8 +87,8 @@ static T_interrupt_test_state interrupt(void *arg) static void prepare( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; sc = rtems_task_restart( ctx->secondary_task_id, (rtems_task_argument) ctx ); @@ -97,8 +97,8 @@ static void prepare( void *arg ) static void action( void *arg ) { - test_context *ctx; - rtems_status_code sc; + test_context *ctx; + rtems_status_code sc; ctx = arg; sc = rtems_semaphore_obtain( ctx->semaphore, RTEMS_DEFAULT_OPTIONS, 1 ); @@ -166,12 +166,12 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_INIT_TASK_PRIORITY INIT_PRIORITY +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_INIT_TASK_PRIORITY INIT_PRIORITY #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spintrcritical16/init.c b/testsuites/sptests/spintrcritical16/init.c index 612f92f4e1..8a898f80c4 100644 --- a/testsuites/sptests/spintrcritical16/init.c +++ b/testsuites/sptests/spintrcritical16/init.c @@ -46,14 +46,14 @@ typedef struct { static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; + test_context *ctx; T_interrupt_test_state state; - Thread_Wait_flags flags; - rtems_status_code sc; + Thread_Wait_flags flags; + rtems_status_code sc; state = T_interrupt_test_get_state(); - if (state != T_INTERRUPT_TEST_ACTION) { + if ( state != T_INTERRUPT_TEST_ACTION ) { return T_INTERRUPT_TEST_CONTINUE; } @@ -80,7 +80,7 @@ static T_interrupt_test_state interrupt( void *arg ) static void prepare( void *arg ) { - test_context *ctx; + test_context *ctx; rtems_status_code sc; ctx = arg; @@ -92,7 +92,7 @@ static void prepare( void *arg ) static void action( void *arg ) { - test_context *ctx; + test_context *ctx; rtems_status_code sc; ctx = arg; @@ -102,7 +102,7 @@ static void action( void *arg ) static void blocked( void *arg ) { - test_context *ctx; + test_context *ctx; rtems_status_code sc; T_interrupt_test_change_state( @@ -129,8 +129,8 @@ static const T_interrupt_test_config config = { */ T_TEST_CASE( SemaphoreSatisfyBeforeTimeout ) { - test_context ctx; - rtems_status_code sc; + test_context ctx; + rtems_status_code sc; T_interrupt_test_state state; ctx.thread = _Thread_Get_executing(); @@ -161,10 +161,10 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spintrcritical18/init.c b/testsuites/sptests/spintrcritical18/init.c index 61ff82df55..3a4c7a3279 100644 --- a/testsuites/sptests/spintrcritical18/init.c +++ b/testsuites/sptests/spintrcritical18/init.c @@ -43,13 +43,13 @@ const char rtems_test_name[] = "SPINTRCRITICAL 18"; #define PRIORITY_HIGH 1 typedef struct { - rtems_id middle_priority_task; - rtems_id high_priority_task; - bool high_priority_task_activated; + rtems_id middle_priority_task; + rtems_id high_priority_task; + bool high_priority_task_activated; volatile bool early; volatile bool switching; volatile bool late; - long potential_hits; + long potential_hits; } test_context; static void wake_up( rtems_id task ) @@ -63,7 +63,7 @@ static void wake_up( rtems_id task ) static void wait_for_wake_up( void ) { rtems_status_code sc; - rtems_event_set events; + rtems_event_set events; sc = rtems_event_receive( WAKE_UP, @@ -77,7 +77,7 @@ static void wait_for_wake_up( void ) static T_interrupt_test_state active_high_priority_task( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; T_interrupt_test_state state; state = T_interrupt_test_get_state(); @@ -150,7 +150,7 @@ static void action( void *arg ) static void blocked( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; T_interrupt_test_state state; state = T_interrupt_test_change_state( @@ -173,11 +173,11 @@ static const T_interrupt_test_config config = { .max_iteration_count = 10000 }; -T_TEST_CASE(InterruptDuringThreadDispatch) +T_TEST_CASE( InterruptDuringThreadDispatch ) { T_interrupt_test_state state; - test_context ctx; - rtems_status_code sc; + test_context ctx; + rtems_status_code sc; memset( &ctx, 0, sizeof( ctx ) ); @@ -237,8 +237,8 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_INIT_TASK_PRIORITY PRIORITY_LOW -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES +#define CONFIGURE_INIT_TASK_PRIORITY PRIORITY_LOW +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spintrcritical20/init.c b/testsuites/sptests/spintrcritical20/init.c index c1521c8969..2a9f22bbd2 100644 --- a/testsuites/sptests/spintrcritical20/init.c +++ b/testsuites/sptests/spintrcritical20/init.c @@ -45,56 +45,55 @@ const char rtems_test_name[] = "SPINTRCRITICAL 20"; #define PRIORITY_SEMAPHORE 1 typedef struct { - rtems_id master_task; - rtems_id semaphore_task; - rtems_id semaphore_id; + rtems_id master_task; + rtems_id semaphore_task; + rtems_id semaphore_id; Thread_Control *semaphore_task_tcb; - bool thread_queue_was_null; - bool status_was_successful; - bool status_was_timeout; - volatile bool early; - volatile bool late; + bool thread_queue_was_null; + bool status_was_successful; + bool status_was_timeout; + volatile bool early; + volatile bool late; } test_context; -static void semaphore_task(rtems_task_argument arg) +static void semaphore_task( rtems_task_argument arg ) { test_context *ctx = (test_context *) arg; ctx->semaphore_task_tcb = _Thread_Get_executing(); - while (true) { + while ( true ) { rtems_status_code sc = rtems_semaphore_obtain( ctx->semaphore_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - T_quiet_true(sc == RTEMS_SUCCESSFUL || sc == RTEMS_TIMEOUT); + T_quiet_true( sc == RTEMS_SUCCESSFUL || sc == RTEMS_TIMEOUT ); } } -static T_interrupt_test_state interrupt(void *arg) +static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; T_interrupt_test_state state; - rtems_status_code sc; + rtems_status_code sc; state = T_interrupt_test_get_state(); - if (state != T_INTERRUPT_TEST_ACTION) { + if ( state != T_INTERRUPT_TEST_ACTION ) { return T_INTERRUPT_TEST_CONTINUE; } - sc = rtems_semaphore_release(ctx->semaphore_id); - T_quiet_rsc_success(sc); + sc = rtems_semaphore_release( ctx->semaphore_id ); + T_quiet_rsc_success( sc ); if ( ctx->early ) { state = T_INTERRUPT_TEST_EARLY; } else if ( ctx->late ) { state = T_INTERRUPT_TEST_LATE; } else if ( - ctx->thread_queue_was_null - && ctx->status_was_successful - && ctx->status_was_timeout + ctx->thread_queue_was_null && ctx->status_was_successful && + ctx->status_was_timeout ) { state = T_INTERRUPT_TEST_DONE; } else { @@ -104,7 +103,7 @@ static T_interrupt_test_state interrupt(void *arg) return state; } -static void prepare(void *arg) +static void prepare( void *arg ) { test_context *ctx = arg; @@ -112,23 +111,23 @@ static void prepare(void *arg) ctx->late = false; } -static void action(void *arg) +static void action( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; Per_CPU_Control *cpu_self; cpu_self = _Thread_Dispatch_disable(); ctx->early = false; - T_quiet_rsc_success(_Thread_Wait_get_status( ctx->semaphore_task_tcb )); + T_quiet_rsc_success( _Thread_Wait_get_status( ctx->semaphore_task_tcb ) ); - if (ctx->semaphore_task_tcb->Wait.queue == NULL) { + if ( ctx->semaphore_task_tcb->Wait.queue == NULL ) { ctx->thread_queue_was_null = true; } - _Thread_Timeout(&ctx->semaphore_task_tcb->Timer.Watchdog); + _Thread_Timeout( &ctx->semaphore_task_tcb->Timer.Watchdog ); - switch (_Thread_Wait_get_status(ctx->semaphore_task_tcb)) { + switch ( _Thread_Wait_get_status( ctx->semaphore_task_tcb ) ) { case STATUS_SUCCESSFUL: ctx->status_was_successful = true; break; @@ -141,7 +140,7 @@ static void action(void *arg) } ctx->late = true; - _Thread_Dispatch_enable(cpu_self); + _Thread_Dispatch_enable( cpu_self ); T_interrupt_test_busy_wait_for_interrupt(); } @@ -153,58 +152,58 @@ static const T_interrupt_test_config config = { .max_iteration_count = 10000 }; -T_TEST_CASE(SemaphoreObtainTimeoutInterrupt) +T_TEST_CASE( SemaphoreObtainTimeoutInterrupt ) { - test_context ctx; - rtems_status_code sc; + test_context ctx; + rtems_status_code sc; T_interrupt_test_state state; - memset(&ctx, 0, sizeof(ctx)); + memset( &ctx, 0, sizeof( ctx ) ); ctx.master_task = rtems_task_self(); sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 1, RTEMS_COUNTING_SEMAPHORE, 0, &ctx.semaphore_id ); - T_assert_rsc_success(sc); + T_assert_rsc_success( sc ); sc = rtems_task_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), PRIORITY_SEMAPHORE, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx.semaphore_task ); - T_assert_rsc_success(sc); + T_assert_rsc_success( sc ); sc = rtems_task_start( ctx.semaphore_task, semaphore_task, (rtems_task_argument) &ctx ); - T_assert_rsc_success(sc); + T_assert_rsc_success( sc ); - state = T_interrupt_test(&config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); - T_true(ctx.thread_queue_was_null); - T_true(ctx.status_was_successful); - T_true(ctx.status_was_timeout); + T_true( ctx.thread_queue_was_null ); + T_true( ctx.status_was_successful ); + T_true( ctx.status_was_timeout ); - sc = rtems_task_delete(ctx.semaphore_task); - T_rsc_success(sc); + sc = rtems_task_delete( ctx.semaphore_task ); + T_rsc_success( sc ); - sc = rtems_semaphore_delete(ctx.semaphore_id); - T_rsc_success(sc); + sc = rtems_semaphore_delete( ctx.semaphore_id ); + T_rsc_success( sc ); } -static rtems_task Init(rtems_task_argument argument) +static rtems_task Init( rtems_task_argument argument ) { - rtems_test_run(argument, TEST_STATE); + rtems_test_run( argument, TEST_STATE ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER @@ -213,10 +212,10 @@ static rtems_task Init(rtems_task_argument argument) #define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_INIT_TASK_PRIORITY PRIORITY_MASTER -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES +#define CONFIGURE_INIT_TASK_PRIORITY PRIORITY_MASTER +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spintrcritical21/init.c b/testsuites/sptests/spintrcritical21/init.c index 6c675e1669..acb3a796ad 100644 --- a/testsuites/sptests/spintrcritical21/init.c +++ b/testsuites/sptests/spintrcritical21/init.c @@ -69,15 +69,13 @@ static bool is_blocked( Thread_Wait_flags flags ) static bool interrupts_blocking_op( Thread_Wait_flags flags ) { - return flags - == ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ); + return flags == + ( THREAD_WAIT_CLASS_EVENT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ); } -static T_interrupt_test_state event_from_isr_interrupt( - void *arg -) +static T_interrupt_test_state event_from_isr_interrupt( void *arg ) { - test_context *ctx; + test_context *ctx; T_interrupt_test_state state; Thread_Wait_flags flags; rtems_status_code status; @@ -130,7 +128,7 @@ static const T_interrupt_test_config event_from_isr_config = { .max_iteration_count = MAX_ITERATION_COUNT }; -T_TEST_CASE(EventFromISR) +T_TEST_CASE( EventFromISR ) { test_context ctx; T_interrupt_test_state state; @@ -162,10 +160,10 @@ static T_interrupt_test_state event_with_timeout_from_isr_interrupt( void *arg ) { - test_context *ctx; - T_interrupt_test_state state; - Thread_Wait_flags flags; - rtems_status_code status; + test_context *ctx; + T_interrupt_test_state state; + Thread_Wait_flags flags; + rtems_status_code status; ctx = arg; flags = _Thread_Wait_flags_get( ctx->main_thread ); @@ -234,8 +232,8 @@ static rtems_task Init( rtems_task_argument argument ) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #include diff --git a/testsuites/sptests/spintrcritical22/init.c b/testsuites/sptests/spintrcritical22/init.c index 73c9c6226c..0f3156c5be 100644 --- a/testsuites/sptests/spintrcritical22/init.c +++ b/testsuites/sptests/spintrcritical22/init.c @@ -37,91 +37,83 @@ const char rtems_test_name[] = "SPINTRCRITICAL 22"; typedef struct { - rtems_id semaphore_id; + rtems_id semaphore_id; Semaphore_Control *semaphore_control; - Thread_Control *main_task_control; + Thread_Control *main_task_control; } test_context; -static Semaphore_Control *get_semaphore_control(rtems_id id) +static Semaphore_Control *get_semaphore_control( rtems_id id ) { Thread_queue_Context queue_context; - Semaphore_Control *sem; + Semaphore_Control *sem; - sem = _Semaphore_Get(id, &queue_context); - rtems_test_assert(sem != NULL); - _ISR_lock_ISR_enable(&queue_context.Lock_context.Lock_context); + sem = _Semaphore_Get( id, &queue_context ); + rtems_test_assert( sem != NULL ); + _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context ); return sem; } -static T_interrupt_test_state release_semaphore(void *arg) +static T_interrupt_test_state release_semaphore( void *arg ) { - test_context *ctx = arg; - rtems_status_code sc; - Thread_Wait_flags flags; + test_context *ctx = arg; + rtems_status_code sc; + Thread_Wait_flags flags; T_interrupt_test_state state; - flags = _Thread_Wait_flags_get(ctx->main_task_control); + flags = _Thread_Wait_flags_get( ctx->main_task_control ); if ( - flags == (THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK) + flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_INTEND_TO_BLOCK ) ) { CORE_semaphore_Control *sem; state = T_INTERRUPT_TEST_DONE; - sc = rtems_semaphore_release(ctx->semaphore_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->semaphore_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_test_assert( - _Thread_Wait_flags_get(ctx->main_task_control) - == THREAD_WAIT_STATE_READY + _Thread_Wait_flags_get( ctx->main_task_control ) == + THREAD_WAIT_STATE_READY ); sem = &ctx->semaphore_control->Core_control.Semaphore; - rtems_test_assert(sem->count == 0); + rtems_test_assert( sem->count == 0 ); } else { - if (flags == (THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_BLOCKED)) { + if ( flags == ( THREAD_WAIT_CLASS_OBJECT | THREAD_WAIT_STATE_BLOCKED ) ) { state = T_INTERRUPT_TEST_LATE; } else { state = T_INTERRUPT_TEST_EARLY; } - sc = rtems_semaphore_release(ctx->semaphore_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->semaphore_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } return state; } -static void action(void *arg) +static void action( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; rtems_status_code sc; - sc = rtems_semaphore_obtain( - ctx->semaphore_id, - RTEMS_WAIT, - 2 - ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->semaphore_id, RTEMS_WAIT, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void prepare(void *arg) +static void prepare( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; rtems_status_code sc; - sc = rtems_semaphore_obtain( - ctx->semaphore_id, - RTEMS_NO_WAIT, - 0 - ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL || sc == RTEMS_UNSATISFIED); + sc = rtems_semaphore_obtain( ctx->semaphore_id, RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL || sc == RTEMS_UNSATISFIED ); } -static void blocked(void *arg) +static void blocked( void *arg ) { - test_context *ctx = arg; + test_context *ctx = arg; rtems_status_code sc; T_interrupt_test_change_state( @@ -129,8 +121,8 @@ static void blocked(void *arg) T_INTERRUPT_TEST_LATE ); - sc = rtems_semaphore_release(ctx->semaphore_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->semaphore_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } static const T_interrupt_test_config config = { @@ -141,35 +133,35 @@ static const T_interrupt_test_config config = { .max_iteration_count = 10000 }; -T_TEST_CASE(InterruptSemaphoreObtain) +T_TEST_CASE( InterruptSemaphoreObtain ) { - test_context ctx; - rtems_status_code sc; + test_context ctx; + rtems_status_code sc; T_interrupt_test_state state; ctx.main_task_control = _Thread_Get_executing(); sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 1, RTEMS_SIMPLE_BINARY_SEMAPHORE, 0, &ctx.semaphore_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - ctx.semaphore_control = get_semaphore_control(ctx.semaphore_id); + ctx.semaphore_control = get_semaphore_control( ctx.semaphore_id ); - state = T_interrupt_test(&config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); - sc = rtems_semaphore_delete(ctx.semaphore_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( ctx.semaphore_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void Init(rtems_task_argument argument) +static void Init( rtems_task_argument argument ) { - rtems_test_run(argument, TEST_STATE); + rtems_test_run( argument, TEST_STATE ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER @@ -178,7 +170,7 @@ static void Init(rtems_task_argument argument) #define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spintrcritical23/init.c b/testsuites/sptests/spintrcritical23/init.c index ebc50fdb2d..b8e8b562e3 100644 --- a/testsuites/sptests/spintrcritical23/init.c +++ b/testsuites/sptests/spintrcritical23/init.c @@ -41,29 +41,29 @@ const char rtems_test_name[] = "SPINTRCRITICAL 23"; typedef struct { - RTEMS_INTERRUPT_LOCK_MEMBER(lock) - rtems_id task_id; + RTEMS_INTERRUPT_LOCK_MEMBER( lock ) + rtems_id task_id; Scheduler_priority_Node *scheduler_node; - rtems_task_priority priority_task; - rtems_task_priority priority_interrupt; - volatile bool early; - volatile bool late; + rtems_task_priority priority_task; + rtems_task_priority priority_interrupt; + volatile bool early; + volatile bool late; } test_context; -static T_interrupt_test_state interrupt(void *arg) +static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx = arg; - T_interrupt_test_state state; + test_context *ctx = arg; + T_interrupt_test_state state; rtems_interrupt_lock_context lock_context; - unsigned int next_priority; + unsigned int next_priority; state = T_interrupt_test_get_state(); - if (state != T_INTERRUPT_TEST_ACTION) { + if ( state != T_INTERRUPT_TEST_ACTION ) { return T_INTERRUPT_TEST_CONTINUE; } - rtems_interrupt_lock_acquire(&ctx->lock, &lock_context); + rtems_interrupt_lock_acquire( &ctx->lock, &lock_context ); next_priority = SCHEDULER_PRIORITY_UNMAP( (unsigned int) ctx->scheduler_node->Base.Priority.value @@ -73,24 +73,24 @@ static T_interrupt_test_state interrupt(void *arg) rtems_task_priority priority_interrupt; rtems_task_priority priority_task; rtems_task_priority previous; - rtems_status_code sc; + rtems_status_code sc; priority_interrupt = ctx->priority_interrupt; priority_task = ctx->priority_task; - rtems_interrupt_lock_release(&ctx->lock, &lock_context); + rtems_interrupt_lock_release( &ctx->lock, &lock_context ); sc = rtems_task_set_priority( ctx->task_id, priority_interrupt, &previous ); - T_quiet_rsc_success(sc); - T_quiet_eq_u32(previous, priority_task); + T_quiet_rsc_success( sc ); + T_quiet_eq_u32( previous, priority_task ); state = T_INTERRUPT_TEST_DONE; } else { - rtems_interrupt_lock_release(&ctx->lock, &lock_context); + rtems_interrupt_lock_release( &ctx->lock, &lock_context ); if ( ctx->early ) { state = T_INTERRUPT_TEST_EARLY; @@ -104,7 +104,7 @@ static T_interrupt_test_state interrupt(void *arg) return state; } -static void prepare(void *arg) +static void prepare( void *arg ) { test_context *ctx = arg; @@ -112,44 +112,40 @@ static void prepare(void *arg) ctx->late = false; } -static void action(void *arg) +static void action( void *arg ) { - test_context *ctx = arg; - rtems_status_code sc; + test_context *ctx = arg; + rtems_status_code sc; rtems_interrupt_lock_context lock_context; - rtems_task_priority priority_last; - rtems_task_priority priority_task; - rtems_task_priority priority_interrupt; - rtems_task_priority previous; + rtems_task_priority priority_last; + rtems_task_priority priority_task; + rtems_task_priority priority_interrupt; + rtems_task_priority previous; - rtems_interrupt_lock_acquire(&ctx->lock, &lock_context); + rtems_interrupt_lock_acquire( &ctx->lock, &lock_context ); priority_last = ctx->priority_task; - priority_task = 1 + (priority_last + 1) % 3; - priority_interrupt = 1 + (priority_task + 1) % 3; + priority_task = 1 + ( priority_last + 1 ) % 3; + priority_interrupt = 1 + ( priority_task + 1 ) % 3; ctx->priority_task = priority_task; ctx->priority_interrupt = priority_interrupt; - rtems_interrupt_lock_release(&ctx->lock, &lock_context); + rtems_interrupt_lock_release( &ctx->lock, &lock_context ); ctx->early = false; - sc = rtems_task_set_priority( - ctx->task_id, - priority_task, - &previous - ); - T_quiet_rsc_success(RTEMS_SUCCESSFUL); - T_quiet_eq_u32(previous, priority_last); + sc = rtems_task_set_priority( ctx->task_id, priority_task, &previous ); + T_quiet_rsc_success( RTEMS_SUCCESSFUL ); + T_quiet_eq_u32( previous, priority_last ); ctx->late = true; - if (T_interrupt_test_get_state() == T_INTERRUPT_TEST_DONE) { + if ( T_interrupt_test_get_state() == T_INTERRUPT_TEST_DONE ) { sc = rtems_task_set_priority( ctx->task_id, RTEMS_CURRENT_PRIORITY, &previous ); - T_quiet_rsc_success(sc); - T_quiet_eq_u32(previous, priority_interrupt); + T_quiet_rsc_success( sc ); + T_quiet_eq_u32( previous, priority_interrupt ); } } @@ -160,35 +156,36 @@ static const T_interrupt_test_config config = { .max_iteration_count = 10000 }; -T_TEST_CASE(TaskSetPriorityInterrupt) +T_TEST_CASE( TaskSetPriorityInterrupt ) { - test_context ctx; + test_context ctx; T_interrupt_test_state state; - rtems_status_code sc; - rtems_task_priority prio; + rtems_status_code sc; + rtems_task_priority prio; - sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio); - T_rsc_success(sc); + sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio ); + T_rsc_success( sc ); - memset(&ctx, 0, sizeof(ctx)); - rtems_interrupt_lock_initialize(&ctx.lock, "Test"); + memset( &ctx, 0, sizeof( ctx ) ); + rtems_interrupt_lock_initialize( &ctx.lock, "Test" ); ctx.priority_task = 1; ctx.task_id = rtems_task_self(); - ctx.scheduler_node = - _Scheduler_priority_Thread_get_node(_Thread_Get_executing()); + ctx.scheduler_node = _Scheduler_priority_Thread_get_node( + _Thread_Get_executing() + ); - state = T_interrupt_test(&config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); - rtems_interrupt_lock_destroy(&ctx.lock); + rtems_interrupt_lock_destroy( &ctx.lock ); - sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio); - T_rsc_success(sc); + sc = rtems_task_set_priority( RTEMS_SELF, prio, &prio ); + T_rsc_success( sc ); } -static rtems_task Init(rtems_task_argument argument) +static rtems_task Init( rtems_task_argument argument ) { - rtems_test_run(argument, TEST_STATE); + rtems_test_run( argument, TEST_STATE ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/spintrcritical24/init.c b/testsuites/sptests/spintrcritical24/init.c index 6f686b1564..eef3ecf830 100644 --- a/testsuites/sptests/spintrcritical24/init.c +++ b/testsuites/sptests/spintrcritical24/init.c @@ -43,26 +43,26 @@ const char rtems_test_name[] = "SPINTRCRITICAL 24"; typedef struct { - int fd; + int fd; rtems_libio_t *iop; - long early_count; - long late_count; - long potential_hit_count; - long append_count; - long no_append_count; - volatile bool closed; + long early_count; + long late_count; + long potential_hit_count; + long append_count; + long no_append_count; + volatile bool closed; } test_context; static const char path[] = "generic"; -static int handler_close(rtems_libio_t *iop) +static int handler_close( rtems_libio_t *iop ) { test_context *ctx; - ctx = IMFS_generic_get_context_by_iop(iop); + ctx = IMFS_generic_get_context_by_iop( iop ); ctx->closed = true; - if (rtems_libio_iop_is_append(iop)) { + if ( rtems_libio_iop_is_append( iop ) ) { ++ctx->append_count; } else { ++ctx->no_append_count; @@ -85,69 +85,69 @@ static const IMFS_node_control node_control = { .node_destroy = IMFS_node_destroy_default }; -static T_interrupt_test_state interrupt(void *arg) +static T_interrupt_test_state interrupt( void *arg ) { - test_context *ctx; + test_context *ctx; T_interrupt_test_state state; - int rv; - unsigned int flags; + int rv; + unsigned int flags; state = T_interrupt_test_get_state(); - if (state != T_INTERRUPT_TEST_ACTION) { + if ( state != T_INTERRUPT_TEST_ACTION ) { return T_INTERRUPT_TEST_CONTINUE; } ctx = arg; - flags = rtems_libio_iop_flags_set(ctx->iop, 0); + flags = rtems_libio_iop_flags_set( ctx->iop, 0 ); - if ((flags & LIBIO_FLAGS_OPEN) != 0) { + if ( ( flags & LIBIO_FLAGS_OPEN ) != 0 ) { ++ctx->early_count; state = T_INTERRUPT_TEST_EARLY; - } else if (ctx->closed) { + } else if ( ctx->closed ) { ++ctx->late_count; state = T_INTERRUPT_TEST_LATE; } else { ++ctx->potential_hit_count; - if (ctx->potential_hit_count >= 13) { + if ( ctx->potential_hit_count >= 13 ) { state = T_INTERRUPT_TEST_DONE; } else { state = T_INTERRUPT_TEST_CONTINUE; } } - rv = fcntl(ctx->fd, F_SETFL, O_APPEND); + rv = fcntl( ctx->fd, F_SETFL, O_APPEND ); - if (rv != 0) { - T_quiet_psx_error(rv, EBADF); + if ( rv != 0 ) { + T_quiet_psx_error( rv, EBADF ); } return state; } -static void prepare(void *arg) +static void prepare( void *arg ) { test_context *ctx; ctx = arg; - ctx->fd = open(path, O_RDWR); - T_quiet_ge_int(ctx->fd, 0); + ctx->fd = open( path, O_RDWR ); + T_quiet_ge_int( ctx->fd, 0 ); ctx->closed = false; - ctx->iop = rtems_libio_iop(ctx->fd); + ctx->iop = rtems_libio_iop( ctx->fd ); } -static void action(void *arg) +static void action( void *arg ) { test_context *ctx; - int rv; + int rv; ctx = arg; - rv = close(ctx->fd); - T_quiet_psx_success(rv); + rv = close( ctx->fd ); + T_quiet_psx_success( rv ); T_interrupt_test_busy_wait_for_interrupt(); } @@ -159,14 +159,14 @@ static const T_interrupt_test_config config = { .max_iteration_count = 10000 }; -T_TEST_CASE(CloseInterrupt) +T_TEST_CASE( CloseInterrupt ) { - test_context ctx; - const char *path = "generic"; - int rv; + test_context ctx; + const char *path = "generic"; + int rv; T_interrupt_test_state state; - memset(&ctx, 0, sizeof(ctx)); + memset( &ctx, 0, sizeof( ctx ) ); rv = IMFS_make_generic_node( path, @@ -174,31 +174,31 @@ T_TEST_CASE(CloseInterrupt) &node_control, &ctx ); - T_psx_success(rv); + T_psx_success( rv ); - state = T_interrupt_test(&config, &ctx); - T_eq_int(state, T_INTERRUPT_TEST_DONE); + state = T_interrupt_test( &config, &ctx ); + T_eq_int( state, T_INTERRUPT_TEST_DONE ); - T_log(T_NORMAL, "early count = %ld", ctx.early_count); - T_log(T_NORMAL, "late count = %ld", ctx.late_count); - T_log(T_NORMAL, "potential hit count = %ld", ctx.potential_hit_count); - T_log(T_NORMAL, "append count = %ld", ctx.append_count); - T_log(T_NORMAL, "no append count = %ld", ctx.no_append_count); + T_log( T_NORMAL, "early count = %ld", ctx.early_count ); + T_log( T_NORMAL, "late count = %ld", ctx.late_count ); + T_log( T_NORMAL, "potential hit count = %ld", ctx.potential_hit_count ); + T_log( T_NORMAL, "append count = %ld", ctx.append_count ); + T_log( T_NORMAL, "no append count = %ld", ctx.no_append_count ); /* There is no reliable indicator if the test case has been hit */ - T_gt_int(ctx.early_count, 0); - T_gt_int(ctx.late_count, 0); - T_gt_int(ctx.potential_hit_count, 0); - T_gt_int(ctx.append_count, 0); - T_gt_int(ctx.no_append_count, 0); + T_gt_int( ctx.early_count, 0 ); + T_gt_int( ctx.late_count, 0 ); + T_gt_int( ctx.potential_hit_count, 0 ); + T_gt_int( ctx.append_count, 0 ); + T_gt_int( ctx.no_append_count, 0 ); - rv = unlink(path); - T_psx_success(rv); + rv = unlink( path ); + T_psx_success( rv ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { - rtems_test_run(arg, TEST_STATE); + rtems_test_run( arg, TEST_STATE ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/splinkersets01/content.c b/testsuites/sptests/splinkersets01/content.c index 5dedcb9060..86fe6065b3 100644 --- a/testsuites/sptests/splinkersets01/content.c +++ b/testsuites/sptests/splinkersets01/content.c @@ -12,10 +12,10 @@ #include "splinkersets01.h" -int content_rw_1; +int content_rw_1; char content_rw_2; char content_rw_3; -const int content_ro_1; +const int content_ro_1; const char content_ro_2; const char content_ro_3; diff --git a/testsuites/sptests/splinkersets01/init.c b/testsuites/sptests/splinkersets01/init.c index 18c3ba1b47..88c295a563 100644 --- a/testsuites/sptests/splinkersets01/init.c +++ b/testsuites/sptests/splinkersets01/init.c @@ -16,42 +16,42 @@ const char rtems_test_name[] = "SPLINKERSETS 1"; -RTEMS_LINKER_RWSET(test_rw_i, const int *); +RTEMS_LINKER_RWSET( test_rw_i, const int * ); -RTEMS_LINKER_ROSET(test_ro_i, const int *); +RTEMS_LINKER_ROSET( test_ro_i, const int * ); -RTEMS_LINKER_RWSET_DECLARE(test_rw_i, const int *); +RTEMS_LINKER_RWSET_DECLARE( test_rw_i, const int * ); -RTEMS_LINKER_ROSET_DECLARE(test_ro_i, const int *); +RTEMS_LINKER_ROSET_DECLARE( test_ro_i, const int * ); -const int a[4]; +const int a[ 4 ]; -const int ca[5]; +const int ca[ 5 ]; -RTEMS_LINKER_RWSET_ITEM(test_rw, const int *, a3) = &a[3]; -RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw, const int *, a2, 2) = &a[2]; -RTEMS_LINKER_RWSET_ITEM_REFERENCE(test_rw, const int *, a1); -RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw, const int *, a0, 0) = &a[0]; +RTEMS_LINKER_RWSET_ITEM( test_rw, const int *, a3 ) = &a[ 3 ]; +RTEMS_LINKER_RWSET_ITEM_ORDERED( test_rw, const int *, a2, 2 ) = &a[ 2 ]; +RTEMS_LINKER_RWSET_ITEM_REFERENCE( test_rw, const int *, a1 ); +RTEMS_LINKER_RWSET_ITEM_ORDERED( test_rw, const int *, a0, 0 ) = &a[ 0 ]; /* Items are ordered lexicographically */ -RTEMS_LINKER_RWSET_ITEM(test_rw_i, const int *, a3) = &a[3]; -RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw_i, const int *, a2, 2) = &a[2]; -RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw_i, const int *, a1, 11) = &a[1]; -RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw_i, const int *, a0, 0) = &a[0]; +RTEMS_LINKER_RWSET_ITEM( test_rw_i, const int *, a3 ) = &a[ 3 ]; +RTEMS_LINKER_RWSET_ITEM_ORDERED( test_rw_i, const int *, a2, 2 ) = &a[ 2 ]; +RTEMS_LINKER_RWSET_ITEM_ORDERED( test_rw_i, const int *, a1, 11 ) = &a[ 1 ]; +RTEMS_LINKER_RWSET_ITEM_ORDERED( test_rw_i, const int *, a0, 0 ) = &a[ 0 ]; #define OZ OA -RTEMS_LINKER_ROSET_ITEM(test_ro, const int *, ca4) = &ca[4]; -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca3, OD) = &ca[3]; -RTEMS_LINKER_ROSET_ITEM_REFERENCE(test_ro, const int *, ca2); -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca1, OB) = &ca[1]; -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca0, OZ) = &ca[0]; +RTEMS_LINKER_ROSET_ITEM( test_ro, const int *, ca4 ) = &ca[ 4 ]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro, const int *, ca3, OD ) = &ca[ 3 ]; +RTEMS_LINKER_ROSET_ITEM_REFERENCE( test_ro, const int *, ca2 ); +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro, const int *, ca1, OB ) = &ca[ 1 ]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro, const int *, ca0, OZ ) = &ca[ 0 ]; -RTEMS_LINKER_ROSET_ITEM(test_ro_i, const int *, ca4) = &ca[4]; -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca3, OD) = &ca[3]; -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca2, OC) = &ca[2]; -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca1, OB) = &ca[1]; -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca0, OZ) = &ca[0]; +RTEMS_LINKER_ROSET_ITEM( test_ro_i, const int *, ca4 ) = &ca[ 4 ]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro_i, const int *, ca3, OD ) = &ca[ 3 ]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro_i, const int *, ca2, OC ) = &ca[ 2 ]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro_i, const int *, ca1, OB ) = &ca[ 1 ]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro_i, const int *, ca0, OZ ) = &ca[ 0 ]; /* * Demonstrate safe (= define must exist) order definitions, otherwise typos @@ -63,202 +63,204 @@ RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca0, OZ) = &ca[0]; #define SAFE_ORDER_B 00001 #define SAFE_ORDER_C 00002 -#define ITEM(i, o) \ +#define ITEM( i, o ) \ enum { test_ro_s_##i = o - o }; \ - RTEMS_LINKER_RWSET_ITEM_ORDERED(test_ro_s, const int *, i, o) = &i + RTEMS_LINKER_RWSET_ITEM_ORDERED( test_ro_s, const int *, i, o ) = &i -RTEMS_LINKER_RWSET(test_ro_s, const int *); +RTEMS_LINKER_RWSET( test_ro_s, const int * ); static const int s0; static const int s1; static const int s2; -ITEM(s2, SAFE_ORDER_C); -ITEM(s1, SAFE_ORDER_B); -ITEM(s0, SAFE_ORDER_A); +ITEM( s2, SAFE_ORDER_C ); +ITEM( s1, SAFE_ORDER_B ); +ITEM( s0, SAFE_ORDER_A ); -RTEMS_LINKER_RWSET(test_rw_empty, const int *); +RTEMS_LINKER_RWSET( test_rw_empty, const int * ); -RTEMS_LINKER_ROSET(test_ro_empty, const int *); +RTEMS_LINKER_ROSET( test_ro_empty, const int * ); -static void test(void) +static void test( void ) { - const int **b; - const int **e; - const int * const *cb; - const int * const *ce; - const int **bi; - const int **ei; - const int * const *cbi; - const int * const *cei; - const int * const *sb; - const int * const *se; - size_t i; - const int **item; + const int **b; + const int **e; + const int *const *cb; + const int *const *ce; + const int **bi; + const int **ei; + const int *const *cbi; + const int *const *cei; + const int *const *sb; + const int *const *se; + size_t i; + const int **item; - b = RTEMS_LINKER_SET_BEGIN(test_rw); - e = RTEMS_LINKER_SET_END(test_rw); - cb = RTEMS_LINKER_SET_BEGIN(test_ro); - ce = RTEMS_LINKER_SET_END(test_ro); - bi = RTEMS_LINKER_SET_BEGIN(test_rw_i); - ei = RTEMS_LINKER_SET_END(test_rw_i); - cbi = RTEMS_LINKER_SET_BEGIN(test_ro_i); - cei = RTEMS_LINKER_SET_END(test_ro_i); - sb = RTEMS_LINKER_SET_BEGIN(test_ro_s); - se = RTEMS_LINKER_SET_END(test_ro_s); - RTEMS_OBFUSCATE_VARIABLE(b); - RTEMS_OBFUSCATE_VARIABLE(e); - RTEMS_OBFUSCATE_VARIABLE(cb); - RTEMS_OBFUSCATE_VARIABLE(ce); - RTEMS_OBFUSCATE_VARIABLE(bi); - RTEMS_OBFUSCATE_VARIABLE(ei); - RTEMS_OBFUSCATE_VARIABLE(cbi); - RTEMS_OBFUSCATE_VARIABLE(cei); - RTEMS_OBFUSCATE_VARIABLE(sb); - RTEMS_OBFUSCATE_VARIABLE(se); + b = RTEMS_LINKER_SET_BEGIN( test_rw ); + e = RTEMS_LINKER_SET_END( test_rw ); + cb = RTEMS_LINKER_SET_BEGIN( test_ro ); + ce = RTEMS_LINKER_SET_END( test_ro ); + bi = RTEMS_LINKER_SET_BEGIN( test_rw_i ); + ei = RTEMS_LINKER_SET_END( test_rw_i ); + cbi = RTEMS_LINKER_SET_BEGIN( test_ro_i ); + cei = RTEMS_LINKER_SET_END( test_ro_i ); + sb = RTEMS_LINKER_SET_BEGIN( test_ro_s ); + se = RTEMS_LINKER_SET_END( test_ro_s ); + RTEMS_OBFUSCATE_VARIABLE( b ); + RTEMS_OBFUSCATE_VARIABLE( e ); + RTEMS_OBFUSCATE_VARIABLE( cb ); + RTEMS_OBFUSCATE_VARIABLE( ce ); + RTEMS_OBFUSCATE_VARIABLE( bi ); + RTEMS_OBFUSCATE_VARIABLE( ei ); + RTEMS_OBFUSCATE_VARIABLE( cbi ); + RTEMS_OBFUSCATE_VARIABLE( cei ); + RTEMS_OBFUSCATE_VARIABLE( sb ); + RTEMS_OBFUSCATE_VARIABLE( se ); - rtems_test_assert((size_t) (e - b) == RTEMS_ARRAY_SIZE(a)); - rtems_test_assert((size_t) (ce - cb) == RTEMS_ARRAY_SIZE(ca)); + rtems_test_assert( (size_t) ( e - b ) == RTEMS_ARRAY_SIZE( a ) ); + rtems_test_assert( (size_t) ( ce - cb ) == RTEMS_ARRAY_SIZE( ca ) ); rtems_test_assert( - RTEMS_LINKER_SET_SIZE(test_rw) - == sizeof(const int *) * RTEMS_ARRAY_SIZE(a) + RTEMS_LINKER_SET_SIZE( test_rw ) == + sizeof( const int * ) * RTEMS_ARRAY_SIZE( a ) ); rtems_test_assert( - RTEMS_LINKER_SET_SIZE(test_ro) - == sizeof(const int *) * RTEMS_ARRAY_SIZE(ca) + RTEMS_LINKER_SET_SIZE( test_ro ) == + sizeof( const int * ) * RTEMS_ARRAY_SIZE( ca ) ); rtems_test_assert( - RTEMS_LINKER_SET_ITEM_COUNT(test_rw) == RTEMS_ARRAY_SIZE(a) + RTEMS_LINKER_SET_ITEM_COUNT( test_rw ) == RTEMS_ARRAY_SIZE( a ) ); rtems_test_assert( - RTEMS_LINKER_SET_ITEM_COUNT(test_ro) == RTEMS_ARRAY_SIZE(ca) + RTEMS_LINKER_SET_ITEM_COUNT( test_ro ) == RTEMS_ARRAY_SIZE( ca ) ); - rtems_test_assert(!RTEMS_LINKER_SET_IS_EMPTY(test_rw)); - rtems_test_assert(!RTEMS_LINKER_SET_IS_EMPTY(test_ro)); + rtems_test_assert( !RTEMS_LINKER_SET_IS_EMPTY( test_rw ) ); + rtems_test_assert( !RTEMS_LINKER_SET_IS_EMPTY( test_ro ) ); - rtems_test_assert((size_t) (ei - bi) == RTEMS_ARRAY_SIZE(a)); - rtems_test_assert((size_t) (cei - cbi) == RTEMS_ARRAY_SIZE(ca)); - rtems_test_assert((size_t) (se - sb) == 3); + rtems_test_assert( (size_t) ( ei - bi ) == RTEMS_ARRAY_SIZE( a ) ); + rtems_test_assert( (size_t) ( cei - cbi ) == RTEMS_ARRAY_SIZE( ca ) ); + rtems_test_assert( (size_t) ( se - sb ) == 3 ); rtems_test_assert( - RTEMS_LINKER_SET_SIZE(test_rw_i) - == sizeof(const int *) * RTEMS_ARRAY_SIZE(a) + RTEMS_LINKER_SET_SIZE( test_rw_i ) == + sizeof( const int * ) * RTEMS_ARRAY_SIZE( a ) ); rtems_test_assert( - RTEMS_LINKER_SET_SIZE(test_ro_i) - == sizeof(const int *) * RTEMS_ARRAY_SIZE(ca) - ); - rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_ro_s) == 3 * sizeof(int *)); - rtems_test_assert( - RTEMS_LINKER_SET_ITEM_COUNT(test_rw_i) == RTEMS_ARRAY_SIZE(a) + RTEMS_LINKER_SET_SIZE( test_ro_i ) == + sizeof( const int * ) * RTEMS_ARRAY_SIZE( ca ) ); rtems_test_assert( - RTEMS_LINKER_SET_ITEM_COUNT(test_ro_i) == RTEMS_ARRAY_SIZE(ca) + RTEMS_LINKER_SET_SIZE( test_ro_s ) == 3 * sizeof( int * ) ); - rtems_test_assert(RTEMS_LINKER_SET_ITEM_COUNT(test_ro_s) == 3); - rtems_test_assert(!RTEMS_LINKER_SET_IS_EMPTY(test_rw_i)); - rtems_test_assert(!RTEMS_LINKER_SET_IS_EMPTY(test_ro_i)); - rtems_test_assert(!RTEMS_LINKER_SET_IS_EMPTY(test_ro_s)); + rtems_test_assert( + RTEMS_LINKER_SET_ITEM_COUNT( test_rw_i ) == RTEMS_ARRAY_SIZE( a ) + ); + rtems_test_assert( + RTEMS_LINKER_SET_ITEM_COUNT( test_ro_i ) == RTEMS_ARRAY_SIZE( ca ) + ); + rtems_test_assert( RTEMS_LINKER_SET_ITEM_COUNT( test_ro_s ) == 3 ); + rtems_test_assert( !RTEMS_LINKER_SET_IS_EMPTY( test_rw_i ) ); + rtems_test_assert( !RTEMS_LINKER_SET_IS_EMPTY( test_ro_i ) ); + rtems_test_assert( !RTEMS_LINKER_SET_IS_EMPTY( test_ro_s ) ); - rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_rw_empty) == 0); - rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_ro_empty) == 0); - rtems_test_assert(RTEMS_LINKER_SET_ITEM_COUNT(test_rw_empty) == 0); - rtems_test_assert(RTEMS_LINKER_SET_ITEM_COUNT(test_ro_empty) == 0); - rtems_test_assert(RTEMS_LINKER_SET_IS_EMPTY(test_rw_empty)); - rtems_test_assert(RTEMS_LINKER_SET_IS_EMPTY(test_ro_empty)); + rtems_test_assert( RTEMS_LINKER_SET_SIZE( test_rw_empty ) == 0 ); + rtems_test_assert( RTEMS_LINKER_SET_SIZE( test_ro_empty ) == 0 ); + rtems_test_assert( RTEMS_LINKER_SET_ITEM_COUNT( test_rw_empty ) == 0 ); + rtems_test_assert( RTEMS_LINKER_SET_ITEM_COUNT( test_ro_empty ) == 0 ); + rtems_test_assert( RTEMS_LINKER_SET_IS_EMPTY( test_rw_empty ) ); + rtems_test_assert( RTEMS_LINKER_SET_IS_EMPTY( test_ro_empty ) ); - for (i = 0; i < RTEMS_ARRAY_SIZE(a); ++i) { - rtems_test_assert(&a[i] == b[i]); + for ( i = 0; i < RTEMS_ARRAY_SIZE( a ); ++i ) { + rtems_test_assert( &a[ i ] == b[ i ] ); } - for (i = 0; i < RTEMS_ARRAY_SIZE(ca); ++i) { - rtems_test_assert(&ca[i] == cb[i]); + for ( i = 0; i < RTEMS_ARRAY_SIZE( ca ); ++i ) { + rtems_test_assert( &ca[ i ] == cb[ i ] ); } - for (i = 0; i < RTEMS_ARRAY_SIZE(a); ++i) { - rtems_test_assert(&a[i] == bi[i]); + for ( i = 0; i < RTEMS_ARRAY_SIZE( a ); ++i ) { + rtems_test_assert( &a[ i ] == bi[ i ] ); } - for (i = 0; i < RTEMS_ARRAY_SIZE(ca); ++i) { - rtems_test_assert(&ca[i] == cbi[i]); + for ( i = 0; i < RTEMS_ARRAY_SIZE( ca ); ++i ) { + rtems_test_assert( &ca[ i ] == cbi[ i ] ); } i = 0; - RTEMS_LINKER_SET_FOREACH(test_rw, item) { - rtems_test_assert(&a[i] == *item); + RTEMS_LINKER_SET_FOREACH ( test_rw, item ) { + rtems_test_assert( &a[ i ] == *item ); ++i; } - rtems_test_assert(i == RTEMS_ARRAY_SIZE(a)); + rtems_test_assert( i == RTEMS_ARRAY_SIZE( a ) ); i = 0; - RTEMS_LINKER_SET_FOREACH(test_ro, item) { - rtems_test_assert(&ca[i] == *item); + RTEMS_LINKER_SET_FOREACH ( test_ro, item ) { + rtems_test_assert( &ca[ i ] == *item ); ++i; } - rtems_test_assert(i == RTEMS_ARRAY_SIZE(ca)); + rtems_test_assert( i == RTEMS_ARRAY_SIZE( ca ) ); i = 0; - RTEMS_LINKER_SET_FOREACH(test_rw_i, item) { - rtems_test_assert(&a[i] == *item); + RTEMS_LINKER_SET_FOREACH ( test_rw_i, item ) { + rtems_test_assert( &a[ i ] == *item ); ++i; } - rtems_test_assert(i == RTEMS_ARRAY_SIZE(a)); + rtems_test_assert( i == RTEMS_ARRAY_SIZE( a ) ); i = 0; - RTEMS_LINKER_SET_FOREACH(test_ro_i, item) { - rtems_test_assert(&ca[i] == *item); + RTEMS_LINKER_SET_FOREACH ( test_ro_i, item ) { + rtems_test_assert( &ca[ i ] == *item ); ++i; } - rtems_test_assert(i == RTEMS_ARRAY_SIZE(ca)); + rtems_test_assert( i == RTEMS_ARRAY_SIZE( ca ) ); - rtems_test_assert(&s0 == sb[0]); - rtems_test_assert(&s1 == sb[1]); - rtems_test_assert(&s2 == sb[2]); + rtems_test_assert( &s0 == sb[ 0 ] ); + rtems_test_assert( &s1 == sb[ 1 ] ); + rtems_test_assert( &s2 == sb[ 2 ] ); i = 0; - RTEMS_LINKER_SET_FOREACH(test_rw_empty, item) { + RTEMS_LINKER_SET_FOREACH ( test_rw_empty, item ) { ++i; } - rtems_test_assert(i == 0); + rtems_test_assert( i == 0 ); i = 0; - RTEMS_LINKER_SET_FOREACH(test_ro_empty, item) { + RTEMS_LINKER_SET_FOREACH ( test_ro_empty, item ) { ++i; } - rtems_test_assert(i == 0); + rtems_test_assert( i == 0 ); } -static void test_content(void) +static void test_content( void ) { const char *b_rw; const char *e_rw; const char *b_ro; const char *e_ro; - b_rw = RTEMS_LINKER_SET_BEGIN(test_content_rw); - e_rw = RTEMS_LINKER_SET_END(test_content_rw); - b_ro = RTEMS_LINKER_SET_BEGIN(test_content_ro); - e_ro = RTEMS_LINKER_SET_END(test_content_ro); - RTEMS_OBFUSCATE_VARIABLE(b_rw); - RTEMS_OBFUSCATE_VARIABLE(e_rw); - RTEMS_OBFUSCATE_VARIABLE(b_ro); - RTEMS_OBFUSCATE_VARIABLE(e_ro); + b_rw = RTEMS_LINKER_SET_BEGIN( test_content_rw ); + e_rw = RTEMS_LINKER_SET_END( test_content_rw ); + b_ro = RTEMS_LINKER_SET_BEGIN( test_content_ro ); + e_ro = RTEMS_LINKER_SET_END( test_content_ro ); + RTEMS_OBFUSCATE_VARIABLE( b_rw ); + RTEMS_OBFUSCATE_VARIABLE( e_rw ); + RTEMS_OBFUSCATE_VARIABLE( b_ro ); + RTEMS_OBFUSCATE_VARIABLE( e_ro ); - rtems_test_assert((uintptr_t) &content_rw_1 >= (uintptr_t) b_rw); - rtems_test_assert((uintptr_t) &content_rw_2 >= (uintptr_t) b_rw); - rtems_test_assert((uintptr_t) &content_rw_3 >= (uintptr_t) b_rw); - rtems_test_assert((uintptr_t) &content_rw_1 <= (uintptr_t) e_rw); - rtems_test_assert((uintptr_t) &content_rw_2 <= (uintptr_t) e_rw); - rtems_test_assert((uintptr_t) &content_rw_3 <= (uintptr_t) e_rw); + rtems_test_assert( (uintptr_t) &content_rw_1 >= (uintptr_t) b_rw ); + rtems_test_assert( (uintptr_t) &content_rw_2 >= (uintptr_t) b_rw ); + rtems_test_assert( (uintptr_t) &content_rw_3 >= (uintptr_t) b_rw ); + rtems_test_assert( (uintptr_t) &content_rw_1 <= (uintptr_t) e_rw ); + rtems_test_assert( (uintptr_t) &content_rw_2 <= (uintptr_t) e_rw ); + rtems_test_assert( (uintptr_t) &content_rw_3 <= (uintptr_t) e_rw ); - rtems_test_assert((uintptr_t) &content_ro_1 >= (uintptr_t) b_ro); - rtems_test_assert((uintptr_t) &content_ro_2 >= (uintptr_t) b_ro); - rtems_test_assert((uintptr_t) &content_ro_3 >= (uintptr_t) b_ro); - rtems_test_assert((uintptr_t) &content_ro_1 <= (uintptr_t) e_ro); - rtems_test_assert((uintptr_t) &content_ro_2 <= (uintptr_t) e_ro); - rtems_test_assert((uintptr_t) &content_ro_3 <= (uintptr_t) e_ro); + rtems_test_assert( (uintptr_t) &content_ro_1 >= (uintptr_t) b_ro ); + rtems_test_assert( (uintptr_t) &content_ro_2 >= (uintptr_t) b_ro ); + rtems_test_assert( (uintptr_t) &content_ro_3 >= (uintptr_t) b_ro ); + rtems_test_assert( (uintptr_t) &content_ro_1 <= (uintptr_t) e_ro ); + rtems_test_assert( (uintptr_t) &content_ro_2 <= (uintptr_t) e_ro ); + rtems_test_assert( (uintptr_t) &content_ro_3 <= (uintptr_t) e_ro ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -268,7 +270,7 @@ static void Init(rtems_task_argument arg) test_content(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/splinkersets01/item-a.c b/testsuites/sptests/splinkersets01/item-a.c index 305c952d83..4d017202a1 100644 --- a/testsuites/sptests/splinkersets01/item-a.c +++ b/testsuites/sptests/splinkersets01/item-a.c @@ -12,4 +12,4 @@ #include "splinkersets01.h" -RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw, const int *, a1, 1) = &a[1]; +RTEMS_LINKER_RWSET_ITEM_ORDERED( test_rw, const int *, a1, 1 ) = &a[ 1 ]; diff --git a/testsuites/sptests/splinkersets01/item-ca.c b/testsuites/sptests/splinkersets01/item-ca.c index e85c0c0855..b48f7cfa5a 100644 --- a/testsuites/sptests/splinkersets01/item-ca.c +++ b/testsuites/sptests/splinkersets01/item-ca.c @@ -12,4 +12,4 @@ #include "splinkersets01.h" -RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca2, OC) = &ca[2]; +RTEMS_LINKER_ROSET_ITEM_ORDERED( test_ro, const int *, ca2, OC ) = &ca[ 2 ]; diff --git a/testsuites/sptests/splinkersets01/sets.c b/testsuites/sptests/splinkersets01/sets.c index a7b930dbf5..d368881589 100644 --- a/testsuites/sptests/splinkersets01/sets.c +++ b/testsuites/sptests/splinkersets01/sets.c @@ -12,10 +12,10 @@ #include "splinkersets01.h" -RTEMS_LINKER_RWSET(test_rw, const int *); +RTEMS_LINKER_RWSET( test_rw, const int * ); -RTEMS_LINKER_ROSET(test_ro, const int *); +RTEMS_LINKER_ROSET( test_ro, const int * ); -RTEMS_LINKER_RWSET(test_content_rw, char); +RTEMS_LINKER_RWSET( test_content_rw, char ); -RTEMS_LINKER_ROSET(test_content_ro, char); +RTEMS_LINKER_ROSET( test_content_ro, char ); diff --git a/testsuites/sptests/splinkersets01/splinkersets01.h b/testsuites/sptests/splinkersets01/splinkersets01.h index 0581204765..f47a3e8ee5 100644 --- a/testsuites/sptests/splinkersets01/splinkersets01.h +++ b/testsuites/sptests/splinkersets01/splinkersets01.h @@ -15,29 +15,29 @@ extern "C" { #include -extern const int a[4]; +extern const int a[ 4 ]; -extern const int ca[5]; +extern const int ca[ 5 ]; -RTEMS_LINKER_RWSET_DECLARE(test_rw, const int *); +RTEMS_LINKER_RWSET_DECLARE( test_rw, const int * ); -RTEMS_LINKER_ROSET_DECLARE(test_ro, const int *); +RTEMS_LINKER_ROSET_DECLARE( test_ro, const int * ); -RTEMS_LINKER_RWSET_DECLARE(test_content_rw, char); +RTEMS_LINKER_RWSET_DECLARE( test_content_rw, char ); -RTEMS_LINKER_ROSET_DECLARE(test_content_ro, char); +RTEMS_LINKER_ROSET_DECLARE( test_content_ro, char ); -RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE(test_rw, const int *, a1, 1); +RTEMS_LINKER_RWSET_ITEM_ORDERED_DECLARE( test_rw, const int *, a1, 1 ); -RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE(test_ro, const int *, ca2, OC); +RTEMS_LINKER_ROSET_ITEM_ORDERED_DECLARE( test_ro, const int *, ca2, OC ); -RTEMS_LINKER_RWSET_CONTENT(test_content_rw, extern int content_rw_1); -RTEMS_LINKER_RWSET_CONTENT(test_content_rw, extern char content_rw_2); -RTEMS_LINKER_RWSET_CONTENT(test_content_rw, extern char content_rw_3); +RTEMS_LINKER_RWSET_CONTENT( test_content_rw, extern int content_rw_1 ); +RTEMS_LINKER_RWSET_CONTENT( test_content_rw, extern char content_rw_2 ); +RTEMS_LINKER_RWSET_CONTENT( test_content_rw, extern char content_rw_3 ); -RTEMS_LINKER_ROSET_CONTENT(test_content_ro, extern const int content_ro_1); -RTEMS_LINKER_ROSET_CONTENT(test_content_ro, extern const char content_ro_2); -RTEMS_LINKER_ROSET_CONTENT(test_content_ro, extern const char content_ro_3); +RTEMS_LINKER_ROSET_CONTENT( test_content_ro, extern const int content_ro_1 ); +RTEMS_LINKER_ROSET_CONTENT( test_content_ro, extern const char content_ro_2 ); +RTEMS_LINKER_ROSET_CONTENT( test_content_ro, extern const char content_ro_3 ); #ifdef __cplusplus } diff --git a/testsuites/sptests/spmisc01/init.c b/testsuites/sptests/spmisc01/init.c index 12764f8d2a..9d37aff203 100644 --- a/testsuites/sptests/spmisc01/init.c +++ b/testsuites/sptests/spmisc01/init.c @@ -38,40 +38,40 @@ const char rtems_test_name[] = "SPMISC 1"; -RTEMS_INLINE_ROUTINE int inline_func(void) +RTEMS_INLINE_ROUTINE int inline_func( void ) { return 7; } -RTEMS_NO_INLINE static int noinline_func(void) +RTEMS_NO_INLINE static int noinline_func( void ) { return 14; } -RTEMS_NO_RETURN void noreturn_func(void); +RTEMS_NO_RETURN void noreturn_func( void ); -RTEMS_PURE static int pure_func(void) +RTEMS_PURE static int pure_func( void ) { return 21; } -RTEMS_CONST static int const_func(void) +RTEMS_CONST static int const_func( void ) { return 23; } -RTEMS_SECTION(".rtemsroset.test") static int section_variable = 28; +RTEMS_SECTION( ".rtemsroset.test" ) static int section_variable = 28; RTEMS_NOINIT static int noinit_variable; -RTEMS_USED static int used_func(void) +RTEMS_USED static int used_func( void ) { return 35; } RTEMS_USED static int used_variable; -static int unused_arg_and_variable_func(RTEMS_UNUSED int arg) +static int unused_arg_and_variable_func( RTEMS_UNUSED int arg ) { RTEMS_UNUSED int variable; @@ -79,67 +79,67 @@ static int unused_arg_and_variable_func(RTEMS_UNUSED int arg) } typedef struct { - uint8_t c; + uint8_t c; uint32_t i; } RTEMS_PACKED packed_struct; -static int alias_func(void) RTEMS_ALIAS(noinline_func); +static int alias_func( void ) RTEMS_ALIAS( noinline_func ); -int weak_alias_func(void) RTEMS_WEAK_ALIAS(noinline_func); +int weak_alias_func( void ) RTEMS_WEAK_ALIAS( noinline_func ); -RTEMS_WEAK int weak_or_strong(void) +RTEMS_WEAK int weak_or_strong( void ) { return 99; } -RTEMS_WEAK int weak_2(void) +RTEMS_WEAK int weak_2( void ) { return 111; } -static char aligned_variable RTEMS_ALIGNED(64); +static char aligned_variable RTEMS_ALIGNED( 64 ); typedef struct { - uint8_t c; - uint8_t aligned_member RTEMS_ALIGNED(64); + uint8_t c; + uint8_t aligned_member RTEMS_ALIGNED( 64 ); } aligned_member_struct; -static void test_unreachable(void) +static void test_unreachable( void ) { - if (0) { + if ( 0 ) { RTEMS_UNREACHABLE(); } } -RTEMS_PRINTFLIKE(1, 2) static int printflike_func(const char *fmt, ...) +RTEMS_PRINTFLIKE( 1, 2 ) static int printflike_func( const char *fmt, ... ) { (void) fmt; return 56; } -static int obfuscate_variable(int i) +static int obfuscate_variable( int i ) { - RTEMS_OBFUSCATE_VARIABLE(i); + RTEMS_OBFUSCATE_VARIABLE( i ); return i; } static int global_symbol_base; -RTEMS_DECLARE_GLOBAL_SYMBOL(a_global_symbol); +RTEMS_DECLARE_GLOBAL_SYMBOL( a_global_symbol ); RTEMS_DEFINE_GLOBAL_SYMBOL( a_global_symbol, - RTEMS_SYMBOL_NAME(global_symbol_base) + 0xabc + RTEMS_SYMBOL_NAME( global_symbol_base ) + 0xabc ); -RTEMS_STATIC_ASSERT(0 != 1, zero_neq_one); +RTEMS_STATIC_ASSERT( 0 != 1, zero_neq_one ); -static int array[3]; +static int array[ 3 ]; typedef struct { uint32_t i; - uint32_t j[RTEMS_ZERO_LENGTH_ARRAY]; + uint32_t j[ RTEMS_ZERO_LENGTH_ARRAY ]; } zero_length_array_struct; typedef struct { @@ -147,50 +147,50 @@ typedef struct { int b; } container_of_struct; -static void container_of(void) +static void container_of( void ) { container_of_struct s; - int *b; + int *b; b = &s.b; - rtems_test_assert(RTEMS_CONTAINER_OF(b, container_of_struct, b) == &s); + rtems_test_assert( RTEMS_CONTAINER_OF( b, container_of_struct, b ) == &s ); } -static int deconst(void) +static int deconst( void ) { const int i = 70; - int *p; + int *p; - p = RTEMS_DECONST(int *, &i); + p = RTEMS_DECONST( int *, &i ); return *p; } -static int devolatile(void) +static int devolatile( void ) { volatile int i = 77; - int *p; + int *p; - p = RTEMS_DEVOLATILE(int *, &i); + p = RTEMS_DEVOLATILE( int *, &i ); return *p; } -static int dequalify(void) +static int dequalify( void ) { volatile const int i = 84; - int *p; + int *p; - p = RTEMS_DEQUALIFY(int *, &i); + p = RTEMS_DEQUALIFY( int *, &i ); return *p; } typedef struct { char a; - int b; + int b; } same_member_type_struct; typedef struct { char c; - int d; + int d; } same_member_type_struct_2; RTEMS_STATIC_ASSERT( @@ -213,7 +213,7 @@ RTEMS_STATIC_ASSERT( same_member_type_struct_neq ); -static int concat(void) +static int concat( void ) { return 91; } @@ -224,7 +224,7 @@ static int concat(void) #define STR ing -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -232,85 +232,83 @@ static void Init(rtems_task_argument arg) int v; TEST_BEGIN(); - rtems_test_assert(inline_func() == 7); + rtems_test_assert( inline_func() == 7 ); RTEMS_COMPILER_MEMORY_BARRIER(); - rtems_test_assert(noinline_func() == 14); - rtems_test_assert(pure_func() == 21); - rtems_test_assert(const_func() == 23); - rtems_test_assert(section_variable == 28); + rtems_test_assert( noinline_func() == 14 ); + rtems_test_assert( pure_func() == 21 ); + rtems_test_assert( const_func() == 23 ); + rtems_test_assert( section_variable == 28 ); v = noinit_variable; - RTEMS_OBFUSCATE_VARIABLE(v); - rtems_test_assert(unused_arg_and_variable_func(49) == 42); - rtems_test_assert(sizeof(packed_struct) == 5); - rtems_test_assert(alias_func() == 14); - rtems_test_assert(weak_alias_func() == 14); + RTEMS_OBFUSCATE_VARIABLE( v ); + rtems_test_assert( unused_arg_and_variable_func( 49 ) == 42 ); + rtems_test_assert( sizeof( packed_struct ) == 5 ); + rtems_test_assert( alias_func() == 14 ); + rtems_test_assert( weak_alias_func() == 14 ); pull_in_strong(); - rtems_test_assert(weak_or_strong() == 77); - rtems_test_assert(weak_2() == 111); - rtems_test_assert(((uintptr_t) &aligned_variable) % 64 == 0); - rtems_test_assert(offsetof(aligned_member_struct, aligned_member) % 64 == 0); + rtems_test_assert( weak_or_strong() == 77 ); + rtems_test_assert( weak_2() == 111 ); + rtems_test_assert( ( (uintptr_t) &aligned_variable ) % 64 == 0 ); + rtems_test_assert( + offsetof( aligned_member_struct, aligned_member ) % 64 == 0 + ); test_unreachable(); - rtems_test_assert(printflike_func("%i", 0) == 56); - rtems_test_assert(obfuscate_variable(63) == 63); + rtems_test_assert( printflike_func( "%i", 0 ) == 56 ); + rtems_test_assert( obfuscate_variable( 63 ) == 63 ); rtems_test_assert( (uintptr_t) a_global_symbol - (uintptr_t) &global_symbol_base == 0xabc ); - rtems_test_assert(RTEMS_ARRAY_SIZE(array) == 3); - rtems_test_assert(sizeof(zero_length_array_struct) == 4); + rtems_test_assert( RTEMS_ARRAY_SIZE( array ) == 3 ); + rtems_test_assert( sizeof( zero_length_array_struct ) == 4 ); container_of(); - rtems_test_assert(deconst() == 70); - rtems_test_assert(devolatile() == 77); - rtems_test_assert(dequalify() == 84); - rtems_test_assert( - RTEMS_HAVE_MEMBER_SAME_TYPE( - same_member_type_struct, - b, - same_member_type_struct_2, - d - ) - ); - rtems_test_assert( - !RTEMS_HAVE_MEMBER_SAME_TYPE( - same_member_type_struct, - b, - same_member_type_struct_2, - c - ) - ); - rtems_test_assert(RTEMS_CONCAT(con, cat)() == 91); - rtems_test_assert(RTEMS_XCONCAT(CON, CAT)() == 91); - rtems_test_assert(strcmp(RTEMS_STRING(str), "str") == 0); - rtems_test_assert(strcmp(RTEMS_XSTRING(STR), "ing") == 0); + rtems_test_assert( deconst() == 70 ); + rtems_test_assert( devolatile() == 77 ); + rtems_test_assert( dequalify() == 84 ); + rtems_test_assert( RTEMS_HAVE_MEMBER_SAME_TYPE( + same_member_type_struct, + b, + same_member_type_struct_2, + d + ) ); + rtems_test_assert( !RTEMS_HAVE_MEMBER_SAME_TYPE( + same_member_type_struct, + b, + same_member_type_struct_2, + c + ) ); + rtems_test_assert( RTEMS_CONCAT( con, cat )() == 91 ); + rtems_test_assert( RTEMS_XCONCAT( CON, CAT )() == 91 ); + rtems_test_assert( strcmp( RTEMS_STRING( str ), "str" ) == 0 ); + rtems_test_assert( strcmp( RTEMS_XSTRING( STR ), "ing" ) == 0 ); - if (RTEMS_PREDICT_TRUE(true)) { - rtems_test_assert(true); + if ( RTEMS_PREDICT_TRUE( true ) ) { + rtems_test_assert( true ); } else { - rtems_test_assert(false); + rtems_test_assert( false ); } - if (RTEMS_PREDICT_FALSE(true)) { - rtems_test_assert(true); + if ( RTEMS_PREDICT_FALSE( true ) ) { + rtems_test_assert( true ); } else { - rtems_test_assert(false); + rtems_test_assert( false ); } - if (RTEMS_PREDICT_TRUE(false)) { - rtems_test_assert(false); + if ( RTEMS_PREDICT_TRUE( false ) ) { + rtems_test_assert( false ); } else { - rtems_test_assert(true); + rtems_test_assert( true ); } - if (RTEMS_PREDICT_FALSE(false)) { - rtems_test_assert(false); + if ( RTEMS_PREDICT_FALSE( false ) ) { + rtems_test_assert( false ); } else { - rtems_test_assert(true); + rtems_test_assert( true ); } p = RTEMS_RETURN_ADDRESS(); (void) p; TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/spmisc01/spmisc01.h b/testsuites/sptests/spmisc01/spmisc01.h index ee04e36cde..cd28ee3897 100644 --- a/testsuites/sptests/spmisc01/spmisc01.h +++ b/testsuites/sptests/spmisc01/spmisc01.h @@ -32,11 +32,11 @@ extern "C" { #endif -int weak_or_strong(void); +int weak_or_strong( void ); -void pull_in_strong(void); +void pull_in_strong( void ); -int weak_2(void); +int weak_2( void ); #ifdef __cplusplus } diff --git a/testsuites/sptests/spmisc01/strong.c b/testsuites/sptests/spmisc01/strong.c index d330e5ed44..eb55465c63 100644 --- a/testsuites/sptests/spmisc01/strong.c +++ b/testsuites/sptests/spmisc01/strong.c @@ -33,17 +33,17 @@ #include -int weak_or_strong(void) +int weak_or_strong( void ) { return 77; } -void pull_in_strong(void) +void pull_in_strong( void ) { /* Do nothing */ } -RTEMS_WEAK int weak_2(void) +RTEMS_WEAK int weak_2( void ) { return 222; } diff --git a/testsuites/sptests/spmkdir/init.c b/testsuites/sptests/spmkdir/init.c index 62af529aaf..4c046ad986 100644 --- a/testsuites/sptests/spmkdir/init.c +++ b/testsuites/sptests/spmkdir/init.c @@ -47,77 +47,77 @@ const char rtems_test_name[] = "SPMKDIR"; -static void test_mkdir(const char *path, mode_t omode, int expected_rv) +static void test_mkdir( const char *path, mode_t omode, int expected_rv ) { struct stat st; - int rv = 0; - mode_t current_umask = umask(0); - mode_t dirmode = S_IFDIR | (omode & ~current_umask); + int rv = 0; + mode_t current_umask = umask( 0 ); + mode_t dirmode = S_IFDIR | ( omode & ~current_umask ); - umask(current_umask); + umask( current_umask ); - rv = rtems_mkdir(path, omode); - rtems_test_assert(rv == expected_rv); + rv = rtems_mkdir( path, omode ); + rtems_test_assert( rv == expected_rv ); - if (rv == 0) { - rv = stat(path, &st); - rtems_test_assert(rv == 0 && st.st_mode == dirmode); + if ( rv == 0 ) { + rv = stat( path, &st ); + rtems_test_assert( rv == 0 && st.st_mode == dirmode ); } } -static rtems_task Init(rtems_task_argument argument) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; mode_t omode = S_IRWXU | S_IRWXG | S_IRWXO; - int rv = 0; + int rv = 0; TEST_BEGIN(); puts( "rtems_mkdir a - OK" ); - test_mkdir("a", omode, 0); + test_mkdir( "a", omode, 0 ); puts( "rtems_mkdir a/b - OK" ); - test_mkdir("a/b", omode, 0); + test_mkdir( "a/b", omode, 0 ); puts( "rtems_mkdir a/b/c/d/e/f/g/h/i - OK" ); - test_mkdir("a/b/c/d/e/f/g/h/i", omode, 0); + test_mkdir( "a/b/c/d/e/f/g/h/i", omode, 0 ); puts( "rtems_mkdir a/b/c - OK" ); - test_mkdir("a/b/c", omode, 0); + test_mkdir( "a/b/c", omode, 0 ); puts( "rtems_mkdir a/b/c/1 - OK" ); - test_mkdir("a/b/c/1", 0, 0); + test_mkdir( "a/b/c/1", 0, 0 ); puts( "rtems_mkdir a/b/c/2 - OK" ); - test_mkdir("a/b/c/2", S_IRWXU, 0); + test_mkdir( "a/b/c/2", S_IRWXU, 0 ); puts( "rtems_mkdir a/b/c/3 - OK" ); - test_mkdir("a/b/c/3", S_IRWXG, 0); + test_mkdir( "a/b/c/3", S_IRWXG, 0 ); puts( "rtems_mkdir a/b/c/4 - OK" ); - test_mkdir("a/b/c/4", S_IRWXO, 0); + test_mkdir( "a/b/c/4", S_IRWXO, 0 ); puts( "rtems_mkdir a/b - OK" ); - test_mkdir("a/b", omode, 0); + test_mkdir( "a/b", omode, 0 ); puts( "rtems_mkdir a - OK" ); - test_mkdir("a", omode, 0); + test_mkdir( "a", omode, 0 ); puts( "rtems_mkdir a/b/x - OK" ); - test_mkdir("a/b/x", S_IRUSR, 0); + test_mkdir( "a/b/x", S_IRUSR, 0 ); puts( "rtems_mkdir a/b/x/y - expect failure" ); - test_mkdir("a/b/x/y", S_IRUSR, -1); - puts( "mknod regular file a/n - OK" ); - rv = mknod("a/n", S_IRWXU | S_IFREG, 0LL); + test_mkdir( "a/b/x/y", S_IRUSR, -1 ); + puts( "mknod regular file a/n - OK" ); + rv = mknod( "a/n", S_IRWXU | S_IFREG, 0LL ); puts( "rtems_mkdir a/n/b - expect failure" ); - test_mkdir("a/n/b", S_IRUSR, -1); + test_mkdir( "a/n/b", S_IRUSR, -1 ); puts( "Create node b and open in RDONLY mode - OK" ); - rv = open ("b", O_CREAT | O_RDONLY, omode); - rtems_test_assert(rv >= 0); + rv = open( "b", O_CREAT | O_RDONLY, omode ); + rtems_test_assert( rv >= 0 ); puts( "Closing b - OK" ); - rv = close(rv); - rtems_test_assert(rv == 0); + rv = close( rv ); + rtems_test_assert( rv == 0 ); puts( "rtems_mkdir b - expect failure" ); - test_mkdir("b", omode, -1); - rtems_test_assert(errno == EEXIST); + test_mkdir( "b", omode, -1 ); + rtems_test_assert( errno == EEXIST ); TEST_END(); - exit(0); + exit( 0 ); } #define CONFIGURE_INIT diff --git a/testsuites/sptests/spmountmgr01/init.c b/testsuites/sptests/spmountmgr01/init.c index 60a97311f5..a9e576be78 100644 --- a/testsuites/sptests/spmountmgr01/init.c +++ b/testsuites/sptests/spmountmgr01/init.c @@ -40,8 +40,8 @@ const char rtems_test_name[] = "SPMOUNTMGR 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -int fs_mount( +rtems_task Init( rtems_task_argument argument ); +int fs_mount( rtems_filesystem_mount_table_entry_t *mt_entry, const void *data ); @@ -57,13 +57,11 @@ int fs_mount( return 0; } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - int status = 0; + int status = 0; void *greedy; TEST_BEGIN(); @@ -84,22 +82,12 @@ rtems_task Init( rtems_test_assert( status == 0 ); puts( "Init - attempt to make target(NULL) and mount - expect EINVAL" ); - status = mount_and_make_target_path( - NULL, - NULL, - "fs", - 0, - NULL ); + status = mount_and_make_target_path( NULL, NULL, "fs", 0, NULL ); rtems_test_assert( status == -1 ); rtems_test_assert( errno == EINVAL ); puts( "Init - attempt to make target and mount - expect EINVAL" ); - status = mount_and_make_target_path( - NULL, - "/tmp", - "fs", - 2, - NULL ); + status = mount_and_make_target_path( NULL, "/tmp", "fs", 2, NULL ); rtems_test_assert( status == -1 ); rtems_test_assert( errno == EINVAL ); @@ -141,7 +129,7 @@ rtems_task Init( rtems_test_assert( errno == ENOENT ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -149,7 +137,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spmrsp01/init.c b/testsuites/sptests/spmrsp01/init.c index e405f0c39c..91c4a7fc2b 100644 --- a/testsuites/sptests/spmrsp01/init.c +++ b/testsuites/sptests/spmrsp01/init.c @@ -41,286 +41,280 @@ typedef struct { rtems_id task_id; } test_mrsp_context; -static void create_not_defined(rtems_attribute attr) +static void create_not_defined( rtems_attribute attr ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_semaphore_create( - rtems_build_name('M', 'R', 'S', 'P'), + rtems_build_name( 'M', 'R', 'S', 'P' ), 1, attr, 0, &id ); - rtems_test_assert(sc == RTEMS_NOT_DEFINED); + rtems_test_assert( sc == RTEMS_NOT_DEFINED ); } -static void test_mrsp_create_errors(void) +static void test_mrsp_create_errors( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - puts("test MrsP create errors"); + puts( "test MrsP create errors" ); sc = rtems_semaphore_create( - rtems_build_name('M', 'R', 'S', 'P'), + rtems_build_name( 'M', 'R', 'S', 'P' ), 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY - | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, UINT32_MAX, &id ); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); create_not_defined( - RTEMS_MULTIPROCESSOR_RESOURCE_SHARING - | RTEMS_COUNTING_SEMAPHORE - | RTEMS_PRIORITY + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_COUNTING_SEMAPHORE | + RTEMS_PRIORITY ); create_not_defined( - RTEMS_MULTIPROCESSOR_RESOURCE_SHARING - | RTEMS_SIMPLE_BINARY_SEMAPHORE - | RTEMS_PRIORITY + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_SIMPLE_BINARY_SEMAPHORE | + RTEMS_PRIORITY ); create_not_defined( - RTEMS_MULTIPROCESSOR_RESOURCE_SHARING - | RTEMS_BINARY_SEMAPHORE - | RTEMS_FIFO + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO ); create_not_defined( - RTEMS_MULTIPROCESSOR_RESOURCE_SHARING - | RTEMS_INHERIT_PRIORITY - | RTEMS_BINARY_SEMAPHORE - | RTEMS_PRIORITY + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_INHERIT_PRIORITY | + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY ); create_not_defined( - RTEMS_MULTIPROCESSOR_RESOURCE_SHARING - | RTEMS_PRIORITY_CEILING - | RTEMS_BINARY_SEMAPHORE - | RTEMS_PRIORITY + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_PRIORITY_CEILING | + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY ); create_not_defined( - RTEMS_MULTIPROCESSOR_RESOURCE_SHARING - | RTEMS_INHERIT_PRIORITY - | RTEMS_PRIORITY_CEILING - | RTEMS_BINARY_SEMAPHORE - | RTEMS_PRIORITY + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_INHERIT_PRIORITY | + RTEMS_PRIORITY_CEILING | RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY ); } -static void assert_prio(rtems_task_priority expected_prio) +static void assert_prio( rtems_task_priority expected_prio ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority prio; - sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(prio == expected_prio); + sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( prio == expected_prio ); } -static void test_mrsp_obtain_release(void) +static void test_mrsp_obtain_release( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - puts("test MrsP obtain and release"); + puts( "test MrsP obtain and release" ); sc = rtems_semaphore_create( - rtems_build_name('M', 'R', 'S', 'P'), + rtems_build_name( 'M', 'R', 'S', 'P' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, 1, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - assert_prio(2); + assert_prio( 2 ); - sc = rtems_semaphore_obtain(id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - assert_prio(1); + assert_prio( 1 ); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - sc = rtems_semaphore_release(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - assert_prio(2); + assert_prio( 2 ); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_mrsp_set_priority_errors(void) +static void test_mrsp_set_priority_errors( void ) { - rtems_status_code sc; - rtems_id id; - rtems_id scheduler_id; + rtems_status_code sc; + rtems_id id; + rtems_id scheduler_id; rtems_task_priority prio; - puts("test MrsP set priority errors"); + puts( "test MrsP set priority errors" ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name('C', 'O', 'N', 'T'), + rtems_build_name( 'C', 'O', 'N', 'T' ), 0, RTEMS_COUNTING_SEMAPHORE, 0, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); prio = 1; - sc = rtems_semaphore_set_priority(RTEMS_ID_NONE, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_semaphore_set_priority( + RTEMS_ID_NONE, + scheduler_id, + prio, + &prio + ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); prio = 1; - sc = rtems_semaphore_set_priority(id, RTEMS_ID_NONE, prio, &prio); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_semaphore_set_priority( id, RTEMS_ID_NONE, prio, &prio ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); prio = 0xffffffff; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, &prio ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); prio = 1; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); prio = 1; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_NOT_DEFINED); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, &prio ); + rtems_test_assert( sc == RTEMS_NOT_DEFINED ); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_mrsp_set_priority(void) +static void test_mrsp_set_priority( void ) { - rtems_status_code sc; - rtems_id id; - rtems_id scheduler_id; + rtems_status_code sc; + rtems_id id; + rtems_id scheduler_id; rtems_task_priority prio; - puts("test MrsP set priority"); + puts( "test MrsP set priority" ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name('M', 'R', 'S', 'P'), + rtems_build_name( 'M', 'R', 'S', 'P' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, 1, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); prio = RTEMS_CURRENT_PRIORITY; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(prio == 1); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( prio == 1 ); prio = 1; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(prio == 1); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( prio == 1 ); prio = 2; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(prio == 1); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( prio == 1 ); prio = RTEMS_CURRENT_PRIORITY; - sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(prio == 2); + sc = rtems_semaphore_set_priority( id, scheduler_id, prio, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( prio == 2 ); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_mrsp_task(rtems_task_argument arg) +static void test_mrsp_task( rtems_task_argument arg ) { test_mrsp_context *ctx = (test_mrsp_context *) arg; - rtems_status_code sc; + rtems_status_code sc; - sc = rtems_semaphore_release(ctx->semaphore_id); - rtems_test_assert(sc == RTEMS_NOT_OWNER_OF_RESOURCE); + sc = rtems_semaphore_release( ctx->semaphore_id ); + rtems_test_assert( sc == RTEMS_NOT_OWNER_OF_RESOURCE ); - sc = rtems_semaphore_obtain(ctx->semaphore_id, RTEMS_NO_WAIT, 0); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_semaphore_obtain( ctx->semaphore_id, RTEMS_NO_WAIT, 0 ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); - sc = rtems_semaphore_obtain(ctx->semaphore_id, RTEMS_WAIT, 1); - rtems_test_assert(sc == RTEMS_TIMEOUT); + sc = rtems_semaphore_obtain( ctx->semaphore_id, RTEMS_WAIT, 1 ); + rtems_test_assert( sc == RTEMS_TIMEOUT ); - sc = rtems_event_transient_send(ctx->task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( ctx->task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); rtems_task_exit(); - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void test_mrsp_timeout_and_not_owner_of_resource(void) +static void test_mrsp_timeout_and_not_owner_of_resource( void ) { rtems_status_code sc; - rtems_id id; - rtems_id task_id; + rtems_id id; + rtems_id task_id; test_mrsp_context ctx; - puts("test MrsP timeout and not owner of resource"); + puts( "test MrsP timeout and not owner of resource" ); sc = rtems_semaphore_create( - rtems_build_name('M', 'R', 'S', 'P'), + rtems_build_name( 'M', 'R', 'S', 'P' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_MULTIPROCESSOR_RESOURCE_SHARING, 1, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_obtain(id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('M', 'R', 'S', 'P'), + rtems_build_name( 'M', 'R', 'S', 'P' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); ctx.semaphore_id = id; ctx.task_id = rtems_task_self(); - sc = rtems_task_start(task_id, test_mrsp_task, (rtems_task_argument) &ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, test_mrsp_task, (rtems_task_argument) &ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_release(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -328,7 +322,7 @@ static void Init(rtems_task_argument arg) TEST_BEGIN(); - rtems_resource_snapshot_take(&snapshot); + rtems_resource_snapshot_take( &snapshot ); test_mrsp_create_errors(); test_mrsp_obtain_release(); @@ -336,16 +330,16 @@ static void Init(rtems_task_argument arg) test_mrsp_set_priority(); test_mrsp_timeout_and_not_owner_of_resource(); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INIT_TASK_PRIORITY 2 diff --git a/testsuites/sptests/spmsgq_err01/init.c b/testsuites/sptests/spmsgq_err01/init.c index f860b12a4b..ce3196c2ef 100644 --- a/testsuites/sptests/spmsgq_err01/init.c +++ b/testsuites/sptests/spmsgq_err01/init.c @@ -34,9 +34,7 @@ #include "system.h" const char rtems_test_name[] = "SP MESSAGE QUEUE ERROR 1"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -46,11 +44,11 @@ rtems_task Init( rtems_status_code status; rtems_test_assert( MAX_MESSAGES == 2 ); - + TEST_BEGIN(); - Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); - Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' ); - + Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); + Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' ); + status = rtems_message_queue_broadcast( 100, buffer, MESSAGE_SIZE, &count ); fatal_directive_status( status, @@ -87,7 +85,9 @@ rtems_task Init( RTEMS_INVALID_NUMBER, "rtems_message_queue_create with 0 count" ); - puts( "TA1 - rtems_message_queue_create - count = 0 - RTEMS_INVALID_NUMBER" ); + puts( + "TA1 - rtems_message_queue_create - count = 0 - RTEMS_INVALID_NUMBER" + ); /* max size == 0 */ status = rtems_message_queue_create( @@ -204,7 +204,9 @@ rtems_task Init( RTEMS_INVALID_ADDRESS, "rtems_message_queue_get_number_pending with NULL param" ); - puts("TA1 - rtems_message_queue_get_number_pending - RTEMS_INVALID_ADDRESS"); + puts( + "TA1 - rtems_message_queue_get_number_pending - RTEMS_INVALID_ADDRESS" + ); /* number pending - bad Id */ status = rtems_message_queue_get_number_pending( 100, &count ); @@ -235,7 +237,7 @@ rtems_task Init( status = rtems_message_queue_receive( 100, - (long (*)[4]) buffer, + (long ( * )[ 4 ]) buffer, &size, RTEMS_DEFAULT_OPTIONS, 0 @@ -261,12 +263,12 @@ rtems_task Init( ); puts( "TA1 - rtems_message_queue_receive - Q 1 - " - "RTEMS_INVALID_ADDRESS NULL buffer" + "RTEMS_INVALID_ADDRESS NULL buffer" ); status = rtems_message_queue_receive( Queue_id[ 1 ], - (long (*)[4]) buffer, + (long ( * )[ 4 ]) buffer, NULL, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT @@ -278,12 +280,12 @@ rtems_task Init( ); puts( "TA1 - rtems_message_queue_receive - Q 1 - " - "RTEMS_INVALID_ADDRESS NULL size" + "RTEMS_INVALID_ADDRESS NULL size" ); status = rtems_message_queue_receive( Queue_id[ 1 ], - (long (*)[4]) buffer, + (long ( * )[ 4 ]) buffer, &size, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT @@ -298,7 +300,7 @@ rtems_task Init( puts( "TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds" ); status = rtems_message_queue_receive( Queue_id[ 1 ], - (long (*)[4]) buffer, + (long ( * )[ 4 ]) buffer, &size, RTEMS_DEFAULT_OPTIONS, 3 * rtems_clock_get_ticks_per_second() @@ -335,11 +337,15 @@ rtems_task Init( status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" + ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" + ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); fatal_directive_status( @@ -370,7 +376,11 @@ rtems_task Init( puts( "TA1 - rtems_message_queue_urgent - RTEMS_INVALID_ID" ); status = rtems_message_queue_broadcast( - Queue_id[ 1 ], NULL, MESSAGE_SIZE, &count ); + Queue_id[ 1 ], + NULL, + MESSAGE_SIZE, + &count + ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -381,7 +391,11 @@ rtems_task Init( ); status = rtems_message_queue_broadcast( - Queue_id[ 1 ], buffer, MESSAGE_SIZE + 1, &count ); + Queue_id[ 1 ], + buffer, + MESSAGE_SIZE + 1, + &count + ); fatal_directive_status( status, RTEMS_INVALID_SIZE, @@ -392,7 +406,11 @@ rtems_task Init( ); status = rtems_message_queue_broadcast( - Queue_id[ 1 ], buffer, MESSAGE_SIZE, NULL ); + Queue_id[ 1 ], + buffer, + MESSAGE_SIZE, + NULL + ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, diff --git a/testsuites/sptests/spmsgq_err01/system.h b/testsuites/sptests/spmsgq_err01/system.h index c5628b9835..069f07acc8 100644 --- a/testsuites/sptests/spmsgq_err01/system.h +++ b/testsuites/sptests/spmsgq_err01/system.h @@ -37,54 +37,52 @@ * Message buffer information */ #define MAX_MESSAGES 2 -#define MESSAGE_SIZE (sizeof(long) * 4) +#define MESSAGE_SIZE ( sizeof( long ) * 4 ) /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MAX_MESSAGES, MESSAGE_SIZE) + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( MAX_MESSAGES, MESSAGE_SIZE ) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spmsgq_err02/init.c b/testsuites/sptests/spmsgq_err02/init.c index 63abb444b3..6b66063594 100644 --- a/testsuites/sptests/spmsgq_err02/init.c +++ b/testsuites/sptests/spmsgq_err02/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP MESSAGE QUEUE ERROR 2"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -45,11 +43,11 @@ rtems_task Init( rtems_status_code status; rtems_test_assert( MAX_MESSAGES == 2 ); - + TEST_BEGIN(); - Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - + Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + status = rtems_task_create( Task_name[ 3 ], 1, @@ -60,7 +58,7 @@ rtems_task Init( ); directive_failed( status, "rtems_task_create of TA3" ); puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" ); - + status = rtems_message_queue_create( Queue_name[ 1 ], MAX_MESSAGES, @@ -70,8 +68,8 @@ rtems_task Init( ); directive_failed( status, "rtems_message_queue_create successful" ); puts( "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL" ); - - status = rtems_message_queue_delete( Queue_id[ 1 ] ); + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); directive_failed( status, "rtems_message_queue_delete successful" ); puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); @@ -83,17 +81,19 @@ rtems_task Init( &Queue_id[ 1 ] ); directive_failed( status, "rtems_message_queue_create successful" ); + puts( "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); + directive_failed( status, "rtems_message_queue_send successful" ); puts( - "TA1 - rtems_message_queue_create - Q 1 - 2 DEEP - RTEMS_SUCCESSFUL" + "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send successful" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); - - status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); - directive_failed( status, "rtems_message_queue_send successful" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" + ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); fatal_directive_status( @@ -115,21 +115,25 @@ rtems_task Init( &Queue_id[ 1 ] ); directive_failed( status, "rtems_message_queue_create successful" ); + puts( "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); + directive_failed( status, "rtems_message_queue_send successful" ); puts( - "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL" + "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send successful" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" + ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send successful" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); - - status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); - directive_failed( status, "rtems_message_queue_send successful" ); - puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_SUCCESSFUL" ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_SUCCESSFUL" + ); status = rtems_message_queue_send( Queue_id[ 1 ], buffer, MESSAGE_SIZE ); fatal_directive_status( @@ -137,9 +141,7 @@ rtems_task Init( RTEMS_TOO_MANY, "rtems_message_queue_send too many to limited queue" ); - puts( - "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 1 - RTEMS_TOO_MANY" - ); + puts( "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 1 - RTEMS_TOO_MANY" ); status = rtems_message_queue_delete( Queue_id[ 1 ] ); directive_failed( status, "rtems_message_queue_delete successful" ); @@ -153,9 +155,7 @@ rtems_task Init( &Queue_id[ 1 ] ); directive_failed( status, "rtems_message_queue_create successful" ); - puts( - "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL" - ); + puts( "TA1 - rtems_message_queue_create - Q 1 - 3 DEEP - RTEMS_SUCCESSFUL" ); puts( "TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL" ); status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); diff --git a/testsuites/sptests/spmsgq_err02/system.h b/testsuites/sptests/spmsgq_err02/system.h index b11e200c0d..16c3de60c8 100644 --- a/testsuites/sptests/spmsgq_err02/system.h +++ b/testsuites/sptests/spmsgq_err02/system.h @@ -37,58 +37,54 @@ * Message buffer information */ #define MAX_MESSAGES 2 -#define MESSAGE_SIZE (sizeof(long) * 4) +#define MESSAGE_SIZE ( sizeof( long ) * 4 ) /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_3( - rtems_task_argument argument -); +rtems_task Task_3( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(MAX_MESSAGES, MESSAGE_SIZE) + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( MAX_MESSAGES, MESSAGE_SIZE ) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spmsgq_err02/task3.c b/testsuites/sptests/spmsgq_err02/task3.c index 2934fd24c1..4c797b789b 100644 --- a/testsuites/sptests/spmsgq_err02/task3.c +++ b/testsuites/sptests/spmsgq_err02/task3.c @@ -42,9 +42,7 @@ #include "system.h" -rtems_task Task_3( - rtems_task_argument argument -) +rtems_task Task_3( rtems_task_argument argument ) { (void) argument; @@ -55,7 +53,7 @@ rtems_task Task_3( puts( "TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER" ); status = rtems_message_queue_receive( Queue_id[ 1 ], - (long (*)[4])buffer, + (long ( * )[ 4 ]) buffer, &size, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT diff --git a/testsuites/sptests/spmutex01/init.c b/testsuites/sptests/spmutex01/init.c index a2de0e1a96..6544f44916 100644 --- a/testsuites/sptests/spmutex01/init.c +++ b/testsuites/sptests/spmutex01/init.c @@ -62,75 +62,64 @@ typedef enum { REQ_MTX_POSIX_RELEASE = RTEMS_EVENT_13 } request_id; -typedef enum { - M, - A_1, - A_2_0, - A_2_1, - H, - NONE -} task_id; +typedef enum { M, A_1, A_2_0, A_2_1, H, NONE } task_id; -typedef enum { - MTX_0, - MTX_1, - MTX_2 -} mutex_id; +typedef enum { MTX_0, MTX_1, MTX_2 } mutex_id; typedef struct { - rtems_id mtx[MTX_COUNT]; - mtx_t mtx_c11; + rtems_id mtx[ MTX_COUNT ]; + mtx_t mtx_c11; pthread_mutex_t mtx_posix; - rtems_id tasks[TASK_COUNT]; - int generation[TASK_COUNT]; - int expected_generation[TASK_COUNT]; - jmp_buf deadlock_return_context; + rtems_id tasks[ TASK_COUNT ]; + int generation[ TASK_COUNT ]; + int expected_generation[ TASK_COUNT ]; + jmp_buf deadlock_return_context; } test_context; static test_context test_instance; static void start_task( - test_context *ctx, - task_id id, - rtems_task_entry entry, + test_context *ctx, + task_id id, + rtems_task_entry entry, rtems_task_priority prio ) { rtems_status_code sc; sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), prio, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &ctx->tasks[id] + &ctx->tasks[ id ] ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(ctx->tasks[id], entry, id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( ctx->tasks[ id ], entry, id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void send_event(test_context *ctx, task_id id, rtems_event_set events) +static void send_event( test_context *ctx, task_id id, rtems_event_set events ) { rtems_status_code sc; - sc = rtems_event_send(ctx->tasks[id], events); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( ctx->tasks[ id ], events ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void wait(void) +static void wait( void ) { rtems_status_code sc; - sc = rtems_task_wake_after(4); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_wake_after( 4 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static rtems_event_set wait_for_events(void) +static rtems_event_set wait_for_events( void ) { - rtems_event_set events; + rtems_event_set events; rtems_status_code sc; sc = rtems_event_receive( @@ -139,602 +128,596 @@ static rtems_event_set wait_for_events(void) RTEMS_NO_TIMEOUT, &events ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); return events; } -static void sync_with_helper(test_context *ctx) +static void sync_with_helper( test_context *ctx ) { rtems_event_set events; - send_event(ctx, H, REQ_WAKE_UP_HELPER); + send_event( ctx, H, REQ_WAKE_UP_HELPER ); events = wait_for_events(); - rtems_test_assert(events == REQ_WAKE_UP_MASTER); + rtems_test_assert( events == REQ_WAKE_UP_MASTER ); } -static void request(test_context *ctx, task_id id, request_id req) +static void request( test_context *ctx, task_id id, request_id req ) { - send_event(ctx, id, req); - sync_with_helper(ctx); + send_event( ctx, id, req ); + sync_with_helper( ctx ); } -static void obtain_timeout(test_context *ctx, mutex_id id) +static void obtain_timeout( test_context *ctx, mutex_id id ) { rtems_status_code sc; - sc = rtems_semaphore_obtain(ctx->mtx[id], RTEMS_WAIT, 2); - rtems_test_assert(sc == RTEMS_TIMEOUT); + sc = rtems_semaphore_obtain( ctx->mtx[ id ], RTEMS_WAIT, 2 ); + rtems_test_assert( sc == RTEMS_TIMEOUT ); } -static void obtain_unsatisfied(test_context *ctx, mutex_id id) +static void obtain_unsatisfied( test_context *ctx, mutex_id id ) { rtems_status_code sc; - sc = rtems_semaphore_obtain(ctx->mtx[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_UNSATISFIED); + sc = rtems_semaphore_obtain( ctx->mtx[ id ], RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_UNSATISFIED ); } -static void obtain(test_context *ctx, mutex_id id) +static void obtain( test_context *ctx, mutex_id id ) { rtems_status_code sc; - sc = rtems_semaphore_obtain(ctx->mtx[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->mtx[ id ], RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void deadlock_obtain(test_context *ctx, mutex_id id) +static void deadlock_obtain( test_context *ctx, mutex_id id ) { rtems_status_code sc; - sc = rtems_semaphore_obtain(ctx->mtx[id], RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_INCORRECT_STATE); + sc = rtems_semaphore_obtain( ctx->mtx[ id ], RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_INCORRECT_STATE ); } -static void release(test_context *ctx, mutex_id id) +static void release( test_context *ctx, mutex_id id ) { rtems_status_code sc; - sc = rtems_semaphore_release(ctx->mtx[id]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->mtx[ id ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void flush(test_context *ctx, mutex_id id) +static void flush( test_context *ctx, mutex_id id ) { rtems_status_code sc; - sc = rtems_semaphore_flush(ctx->mtx[id]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_flush( ctx->mtx[ id ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void obtain_c11(test_context *ctx) +static void obtain_c11( test_context *ctx ) { int status; - status = mtx_lock(&ctx->mtx_c11); - rtems_test_assert(status == thrd_success); + status = mtx_lock( &ctx->mtx_c11 ); + rtems_test_assert( status == thrd_success ); } -static void deadlock_obtain_c11(test_context *ctx) +static void deadlock_obtain_c11( test_context *ctx ) { - if (setjmp(ctx->deadlock_return_context) == 0) { - (void) mtx_lock(&ctx->mtx_c11); + if ( setjmp( ctx->deadlock_return_context ) == 0 ) { + (void) mtx_lock( &ctx->mtx_c11 ); } } -static void release_c11(test_context *ctx) +static void release_c11( test_context *ctx ) { int status; - status = mtx_unlock(&ctx->mtx_c11); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( &ctx->mtx_c11 ); + rtems_test_assert( status == thrd_success ); } -static void obtain_posix(test_context *ctx) +static void obtain_posix( test_context *ctx ) { int error; - error = pthread_mutex_lock(&ctx->mtx_posix); - rtems_test_assert(error == 0); + error = pthread_mutex_lock( &ctx->mtx_posix ); + rtems_test_assert( error == 0 ); } -static void deadlock_obtain_posix(test_context *ctx) +static void deadlock_obtain_posix( test_context *ctx ) { int error; - error = pthread_mutex_lock(&ctx->mtx_posix); - rtems_test_assert(error == EDEADLK); + error = pthread_mutex_lock( &ctx->mtx_posix ); + rtems_test_assert( error == EDEADLK ); } -static void release_posix(test_context *ctx) +static void release_posix( test_context *ctx ) { int error; - error = pthread_mutex_unlock(&ctx->mtx_posix); - rtems_test_assert(error == 0); + error = pthread_mutex_unlock( &ctx->mtx_posix ); + rtems_test_assert( error == 0 ); } -static void check_generations(test_context *ctx, task_id a, task_id b) +static void check_generations( test_context *ctx, task_id a, task_id b ) { size_t i; - if (a != NONE) { - ++ctx->expected_generation[a]; + if ( a != NONE ) { + ++ctx->expected_generation[ a ]; } - if (b != NONE) { - ++ctx->expected_generation[b]; + if ( b != NONE ) { + ++ctx->expected_generation[ b ]; } - for (i = 0; i < TASK_COUNT; ++i) { - rtems_test_assert(ctx->generation[i] == ctx->expected_generation[i]); + for ( i = 0; i < TASK_COUNT; ++i ) { + rtems_test_assert( ctx->generation[ i ] == ctx->expected_generation[ i ] ); } } static void assert_prio( - test_context *ctx, - task_id id, + test_context *ctx, + task_id id, rtems_task_priority expected ) { rtems_task_priority actual; - rtems_status_code sc; + rtems_status_code sc; sc = rtems_task_set_priority( - ctx->tasks[id], + ctx->tasks[ id ], RTEMS_CURRENT_PRIORITY, &actual ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(expected == actual); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( expected == actual ); } static void change_prio( - test_context *ctx, - task_id id, + test_context *ctx, + task_id id, rtems_task_priority prio ) { rtems_status_code sc; - sc = rtems_task_set_priority( - ctx->tasks[id], - prio, - &prio - ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_priority( ctx->tasks[ id ], prio, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void helper(rtems_task_argument arg) +static void helper( rtems_task_argument arg ) { (void) arg; test_context *ctx = &test_instance; - while (true) { + while ( true ) { rtems_event_set events = wait_for_events(); - rtems_test_assert(events == REQ_WAKE_UP_HELPER); - send_event(ctx, M, REQ_WAKE_UP_MASTER); + rtems_test_assert( events == REQ_WAKE_UP_HELPER ); + send_event( ctx, M, REQ_WAKE_UP_MASTER ); } } -static void worker(rtems_task_argument arg) +static void worker( rtems_task_argument arg ) { (void) arg; test_context *ctx = &test_instance; - task_id id = arg; + task_id id = arg; - while (true) { + while ( true ) { rtems_event_set events = wait_for_events(); - if ((events & REQ_MTX_0_OBTAIN) != 0) { - obtain(ctx, MTX_0); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_0_OBTAIN ) != 0 ) { + obtain( ctx, MTX_0 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_0_OBTAIN_UNSATISFIED) != 0) { - obtain_unsatisfied(ctx, MTX_0); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_0_OBTAIN_UNSATISFIED ) != 0 ) { + obtain_unsatisfied( ctx, MTX_0 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_0_RELEASE) != 0) { - release(ctx, MTX_0); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_0_RELEASE ) != 0 ) { + release( ctx, MTX_0 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_1_OBTAIN) != 0) { - obtain(ctx, MTX_1); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_1_OBTAIN ) != 0 ) { + obtain( ctx, MTX_1 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_1_OBTAIN_TIMEOUT) != 0) { - obtain_timeout(ctx, MTX_1); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_1_OBTAIN_TIMEOUT ) != 0 ) { + obtain_timeout( ctx, MTX_1 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_1_RELEASE) != 0) { - release(ctx, MTX_1); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_1_RELEASE ) != 0 ) { + release( ctx, MTX_1 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_2_OBTAIN) != 0) { - obtain(ctx, MTX_2); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_2_OBTAIN ) != 0 ) { + obtain( ctx, MTX_2 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_2_RELEASE) != 0) { - release(ctx, MTX_2); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_2_RELEASE ) != 0 ) { + release( ctx, MTX_2 ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_C11_OBTAIN) != 0) { - obtain_c11(ctx); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_C11_OBTAIN ) != 0 ) { + obtain_c11( ctx ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_C11_RELEASE) != 0) { - release_c11(ctx); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_C11_RELEASE ) != 0 ) { + release_c11( ctx ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_POSIX_OBTAIN) != 0) { - obtain_posix(ctx); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_POSIX_OBTAIN ) != 0 ) { + obtain_posix( ctx ); + ++ctx->generation[ id ]; } - if ((events & REQ_MTX_POSIX_RELEASE) != 0) { - release_posix(ctx); - ++ctx->generation[id]; + if ( ( events & REQ_MTX_POSIX_RELEASE ) != 0 ) { + release_posix( ctx ); + ++ctx->generation[ id ]; } } } -static void set_up(test_context *ctx) +static void set_up( test_context *ctx ) { - rtems_status_code sc; - int status; - size_t i; - int error; + rtems_status_code sc; + int status; + size_t i; + int error; pthread_mutexattr_t attr; - ctx->tasks[M] = rtems_task_self(); - start_task(ctx, A_1, worker, 1); - start_task(ctx, A_2_0, worker, 2); - start_task(ctx, A_2_1, worker, 2); - start_task(ctx, H, helper, 3); + ctx->tasks[ M ] = rtems_task_self(); + start_task( ctx, A_1, worker, 1 ); + start_task( ctx, A_2_0, worker, 2 ); + start_task( ctx, A_2_1, worker, 2 ); + start_task( ctx, H, helper, 3 ); - for (i = 0; i < MTX_COUNT; ++i) { + for ( i = 0; i < MTX_COUNT; ++i ) { sc = rtems_semaphore_create( - rtems_build_name(' ', 'M', 'T', 'X'), + rtems_build_name( ' ', 'M', 'T', 'X' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0, - &ctx->mtx[i] + &ctx->mtx[ i ] ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - status = mtx_init(&ctx->mtx_c11, mtx_plain); - rtems_test_assert(status == thrd_success); + status = mtx_init( &ctx->mtx_c11, mtx_plain ); + rtems_test_assert( status == thrd_success ); - error = pthread_mutexattr_init(&attr); - rtems_test_assert(error == 0); + error = pthread_mutexattr_init( &attr ); + rtems_test_assert( error == 0 ); - error = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); - rtems_test_assert(error == 0); + error = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT ); + rtems_test_assert( error == 0 ); - error = pthread_mutex_init(&ctx->mtx_posix, &attr); - rtems_test_assert(error == 0); + error = pthread_mutex_init( &ctx->mtx_posix, &attr ); + rtems_test_assert( error == 0 ); - error = pthread_mutexattr_destroy(&attr); - rtems_test_assert(error == 0); + error = pthread_mutexattr_destroy( &attr ); + rtems_test_assert( error == 0 ); } -static void test_inherit(test_context *ctx) +static void test_inherit( test_context *ctx ) { - assert_prio(ctx, M, 3); - obtain(ctx, MTX_0); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, M, 1); - change_prio(ctx, A_1, 2); - assert_prio(ctx, M, 2); - change_prio(ctx, A_1, 3); - assert_prio(ctx, M, 3); - change_prio(ctx, A_1, 4); - assert_prio(ctx, M, 3); - change_prio(ctx, A_1, 1); - assert_prio(ctx, M, 1); - release(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - assert_prio(ctx, M, 3); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); + assert_prio( ctx, M, 3 ); + obtain( ctx, MTX_0 ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, M, 1 ); + change_prio( ctx, A_1, 2 ); + assert_prio( ctx, M, 2 ); + change_prio( ctx, A_1, 3 ); + assert_prio( ctx, M, 3 ); + change_prio( ctx, A_1, 4 ); + assert_prio( ctx, M, 3 ); + change_prio( ctx, A_1, 1 ); + assert_prio( ctx, M, 1 ); + release( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + assert_prio( ctx, M, 3 ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void test_inherit_fifo_for_equal_priority(test_context *ctx) +static void test_inherit_fifo_for_equal_priority( test_context *ctx ) { - assert_prio(ctx, M, 3); - obtain(ctx, MTX_0); - request(ctx, A_2_0, REQ_MTX_0_OBTAIN); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - request(ctx, A_2_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, M, 1); - release(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - assert_prio(ctx, M, 3); - assert_prio(ctx, A_1, 1); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, A_2_0); - request(ctx, A_2_0, REQ_MTX_0_RELEASE); - check_generations(ctx, A_2_0, A_2_1); - request(ctx, A_2_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_2_1, NONE); + assert_prio( ctx, M, 3 ); + obtain( ctx, MTX_0 ); + request( ctx, A_2_0, REQ_MTX_0_OBTAIN ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + request( ctx, A_2_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, M, 1 ); + release( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + assert_prio( ctx, M, 3 ); + assert_prio( ctx, A_1, 1 ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, A_2_0 ); + request( ctx, A_2_0, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_2_0, A_2_1 ); + request( ctx, A_2_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_2_1, NONE ); } -static void test_inherit_nested_vertical(test_context *ctx) +static void test_inherit_nested_vertical( test_context *ctx ) { - assert_prio(ctx, M, 3); - obtain(ctx, MTX_0); - obtain(ctx, MTX_1); - request(ctx, A_1, REQ_MTX_1_OBTAIN); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, M, 1); - release(ctx, MTX_1); - check_generations(ctx, A_1, NONE); - assert_prio(ctx, M, 3); - request(ctx, A_1, REQ_MTX_1_RELEASE); - check_generations(ctx, A_1, NONE); - release(ctx, MTX_0); + assert_prio( ctx, M, 3 ); + obtain( ctx, MTX_0 ); + obtain( ctx, MTX_1 ); + request( ctx, A_1, REQ_MTX_1_OBTAIN ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, M, 1 ); + release( ctx, MTX_1 ); + check_generations( ctx, A_1, NONE ); + assert_prio( ctx, M, 3 ); + request( ctx, A_1, REQ_MTX_1_RELEASE ); + check_generations( ctx, A_1, NONE ); + release( ctx, MTX_0 ); } -static void test_inherit_nested_vertical_timeout(test_context *ctx) +static void test_inherit_nested_vertical_timeout( test_context *ctx ) { - assert_prio(ctx, M, 3); - obtain(ctx, MTX_0); - obtain(ctx, MTX_1); - request(ctx, A_1, REQ_MTX_1_OBTAIN_TIMEOUT); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, M, 1); + assert_prio( ctx, M, 3 ); + obtain( ctx, MTX_0 ); + obtain( ctx, MTX_1 ); + request( ctx, A_1, REQ_MTX_1_OBTAIN_TIMEOUT ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, M, 1 ); wait(); - check_generations(ctx, A_1, NONE); - assert_prio(ctx, M, 3); - release(ctx, MTX_1); - release(ctx, MTX_0); + check_generations( ctx, A_1, NONE ); + assert_prio( ctx, M, 3 ); + release( ctx, MTX_1 ); + release( ctx, MTX_0 ); } -static void test_inherit_nested_horizontal(test_context *ctx) +static void test_inherit_nested_horizontal( test_context *ctx ) { - assert_prio(ctx, M, 3); - obtain(ctx, MTX_0); - request(ctx, A_2_0, REQ_MTX_1_OBTAIN); - check_generations(ctx, A_2_0, NONE); - request(ctx, A_2_0, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, M, 2); - request(ctx, A_1, REQ_MTX_1_OBTAIN_TIMEOUT); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, A_2_0, 1); - assert_prio(ctx, M, 1); + assert_prio( ctx, M, 3 ); + obtain( ctx, MTX_0 ); + request( ctx, A_2_0, REQ_MTX_1_OBTAIN ); + check_generations( ctx, A_2_0, NONE ); + request( ctx, A_2_0, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, M, 2 ); + request( ctx, A_1, REQ_MTX_1_OBTAIN_TIMEOUT ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, A_2_0, 1 ); + assert_prio( ctx, M, 1 ); wait(); - check_generations(ctx, A_1, NONE); - assert_prio(ctx, A_2_0, 2); - assert_prio(ctx, M, 2); - request(ctx, A_1, REQ_MTX_1_OBTAIN); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, A_2_0, 1); - assert_prio(ctx, M, 1); - change_prio(ctx, A_1, 2); - assert_prio(ctx, M, 2); - change_prio(ctx, A_1, 3); - assert_prio(ctx, M, 2); - change_prio(ctx, A_2_0, 3); - assert_prio(ctx, M, 3); - change_prio(ctx, A_2_0, 2); - assert_prio(ctx, M, 2); - change_prio(ctx, A_1, 1); - assert_prio(ctx, M, 1); - release(ctx, MTX_0); - check_generations(ctx, A_2_0, NONE); - assert_prio(ctx, A_2_0, 1); - assert_prio(ctx, M, 3); - request(ctx, A_2_0, REQ_MTX_0_RELEASE); - check_generations(ctx, A_2_0, NONE); - assert_prio(ctx, A_2_0, 1); - request(ctx, A_2_0, REQ_MTX_1_RELEASE); - check_generations(ctx, A_1, A_2_0); - assert_prio(ctx, A_2_0, 2); - request(ctx, A_1, REQ_MTX_1_RELEASE); - check_generations(ctx, A_1, NONE); + check_generations( ctx, A_1, NONE ); + assert_prio( ctx, A_2_0, 2 ); + assert_prio( ctx, M, 2 ); + request( ctx, A_1, REQ_MTX_1_OBTAIN ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, A_2_0, 1 ); + assert_prio( ctx, M, 1 ); + change_prio( ctx, A_1, 2 ); + assert_prio( ctx, M, 2 ); + change_prio( ctx, A_1, 3 ); + assert_prio( ctx, M, 2 ); + change_prio( ctx, A_2_0, 3 ); + assert_prio( ctx, M, 3 ); + change_prio( ctx, A_2_0, 2 ); + assert_prio( ctx, M, 2 ); + change_prio( ctx, A_1, 1 ); + assert_prio( ctx, M, 1 ); + release( ctx, MTX_0 ); + check_generations( ctx, A_2_0, NONE ); + assert_prio( ctx, A_2_0, 1 ); + assert_prio( ctx, M, 3 ); + request( ctx, A_2_0, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_2_0, NONE ); + assert_prio( ctx, A_2_0, 1 ); + request( ctx, A_2_0, REQ_MTX_1_RELEASE ); + check_generations( ctx, A_1, A_2_0 ); + assert_prio( ctx, A_2_0, 2 ); + request( ctx, A_1, REQ_MTX_1_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void test_inherit_flush(test_context *ctx) +static void test_inherit_flush( test_context *ctx ) { - assert_prio(ctx, M, 3); - obtain(ctx, MTX_0); - request(ctx, A_1, REQ_MTX_0_OBTAIN_UNSATISFIED); - check_generations(ctx, NONE, NONE); - assert_prio(ctx, M, 1); - flush(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - assert_prio(ctx, M, 3); - release(ctx, MTX_0); + assert_prio( ctx, M, 3 ); + obtain( ctx, MTX_0 ); + request( ctx, A_1, REQ_MTX_0_OBTAIN_UNSATISFIED ); + check_generations( ctx, NONE, NONE ); + assert_prio( ctx, M, 1 ); + flush( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + assert_prio( ctx, M, 3 ); + release( ctx, MTX_0 ); } -static void test_deadlock_two_classic(test_context *ctx) +static void test_deadlock_two_classic( test_context *ctx ) { - obtain(ctx, MTX_0); - request(ctx, A_1, REQ_MTX_1_OBTAIN); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - deadlock_obtain(ctx, MTX_1); - release(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_1_RELEASE); - check_generations(ctx, A_1, NONE); + obtain( ctx, MTX_0 ); + request( ctx, A_1, REQ_MTX_1_OBTAIN ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + deadlock_obtain( ctx, MTX_1 ); + release( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_1_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void test_deadlock_three_classic(test_context *ctx) +static void test_deadlock_three_classic( test_context *ctx ) { - obtain(ctx, MTX_0); - request(ctx, A_1, REQ_MTX_1_OBTAIN); - check_generations(ctx, A_1, NONE); - request(ctx, A_2_0, REQ_MTX_2_OBTAIN); - check_generations(ctx, A_2_0, NONE); - request(ctx, A_2_0, REQ_MTX_1_OBTAIN); - check_generations(ctx, NONE, NONE); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - deadlock_obtain(ctx, MTX_2); - release(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_1_RELEASE); - check_generations(ctx, A_1, A_2_0); - request(ctx, A_2_0, REQ_MTX_2_RELEASE); - check_generations(ctx, A_2_0, NONE); - request(ctx, A_2_0, REQ_MTX_1_RELEASE); - check_generations(ctx, A_2_0, NONE); + obtain( ctx, MTX_0 ); + request( ctx, A_1, REQ_MTX_1_OBTAIN ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_2_0, REQ_MTX_2_OBTAIN ); + check_generations( ctx, A_2_0, NONE ); + request( ctx, A_2_0, REQ_MTX_1_OBTAIN ); + check_generations( ctx, NONE, NONE ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + deadlock_obtain( ctx, MTX_2 ); + release( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_1_RELEASE ); + check_generations( ctx, A_1, A_2_0 ); + request( ctx, A_2_0, REQ_MTX_2_RELEASE ); + check_generations( ctx, A_2_0, NONE ); + request( ctx, A_2_0, REQ_MTX_1_RELEASE ); + check_generations( ctx, A_2_0, NONE ); } -static void test_deadlock_c11_and_classic(test_context *ctx) +static void test_deadlock_c11_and_classic( test_context *ctx ) { - obtain_c11(ctx); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_C11_OBTAIN); - check_generations(ctx, NONE, NONE); - deadlock_obtain(ctx, MTX_0); - release_c11(ctx); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_C11_RELEASE); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); + obtain_c11( ctx ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_C11_OBTAIN ); + check_generations( ctx, NONE, NONE ); + deadlock_obtain( ctx, MTX_0 ); + release_c11( ctx ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_C11_RELEASE ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void test_deadlock_classic_and_c11(test_context *ctx) +static void test_deadlock_classic_and_c11( test_context *ctx ) { - obtain(ctx, MTX_0); - request(ctx, A_1, REQ_MTX_C11_OBTAIN); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - deadlock_obtain_c11(ctx); - release(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_C11_RELEASE); - check_generations(ctx, A_1, NONE); + obtain( ctx, MTX_0 ); + request( ctx, A_1, REQ_MTX_C11_OBTAIN ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + deadlock_obtain_c11( ctx ); + release( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_C11_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void test_deadlock_posix_and_classic(test_context *ctx) +static void test_deadlock_posix_and_classic( test_context *ctx ) { - obtain_posix(ctx); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_POSIX_OBTAIN); - check_generations(ctx, NONE, NONE); - deadlock_obtain(ctx, MTX_0); - release_posix(ctx); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_POSIX_RELEASE); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); + obtain_posix( ctx ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_POSIX_OBTAIN ); + check_generations( ctx, NONE, NONE ); + deadlock_obtain( ctx, MTX_0 ); + release_posix( ctx ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_POSIX_RELEASE ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void test_deadlock_classic_and_posix(test_context *ctx) +static void test_deadlock_classic_and_posix( test_context *ctx ) { - obtain(ctx, MTX_0); - request(ctx, A_1, REQ_MTX_POSIX_OBTAIN); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_OBTAIN); - check_generations(ctx, NONE, NONE); - deadlock_obtain_posix(ctx); - release(ctx, MTX_0); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_0_RELEASE); - check_generations(ctx, A_1, NONE); - request(ctx, A_1, REQ_MTX_POSIX_RELEASE); - check_generations(ctx, A_1, NONE); + obtain( ctx, MTX_0 ); + request( ctx, A_1, REQ_MTX_POSIX_OBTAIN ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_OBTAIN ); + check_generations( ctx, NONE, NONE ); + deadlock_obtain_posix( ctx ); + release( ctx, MTX_0 ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_0_RELEASE ); + check_generations( ctx, A_1, NONE ); + request( ctx, A_1, REQ_MTX_POSIX_RELEASE ); + check_generations( ctx, A_1, NONE ); } -static void tear_down(test_context *ctx) +static void tear_down( test_context *ctx ) { rtems_status_code sc; - size_t i; - int error; + size_t i; + int error; - for (i = 1; i < TASK_COUNT; ++i) { - sc = rtems_task_delete(ctx->tasks[i]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + for ( i = 1; i < TASK_COUNT; ++i ) { + sc = rtems_task_delete( ctx->tasks[ i ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - for (i = 0; i < MTX_COUNT; ++i) { - sc = rtems_semaphore_delete(ctx->mtx[i]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + for ( i = 0; i < MTX_COUNT; ++i ) { + sc = rtems_semaphore_delete( ctx->mtx[ i ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - mtx_destroy(&ctx->mtx_c11); + mtx_destroy( &ctx->mtx_c11 ); - error = pthread_mutex_destroy(&ctx->mtx_posix); - rtems_test_assert(error == 0); + error = pthread_mutex_destroy( &ctx->mtx_posix ); + rtems_test_assert( error == 0 ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; - test_context *ctx = &test_instance; + test_context *ctx = &test_instance; rtems_resource_snapshot snapshot; TEST_BEGIN(); - rtems_resource_snapshot_take(&snapshot); + rtems_resource_snapshot_take( &snapshot ); - set_up(ctx); - test_inherit(ctx); - test_inherit_fifo_for_equal_priority(ctx); - test_inherit_nested_vertical(ctx); - test_inherit_nested_vertical_timeout(ctx); - test_inherit_nested_horizontal(ctx); - test_inherit_flush(ctx); - test_deadlock_two_classic(ctx); - test_deadlock_three_classic(ctx); - test_deadlock_c11_and_classic(ctx); - test_deadlock_classic_and_c11(ctx); - test_deadlock_posix_and_classic(ctx); - test_deadlock_classic_and_posix(ctx); - tear_down(ctx); + set_up( ctx ); + test_inherit( ctx ); + test_inherit_fifo_for_equal_priority( ctx ); + test_inherit_nested_vertical( ctx ); + test_inherit_nested_vertical_timeout( ctx ); + test_inherit_nested_horizontal( ctx ); + test_inherit_flush( ctx ); + test_deadlock_two_classic( ctx ); + test_deadlock_three_classic( ctx ); + test_deadlock_c11_and_classic( ctx ); + test_deadlock_classic_and_c11( ctx ); + test_deadlock_posix_and_classic( ctx ); + test_deadlock_classic_and_posix( ctx ); + tear_down( ctx ); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { - if ( - source == INTERNAL_ERROR_CORE - && !always_set_to_false - && error == INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK + source == INTERNAL_ERROR_CORE && !always_set_to_false && + error == INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK ) { test_context *ctx = &test_instance; - _ISR_Set_level(0); - longjmp(ctx->deadlock_return_context, 1); + _ISR_Set_level( 0 ); + longjmp( ctx->deadlock_return_context, 1 ); } } @@ -746,8 +729,7 @@ static void fatal_extension( #define CONFIGURE_MAXIMUM_SEMAPHORES 3 #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_INIT_TASK_PRIORITY 3 diff --git a/testsuites/sptests/spnsext01/init.c b/testsuites/sptests/spnsext01/init.c index 92b3aa1143..17e0d95289 100644 --- a/testsuites/sptests/spnsext01/init.c +++ b/testsuites/sptests/spnsext01/init.c @@ -33,60 +33,60 @@ const char rtems_test_name[] = "SPNSEXT 1"; -static rtems_task Init(rtems_task_argument argument) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code sc = RTEMS_SUCCESSFUL; - RTEMS_INTERRUPT_LOCK_DECLARE(, lock) + RTEMS_INTERRUPT_LOCK_DECLARE(, lock ) rtems_interrupt_lock_context lock_context; - rtems_interval t0 = 0; - rtems_interval t1 = 0; - int i = 0; - int n = 0; - struct timespec uptime; - struct timespec new_uptime; + rtems_interval t0 = 0; + rtems_interval t1 = 0; + int i = 0; + int n = 0; + struct timespec uptime; + struct timespec new_uptime; TEST_BEGIN(); /* Align with clock tick */ t0 = rtems_clock_get_ticks_since_boot(); - while ((t1 = rtems_clock_get_ticks_since_boot()) == t0) { + while ( ( t1 = rtems_clock_get_ticks_since_boot() ) == t0 ) { /* Do nothing */ } t0 = t1; - sc = rtems_clock_get_uptime(&uptime); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - while ((t1 = rtems_clock_get_ticks_since_boot()) == t0) { + sc = rtems_clock_get_uptime( &uptime ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + while ( ( t1 = rtems_clock_get_ticks_since_boot() ) == t0 ) { ++n; - sc = rtems_clock_get_uptime(&new_uptime); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(!_Timespec_Less_than(&new_uptime, &uptime)); + sc = rtems_clock_get_uptime( &new_uptime ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( !_Timespec_Less_than( &new_uptime, &uptime ) ); uptime = new_uptime; } - n = (3 * n) / 2; + n = ( 3 * n ) / 2; - rtems_interrupt_lock_initialize(&lock, "test"); - rtems_interrupt_lock_acquire(&lock, &lock_context); - sc = rtems_clock_get_uptime(&uptime); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - for (i = 0; i < n; ++i) { + rtems_interrupt_lock_initialize( &lock, "test" ); + rtems_interrupt_lock_acquire( &lock, &lock_context ); + sc = rtems_clock_get_uptime( &uptime ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + for ( i = 0; i < n; ++i ) { /* Preserve execution time of previous loop */ rtems_clock_get_ticks_since_boot(); - sc = rtems_clock_get_uptime(&new_uptime); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(!_Timespec_Less_than(&new_uptime, &uptime)); + sc = rtems_clock_get_uptime( &new_uptime ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( !_Timespec_Less_than( &new_uptime, &uptime ) ); uptime = new_uptime; } - rtems_interrupt_lock_release(&lock, &lock_context); - rtems_interrupt_lock_destroy(&lock); + rtems_interrupt_lock_release( &lock, &lock_context ); + rtems_interrupt_lock_destroy( &lock ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_INIT diff --git a/testsuites/sptests/spntp01/init.c b/testsuites/sptests/spntp01/init.c index 4f23838cb0..e548919027 100644 --- a/testsuites/sptests/spntp01/init.c +++ b/testsuites/sptests/spntp01/init.c @@ -42,8 +42,8 @@ const char rtems_test_name[] = "SPNTP 1"; T_TEST_CASE( NTP ) { struct ntptimeval ntv; - struct timex tx; - int status; + struct timex tx; + int status; errno = 0; status = ntp_gettime( NULL ); @@ -88,7 +88,7 @@ T_TEST_CASE( NTP ) T_eq_long( tx.errcnt, 0 ); T_eq_long( tx.stbcnt, 0 ); - status = adjtime( NULL, NULL ); + status = adjtime( NULL, NULL ); T_eq_int( status, 0 ); } diff --git a/testsuites/sptests/spobjgetnext/init.c b/testsuites/sptests/spobjgetnext/init.c index 5716b9880c..60a533a6dc 100644 --- a/testsuites/sptests/spobjgetnext/init.c +++ b/testsuites/sptests/spobjgetnext/init.c @@ -40,33 +40,24 @@ const char rtems_test_name[] = "SPOBJGETNEXT"; /* prototypes */ -int scan_objects( - Objects_Information *information, - Objects_Id start -); +int scan_objects( Objects_Information *information, Objects_Id start ); #define MAX_SCAN 10 -int scan_objects( - Objects_Information *information, - Objects_Id start -) +int scan_objects( Objects_Information *information, Objects_Id start ) { - Objects_Control *o[MAX_SCAN]; - int i; - Objects_Id id; + Objects_Control *o[ MAX_SCAN ]; + int i; + Objects_Id id; - memset( o, 1, sizeof(o) ); + memset( o, 1, sizeof( o ) ); id = start; - for (i=0 ; i= 1 task and make sure the counts are correct when */ diff --git a/testsuites/sptests/spobjgetnext/system.h b/testsuites/sptests/spobjgetnext/system.h index 63d865d851..b7cf6756eb 100644 --- a/testsuites/sptests/spobjgetnext/system.h +++ b/testsuites/sptests/spobjgetnext/system.h @@ -30,9 +30,7 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ @@ -43,9 +41,9 @@ rtems_task Init( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 #include diff --git a/testsuites/sptests/sppagesize/init.c b/testsuites/sptests/sppagesize/init.c index 4393d31ef3..96773e5faa 100644 --- a/testsuites/sptests/sppagesize/init.c +++ b/testsuites/sptests/sppagesize/init.c @@ -38,22 +38,20 @@ const char rtems_test_name[] = "SPPAGESIZE"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { - (void) argument; + (void) argument; - TEST_BEGIN(); + TEST_BEGIN(); - rtems_test_assert(PAGESIZE == PAGE_SIZE); - rtems_test_assert(getpagesize() == PAGE_SIZE); + rtems_test_assert( PAGESIZE == PAGE_SIZE ); + rtems_test_assert( getpagesize() == PAGE_SIZE ); - TEST_END(); + TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER diff --git a/testsuites/sptests/sppartition_err01/init.c b/testsuites/sptests/sppartition_err01/init.c index 3292b01f54..2b05a5e59e 100644 --- a/testsuites/sptests/sppartition_err01/init.c +++ b/testsuites/sptests/sppartition_err01/init.c @@ -39,23 +39,24 @@ static uint32_t Other_Memory; static rtems_name Partition_name[ 2 ]; /* array of partition names */ -static rtems_id Partition_id[ 2 ]; /* array of partition ids */ +static rtems_id Partition_id[ 2 ]; /* array of partition ids */ -static RTEMS_ALIGNED( RTEMS_PARTITION_ALIGNMENT ) uint8_t - Partition_good_area[ 256 ]; +static RTEMS_ALIGNED( + RTEMS_PARTITION_ALIGNMENT +) uint8_t Partition_good_area[ 256 ]; #define Partition_bad_area (void *) 0x00000005 -static void test_partition_errors(void) +static void test_partition_errors( void ) { - void *buffer_address_1; - void *buffer_address_2; - void *buffer_address_3; - rtems_status_code status; - size_t size; - rtems_id junk_id; + void *buffer_address_1; + void *buffer_address_2; + void *buffer_address_3; + rtems_status_code status; + size_t size; + rtems_id junk_id; - Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); status = rtems_partition_create( 0, @@ -126,8 +127,8 @@ static void test_partition_errors(void) puts( "TA1 - rtems_partition_create - buffer size < overhead - RTEMS_INVALID_SIZE" ); -#define SIZEOF_CHAIN_NODE 2 * sizeof(void *) - for ( size=0 ; size < SIZEOF_CHAIN_NODE ; size++) { +#define SIZEOF_CHAIN_NODE 2 * sizeof( void * ) + for ( size = 0; size < SIZEOF_CHAIN_NODE; size++ ) { status = rtems_partition_create( Partition_name[ 1 ], Partition_good_area, @@ -136,8 +137,9 @@ static void test_partition_errors(void) RTEMS_DEFAULT_ATTRIBUTES, &junk_id ); - if ( status != RTEMS_INVALID_SIZE ) + if ( status != RTEMS_INVALID_SIZE ) { printf( "ERROR when size == %zu\n", size ); + } fatal_directive_status( status, @@ -146,7 +148,7 @@ static void test_partition_errors(void) ); } -#if defined(_C3x) || defined(_C4x) +#if defined( _C3x ) || defined( _C4x ) puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS - SKIPPED" ); #else status = rtems_partition_create( @@ -165,7 +167,7 @@ static void test_partition_errors(void) puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" ); #endif -#if defined(_C3x) || defined(_C4x) +#if defined( _C3x ) || defined( _C4x ) puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE - SKIPPED" ); #else status = rtems_partition_create( @@ -278,7 +280,7 @@ static void test_partition_errors(void) puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" ); status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 ); - directive_failed( status, "rtems_partition_get_buffer"); + directive_failed( status, "rtems_partition_get_buffer" ); puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 ); @@ -301,10 +303,7 @@ static void test_partition_errors(void) ); puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" ); - status = rtems_partition_return_buffer( - Partition_id[ 1 ], - &Other_Memory - ); + status = rtems_partition_return_buffer( Partition_id[ 1 ], &Other_Memory ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -324,12 +323,10 @@ static void test_partition_errors(void) "rtems_partition_return_buffer with buffer address not on boundary" ); puts_nocr( "TA1 - rtems_partition_return_buffer - " ); - puts ( "RTEMS_INVALID_ADDRESS - not on boundary"); + puts( "RTEMS_INVALID_ADDRESS - not on boundary" ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sppartition_err01/system.h b/testsuites/sptests/sppartition_err01/system.h index c2f7b18df3..7e3fa1cdfa 100644 --- a/testsuites/sptests/sppartition_err01/system.h +++ b/testsuites/sptests/sppartition_err01/system.h @@ -33,8 +33,8 @@ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PARTITIONS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PARTITIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sppercpudata01/init.c b/testsuites/sptests/sppercpudata01/init.c index 5cb6969e42..a014624155 100644 --- a/testsuites/sptests/sppercpudata01/init.c +++ b/testsuites/sptests/sppercpudata01/init.c @@ -40,26 +40,27 @@ const char rtems_test_name[] = "SPPERCPUDATA 1"; PER_CPU_DATA_NEED_INITIALIZATION(); -static RTEMS_ALIGNED(CPU_HEAP_ALIGNMENT) - PER_CPU_DATA_ITEM(unsigned char, c) = 1; +static RTEMS_ALIGNED( + CPU_HEAP_ALIGNMENT +) PER_CPU_DATA_ITEM( unsigned char, c ) = 1; -static PER_CPU_DATA_ITEM(unsigned char, cz); +static PER_CPU_DATA_ITEM( unsigned char, cz ); -static PER_CPU_DATA_ITEM(unsigned short, s) = 2; +static PER_CPU_DATA_ITEM( unsigned short, s ) = 2; -static PER_CPU_DATA_ITEM(unsigned short, sz); +static PER_CPU_DATA_ITEM( unsigned short, sz ); -static PER_CPU_DATA_ITEM(unsigned int, i) = 3; +static PER_CPU_DATA_ITEM( unsigned int, i ) = 3; -static PER_CPU_DATA_ITEM(unsigned int, iz); +static PER_CPU_DATA_ITEM( unsigned int, iz ); -static PER_CPU_DATA_ITEM(unsigned long, l) = 4; +static PER_CPU_DATA_ITEM( unsigned long, l ) = 4; -static PER_CPU_DATA_ITEM(unsigned long, lz); +static PER_CPU_DATA_ITEM( unsigned long, lz ); -static PER_CPU_DATA_ITEM(unsigned int, a[3]) = { 5, 6, 7 }; +static PER_CPU_DATA_ITEM( unsigned int, a[ 3 ] ) = { 5, 6, 7 }; -static PER_CPU_DATA_ITEM(unsigned int, az[3]); +static PER_CPU_DATA_ITEM( unsigned int, az[ 3 ] ); typedef struct t { unsigned int a; @@ -67,253 +68,250 @@ typedef struct t { unsigned int c; } t; -static PER_CPU_DATA_ITEM(t, t) = { .a = 8, .b = 9, .c = 10 }; +static PER_CPU_DATA_ITEM( t, t ) = { .a = 8, .b = 9, .c = 10 }; -static void set_affinity(uint32_t cpu_index) +static void set_affinity( uint32_t cpu_index ) { rtems_status_code sc; - cpu_set_t set; + cpu_set_t set; - CPU_ZERO(&set); - CPU_SET((int) cpu_index, &set); - sc = rtems_task_set_affinity(RTEMS_SELF, sizeof(set), &set); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + CPU_ZERO( &set ); + CPU_SET( (int) cpu_index, &set ); + sc = rtems_task_set_affinity( RTEMS_SELF, sizeof( set ), &set ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_initial_values(void) +static void test_initial_values( void ) { uint32_t cpu_index; for ( - cpu_index = 0; - cpu_index < rtems_scheduler_get_processor_maximum(); + cpu_index = 0; cpu_index < rtems_scheduler_get_processor_maximum(); ++cpu_index ) { Per_CPU_Control *cpu; - unsigned char *c; - unsigned short *s; - unsigned int *i; - unsigned long *l; - uintptr_t off; - t *pt; + unsigned char *c; + unsigned short *s; + unsigned int *i; + unsigned long *l; + uintptr_t off; + t *pt; - set_affinity(cpu_index); - cpu = _Per_CPU_Get_by_index(cpu_index); + set_affinity( cpu_index ); + cpu = _Per_CPU_Get_by_index( cpu_index ); - off = PER_CPU_DATA_OFFSET(c); - rtems_test_assert(off % CPU_HEAP_ALIGNMENT == 0); - c = PER_CPU_DATA_GET_BY_OFFSET(cpu, unsigned char, off); - rtems_test_assert(*c == 1); + off = PER_CPU_DATA_OFFSET( c ); + rtems_test_assert( off % CPU_HEAP_ALIGNMENT == 0 ); + c = PER_CPU_DATA_GET_BY_OFFSET( cpu, unsigned char, off ); + rtems_test_assert( *c == 1 ); - c = PER_CPU_DATA_GET(cpu, unsigned char, c); - rtems_test_assert(*c == 1); + c = PER_CPU_DATA_GET( cpu, unsigned char, c ); + rtems_test_assert( *c == 1 ); - c = PER_CPU_DATA_GET(cpu, unsigned char, cz); - rtems_test_assert(*c == 0); + c = PER_CPU_DATA_GET( cpu, unsigned char, cz ); + rtems_test_assert( *c == 0 ); - s = PER_CPU_DATA_GET(cpu, unsigned short, s); - rtems_test_assert(*s == 2); + s = PER_CPU_DATA_GET( cpu, unsigned short, s ); + rtems_test_assert( *s == 2 ); - s = PER_CPU_DATA_GET(cpu, unsigned short, sz); - rtems_test_assert(*s == 0); + s = PER_CPU_DATA_GET( cpu, unsigned short, sz ); + rtems_test_assert( *s == 0 ); - i = PER_CPU_DATA_GET(cpu, unsigned int, i); - rtems_test_assert(*i == 3); + i = PER_CPU_DATA_GET( cpu, unsigned int, i ); + rtems_test_assert( *i == 3 ); - i = PER_CPU_DATA_GET(cpu, unsigned int, iz); - rtems_test_assert(*i == 0); + i = PER_CPU_DATA_GET( cpu, unsigned int, iz ); + rtems_test_assert( *i == 0 ); - l = PER_CPU_DATA_GET(cpu, unsigned long, l); - rtems_test_assert(*l == 4); + l = PER_CPU_DATA_GET( cpu, unsigned long, l ); + rtems_test_assert( *l == 4 ); - l = PER_CPU_DATA_GET(cpu, unsigned long, lz); - rtems_test_assert(*l == 0); + l = PER_CPU_DATA_GET( cpu, unsigned long, lz ); + rtems_test_assert( *l == 0 ); - i = PER_CPU_DATA_GET(cpu, unsigned int, a[0]); - rtems_test_assert(i[0] == 5); - rtems_test_assert(i[1] == 6); - rtems_test_assert(i[2] == 7); + i = PER_CPU_DATA_GET( cpu, unsigned int, a[ 0 ] ); + rtems_test_assert( i[ 0 ] == 5 ); + rtems_test_assert( i[ 1 ] == 6 ); + rtems_test_assert( i[ 2 ] == 7 ); - i = PER_CPU_DATA_GET(cpu, unsigned int, az[0]); - rtems_test_assert(i[0] == 0); - rtems_test_assert(i[1] == 0); - rtems_test_assert(i[2] == 0); + i = PER_CPU_DATA_GET( cpu, unsigned int, az[ 0 ] ); + rtems_test_assert( i[ 0 ] == 0 ); + rtems_test_assert( i[ 1 ] == 0 ); + rtems_test_assert( i[ 2 ] == 0 ); - pt = PER_CPU_DATA_GET(cpu, t, t); - rtems_test_assert(pt->a == 8); - rtems_test_assert(pt->b == 9); - rtems_test_assert(pt->c == 10); + pt = PER_CPU_DATA_GET( cpu, t, t ); + rtems_test_assert( pt->a == 8 ); + rtems_test_assert( pt->b == 9 ); + rtems_test_assert( pt->c == 10 ); - pt = PER_CPU_DATA_GET(cpu, struct t, t); - rtems_test_assert(pt->a == 8); - rtems_test_assert(pt->b == 9); - rtems_test_assert(pt->c == 10); + pt = PER_CPU_DATA_GET( cpu, struct t, t ); + rtems_test_assert( pt->a == 8 ); + rtems_test_assert( pt->b == 9 ); + rtems_test_assert( pt->c == 10 ); - i = PER_CPU_DATA_GET(cpu, unsigned int, g); - rtems_test_assert(*i == 11); + i = PER_CPU_DATA_GET( cpu, unsigned int, g ); + rtems_test_assert( *i == 11 ); } } -static void set_unique_values(unsigned int v) +static void set_unique_values( unsigned int v ) { uint32_t cpu_index; for ( - cpu_index = 0; - cpu_index < rtems_scheduler_get_processor_maximum(); + cpu_index = 0; cpu_index < rtems_scheduler_get_processor_maximum(); ++cpu_index ) { Per_CPU_Control *cpu; - unsigned char *c; - unsigned short *s; - unsigned int *i; - unsigned long *l; - t *pt; + unsigned char *c; + unsigned short *s; + unsigned int *i; + unsigned long *l; + t *pt; - set_affinity(cpu_index); - cpu = _Per_CPU_Get_by_index(cpu_index); + set_affinity( cpu_index ); + cpu = _Per_CPU_Get_by_index( cpu_index ); - c = PER_CPU_DATA_GET(cpu, unsigned char, c); + c = PER_CPU_DATA_GET( cpu, unsigned char, c ); *c = (unsigned char) ++v; - c = PER_CPU_DATA_GET(cpu, unsigned char, cz); + c = PER_CPU_DATA_GET( cpu, unsigned char, cz ); *c = (unsigned char) ++v; - s = PER_CPU_DATA_GET(cpu, unsigned short, s); + s = PER_CPU_DATA_GET( cpu, unsigned short, s ); *s = (unsigned short) ++v; - s = PER_CPU_DATA_GET(cpu, unsigned short, sz); + s = PER_CPU_DATA_GET( cpu, unsigned short, sz ); *s = (unsigned short) ++v; - i = PER_CPU_DATA_GET(cpu, unsigned int, i); + i = PER_CPU_DATA_GET( cpu, unsigned int, i ); *i = ++v; - i = PER_CPU_DATA_GET(cpu, unsigned int, iz); + i = PER_CPU_DATA_GET( cpu, unsigned int, iz ); *i = ++v; - l = PER_CPU_DATA_GET(cpu, unsigned long, l); + l = PER_CPU_DATA_GET( cpu, unsigned long, l ); *l = ++v; - l = PER_CPU_DATA_GET(cpu, unsigned long, lz); + l = PER_CPU_DATA_GET( cpu, unsigned long, lz ); *l = ++v; - i = PER_CPU_DATA_GET(cpu, unsigned int, a[0]); - i[0] = ++v; - i[1] = ++v; - i[2] = ++v; + i = PER_CPU_DATA_GET( cpu, unsigned int, a[ 0 ] ); + i[ 0 ] = ++v; + i[ 1 ] = ++v; + i[ 2 ] = ++v; - i = PER_CPU_DATA_GET(cpu, unsigned int, az[0]); - i[0] = ++v; - i[1] = ++v; - i[2] = ++v; + i = PER_CPU_DATA_GET( cpu, unsigned int, az[ 0 ] ); + i[ 0 ] = ++v; + i[ 1 ] = ++v; + i[ 2 ] = ++v; - pt = PER_CPU_DATA_GET(cpu, t, t); + pt = PER_CPU_DATA_GET( cpu, t, t ); pt->a = ++v; pt->b = ++v; pt->c = ++v; - i = PER_CPU_DATA_GET(cpu, unsigned int, g); + i = PER_CPU_DATA_GET( cpu, unsigned int, g ); *i = ++v; } } -static void test_unique_values(unsigned int v) +static void test_unique_values( unsigned int v ) { uint32_t cpu_index; for ( - cpu_index = 0; - cpu_index < rtems_scheduler_get_processor_maximum(); + cpu_index = 0; cpu_index < rtems_scheduler_get_processor_maximum(); ++cpu_index ) { Per_CPU_Control *cpu; - unsigned char *c; - unsigned short *s; - unsigned int *i; - unsigned long *l; - uintptr_t off; - t *pt; + unsigned char *c; + unsigned short *s; + unsigned int *i; + unsigned long *l; + uintptr_t off; + t *pt; - set_affinity(cpu_index); - cpu = _Per_CPU_Get_by_index(cpu_index); + set_affinity( cpu_index ); + cpu = _Per_CPU_Get_by_index( cpu_index ); - c = PER_CPU_DATA_GET(cpu, unsigned char, c); + c = PER_CPU_DATA_GET( cpu, unsigned char, c ); ++v; - rtems_test_assert(*c == (unsigned char) v); + rtems_test_assert( *c == (unsigned char) v ); - off = PER_CPU_DATA_OFFSET(c); - rtems_test_assert(off % CPU_HEAP_ALIGNMENT == 0); - c = PER_CPU_DATA_GET_BY_OFFSET(cpu, unsigned char, off); - rtems_test_assert(*c == (unsigned char) v); + off = PER_CPU_DATA_OFFSET( c ); + rtems_test_assert( off % CPU_HEAP_ALIGNMENT == 0 ); + c = PER_CPU_DATA_GET_BY_OFFSET( cpu, unsigned char, off ); + rtems_test_assert( *c == (unsigned char) v ); - c = PER_CPU_DATA_GET(cpu, unsigned char, cz); + c = PER_CPU_DATA_GET( cpu, unsigned char, cz ); ++v; - rtems_test_assert(*c == (unsigned char) v); + rtems_test_assert( *c == (unsigned char) v ); - s = PER_CPU_DATA_GET(cpu, unsigned short, s); + s = PER_CPU_DATA_GET( cpu, unsigned short, s ); ++v; - rtems_test_assert(*s == (unsigned short) v); + rtems_test_assert( *s == (unsigned short) v ); - s = PER_CPU_DATA_GET(cpu, unsigned short, sz); + s = PER_CPU_DATA_GET( cpu, unsigned short, sz ); ++v; - rtems_test_assert(*s == (unsigned short) v); + rtems_test_assert( *s == (unsigned short) v ); - i = PER_CPU_DATA_GET(cpu, unsigned int, i); + i = PER_CPU_DATA_GET( cpu, unsigned int, i ); ++v; - rtems_test_assert(*i == v); + rtems_test_assert( *i == v ); - i = PER_CPU_DATA_GET(cpu, unsigned int, iz); + i = PER_CPU_DATA_GET( cpu, unsigned int, iz ); ++v; - rtems_test_assert(*i == v); + rtems_test_assert( *i == v ); - l = PER_CPU_DATA_GET(cpu, unsigned long, l); + l = PER_CPU_DATA_GET( cpu, unsigned long, l ); ++v; - rtems_test_assert(*l == v); + rtems_test_assert( *l == v ); - l = PER_CPU_DATA_GET(cpu, unsigned long, lz); + l = PER_CPU_DATA_GET( cpu, unsigned long, lz ); ++v; - rtems_test_assert(*l == v); + rtems_test_assert( *l == v ); - i = PER_CPU_DATA_GET(cpu, unsigned int, a[0]); + i = PER_CPU_DATA_GET( cpu, unsigned int, a[ 0 ] ); ++v; - rtems_test_assert(i[0] == v); + rtems_test_assert( i[ 0 ] == v ); ++v; - rtems_test_assert(i[1] == v); + rtems_test_assert( i[ 1 ] == v ); ++v; - rtems_test_assert(i[2] == v); + rtems_test_assert( i[ 2 ] == v ); - i = PER_CPU_DATA_GET(cpu, unsigned int, az[0]); + i = PER_CPU_DATA_GET( cpu, unsigned int, az[ 0 ] ); ++v; - rtems_test_assert(i[0] == v); + rtems_test_assert( i[ 0 ] == v ); ++v; - rtems_test_assert(i[1] == v); + rtems_test_assert( i[ 1 ] == v ); ++v; - rtems_test_assert(i[2] == v); + rtems_test_assert( i[ 2 ] == v ); - pt = PER_CPU_DATA_GET(cpu, t, t); + pt = PER_CPU_DATA_GET( cpu, t, t ); ++v; - rtems_test_assert(pt->a == v); + rtems_test_assert( pt->a == v ); ++v; - rtems_test_assert(pt->b == v); + rtems_test_assert( pt->b == v ); ++v; - rtems_test_assert(pt->c == v); + rtems_test_assert( pt->c == v ); - i = PER_CPU_DATA_GET(cpu, unsigned int, g); + i = PER_CPU_DATA_GET( cpu, unsigned int, g ); ++v; - rtems_test_assert(*i == v); + rtems_test_assert( *i == v ); } } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; TEST_BEGIN(); test_initial_values(); - set_unique_values(12); - test_unique_values(12); + set_unique_values( 12 ); + test_unique_values( 12 ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER diff --git a/testsuites/sptests/sppercpudata01/item.c b/testsuites/sptests/sppercpudata01/item.c index 295e2855ee..f5c5b4ba74 100644 --- a/testsuites/sptests/sppercpudata01/item.c +++ b/testsuites/sptests/sppercpudata01/item.c @@ -31,4 +31,4 @@ #include "sppercpudata01.h" -PER_CPU_DATA_ITEM(unsigned int, g) = 11; +PER_CPU_DATA_ITEM( unsigned int, g ) = 11; diff --git a/testsuites/sptests/sppercpudata01/sppercpudata01.h b/testsuites/sptests/sppercpudata01/sppercpudata01.h index 2913d3456f..b920e7a423 100644 --- a/testsuites/sptests/sppercpudata01/sppercpudata01.h +++ b/testsuites/sptests/sppercpudata01/sppercpudata01.h @@ -34,7 +34,7 @@ extern "C" { #include -PER_CPU_DATA_ITEM_DECLARE(unsigned int, g); +PER_CPU_DATA_ITEM_DECLARE( unsigned int, g ); #ifdef __cplusplus } diff --git a/testsuites/sptests/spport_err01/init.c b/testsuites/sptests/spport_err01/init.c index 4264167495..6903cf4c0c 100644 --- a/testsuites/sptests/spport_err01/init.c +++ b/testsuites/sptests/spport_err01/init.c @@ -35,23 +35,21 @@ const char rtems_test_name[] = "SP PORT ERROR 01"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - void *converted; + void *converted; rtems_status_code status; - + TEST_BEGIN(); - Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); + Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); status = rtems_port_create( - 0, - Internal_port_area, - External_port_area, - sizeof( Internal_port_area ), - &Junk_id + 0, + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + &Junk_id ); fatal_directive_status( status, @@ -60,15 +58,15 @@ rtems_task Init( ); puts( "TA1 - rtems_port_create - RTEMS_INVALID_NAME" ); -#if defined(_C3x) || defined(_C4x) +#if defined( _C3x ) || defined( _C4x ) puts( "TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS - SKIPPED" ); #else status = rtems_port_create( - Port_name[ 1 ], - &((char *)Internal_port_area)[ 1 ], - External_port_area, - sizeof( Internal_port_area ), - &Junk_id + Port_name[ 1 ], + &( (char *) Internal_port_area )[ 1 ], + External_port_area, + sizeof( Internal_port_area ), + &Junk_id ); fatal_directive_status( status, @@ -79,11 +77,11 @@ rtems_task Init( #endif status = rtems_port_create( - Port_name[ 1 ], - Internal_port_area, - External_port_area, - sizeof( Internal_port_area ), - NULL + Port_name[ 1 ], + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + NULL ); fatal_directive_status( status, @@ -93,11 +91,11 @@ rtems_task Init( puts( "TA1 - rtems_port_create - null id - RTEMS_INVALID_ADDRESS" ); status = rtems_port_create( - Port_name[ 1 ], - Internal_port_area, - External_port_area, - sizeof( Internal_port_area ), - &Junk_id + Port_name[ 1 ], + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + &Junk_id ); fatal_directive_status( status, @@ -133,11 +131,7 @@ rtems_task Init( "rtems_port_external_to_internal with illegal id" ); - status = rtems_port_external_to_internal( - 100, - Internal_port_area, - NULL - ); + status = rtems_port_external_to_internal( 100, Internal_port_area, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -157,17 +151,13 @@ rtems_task Init( ); puts( "TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID" ); - status = rtems_port_internal_to_external( - 100, - Internal_port_area, - NULL - ); + status = rtems_port_internal_to_external( 100, Internal_port_area, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_port_internal_to_external with NULL param" ); puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ADDRESS" ); - - TEST_END(); + + TEST_END(); } diff --git a/testsuites/sptests/spport_err01/system.h b/testsuites/sptests/spport_err01/system.h index e77feb7942..943a3064b6 100644 --- a/testsuites/sptests/spport_err01/system.h +++ b/testsuites/sptests/spport_err01/system.h @@ -35,47 +35,45 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/sppps01/init.c b/testsuites/sptests/sppps01/init.c index 079fb7599e..25e04b7c4a 100644 --- a/testsuites/sptests/sppps01/init.c +++ b/testsuites/sptests/sppps01/init.c @@ -39,26 +39,26 @@ const char rtems_test_name[] = "SPPPS 1"; -#define PPS_EVENT RTEMS_EVENT_0 -#define TASK_WAITING RTEMS_EVENT_1 +#define PPS_EVENT RTEMS_EVENT_0 +#define TASK_WAITING RTEMS_EVENT_1 #define PPS_EVENT_RECEIVED RTEMS_EVENT_2 struct test_pps_device { struct pps_state pps; - rtems_id task_waiting; - int wokenup; + rtems_id task_waiting; + int wokenup; }; typedef struct { - rtems_id main_task; + rtems_id main_task; struct test_pps_device *pps_dev; } test_context; T_TEST_CASE( WaitPPSEventDefaultHandler ) { - int status; + int status; struct test_pps_device pps_dev; - struct pps_fetch_args fetch; + struct pps_fetch_args fetch; memset( &pps_dev, 0, sizeof( pps_dev ) ); pps_dev.task_waiting = RTEMS_INVALID_ID; @@ -69,15 +69,15 @@ T_TEST_CASE( WaitPPSEventDefaultHandler ) /* If no timeout is requested, pps_fetch() doesn't call the default handler */ memset( &fetch, 0, sizeof( fetch ) ); - status = pps_ioctl( PPS_IOC_FETCH, (caddr_t)&fetch, &pps_dev.pps ); + status = pps_ioctl( PPS_IOC_FETCH, (caddr_t) &fetch, &pps_dev.pps ); T_eq_int( status, 0 ); fetch.timeout.tv_sec = 1; - status = pps_ioctl( PPS_IOC_FETCH, (caddr_t)&fetch, &pps_dev.pps ); + status = pps_ioctl( PPS_IOC_FETCH, (caddr_t) &fetch, &pps_dev.pps ); T_eq_int( status, ETIMEDOUT ); } -static void fake_wakeup(struct pps_state *pps) +static void fake_wakeup( struct pps_state *pps ) { struct test_pps_device *pps_dev; @@ -119,36 +119,42 @@ T_TEST_CASE( PPSEventEarlyReturns ) T_eq_int( pps_dev.wokenup, 1 ); } -static void wakeup(struct pps_state *pps) +static void wakeup( struct pps_state *pps ) { struct test_pps_device *pps_dev; pps_dev = RTEMS_CONTAINER_OF( pps, struct test_pps_device, pps ); - if (pps_dev->task_waiting != RTEMS_INVALID_ID) + if ( pps_dev->task_waiting != RTEMS_INVALID_ID ) { rtems_event_send( pps_dev->task_waiting, PPS_EVENT ); + } } -static int wait(struct pps_state *pps, struct timespec timeout) +static int wait( struct pps_state *pps, struct timespec timeout ) { - rtems_status_code sc; - rtems_event_set out; - uint32_t timeoutticks; + rtems_status_code sc; + rtems_event_set out; + uint32_t timeoutticks; struct test_pps_device *pps_dev; pps_dev = RTEMS_CONTAINER_OF( pps, struct test_pps_device, pps ); pps_dev->task_waiting = rtems_task_self(); - timeoutticks = rtems_timespec_to_ticks(&timeout); - sc = rtems_event_receive( PPS_EVENT, RTEMS_DEFAULT_OPTIONS, timeoutticks, &out ); - return rtems_status_code_to_errno(sc); + timeoutticks = rtems_timespec_to_ticks( &timeout ); + sc = rtems_event_receive( + PPS_EVENT, + RTEMS_DEFAULT_OPTIONS, + timeoutticks, + &out + ); + return rtems_status_code_to_errno( sc ); } -static void pps_task(rtems_task_argument arg) +static void pps_task( rtems_task_argument arg ) { - int status; - rtems_status_code sc; + int status; + rtems_status_code sc; struct pps_fetch_args fetch; - test_context *ctx; + test_context *ctx; ctx = (test_context *) arg; @@ -158,7 +164,7 @@ static void pps_task(rtems_task_argument arg) sc = rtems_event_send( ctx->main_task, TASK_WAITING ); T_rsc_success( sc ); - status = pps_ioctl( PPS_IOC_FETCH, (caddr_t)&fetch, &ctx->pps_dev->pps ); + status = pps_ioctl( PPS_IOC_FETCH, (caddr_t) &fetch, &ctx->pps_dev->pps ); T_eq_int( status, 0 ); sc = rtems_event_send( ctx->main_task, PPS_EVENT_RECEIVED ); T_rsc_success( sc ); @@ -168,14 +174,14 @@ static void pps_task(rtems_task_argument arg) T_TEST_CASE( WakeupTaskWithPPSEvent ) { - int status; - rtems_status_code sc; + int status; + rtems_status_code sc; struct test_pps_device pps_dev; struct pps_kcbind_args kcbind; - test_context ctx; - rtems_id pps_task_id; - rtems_task_priority pps_task_prio = 1; - rtems_event_set out; + test_context ctx; + rtems_id pps_task_id; + rtems_task_priority pps_task_prio = 1; + rtems_event_set out; memset( &pps_dev, 0, sizeof( pps_dev ) ); pps_dev.task_waiting = RTEMS_INVALID_ID; @@ -191,7 +197,7 @@ T_TEST_CASE( WakeupTaskWithPPSEvent ) kcbind.kernel_consumer = PPS_KC_HARDPPS; kcbind.edge = PPS_CAPTUREASSERT; kcbind.tsformat = PPS_TSFMT_TSPEC; - status = pps_ioctl( PPS_IOC_KCBIND, (caddr_t)&kcbind, &pps_dev.pps ); + status = pps_ioctl( PPS_IOC_KCBIND, (caddr_t) &kcbind, &pps_dev.pps ); T_eq_int( status, 0 ); /* Save current timecounter in pps_state object */ @@ -199,7 +205,7 @@ T_TEST_CASE( WakeupTaskWithPPSEvent ) pps_event( &pps_dev.pps, PPS_CAPTUREASSERT ); sc = rtems_task_create( - rtems_build_name('P', 'P', 'S', 'E'), + rtems_build_name( 'P', 'P', 'S', 'E' ), pps_task_prio, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, @@ -210,14 +216,24 @@ T_TEST_CASE( WakeupTaskWithPPSEvent ) sc = rtems_task_start( pps_task_id, pps_task, (rtems_task_argument) &ctx ); T_rsc_success( sc ); - sc = rtems_event_receive( TASK_WAITING, RTEMS_DEFAULT_OPTIONS, RTEMS_MILLISECONDS_TO_TICKS(100), &out ); + sc = rtems_event_receive( + TASK_WAITING, + RTEMS_DEFAULT_OPTIONS, + RTEMS_MILLISECONDS_TO_TICKS( 100 ), + &out + ); T_rsc_success( sc ); /* Capture event and send wake-up */ pps_capture( &pps_dev.pps ); pps_event( &pps_dev.pps, PPS_CAPTUREASSERT ); - sc = rtems_event_receive( PPS_EVENT_RECEIVED, RTEMS_DEFAULT_OPTIONS, RTEMS_MILLISECONDS_TO_TICKS(100), &out ); + sc = rtems_event_receive( + PPS_EVENT_RECEIVED, + RTEMS_DEFAULT_OPTIONS, + RTEMS_MILLISECONDS_TO_TICKS( 100 ), + &out + ); T_rsc_success( sc ); } diff --git a/testsuites/sptests/spprintk/init.c b/testsuites/sptests/spprintk/init.c index ec13102c04..34000ddf47 100644 --- a/testsuites/sptests/spprintk/init.c +++ b/testsuites/sptests/spprintk/init.c @@ -40,22 +40,22 @@ * contained in the file is suppose to be wrong. */ #undef RTEMS_PRINTFLIKE -#define RTEMS_PRINTFLIKE(_a, _b) +#define RTEMS_PRINTFLIKE( _a, _b ) #include #include const char rtems_test_name[] = "SPPRINTK"; -static int test_getchar(void) +static int test_getchar( void ) { return 0x35; } -static void do_getchark(void) +static void do_getchark( void ) { - int sc; - BSP_polling_getchar_function_type poll_char; + int sc; + BSP_polling_getchar_function_type poll_char; poll_char = BSP_poll_char; @@ -73,17 +73,17 @@ static void do_getchark(void) BSP_poll_char = poll_char; } -static void do_putk(void) +static void do_putk( void ) { putk( "This is a test of putk" ); } -static void do_printk(void) +static void do_printk( void ) { - long lm = 2147483647L; + long lm = 2147483647L; unsigned long ulm = 4294967295UL; - long long llm = 9223372036854775807LL; - long long ullm = 18446744073709551615ULL; + long long llm = 9223372036854775807LL; + long long ullm = 18446744073709551615ULL; printk( "bad format -- %%q in parentheses (%q)\n" ); @@ -97,7 +97,7 @@ static void do_printk(void) printk( "%%u of 16 -- %u\n", 16 ); printk( "%%X of 16 -- %X\n", 16 ); printk( "%%x of 16 -- %x\n", 16 ); - printk( "%%p of 0x1234 -- %p\n", (void *)0x1234 ); + printk( "%%p of 0x1234 -- %p\n", (void *) 0x1234 ); /* long */ printk( "%%lo of 2147483647 -- %lo\n", lm ); @@ -129,8 +129,10 @@ static void do_printk(void) printk( "%%u of -16 -- %u\n", -16 ); /* string formats */ - printk( "%%s of Mary Had a Little Lamb -- '%s'\n", - "Mary Had a Little Lamb" ); + printk( + "%%s of Mary Had a Little Lamb -- '%s'\n", + "Mary Had a Little Lamb" + ); printk( "%%s of NULL -- '%s'\n", NULL ); printk( "%%12s of joel -- '%20s'\n", "joel" ); printk( "%%4s of joel -- '%4s'\n", "joel" ); @@ -141,7 +143,7 @@ static void do_printk(void) } typedef struct { - char buf[128]; + char buf[ 128 ]; size_t i; } test_context; @@ -169,11 +171,11 @@ static test_context test_instance; static void test_io_printf( test_context *ctx ) { - int i; - intmax_t j; + int i; + intmax_t j; long long ll; - long l; - size_t z; + long l; + size_t z; ptrdiff_t t; clear( ctx ); @@ -210,7 +212,7 @@ static void test_io_printf( test_context *ctx ) static void test_io_base64( test_context *ctx ) { unsigned char buf[] = "abcdefghi"; - int n; + int n; clear( ctx ); n = _Base64_Encode( put_char, ctx, buf, 9, "\n", 0 ); @@ -265,7 +267,7 @@ static void test_io_base64( test_context *ctx ) static void test_io_base64url( test_context *ctx ) { unsigned char buf[] = { 0, 0, 62, 0, 0, 63 }; - int n; + int n; clear( ctx ); n = _Base64url_Encode( put_char, ctx, buf, sizeof( buf ), "\n", 0 ); @@ -273,24 +275,22 @@ static void test_io_base64url( test_context *ctx ) rtems_test_assert( strcmp( ctx->buf, "AAA-\nAAA_" ) == 0 ); } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); do_putk(); - putk(""); + putk( "" ); do_printk(); - putk(""); + putk( "" ); do_getchark(); - test_io_printf(&test_instance); - test_io_base64(&test_instance); - test_io_base64url(&test_instance); + test_io_printf( &test_instance ); + test_io_base64( &test_instance ); + test_io_base64url( &test_instance ); TEST_END(); rtems_test_exit( 0 ); @@ -300,7 +300,7 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spprivenv01/init.c b/testsuites/sptests/spprivenv01/init.c index 1793adab60..5b13152d04 100644 --- a/testsuites/sptests/spprivenv01/init.c +++ b/testsuites/sptests/spprivenv01/init.c @@ -39,10 +39,10 @@ const char rtems_test_name[] = "SPPRIVENV 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task task_routine(rtems_task_argument not_used); +rtems_task Init( rtems_task_argument argument ); +rtems_task task_routine( rtems_task_argument not_used ); -rtems_task task_routine(rtems_task_argument not_used) +rtems_task task_routine( rtems_task_argument not_used ) { (void) not_used; @@ -60,17 +60,15 @@ rtems_task task_routine(rtems_task_argument not_used) rtems_task_exit(); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code sc; - void *opaque; - rtems_id task_id; - rtems_name another_task_name; - rtems_user_env_t *current_env; + rtems_status_code sc; + void *opaque; + rtems_id task_id; + rtems_name another_task_name; + rtems_user_env_t *current_env; TEST_BEGIN(); @@ -107,24 +105,26 @@ rtems_task Init( puts( "Init - creating a task name and a task -- OK" ); - another_task_name = - rtems_build_name( 'T','S','K','D' ); + another_task_name = rtems_build_name( 'T', 'S', 'K', 'D' ); - sc = rtems_task_create( another_task_name, - 1, - RTEMS_MINIMUM_STACK_SIZE * 2, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &task_id - ); + sc = rtems_task_create( + another_task_name, + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); puts( "Init - starting the task_routine, to set its private environment" ); - sc = rtems_task_start( task_id, task_routine, 0); + sc = rtems_task_start( task_id, task_routine, 0 ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sleep( 1 ); - puts( "Init - Check current private environment. Should be same as before." ); + puts( + "Init - Check current private environment. Should be same as before." + ); rtems_test_assert( rtems_current_user_env == current_env ); puts( "Init - Reset to global environment" ); @@ -133,7 +133,7 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -141,7 +141,7 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_TASKS 3 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spprofiling01/init.c b/testsuites/sptests/spprofiling01/init.c index 67dc5717e4..ad079b1535 100644 --- a/testsuites/sptests/spprofiling01/init.c +++ b/testsuites/sptests/spprofiling01/init.c @@ -45,102 +45,97 @@ typedef struct { rtems_interrupt_lock b; rtems_interrupt_lock c; rtems_interrupt_lock d; - enum { - WAIT_FOR_A, - EXPECT_B, - EXPECT_D, - DONE - } state; + enum { WAIT_FOR_A, EXPECT_B, EXPECT_D, DONE } state; } visitor_context; -static bool is_equal(const rtems_profiling_smp_lock *psl, const char *name) +static bool is_equal( const rtems_profiling_smp_lock *psl, const char *name ) { - return strcmp(psl->name, name) == 0; + return strcmp( psl->name, name ) == 0; } -static void visitor(void *arg, const rtems_profiling_data *data) +static void visitor( void *arg, const rtems_profiling_data *data ) { visitor_context *ctx = arg; - if (data->header.type == RTEMS_PROFILING_SMP_LOCK) { + if ( data->header.type == RTEMS_PROFILING_SMP_LOCK ) { const rtems_profiling_smp_lock *psl = &data->smp_lock; - switch (ctx->state) { + switch ( ctx->state ) { case WAIT_FOR_A: - rtems_test_assert(!is_equal(psl, "b")); - rtems_test_assert(!is_equal(psl, "c")); - rtems_test_assert(!is_equal(psl, "d")); + rtems_test_assert( !is_equal( psl, "b" ) ); + rtems_test_assert( !is_equal( psl, "c" ) ); + rtems_test_assert( !is_equal( psl, "d" ) ); - if (is_equal(psl, "a")) { + if ( is_equal( psl, "a" ) ) { ctx->state = EXPECT_B; } break; case EXPECT_B: - rtems_test_assert(is_equal(psl, "b")); - rtems_interrupt_lock_destroy(&ctx->c); + rtems_test_assert( is_equal( psl, "b" ) ); + rtems_interrupt_lock_destroy( &ctx->c ); ctx->state = EXPECT_D; break; case EXPECT_D: - rtems_test_assert(is_equal(psl, "d")); + rtems_test_assert( is_equal( psl, "d" ) ); ctx->state = DONE; break; case DONE: - rtems_test_assert(!is_equal(psl, "a")); - rtems_test_assert(!is_equal(psl, "b")); - rtems_test_assert(!is_equal(psl, "c")); - rtems_test_assert(!is_equal(psl, "d")); + rtems_test_assert( !is_equal( psl, "a" ) ); + rtems_test_assert( !is_equal( psl, "b" ) ); + rtems_test_assert( !is_equal( psl, "c" ) ); + rtems_test_assert( !is_equal( psl, "d" ) ); break; } } } -static void lock_init(rtems_interrupt_lock *lock, const char *name) +static void lock_init( rtems_interrupt_lock *lock, const char *name ) { (void) lock; rtems_interrupt_lock_context lock_context; - rtems_interrupt_lock_initialize(lock, name); - rtems_interrupt_lock_acquire(lock, &lock_context); - rtems_interrupt_lock_release(lock, &lock_context); + rtems_interrupt_lock_initialize( lock, name ); + rtems_interrupt_lock_acquire( lock, &lock_context ); + rtems_interrupt_lock_release( lock, &lock_context ); } -static void test_iterate(void) +static void test_iterate( void ) { - visitor_context ctx_instance; + visitor_context ctx_instance; visitor_context *ctx = &ctx_instance; ctx->state = WAIT_FOR_A; - lock_init(&ctx->a, "a"); - lock_init(&ctx->b, "b"); - lock_init(&ctx->c, "c"); - lock_init(&ctx->d, "d"); + lock_init( &ctx->a, "a" ); + lock_init( &ctx->b, "b" ); + lock_init( &ctx->c, "c" ); + lock_init( &ctx->d, "d" ); - rtems_profiling_iterate(visitor, ctx); + rtems_profiling_iterate( visitor, ctx ); - rtems_interrupt_lock_destroy(&ctx->a); - rtems_interrupt_lock_destroy(&ctx->b); + rtems_interrupt_lock_destroy( &ctx->a ); + rtems_interrupt_lock_destroy( &ctx->b ); - if (ctx->state != DONE) { - rtems_interrupt_lock_destroy(&ctx->c); + if ( ctx->state != DONE ) { + rtems_interrupt_lock_destroy( &ctx->c ); } - rtems_interrupt_lock_destroy(&ctx->d); + rtems_interrupt_lock_destroy( &ctx->d ); } -static void test_report_xml(void) +static void test_report_xml( void ) { rtems_status_code sc; - int rv; + int rv; - sc = rtems_task_wake_after(3); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_wake_after( 3 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rv = rtems_profiling_report_xml("X", &rtems_test_printer, 1, " "); - printf("characters produced by rtems_profiling_report_xml(): %i\n", rv); + rv = rtems_profiling_report_xml( "X", &rtems_test_printer, 1, " " ); + printf( "characters produced by rtems_profiling_report_xml(): %i\n", rv ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -151,7 +146,7 @@ static void Init(rtems_task_argument arg) TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/spqreslib/init.c b/testsuites/sptests/spqreslib/init.c index 00eb9908e0..d8954faef2 100644 --- a/testsuites/sptests/spqreslib/init.c +++ b/testsuites/sptests/spqreslib/init.c @@ -32,25 +32,23 @@ const char rtems_test_name[] = "SPQRESLIB"; -rtems_id Task_id; +rtems_id Task_id; rtems_task_priority Priority; -time_t Period; -time_t Execution; -time_t Phase; +time_t Period; +time_t Execution; +time_t Phase; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code status; - qres_sid_t server_id, server_id2; - time_t approved_budget, exec_time, abs_time, current_budget; - qres_params_t params, params1, params3; + qres_sid_t server_id, server_id2; + time_t approved_budget, exec_time, abs_time, current_budget; + qres_params_t params, params1, params3; Priority = 30; - Period = 30; + Period = 30; Execution = 10; Phase = 0; @@ -63,7 +61,6 @@ rtems_task Init( TEST_BEGIN(); - status = rtems_task_create( rtems_build_name( 'P', 'T', '1', ' ' ), Priority, @@ -75,151 +72,167 @@ rtems_task Init( directive_failed( status, "rtems_task_create loop" ); printf( "Init: Initializing the qres library\n" ); - if ( qres_init() ) + if ( qres_init() ) { printf( "ERROR: QRES INITIALIZATION FAILED\n" ); + } /* Error checks for Create server and Destroy server */ printf( "Init: Create server and Destroy server\n" ); - if ( qres_destroy_server( -5 ) != - QOS_E_INVALID_PARAM ) + if ( qres_destroy_server( -5 ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" ); - if ( qres_destroy_server( 5 ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_destroy_server( 5 ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" ); - if ( qres_destroy_server( 0 ) != QOS_E_NOSERVER ) + } + if ( qres_destroy_server( 0 ) != QOS_E_NOSERVER ) { printf( "ERROR: DESTROY SERVER PASSED UNEXPECTEDLY\n" ); - if ( qres_create_server( ¶ms1, &server_id ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_create_server( ¶ms1, &server_id ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); - if ( qres_create_server( ¶ms3, &server_id ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_create_server( ¶ms3, &server_id ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); - if ( qres_create_server( ¶ms, &server_id2 ) ) + } + if ( qres_create_server( ¶ms, &server_id2 ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( qres_create_server( ¶ms, &server_id ) ) + } + if ( qres_create_server( ¶ms, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( qres_create_server( ¶ms, &server_id ) != - QOS_E_FULL ) + } + if ( qres_create_server( ¶ms, &server_id ) != QOS_E_FULL ) { printf( "ERROR: CREATE SERVER PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Attach thread and Detach thread */ printf( "Init: Attach thread\n" ); - if ( qres_attach_thread( -5, 0, RTEMS_SELF ) != - QOS_E_INVALID_PARAM ) + if ( qres_attach_thread( -5, 0, RTEMS_SELF ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( qres_attach_thread( 5, 0, RTEMS_SELF ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_attach_thread( 5, 0, RTEMS_SELF ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( qres_attach_thread( server_id, 0, 1234 ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_attach_thread( server_id, 0, 1234 ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( qres_attach_thread( server_id, 0, RTEMS_SELF ) ) + } + if ( qres_attach_thread( server_id, 0, RTEMS_SELF ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); - if ( qres_attach_thread( server_id, 0, RTEMS_SELF ) != - QOS_E_FULL ) + } + if ( qres_attach_thread( server_id, 0, RTEMS_SELF ) != QOS_E_FULL ) { printf( "ERROR: ATTACH THREAD AGAIN PASSED UNEXPECTEDLY\n" ); - if ( qres_attach_thread( server_id, 0, Task_id ) != - QOS_E_FULL ) + } + if ( qres_attach_thread( server_id, 0, Task_id ) != QOS_E_FULL ) { printf( "ERROR: ATTACH THREAD TO FULL SERVER PASSED UNEXPECTEDLY \n" ); - if ( qres_destroy_server( server_id ) ) + } + if ( qres_destroy_server( server_id ) ) { printf( "ERROR: DESTROY SERVER WITH THREAD ATTACHED FAILED\n" ); - if ( qres_attach_thread( server_id, 0, RTEMS_SELF ) != - QOS_E_NOSERVER ) + } + if ( qres_attach_thread( server_id, 0, RTEMS_SELF ) != QOS_E_NOSERVER ) { printf( "ERROR: ATTACH THREAD PASSED UNEXPECTEDLY\n" ); + } printf( "Init: Detach thread\n" ); - if ( qres_detach_thread( -5, 0, RTEMS_SELF ) != - QOS_E_INVALID_PARAM ) + if ( qres_detach_thread( -5, 0, RTEMS_SELF ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( qres_detach_thread( 5, 0, RTEMS_SELF ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_detach_thread( 5, 0, RTEMS_SELF ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY\n" ); - if ( qres_detach_thread( server_id2, 0, 1234 ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_detach_thread( server_id2, 0, 1234 ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY \n" ); - if ( qres_detach_thread( server_id, 0, RTEMS_SELF ) != - QOS_E_NOSERVER ) + } + if ( qres_detach_thread( server_id, 0, RTEMS_SELF ) != QOS_E_NOSERVER ) { printf( "ERROR: DETACH THREAD PASSED UNEXPECTEDLY4\n" ); + } qres_destroy_server( server_id2 ); /* Error checks for Set params and Get params */ printf( "Init: Set params and Get params\n" ); - if ( qres_set_params( -5, ¶ms ) != - QOS_E_INVALID_PARAM ) + if ( qres_set_params( -5, ¶ms ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: SET PARAMS PASSED UNEXPECTEDLY\n" ); - if ( qres_set_params( 5, ¶ms ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_set_params( 5, ¶ms ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: SET PARAMS PASSED UNEXPECTEDLY\n" ); - if ( qres_set_params( server_id, ¶ms ) != - QOS_E_NOSERVER ) + } + if ( qres_set_params( server_id, ¶ms ) != QOS_E_NOSERVER ) { printf( "ERROR: SET PARAMS PASSED UNEXPECTEDLY\n" ); + } - if ( qres_get_params( -5, ¶ms ) != - QOS_E_INVALID_PARAM ) + if ( qres_get_params( -5, ¶ms ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: GET PARAMS PASSED UNEXPECTEDLY\n" ); - if ( qres_get_params( 5, ¶ms ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_get_params( 5, ¶ms ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: GET PARAMS PASSED UNEXPECTEDLY\n" ); - if ( qres_get_params( server_id, ¶ms ) != - QOS_E_NOSERVER ) + } + if ( qres_get_params( server_id, ¶ms ) != QOS_E_NOSERVER ) { printf( "ERROR: GET PARAMS PASSED UNEXPECTEDLY\n" ); + } - if ( qres_set_params( server_id, ¶ms1 ) != - QOS_E_INVALID_PARAM ) + if ( qres_set_params( server_id, ¶ms1 ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: SET PARAMS PASSED UNEXPECTEDLY\n" ); - if ( qres_set_params( server_id, ¶ms3 ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_set_params( server_id, ¶ms3 ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: SET PARAMS PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get server id */ printf( "Init: Get server id\n" ); - if ( qres_get_sid( 0, RTEMS_SELF, &server_id ) != - QOS_E_NOSERVER ) + if ( qres_get_sid( 0, RTEMS_SELF, &server_id ) != QOS_E_NOSERVER ) { printf( "ERROR: GET SERVER ID PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get approved budget */ printf( "Init: Get approved budget\n" ); - if ( qres_get_appr_budget( -5, &approved_budget ) != - QOS_E_INVALID_PARAM ) + if ( qres_get_appr_budget( -5, &approved_budget ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" ); - if ( qres_get_appr_budget( 5, &approved_budget ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_get_appr_budget( 5, &approved_budget ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" ); - if ( qres_get_appr_budget( server_id, &approved_budget ) != - QOS_E_NOSERVER ) + } + if ( + qres_get_appr_budget( server_id, &approved_budget ) != QOS_E_NOSERVER + ) { printf( "ERROR: GET APPROVED BUDGET PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get current budget */ printf( "Init: Get current budget\n" ); - if ( qres_get_curr_budget( -5, ¤t_budget ) != - QOS_E_INVALID_PARAM ) + if ( qres_get_curr_budget( -5, ¤t_budget ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" ); - if ( qres_get_curr_budget( 5, ¤t_budget ) != - QOS_E_INVALID_PARAM ) + } + if ( qres_get_curr_budget( 5, ¤t_budget ) != QOS_E_INVALID_PARAM ) { printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" ); - if ( qres_get_curr_budget( server_id, ¤t_budget ) != - QOS_E_NOSERVER ) + } + if ( qres_get_curr_budget( server_id, ¤t_budget ) != QOS_E_NOSERVER ) { printf( "ERROR: GET REMAINING BUDGET PASSED UNEXPECTEDLY\n" ); + } /* Error checks for Get execution time */ printf( "Init: Get execution time\n" ); - if ( qres_get_exec_time( -5, &exec_time, &abs_time ) != - QOS_E_INVALID_PARAM ) + if ( + qres_get_exec_time( -5, &exec_time, &abs_time ) != QOS_E_INVALID_PARAM + ) { printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" ); - if ( qres_get_exec_time( 5, &exec_time, &abs_time ) != - QOS_E_INVALID_PARAM ) + } + if ( + qres_get_exec_time( 5, &exec_time, &abs_time ) != QOS_E_INVALID_PARAM + ) { printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" ); - if ( qres_get_exec_time( server_id, &exec_time, &abs_time ) != - QOS_E_NOSERVER ) + } + if ( + qres_get_exec_time( server_id, &exec_time, &abs_time ) != QOS_E_NOSERVER + ) { printf( "ERROR: GET EXECUTION TIME PASSED UNEXPECTEDLY\n" ); + } /* Restart QRES library */ printf( "Init: Cleaning up QRES\n" ); - if ( qres_cleanup() ) + if ( qres_cleanup() ) { printf( "ERROR: QRES CLEANUP FAILED\n" ); + } printf( "Init: Initializing the QRES\n" ); - if ( qres_init() ) + if ( qres_init() ) { printf( "ERROR: QRES INITIALIZATION FAILED\n" ); + } /* Start periodic task */ printf( "Init: Starting periodic task\n" ); diff --git a/testsuites/sptests/spqreslib/system.h b/testsuites/sptests/spqreslib/system.h index 42cea3a717..d69a3e0ce9 100644 --- a/testsuites/sptests/spqreslib/system.h +++ b/testsuites/sptests/spqreslib/system.h @@ -34,13 +34,9 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_Periodic( - rtems_task_argument argument -); +rtems_task Task_Periodic( rtems_task_argument argument ); /* configuration information */ @@ -49,16 +45,16 @@ rtems_task Task_Periodic( #define CONFIGURE_MICROSECONDS_PER_TICK 100000 -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_PERIODS 10 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_PERIODS 10 -#define CONFIGURE_INIT_TASK_PRIORITY 100 -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INIT_TASK_PRIORITY 100 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (6 * 4 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 6 * 4 * RTEMS_MINIMUM_STACK_SIZE ) #define CONFIGURE_SCHEDULER_CBS @@ -71,10 +67,10 @@ rtems_task Task_Periodic( /* global variables */ -extern rtems_id Task_id; +extern rtems_id Task_id; extern rtems_task_priority Priority; -extern time_t Period; -extern time_t Execution; -extern time_t Phase; +extern time_t Period; +extern time_t Execution; +extern time_t Phase; /* end of include file */ diff --git a/testsuites/sptests/spqreslib/task_periodic.c b/testsuites/sptests/spqreslib/task_periodic.c index 189d4ba9ea..8d51f81fde 100644 --- a/testsuites/sptests/spqreslib/task_periodic.c +++ b/testsuites/sptests/spqreslib/task_periodic.c @@ -27,9 +27,7 @@ #include "system.h" -rtems_task Task_Periodic( - rtems_task_argument argument -) +rtems_task Task_Periodic( rtems_task_argument argument ) { rtems_id rmid; rtems_status_code status; @@ -38,67 +36,84 @@ rtems_task Task_Periodic( int start, stop, now; - qres_sid_t server_id, tsid; + qres_sid_t server_id, tsid; qres_params_t params, tparams; params.P = Period; - params.Q = Execution+1; + params.Q = Execution + 1; printf( "Periodic task: Create server and Attach thread\n" ); - if ( qres_create_server( ¶ms, &server_id ) ) + if ( qres_create_server( ¶ms, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); - if ( qres_attach_thread( server_id, 0, Task_id ) ) + } + if ( qres_attach_thread( server_id, 0, Task_id ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); + } printf( "Periodic task: ID and Get parameters\n" ); - if ( qres_get_sid( 0, Task_id, &tsid ) ) + if ( qres_get_sid( 0, Task_id, &tsid ) ) { printf( "ERROR: GET SERVER ID FAILED\n" ); - if ( tsid != server_id ) + } + if ( tsid != server_id ) { printf( "ERROR: SERVER ID MISMATCH\n" ); - if ( qres_get_params( server_id, &tparams ) ) + } + if ( qres_get_params( server_id, &tparams ) ) { printf( "ERROR: GET PARAMETERS FAILED\n" ); - if ( params.P != tparams.P || - params.Q != tparams.Q ) + } + if ( params.P != tparams.P || params.Q != tparams.Q ) { printf( "ERROR: PARAMETERS MISMATCH\n" ); + } printf( "Periodic task: Detach thread and Destroy server\n" ); - if ( qres_detach_thread( server_id, 0, Task_id ) ) + if ( qres_detach_thread( server_id, 0, Task_id ) ) { printf( "ERROR: DETACH THREAD FAILED\n" ); - if ( qres_destroy_server( server_id ) ) + } + if ( qres_destroy_server( server_id ) ) { printf( "ERROR: DESTROY SERVER FAILED\n" ); - if ( qres_create_server( ¶ms, &server_id ) ) + } + if ( qres_create_server( ¶ms, &server_id ) ) { printf( "ERROR: CREATE SERVER FAILED\n" ); + } printf( "Periodic task: Current budget and Execution time\n" ); - if ( qres_get_curr_budget( server_id, ¤t_budget ) ) + if ( qres_get_curr_budget( server_id, ¤t_budget ) ) { printf( "ERROR: GET REMAINING BUDGET FAILED\n" ); - if ( current_budget != params.Q ) + } + if ( current_budget != params.Q ) { printf( "ERROR: REMAINING BUDGET MISMATCH\n" ); - if ( qres_get_exec_time( server_id, &exec_time, &abs_time ) ) + } + if ( qres_get_exec_time( server_id, &exec_time, &abs_time ) ) { printf( "ERROR: GET EXECUTION TIME FAILED\n" ); + } printf( "Periodic task: Set parameters\n" ); - if ( qres_attach_thread( server_id, 0, Task_id ) ) + if ( qres_attach_thread( server_id, 0, Task_id ) ) { printf( "ERROR: ATTACH THREAD FAILED\n" ); + } params.P = Period * 2; - params.Q = Execution * 2 +1; - if ( qres_set_params( server_id, ¶ms ) ) + params.Q = Execution * 2 + 1; + if ( qres_set_params( server_id, ¶ms ) ) { printf( "ERROR: SET PARAMS FAILED\n" ); - if ( qres_get_params( server_id, &tparams ) ) + } + if ( qres_get_params( server_id, &tparams ) ) { printf( "ERROR: GET PARAMS FAILED\n" ); - if ( params.P != tparams.P || - params.Q != tparams.Q ) + } + if ( params.P != tparams.P || params.Q != tparams.Q ) { printf( "ERROR: PARAMS MISMATCH\n" ); + } params.P = Period; - params.Q = Execution+1; - if ( qres_set_params( server_id, ¶ms ) ) + params.Q = Execution + 1; + if ( qres_set_params( server_id, ¶ms ) ) { printf( "ERROR: SET PARAMS FAILED\n" ); - if ( qres_get_appr_budget( server_id, &approved_budget ) ) + } + if ( qres_get_appr_budget( server_id, &approved_budget ) ) { printf( "ERROR: GET APPROVED BUDGET FAILED\n" ); + } printf( "Periodic task: Approved budget\n" ); - if ( approved_budget != params.Q ) + if ( approved_budget != params.Q ) { printf( "ERROR: APPROVED BUDGET MISMATCH\n" ); + } status = rtems_rate_monotonic_create( argument, &rmid ); directive_failed( status, "rtems_rate_monotonic_create" ); @@ -109,22 +124,29 @@ rtems_task Task_Periodic( directive_failed( status, "rtems_task_wake_after" ); while ( FOREVER ) { - if ( rtems_rate_monotonic_period(rmid, Period) == RTEMS_TIMEOUT ) + if ( rtems_rate_monotonic_period( rmid, Period ) == RTEMS_TIMEOUT ) { printf( "P%" PRIdPTR " - Deadline miss\n", argument ); + } start = rtems_clock_get_ticks_since_boot(); printf( "P%" PRIdPTR "-S ticks:%d\n", argument, start ); - if ( start > 4*Period+Phase ) break; /* stop */ + if ( start > 4 * Period + Phase ) { + break; /* stop */ + } /* active computing */ - while(FOREVER) { + while ( FOREVER ) { now = rtems_clock_get_ticks_since_boot(); - if ( now >= start + Execution ) break; + if ( now >= start + Execution ) { + break; + } - if ( qres_get_exec_time( server_id, &exec_time, &abs_time ) ) + if ( qres_get_exec_time( server_id, &exec_time, &abs_time ) ) { printf( "ERROR: GET EXECUTION TIME FAILED\n" ); - if ( qres_get_curr_budget( server_id, ¤t_budget) ) + } + if ( qres_get_curr_budget( server_id, ¤t_budget ) ) { printf( "ERROR: GET CURRENT BUDGET FAILED\n" ); - if ( (current_budget + exec_time) > (Execution + 1) ) { + } + if ( ( current_budget + exec_time ) > ( Execution + 1 ) ) { printf( "ERROR: CURRENT BUDGET AND EXECUTION TIME MISMATCH\n" ); rtems_test_exit( 0 ); } @@ -136,13 +158,17 @@ rtems_task Task_Periodic( /* delete period and SELF */ status = rtems_rate_monotonic_delete( rmid ); if ( status != RTEMS_SUCCESSFUL ) { - printf("rtems_rate_monotonic_delete failed with status of %d.\n", status); + printf( + "rtems_rate_monotonic_delete failed with status of %d.\n", + status + ); rtems_test_exit( 0 ); } - if ( qres_cleanup() ) + if ( qres_cleanup() ) { printf( "ERROR: QRES CLEANUP\n" ); + } - fflush(stdout); + fflush( stdout ); TEST_END(); rtems_test_exit( 0 ); } diff --git a/testsuites/sptests/spratemon_err01/init.c b/testsuites/sptests/spratemon_err01/init.c index 95baa8a7c3..1dde5ab857 100644 --- a/testsuites/sptests/spratemon_err01/init.c +++ b/testsuites/sptests/spratemon_err01/init.c @@ -35,18 +35,16 @@ const char rtems_test_name[] = "SP RATE MONOTONIC ERROR 01"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code status; TEST_BEGIN(); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); - + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + status = rtems_task_create( Task_name[ 4 ], 1, @@ -58,6 +56,6 @@ rtems_task Init( directive_failed( status, "rtems_task_create of TA4" ); puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" ); - Screen10(); + Screen10(); TEST_END(); } diff --git a/testsuites/sptests/spratemon_err01/screen10.c b/testsuites/sptests/spratemon_err01/screen10.c index feea4de2d0..1ac691da22 100644 --- a/testsuites/sptests/spratemon_err01/screen10.c +++ b/testsuites/sptests/spratemon_err01/screen10.c @@ -127,17 +127,21 @@ void Screen10() ); while ( FOREVER ) { + status = rtems_rate_monotonic_period( + Period_id[ 1 ], + RTEMS_PERIOD_STATUS + ); - status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS); + if ( status == RTEMS_TIMEOUT ) { + break; + } - if ( status == RTEMS_TIMEOUT ) break; + directive_failed( + status, + "rtems_rate_monotonic_period waiting for timeout" + ); - directive_failed( - status, - "rtems_rate_monotonic_period waiting for timeout" - ); - - rtems_task_wake_after( 1 ); + rtems_task_wake_after( 1 ); } puts( "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT" diff --git a/testsuites/sptests/spratemon_err01/system.h b/testsuites/sptests/spratemon_err01/system.h index 5ec49865d4..9452356125 100644 --- a/testsuites/sptests/spratemon_err01/system.h +++ b/testsuites/sptests/spratemon_err01/system.h @@ -35,18 +35,14 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); -rtems_task Task_4( - rtems_task_argument argument -); +rtems_task Task_4( rtems_task_argument argument ); void Screen10( void ); @@ -55,38 +51,38 @@ void Screen10( void ); #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spratemon_err01/task4.c b/testsuites/sptests/spratemon_err01/task4.c index 3451c54d07..a1bedce357 100644 --- a/testsuites/sptests/spratemon_err01/task4.c +++ b/testsuites/sptests/spratemon_err01/task4.c @@ -42,9 +42,7 @@ #include "system.h" -rtems_task Task_4( - rtems_task_argument argument -) +rtems_task Task_4( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sprbtree01/init.c b/testsuites/sptests/sprbtree01/init.c index 7fa6e3e80a..0d08ee7479 100644 --- a/testsuites/sptests/sprbtree01/init.c +++ b/testsuites/sptests/sprbtree01/init.c @@ -38,9 +38,9 @@ const char rtems_test_name[] = "SPRBTREE 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -static void test_rbtree_init_one(void) +static void test_rbtree_init_one( void ) { RBTree_Control tree; RBTree_Node node; @@ -64,21 +64,59 @@ static void test_rbtree_init_one(void) rtems_test_assert( _RBTree_Is_empty( &tree ) ); } -static const int numbers[20] = { - 52, 99, 0, 85, 43, 44, 10, 60, 50, 19, 8, 68, 48, 57, 17, 67, 90, 12, 77, 71 +static const int numbers[ 20 ] = { + 52, + 99, + 0, + 85, + 43, + 44, + 10, + 60, + 50, + 19, + 8, + 68, + 48, + 57, + 17, + 67, + 90, + 12, + 77, + 71 }; -static const int numbers_sorted[20] = { - 0, 8, 10, 12, 17, 19, 43, 44, 48, 50, 52, 57, 60, 67, 68, 71, 77, 85, 90, 99 +static const int numbers_sorted[ 20 ] = { + 0, + 8, + 10, + 12, + 17, + 19, + 43, + 44, + 48, + 50, + 52, + 57, + 60, + 67, + 68, + 71, + 77, + 85, + 90, + 99 }; typedef struct { - int id; - int key; + int id; + int key; rtems_rbtree_node Node; } test_node; -static test_node node_array[100]; +static test_node node_array[ 100 ]; #define RED RTEMS_RB_RED @@ -89,7 +127,7 @@ static int rb_color( const rtems_rbtree_node *n ) return RTEMS_RB_COLOR( n, Node ); } -static rtems_rbtree_compare_result test_compare_function ( +static rtems_rbtree_compare_result test_compare_function( const rtems_rbtree_node *n1, const rtems_rbtree_node *n2 ) @@ -136,49 +174,50 @@ static rtems_rbtree_node *rb_find_multi( * recursively checks tree. if the tree is built properly it should only * be a depth of 7 function calls for 100 entries in the tree. */ -static int rb_assert ( rtems_rbtree_node *root ) +static int rb_assert( rtems_rbtree_node *root ) { int lh, rh; - if ( root == NULL ) + if ( root == NULL ) { return 1; - else { - rtems_rbtree_node *ln = rtems_rbtree_left(root); - rtems_rbtree_node *rn = rtems_rbtree_right(root); + } else { + rtems_rbtree_node *ln = rtems_rbtree_left( root ); + rtems_rbtree_node *rn = rtems_rbtree_right( root ); /* Consecutive red links */ if ( rb_color( root ) == RED ) { if ( - ( ln && rb_color( ln ) == RED ) - || ( rn && rb_color( rn ) == RED ) + ( ln && rb_color( ln ) == RED ) || ( rn && rb_color( rn ) == RED ) ) { - puts ( "Red violation" ); + puts( "Red violation" ); return -1; } } - lh = rb_assert ( ln ); - rh = rb_assert ( rn ); + lh = rb_assert( ln ); + rh = rb_assert( rn ); /* Invalid binary search tree */ - if ( ( ln != NULL && test_compare_function(ln, root) > 0 ) - || ( rn != NULL && test_compare_function(rn, root) < 0 ) ) - { - puts ( "Binary tree violation" ); + if ( + ( ln != NULL && test_compare_function( ln, root ) > 0 ) || + ( rn != NULL && test_compare_function( rn, root ) < 0 ) + ) { + puts( "Binary tree violation" ); return -1; } /* Black height mismatch */ if ( lh != -1 && rh != -1 && lh != rh ) { - puts ( "Black violation" ); + puts( "Black violation" ); return -1; } /* Only count black links */ - if ( lh != -1 && rh != -1 ) + if ( lh != -1 && rh != -1 ) { return ( rb_color( root ) == RED ) ? lh : lh + 1; - else + } else { return -1; + } } } @@ -217,12 +256,12 @@ static void min_max_extract( rtems_test_assert( rtems_rbtree_max( tree ) == max ); } -static void test_rbtree_min_max(void) +static void test_rbtree_min_max( void ) { - rtems_rbtree_control tree; - rtems_rbtree_node *node; - rtems_rbtree_node *min; - rtems_rbtree_node *max; + rtems_rbtree_control tree; + rtems_rbtree_node *node; + rtems_rbtree_node *min; + rtems_rbtree_node *max; puts( "INIT - Verify min/max node updates" ); @@ -279,10 +318,7 @@ static void test_rbtree_min_max(void) rtems_test_assert( rtems_rbtree_is_empty( &tree ) ); } -static bool test_less( - const void *left, - const RBTree_Node *right -) +static bool test_less( const void *left, const RBTree_Node *right ) { const int *the_left; const test_node *the_right; @@ -314,311 +350,296 @@ static void test_rbtree_insert_inline( void ) _RBTree_Initialize_node( &c.Node ); key = b.key; - is_new_minimum = _RBTree_Insert_inline( - &tree, - &b.Node, - &key, - test_less - ); + is_new_minimum = _RBTree_Insert_inline( &tree, &b.Node, &key, test_less ); rtems_test_assert( is_new_minimum ); key = c.key; - is_new_minimum = _RBTree_Insert_inline( - &tree, - &c.Node, - &key, - test_less - ); + is_new_minimum = _RBTree_Insert_inline( &tree, &c.Node, &key, test_less ); rtems_test_assert( !is_new_minimum ); key = a.key; - is_new_minimum = _RBTree_Insert_inline( - &tree, - &a.Node, - &key, - test_less - ); + is_new_minimum = _RBTree_Insert_inline( &tree, &a.Node, &key, test_less ); rtems_test_assert( is_new_minimum ); } #define TN( i ) &node_array[ i ].Node typedef struct { - int key; + int key; const rtems_rbtree_node *parent; const rtems_rbtree_node *left; const rtems_rbtree_node *right; - int color; + int color; } test_node_description; static const test_node_description test_insert_tree_0[] = { - { 52, NULL, NULL, NULL , BLACK } + { 52, NULL, NULL, NULL, BLACK } }; static const test_node_description test_insert_tree_1[] = { - { 52, NULL, NULL, TN( 1 ) , BLACK }, - { 99, TN( 0 ), NULL, NULL , RED } + { 52, NULL, NULL, TN( 1 ), BLACK }, + { 99, TN( 0 ), NULL, NULL, RED } }; static const test_node_description test_insert_tree_2[] = { - { 0, TN( 0 ), NULL, NULL , RED }, - { 52, NULL, TN( 2 ), TN( 1 ) , BLACK }, - { 99, TN( 0 ), NULL, NULL , RED } + { 0, TN( 0 ), NULL, NULL, RED }, + { 52, NULL, TN( 2 ), TN( 1 ), BLACK }, + { 99, TN( 0 ), NULL, NULL, RED } }; static const test_node_description test_insert_tree_3[] = { - { 0, TN( 0 ), NULL, NULL , BLACK }, - { 52, NULL, TN( 2 ), TN( 1 ) , BLACK }, - { 85, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 0 ), TN( 3 ), NULL , BLACK } + { 0, TN( 0 ), NULL, NULL, BLACK }, + { 52, NULL, TN( 2 ), TN( 1 ), BLACK }, + { 85, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 0 ), TN( 3 ), NULL, BLACK } }; static const test_node_description test_insert_tree_4[] = { - { 0, TN( 0 ), NULL, TN( 4 ) , BLACK }, - { 43, TN( 2 ), NULL, NULL , RED }, - { 52, NULL, TN( 2 ), TN( 1 ) , BLACK }, - { 85, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 0 ), TN( 3 ), NULL , BLACK } + { 0, TN( 0 ), NULL, TN( 4 ), BLACK }, + { 43, TN( 2 ), NULL, NULL, RED }, + { 52, NULL, TN( 2 ), TN( 1 ), BLACK }, + { 85, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 0 ), TN( 3 ), NULL, BLACK } }; static const test_node_description test_insert_tree_5[] = { - { 0, TN( 4 ), NULL, NULL , RED }, - { 43, TN( 0 ), TN( 2 ), TN( 5 ) , BLACK }, - { 44, TN( 4 ), NULL, NULL , RED }, - { 52, NULL, TN( 4 ), TN( 1 ) , BLACK }, - { 85, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 0 ), TN( 3 ), NULL , BLACK } + { 0, TN( 4 ), NULL, NULL, RED }, + { 43, TN( 0 ), TN( 2 ), TN( 5 ), BLACK }, + { 44, TN( 4 ), NULL, NULL, RED }, + { 52, NULL, TN( 4 ), TN( 1 ), BLACK }, + { 85, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 0 ), TN( 3 ), NULL, BLACK } }; static const test_node_description test_insert_tree_6[] = { - { 0, TN( 4 ), NULL, TN( 6 ) , BLACK }, - { 10, TN( 2 ), NULL, NULL , RED }, - { 43, TN( 0 ), TN( 2 ), TN( 5 ) , RED }, - { 44, TN( 4 ), NULL, NULL , BLACK }, - { 52, NULL, TN( 4 ), TN( 1 ) , BLACK }, - { 85, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 0 ), TN( 3 ), NULL , BLACK } + { 0, TN( 4 ), NULL, TN( 6 ), BLACK }, + { 10, TN( 2 ), NULL, NULL, RED }, + { 43, TN( 0 ), TN( 2 ), TN( 5 ), RED }, + { 44, TN( 4 ), NULL, NULL, BLACK }, + { 52, NULL, TN( 4 ), TN( 1 ), BLACK }, + { 85, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 0 ), TN( 3 ), NULL, BLACK } }; static const test_node_description test_insert_tree_7[] = { - { 0, TN( 4 ), NULL, TN( 6 ) , BLACK }, - { 10, TN( 2 ), NULL, NULL , RED }, - { 43, TN( 0 ), TN( 2 ), TN( 5 ) , RED }, - { 44, TN( 4 ), NULL, NULL , BLACK }, - { 52, NULL, TN( 4 ), TN( 3 ) , BLACK }, - { 60, TN( 3 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , BLACK }, - { 99, TN( 3 ), NULL, NULL , RED } + { 0, TN( 4 ), NULL, TN( 6 ), BLACK }, + { 10, TN( 2 ), NULL, NULL, RED }, + { 43, TN( 0 ), TN( 2 ), TN( 5 ), RED }, + { 44, TN( 4 ), NULL, NULL, BLACK }, + { 52, NULL, TN( 4 ), TN( 3 ), BLACK }, + { 60, TN( 3 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), BLACK }, + { 99, TN( 3 ), NULL, NULL, RED } }; static const test_node_description test_insert_tree_8[] = { - { 0, TN( 4 ), NULL, TN( 6 ) , BLACK }, - { 10, TN( 2 ), NULL, NULL , RED }, - { 43, TN( 0 ), TN( 2 ), TN( 5 ) , RED }, - { 44, TN( 4 ), NULL, TN( 8 ) , BLACK }, - { 50, TN( 5 ), NULL, NULL , RED }, - { 52, NULL, TN( 4 ), TN( 3 ) , BLACK }, - { 60, TN( 3 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , BLACK }, - { 99, TN( 3 ), NULL, NULL , RED } + { 0, TN( 4 ), NULL, TN( 6 ), BLACK }, + { 10, TN( 2 ), NULL, NULL, RED }, + { 43, TN( 0 ), TN( 2 ), TN( 5 ), RED }, + { 44, TN( 4 ), NULL, TN( 8 ), BLACK }, + { 50, TN( 5 ), NULL, NULL, RED }, + { 52, NULL, TN( 4 ), TN( 3 ), BLACK }, + { 60, TN( 3 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), BLACK }, + { 99, TN( 3 ), NULL, NULL, RED } }; static const test_node_description test_insert_tree_9[] = { - { 0, TN( 6 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 19, TN( 6 ), NULL, NULL , RED }, - { 43, TN( 0 ), TN( 6 ), TN( 5 ) , RED }, - { 44, TN( 4 ), NULL, TN( 8 ) , BLACK }, - { 50, TN( 5 ), NULL, NULL , RED }, - { 52, NULL, TN( 4 ), TN( 3 ) , BLACK }, - { 60, TN( 3 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , BLACK }, - { 99, TN( 3 ), NULL, NULL , RED } + { 0, TN( 6 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 19, TN( 6 ), NULL, NULL, RED }, + { 43, TN( 0 ), TN( 6 ), TN( 5 ), RED }, + { 44, TN( 4 ), NULL, TN( 8 ), BLACK }, + { 50, TN( 5 ), NULL, NULL, RED }, + { 52, NULL, TN( 4 ), TN( 3 ), BLACK }, + { 60, TN( 3 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), BLACK }, + { 99, TN( 3 ), NULL, NULL, RED } }; static const test_node_description test_insert_tree_10[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , RED }, - { 19, TN( 6 ), NULL, NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 0 ) , BLACK }, - { 44, TN( 0 ), NULL, TN( 8 ) , BLACK }, - { 50, TN( 5 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 5 ), TN( 3 ) , RED }, - { 60, TN( 3 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , BLACK }, - { 99, TN( 3 ), NULL, NULL , RED } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), RED }, + { 19, TN( 6 ), NULL, NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 0 ), BLACK }, + { 44, TN( 0 ), NULL, TN( 8 ), BLACK }, + { 50, TN( 5 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 5 ), TN( 3 ), RED }, + { 60, TN( 3 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), BLACK }, + { 99, TN( 3 ), NULL, NULL, RED } }; static const test_node_description test_insert_tree_11[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 19, TN( 6 ), NULL, NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 0 ) , BLACK }, - { 44, TN( 0 ), NULL, TN( 8 ) , BLACK }, - { 50, TN( 5 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 5 ), TN( 3 ) , BLACK }, - { 60, TN( 3 ), NULL, TN( 11 ) , BLACK }, - { 68, TN( 7 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , RED }, - { 99, TN( 3 ), NULL, NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 19, TN( 6 ), NULL, NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 0 ), BLACK }, + { 44, TN( 0 ), NULL, TN( 8 ), BLACK }, + { 50, TN( 5 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 5 ), TN( 3 ), BLACK }, + { 60, TN( 3 ), NULL, TN( 11 ), BLACK }, + { 68, TN( 7 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), RED }, + { 99, TN( 3 ), NULL, NULL, BLACK } }; static const test_node_description test_insert_tree_12[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 19, TN( 6 ), NULL, NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 0 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 12 ), TN( 3 ) , BLACK }, - { 60, TN( 3 ), NULL, TN( 11 ) , BLACK }, - { 68, TN( 7 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , RED }, - { 99, TN( 3 ), NULL, NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 19, TN( 6 ), NULL, NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 0 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 12 ), TN( 3 ), BLACK }, + { 60, TN( 3 ), NULL, TN( 11 ), BLACK }, + { 68, TN( 7 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), RED }, + { 99, TN( 3 ), NULL, NULL, BLACK } }; static const test_node_description test_insert_tree_13[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 19, TN( 6 ), NULL, NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 0 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 12 ), TN( 3 ) , BLACK }, - { 57, TN( 7 ), NULL, NULL , RED }, - { 60, TN( 3 ), TN( 13 ), TN( 11 ) , BLACK }, - { 68, TN( 7 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , RED }, - { 99, TN( 3 ), NULL, NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 19, TN( 6 ), NULL, NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 0 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 12 ), TN( 3 ), BLACK }, + { 57, TN( 7 ), NULL, NULL, RED }, + { 60, TN( 3 ), TN( 13 ), TN( 11 ), BLACK }, + { 68, TN( 7 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), RED }, + { 99, TN( 3 ), NULL, NULL, BLACK } }; static const test_node_description test_insert_tree_14[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 17, TN( 9 ), NULL, NULL , RED }, - { 19, TN( 6 ), TN( 14 ), NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 0 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 12 ), TN( 3 ) , BLACK }, - { 57, TN( 7 ), NULL, NULL , RED }, - { 60, TN( 3 ), TN( 13 ), TN( 11 ) , BLACK }, - { 68, TN( 7 ), NULL, NULL , RED }, - { 85, TN( 0 ), TN( 7 ), TN( 1 ) , RED }, - { 99, TN( 3 ), NULL, NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 17, TN( 9 ), NULL, NULL, RED }, + { 19, TN( 6 ), TN( 14 ), NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 0 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 12 ), TN( 3 ), BLACK }, + { 57, TN( 7 ), NULL, NULL, RED }, + { 60, TN( 3 ), TN( 13 ), TN( 11 ), BLACK }, + { 68, TN( 7 ), NULL, NULL, RED }, + { 85, TN( 0 ), TN( 7 ), TN( 1 ), RED }, + { 99, TN( 3 ), NULL, NULL, BLACK } }; static const test_node_description test_insert_tree_15[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 17, TN( 9 ), NULL, NULL , RED }, - { 19, TN( 6 ), TN( 14 ), NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , RED }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , RED }, - { 68, TN( 3 ), TN( 15 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , RED }, - { 99, TN( 3 ), NULL, NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 17, TN( 9 ), NULL, NULL, RED }, + { 19, TN( 6 ), TN( 14 ), NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), RED }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, RED }, + { 68, TN( 3 ), TN( 15 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), RED }, + { 99, TN( 3 ), NULL, NULL, BLACK } }; static const test_node_description test_insert_tree_16[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 9 ) , BLACK }, - { 17, TN( 9 ), NULL, NULL , RED }, - { 19, TN( 6 ), TN( 14 ), NULL , BLACK }, - { 43, NULL, TN( 6 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , RED }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , RED }, - { 68, TN( 3 ), TN( 15 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , RED }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 9 ), BLACK }, + { 17, TN( 9 ), NULL, NULL, RED }, + { 19, TN( 6 ), TN( 14 ), NULL, BLACK }, + { 43, NULL, TN( 6 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), RED }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, RED }, + { 68, TN( 3 ), TN( 15 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), RED }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_insert_tree_17[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 14 ) , BLACK }, - { 12, TN( 14 ), NULL, NULL , RED }, - { 17, TN( 6 ), TN( 17 ), TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , RED }, - { 43, NULL, TN( 6 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , RED }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , RED }, - { 68, TN( 3 ), TN( 15 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , RED }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 14 ), BLACK }, + { 12, TN( 14 ), NULL, NULL, RED }, + { 17, TN( 6 ), TN( 17 ), TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, RED }, + { 43, NULL, TN( 6 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), RED }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, RED }, + { 68, TN( 3 ), TN( 15 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), RED }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_insert_tree_18[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 14 ) , BLACK }, - { 12, TN( 14 ), NULL, NULL , RED }, - { 17, TN( 6 ), TN( 17 ), TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , RED }, - { 43, NULL, TN( 6 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , RED }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , RED }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , BLACK }, - { 77, TN( 11 ), NULL, NULL , RED }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , RED }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 14 ), BLACK }, + { 12, TN( 14 ), NULL, NULL, RED }, + { 17, TN( 6 ), TN( 17 ), TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, RED }, + { 43, NULL, TN( 6 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), RED }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, RED }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), BLACK }, + { 77, TN( 11 ), NULL, NULL, RED }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), RED }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_insert_tree_19[] = { - { 0, TN( 6 ), NULL, TN( 10 ) , BLACK }, - { 8, TN( 2 ), NULL, NULL , RED }, - { 10, TN( 4 ), TN( 2 ), TN( 14 ) , BLACK }, - { 12, TN( 14 ), NULL, NULL , RED }, - { 17, TN( 6 ), TN( 17 ), TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , RED }, - { 43, NULL, TN( 6 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , RED }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 0, TN( 6 ), NULL, TN( 10 ), BLACK }, + { 8, TN( 2 ), NULL, NULL, RED }, + { 10, TN( 4 ), TN( 2 ), TN( 14 ), BLACK }, + { 12, TN( 14 ), NULL, NULL, RED }, + { 17, TN( 6 ), TN( 17 ), TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, RED }, + { 43, NULL, TN( 6 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), RED }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description *const test_insert_trees[] = { @@ -645,250 +666,250 @@ static const test_node_description *const test_insert_trees[] = { }; static const test_node_description test_remove_tree_0[] = { - { 8, TN( 6 ), NULL, NULL , BLACK }, - { 10, TN( 4 ), TN( 10 ), TN( 14 ) , BLACK }, - { 12, TN( 14 ), NULL, NULL , RED }, - { 17, TN( 6 ), TN( 17 ), TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , RED }, - { 43, NULL, TN( 6 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , RED }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 8, TN( 6 ), NULL, NULL, BLACK }, + { 10, TN( 4 ), TN( 10 ), TN( 14 ), BLACK }, + { 12, TN( 14 ), NULL, NULL, RED }, + { 17, TN( 6 ), TN( 17 ), TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, RED }, + { 43, NULL, TN( 6 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), RED }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_1[] = { - { 10, TN( 14 ), NULL, TN( 17 ) , BLACK }, - { 12, TN( 6 ), NULL, NULL , RED }, - { 17, TN( 4 ), TN( 6 ), TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , BLACK }, - { 43, NULL, TN( 14 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , RED }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 10, TN( 14 ), NULL, TN( 17 ), BLACK }, + { 12, TN( 6 ), NULL, NULL, RED }, + { 17, TN( 4 ), TN( 6 ), TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, BLACK }, + { 43, NULL, TN( 14 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), RED }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_2[] = { - { 12, TN( 14 ), NULL, NULL , BLACK }, - { 17, TN( 4 ), TN( 17 ), TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , BLACK }, - { 43, NULL, TN( 14 ), TN( 7 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, TN( 4 ), TN( 0 ), TN( 3 ) , RED }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 12, TN( 14 ), NULL, NULL, BLACK }, + { 17, TN( 4 ), TN( 17 ), TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, BLACK }, + { 43, NULL, TN( 14 ), TN( 7 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, TN( 4 ), TN( 0 ), TN( 3 ), RED }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_3[] = { - { 17, TN( 4 ), NULL, TN( 9 ) , BLACK }, - { 19, TN( 14 ), NULL, NULL , RED }, - { 43, TN( 7 ), TN( 14 ), TN( 0 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 12 ), TN( 13 ) , RED }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, NULL, TN( 4 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 17, TN( 4 ), NULL, TN( 9 ), BLACK }, + { 19, TN( 14 ), NULL, NULL, RED }, + { 43, TN( 7 ), TN( 14 ), TN( 0 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 12 ), TN( 13 ), RED }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, NULL, TN( 4 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_4[] = { - { 19, TN( 4 ), NULL, NULL , BLACK }, - { 43, TN( 7 ), TN( 9 ), TN( 0 ) , BLACK }, - { 44, TN( 12 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 4 ), TN( 12 ), TN( 13 ) , RED }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, NULL, TN( 4 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 19, TN( 4 ), NULL, NULL, BLACK }, + { 43, TN( 7 ), TN( 9 ), TN( 0 ), BLACK }, + { 44, TN( 12 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 4 ), TN( 12 ), TN( 13 ), RED }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, NULL, TN( 4 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_5[] = { - { 43, TN( 12 ), NULL, TN( 5 ) , BLACK }, - { 44, TN( 4 ), NULL, NULL , RED }, - { 48, TN( 0 ), TN( 4 ), TN( 8 ) , RED }, - { 50, TN( 12 ), NULL, NULL , BLACK }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, NULL, TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 43, TN( 12 ), NULL, TN( 5 ), BLACK }, + { 44, TN( 4 ), NULL, NULL, RED }, + { 48, TN( 0 ), TN( 4 ), TN( 8 ), RED }, + { 50, TN( 12 ), NULL, NULL, BLACK }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, NULL, TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_6[] = { - { 44, TN( 12 ), NULL, NULL , BLACK }, - { 48, TN( 0 ), TN( 5 ), TN( 8 ) , RED }, - { 50, TN( 12 ), NULL, NULL , BLACK }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, NULL, TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 44, TN( 12 ), NULL, NULL, BLACK }, + { 48, TN( 0 ), TN( 5 ), TN( 8 ), RED }, + { 50, TN( 12 ), NULL, NULL, BLACK }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, NULL, TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_7[] = { - { 48, TN( 0 ), NULL, TN( 8 ) , BLACK }, - { 50, TN( 12 ), NULL, NULL , RED }, - { 52, TN( 7 ), TN( 12 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, NULL, TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 48, TN( 0 ), NULL, TN( 8 ), BLACK }, + { 50, TN( 12 ), NULL, NULL, RED }, + { 52, TN( 7 ), TN( 12 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, NULL, TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_8[] = { - { 50, TN( 0 ), NULL, NULL , BLACK }, - { 52, TN( 7 ), TN( 8 ), TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , BLACK }, - { 60, NULL, TN( 0 ), TN( 3 ) , BLACK }, - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, TN( 3 ), TN( 15 ), TN( 18 ) , RED }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 11 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 7 ), TN( 11 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 50, TN( 0 ), NULL, NULL, BLACK }, + { 52, TN( 7 ), TN( 8 ), TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, BLACK }, + { 60, NULL, TN( 0 ), TN( 3 ), BLACK }, + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, TN( 3 ), TN( 15 ), TN( 18 ), RED }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 11 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 7 ), TN( 11 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_9[] = { - { 52, TN( 7 ), NULL, TN( 13 ) , BLACK }, - { 57, TN( 0 ), NULL, NULL , RED }, - { 60, TN( 11 ), TN( 0 ), TN( 15 ) , BLACK }, - { 67, TN( 7 ), NULL, NULL , BLACK }, - { 68, NULL, TN( 7 ), TN( 3 ) , BLACK }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 3 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 11 ), TN( 18 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 52, TN( 7 ), NULL, TN( 13 ), BLACK }, + { 57, TN( 0 ), NULL, NULL, RED }, + { 60, TN( 11 ), TN( 0 ), TN( 15 ), BLACK }, + { 67, TN( 7 ), NULL, NULL, BLACK }, + { 68, NULL, TN( 7 ), TN( 3 ), BLACK }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 3 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 11 ), TN( 18 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_10[] = { - { 57, TN( 7 ), NULL, NULL , BLACK }, - { 60, TN( 11 ), TN( 13 ), TN( 15 ) , BLACK }, - { 67, TN( 7 ), NULL, NULL , BLACK }, - { 68, NULL, TN( 7 ), TN( 3 ) , BLACK }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 3 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 11 ), TN( 18 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 57, TN( 7 ), NULL, NULL, BLACK }, + { 60, TN( 11 ), TN( 13 ), TN( 15 ), BLACK }, + { 67, TN( 7 ), NULL, NULL, BLACK }, + { 68, NULL, TN( 7 ), TN( 3 ), BLACK }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 3 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 11 ), TN( 18 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_11[] = { - { 60, TN( 11 ), NULL, TN( 15 ) , BLACK }, - { 67, TN( 7 ), NULL, NULL , RED }, - { 68, NULL, TN( 7 ), TN( 3 ) , BLACK }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 3 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 11 ), TN( 18 ), TN( 1 ) , RED }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 60, TN( 11 ), NULL, TN( 15 ), BLACK }, + { 67, TN( 7 ), NULL, NULL, RED }, + { 68, NULL, TN( 7 ), TN( 3 ), BLACK }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 3 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 11 ), TN( 18 ), TN( 1 ), RED }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_12[] = { - { 67, TN( 11 ), NULL, NULL , BLACK }, - { 68, NULL, TN( 15 ), TN( 3 ) , BLACK }, - { 71, TN( 18 ), NULL, NULL , RED }, - { 77, TN( 3 ), TN( 19 ), NULL , BLACK }, - { 85, TN( 11 ), TN( 18 ), TN( 1 ) , RED }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 67, TN( 11 ), NULL, NULL, BLACK }, + { 68, NULL, TN( 15 ), TN( 3 ), BLACK }, + { 71, TN( 18 ), NULL, NULL, RED }, + { 77, TN( 3 ), TN( 19 ), NULL, BLACK }, + { 85, TN( 11 ), TN( 18 ), TN( 1 ), RED }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_13[] = { - { 68, TN( 19 ), NULL, NULL , BLACK }, - { 71, TN( 3 ), TN( 11 ), TN( 18 ) , RED }, - { 77, TN( 19 ), NULL, NULL , BLACK }, - { 85, NULL, TN( 19 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 68, TN( 19 ), NULL, NULL, BLACK }, + { 71, TN( 3 ), TN( 11 ), TN( 18 ), RED }, + { 77, TN( 19 ), NULL, NULL, BLACK }, + { 85, NULL, TN( 19 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_14[] = { - { 71, TN( 3 ), NULL, TN( 18 ) , BLACK }, - { 77, TN( 19 ), NULL, NULL , RED }, - { 85, NULL, TN( 19 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 71, TN( 3 ), NULL, TN( 18 ), BLACK }, + { 77, TN( 19 ), NULL, NULL, RED }, + { 85, NULL, TN( 19 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_15[] = { - { 77, TN( 3 ), NULL, NULL , BLACK }, - { 85, NULL, TN( 18 ), TN( 1 ) , BLACK }, - { 90, TN( 1 ), NULL, NULL , RED }, - { 99, TN( 3 ), TN( 16 ), NULL , BLACK } + { 77, TN( 3 ), NULL, NULL, BLACK }, + { 85, NULL, TN( 18 ), TN( 1 ), BLACK }, + { 90, TN( 1 ), NULL, NULL, RED }, + { 99, TN( 3 ), TN( 16 ), NULL, BLACK } }; static const test_node_description test_remove_tree_16[] = { - { 85, TN( 16 ), NULL, NULL , BLACK }, - { 90, NULL, TN( 3 ), TN( 1 ) , BLACK }, - { 99, TN( 16 ), NULL, NULL , BLACK } + { 85, TN( 16 ), NULL, NULL, BLACK }, + { 90, NULL, TN( 3 ), TN( 1 ), BLACK }, + { 99, TN( 16 ), NULL, NULL, BLACK } }; static const test_node_description test_remove_tree_17[] = { - { 90, NULL, NULL, TN( 1 ) , BLACK }, - { 99, TN( 16 ), NULL, NULL , RED } + { 90, NULL, NULL, TN( 1 ), BLACK }, + { 99, TN( 16 ), NULL, NULL, RED } }; static const test_node_description test_remove_tree_18[] = { - { 99, NULL, NULL, NULL , BLACK } + { 99, NULL, NULL, NULL, BLACK } }; static const test_node_description *const test_remove_trees[] = { @@ -914,17 +935,14 @@ static const test_node_description *const test_remove_trees[] = { }; typedef struct { - int current; - int count; + int current; + int count; const test_node_description *tree; } visitor_context; -static bool visit_nodes( - const RBTree_Node *node, - void *visitor_arg -) +static bool visit_nodes( const RBTree_Node *node, void *visitor_arg ) { - visitor_context *ctx = visitor_arg; + visitor_context *ctx = visitor_arg; const test_node_description *td = &ctx->tree[ ctx->current ]; const test_node *tn = RTEMS_CONTAINER_OF( node, test_node, Node ); @@ -955,11 +973,9 @@ static const test_node_description random_ops_tree_multiple_1[] = { { 0, NULL, NULL, NULL, BLACK } }; -static const test_node_description random_ops_tree_unique_2[] = { -}; +static const test_node_description random_ops_tree_unique_2[] = {}; -static const test_node_description random_ops_tree_multiple_2[] = { -}; +static const test_node_description random_ops_tree_multiple_2[] = {}; static const test_node_description random_ops_tree_unique_3[] = { { 2, NULL, NULL, NULL, BLACK } @@ -970,8 +986,8 @@ static const test_node_description random_ops_tree_multiple_3[] = { }; static const test_node_description random_ops_tree_unique_4[] = { - { 0, TN(3), NULL, NULL, RED }, - { 3, NULL, TN(0), NULL, BLACK } + { 0, TN( 3 ), NULL, NULL, RED }, + { 3, NULL, TN( 0 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_4[] = { @@ -1018,10 +1034,10 @@ static const test_node_description random_ops_tree_multiple_7[] = { }; static const test_node_description random_ops_tree_unique_8[] = { - { 0, TN(1), NULL, NULL, BLACK }, - { 1, NULL, TN(0), TN(6), BLACK }, - { 5, TN(6), NULL, NULL, RED }, - { 6, TN(1), TN(5), NULL, BLACK } + { 0, TN( 1 ), NULL, NULL, BLACK }, + { 1, NULL, TN( 0 ), TN( 6 ), BLACK }, + { 5, TN( 6 ), NULL, NULL, RED }, + { 6, TN( 1 ), TN( 5 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_8[] = { @@ -1108,36 +1124,36 @@ static const test_node_description random_ops_tree_multiple_12[] = { }; static const test_node_description random_ops_tree_unique_13[] = { - { 0, TN(1), NULL, NULL, RED }, - { 1, TN(3), TN(0), NULL, BLACK }, - { 3, TN(8), TN(1), TN(5), RED }, - { 4, TN(5), NULL, NULL, RED }, - { 5, TN(3), TN(4), TN(6), BLACK }, - { 6, TN(5), NULL, NULL, RED }, - { 8, NULL, TN(3), TN(11), BLACK }, - { 10, TN(11), NULL, NULL, RED }, - { 11, TN(8), TN(10), NULL, BLACK } + { 0, TN( 1 ), NULL, NULL, RED }, + { 1, TN( 3 ), TN( 0 ), NULL, BLACK }, + { 3, TN( 8 ), TN( 1 ), TN( 5 ), RED }, + { 4, TN( 5 ), NULL, NULL, RED }, + { 5, TN( 3 ), TN( 4 ), TN( 6 ), BLACK }, + { 6, TN( 5 ), NULL, NULL, RED }, + { 8, NULL, TN( 3 ), TN( 11 ), BLACK }, + { 10, TN( 11 ), NULL, NULL, RED }, + { 11, TN( 8 ), TN( 10 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_13[] = { - { 0, TN(0), NULL, NULL, RED }, - { 0, TN(3), TN(1), NULL, BLACK }, - { 1, TN(6), TN(0), TN(4), RED }, - { 2, TN(3), NULL, TN(5), BLACK }, - { 2, TN(4), NULL, NULL, RED }, - { 3, NULL, TN(3), TN(11), BLACK }, - { 4, TN(11), NULL, NULL, RED }, - { 5, TN(6), TN(8), TN(10), BLACK }, - { 5, TN(11), NULL, NULL, RED } + { 0, TN( 0 ), NULL, NULL, RED }, + { 0, TN( 3 ), TN( 1 ), NULL, BLACK }, + { 1, TN( 6 ), TN( 0 ), TN( 4 ), RED }, + { 2, TN( 3 ), NULL, TN( 5 ), BLACK }, + { 2, TN( 4 ), NULL, NULL, RED }, + { 3, NULL, TN( 3 ), TN( 11 ), BLACK }, + { 4, TN( 11 ), NULL, NULL, RED }, + { 5, TN( 6 ), TN( 8 ), TN( 10 ), BLACK }, + { 5, TN( 11 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_14[] = { - { 3, TN(5), NULL, NULL, RED }, - { 5, TN(6), TN(3), NULL, BLACK }, - { 6, NULL, TN(5), TN(12), BLACK }, - { 8, TN(12), NULL, NULL, BLACK }, - { 12, TN(6), TN(8), TN(13), RED }, - { 13, TN(12), NULL, NULL, BLACK } + { 3, TN( 5 ), NULL, NULL, RED }, + { 5, TN( 6 ), TN( 3 ), NULL, BLACK }, + { 6, NULL, TN( 5 ), TN( 12 ), BLACK }, + { 8, TN( 12 ), NULL, NULL, BLACK }, + { 12, TN( 6 ), TN( 8 ), TN( 13 ), RED }, + { 13, TN( 12 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_14[] = { @@ -1150,497 +1166,497 @@ static const test_node_description random_ops_tree_multiple_14[] = { }; static const test_node_description random_ops_tree_unique_15[] = { - { 0, TN(2), NULL, NULL, RED }, - { 2, TN(8), TN(0), TN(7), BLACK }, - { 7, TN(2), NULL, NULL, RED }, - { 8, NULL, TN(2), TN(12), BLACK }, - { 9, TN(12), NULL, TN(10), BLACK }, - { 10, TN(9), NULL, NULL, RED }, - { 12, TN(8), TN(9), TN(13), RED }, - { 13, TN(12), NULL, TN(14), BLACK }, - { 14, TN(13), NULL, NULL, RED } + { 0, TN( 2 ), NULL, NULL, RED }, + { 2, TN( 8 ), TN( 0 ), TN( 7 ), BLACK }, + { 7, TN( 2 ), NULL, NULL, RED }, + { 8, NULL, TN( 2 ), TN( 12 ), BLACK }, + { 9, TN( 12 ), NULL, TN( 10 ), BLACK }, + { 10, TN( 9 ), NULL, NULL, RED }, + { 12, TN( 8 ), TN( 9 ), TN( 13 ), RED }, + { 13, TN( 12 ), NULL, TN( 14 ), BLACK }, + { 14, TN( 13 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_15[] = { - { 0, TN(2), NULL, NULL, RED }, - { 1, TN(9), TN(0), TN(7), BLACK }, - { 3, TN(2), NULL, NULL, RED }, - { 4, NULL, TN(2), TN(10), BLACK }, - { 4, TN(10), NULL, NULL, BLACK }, - { 5, TN(9), TN(8), TN(12), RED }, - { 6, TN(12), NULL, NULL, RED }, - { 6, TN(10), TN(13), TN(14), BLACK }, - { 7, TN(12), NULL, NULL, RED } + { 0, TN( 2 ), NULL, NULL, RED }, + { 1, TN( 9 ), TN( 0 ), TN( 7 ), BLACK }, + { 3, TN( 2 ), NULL, NULL, RED }, + { 4, NULL, TN( 2 ), TN( 10 ), BLACK }, + { 4, TN( 10 ), NULL, NULL, BLACK }, + { 5, TN( 9 ), TN( 8 ), TN( 12 ), RED }, + { 6, TN( 12 ), NULL, NULL, RED }, + { 6, TN( 10 ), TN( 13 ), TN( 14 ), BLACK }, + { 7, TN( 12 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_16[] = { - { 0, TN(5), NULL, TN(3), BLACK }, - { 3, TN(0), NULL, NULL, RED }, - { 5, TN(10), TN(0), TN(7), RED }, - { 7, TN(5), NULL, NULL, BLACK }, - { 10, NULL, TN(5), TN(12), BLACK }, - { 12, TN(10), NULL, NULL, BLACK } + { 0, TN( 5 ), NULL, TN( 3 ), BLACK }, + { 3, TN( 0 ), NULL, NULL, RED }, + { 5, TN( 10 ), TN( 0 ), TN( 7 ), RED }, + { 7, TN( 5 ), NULL, NULL, BLACK }, + { 10, NULL, TN( 5 ), TN( 12 ), BLACK }, + { 12, TN( 10 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_16[] = { - { 0, TN(5), NULL, TN(3), BLACK }, - { 1, TN(0), NULL, NULL, RED }, - { 2, TN(10), TN(0), TN(7), RED }, - { 3, TN(5), NULL, NULL, BLACK }, - { 5, NULL, TN(5), TN(12), BLACK }, - { 6, TN(10), NULL, NULL, BLACK } + { 0, TN( 5 ), NULL, TN( 3 ), BLACK }, + { 1, TN( 0 ), NULL, NULL, RED }, + { 2, TN( 10 ), TN( 0 ), TN( 7 ), RED }, + { 3, TN( 5 ), NULL, NULL, BLACK }, + { 5, NULL, TN( 5 ), TN( 12 ), BLACK }, + { 6, TN( 10 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_unique_17[] = { - { 0, TN(1), NULL, NULL, RED }, - { 1, TN(3), TN(0), NULL, BLACK }, - { 3, TN(7), TN(1), TN(5), RED }, - { 4, TN(5), NULL, NULL, RED }, - { 5, TN(3), TN(4), NULL, BLACK }, - { 7, NULL, TN(3), TN(9), BLACK }, - { 8, TN(9), NULL, NULL, BLACK }, - { 9, TN(7), TN(8), TN(16), RED }, - { 16, TN(9), NULL, NULL, BLACK } + { 0, TN( 1 ), NULL, NULL, RED }, + { 1, TN( 3 ), TN( 0 ), NULL, BLACK }, + { 3, TN( 7 ), TN( 1 ), TN( 5 ), RED }, + { 4, TN( 5 ), NULL, NULL, RED }, + { 5, TN( 3 ), TN( 4 ), NULL, BLACK }, + { 7, NULL, TN( 3 ), TN( 9 ), BLACK }, + { 8, TN( 9 ), NULL, NULL, BLACK }, + { 9, TN( 7 ), TN( 8 ), TN( 16 ), RED }, + { 16, TN( 9 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_17[] = { - { 0, TN(0), NULL, NULL, RED }, - { 0, TN(3), TN(1), NULL, BLACK }, - { 1, TN(7), TN(0), TN(5), RED }, - { 2, TN(3), NULL, TN(4), BLACK }, - { 2, TN(5), NULL, NULL, RED }, - { 3, NULL, TN(3), TN(8), BLACK }, - { 4, TN(8), NULL, NULL, BLACK }, - { 4, TN(7), TN(9), TN(16), RED }, - { 8, TN(8), NULL, NULL, BLACK } + { 0, TN( 0 ), NULL, NULL, RED }, + { 0, TN( 3 ), TN( 1 ), NULL, BLACK }, + { 1, TN( 7 ), TN( 0 ), TN( 5 ), RED }, + { 2, TN( 3 ), NULL, TN( 4 ), BLACK }, + { 2, TN( 5 ), NULL, NULL, RED }, + { 3, NULL, TN( 3 ), TN( 8 ), BLACK }, + { 4, TN( 8 ), NULL, NULL, BLACK }, + { 4, TN( 7 ), TN( 9 ), TN( 16 ), RED }, + { 8, TN( 8 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_unique_18[] = { - { 0, TN(2), NULL, TN(1), BLACK }, - { 1, TN(0), NULL, NULL, RED }, - { 2, TN(4), TN(0), TN(3), BLACK }, - { 3, TN(2), NULL, NULL, BLACK }, - { 4, NULL, TN(2), TN(12), BLACK }, - { 5, TN(6), NULL, NULL, RED }, - { 6, TN(8), TN(5), TN(7), BLACK }, - { 7, TN(6), NULL, NULL, RED }, - { 8, TN(12), TN(6), TN(10), RED }, - { 9, TN(10), NULL, NULL, RED }, - { 10, TN(8), TN(9), NULL, BLACK }, - { 12, TN(4), TN(8), TN(17), BLACK }, - { 14, TN(17), NULL, NULL, RED }, - { 17, TN(12), TN(14), NULL, BLACK } + { 0, TN( 2 ), NULL, TN( 1 ), BLACK }, + { 1, TN( 0 ), NULL, NULL, RED }, + { 2, TN( 4 ), TN( 0 ), TN( 3 ), BLACK }, + { 3, TN( 2 ), NULL, NULL, BLACK }, + { 4, NULL, TN( 2 ), TN( 12 ), BLACK }, + { 5, TN( 6 ), NULL, NULL, RED }, + { 6, TN( 8 ), TN( 5 ), TN( 7 ), BLACK }, + { 7, TN( 6 ), NULL, NULL, RED }, + { 8, TN( 12 ), TN( 6 ), TN( 10 ), RED }, + { 9, TN( 10 ), NULL, NULL, RED }, + { 10, TN( 8 ), TN( 9 ), NULL, BLACK }, + { 12, TN( 4 ), TN( 8 ), TN( 17 ), BLACK }, + { 14, TN( 17 ), NULL, NULL, RED }, + { 17, TN( 12 ), TN( 14 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_18[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 0, TN(0), NULL, NULL, RED }, - { 1, TN(4), TN(0), TN(2), BLACK }, - { 1, TN(3), NULL, NULL, BLACK }, - { 2, NULL, TN(3), TN(12), BLACK }, - { 2, TN(6), NULL, NULL, RED }, - { 3, TN(8), TN(5), TN(7), BLACK }, - { 3, TN(6), NULL, NULL, RED }, - { 4, TN(12), TN(6), TN(10), RED }, - { 4, TN(10), NULL, NULL, RED }, - { 5, TN(8), TN(9), NULL, BLACK }, - { 6, TN(4), TN(8), TN(14), BLACK }, - { 7, TN(12), NULL, TN(17), BLACK }, - { 8, TN(14), NULL, NULL, RED } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 0, TN( 0 ), NULL, NULL, RED }, + { 1, TN( 4 ), TN( 0 ), TN( 2 ), BLACK }, + { 1, TN( 3 ), NULL, NULL, BLACK }, + { 2, NULL, TN( 3 ), TN( 12 ), BLACK }, + { 2, TN( 6 ), NULL, NULL, RED }, + { 3, TN( 8 ), TN( 5 ), TN( 7 ), BLACK }, + { 3, TN( 6 ), NULL, NULL, RED }, + { 4, TN( 12 ), TN( 6 ), TN( 10 ), RED }, + { 4, TN( 10 ), NULL, NULL, RED }, + { 5, TN( 8 ), TN( 9 ), NULL, BLACK }, + { 6, TN( 4 ), TN( 8 ), TN( 14 ), BLACK }, + { 7, TN( 12 ), NULL, TN( 17 ), BLACK }, + { 8, TN( 14 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_19[] = { - { 1, TN(2), NULL, NULL, RED }, - { 2, TN(6), TN(1), NULL, BLACK }, - { 6, TN(11), TN(2), TN(8), BLACK }, - { 8, TN(6), NULL, TN(9), BLACK }, - { 9, TN(8), NULL, NULL, RED }, - { 11, NULL, TN(6), TN(14), BLACK }, - { 12, TN(14), NULL, NULL, BLACK }, - { 14, TN(11), TN(12), TN(16), BLACK }, - { 16, TN(14), NULL, NULL, BLACK } + { 1, TN( 2 ), NULL, NULL, RED }, + { 2, TN( 6 ), TN( 1 ), NULL, BLACK }, + { 6, TN( 11 ), TN( 2 ), TN( 8 ), BLACK }, + { 8, TN( 6 ), NULL, TN( 9 ), BLACK }, + { 9, TN( 8 ), NULL, NULL, RED }, + { 11, NULL, TN( 6 ), TN( 14 ), BLACK }, + { 12, TN( 14 ), NULL, NULL, BLACK }, + { 14, TN( 11 ), TN( 12 ), TN( 16 ), BLACK }, + { 16, TN( 14 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_19[] = { - { 0, TN(2), NULL, NULL, RED }, - { 1, TN(6), TN(1), NULL, BLACK }, - { 3, TN(11), TN(2), TN(9), BLACK }, - { 4, TN(6), NULL, TN(8), BLACK }, - { 4, TN(9), NULL, NULL, RED }, - { 5, NULL, TN(6), TN(14), BLACK }, - { 6, TN(14), NULL, NULL, BLACK }, - { 7, TN(11), TN(12), TN(16), BLACK }, - { 8, TN(14), NULL, NULL, BLACK } + { 0, TN( 2 ), NULL, NULL, RED }, + { 1, TN( 6 ), TN( 1 ), NULL, BLACK }, + { 3, TN( 11 ), TN( 2 ), TN( 9 ), BLACK }, + { 4, TN( 6 ), NULL, TN( 8 ), BLACK }, + { 4, TN( 9 ), NULL, NULL, RED }, + { 5, NULL, TN( 6 ), TN( 14 ), BLACK }, + { 6, TN( 14 ), NULL, NULL, BLACK }, + { 7, TN( 11 ), TN( 12 ), TN( 16 ), BLACK }, + { 8, TN( 14 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_unique_20[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 1, TN(0), NULL, NULL, RED }, - { 3, TN(9), TN(0), TN(7), BLACK }, - { 4, TN(7), NULL, NULL, RED }, - { 7, TN(3), TN(4), NULL, BLACK }, - { 9, NULL, TN(3), TN(12), BLACK }, - { 10, TN(12), NULL, NULL, BLACK }, - { 12, TN(9), TN(10), TN(17), BLACK }, - { 14, TN(17), NULL, NULL, BLACK }, - { 17, TN(12), TN(14), TN(18), RED }, - { 18, TN(17), NULL, TN(19), BLACK }, - { 19, TN(18), NULL, NULL, RED } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 1, TN( 0 ), NULL, NULL, RED }, + { 3, TN( 9 ), TN( 0 ), TN( 7 ), BLACK }, + { 4, TN( 7 ), NULL, NULL, RED }, + { 7, TN( 3 ), TN( 4 ), NULL, BLACK }, + { 9, NULL, TN( 3 ), TN( 12 ), BLACK }, + { 10, TN( 12 ), NULL, NULL, BLACK }, + { 12, TN( 9 ), TN( 10 ), TN( 17 ), BLACK }, + { 14, TN( 17 ), NULL, NULL, BLACK }, + { 17, TN( 12 ), TN( 14 ), TN( 18 ), RED }, + { 18, TN( 17 ), NULL, TN( 19 ), BLACK }, + { 19, TN( 18 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_20[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 0, TN(0), NULL, NULL, RED }, - { 1, TN(9), TN(0), TN(7), BLACK }, - { 2, TN(7), NULL, NULL, RED }, - { 3, TN(3), TN(4), NULL, BLACK }, - { 4, NULL, TN(3), TN(14), BLACK }, - { 5, TN(14), NULL, TN(12), BLACK }, - { 6, TN(10), NULL, NULL, RED }, - { 7, TN(9), TN(10), TN(18), BLACK }, - { 8, TN(18), NULL, NULL, RED }, - { 9, TN(14), TN(17), TN(19), BLACK }, - { 9, TN(18), NULL, NULL, RED } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 0, TN( 0 ), NULL, NULL, RED }, + { 1, TN( 9 ), TN( 0 ), TN( 7 ), BLACK }, + { 2, TN( 7 ), NULL, NULL, RED }, + { 3, TN( 3 ), TN( 4 ), NULL, BLACK }, + { 4, NULL, TN( 3 ), TN( 14 ), BLACK }, + { 5, TN( 14 ), NULL, TN( 12 ), BLACK }, + { 6, TN( 10 ), NULL, NULL, RED }, + { 7, TN( 9 ), TN( 10 ), TN( 18 ), BLACK }, + { 8, TN( 18 ), NULL, NULL, RED }, + { 9, TN( 14 ), TN( 17 ), TN( 19 ), BLACK }, + { 9, TN( 18 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_21[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 1, TN(0), NULL, NULL, RED }, - { 3, TN(11), TN(0), TN(5), BLACK }, - { 4, TN(5), NULL, NULL, BLACK }, - { 5, TN(3), TN(4), TN(8), RED }, - { 8, TN(5), NULL, NULL, BLACK }, - { 11, NULL, TN(3), TN(15), BLACK }, - { 13, TN(15), NULL, NULL, BLACK }, - { 15, TN(11), TN(13), TN(17), BLACK }, - { 16, TN(17), NULL, NULL, RED }, - { 17, TN(15), TN(16), NULL, BLACK } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 1, TN( 0 ), NULL, NULL, RED }, + { 3, TN( 11 ), TN( 0 ), TN( 5 ), BLACK }, + { 4, TN( 5 ), NULL, NULL, BLACK }, + { 5, TN( 3 ), TN( 4 ), TN( 8 ), RED }, + { 8, TN( 5 ), NULL, NULL, BLACK }, + { 11, NULL, TN( 3 ), TN( 15 ), BLACK }, + { 13, TN( 15 ), NULL, NULL, BLACK }, + { 15, TN( 11 ), TN( 13 ), TN( 17 ), BLACK }, + { 16, TN( 17 ), NULL, NULL, RED }, + { 17, TN( 15 ), TN( 16 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_21[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 0, TN(0), NULL, NULL, RED }, - { 1, TN(8), TN(0), TN(4), BLACK }, - { 2, TN(3), NULL, TN(5), BLACK }, - { 2, TN(4), NULL, NULL, RED }, - { 4, NULL, TN(3), TN(13), BLACK }, - { 5, TN(13), NULL, NULL, BLACK }, - { 6, TN(8), TN(11), TN(17), BLACK }, - { 7, TN(17), NULL, NULL, BLACK }, - { 8, TN(13), TN(15), TN(16), RED }, - { 8, TN(17), NULL, NULL, BLACK } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 0, TN( 0 ), NULL, NULL, RED }, + { 1, TN( 8 ), TN( 0 ), TN( 4 ), BLACK }, + { 2, TN( 3 ), NULL, TN( 5 ), BLACK }, + { 2, TN( 4 ), NULL, NULL, RED }, + { 4, NULL, TN( 3 ), TN( 13 ), BLACK }, + { 5, TN( 13 ), NULL, NULL, BLACK }, + { 6, TN( 8 ), TN( 11 ), TN( 17 ), BLACK }, + { 7, TN( 17 ), NULL, NULL, BLACK }, + { 8, TN( 13 ), TN( 15 ), TN( 16 ), RED }, + { 8, TN( 17 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_unique_22[] = { - { 1, TN(3), NULL, TN(2), BLACK }, - { 2, TN(1), NULL, NULL, RED }, - { 3, TN(8), TN(1), TN(7), BLACK }, - { 4, TN(7), NULL, NULL, RED }, - { 7, TN(3), TN(4), NULL, BLACK }, - { 8, NULL, TN(3), TN(14), BLACK }, - { 10, TN(11), NULL, NULL, RED }, - { 11, TN(14), TN(10), NULL, BLACK }, - { 14, TN(8), TN(11), TN(18), BLACK }, - { 15, TN(18), NULL, NULL, BLACK }, - { 18, TN(14), TN(15), TN(21), RED }, - { 21, TN(18), NULL, NULL, BLACK } + { 1, TN( 3 ), NULL, TN( 2 ), BLACK }, + { 2, TN( 1 ), NULL, NULL, RED }, + { 3, TN( 8 ), TN( 1 ), TN( 7 ), BLACK }, + { 4, TN( 7 ), NULL, NULL, RED }, + { 7, TN( 3 ), TN( 4 ), NULL, BLACK }, + { 8, NULL, TN( 3 ), TN( 14 ), BLACK }, + { 10, TN( 11 ), NULL, NULL, RED }, + { 11, TN( 14 ), TN( 10 ), NULL, BLACK }, + { 14, TN( 8 ), TN( 11 ), TN( 18 ), BLACK }, + { 15, TN( 18 ), NULL, NULL, BLACK }, + { 18, TN( 14 ), TN( 15 ), TN( 21 ), RED }, + { 21, TN( 18 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_22[] = { - { 0, TN(3), NULL, NULL, BLACK }, - { 1, TN(8), TN(1), TN(4), BLACK }, - { 1, TN(4), NULL, NULL, BLACK }, - { 2, TN(3), TN(2), TN(7), RED }, - { 3, TN(4), NULL, NULL, BLACK }, - { 4, NULL, TN(3), TN(14), BLACK }, - { 5, TN(14), NULL, TN(10), BLACK }, - { 5, TN(11), NULL, NULL, RED }, - { 7, TN(8), TN(11), TN(18), BLACK }, - { 7, TN(18), NULL, NULL, BLACK }, - { 9, TN(14), TN(15), TN(21), RED }, - { 10, TN(18), NULL, NULL, BLACK } + { 0, TN( 3 ), NULL, NULL, BLACK }, + { 1, TN( 8 ), TN( 1 ), TN( 4 ), BLACK }, + { 1, TN( 4 ), NULL, NULL, BLACK }, + { 2, TN( 3 ), TN( 2 ), TN( 7 ), RED }, + { 3, TN( 4 ), NULL, NULL, BLACK }, + { 4, NULL, TN( 3 ), TN( 14 ), BLACK }, + { 5, TN( 14 ), NULL, TN( 10 ), BLACK }, + { 5, TN( 11 ), NULL, NULL, RED }, + { 7, TN( 8 ), TN( 11 ), TN( 18 ), BLACK }, + { 7, TN( 18 ), NULL, NULL, BLACK }, + { 9, TN( 14 ), TN( 15 ), TN( 21 ), RED }, + { 10, TN( 18 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_unique_23[] = { - { 0, TN(2), NULL, NULL, RED }, - { 2, TN(8), TN(0), TN(7), BLACK }, - { 7, TN(2), NULL, NULL, RED }, - { 8, TN(12), TN(2), TN(11), BLACK }, - { 11, TN(8), NULL, NULL, BLACK }, - { 12, NULL, TN(8), TN(17), BLACK }, - { 13, TN(15), NULL, TN(14), BLACK }, - { 14, TN(13), NULL, NULL, RED }, - { 15, TN(17), TN(13), TN(16), RED }, - { 16, TN(15), NULL, NULL, BLACK }, - { 17, TN(12), TN(15), TN(20), BLACK }, - { 20, TN(17), NULL, TN(21), BLACK }, - { 21, TN(20), NULL, NULL, RED } + { 0, TN( 2 ), NULL, NULL, RED }, + { 2, TN( 8 ), TN( 0 ), TN( 7 ), BLACK }, + { 7, TN( 2 ), NULL, NULL, RED }, + { 8, TN( 12 ), TN( 2 ), TN( 11 ), BLACK }, + { 11, TN( 8 ), NULL, NULL, BLACK }, + { 12, NULL, TN( 8 ), TN( 17 ), BLACK }, + { 13, TN( 15 ), NULL, TN( 14 ), BLACK }, + { 14, TN( 13 ), NULL, NULL, RED }, + { 15, TN( 17 ), TN( 13 ), TN( 16 ), RED }, + { 16, TN( 15 ), NULL, NULL, BLACK }, + { 17, TN( 12 ), TN( 15 ), TN( 20 ), BLACK }, + { 20, TN( 17 ), NULL, TN( 21 ), BLACK }, + { 21, TN( 20 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_23[] = { - { 0, TN(2), NULL, NULL, RED }, - { 1, TN(8), TN(0), TN(7), BLACK }, - { 3, TN(2), NULL, NULL, RED }, - { 4, TN(12), TN(2), TN(11), BLACK }, - { 5, TN(8), NULL, NULL, BLACK }, - { 6, NULL, TN(8), TN(17), BLACK }, - { 6, TN(15), NULL, NULL, BLACK }, - { 7, TN(17), TN(13), TN(16), RED }, - { 7, TN(16), NULL, NULL, RED }, - { 8, TN(15), TN(14), NULL, BLACK }, - { 8, TN(12), TN(15), TN(20), BLACK }, - { 10, TN(17), NULL, TN(21), BLACK }, - { 10, TN(20), NULL, NULL, RED } + { 0, TN( 2 ), NULL, NULL, RED }, + { 1, TN( 8 ), TN( 0 ), TN( 7 ), BLACK }, + { 3, TN( 2 ), NULL, NULL, RED }, + { 4, TN( 12 ), TN( 2 ), TN( 11 ), BLACK }, + { 5, TN( 8 ), NULL, NULL, BLACK }, + { 6, NULL, TN( 8 ), TN( 17 ), BLACK }, + { 6, TN( 15 ), NULL, NULL, BLACK }, + { 7, TN( 17 ), TN( 13 ), TN( 16 ), RED }, + { 7, TN( 16 ), NULL, NULL, RED }, + { 8, TN( 15 ), TN( 14 ), NULL, BLACK }, + { 8, TN( 12 ), TN( 15 ), TN( 20 ), BLACK }, + { 10, TN( 17 ), NULL, TN( 21 ), BLACK }, + { 10, TN( 20 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_24[] = { - { 4, TN(6), NULL, TN(5), BLACK }, - { 5, TN(4), NULL, NULL, RED }, - { 6, TN(14), TN(4), TN(10), BLACK }, - { 8, TN(10), NULL, NULL, RED }, - { 10, TN(6), TN(8), NULL, BLACK }, - { 14, NULL, TN(6), TN(20), BLACK }, - { 15, TN(16), NULL, NULL, RED }, - { 16, TN(20), TN(15), NULL, BLACK }, - { 20, TN(14), TN(16), TN(22), BLACK }, - { 22, TN(20), NULL, NULL, BLACK } + { 4, TN( 6 ), NULL, TN( 5 ), BLACK }, + { 5, TN( 4 ), NULL, NULL, RED }, + { 6, TN( 14 ), TN( 4 ), TN( 10 ), BLACK }, + { 8, TN( 10 ), NULL, NULL, RED }, + { 10, TN( 6 ), TN( 8 ), NULL, BLACK }, + { 14, NULL, TN( 6 ), TN( 20 ), BLACK }, + { 15, TN( 16 ), NULL, NULL, RED }, + { 16, TN( 20 ), TN( 15 ), NULL, BLACK }, + { 20, TN( 14 ), TN( 16 ), TN( 22 ), BLACK }, + { 22, TN( 20 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_24[] = { - { 2, TN(6), NULL, TN(5), BLACK }, - { 2, TN(4), NULL, NULL, RED }, - { 3, TN(14), TN(4), TN(10), BLACK }, - { 4, TN(10), NULL, NULL, RED }, - { 5, TN(6), TN(8), NULL, BLACK }, - { 7, NULL, TN(6), TN(20), BLACK }, - { 7, TN(16), NULL, NULL, RED }, - { 8, TN(20), TN(15), NULL, BLACK }, - { 10, TN(14), TN(16), TN(22), BLACK }, - { 11, TN(20), NULL, NULL, BLACK } + { 2, TN( 6 ), NULL, TN( 5 ), BLACK }, + { 2, TN( 4 ), NULL, NULL, RED }, + { 3, TN( 14 ), TN( 4 ), TN( 10 ), BLACK }, + { 4, TN( 10 ), NULL, NULL, RED }, + { 5, TN( 6 ), TN( 8 ), NULL, BLACK }, + { 7, NULL, TN( 6 ), TN( 20 ), BLACK }, + { 7, TN( 16 ), NULL, NULL, RED }, + { 8, TN( 20 ), TN( 15 ), NULL, BLACK }, + { 10, TN( 14 ), TN( 16 ), TN( 22 ), BLACK }, + { 11, TN( 20 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_unique_25[] = { - { 0, TN(1), NULL, NULL, RED }, - { 1, TN(3), TN(0), NULL, BLACK }, - { 3, TN(13), TN(1), TN(5), BLACK }, - { 4, TN(5), NULL, NULL, BLACK }, - { 5, TN(3), TN(4), TN(6), RED }, - { 6, TN(5), NULL, TN(9), BLACK }, - { 9, TN(6), NULL, NULL, RED }, - { 13, NULL, TN(3), TN(19), BLACK }, - { 14, TN(15), NULL, NULL, RED }, - { 15, TN(16), TN(14), NULL, BLACK }, - { 16, TN(19), TN(15), TN(17), RED }, - { 17, TN(16), NULL, NULL, BLACK }, - { 19, TN(13), TN(16), TN(23), BLACK }, - { 23, TN(19), NULL, TN(24), BLACK }, - { 24, TN(23), NULL, NULL, RED } + { 0, TN( 1 ), NULL, NULL, RED }, + { 1, TN( 3 ), TN( 0 ), NULL, BLACK }, + { 3, TN( 13 ), TN( 1 ), TN( 5 ), BLACK }, + { 4, TN( 5 ), NULL, NULL, BLACK }, + { 5, TN( 3 ), TN( 4 ), TN( 6 ), RED }, + { 6, TN( 5 ), NULL, TN( 9 ), BLACK }, + { 9, TN( 6 ), NULL, NULL, RED }, + { 13, NULL, TN( 3 ), TN( 19 ), BLACK }, + { 14, TN( 15 ), NULL, NULL, RED }, + { 15, TN( 16 ), TN( 14 ), NULL, BLACK }, + { 16, TN( 19 ), TN( 15 ), TN( 17 ), RED }, + { 17, TN( 16 ), NULL, NULL, BLACK }, + { 19, TN( 13 ), TN( 16 ), TN( 23 ), BLACK }, + { 23, TN( 19 ), NULL, TN( 24 ), BLACK }, + { 24, TN( 23 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_25[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 0, TN(0), NULL, NULL, RED }, - { 1, TN(13), TN(0), TN(4), BLACK }, - { 2, TN(4), NULL, NULL, BLACK }, - { 2, TN(3), TN(5), TN(6), RED }, - { 3, TN(4), NULL, TN(9), BLACK }, - { 4, TN(6), NULL, NULL, RED }, - { 6, NULL, TN(3), TN(19), BLACK }, - { 7, TN(17), NULL, TN(14), BLACK }, - { 7, TN(15), NULL, NULL, RED }, - { 8, TN(19), TN(15), TN(16), RED }, - { 8, TN(17), NULL, NULL, BLACK }, - { 9, TN(13), TN(17), TN(23), BLACK }, - { 11, TN(19), NULL, TN(24), BLACK }, - { 12, TN(23), NULL, NULL, RED } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 0, TN( 0 ), NULL, NULL, RED }, + { 1, TN( 13 ), TN( 0 ), TN( 4 ), BLACK }, + { 2, TN( 4 ), NULL, NULL, BLACK }, + { 2, TN( 3 ), TN( 5 ), TN( 6 ), RED }, + { 3, TN( 4 ), NULL, TN( 9 ), BLACK }, + { 4, TN( 6 ), NULL, NULL, RED }, + { 6, NULL, TN( 3 ), TN( 19 ), BLACK }, + { 7, TN( 17 ), NULL, TN( 14 ), BLACK }, + { 7, TN( 15 ), NULL, NULL, RED }, + { 8, TN( 19 ), TN( 15 ), TN( 16 ), RED }, + { 8, TN( 17 ), NULL, NULL, BLACK }, + { 9, TN( 13 ), TN( 17 ), TN( 23 ), BLACK }, + { 11, TN( 19 ), NULL, TN( 24 ), BLACK }, + { 12, TN( 23 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_26[] = { - { 0, TN(1), NULL, NULL, RED }, - { 1, TN(3), TN(0), NULL, BLACK }, - { 3, TN(11), TN(1), TN(9), BLACK }, - { 6, TN(9), NULL, NULL, RED }, - { 9, TN(3), TN(6), TN(10), BLACK }, - { 10, TN(9), NULL, NULL, RED }, - { 11, NULL, TN(3), TN(14), BLACK }, - { 12, TN(14), NULL, TN(13), BLACK }, - { 13, TN(12), NULL, NULL, RED }, - { 14, TN(11), TN(12), TN(20), BLACK }, - { 18, TN(20), NULL, NULL, BLACK }, - { 20, TN(14), TN(18), TN(23), RED }, - { 21, TN(23), NULL, NULL, RED }, - { 23, TN(20), TN(21), NULL, BLACK } + { 0, TN( 1 ), NULL, NULL, RED }, + { 1, TN( 3 ), TN( 0 ), NULL, BLACK }, + { 3, TN( 11 ), TN( 1 ), TN( 9 ), BLACK }, + { 6, TN( 9 ), NULL, NULL, RED }, + { 9, TN( 3 ), TN( 6 ), TN( 10 ), BLACK }, + { 10, TN( 9 ), NULL, NULL, RED }, + { 11, NULL, TN( 3 ), TN( 14 ), BLACK }, + { 12, TN( 14 ), NULL, TN( 13 ), BLACK }, + { 13, TN( 12 ), NULL, NULL, RED }, + { 14, TN( 11 ), TN( 12 ), TN( 20 ), BLACK }, + { 18, TN( 20 ), NULL, NULL, BLACK }, + { 20, TN( 14 ), TN( 18 ), TN( 23 ), RED }, + { 21, TN( 23 ), NULL, NULL, RED }, + { 23, TN( 20 ), TN( 21 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_26[] = { - { 0, TN(3), NULL, TN(0), BLACK }, - { 0, TN(1), NULL, NULL, RED }, - { 1, TN(9), TN(1), TN(6), BLACK }, - { 3, TN(3), NULL, NULL, BLACK }, - { 4, NULL, TN(3), TN(14), BLACK }, - { 5, TN(12), NULL, TN(10), BLACK }, - { 5, TN(11), NULL, NULL, RED }, - { 6, TN(14), TN(11), TN(13), RED }, - { 6, TN(12), NULL, NULL, BLACK }, - { 7, TN(9), TN(12), TN(20), BLACK }, - { 9, TN(20), NULL, NULL, BLACK }, - { 10, TN(14), TN(18), TN(23), RED }, - { 10, TN(23), NULL, NULL, RED }, - { 11, TN(20), TN(21), NULL, BLACK } + { 0, TN( 3 ), NULL, TN( 0 ), BLACK }, + { 0, TN( 1 ), NULL, NULL, RED }, + { 1, TN( 9 ), TN( 1 ), TN( 6 ), BLACK }, + { 3, TN( 3 ), NULL, NULL, BLACK }, + { 4, NULL, TN( 3 ), TN( 14 ), BLACK }, + { 5, TN( 12 ), NULL, TN( 10 ), BLACK }, + { 5, TN( 11 ), NULL, NULL, RED }, + { 6, TN( 14 ), TN( 11 ), TN( 13 ), RED }, + { 6, TN( 12 ), NULL, NULL, BLACK }, + { 7, TN( 9 ), TN( 12 ), TN( 20 ), BLACK }, + { 9, TN( 20 ), NULL, NULL, BLACK }, + { 10, TN( 14 ), TN( 18 ), TN( 23 ), RED }, + { 10, TN( 23 ), NULL, NULL, RED }, + { 11, TN( 20 ), TN( 21 ), NULL, BLACK } }; static const test_node_description random_ops_tree_unique_27[] = { - { 3, TN(8), NULL, NULL, BLACK }, - { 8, TN(19), TN(3), TN(17), BLACK }, - { 12, TN(17), NULL, NULL, RED }, - { 17, TN(8), TN(12), NULL, BLACK }, - { 19, NULL, TN(8), TN(24), BLACK }, - { 20, TN(21), NULL, NULL, RED }, - { 21, TN(24), TN(20), TN(23), BLACK }, - { 23, TN(21), NULL, NULL, RED }, - { 24, TN(19), TN(21), TN(25), BLACK }, - { 25, TN(24), NULL, TN(26), BLACK }, - { 26, TN(25), NULL, NULL, RED } + { 3, TN( 8 ), NULL, NULL, BLACK }, + { 8, TN( 19 ), TN( 3 ), TN( 17 ), BLACK }, + { 12, TN( 17 ), NULL, NULL, RED }, + { 17, TN( 8 ), TN( 12 ), NULL, BLACK }, + { 19, NULL, TN( 8 ), TN( 24 ), BLACK }, + { 20, TN( 21 ), NULL, NULL, RED }, + { 21, TN( 24 ), TN( 20 ), TN( 23 ), BLACK }, + { 23, TN( 21 ), NULL, NULL, RED }, + { 24, TN( 19 ), TN( 21 ), TN( 25 ), BLACK }, + { 25, TN( 24 ), NULL, TN( 26 ), BLACK }, + { 26, TN( 25 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_27[] = { - { 1, TN(8), NULL, NULL, BLACK }, - { 4, TN(19), TN(3), TN(17), BLACK }, - { 6, TN(17), NULL, NULL, RED }, - { 8, TN(8), TN(12), NULL, BLACK }, - { 9, NULL, TN(8), TN(25), BLACK }, - { 10, TN(21), NULL, NULL, RED }, - { 10, TN(25), TN(20), TN(23), BLACK }, - { 11, TN(21), NULL, NULL, RED }, - { 12, TN(19), TN(21), TN(24), BLACK }, - { 12, TN(25), NULL, TN(26), BLACK }, - { 13, TN(24), NULL, NULL, RED } + { 1, TN( 8 ), NULL, NULL, BLACK }, + { 4, TN( 19 ), TN( 3 ), TN( 17 ), BLACK }, + { 6, TN( 17 ), NULL, NULL, RED }, + { 8, TN( 8 ), TN( 12 ), NULL, BLACK }, + { 9, NULL, TN( 8 ), TN( 25 ), BLACK }, + { 10, TN( 21 ), NULL, NULL, RED }, + { 10, TN( 25 ), TN( 20 ), TN( 23 ), BLACK }, + { 11, TN( 21 ), NULL, NULL, RED }, + { 12, TN( 19 ), TN( 21 ), TN( 24 ), BLACK }, + { 12, TN( 25 ), NULL, TN( 26 ), BLACK }, + { 13, TN( 24 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_28[] = { - { 0, TN(5), NULL, NULL, BLACK }, - { 5, TN(13), TN(0), TN(7), RED }, - { 7, TN(5), NULL, NULL, BLACK }, - { 13, NULL, TN(5), TN(17), BLACK }, - { 15, TN(17), NULL, NULL, BLACK }, - { 17, TN(13), TN(15), TN(26), RED }, - { 21, TN(26), NULL, NULL, RED }, - { 26, TN(17), TN(21), NULL, BLACK } + { 0, TN( 5 ), NULL, NULL, BLACK }, + { 5, TN( 13 ), TN( 0 ), TN( 7 ), RED }, + { 7, TN( 5 ), NULL, NULL, BLACK }, + { 13, NULL, TN( 5 ), TN( 17 ), BLACK }, + { 15, TN( 17 ), NULL, NULL, BLACK }, + { 17, TN( 13 ), TN( 15 ), TN( 26 ), RED }, + { 21, TN( 26 ), NULL, NULL, RED }, + { 26, TN( 17 ), TN( 21 ), NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_28[] = { - { 0, TN(5), NULL, NULL, BLACK }, - { 2, TN(13), TN(0), TN(7), RED }, - { 3, TN(5), NULL, NULL, BLACK }, - { 6, NULL, TN(5), TN(17), BLACK }, - { 7, TN(17), NULL, NULL, BLACK }, - { 8, TN(13), TN(15), TN(26), RED }, - { 10, TN(26), NULL, NULL, RED }, - { 13, TN(17), TN(21), NULL, BLACK } + { 0, TN( 5 ), NULL, NULL, BLACK }, + { 2, TN( 13 ), TN( 0 ), TN( 7 ), RED }, + { 3, TN( 5 ), NULL, NULL, BLACK }, + { 6, NULL, TN( 5 ), TN( 17 ), BLACK }, + { 7, TN( 17 ), NULL, NULL, BLACK }, + { 8, TN( 13 ), TN( 15 ), TN( 26 ), RED }, + { 10, TN( 26 ), NULL, NULL, RED }, + { 13, TN( 17 ), TN( 21 ), NULL, BLACK } }; static const test_node_description random_ops_tree_unique_29[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 1, TN(0), NULL, NULL, RED }, - { 3, TN(12), TN(0), TN(6), BLACK }, - { 4, TN(6), NULL, NULL, BLACK }, - { 6, TN(3), TN(4), TN(8), RED }, - { 7, TN(8), NULL, NULL, RED }, - { 8, TN(6), TN(7), TN(11), BLACK }, - { 11, TN(8), NULL, NULL, RED }, - { 12, NULL, TN(3), TN(17), BLACK }, - { 13, TN(17), NULL, TN(14), BLACK }, - { 14, TN(13), NULL, NULL, RED }, - { 17, TN(12), TN(13), TN(25), BLACK }, - { 22, TN(25), NULL, NULL, RED }, - { 25, TN(17), TN(22), TN(27), BLACK }, - { 27, TN(25), NULL, NULL, RED } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 1, TN( 0 ), NULL, NULL, RED }, + { 3, TN( 12 ), TN( 0 ), TN( 6 ), BLACK }, + { 4, TN( 6 ), NULL, NULL, BLACK }, + { 6, TN( 3 ), TN( 4 ), TN( 8 ), RED }, + { 7, TN( 8 ), NULL, NULL, RED }, + { 8, TN( 6 ), TN( 7 ), TN( 11 ), BLACK }, + { 11, TN( 8 ), NULL, NULL, RED }, + { 12, NULL, TN( 3 ), TN( 17 ), BLACK }, + { 13, TN( 17 ), NULL, TN( 14 ), BLACK }, + { 14, TN( 13 ), NULL, NULL, RED }, + { 17, TN( 12 ), TN( 13 ), TN( 25 ), BLACK }, + { 22, TN( 25 ), NULL, NULL, RED }, + { 25, TN( 17 ), TN( 22 ), TN( 27 ), BLACK }, + { 27, TN( 25 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_29[] = { - { 0, TN(3), NULL, TN(1), BLACK }, - { 0, TN(0), NULL, NULL, RED }, - { 1, TN(11), TN(0), TN(6), BLACK }, - { 2, TN(6), NULL, NULL, BLACK }, - { 3, TN(3), TN(4), TN(7), RED }, - { 3, TN(6), NULL, TN(8), BLACK }, - { 4, TN(7), NULL, NULL, RED }, - { 5, NULL, TN(3), TN(22), BLACK }, - { 6, TN(12), NULL, NULL, BLACK }, - { 6, TN(22), TN(13), TN(17), RED }, - { 7, TN(17), NULL, NULL, RED }, - { 8, TN(12), TN(14), NULL, BLACK }, - { 11, TN(11), TN(12), TN(25), BLACK }, - { 12, TN(22), NULL, TN(27), BLACK }, - { 13, TN(25), NULL, NULL, RED } + { 0, TN( 3 ), NULL, TN( 1 ), BLACK }, + { 0, TN( 0 ), NULL, NULL, RED }, + { 1, TN( 11 ), TN( 0 ), TN( 6 ), BLACK }, + { 2, TN( 6 ), NULL, NULL, BLACK }, + { 3, TN( 3 ), TN( 4 ), TN( 7 ), RED }, + { 3, TN( 6 ), NULL, TN( 8 ), BLACK }, + { 4, TN( 7 ), NULL, NULL, RED }, + { 5, NULL, TN( 3 ), TN( 22 ), BLACK }, + { 6, TN( 12 ), NULL, NULL, BLACK }, + { 6, TN( 22 ), TN( 13 ), TN( 17 ), RED }, + { 7, TN( 17 ), NULL, NULL, RED }, + { 8, TN( 12 ), TN( 14 ), NULL, BLACK }, + { 11, TN( 11 ), TN( 12 ), TN( 25 ), BLACK }, + { 12, TN( 22 ), NULL, TN( 27 ), BLACK }, + { 13, TN( 25 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_30[] = { - { 0, TN(4), NULL, NULL, RED }, - { 4, TN(6), TN(0), NULL, BLACK }, - { 6, TN(13), TN(4), TN(9), RED }, - { 8, TN(9), NULL, NULL, RED }, - { 9, TN(6), TN(8), TN(12), BLACK }, - { 12, TN(9), NULL, NULL, RED }, - { 13, NULL, TN(6), TN(18), BLACK }, - { 14, TN(16), NULL, NULL, RED }, - { 16, TN(18), TN(14), TN(17), BLACK }, - { 17, TN(16), NULL, NULL, RED }, - { 18, TN(13), TN(16), TN(27), RED }, - { 20, TN(27), NULL, NULL, RED }, - { 27, TN(18), TN(20), TN(28), BLACK }, - { 28, TN(27), NULL, NULL, RED } + { 0, TN( 4 ), NULL, NULL, RED }, + { 4, TN( 6 ), TN( 0 ), NULL, BLACK }, + { 6, TN( 13 ), TN( 4 ), TN( 9 ), RED }, + { 8, TN( 9 ), NULL, NULL, RED }, + { 9, TN( 6 ), TN( 8 ), TN( 12 ), BLACK }, + { 12, TN( 9 ), NULL, NULL, RED }, + { 13, NULL, TN( 6 ), TN( 18 ), BLACK }, + { 14, TN( 16 ), NULL, NULL, RED }, + { 16, TN( 18 ), TN( 14 ), TN( 17 ), BLACK }, + { 17, TN( 16 ), NULL, NULL, RED }, + { 18, TN( 13 ), TN( 16 ), TN( 27 ), RED }, + { 20, TN( 27 ), NULL, NULL, RED }, + { 27, TN( 18 ), TN( 20 ), TN( 28 ), BLACK }, + { 28, TN( 27 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_multiple_30[] = { - { 0, TN(4), NULL, NULL, BLACK }, - { 2, TN(13), TN(0), TN(9), RED }, - { 3, TN(9), NULL, NULL, RED }, - { 4, TN(4), TN(6), TN(8), BLACK }, - { 4, TN(9), NULL, NULL, RED }, - { 6, TN(14), TN(4), TN(12), BLACK }, - { 6, TN(13), NULL, NULL, BLACK }, - { 7, NULL, TN(13), TN(18), BLACK }, - { 8, TN(18), NULL, TN(16), BLACK }, - { 8, TN(17), NULL, NULL, RED }, - { 9, TN(14), TN(17), TN(27), BLACK }, - { 10, TN(27), NULL, NULL, RED }, - { 13, TN(18), TN(20), TN(28), BLACK }, - { 14, TN(27), NULL, NULL, RED } + { 0, TN( 4 ), NULL, NULL, BLACK }, + { 2, TN( 13 ), TN( 0 ), TN( 9 ), RED }, + { 3, TN( 9 ), NULL, NULL, RED }, + { 4, TN( 4 ), TN( 6 ), TN( 8 ), BLACK }, + { 4, TN( 9 ), NULL, NULL, RED }, + { 6, TN( 14 ), TN( 4 ), TN( 12 ), BLACK }, + { 6, TN( 13 ), NULL, NULL, BLACK }, + { 7, NULL, TN( 13 ), TN( 18 ), BLACK }, + { 8, TN( 18 ), NULL, TN( 16 ), BLACK }, + { 8, TN( 17 ), NULL, NULL, RED }, + { 9, TN( 14 ), TN( 17 ), TN( 27 ), BLACK }, + { 10, TN( 27 ), NULL, NULL, RED }, + { 13, TN( 18 ), TN( 20 ), TN( 28 ), BLACK }, + { 14, TN( 27 ), NULL, NULL, RED } }; static const test_node_description random_ops_tree_unique_31[] = { - { 0, TN(2), NULL, NULL, RED }, - { 2, TN(5), TN(0), NULL, BLACK }, - { 5, TN(11), TN(2), TN(9), BLACK }, - { 7, TN(9), NULL, NULL, RED }, - { 9, TN(5), TN(7), NULL, BLACK }, - { 11, NULL, TN(5), TN(21), BLACK }, - { 14, TN(16), NULL, NULL, RED }, - { 16, TN(21), TN(14), TN(18), BLACK }, - { 18, TN(16), NULL, NULL, RED }, - { 21, TN(11), TN(16), TN(30), BLACK }, - { 30, TN(21), NULL, NULL, BLACK } + { 0, TN( 2 ), NULL, NULL, RED }, + { 2, TN( 5 ), TN( 0 ), NULL, BLACK }, + { 5, TN( 11 ), TN( 2 ), TN( 9 ), BLACK }, + { 7, TN( 9 ), NULL, NULL, RED }, + { 9, TN( 5 ), TN( 7 ), NULL, BLACK }, + { 11, NULL, TN( 5 ), TN( 21 ), BLACK }, + { 14, TN( 16 ), NULL, NULL, RED }, + { 16, TN( 21 ), TN( 14 ), TN( 18 ), BLACK }, + { 18, TN( 16 ), NULL, NULL, RED }, + { 21, TN( 11 ), TN( 16 ), TN( 30 ), BLACK }, + { 30, TN( 21 ), NULL, NULL, BLACK } }; static const test_node_description random_ops_tree_multiple_31[] = { - { 0, TN(2), NULL, NULL, RED }, - { 1, TN(5), TN(0), NULL, BLACK }, - { 2, TN(11), TN(2), TN(9), BLACK }, - { 3, TN(9), NULL, NULL, RED }, - { 4, TN(5), TN(7), NULL, BLACK }, - { 5, NULL, TN(5), TN(21), BLACK }, - { 7, TN(16), NULL, NULL, RED }, - { 8, TN(21), TN(14), TN(18), BLACK }, - { 9, TN(16), NULL, NULL, RED }, - { 10, TN(11), TN(16), TN(30), BLACK }, - { 15, TN(21), NULL, NULL, BLACK } + { 0, TN( 2 ), NULL, NULL, RED }, + { 1, TN( 5 ), TN( 0 ), NULL, BLACK }, + { 2, TN( 11 ), TN( 2 ), TN( 9 ), BLACK }, + { 3, TN( 9 ), NULL, NULL, RED }, + { 4, TN( 5 ), TN( 7 ), NULL, BLACK }, + { 5, NULL, TN( 5 ), TN( 21 ), BLACK }, + { 7, TN( 16 ), NULL, NULL, RED }, + { 8, TN( 21 ), TN( 14 ), TN( 18 ), BLACK }, + { 9, TN( 16 ), NULL, NULL, RED }, + { 10, TN( 11 ), TN( 16 ), TN( 30 ), BLACK }, + { 15, TN( 21 ), NULL, NULL, BLACK } }; #define RANDOM_OPS_TREE( i ) \ - { &random_ops_tree_multiple_ ## i[ 0 ], &random_ops_tree_unique_ ## i[ 0 ] } + { &random_ops_tree_multiple_##i[ 0 ], &random_ops_tree_unique_##i[ 0 ] } -static const test_node_description *const random_ops_trees[][2] = { +static const test_node_description *const random_ops_trees[][ 2 ] = { RANDOM_OPS_TREE( 1 ), RANDOM_OPS_TREE( 2 ), RANDOM_OPS_TREE( 3 ), @@ -1674,13 +1690,11 @@ static const test_node_description *const random_ops_trees[][2] = { RANDOM_OPS_TREE( 31 ) }; -#define RANDOM_OPS_TREE_COUNT( i ) \ - { \ - RTEMS_ARRAY_SIZE( random_ops_tree_multiple_ ## i ), \ - RTEMS_ARRAY_SIZE( random_ops_tree_unique_ ## i ) \ - } +#define RANDOM_OPS_TREE_COUNT( i ) \ + { RTEMS_ARRAY_SIZE( random_ops_tree_multiple_##i ), \ + RTEMS_ARRAY_SIZE( random_ops_tree_unique_##i ) } -static const size_t random_ops_tree_counts[][2] = { +static const size_t random_ops_tree_counts[][ 2 ] = { RANDOM_OPS_TREE_COUNT( 1 ), RANDOM_OPS_TREE_COUNT( 2 ), RANDOM_OPS_TREE_COUNT( 3 ), @@ -1730,11 +1744,11 @@ static void random_ops( size_t n, bool unique ) random_ops_trees[ n - 1 ][ unique ] }; rtems_rbtree_control tree; - test_node *nodes = &node_array[ 0 ]; - size_t m = n * n * n; - size_t s = unique ? 1 : 2; - uint32_t v = 0xdeadbeef; - size_t i; + test_node *nodes = &node_array[ 0 ]; + size_t m = n * n * n; + size_t s = unique ? 1 : 2; + uint32_t v = 0xdeadbeef; + size_t i; rtems_rbtree_initialize_empty( &tree ); @@ -1745,7 +1759,7 @@ static void random_ops( size_t n, bool unique ) } for ( i = 0; i < m; ++i ) { - size_t j = ( v >> 13 ) % n; + size_t j = ( v >> 13 ) % n; test_node *tn = &nodes[ j ]; if ( tn->id == 0 ) { @@ -1918,9 +1932,9 @@ static void postorder_tree_init( const postorder_node_description *pnd; pnd = &pt->tree[ i ]; - RTEMS_RB_PARENT( TN( i ), Node) = pnd->parent; - RTEMS_RB_LEFT( TN( i ), Node) = pnd->left; - RTEMS_RB_RIGHT( TN( i ), Node) = pnd->right; + RTEMS_RB_PARENT( TN( i ), Node ) = pnd->parent; + RTEMS_RB_LEFT( TN( i ), Node ) = pnd->left; + RTEMS_RB_RIGHT( TN( i ), Node ) = pnd->right; } } @@ -1931,7 +1945,7 @@ static void postorder_tree_check( { test_node *node; test_node *next; - size_t i; + size_t i; node = _RBTree_Postorder_first( tree, offsetof( test_node, Node ) ); @@ -1945,7 +1959,8 @@ static void postorder_tree_check( i = 0; next = NULL; - rbtree_postorder_for_each_entry_safe( node, next, tree, Node ) { + rbtree_postorder_for_each_entry_safe( node, next, tree, Node ) + { rtems_test_assert( node == &node_array[ i ] ); if ( i < pt->node_count - 1 ) { @@ -1982,12 +1997,12 @@ rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_rbtree_control rbtree1; - rtems_rbtree_node *p; + rtems_rbtree_control rbtree1; + rtems_rbtree_node *p; test_node node1, node2; test_node search_node; int id; - int i; + int i; TEST_BEGIN(); @@ -2008,84 +2023,91 @@ rtems_task Init( rtems_task_argument ignored ) rtems_test_assert( !rtems_rbtree_is_node_off_tree( &node1.Node ) ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } - for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 1; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 2 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if (id < 2) { - puts("INIT - NOT ENOUGH NODES ON RBTREE"); - rtems_test_exit(0); + if ( id < 2 ) { + puts( "INIT - NOT ENOUGH NODES ON RBTREE" ); + rtems_test_exit( 0 ); } - puts("INIT - Verify rtems_rbtree_insert with the same value twice"); + puts( "INIT - Verify rtems_rbtree_insert with the same value twice" ); node2.key = node1.key; - rb_insert_unique(&rbtree1, &node1.Node); - p = rb_insert_unique(&rbtree1, &node2.Node); + rb_insert_unique( &rbtree1, &node1.Node ); + p = rb_insert_unique( &rbtree1, &node2.Node ); - if (p != &node1.Node) + if ( p != &node1.Node ) { puts( "INIT - FAILED DUPLICATE INSERT" ); + } - for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 1; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 1 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if (id < 1) { - puts("INIT - NOT ENOUGH NODES ON RBTREE"); - rtems_test_exit(0); + if ( id < 1 ) { + puts( "INIT - NOT ENOUGH NODES ON RBTREE" ); + rtems_test_exit( 0 ); } node2.key = 2; /* verify that the rbtree is empty */ puts( "INIT - Verify rtems_rbtree_is_empty" ); - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "INIT - Verify rtems_XXX on an empty tree" ); - if(rtems_rbtree_get_min(&rbtree1)) { - puts("INIT - get_min on empty returned non-NULL"); - rtems_test_exit(0); + if ( rtems_rbtree_get_min( &rbtree1 ) ) { + puts( "INIT - get_min on empty returned non-NULL" ); + rtems_test_exit( 0 ); } - if(rtems_rbtree_get_max(&rbtree1)) { - puts("INIT - get_max on empty returned non-NULL"); - rtems_test_exit(0); + if ( rtems_rbtree_get_max( &rbtree1 ) ) { + puts( "INIT - get_max on empty returned non-NULL" ); + rtems_test_exit( 0 ); } - if(rtems_rbtree_peek_min(&rbtree1)) { - puts("INIT - peek_min on empty returned non-NULL"); - rtems_test_exit(0); + if ( rtems_rbtree_peek_min( &rbtree1 ) ) { + puts( "INIT - peek_min on empty returned non-NULL" ); + rtems_test_exit( 0 ); } - if(rtems_rbtree_peek_max(&rbtree1)) { - puts("INIT - peek_max on empty returned non-NULL"); - rtems_test_exit(0); + if ( rtems_rbtree_peek_max( &rbtree1 ) ) { + puts( "INIT - peek_max on empty returned non-NULL" ); + rtems_test_exit( 0 ); } - /* verify that the rbtree insert works after a tree is emptied */ puts( "INIT - Verify rtems_rbtree_insert after empty tree" ); node1.id = 2; @@ -2096,130 +2118,150 @@ rtems_task Init( rtems_task_argument ignored ) rb_insert_unique( &rbtree1, &node2.Node ); puts( "INIT - Verify rtems_rbtree_peek_max/min, rtems_rbtree_extract" ); - test_node *t1 = RTEMS_CONTAINER_OF(rtems_rbtree_peek_max(&rbtree1), - test_node,Node); - test_node *t2 = RTEMS_CONTAINER_OF(rtems_rbtree_peek_min(&rbtree1), - test_node,Node); - if (t1->key - t2->key != 1) { + test_node *t1 = RTEMS_CONTAINER_OF( + rtems_rbtree_peek_max( &rbtree1 ), + test_node, + Node + ); + test_node *t2 = RTEMS_CONTAINER_OF( + rtems_rbtree_peek_min( &rbtree1 ), + test_node, + Node + ); + if ( t1->key - t2->key != 1 ) { puts( "INIT - Peek Min - Max failed" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - p = rtems_rbtree_peek_max(&rbtree1); - rtems_rbtree_extract(&rbtree1, p); - t1 = RTEMS_CONTAINER_OF(p,test_node,Node); - if (t1->key != 2) { - puts( "INIT - rtems_rbtree_extract failed"); - rtems_test_exit(0); + p = rtems_rbtree_peek_max( &rbtree1 ); + rtems_rbtree_extract( &rbtree1, p ); + t1 = RTEMS_CONTAINER_OF( p, test_node, Node ); + if ( t1->key != 2 ) { + puts( "INIT - rtems_rbtree_extract failed" ); + rtems_test_exit( 0 ); } - rb_insert_unique(&rbtree1, p); + rb_insert_unique( &rbtree1, p ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 1 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 1; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 2 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } } - - puts( "INIT - Verify rtems_rbtree_insert with 100 nodes value [0,99]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = i; - node_array[i].key = i; - rb_insert_unique( &rbtree1, &node_array[i].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + puts( "INIT - Verify rtems_rbtree_insert with 100 nodes value [0,99]" ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = i; + node_array[ i ].key = i; + rb_insert_unique( &rbtree1, &node_array[ i ].Node ); + + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - - if(!rtems_rbtree_is_empty(&rbtree1)) { + + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "INIT - Verify rtems_rbtree_insert with 100 nodes value [99,0]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = 99-i; - node_array[i].key = 99-i; - rb_insert_unique( &rbtree1, &node_array[i].Node ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = 99 - i; + node_array[ i ].key = 99 - i; + rb_insert_unique( &rbtree1, &node_array[ i ].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* testing rbtree_extract by adding 100 nodes then removing the 20 with * keys specified by the numbers array, then removing the rest */ puts( "INIT - Verify rtems_rbtree_extract with 100 nodes value [0,99]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = i; - node_array[i].key = i; - rb_insert_unique( &rbtree1, &node_array[i].Node ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = i; + node_array[ i ].key = i; + rb_insert_unique( &rbtree1, &node_array[ i ].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Extracting 20 random nodes" ); - for (i = 0; i < 20; i++) { - id = numbers[i]; - rtems_rbtree_extract( &rbtree1, &node_array[id].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + for ( i = 0; i < 20; i++ ) { + id = numbers[ i ]; + rtems_rbtree_extract( &rbtree1, &node_array[ id ].Node ); + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Removing 80 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0, i = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p, test_node, Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0, i = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); - while ( id == numbers_sorted[i] ) { + while ( id == numbers_sorted[ i ] ) { /* skip if expected minimum (id) is in the set of extracted numbers */ id++; i++; @@ -2227,165 +2269,182 @@ rtems_task Init( rtems_task_argument ignored ) if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* Additional rtems_rbtree_extract test which removes a node * with two children while target node has a left child only. */ for ( i = 0; i < 7; i++ ) { - node_array[i].id = i; - node_array[i].key = i; + node_array[ i ].id = i; + node_array[ i ].key = i; } - rb_insert_unique( &rbtree1, &node_array[3].Node ); - rb_insert_unique( &rbtree1, &node_array[1].Node ); - rb_insert_unique( &rbtree1, &node_array[5].Node ); - rb_insert_unique( &rbtree1, &node_array[0].Node ); - rb_insert_unique( &rbtree1, &node_array[2].Node ); - rb_insert_unique( &rbtree1, &node_array[4].Node ); - rb_insert_unique( &rbtree1, &node_array[6].Node ); - rtems_rbtree_extract( &rbtree1, &node_array[2].Node ); + rb_insert_unique( &rbtree1, &node_array[ 3 ].Node ); + rb_insert_unique( &rbtree1, &node_array[ 1 ].Node ); + rb_insert_unique( &rbtree1, &node_array[ 5 ].Node ); + rb_insert_unique( &rbtree1, &node_array[ 0 ].Node ); + rb_insert_unique( &rbtree1, &node_array[ 2 ].Node ); + rb_insert_unique( &rbtree1, &node_array[ 4 ].Node ); + rb_insert_unique( &rbtree1, &node_array[ 6 ].Node ); + rtems_rbtree_extract( &rbtree1, &node_array[ 2 ].Node ); /* node_array[1] has now only a left child. */ - if ( !rtems_rbtree_left( &node_array[1].Node ) || - rtems_rbtree_right( &node_array[1].Node ) ) - puts( "INIT - LEFT CHILD ONLY NOT FOUND" ); - rtems_rbtree_extract( &rbtree1, &node_array[3].Node ); - while( (p = rtems_rbtree_get_max(&rbtree1)) ); + if ( + !rtems_rbtree_left( &node_array[ 1 ].Node ) || + rtems_rbtree_right( &node_array[ 1 ].Node ) + ) { + puts( "INIT - LEFT CHILD ONLY NOT FOUND" ); + } + rtems_rbtree_extract( &rbtree1, &node_array[ 3 ].Node ); + while (( p = rtems_rbtree_get_max( &rbtree1 ) )); puts( "INIT - Verify rtems_rbtree_get_max with 100 nodes value [99,0]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = 99-i; - node_array[i].key = 99-i; - rb_insert_unique( &rbtree1, &node_array[i].Node ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = 99 - i; + node_array[ i ].key = 99 - i; + rb_insert_unique( &rbtree1, &node_array[ i ].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_max(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_max(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_max( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_max( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if ( t->id != 99-id ) { + if ( t->id != 99 - id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "INIT - Verify rtems_rbtree_get_max with 100 nodes value [0,99]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = i; - node_array[i].key = i; - rb_insert_unique( &rbtree1, &node_array[i].Node ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = i; + node_array[ i ].key = i; + rb_insert_unique( &rbtree1, &node_array[ i ].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Verify rtems_rbtree_find" ); search_node.key = 30; - p = rb_find_unique(&rbtree1, &search_node.Node); - if(RTEMS_CONTAINER_OF(p,test_node,Node)->id != 30) { - puts ("INIT - ERROR ON RBTREE ID MISMATCH"); - rtems_test_exit(0); + p = rb_find_unique( &rbtree1, &search_node.Node ); + if ( RTEMS_CONTAINER_OF( p, test_node, Node )->id != 30 ) { + puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); + rtems_test_exit( 0 ); } - puts( "INIT - Verify rtems_rbtree_predecessor/successor"); - p = rtems_rbtree_predecessor(p); - if(p && RTEMS_CONTAINER_OF(p,test_node,Node)->id != 29) { - puts ("INIT - ERROR ON RBTREE ID MISMATCH"); - rtems_test_exit(0); + puts( "INIT - Verify rtems_rbtree_predecessor/successor" ); + p = rtems_rbtree_predecessor( p ); + if ( p && RTEMS_CONTAINER_OF( p, test_node, Node )->id != 29 ) { + puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); + rtems_test_exit( 0 ); } - p = rb_find_unique(&rbtree1, &search_node.Node); - p = rtems_rbtree_successor(p); - if(p && RTEMS_CONTAINER_OF(p,test_node,Node)->id != 31) { - puts ("INIT - ERROR ON RBTREE ID MISMATCH"); - rtems_test_exit(0); + p = rb_find_unique( &rbtree1, &search_node.Node ); + p = rtems_rbtree_successor( p ); + if ( p && RTEMS_CONTAINER_OF( p, test_node, Node )->id != 31 ) { + puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); + rtems_test_exit( 0 ); } - if ( rb_color( rtems_rbtree_root(&rbtree1) ) != BLACK ) - puts ( "INIT - ERROR ON RBTREE ROOT IS BLACK MISMATCH" ); + if ( rb_color( rtems_rbtree_root( &rbtree1 ) ) != BLACK ) { + puts( "INIT - ERROR ON RBTREE ROOT IS BLACK MISMATCH" ); + } puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_max(&rbtree1), id = 99 ; p ; - p = rtems_rbtree_get_max(&rbtree1) , id-- ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_max( &rbtree1 ), id = 99; p; + p = rtems_rbtree_get_max( &rbtree1 ), id-- + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id < 0 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - puts("INIT - Insert 20 random numbers"); - for (i = 0; i < 20; i++) { + puts( "INIT - Insert 20 random numbers" ); + for ( i = 0; i < 20; i++ ) { visitor_context ctx = { 0, i + 1, test_insert_trees[ i ] }; - node_array[i].id = numbers[i]; - node_array[i].key = numbers[i]; - rb_insert_unique( &rbtree1, &node_array[i].Node ); + node_array[ i ].id = numbers[ i ]; + node_array[ i ].key = numbers[ i ]; + rb_insert_unique( &rbtree1, &node_array[ i ].Node ); _RBTree_Iterate( &rbtree1, visit_nodes, &ctx ); rtems_test_assert( ctx.current == ctx.count ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Removing 20 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 19 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if ( t->id != numbers_sorted[id] ) { + if ( t->id != numbers_sorted[ id ] ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } if ( id < 19 ) { visitor_context ctx = { 0, 20 - id - 1, test_remove_trees[ id ] }; @@ -2395,42 +2454,50 @@ rtems_task Init( rtems_task_argument ignored ) } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "INIT - Verify rtems_rbtree_initialize with 100 nodes value [0,99]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = i; - node_array[i].key = i; + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = i; + node_array[ i ].key = i; } - rtems_rbtree_initialize( &rbtree1, &test_compare_function, - &node_array[0].Node, 100, - sizeof(test_node), true ); + rtems_rbtree_initialize( + &rbtree1, + &test_compare_function, + &node_array[ 0 ].Node, + 100, + sizeof( test_node ), + true + ); puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } if ( t->id != id ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* Initialize the tree for duplicate keys */ @@ -2438,85 +2505,93 @@ rtems_task Init( rtems_task_argument ignored ) rtems_rbtree_initialize_empty( &rbtree1 ); puts( "INIT - Verify rtems_rbtree_insert with 100 nodes value [0,99]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = i; - node_array[i].key = i%5; - rb_insert_multi( &rbtree1, &node_array[i].Node ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = i; + node_array[ i ].key = i % 5; + rb_insert_multi( &rbtree1, &node_array[ i ].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Verify rtems_rbtree_find in a duplicate tree" ); search_node.key = 2; - p = rb_find_multi(&rbtree1, &search_node.Node); - if(RTEMS_CONTAINER_OF(p,test_node,Node)->id != 2) { - puts ("INIT - ERROR ON RBTREE ID MISMATCH"); - rtems_test_exit(0); + p = rb_find_multi( &rbtree1, &search_node.Node ); + if ( RTEMS_CONTAINER_OF( p, test_node, Node )->id != 2 ) { + puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); + rtems_test_exit( 0 ); } puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if ( t->id != ( ((id*5)%100) + (id/20) ) ) { + if ( t->id != ( ( ( id * 5 ) % 100 ) + ( id / 20 ) ) ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } puts( "INIT - Verify rtems_rbtree_insert with 100 nodes value [99,0]" ); - for (i = 0; i < 100; i++) { - node_array[i].id = 99-i; - node_array[i].key = (99-i)%5; - rb_insert_multi( &rbtree1, &node_array[i].Node ); + for ( i = 0; i < 100; i++ ) { + node_array[ i ].id = 99 - i; + node_array[ i ].key = ( 99 - i ) % 5; + rb_insert_multi( &rbtree1, &node_array[ i ].Node ); - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } puts( "INIT - Verify rtems_rbtree_find in a duplicate tree" ); search_node.key = 2; - p = rb_find_multi(&rbtree1, &search_node.Node); - if(RTEMS_CONTAINER_OF(p,test_node,Node)->id != 97) { - puts ("INIT - ERROR ON RBTREE ID MISMATCH"); - rtems_test_exit(0); + p = rb_find_multi( &rbtree1, &search_node.Node ); + if ( RTEMS_CONTAINER_OF( p, test_node, Node )->id != 97 ) { + puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); + rtems_test_exit( 0 ); } puts( "INIT - Removing 100 nodes" ); - for ( p = rtems_rbtree_get_min(&rbtree1), id = 0 ; p ; - p = rtems_rbtree_get_min(&rbtree1) , id++ ) { - test_node *t = RTEMS_CONTAINER_OF(p,test_node,Node); + for ( + p = rtems_rbtree_get_min( &rbtree1 ), id = 0; p; + p = rtems_rbtree_get_min( &rbtree1 ), id++ + ) { + test_node *t = RTEMS_CONTAINER_OF( p, test_node, Node ); if ( id > 99 ) { puts( "INIT - TOO MANY NODES ON RBTREE" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if ( t->id != ( (((99-id)*5)%100) + (id/20) ) ) { + if ( t->id != ( ( ( ( 99 - id ) * 5 ) % 100 ) + ( id / 20 ) ) ) { puts( "INIT - ERROR ON RBTREE ID MISMATCH" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - if (!rb_assert(rtems_rbtree_root(&rbtree1)) ) + if ( !rb_assert( rtems_rbtree_root( &rbtree1 ) ) ) { puts( "INIT - FAILED TREE CHECK" ); + } } - if(!rtems_rbtree_is_empty(&rbtree1)) { + if ( !rtems_rbtree_is_empty( &rbtree1 ) ) { puts( "INIT - TREE NOT EMPTY" ); - rtems_test_exit(0); + rtems_test_exit( 0 ); } test_rbtree_postorder(); @@ -2526,7 +2601,7 @@ rtems_task Init( rtems_task_argument ignored ) test_rbtree_random_ops(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ diff --git a/testsuites/sptests/spregion_err01/init.c b/testsuites/sptests/spregion_err01/init.c index a8d706d757..1e3b63d620 100644 --- a/testsuites/sptests/spregion_err01/init.c +++ b/testsuites/sptests/spregion_err01/init.c @@ -35,25 +35,25 @@ const char rtems_test_name[] = "SPREGION_ERR 1"; -static rtems_name Region_name[ 2 ]; /* array of region names */ -static rtems_id Region_id[ 2 ]; /* array of region ids */ +static rtems_name Region_name[ 2 ]; /* array of region names */ +static rtems_id Region_id[ 2 ]; /* array of region ids */ -static uint8_t Region_good_area[4096] CPU_STRUCTURE_ALIGNMENT; -#define Region_bad_area (void *) 0x00000005 +static uint8_t Region_good_area[ 4096 ] CPU_STRUCTURE_ALIGNMENT; +#define Region_bad_area (void *) 0x00000005 #define REGION_START_OFFSET 1024 #define REGION_LENGTH 512 -static void region_error_tests(void) +static void region_error_tests( void ) { - void *segment_address_1; - void *segment_address_2; - void *segment_address_3; - uintptr_t segment_size; - rtems_status_code status; - Heap_Information_block the_info; - rtems_id junk_id; + void *segment_address_1; + void *segment_address_2; + void *segment_address_3; + uintptr_t segment_size; + rtems_status_code status; + Heap_Information_block the_info; + rtems_id junk_id; - Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' ); + Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' ); /* Check invalid name error case */ status = rtems_region_create( @@ -131,11 +131,7 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" ); /* extend NULL address */ - status = rtems_region_extend( - Region_id[ 1 ], - NULL, - REGION_LENGTH - 1 - ); + status = rtems_region_extend( Region_id[ 1 ], NULL, REGION_LENGTH - 1 ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -246,11 +242,11 @@ static void region_error_tests(void) /* get_segment with NULL param */ status = rtems_region_get_segment( - Region_id[ 1 ], - 2, - RTEMS_DEFAULT_OPTIONS, - RTEMS_NO_TIMEOUT, - NULL + Region_id[ 1 ], + 2, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + NULL ); fatal_directive_status( status, @@ -261,11 +257,11 @@ static void region_error_tests(void) /* get_segment with illegal 0 size */ status = rtems_region_get_segment( - Region_id[ 1 ], - 0, - RTEMS_DEFAULT_OPTIONS, - RTEMS_NO_TIMEOUT, - &segment_address_1 + Region_id[ 1 ], + 0, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 ); fatal_directive_status( status, @@ -276,11 +272,11 @@ static void region_error_tests(void) /* get_segment with illegal big size */ status = rtems_region_get_segment( - Region_id[ 1 ], - sizeof( Region_good_area ) * 2, - RTEMS_DEFAULT_OPTIONS, - RTEMS_NO_TIMEOUT, - &segment_address_1 + Region_id[ 1 ], + sizeof( Region_good_area ) * 2, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 ); fatal_directive_status( status, @@ -290,21 +286,21 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_get_segment - too big - RTEMS_INVALID_SIZE" ); status = rtems_region_get_segment( - Region_id[ 1 ], - REGION_LENGTH / 2, - RTEMS_DEFAULT_OPTIONS, - RTEMS_NO_TIMEOUT, - &segment_address_1 + Region_id[ 1 ], + REGION_LENGTH / 2, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 ); directive_failed( status, "rtems_region_get_segment" ); puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" ); status = rtems_region_get_segment( - Region_id[ 1 ], - REGION_LENGTH / 2, - RTEMS_NO_WAIT, - RTEMS_NO_TIMEOUT, - &segment_address_2 + Region_id[ 1 ], + REGION_LENGTH / 2, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_2 ); fatal_directive_status( status, @@ -329,7 +325,11 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" ); /* Check get_segment_size errors */ - status = rtems_region_get_segment_size( Region_id[ 1 ], NULL, &segment_size ); + status = rtems_region_get_segment_size( + Region_id[ 1 ], + NULL, + &segment_size + ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, @@ -338,7 +338,9 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_get_segment_size - RTEMS_INVALID_ADDRESS" ); status = rtems_region_get_segment_size( - Region_id[ 1 ], segment_address_1, NULL + Region_id[ 1 ], + segment_address_1, + NULL ); fatal_directive_status( status, @@ -348,7 +350,9 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_get_segment_size - RTEMS_INVALID_ADDRESS" ); status = rtems_region_get_segment_size( - 100, segment_address_1, &segment_size + 100, + segment_address_1, + &segment_size ); fatal_directive_status( status, @@ -367,7 +371,10 @@ static void region_error_tests(void) /* Check resize_segment errors */ status = rtems_region_resize_segment( - Region_id[ 1 ], segment_address_3, 256, NULL + Region_id[ 1 ], + segment_address_3, + 256, + NULL ); fatal_directive_status( status, @@ -377,7 +384,10 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_resize_segment - RTEMS_INVALID_ADDRESS" ); status = rtems_region_resize_segment( - Region_id[ 1 ], NULL, 256, &segment_size + Region_id[ 1 ], + NULL, + 256, + &segment_size ); fatal_directive_status( status, @@ -387,7 +397,10 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_resize_segment - RTEMS_INVALID_ADDRESS" ); status = rtems_region_resize_segment( - 100, segment_address_3, 256, &segment_size + 100, + segment_address_3, + 256, + &segment_size ); fatal_directive_status( status, @@ -413,16 +426,12 @@ static void region_error_tests(void) ); puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); -/* + /* * The following generate internal heap errors. Thus this code * is subject to change if the heap code changes. */ - status = rtems_region_extend( - 100, - Region_good_area, - 128 - ); + status = rtems_region_extend( 100, Region_good_area, 128 ); fatal_directive_status( status, RTEMS_INVALID_ID, @@ -443,9 +452,7 @@ static void region_error_tests(void) puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/spregion_err01/system.h b/testsuites/sptests/spregion_err01/system.h index edac56a2c7..977b0b9faf 100644 --- a/testsuites/sptests/spregion_err01/system.h +++ b/testsuites/sptests/spregion_err01/system.h @@ -33,8 +33,8 @@ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_REGIONS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sprmsched01/init.c b/testsuites/sptests/sprmsched01/init.c index 323f1b962e..17dfc18ee1 100644 --- a/testsuites/sptests/sprmsched01/init.c +++ b/testsuites/sptests/sprmsched01/init.c @@ -37,32 +37,30 @@ const char rtems_test_name[] = "SPRMSCHED 1"; -static const uint32_t Periods[] = { 1000, 200 }; -static const uint32_t Iterations[] = { 600, 100 }; +static const uint32_t Periods[] = { 1000, 200 }; +static const uint32_t Iterations[] = { 600, 100 }; static const rtems_name Task_name[] = { rtems_build_name( 'T', 'A', '1', ' ' ), rtems_build_name( 'T', 'A', '2', ' ' ) }; -static const rtems_task_priority Prio[3] = { 2, 5 }; -static const uint32_t testnumber = 9; /* stop condition */ +static const rtems_task_priority Prio[ 3 ] = { 2, 5 }; +static const uint32_t testnumber = 9; /* stop condition */ static uint32_t tsk_counter[] = { 0, 0 }; -static rtems_id Task_id[ 2 ]; +static rtems_id Task_id[ 2 ]; /** * @brief Task body */ -static rtems_task Task( - rtems_task_argument argument -) +static rtems_task Task( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - rtems_id RM_period; - rtems_id selfid=rtems_task_self(); - rtems_rate_monotonic_period_status period_status; - uint32_t flag=0; + rtems_status_code status; + rtems_id RM_period; + rtems_id selfid = rtems_task_self(); + rtems_rate_monotonic_period_status period_status; + uint32_t flag = 0; /*create period*/ status = rtems_rate_monotonic_create( Task_name[ argument ], &RM_period ); @@ -74,9 +72,9 @@ static rtems_task Task( /* Do some work */ rtems_test_spin_for_ticks( Iterations[ argument ] ); - if( argument == 1 ){ - if( status == RTEMS_TIMEOUT ){ - if( flag == 0 ){ + if ( argument == 1 ) { + if ( status == RTEMS_TIMEOUT ) { + if ( flag == 0 ) { puts( "First time RTEMS_TIMEOUT" ); puts( "Task 2 should have 3 postponed jobs due to preemption." ); rtems_test_assert( period_status.postponed_jobs_count == 3 ); @@ -93,7 +91,7 @@ static rtems_task Task( status = rtems_rate_monotonic_get_status( RM_period, &period_status ); directive_failed( status, "rate_monotonic_get_status" ); - if( tsk_counter[ argument ] == testnumber ){ + if ( tsk_counter[ argument ] == testnumber ) { TEST_END(); status = rtems_rate_monotonic_delete( RM_period ); directive_failed( status, "rtems_rate_monotonic_delete" ); @@ -101,9 +99,9 @@ static rtems_task Task( } } - tsk_counter[ argument ]+=1; - if ( argument == 0 ){ - if( tsk_counter[ argument ] == 2 ){ + tsk_counter[ argument ] += 1; + if ( argument == 0 ) { + if ( tsk_counter[ argument ] == 2 ) { puts( "Task 1 has released two jobs" ); status = rtems_rate_monotonic_delete( RM_period ); directive_failed( status, "rtems_rate_monotonic_delete" ); @@ -114,45 +112,45 @@ static rtems_task Task( } } -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; - uint32_t index; + uint32_t index; rtems_status_code status; TEST_BEGIN(); /* Create two tasks */ - for ( index = 0; index < RTEMS_ARRAY_SIZE(Task_name); ++index ){ + for ( index = 0; index < RTEMS_ARRAY_SIZE( Task_name ); ++index ) { status = rtems_task_create( - Task_name[ index ], Prio[index], RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ index ] + Task_name[ index ], + Prio[ index ], + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); } - /* After creating the periods for tasks, start to run them sequencially. */ - for ( index = 0; index < RTEMS_ARRAY_SIZE(Task_name); ++index ){ - status = rtems_task_start( Task_id[ index ], Task, index); - directive_failed( status, "rtems_task_start loop"); + for ( index = 0; index < RTEMS_ARRAY_SIZE( Task_name ); ++index ) { + status = rtems_task_start( Task_id[ index ], Task, index ); + directive_failed( status, "rtems_task_start loop" ); } rtems_task_exit(); } #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_PERIODS 2 +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_PERIODS 2 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INITIAL_EXTENSIONS \ - RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_INIT diff --git a/testsuites/sptests/sprmsched02/init.c b/testsuites/sptests/sprmsched02/init.c index b87be89034..bea52dddab 100644 --- a/testsuites/sptests/sprmsched02/init.c +++ b/testsuites/sptests/sprmsched02/init.c @@ -37,15 +37,13 @@ const char rtems_test_name[] = "SPRMSCHED 2"; /* forward declarations to avoid warnings */ -rtems_task Init( rtems_task_argument argument ); +rtems_task Init( rtems_task_argument argument ); static void modify_count( rtems_id id ); -static void modify_count( - rtems_id id -) +static void modify_count( rtems_id id ) { - Rate_monotonic_Control *the_period; - ISR_lock_Context lock_context; + Rate_monotonic_Control *the_period; + ISR_lock_Context lock_context; the_period = _Rate_monotonic_Get( id, &lock_context ); _Rate_monotonic_Acquire_critical( the_period, &lock_context ); @@ -53,27 +51,22 @@ static void modify_count( _Rate_monotonic_Release( the_period, &lock_context ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_id period_id; - rtems_name period_name; - rtems_rate_monotonic_period_status period_status; - rtems_status_code status; - int i; + rtems_id period_id; + rtems_name period_name; + rtems_rate_monotonic_period_status period_status; + rtems_status_code status; + int i; - period_name = rtems_build_name('P','E','R','1'); + period_name = rtems_build_name( 'P', 'E', 'R', '1' ); TEST_BEGIN(); /* create period */ - status = rtems_rate_monotonic_create( - period_name, - &period_id - ); + status = rtems_rate_monotonic_create( period_name, &period_id ); directive_failed( status, "rate_monotonic_create" ); /* modify the count to UINT32_MAX and attempt to miss deadline*/ @@ -88,10 +81,14 @@ rtems_task Init( /* Check the status */ status = rtems_rate_monotonic_get_status( period_id, &period_status ); directive_failed( status, "rate_monotonic_get_status" ); - printf( "Init Postponed jobs = %"PRIu32", and expected %"PRIu32"\n", period_status.postponed_jobs_count, UINT32_MAX ); + printf( + "Init Postponed jobs = %" PRIu32 ", and expected %" PRIu32 "\n", + period_status.postponed_jobs_count, + UINT32_MAX + ); rtems_test_assert( period_status.postponed_jobs_count == UINT32_MAX ); - for ( i=1 ; i <= 2 ; i++ ) { + for ( i = 1; i <= 2; i++ ) { status = rtems_task_wake_after( 100 ); directive_failed( status, "rtems_task_wake_after(100)" ); puts( "Task misses its deadline." ); @@ -101,8 +98,12 @@ rtems_task Init( directive_failed( status, "rate_monotonic_get_status" ); /* print out the count which should keep in UINT32_MAX, since the period still misses its deadline */ - printf( "Count = %"PRIu32", and expected %"PRIu32"\n", period_status.postponed_jobs_count, UINT32_MAX); - rtems_test_assert( period_status.postponed_jobs_count == UINT32_MAX); + printf( + "Count = %" PRIu32 ", and expected %" PRIu32 "\n", + period_status.postponed_jobs_count, + UINT32_MAX + ); + rtems_test_assert( period_status.postponed_jobs_count == UINT32_MAX ); rtems_test_spin_until_next_tick(); status = rtems_rate_monotonic_period( period_id, 50 ); @@ -111,13 +112,11 @@ rtems_task Init( RTEMS_TIMEOUT, "rtems_rate_monotonic_period 2-n" ); - - } TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -125,14 +124,13 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE - #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spscheduler01/init.c b/testsuites/sptests/spscheduler01/init.c index 1dacf3814b..be3c1aba52 100644 --- a/testsuites/sptests/spscheduler01/init.c +++ b/testsuites/sptests/spscheduler01/init.c @@ -43,11 +43,11 @@ const char rtems_test_name[] = "SPSCHEDULER 1"; -#define BLUE rtems_build_name('b', 'l', 'u', 'e') +#define BLUE rtems_build_name( 'b', 'l', 'u', 'e' ) -#define RED rtems_build_name('r', 'e', 'd', ' ') +#define RED rtems_build_name( 'r', 'e', 'd', ' ' ) -#define BIG_NUM_CPUS (2 * CHAR_BIT * sizeof(cpu_set_t)) +#define BIG_NUM_CPUS ( 2 * CHAR_BIT * sizeof( cpu_set_t ) ) static const rtems_id invalid_id = 1; @@ -55,667 +55,719 @@ static rtems_id master_id; static rtems_id sema_id; -static void assert_eno(rtems_status_code sc, int eno) +static void assert_eno( rtems_status_code sc, int eno ) { - switch (sc) { + switch ( sc ) { case RTEMS_SUCCESSFUL: - rtems_test_assert(eno == 0); + rtems_test_assert( eno == 0 ); break; case RTEMS_INVALID_ADDRESS: - rtems_test_assert(eno == EFAULT); + rtems_test_assert( eno == EFAULT ); break; case RTEMS_INVALID_ID: - rtems_test_assert(eno == ESRCH); + rtems_test_assert( eno == ESRCH ); break; case RTEMS_INVALID_NUMBER: case RTEMS_INVALID_SIZE: - rtems_test_assert(eno == EINVAL); + rtems_test_assert( eno == EINVAL ); break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); } } static rtems_status_code task_get_affinity( - rtems_id id, - size_t cpusetsize, + rtems_id id, + size_t cpusetsize, cpu_set_t *cpuset ) { rtems_status_code sc; - int eno; - cpu_set_t *cpusetbig; + int eno; + cpu_set_t *cpusetbig; - sc = rtems_task_get_affinity(id, cpusetsize, cpuset); + sc = rtems_task_get_affinity( id, cpusetsize, cpuset ); - if (cpuset != NULL) { - cpusetbig = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbig != NULL); + if ( cpuset != NULL ) { + cpusetbig = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbig != NULL ); - memcpy(cpusetbig, cpuset, cpusetsize); + memcpy( cpusetbig, cpuset, cpusetsize ); } else { cpusetbig = NULL; } - eno = pthread_getaffinity_np(id, cpusetsize, cpusetbig); + eno = pthread_getaffinity_np( id, cpusetsize, cpusetbig ); - if (cpuset != NULL) { - rtems_test_assert(CPU_EQUAL_S(cpusetsize, cpusetbig, cpuset)); - CPU_FREE(cpusetbig); + if ( cpuset != NULL ) { + rtems_test_assert( CPU_EQUAL_S( cpusetsize, cpusetbig, cpuset ) ); + CPU_FREE( cpusetbig ); } - assert_eno(sc, eno); + assert_eno( sc, eno ); return sc; } static rtems_status_code task_set_affinity( - rtems_id id, - size_t cpusetsize, + rtems_id id, + size_t cpusetsize, const cpu_set_t *cpuset ) { rtems_status_code sc; - int eno; + int eno; - sc = rtems_task_set_affinity(id, cpusetsize, cpuset); - eno = pthread_setaffinity_np(id, cpusetsize, cpuset); - assert_eno(sc, eno); + sc = rtems_task_set_affinity( id, cpusetsize, cpuset ); + eno = pthread_setaffinity_np( id, cpusetsize, cpuset ); + assert_eno( sc, eno ); return sc; } -static void test_task_get_set_affinity(void) +static void test_task_get_set_affinity( void ) { - rtems_id self_id = rtems_task_self(); - rtems_id task_id; + rtems_id self_id = rtems_task_self(); + rtems_id task_id; rtems_status_code sc; - cpu_set_t cpusetone; - cpu_set_t cpusetall; - cpu_set_t cpuset; - size_t cpusetbigsize = CPU_ALLOC_SIZE(BIG_NUM_CPUS); - cpu_set_t *cpusetbigone; - cpu_set_t *cpusetbig; + cpu_set_t cpusetone; + cpu_set_t cpusetall; + cpu_set_t cpuset; + size_t cpusetbigsize = CPU_ALLOC_SIZE( BIG_NUM_CPUS ); + cpu_set_t *cpusetbigone; + cpu_set_t *cpusetbig; - CPU_ZERO(&cpusetone); - CPU_SET(0, &cpusetone); + CPU_ZERO( &cpusetone ); + CPU_SET( 0, &cpusetone ); - CPU_FILL(&cpusetall); + CPU_FILL( &cpusetall ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_get_affinity(RTEMS_SELF, sizeof(cpuset), NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = task_get_affinity( RTEMS_SELF, sizeof( cpuset ), NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = task_set_affinity(RTEMS_SELF, sizeof(cpuset), NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = task_set_affinity( RTEMS_SELF, sizeof( cpuset ), NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = task_get_affinity(RTEMS_SELF, 0, &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_SIZE); + sc = task_get_affinity( RTEMS_SELF, 0, &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_SIZE ); - sc = task_set_affinity(RTEMS_SELF, 0, &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + sc = task_set_affinity( RTEMS_SELF, 0, &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_NUMBER ); - sc = task_get_affinity(invalid_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = task_get_affinity( invalid_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = task_set_affinity(invalid_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = task_set_affinity( invalid_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = task_get_affinity(RTEMS_SELF, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( RTEMS_SELF, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - sc = task_set_affinity(RTEMS_SELF, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( RTEMS_SELF, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_set_affinity(self_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( self_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_set_affinity(task_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( task_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_get_affinity(task_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( task_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - sc = task_set_affinity(RTEMS_SELF, sizeof(cpusetall), &cpusetall); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( RTEMS_SELF, sizeof( cpusetall ), &cpusetall ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = task_get_affinity(task_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( task_id, sizeof( cpuset ), &cpuset ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - cpusetbigone = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbigone != NULL); + cpusetbigone = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbigone != NULL ); - cpusetbig = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbig != NULL); + cpusetbig = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbig != NULL ); - CPU_ZERO_S(cpusetbigsize, cpusetbigone); - CPU_SET_S(0, cpusetbigsize, cpusetbigone); + CPU_ZERO_S( cpusetbigsize, cpusetbigone ); + CPU_SET_S( 0, cpusetbigsize, cpusetbigone ); - sc = task_get_affinity(task_id, cpusetbigsize, cpusetbig); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_get_affinity( task_id, cpusetbigsize, cpusetbig ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL_S(cpusetbigsize, cpusetbig, cpusetbigone)); + rtems_test_assert( CPU_EQUAL_S( cpusetbigsize, cpusetbig, cpusetbigone ) ); - sc = task_set_affinity(task_id, cpusetbigsize, cpusetbig); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = task_set_affinity( task_id, cpusetbigsize, cpusetbig ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - CPU_FREE(cpusetbig); - CPU_FREE(cpusetbigone); + CPU_FREE( cpusetbig ); + CPU_FREE( cpusetbigone ); } -static rtems_task_priority set_prio(rtems_id id, rtems_task_priority prio) +static rtems_task_priority set_prio( rtems_id id, rtems_task_priority prio ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority old_prio; old_prio = 0xffffffff; - sc = rtems_task_set_priority(id, prio, &old_prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_priority( id, prio, &old_prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); return old_prio; } -static void forbidden_task(rtems_task_argument arg) +static void forbidden_task( rtems_task_argument arg ) { (void) arg; - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void restart_task(rtems_task_argument arg) +static void restart_task( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - if (arg == 0) { - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 2); + if ( arg == 0 ) { + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 2 ); - rtems_task_restart(RTEMS_SELF, 1); - } else if (arg == 1) { + rtems_task_restart( RTEMS_SELF, 1 ); + } else if ( arg == 1 ) { rtems_id scheduler_id; - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 2); + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 2 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(RTEMS_SELF, scheduler_id, 4); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( RTEMS_SELF, scheduler_id, 4 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 4); + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 4 ); - rtems_task_restart(RTEMS_SELF, 2); + rtems_task_restart( RTEMS_SELF, 2 ); } else { - rtems_test_assert(set_prio(RTEMS_SELF, 3) == 4); + rtems_test_assert( set_prio( RTEMS_SELF, 3 ) == 4 ); - rtems_task_resume(master_id); + rtems_task_resume( master_id ); } - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void sema_task(rtems_task_argument arg) +static void sema_task( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - sc = rtems_semaphore_obtain(sema_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( sema_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void test_task_get_set_scheduler(void) +static void test_task_get_set_scheduler( void ) { rtems_status_code sc; - rtems_id self_id = rtems_task_self(); - rtems_name name = BLUE; - rtems_id scheduler_id; - rtems_id scheduler_by_name; - rtems_id task_id; - rtems_id mtx_id; + rtems_id self_id = rtems_task_self(); + rtems_name name = BLUE; + rtems_id scheduler_id; + rtems_id scheduler_by_name; + rtems_id task_id; + rtems_id mtx_id; - sc = rtems_scheduler_ident(name, &scheduler_by_name); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( name, &scheduler_by_name ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_get_scheduler(RTEMS_SELF, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_task_get_scheduler( RTEMS_SELF, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_task_get_scheduler(invalid_id, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_task_get_scheduler( invalid_id, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); scheduler_id = 0; - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == scheduler_by_name); + rtems_test_assert( scheduler_id == scheduler_by_name ); scheduler_id = 0; - sc = rtems_task_get_scheduler(self_id, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( self_id, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == scheduler_by_name); + rtems_test_assert( scheduler_id == scheduler_by_name ); - sc = rtems_task_set_scheduler(invalid_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_task_set_scheduler( invalid_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_task_set_scheduler(self_id, invalid_id, 1); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_task_set_scheduler( self_id, invalid_id, 1 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, UINT32_C(0x80000000)); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + sc = rtems_task_set_scheduler( + self_id, + scheduler_id, + UINT32_C( 0x80000000 ) + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name(' ', 'M', 'T', 'X'), + rtems_build_name( ' ', 'M', 'T', 'X' ), 0, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0, &mtx_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_release(mtx_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( mtx_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(self_id, RTEMS_CURRENT_PRIORITY) == 1); + rtems_test_assert( set_prio( self_id, RTEMS_CURRENT_PRIORITY ) == 1 ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(self_id, RTEMS_CURRENT_PRIORITY) == 2); + rtems_test_assert( set_prio( self_id, RTEMS_CURRENT_PRIORITY ) == 2 ); - sc = rtems_task_set_scheduler(self_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( self_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(set_prio(self_id, RTEMS_CURRENT_PRIORITY) == 1); + rtems_test_assert( set_prio( self_id, RTEMS_CURRENT_PRIORITY ) == 1 ); - sc = rtems_semaphore_delete(mtx_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( mtx_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); scheduler_id = 0; - sc = rtems_task_get_scheduler(task_id, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( task_id, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == scheduler_by_name); + rtems_test_assert( scheduler_id == scheduler_by_name ); - sc = rtems_task_set_scheduler(task_id, scheduler_id, 2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( task_id, scheduler_id, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task_id, forbidden_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, forbidden_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(task_id, scheduler_id, 2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_scheduler( task_id, scheduler_id, 2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task_id, restart_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, restart_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_suspend(self_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_suspend( self_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 0, RTEMS_COUNTING_SEMAPHORE, 0, &sema_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task_id, sema_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task_id, sema_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_set_scheduler(task_id, scheduler_id, 1); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_task_set_scheduler( task_id, scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - sc = rtems_semaphore_delete(sema_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( sema_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_scheduler_ident(void) +static void test_scheduler_ident( void ) { rtems_status_code sc; - rtems_id expected_id = rtems_build_id(7, 1, 1, 1); - rtems_id scheduler_id; - rtems_name name = BLUE; - rtems_name invalid_name = RED; - cpu_set_t s; + rtems_id expected_id = rtems_build_id( 7, 1, 1, 1 ); + rtems_id scheduler_id; + rtems_name name = BLUE; + rtems_name invalid_name = RED; + cpu_set_t s; - sc = rtems_scheduler_ident(name, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_ident( name, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_ident(invalid_name, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_NAME); + sc = rtems_scheduler_ident( invalid_name, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_NAME ); scheduler_id = 0; - sc = rtems_scheduler_ident(name, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( name, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == expected_id); + rtems_test_assert( scheduler_id == expected_id ); - sc = rtems_scheduler_ident_by_processor(1, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_ident_by_processor( 1, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_ident_by_processor(1, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_NAME); + sc = rtems_scheduler_ident_by_processor( 1, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_NAME ); scheduler_id = 0; - sc = rtems_scheduler_ident_by_processor(0, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident_by_processor( 0, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == expected_id); + rtems_test_assert( scheduler_id == expected_id ); - CPU_ZERO(&s); - CPU_SET(1, &s); - sc = rtems_scheduler_ident_by_processor_set(sizeof(s), &s, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + CPU_ZERO( &s ); + CPU_SET( 1, &s ); + sc = rtems_scheduler_ident_by_processor_set( sizeof( s ), &s, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_ident_by_processor_set(1, &s, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_SIZE); + sc = rtems_scheduler_ident_by_processor_set( 1, &s, &scheduler_id ); + rtems_test_assert( sc == RTEMS_INVALID_SIZE ); - sc = rtems_scheduler_ident_by_processor_set(sizeof(s), &s, &scheduler_id); - rtems_test_assert(sc == RTEMS_INVALID_NAME); + sc = rtems_scheduler_ident_by_processor_set( + sizeof( s ), + &s, + &scheduler_id + ); + rtems_test_assert( sc == RTEMS_INVALID_NAME ); - CPU_SET(0, &s); + CPU_SET( 0, &s ); scheduler_id = 0; - sc = rtems_scheduler_ident_by_processor_set(sizeof(s), &s, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident_by_processor_set( + sizeof( s ), + &s, + &scheduler_id + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(scheduler_id == expected_id); + rtems_test_assert( scheduler_id == expected_id ); } -static void test_scheduler_get_max_prio(void) +static void test_scheduler_get_max_prio( void ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority priority; - rtems_id scheduler_id; + rtems_id scheduler_id; priority = 0; - sc = rtems_scheduler_get_maximum_priority(invalid_id, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 0); + sc = rtems_scheduler_get_maximum_priority( invalid_id, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 0 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_get_maximum_priority(scheduler_id, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_get_maximum_priority( scheduler_id, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); priority = 0; - sc = rtems_scheduler_get_maximum_priority(scheduler_id, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority == 255); + sc = rtems_scheduler_get_maximum_priority( scheduler_id, &priority ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority == 255 ); } -static void test_scheduler_map_to_posix(void) +static void test_scheduler_map_to_posix( void ) { rtems_status_code sc; - int posix_priority; - rtems_id scheduler_id; + int posix_priority; + rtems_id scheduler_id; posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(invalid_id, 1, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( invalid_id, 1, &posix_priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( posix_priority == 123 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 1, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_map_priority_to_posix( scheduler_id, 1, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 0, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 0, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( posix_priority == 123 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 255, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 255, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( posix_priority == 123 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 256, &posix_priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(posix_priority == 123); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 256, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( posix_priority == 123 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 1, &posix_priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(posix_priority == 254); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 1, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( posix_priority == 254 ); posix_priority = 123; - sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 254, &posix_priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(posix_priority == 1); + sc = rtems_scheduler_map_priority_to_posix( + scheduler_id, + 254, + &posix_priority + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( posix_priority == 1 ); } -static void test_scheduler_map_from_posix(void) +static void test_scheduler_map_from_posix( void ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority priority; - rtems_id scheduler_id; + rtems_id scheduler_id; priority = 123; - sc = rtems_scheduler_map_priority_from_posix(invalid_id, 1, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( invalid_id, 1, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 123 ); - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 1, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 1, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, -1, &priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, -1, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( priority == 123 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 0, &priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 0, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( priority == 123 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 255, &priority); - rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); - rtems_test_assert(priority == 123); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 255, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_PRIORITY ); + rtems_test_assert( priority == 123 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 1, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority == 254); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 1, &priority ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority == 254 ); priority = 123; - sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 254, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority == 1); + sc = rtems_scheduler_map_priority_from_posix( scheduler_id, 254, &priority ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority == 1 ); } -static void test_scheduler_get_processors(void) +static void test_scheduler_get_processors( void ) { rtems_status_code sc; - rtems_name name = BLUE; - rtems_id scheduler_id; - cpu_set_t cpusetone; - cpu_set_t cpuset; - size_t cpusetbigsize = CPU_ALLOC_SIZE(BIG_NUM_CPUS); - cpu_set_t *cpusetbigone; - cpu_set_t *cpusetbig; + rtems_name name = BLUE; + rtems_id scheduler_id; + cpu_set_t cpusetone; + cpu_set_t cpuset; + size_t cpusetbigsize = CPU_ALLOC_SIZE( BIG_NUM_CPUS ); + cpu_set_t *cpusetbigone; + cpu_set_t *cpusetbig; - CPU_ZERO(&cpusetone); - CPU_SET(0, &cpusetone); + CPU_ZERO( &cpusetone ); + CPU_SET( 0, &cpusetone ); - sc = rtems_scheduler_ident(name, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( name, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_get_processor_set(scheduler_id, sizeof(cpuset), NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_scheduler_get_processor_set( + scheduler_id, + sizeof( cpuset ), + NULL + ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); - sc = rtems_scheduler_get_processor_set(invalid_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_scheduler_get_processor_set( + invalid_id, + sizeof( cpuset ), + &cpuset + ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_scheduler_get_processor_set(scheduler_id, 0, &cpuset); - rtems_test_assert(sc == RTEMS_INVALID_SIZE); + sc = rtems_scheduler_get_processor_set( scheduler_id, 0, &cpuset ); + rtems_test_assert( sc == RTEMS_INVALID_SIZE ); - sc = rtems_scheduler_get_processor_set(scheduler_id, sizeof(cpuset), &cpuset); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_get_processor_set( + scheduler_id, + sizeof( cpuset ), + &cpuset + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL(&cpuset, &cpusetone)); + rtems_test_assert( CPU_EQUAL( &cpuset, &cpusetone ) ); - cpusetbigone = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbigone != NULL); + cpusetbigone = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbigone != NULL ); - cpusetbig = CPU_ALLOC(BIG_NUM_CPUS); - rtems_test_assert(cpusetbig != NULL); + cpusetbig = CPU_ALLOC( BIG_NUM_CPUS ); + rtems_test_assert( cpusetbig != NULL ); - CPU_ZERO_S(cpusetbigsize, cpusetbigone); - CPU_SET_S(0, cpusetbigsize, cpusetbigone); + CPU_ZERO_S( cpusetbigsize, cpusetbigone ); + CPU_SET_S( 0, cpusetbigsize, cpusetbigone ); - sc = rtems_scheduler_get_processor_set(scheduler_id, cpusetbigsize, cpusetbig); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_get_processor_set( + scheduler_id, + cpusetbigsize, + cpusetbig + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(CPU_EQUAL_S(cpusetbigsize, cpusetbig, cpusetbigone)); + rtems_test_assert( CPU_EQUAL_S( cpusetbigsize, cpusetbig, cpusetbigone ) ); - CPU_FREE(cpusetbig); - CPU_FREE(cpusetbigone); + CPU_FREE( cpusetbig ); + CPU_FREE( cpusetbigone ); } -static void test_scheduler_add_remove_processors(void) +static void test_scheduler_add_remove_processors( void ) { rtems_status_code sc; - rtems_id scheduler_id; + rtems_id scheduler_id; - sc = rtems_scheduler_ident(BLUE, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_scheduler_ident( BLUE, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_scheduler_add_processor(invalid_id, 0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_scheduler_add_processor( invalid_id, 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_scheduler_remove_processor(invalid_id, 0); - rtems_test_assert(sc == RTEMS_INVALID_ID); + sc = rtems_scheduler_remove_processor( invalid_id, 0 ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); - sc = rtems_scheduler_add_processor(scheduler_id, 1); - rtems_test_assert(sc == RTEMS_NOT_CONFIGURED); + sc = rtems_scheduler_add_processor( scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_NOT_CONFIGURED ); - sc = rtems_scheduler_remove_processor(scheduler_id, 1); - rtems_test_assert(sc == RTEMS_INVALID_NUMBER); + sc = rtems_scheduler_remove_processor( scheduler_id, 1 ); + rtems_test_assert( sc == RTEMS_INVALID_NUMBER ); - sc = rtems_scheduler_add_processor(scheduler_id, 0); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_scheduler_add_processor( scheduler_id, 0 ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - sc = rtems_scheduler_remove_processor(scheduler_id, 0); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_scheduler_remove_processor( scheduler_id, 0 ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); } -static void test_task_get_priority(void) +static void test_task_get_priority( void ) { - rtems_status_code sc; - rtems_id scheduler_id; + rtems_status_code sc; + rtems_id scheduler_id; rtems_task_priority priority; rtems_task_priority priority_2; - sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_get_scheduler( RTEMS_SELF, &scheduler_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_get_priority(RTEMS_SELF, scheduler_id, NULL); - rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + sc = rtems_task_get_priority( RTEMS_SELF, scheduler_id, NULL ); + rtems_test_assert( sc == RTEMS_INVALID_ADDRESS ); priority = 0; - sc = rtems_task_get_priority(RTEMS_SELF, invalid_id, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 0); + sc = rtems_task_get_priority( RTEMS_SELF, invalid_id, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 0 ); - sc = rtems_task_get_priority(invalid_id, scheduler_id, &priority); - rtems_test_assert(sc == RTEMS_INVALID_ID); - rtems_test_assert(priority == 0); + sc = rtems_task_get_priority( invalid_id, scheduler_id, &priority ); + rtems_test_assert( sc == RTEMS_INVALID_ID ); + rtems_test_assert( priority == 0 ); - sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority != 0); + sc = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &priority + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority != 0 ); priority_2 = 0; - sc = rtems_task_get_priority(RTEMS_SELF, scheduler_id, &priority_2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority_2 == priority); + sc = rtems_task_get_priority( RTEMS_SELF, scheduler_id, &priority_2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority_2 == priority ); priority_2 = 0; - sc = rtems_task_get_priority(rtems_task_self(), scheduler_id, &priority_2); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(priority_2 == priority); + sc = rtems_task_get_priority( rtems_task_self(), scheduler_id, &priority_2 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( priority_2 == priority ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -723,7 +775,7 @@ static void Init(rtems_task_argument arg) TEST_BEGIN(); - rtems_resource_snapshot_take(&snapshot); + rtems_resource_snapshot_take( &snapshot ); master_id = rtems_task_self(); @@ -737,16 +789,16 @@ static void Init(rtems_task_argument arg) test_scheduler_add_remove_processors(); test_task_get_priority(); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spsem01/init.c b/testsuites/sptests/spsem01/init.c index 066ad77936..7511de0089 100644 --- a/testsuites/sptests/spsem01/init.c +++ b/testsuites/sptests/spsem01/init.c @@ -36,146 +36,145 @@ #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_TASKS 3 #define CONFIGURE_MAXIMUM_SEMAPHORES 2 #define CONFIGURE_INIT #include const char rtems_test_name[] = "SPSEM 1"; -rtems_task Task01(rtems_task_argument ignored); -rtems_task Task02(rtems_task_argument ignored); -rtems_task Init(rtems_task_argument ignored); +rtems_task Task01( rtems_task_argument ignored ); +rtems_task Task02( rtems_task_argument ignored ); +rtems_task Init( rtems_task_argument ignored ); -static int getprio(void) +static int getprio( void ) { - rtems_status_code status; + rtems_status_code status; rtems_task_priority pri; - status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri); - directive_failed( status, "rtems_task_set_priority"); - return (int)pri; + status = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri ); + directive_failed( status, "rtems_task_set_priority" ); + return (int) pri; } -rtems_id Task_id[2]; -rtems_name Task_name[2]; +rtems_id Task_id[ 2 ]; +rtems_name Task_name[ 2 ]; -rtems_id sem_id[2]; -rtems_name sem_name[2]; +rtems_id sem_id[ 2 ]; +rtems_name sem_name[ 2 ]; -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - rtems_attribute sem_attr; + rtems_attribute sem_attr; TEST_BEGIN(); sem_attr = RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY; - sem_name[0] = rtems_build_name( 'S','0',' ',' '); + sem_name[ 0 ] = rtems_build_name( 'S', '0', ' ', ' ' ); status = rtems_semaphore_create( - sem_name[0], + sem_name[ 0 ], 1, sem_attr, 0, - &sem_id[0] + &sem_id[ 0 ] ); - directive_failed( status, "rtems_semaphore_create of S0"); - printf("init: S0 created\n"); + directive_failed( status, "rtems_semaphore_create of S0" ); + printf( "init: S0 created\n" ); - sem_name[1] = rtems_build_name( 'S','1',' ',' '); + sem_name[ 1 ] = rtems_build_name( 'S', '1', ' ', ' ' ); status = rtems_semaphore_create( - sem_name[1], + sem_name[ 1 ], 1, sem_attr, 0, - &sem_id[1] + &sem_id[ 1 ] ); - directive_failed( status, "rtems_semaphore_create of S1"); - printf("init: S1 created\n"); + directive_failed( status, "rtems_semaphore_create of S1" ); + printf( "init: S1 created\n" ); - Task_name[0] = rtems_build_name( 'T','A','0','1'); + Task_name[ 0 ] = rtems_build_name( 'T', 'A', '0', '1' ); status = rtems_task_create( - Task_name[0], + Task_name[ 0 ], 36, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[0] + &Task_id[ 0 ] ); - directive_failed( status, "rtems_task_create of TA01"); - printf("init: TA01 created with priority 36\n"); + directive_failed( status, "rtems_task_create of TA01" ); + printf( "init: TA01 created with priority 36\n" ); - Task_name[1] = rtems_build_name( 'T','A','0','2'); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '0', '2' ); status = rtems_task_create( - Task_name[1], + Task_name[ 1 ], 34, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[1] + &Task_id[ 1 ] ); - directive_failed( status , "rtems_task_create of TA02\n"); - printf("init: TA02 created with priority 34\n"); + directive_failed( status, "rtems_task_create of TA02\n" ); + printf( "init: TA02 created with priority 34\n" ); - status = rtems_task_start( Task_id[0], Task01, 0); - directive_failed( status, "rtems_task_start of TA01"); + status = rtems_task_start( Task_id[ 0 ], Task01, 0 ); + directive_failed( status, "rtems_task_start of TA01" ); rtems_task_exit(); } /* Task01 starts with priority 36 */ -rtems_task Task01(rtems_task_argument ignored) +rtems_task Task01( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - printf("TA01: started with priority %d\n", getprio()); + printf( "TA01: started with priority %d\n", getprio() ); - status = rtems_semaphore_obtain( sem_id[0], RTEMS_WAIT, 0 ); - directive_failed( status, "rtems_semaphore_obtain of S0\n"); - printf("TA01: priority %d, holding S0\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 0 ], RTEMS_WAIT, 0 ); + directive_failed( status, "rtems_semaphore_obtain of S0\n" ); + printf( "TA01: priority %d, holding S0\n", getprio() ); - status = rtems_semaphore_obtain( sem_id[1], RTEMS_WAIT, 0 ); - directive_failed( status, "rtems_semaphore_obtain of S1"); - printf("TA01: priority %d, holding S0, S1\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 1 ], RTEMS_WAIT, 0 ); + directive_failed( status, "rtems_semaphore_obtain of S1" ); + printf( "TA01: priority %d, holding S0, S1\n", getprio() ); /* Start Task 2 (TA02) with priority 34. It will run immediately. */ - status = rtems_task_start( Task_id[1], Task02, 0); - directive_failed( status, "rtems_task_start of TA02\n"); + status = rtems_task_start( Task_id[ 1 ], Task02, 0 ); + directive_failed( status, "rtems_task_start of TA02\n" ); - status = rtems_semaphore_release(sem_id[1]); - directive_failed( status, "rtems_semaphore_release of S1\n"); - printf("TA01: priority %d, holding S0\n", getprio()); + status = rtems_semaphore_release( sem_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release of S1\n" ); + printf( "TA01: priority %d, holding S0\n", getprio() ); - status = rtems_semaphore_release(sem_id[0]); - directive_failed( status, "rtems_semaphore_release of S0\n"); - printf("TA01: priority %d\n", getprio()); + status = rtems_semaphore_release( sem_id[ 0 ] ); + directive_failed( status, "rtems_semaphore_release of S0\n" ); + printf( "TA01: priority %d\n", getprio() ); - printf("TA01: exiting\n"); + printf( "TA01: exiting\n" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* TA02 starts at Task02 with priority 34 */ -rtems_task Task02(rtems_task_argument ignored) +rtems_task Task02( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - printf("TA02: started with priority %d\n", getprio()); + printf( "TA02: started with priority %d\n", getprio() ); /* Obtain S1, which should be held by TA01 by now */ - status = rtems_semaphore_obtain( sem_id[1], RTEMS_WAIT, 0 ); - directive_failed( status, " rtems_semaphore_obtain S1"); - printf("TA02: priority %d, holding S1\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 1 ], RTEMS_WAIT, 0 ); + directive_failed( status, " rtems_semaphore_obtain S1" ); + printf( "TA02: priority %d, holding S1\n", getprio() ); - printf("TA02: suspending\n"); - status = rtems_task_suspend( RTEMS_SELF); - directive_failed( status, "rtems_task_suspend TA02"); + printf( "TA02: suspending\n" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend TA02" ); } - diff --git a/testsuites/sptests/spsem02/init.c b/testsuites/sptests/spsem02/init.c index 054f7acfe0..e3b60e95ed 100644 --- a/testsuites/sptests/spsem02/init.c +++ b/testsuites/sptests/spsem02/init.c @@ -36,183 +36,183 @@ #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_MAXIMUM_SEMAPHORES 2 #define CONFIGURE_INIT #include const char rtems_test_name[] = "SPSEM 2"; -rtems_task Task01(rtems_task_argument ignored); -rtems_task Task02(rtems_task_argument ignored); -rtems_task Task03(rtems_task_argument ignored); -rtems_task Init(rtems_task_argument ignored); +rtems_task Task01( rtems_task_argument ignored ); +rtems_task Task02( rtems_task_argument ignored ); +rtems_task Task03( rtems_task_argument ignored ); +rtems_task Init( rtems_task_argument ignored ); -static int getprio(void) +static int getprio( void ) { - rtems_status_code status; + rtems_status_code status; rtems_task_priority pri; - status = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri); - directive_failed( status, "rtems_task_set_priority"); - return (int)pri; + status = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &pri ); + directive_failed( status, "rtems_task_set_priority" ); + return (int) pri; } -rtems_id Task_id[3]; -rtems_name Task_name[3]; +rtems_id Task_id[ 3 ]; +rtems_name Task_name[ 3 ]; -rtems_id sem_id[2]; -rtems_name sem_name[2]; +rtems_id sem_id[ 2 ]; +rtems_name sem_name[ 2 ]; -rtems_task Init(rtems_task_argument ignored) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - rtems_attribute sem_attr; + rtems_attribute sem_attr; TEST_BEGIN(); sem_attr = RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY; - sem_name[0] = rtems_build_name( 'S','0',' ',' '); + sem_name[ 0 ] = rtems_build_name( 'S', '0', ' ', ' ' ); status = rtems_semaphore_create( - sem_name[0], + sem_name[ 0 ], 1, sem_attr, 0, - &sem_id[0] + &sem_id[ 0 ] ); - directive_failed( status, "rtems_semaphore_create of S0"); - printf("init: S0 created\n"); + directive_failed( status, "rtems_semaphore_create of S0" ); + printf( "init: S0 created\n" ); - sem_name[1] = rtems_build_name( 'S','1',' ',' '); + sem_name[ 1 ] = rtems_build_name( 'S', '1', ' ', ' ' ); status = rtems_semaphore_create( - sem_name[1], + sem_name[ 1 ], 1, sem_attr, 0, - &sem_id[1] + &sem_id[ 1 ] ); - directive_failed( status, "rtems_semaphore_create of S1"); - printf("init: S1 created\n"); + directive_failed( status, "rtems_semaphore_create of S1" ); + printf( "init: S1 created\n" ); - Task_name[0] = rtems_build_name( 'T','A','0','1'); + Task_name[ 0 ] = rtems_build_name( 'T', 'A', '0', '1' ); status = rtems_task_create( - Task_name[0], + Task_name[ 0 ], 36, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[0] + &Task_id[ 0 ] ); - directive_failed( status, "rtems_task_create of TA01"); - printf("init: TA01 created with priority 36\n"); + directive_failed( status, "rtems_task_create of TA01" ); + printf( "init: TA01 created with priority 36\n" ); - Task_name[1] = rtems_build_name( 'T','A','0','2'); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '0', '2' ); status = rtems_task_create( - Task_name[1], + Task_name[ 1 ], 34, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[1] + &Task_id[ 1 ] ); - directive_failed( status , "rtems_task_create of TA02\n"); - printf("init: TA02 created with priority 34\n"); + directive_failed( status, "rtems_task_create of TA02\n" ); + printf( "init: TA02 created with priority 34\n" ); - Task_name[2] = rtems_build_name( 'T','A','0','3'); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '0', '3' ); status = rtems_task_create( - Task_name[2], + Task_name[ 2 ], 32, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[2] + &Task_id[ 2 ] ); - directive_failed( status , "rtems_task_create of TA03\n"); - printf("init: TA03 created with priority 32\n"); + directive_failed( status, "rtems_task_create of TA03\n" ); + printf( "init: TA03 created with priority 32\n" ); - status = rtems_task_start( Task_id[0], Task01, 0); - directive_failed( status, "rtems_task_start of TA01"); + status = rtems_task_start( Task_id[ 0 ], Task01, 0 ); + directive_failed( status, "rtems_task_start of TA01" ); rtems_task_exit(); } /* Task01 starts with priority 36 */ -rtems_task Task01(rtems_task_argument ignored) +rtems_task Task01( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - printf("TA01: started with priority %d\n", getprio()); + printf( "TA01: started with priority %d\n", getprio() ); - status = rtems_semaphore_obtain( sem_id[0], RTEMS_WAIT, 0 ); - directive_failed( status, "rtems_semaphore_obtain of S0\n"); - printf("TA01: priority %d, holding S0\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 0 ], RTEMS_WAIT, 0 ); + directive_failed( status, "rtems_semaphore_obtain of S0\n" ); + printf( "TA01: priority %d, holding S0\n", getprio() ); - status = rtems_semaphore_obtain( sem_id[1], RTEMS_WAIT, 0 ); - directive_failed( status, "rtems_semaphore_obtain of S1"); - printf("TA01: priority %d, holding S0, S1\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 1 ], RTEMS_WAIT, 0 ); + directive_failed( status, "rtems_semaphore_obtain of S1" ); + printf( "TA01: priority %d, holding S0, S1\n", getprio() ); /* Start Task 2 (TA02) with priority 34. It will run immediately. */ - status = rtems_task_start( Task_id[1], Task02, 0); - directive_failed( status, "rtems_task_start of TA02\n"); + status = rtems_task_start( Task_id[ 1 ], Task02, 0 ); + directive_failed( status, "rtems_task_start of TA02\n" ); /* Start Task 3 (TA03) with priority 32. It will run immediately. */ - status = rtems_task_start( Task_id[2], Task03, 0); - directive_failed( status, "rtems_task_start of TA03\n"); - printf("TA01: priority %d, holding S0, S1\n", getprio()); + status = rtems_task_start( Task_id[ 2 ], Task03, 0 ); + directive_failed( status, "rtems_task_start of TA03\n" ); + printf( "TA01: priority %d, holding S0, S1\n", getprio() ); - status = rtems_semaphore_release(sem_id[1]); - directive_failed( status, "rtems_semaphore_release of S1\n"); - printf("TA01: priority %d, holding S0\n", getprio()); + status = rtems_semaphore_release( sem_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release of S1\n" ); + printf( "TA01: priority %d, holding S0\n", getprio() ); - status = rtems_semaphore_release(sem_id[0]); - directive_failed( status, "rtems_semaphore_release of S0\n"); - printf("TA01: priority %d\n", getprio()); + status = rtems_semaphore_release( sem_id[ 0 ] ); + directive_failed( status, "rtems_semaphore_release of S0\n" ); + printf( "TA01: priority %d\n", getprio() ); - printf("TA01: exiting\n"); + printf( "TA01: exiting\n" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* TA02 starts at Task02 with priority 34 */ -rtems_task Task02(rtems_task_argument ignored) +rtems_task Task02( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - printf("TA02: started with priority %d\n", getprio()); + printf( "TA02: started with priority %d\n", getprio() ); /* Obtain S1, which should be held by TA01 by now */ - status = rtems_semaphore_obtain( sem_id[1], RTEMS_WAIT, 0 ); - directive_failed( status, " rtems_semaphore_obtain S1"); - printf("TA02: priority %d, holding S1\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 1 ], RTEMS_WAIT, 0 ); + directive_failed( status, " rtems_semaphore_obtain S1" ); + printf( "TA02: priority %d, holding S1\n", getprio() ); - printf("TA02: suspending\n"); - status = rtems_task_suspend( RTEMS_SELF); - directive_failed( status, "rtems_task_suspend TA02"); + printf( "TA02: suspending\n" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend TA02" ); } /* Task03 starts with priority 32 */ -rtems_task Task03(rtems_task_argument ignored) +rtems_task Task03( rtems_task_argument ignored ) { (void) ignored; rtems_status_code status; - printf("TA03: started with priority %d\n", getprio()); + printf( "TA03: started with priority %d\n", getprio() ); - status = rtems_semaphore_obtain( sem_id[0], RTEMS_WAIT, 0 ); - directive_failed( status, "rtems_semaphore_obtain of S0\n"); - printf("TA03: priority %d, holding S0\n", getprio()); + status = rtems_semaphore_obtain( sem_id[ 0 ], RTEMS_WAIT, 0 ); + directive_failed( status, "rtems_semaphore_obtain of S0\n" ); + printf( "TA03: priority %d, holding S0\n", getprio() ); - status = rtems_semaphore_release(sem_id[0]); - directive_failed( status, "rtems_semaphore_release of S0\n"); - printf("TA03: priority %d\n", getprio()); + status = rtems_semaphore_release( sem_id[ 0 ] ); + directive_failed( status, "rtems_semaphore_release of S0\n" ); + printf( "TA03: priority %d\n", getprio() ); - printf("TA03: exiting\n"); + printf( "TA03: exiting\n" ); rtems_task_exit(); } diff --git a/testsuites/sptests/spsem03/init.c b/testsuites/sptests/spsem03/init.c index 5d92300074..bf5b5f925f 100644 --- a/testsuites/sptests/spsem03/init.c +++ b/testsuites/sptests/spsem03/init.c @@ -44,89 +44,89 @@ typedef struct { static test_context test_instance; -static void assert_prio(rtems_id task_id, rtems_task_priority expected_prio) +static void assert_prio( rtems_id task_id, rtems_task_priority expected_prio ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority prio; - sc = rtems_task_set_priority(task_id, RTEMS_CURRENT_PRIORITY, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(prio == expected_prio); + sc = rtems_task_set_priority( task_id, RTEMS_CURRENT_PRIORITY, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( prio == expected_prio ); } -static void create_task(rtems_id *id, rtems_task_priority prio) +static void create_task( rtems_id *id, rtems_task_priority prio ) { rtems_status_code sc; sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), prio, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void start_task(rtems_id id, rtems_task_entry entry) +static void start_task( rtems_id id, rtems_task_entry entry ) { rtems_status_code sc; - sc = rtems_task_start(id, entry, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( id, entry, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void create_sema(rtems_id *id) +static void create_sema( rtems_id *id ) { rtems_status_code sc; sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, 0, id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void obtain_sema(rtems_id id) +static void obtain_sema( rtems_id id ) { rtems_status_code sc; - sc = rtems_semaphore_obtain(id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void inversion_task(rtems_task_argument arg) +static void inversion_task( rtems_task_argument arg ) { (void) arg; - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void mid_task(rtems_task_argument arg) +static void mid_task( rtems_task_argument arg ) { (void) arg; test_context *ctx = &test_instance; - obtain_sema(ctx->sem_b); - obtain_sema(ctx->sem_a); + obtain_sema( ctx->sem_b ); + obtain_sema( ctx->sem_a ); } -static void high_task(rtems_task_argument arg) +static void high_task( rtems_task_argument arg ) { (void) arg; test_context *ctx = &test_instance; - start_task(ctx->inversion, inversion_task); - obtain_sema(ctx->sem_b); + start_task( ctx->inversion, inversion_task ); + obtain_sema( ctx->sem_b ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -136,37 +136,37 @@ static void Init(rtems_task_argument arg) ctx->low = rtems_task_self(); - create_task(&ctx->mid, 3); - create_task(&ctx->high, 1); - create_task(&ctx->inversion, 2); - create_sema(&ctx->sem_a); - create_sema(&ctx->sem_b); + create_task( &ctx->mid, 3 ); + create_task( &ctx->high, 1 ); + create_task( &ctx->inversion, 2 ); + create_sema( &ctx->sem_a ); + create_sema( &ctx->sem_b ); - obtain_sema(ctx->sem_a); - start_task(ctx->mid, mid_task); - start_task(ctx->high, high_task); + obtain_sema( ctx->sem_a ); + start_task( ctx->mid, mid_task ); + start_task( ctx->high, high_task ); /* * Here we see that the priority of the high priority task blocked on * semaphore B propagated to the low priority task owning semaphore A * on which the owner of semaphore B depends. */ - assert_prio(ctx->low, 1); - assert_prio(ctx->mid, 1); - assert_prio(ctx->high, 1); - assert_prio(ctx->inversion, 2); + assert_prio( ctx->low, 1 ); + assert_prio( ctx->mid, 1 ); + assert_prio( ctx->high, 1 ); + assert_prio( ctx->inversion, 2 ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_INIT_TASK_PRIORITY 4 +#define CONFIGURE_INIT_TASK_PRIORITY 4 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spsem_err01/init.c b/testsuites/sptests/spsem_err01/init.c index 599bf2ef50..b6ea8045ff 100644 --- a/testsuites/sptests/spsem_err01/init.c +++ b/testsuites/sptests/spsem_err01/init.c @@ -33,23 +33,21 @@ #define CONFIGURE_INIT #include "system.h" -#define MESSAGE_SIZE (sizeof(long) * 4) +#define MESSAGE_SIZE ( sizeof( long ) * 4 ) const char rtems_test_name[] = "SP SEMAPHORE ERROR 01"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code status; TEST_BEGIN(); - - Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); - Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); - Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); /* release overflow */ status = rtems_semaphore_create( @@ -59,11 +57,7 @@ rtems_task Init( 0, &Semaphore_id[ 1 ] ); - fatal_directive_status( - status, - RTEMS_SUCCESSFUL, - "rtems_semaphore_create" - ); + fatal_directive_status( status, RTEMS_SUCCESSFUL, "rtems_semaphore_create" ); puts( "TA1 - rtems_semaphore_create - RTEMS_SUCCESSFUL" ); status = rtems_semaphore_release( Semaphore_id[ 1 ] ); fatal_directive_status( @@ -73,11 +67,7 @@ rtems_task Init( ); puts( "TA1 - rtems_semaphore_release - RTEMS_UNSATISFIED" ); status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); - fatal_directive_status( - status, - RTEMS_SUCCESSFUL, - "rtems_semaphore_delete" - ); + fatal_directive_status( status, RTEMS_SUCCESSFUL, "rtems_semaphore_delete" ); puts( "TA1 - rtems_semaphore_delete - RTEMS_SUCCESSFUL" ); /* invalid name */ @@ -132,14 +122,14 @@ rtems_task Init( puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" ); do { - status = rtems_semaphore_create( - Semaphore_name[ 3 ], - 1, - RTEMS_DEFAULT_ATTRIBUTES, - RTEMS_NO_PRIORITY, - &Junk_id - ); - } while (status == RTEMS_SUCCESSFUL); + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + RTEMS_NO_PRIORITY, + &Junk_id + ); + } while ( status == RTEMS_SUCCESSFUL ); fatal_directive_status( status, @@ -160,7 +150,9 @@ rtems_task Init( RTEMS_NOT_DEFINED, "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY" ); - puts( "TA1 - rtems_semaphore_create - FIFO and inherit - RTEMS_NOT_DEFINED" ); + puts( + "TA1 - rtems_semaphore_create - FIFO and inherit - RTEMS_NOT_DEFINED" + ); status = rtems_semaphore_create( Semaphore_name[ 1 ], @@ -174,13 +166,15 @@ rtems_task Init( RTEMS_NOT_DEFINED, "rtems_semaphore_create of RTEMS_FIFO RTEMS_CEILING_PRIORITY" ); - puts( "TA1 - rtems_semaphore_create - FIFO and ceiling - RTEMS_NOT_DEFINED" ); + puts( + "TA1 - rtems_semaphore_create - FIFO and ceiling - RTEMS_NOT_DEFINED" + ); status = rtems_semaphore_create( Semaphore_name[ 1 ], 1, - RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY_CEILING | - RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY, + RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY_CEILING | RTEMS_BINARY_SEMAPHORE | + RTEMS_PRIORITY, 10, &Junk_id ); @@ -190,7 +184,8 @@ rtems_task Init( "rtems_semaphore_create of binary with ceiling and inherit" ); puts( - "TA1 - rtems_semaphore_create - ceiling and inherit - RTEMS_NOT_DEFINED" ); + "TA1 - rtems_semaphore_create - ceiling and inherit - RTEMS_NOT_DEFINED" + ); status = rtems_semaphore_create( Semaphore_name[ 1 ], diff --git a/testsuites/sptests/spsem_err01/system.h b/testsuites/sptests/spsem_err01/system.h index 3b3386bafa..a0a9e9743f 100644 --- a/testsuites/sptests/spsem_err01/system.h +++ b/testsuites/sptests/spsem_err01/system.h @@ -35,49 +35,47 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spsem_err02/init.c b/testsuites/sptests/spsem_err02/init.c index 3ef6857924..7fd0572d3e 100644 --- a/testsuites/sptests/spsem_err02/init.c +++ b/testsuites/sptests/spsem_err02/init.c @@ -35,19 +35,17 @@ const char rtems_test_name[] = "SP SEMAPHORE ERROR 02"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code status; - + TEST_BEGIN(); - - Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); - Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); status = rtems_task_create( Task_name[ 2 ], @@ -59,10 +57,10 @@ rtems_task Init( ); directive_failed( status, "rtems_task_create of TA2" ); puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" ); - + puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" ); status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); - directive_failed( status, "rtems_task_start of TA2" ); + directive_failed( status, "rtems_task_start of TA2" ); /* OK */ status = rtems_semaphore_create( @@ -160,20 +158,22 @@ rtems_task Init( RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); - directive_failed( status, "rtems_semaphore_obtain"); + directive_failed( status, "rtems_semaphore_obtain" ); - puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" ); + puts( + "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" + ); status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); fatal_directive_status( - status, - RTEMS_RESOURCE_IN_USE, - "rtems_semaphore_delete of SM2" + status, + RTEMS_RESOURCE_IN_USE, + "rtems_semaphore_delete of SM2" ); puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after (yield)" ); - + TEST_END(); } diff --git a/testsuites/sptests/spsem_err02/system.h b/testsuites/sptests/spsem_err02/system.h index fe46365be6..bf647cb432 100644 --- a/testsuites/sptests/spsem_err02/system.h +++ b/testsuites/sptests/spsem_err02/system.h @@ -35,39 +35,35 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ diff --git a/testsuites/sptests/spsem_err02/task2.c b/testsuites/sptests/spsem_err02/task2.c index 2b9b5fe5c1..68ee1bf520 100644 --- a/testsuites/sptests/spsem_err02/task2.c +++ b/testsuites/sptests/spsem_err02/task2.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/spsignal_err01/init.c b/testsuites/sptests/spsignal_err01/init.c index 4f46dd8e43..da6ce43c54 100644 --- a/testsuites/sptests/spsignal_err01/init.c +++ b/testsuites/sptests/spsignal_err01/init.c @@ -35,9 +35,7 @@ const char rtems_test_name[] = "SP SIGNAL ERROR 01"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/spsignal_err01/isr.c b/testsuites/sptests/spsignal_err01/isr.c index a397d6967e..ccc9d54846 100644 --- a/testsuites/sptests/spsignal_err01/isr.c +++ b/testsuites/sptests/spsignal_err01/isr.c @@ -40,9 +40,7 @@ #include "system.h" -rtems_isr Service_routine( - rtems_vector_number ignored -) +rtems_isr Service_routine( rtems_vector_number ignored ) { (void) ignored; } diff --git a/testsuites/sptests/spsignal_err01/system.h b/testsuites/sptests/spsignal_err01/system.h index af1bac365b..cfbc4f07ea 100644 --- a/testsuites/sptests/spsignal_err01/system.h +++ b/testsuites/sptests/spsignal_err01/system.h @@ -35,51 +35,47 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_isr Service_routine( - rtems_vector_number ignored -); +rtems_isr Service_routine( rtems_vector_number ignored ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ TEST_EXTERN rtems_name Semaphore_name[ 4 ]; /* array of semaphore names */ TEST_EXTERN rtems_id Semaphore_id[ 4 ]; /* array of semaphore ids */ -TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ -TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ +TEST_EXTERN rtems_name Queue_name[ 3 ]; /* array of queue names */ +TEST_EXTERN rtems_id Queue_id[ 3 ]; /* array of queue ids */ -TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ -TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ +TEST_EXTERN rtems_name Port_name[ 2 ]; /* array of port names */ +TEST_EXTERN rtems_id Port_id[ 2 ]; /* array of port ids */ -TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ -TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ +TEST_EXTERN rtems_name Period_name[ 2 ]; /* array of period names */ +TEST_EXTERN rtems_id Period_id[ 2 ]; /* array of period ids */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ #define Internal_port_area (void *) 0x00001000 #define External_port_area (void *) 0x00002000 diff --git a/testsuites/sptests/spsimplesched01/init.c b/testsuites/sptests/spsimplesched01/init.c index a715b3414b..7fc2dde61b 100644 --- a/testsuites/sptests/spsimplesched01/init.c +++ b/testsuites/sptests/spsimplesched01/init.c @@ -35,31 +35,29 @@ const char rtems_test_name[] = "SPSIMPLESCHED 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Test_task(rtems_task_argument unused); +rtems_task Init( rtems_task_argument argument ); +rtems_task Test_task( rtems_task_argument unused ); /* * Keep the names and IDs in global variables so another task can use them. */ -rtems_id Task_id[ 4 ]; /* array of task ids */ -rtems_name Task_name[ 4 ]; /* array of task names */ +rtems_id Task_id[ 4 ]; /* array of task ids */ +rtems_name Task_name[ 4 ]; /* array of task names */ -rtems_task Test_task( - rtems_task_argument unused -) +rtems_task Test_task( rtems_task_argument unused ) { (void) unused; - rtems_id tid; - rtems_time_of_day time; - uint32_t task_index; - rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + uint32_t task_index; + rtems_status_code status; status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "task ident" ); task_index = task_number( tid ); - for ( ; ; ) { + for ( ;; ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "clock get tod" ); if ( time.second >= 35 ) { @@ -75,9 +73,7 @@ rtems_task Test_task( } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -87,13 +83,13 @@ rtems_task Init( TEST_BEGIN(); - time.year = 1988; - time.month = 12; - time.day = 31; - time.hour = 9; + time.year = 1988; + time.month = 12; + time.day = 31; + time.hour = 9; time.minute = 0; time.second = 0; - time.ticks = 0; + time.ticks = 0; status = rtems_clock_set( &time ); @@ -102,20 +98,32 @@ rtems_task Init( Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); status = rtems_task_create( - Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); directive_failed( status, "create 1" ); status = rtems_task_create( - Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); directive_failed( status, "create 2" ); status = rtems_task_create( - Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] + Task_name[ 3 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] ); directive_failed( status, "create 3" ); @@ -130,11 +138,11 @@ rtems_task Init( status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); directive_failed( status, "start 3" ); - status = rtems_task_set_priority( Task_id[1], 2, &old ); + status = rtems_task_set_priority( Task_id[ 1 ], 2, &old ); directive_failed( status, "set priority 1" ); - status = rtems_task_set_priority( Task_id[2], 2, &old ); + status = rtems_task_set_priority( Task_id[ 2 ], 2, &old ); directive_failed( status, "set priority 2" ); - status = rtems_task_set_priority( Task_id[3], 2, &old ); + status = rtems_task_set_priority( Task_id[ 3 ], 2, &old ); directive_failed( status, "set priority 3" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); @@ -150,13 +158,13 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 4 +#define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spsimplesched02/init.c b/testsuites/sptests/spsimplesched02/init.c index 8bae13bb50..2598a26b8d 100644 --- a/testsuites/sptests/spsimplesched02/init.c +++ b/testsuites/sptests/spsimplesched02/init.c @@ -37,22 +37,20 @@ const char rtems_test_name[] = "SPSIMPLESCHED 2"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -rtems_task Test_task(rtems_task_argument argument); -void ObtainRelease(bool suspendIdle); +rtems_task Init( rtems_task_argument argument ); +rtems_task Test_task( rtems_task_argument argument ); +void ObtainRelease( bool suspendIdle ); /* * Keep the names and IDs in global variables so another task can use them. */ rtems_id Idle_id; -rtems_id Task_id[ 3 ]; /* array of task ids */ -rtems_name Task_name[ 3 ]; /* array of task names */ +rtems_id Task_id[ 3 ]; /* array of task ids */ +rtems_name Task_name[ 3 ]; /* array of task names */ rtems_name Semaphore_name[ 2 ]; rtems_id Semaphore_id[ 2 ]; -rtems_task Test_task( - rtems_task_argument unused -) +rtems_task Test_task( rtems_task_argument unused ) { (void) unused; @@ -62,7 +60,7 @@ rtems_task Test_task( status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "wake after" ); - for ( ; ; ) { + for ( ;; ) { status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "yield" ); } @@ -70,37 +68,39 @@ rtems_task Test_task( void ObtainRelease( bool suspendIdle ) { - rtems_status_code status; + rtems_status_code status; - if (suspendIdle) { - puts( "INIT - Suspend Idle Task"); + if ( suspendIdle ) { + puts( "INIT - Suspend Idle Task" ); status = rtems_task_suspend( Idle_id ); directive_failed( status, "rtems_task_suspend idle" ); } puts( "INIT - Obtain priority ceiling semaphore - priority increases" ); - status= rtems_semaphore_obtain( Semaphore_id[1], RTEMS_DEFAULT_OPTIONS, 0 ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + 0 + ); directive_failed( status, "rtems_semaphore_obtain" ); puts( "INIT - Obtain priority ceiling semaphore - priority decreases" ); - status = rtems_semaphore_release( Semaphore_id[1] ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); directive_failed( status, "rtems_semaphore_release" ); - if (suspendIdle) { - puts( "INIT - Resume Idle Task"); + if ( suspendIdle ) { + puts( "INIT - Resume Idle Task" ); status = rtems_task_resume( Idle_id ); directive_failed( status, "rtems_task_resume idle" ); } } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - Status_Control score_status; + rtems_status_code status; + Status_Control score_status; TEST_BEGIN(); @@ -135,8 +135,12 @@ rtems_task Init( puts( "INIT - create task 1" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); status = rtems_task_create( - Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] + Task_name[ 1 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); ObtainRelease( false ); @@ -148,8 +152,12 @@ rtems_task Init( puts( "INIT - create task 2" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '2', ' ' ); status = rtems_task_create( - Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] + Task_name[ 2 ], + 1, + RTEMS_MINIMUM_STACK_SIZE * 2, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] ); status = rtems_task_start( Task_id[ 2 ], Test_task, 1 ); ObtainRelease( false ); @@ -161,7 +169,7 @@ rtems_task Init( /* End the Test */ TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -170,17 +178,17 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 3 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE ) -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT -#define CONFIGURE_INIT_TASK_PRIORITY 4 +#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT +#define CONFIGURE_INIT_TASK_PRIORITY 4 #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spsimplesched03/init.c b/testsuites/sptests/spsimplesched03/init.c index 455b86d71c..d90287d30d 100644 --- a/testsuites/sptests/spsimplesched03/init.c +++ b/testsuites/sptests/spsimplesched03/init.c @@ -35,20 +35,18 @@ const char rtems_test_name[] = "SPSIMPLESCHED 3"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; + rtems_status_code status; TEST_BEGIN(); - puts( "INIT - rtems timer initiate server"); - status = rtems_timer_initiate_server( + puts( "INIT - rtems timer initiate server" ); + status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES @@ -57,7 +55,7 @@ rtems_task Init( /* End the Test */ TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -65,11 +63,11 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_INIT_TASK_PRIORITY 2 +#define CONFIGURE_INIT_TASK_PRIORITY 2 #define CONFIGURE_INIT #include diff --git a/testsuites/sptests/spsize/getint.c b/testsuites/sptests/spsize/getint.c index 166f64f4e5..4a1e271a9f 100644 --- a/testsuites/sptests/spsize/getint.c +++ b/testsuites/sptests/spsize/getint.c @@ -47,8 +47,8 @@ int getint( void ); int getint( void ) { - char buff[16]; + char buff[ 16 ]; - gets(buff); - return atoi(buff); + gets( buff ); + return atoi( buff ); } diff --git a/testsuites/sptests/spsize/init.c b/testsuites/sptests/spsize/init.c index 4eb3ca843b..7362f75d6c 100644 --- a/testsuites/sptests/spsize/init.c +++ b/testsuites/sptests/spsize/init.c @@ -51,23 +51,21 @@ const char rtems_test_name[] = "SPSIZE"; void size_rtems( int mode ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; -#if defined(HAVE_MENU) +#if defined( HAVE_MENU ) int choice = 0; #endif - setvbuf(stdout, 0, _IONBF, 0); + setvbuf( stdout, 0, _IONBF, 0 ); TEST_BEGIN(); size_rtems( 1 ); TEST_END(); rtems_test_exit( 0 ); -#if defined(HAVE_MENU) +#if defined( HAVE_MENU ) do { printf( "\n\nPlease select program mode:\n" ); printf( " 1) Print Formulas\n" ); @@ -76,11 +74,17 @@ rtems_task Init( printf( "Enter number of choice (1,2,3) : " ); choice = getint(); - switch( choice ) { - case 1: size_rtems( 1 ); break; - case 2: size_rtems( 0 ); break; - case 3: rtems_test_exit( 0 ); - default: continue; + switch ( choice ) { + case 1: + size_rtems( 1 ); + break; + case 2: + size_rtems( 0 ); + break; + case 3: + rtems_test_exit( 0 ); + default: + continue; } } while ( FOREVER ); #endif diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c index c353f3bd5d..4753db5955 100644 --- a/testsuites/sptests/spsize/size.c +++ b/testsuites/sptests/spsize/size.c @@ -52,7 +52,7 @@ #include #include #include -#if defined(RTEMS_MULTIPROCESSING) +#if defined( RTEMS_MULTIPROCESSING ) #include #include #endif @@ -70,7 +70,7 @@ #include #include #include -#if defined(RTEMS_SMP) +#if defined( RTEMS_SMP ) #include #endif @@ -82,19 +82,18 @@ #include "system.h" /* external function prototypes */ -int getint( void ); -void size_rtems(int mode); -void help_size(void); -void print_formula(void); - +int getint( void ); +void size_rtems( int mode ); +void help_size( void ); +void print_formula( void ); /* These are always defined by the executive. * * #include * #include */ -#define HEAP_OVHD 16 /* wasted heap space per task stack */ -#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ +#define HEAP_OVHD 16 /* wasted heap space per task stack */ +#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ /* * This assumes the default Priority Scheduler @@ -105,72 +104,63 @@ void print_formula(void); /* Priority scheduling per-thread consumption. Gets * included in the PER_TASK consumption. */ -#define SCHEDULER_TASK_WKSP (sizeof(Scheduler_priority_Node)) +#define SCHEDULER_TASK_WKSP ( sizeof( Scheduler_priority_Node ) ) /* Priority scheduling workspace consumption * * Include allocation of ready queue. */ -#define SCHEDULER_WKSP_SIZE \ - (sizeof(Scheduler_priority_Context) + \ - RTEMS_MAXIMUM_PRIORITY * sizeof(Chain_Control )) +#define SCHEDULER_WKSP_SIZE \ + ( sizeof( Scheduler_priority_Context ) + \ + RTEMS_MAXIMUM_PRIORITY * sizeof( Chain_Control ) ) /****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/ -#define PER_TASK \ - (long) (sizeof (Thread_Control) + \ - NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ) + \ - SCHEDULER_TASK_WKSP ) -#define PER_SEMAPHORE \ - (long) (sizeof (Semaphore_Control) + NAME_PTR_SIZE) -#define PER_TIMER \ - (long) (sizeof (Timer_Control) + NAME_PTR_SIZE) -#define PER_MSGQ \ - (long) (sizeof (Message_queue_Control) + NAME_PTR_SIZE) -#define PER_REGN \ - (long) (sizeof (Region_Control) + NAME_PTR_SIZE) -#define PER_PART \ - (long) (sizeof (Partition_Control) + NAME_PTR_SIZE) -#define PER_PERIOD \ - (long) (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE) -#define PER_PORT \ - (long) (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) -#define PER_EXTENSION \ - (long) (sizeof (Extension_Control) + NAME_PTR_SIZE) +#define PER_TASK \ + (long) ( sizeof( Thread_Control ) + NAME_PTR_SIZE + HEAP_OVHD + \ + sizeof( RTEMS_API_Control ) + SCHEDULER_TASK_WKSP ) +#define PER_SEMAPHORE (long) ( sizeof( Semaphore_Control ) + NAME_PTR_SIZE ) +#define PER_TIMER (long) ( sizeof( Timer_Control ) + NAME_PTR_SIZE ) +#define PER_MSGQ (long) ( sizeof( Message_queue_Control ) + NAME_PTR_SIZE ) +#define PER_REGN (long) ( sizeof( Region_Control ) + NAME_PTR_SIZE ) +#define PER_PART (long) ( sizeof( Partition_Control ) + NAME_PTR_SIZE ) +#define PER_PERIOD (long) ( sizeof( Rate_monotonic_Control ) + NAME_PTR_SIZE ) +#define PER_PORT \ + (long) ( sizeof( Dual_ported_memory_Control ) + NAME_PTR_SIZE ) +#define PER_EXTENSION (long) ( sizeof( Extension_Control ) + NAME_PTR_SIZE ) -#define PER_DRV (long) (0) -#define PER_FPTASK (long) (CONTEXT_FP_SIZE) -#define PER_GOBTBL (long) (sizeof (Chain_Control)*4) -#define PER_NODE (long) PER_GOBTBL -#if defined(RTEMS_MULTIPROCESSING) -#define PER_GOBJECT (long) (sizeof (Objects_MP_Control)) +#define PER_DRV (long) ( 0 ) +#define PER_FPTASK (long) ( CONTEXT_FP_SIZE ) +#define PER_GOBTBL (long) ( sizeof( Chain_Control ) * 4 ) +#define PER_NODE (long) PER_GOBTBL +#if defined( RTEMS_MULTIPROCESSING ) +#define PER_GOBJECT (long) ( sizeof( Objects_MP_Control ) ) #else -#define PER_GOBJECT (long) 0 +#define PER_GOBJECT (long) 0 #endif -#define PER_PROXY (long) (sizeof (Thread_Proxy_control)) +#define PER_PROXY (long) ( sizeof( Thread_Proxy_control ) ) -#if !defined(RTEMS_MULTIPROCESSING) || (CPU_ALL_TASKS_ARE_FP != TRUE) +#if !defined( RTEMS_MULTIPROCESSING ) || ( CPU_ALL_TASKS_ARE_FP != TRUE ) #define MPCI_RECEIVE_SERVER_FP (long) 0 #else -#define MPCI_RECEIVE_SERVER_FP (long) (sizeof( Context_Control_fp )) +#define MPCI_RECEIVE_SERVER_FP (long) ( sizeof( Context_Control_fp ) ) #endif -#if (CPU_IDLE_TASK_IS_FP == TRUE) -#define SYSTEM_IDLE_FP (long) (sizeof( Context_Control_fp )) +#if ( CPU_IDLE_TASK_IS_FP == TRUE ) +#define SYSTEM_IDLE_FP (long) ( sizeof( Context_Control_fp ) ) #else #define SYSTEM_IDLE_FP (long) 0 #endif -#if !defined(RTEMS_MULTIPROCESSING) +#if !defined( RTEMS_MULTIPROCESSING ) #define MPCI_RECEIVE_SERVER_STACK_SIZE 0 #endif -#if defined(RTEMS_MULTIPROCESSING) -#define MPCI_RECEIVE_SERVER_STACK_SIZE \ +#if defined( RTEMS_MULTIPROCESSING ) +#define MPCI_RECEIVE_SERVER_STACK_SIZE -#define MP_SYSTEM_TASKS \ - (STACK_MINIMUM_SIZE + CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \ - sizeof(Thread_Control) + \ - MPCI_RECEIVE_SERVER_FP) +#define MP_SYSTEM_TASKS \ + ( STACK_MINIMUM_SIZE + CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \ + sizeof( Thread_Control ) + MPCI_RECEIVE_SERVER_FP ) extern CORE_semaphore_Control _MPCI_Semaphore; #else @@ -181,21 +171,19 @@ extern CORE_semaphore_Control _MPCI_Semaphore; * Idle and the MPCI Receive Server Threads */ -#define SYSTEM_TASKS \ - (STACK_MINIMUM_SIZE + sizeof(Thread_Control) + SYSTEM_IDLE_FP + \ - MP_SYSTEM_TASKS) +#define SYSTEM_TASKS \ + ( STACK_MINIMUM_SIZE + sizeof( Thread_Control ) + SYSTEM_IDLE_FP + \ + MP_SYSTEM_TASKS ) /* FIXME: uint32_t doesn't seem right */ -uint32_t sys_req; +uint32_t sys_req; -void size_rtems( - int mode -) +void size_rtems( int mode ) { -int uninitialized = 0; -int initialized = 0; + int uninitialized = 0; + int initialized = 0; -/* + /* * The following data is allocated for each Manager: * * + Per Manager Object Information @@ -245,421 +233,495 @@ int initialized = 0; * The following calculates the overhead needed by RTEMS from the * Workspace Area. */ -sys_req = SYSTEM_TASKS + /* MPCI Receive Server and IDLE */ - NAME_PTR_SIZE + /* Task Overhead */ - SCHEDULER_WKSP_SIZE + /* Scheduler Overhead */ - NAME_PTR_SIZE + /* Timer Overhead */ - NAME_PTR_SIZE + /* Semaphore Overhead */ - NAME_PTR_SIZE + /* Message Queue Overhead */ - NAME_PTR_SIZE + /* Region Overhead */ - NAME_PTR_SIZE + /* Partition Overhead */ - NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ - NAME_PTR_SIZE + /* Rate Monotonic Overhead */ - NAME_PTR_SIZE + /* Extension Overhead */ - PER_NODE; /* Extra Gobject Table */ + sys_req = SYSTEM_TASKS + /* MPCI Receive Server and IDLE */ + NAME_PTR_SIZE + /* Task Overhead */ + SCHEDULER_WKSP_SIZE + /* Scheduler Overhead */ + NAME_PTR_SIZE + /* Timer Overhead */ + NAME_PTR_SIZE + /* Semaphore Overhead */ + NAME_PTR_SIZE + /* Message Queue Overhead */ + NAME_PTR_SIZE + /* Region Overhead */ + NAME_PTR_SIZE + /* Partition Overhead */ + NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ + NAME_PTR_SIZE + /* Rate Monotonic Overhead */ + NAME_PTR_SIZE + /* Extension Overhead */ + PER_NODE; /* Extra Gobject Table */ -uninitialized = -/*address.h*/ 0 + + uninitialized = + /*address.h*/ 0 + -/*asr.h*/ 0 + + /*asr.h*/ 0 + -/*attr.h*/ 0 + + /*attr.h*/ 0 + -/*bitfield.h*/ 0 + + /*bitfield.h*/ 0 + -/*chain.h*/ 0 + + /*chain.h*/ 0 + -/*clock.h*/ 0 + + /*clock.h*/ 0 + -/*config.h*/ 0 + + /*config.h*/ 0 + -/*context.h*/ (sizeof _Thread_Dispatch_necessary) + + /*context.h*/ ( sizeof _Thread_Dispatch_necessary ) + -/*copyrt.h*/ 0 + + /*copyrt.h*/ 0 + -/*dpmemimpl.h*/ (sizeof _Dual_ported_memory_Information) + + /*dpmemimpl.h*/ ( sizeof _Dual_ported_memory_Information ) + -#if defined(RTEMS_MULTIPROCESSING) -/*eventmp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*eventmp.h*/ 0 + #endif -/*extensionimpl.h*/ (sizeof _Extension_Information) + + /*extensionimpl.h*/ ( sizeof _Extension_Information ) + -/*fatal.h*/ 0 + + /*fatal.h*/ 0 + -/*heap.h*/ 0 + + /*heap.h*/ 0 + -/*init.h*/ 0 + + /*init.h*/ 0 + -/*intr.h*/ 0 + + /*intr.h*/ 0 + -/*isr.h*/ (sizeof _ISR_Nest_level) + -#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE) - (sizeof _ISR_Vector_table) + + /*isr.h*/ ( sizeof _ISR_Nest_level ) + +#if ( CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE ) + ( sizeof _ISR_Vector_table ) + #endif -/*messageimpl.h*/ (sizeof _Message_queue_Information) + + /*messageimpl.h*/ ( sizeof _Message_queue_Information ) + -/*modes.h*/ 0 + + /*modes.h*/ 0 + -#if defined(RTEMS_MULTIPROCESSING) -/*mp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*mp.h*/ 0 + #endif -#if defined(RTEMS_MULTIPROCESSING) -/*mpciimpl.h*/ (sizeof _MPCI_Remote_blocked_threads) + - (sizeof _MPCI_Semaphore) + - (sizeof _MPCI_table) + - (sizeof _MPCI_Receive_server_tcb) + - (sizeof _MPCI_Packet_processors) + +#if defined( RTEMS_MULTIPROCESSING ) + /*mpciimpl.h*/ ( sizeof _MPCI_Remote_blocked_threads ) + + ( sizeof _MPCI_Semaphore ) + ( sizeof _MPCI_table ) + + ( sizeof _MPCI_Receive_server_tcb ) + ( sizeof _MPCI_Packet_processors ) + #endif -#if defined(RTEMS_MULTIPROCESSING) -/*mppkt.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*mppkt.h*/ 0 + #endif -#if defined(RTEMS_MULTIPROCESSING) -/*mptables.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*mptables.h*/ 0 + #endif -#if defined(RTEMS_MULTIPROCESSING) -/*msgmp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*msgmp.h*/ 0 + #endif -/*object.h*/ (sizeof _Objects_Local_node) + - (sizeof _Objects_Maximum_nodes) + - (sizeof _Objects_Information_table) + + /*object.h*/ ( sizeof _Objects_Local_node ) + + ( sizeof _Objects_Maximum_nodes ) + ( sizeof _Objects_Information_table ) + -/*options.h*/ 0 + + /*options.h*/ 0 + -/*partimpl.h*/ (sizeof _Partition_Information) + + /*partimpl.h*/ ( sizeof _Partition_Information ) + -#if defined(RTEMS_MULTIPROCESSING) -/*partmp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*partmp.h*/ 0 + #endif -/*percpu.h*/ (_SMP_Get_processor_maximum() * sizeof(Per_CPU_Control)) + + /*percpu.h*/ ( _SMP_Get_processor_maximum() * sizeof( Per_CPU_Control ) ) + -/*ratemonimpl.h*/ (sizeof _Rate_monotonic_Information) + + /*ratemonimpl.h*/ ( sizeof _Rate_monotonic_Information ) + -/*regionimpl.h*/ (sizeof _Region_Information) + + /*regionimpl.h*/ ( sizeof _Region_Information ) + -#if defined(RTEMS_MULTIPROCESSING) -/*regionmp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*regionmp.h*/ 0 + #endif -/*rtems.h*/ /* Not applicable */ + /*rtems.h*/ /* Not applicable */ -/*semimpl.h*/ (sizeof _Semaphore_Information) + + /*semimpl.h*/ ( sizeof _Semaphore_Information ) + -#if defined(RTEMS_MULTIPROCESSING) -/*semmp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*semmp.h*/ 0 + #endif -/*signal.h*/ 0 + + /*signal.h*/ 0 + -/*signalmp.h*/ 0 + + /*signalmp.h*/ 0 + -/*stack.h*/ 0 + + /*stack.h*/ 0 + -/*states.h*/ 0 + + /*states.h*/ 0 + -/*status.h*/ 0 + + /*status.h*/ 0 + -/*sysstate.h*/ (sizeof _System_state_Current) + -#if defined(RTEMS_MULTIPROCESSING) - (sizeof _System_state_Is_multiprocessing) + + /*sysstate.h*/ ( sizeof _System_state_Current ) + +#if defined( RTEMS_MULTIPROCESSING ) + ( sizeof _System_state_Is_multiprocessing ) + #endif -#if defined(RTEMS_MULTIPROCESSING) -/*taskmp.h*/ 0 + +#if defined( RTEMS_MULTIPROCESSING ) + /*taskmp.h*/ 0 + #endif -/*tasksimpl.h*/ (sizeof _RTEMS_tasks_Information) + + /*tasksimpl.h*/ ( sizeof _RTEMS_tasks_Information ) + -/*thread.h*/ (sizeof _Thread_Dispatch_disable_level) + - (sizeof _Thread_Executing) + - (sizeof _Thread_Heir) + -#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1) - (sizeof _Thread_Allocated_fp) + + /*thread.h*/ ( sizeof _Thread_Dispatch_disable_level ) + + ( sizeof _Thread_Executing ) + ( sizeof _Thread_Heir ) + +#if ( CPU_HARDWARE_FP == 1 ) || ( CPU_SOFTWARE_FP == 1 ) + ( sizeof _Thread_Allocated_fp ) + #endif - (sizeof _Thread_Information) + + ( sizeof _Thread_Information ) + -/*threadq.h*/ + /*threadq.h*/ -/*timerimpl.h*/ (sizeof _Timer_Information) + + /*timerimpl.h*/ ( sizeof _Timer_Information ) + -/*tqdata.h*/ 0 + + /*tqdata.h*/ 0 + -/*types.h*/ 0 + + /*types.h*/ 0 + -/*userext.h*/ (sizeof _User_extensions_List) + + /*userext.h*/ ( sizeof _User_extensions_List ) + -/*watchdog.h*/ (sizeof _Watchdog_Ticks_since_boot) + + /*watchdog.h*/ ( sizeof _Watchdog_Ticks_since_boot ) + -/*wkspace.h*/ (sizeof _Workspace_Area); + /*wkspace.h*/ ( sizeof _Workspace_Area ); -#ifndef unix /* make sure this is not a native compile */ +#ifndef unix /* make sure this is not a native compile */ #ifdef __i386__ -/* cpu.h */ -uninitialized += (sizeof _CPU_Null_fp_context); + /* cpu.h */ + uninitialized += ( sizeof _CPU_Null_fp_context ); -uninitialized += (sizeof _CPU_Interrupt_stack_low) + - (sizeof _CPU_Interrupt_stack_high); + uninitialized += ( sizeof _CPU_Interrupt_stack_low ) + + ( sizeof _CPU_Interrupt_stack_high ); #endif #ifdef __mc68000__ -/* cpu.h */ -uninitialized += (sizeof _CPU_Interrupt_stack_low) + - (sizeof _CPU_Interrupt_stack_high); + /* cpu.h */ + uninitialized += ( sizeof _CPU_Interrupt_stack_low ) + + ( sizeof _CPU_Interrupt_stack_high ); #endif #ifdef __sparc__ -/* cpu.h */ -uninitialized += (sizeof _CPU_Interrupt_stack_low) + - (sizeof _CPU_Interrupt_stack_high); + /* cpu.h */ + uninitialized += ( sizeof _CPU_Interrupt_stack_low ) + + ( sizeof _CPU_Interrupt_stack_high ); #endif - #ifdef no_cpu -/* cpu.h */ -uninitialized += (sizeof _CPU_Null_fp_context) + - (sizeof _CPU_Interrupt_stack_low) + - (sizeof _CPU_Interrupt_stack_high) + - (sizeof _CPU_Thread_dispatch_pointer); + /* cpu.h */ + uninitialized += ( sizeof _CPU_Null_fp_context ) + + ( sizeof _CPU_Interrupt_stack_low ) + + ( sizeof _CPU_Interrupt_stack_high ) + + ( sizeof _CPU_Thread_dispatch_pointer ); #endif #ifdef __PPC__ -/* cpu.h */ -uninitialized += (sizeof _CPU_Interrupt_stack_low) + - (sizeof _CPU_Interrupt_stack_high); + /* cpu.h */ + uninitialized += ( sizeof _CPU_Interrupt_stack_low ) + + ( sizeof _CPU_Interrupt_stack_high ); #endif #endif /* !unix */ -initialized += -/*copyrt.h*/ (strlen(_Copyright_Notice)+1) + - (strlen(_RTEMS_version)+1); - - + initialized += + /*copyrt.h*/ ( strlen( _Copyright_Notice ) + 1 ) + + ( strlen( _RTEMS_version ) + 1 ); #ifndef unix /* make sure this is not native */ #ifdef __sparc__ -initialized += (sizeof _CPU_Trap_slot_template); + initialized += ( sizeof _CPU_Trap_slot_template ); #endif #endif /* !unix */ -puts( "" ); + puts( "" ); - if ( mode == 0 ) help_size(); - else print_formula(); - -printf( "\n" ); -printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); -printf( "RTEMS initialized data consumes %d bytes\n", initialized ); + if ( mode == 0 ) { + help_size(); + } else { + print_formula(); + } + printf( "\n" ); + printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); + printf( "RTEMS initialized data consumes %d bytes\n", initialized ); } void help_size() { -int c = '\0'; -int break_loop; -int total_size; -int task_stacks; -int interrupt_stack; -int maximum_tasks, size_tasks; -int maximum_sems, size_sems; -int maximum_timers, size_timers; -int maximum_msgqs, size_msgqs; -int maximum_msgs, size_msgs_overhead; -int maximum_regns, size_regns; -int maximum_parts, size_parts; -int maximum_ports, size_ports; -int maximum_periods, size_periods; -int maximum_extensions, size_extensions; -int maximum_drvs, size_drvs; -int maximum_fps, size_fps; -int maximum_nodes, size_nodes; -int maximum_gobjs, size_gobjs; -int maximum_proxies, size_proxies; + int c = '\0'; + int break_loop; + int total_size; + int task_stacks; + int interrupt_stack; + int maximum_tasks, size_tasks; + int maximum_sems, size_sems; + int maximum_timers, size_timers; + int maximum_msgqs, size_msgqs; + int maximum_msgs, size_msgs_overhead; + int maximum_regns, size_regns; + int maximum_parts, size_parts; + int maximum_ports, size_ports; + int maximum_periods, size_periods; + int maximum_extensions, size_extensions; + int maximum_drvs, size_drvs; + int maximum_fps, size_fps; + int maximum_nodes, size_nodes; + int maximum_gobjs, size_gobjs; + int maximum_proxies, size_proxies; -total_size = sys_req; /* Fixed Overhead */ -printf( "What is maximum_tasks? " ); -maximum_tasks = getint(); -size_tasks = PER_TASK * maximum_tasks; -total_size += size_tasks; + total_size = sys_req; /* Fixed Overhead */ + printf( "What is maximum_tasks? " ); + maximum_tasks = getint(); + size_tasks = PER_TASK * maximum_tasks; + total_size += size_tasks; -printf( "What is maximum_semaphores? " ); -maximum_sems = getint(); -size_sems = PER_SEMAPHORE * maximum_sems; -total_size += size_sems; + printf( "What is maximum_semaphores? " ); + maximum_sems = getint(); + size_sems = PER_SEMAPHORE * maximum_sems; + total_size += size_sems; -printf( "What is maximum_timers? " ); -maximum_timers = getint(); -size_timers = PER_TIMER * maximum_timers; -total_size += size_timers; + printf( "What is maximum_timers? " ); + maximum_timers = getint(); + size_timers = PER_TIMER * maximum_timers; + total_size += size_timers; -printf( "What is maximum_message_queues? " ); -maximum_msgqs = getint(); -size_msgqs = PER_MSGQ * maximum_msgqs; -total_size += size_msgqs; + printf( "What is maximum_message_queues? " ); + maximum_msgqs = getint(); + size_msgqs = PER_MSGQ * maximum_msgqs; + total_size += size_msgqs; -printf( "What is maximum_messages? XXXX " ); -maximum_msgs = getint(); -size_msgs_overhead = 0; -total_size += size_msgs_overhead; + printf( "What is maximum_messages? XXXX " ); + maximum_msgs = getint(); + size_msgs_overhead = 0; + total_size += size_msgs_overhead; -printf( "What is maximum_regions? " ); -maximum_regns = getint(); -size_regns = PER_REGN * maximum_regns; -total_size += size_regns; + printf( "What is maximum_regions? " ); + maximum_regns = getint(); + size_regns = PER_REGN * maximum_regns; + total_size += size_regns; -printf( "What is maximum_partitions? " ); -maximum_parts = getint(); -size_parts = PER_PART * maximum_parts; -total_size += size_parts; + printf( "What is maximum_partitions? " ); + maximum_parts = getint(); + size_parts = PER_PART * maximum_parts; + total_size += size_parts; -printf( "What is maximum_ports? " ); -maximum_ports = getint(); -size_ports = PER_PORT * maximum_ports; -total_size += size_ports; + printf( "What is maximum_ports? " ); + maximum_ports = getint(); + size_ports = PER_PORT * maximum_ports; + total_size += size_ports; -printf( "What is maximum_periods? " ); -maximum_periods = getint(); -size_periods = PER_PERIOD * maximum_periods; -total_size += size_periods; + printf( "What is maximum_periods? " ); + maximum_periods = getint(); + size_periods = PER_PERIOD * maximum_periods; + total_size += size_periods; -printf( "What is maximum_extensions? " ); -maximum_extensions = getint(); -size_extensions = PER_EXTENSION * maximum_extensions; -total_size += size_extensions; + printf( "What is maximum_extensions? " ); + maximum_extensions = getint(); + size_extensions = PER_EXTENSION * maximum_extensions; + total_size += size_extensions; -printf( "What is number_of_device_drivers? " ); -maximum_drvs = getint(); -size_drvs = PER_DRV * maximum_drvs; -total_size += size_drvs; + printf( "What is number_of_device_drivers? " ); + maximum_drvs = getint(); + size_drvs = PER_DRV * maximum_drvs; + total_size += size_drvs; -printf( "What will be total stack requirement for all tasks? " ); -task_stacks = getint(); -total_size += task_stacks; + printf( "What will be total stack requirement for all tasks? " ); + task_stacks = getint(); + total_size += task_stacks; -printf( "What is the size of the interrupt stack? " ); -interrupt_stack = getint(); -total_size += interrupt_stack; + printf( "What is the size of the interrupt stack? " ); + interrupt_stack = getint(); + total_size += interrupt_stack; -printf( "How many tasks will be created with the FP flag? " ); -maximum_fps = getint(); -size_fps = PER_FPTASK * maximum_fps; -total_size += size_fps; + printf( "How many tasks will be created with the FP flag? " ); + maximum_fps = getint(); + size_fps = PER_FPTASK * maximum_fps; + total_size += size_fps; -printf( "Is this a single processor system? " ); -for ( break_loop=0 ; !break_loop; c = getchar() ) { - switch ( c ) { - case 'Y': case 'y': - case 'N': case 'n': - break_loop = 1; - break; + printf( "Is this a single processor system? " ); + for ( break_loop = 0; !break_loop; c = getchar() ) { + switch ( c ) { + case 'Y': + case 'y': + case 'N': + case 'n': + break_loop = 1; + break; + } + } + printf( "%c\n", c ); + if ( c == 'n' || c == 'N' ) { + printf( "What is maximum_nodes? " ); + maximum_nodes = getint(); + size_nodes = PER_NODE * maximum_nodes; + total_size += size_nodes; + printf( "What is maximum_global_objects? " ); + maximum_gobjs = getint(); + size_gobjs = PER_GOBJECT * maximum_gobjs; + total_size += size_gobjs; + printf( "What is maximum_proxies? " ); + maximum_proxies = getint(); + size_proxies = PER_PROXY * maximum_proxies; + total_size += size_proxies; + } else { + maximum_nodes = 0; + size_nodes = PER_NODE * 0; + maximum_gobjs = 0; + size_gobjs = PER_GOBJECT * 0; + maximum_proxies = 0; + size_proxies = PER_PROXY * 0; } -} -printf( "%c\n", c ); -if ( c == 'n' || c == 'N' ) { - printf( "What is maximum_nodes? " ); - maximum_nodes = getint(); - size_nodes = PER_NODE * maximum_nodes; - total_size += size_nodes; - printf( "What is maximum_global_objects? " ); - maximum_gobjs = getint(); - size_gobjs = PER_GOBJECT * maximum_gobjs; - total_size += size_gobjs; - printf( "What is maximum_proxies? " ); - maximum_proxies = getint(); - size_proxies = PER_PROXY * maximum_proxies; - total_size += size_proxies; -} else { - maximum_nodes = 0; - size_nodes = PER_NODE * 0; - maximum_gobjs = 0; - size_gobjs = PER_GOBJECT * 0; - maximum_proxies = 0; - size_proxies = PER_PROXY * 0; -} -printf( "\n\n" ); -printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); -printf( " Tasks - %03d * %03ld = %ld\n", - maximum_tasks, PER_TASK, (long) size_tasks ); -printf( " Semaphores - %03d * %03ld = %ld\n", - maximum_sems, PER_SEMAPHORE, (long) size_sems ); -printf( " Timers - %03d * %03ld = %ld\n", - maximum_timers, PER_TIMER, (long) size_timers ); -printf( " Msg Queues - %03d * %03ld = %ld\n", - maximum_msgqs, PER_MSGQ, (long) size_msgqs ); -printf( " Messages Overhead - %03d * %03d = %ld\n", - maximum_msgs, 0 /* PER_MSG_OVERHEAD */, (long) size_msgs_overhead ); -printf( " Regions - %03d * %03ld = %ld\n", - maximum_regns, PER_REGN, (long) size_regns); -printf( " Partitions - %03d * %03ld = %ld\n", - maximum_parts, PER_PART, (long) size_parts ); -printf( " Periods - %03d * %03ld = %ld\n", - maximum_periods, PER_PERIOD, (long) size_periods ); -printf( " Extensions - %03d * %03ld = %ld\n", - maximum_extensions, PER_EXTENSION, (long) size_extensions ); -printf( " Device Drivers - %03d * %03ld = %ld\n", - maximum_drvs, PER_DRV, (long) size_drvs ); + printf( "\n\n" ); + printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); + printf( + " Tasks - %03d * %03ld = %ld\n", + maximum_tasks, + PER_TASK, + (long) size_tasks + ); + printf( + " Semaphores - %03d * %03ld = %ld\n", + maximum_sems, + PER_SEMAPHORE, + (long) size_sems + ); + printf( + " Timers - %03d * %03ld = %ld\n", + maximum_timers, + PER_TIMER, + (long) size_timers + ); + printf( + " Msg Queues - %03d * %03ld = %ld\n", + maximum_msgqs, + PER_MSGQ, + (long) size_msgqs + ); + printf( + " Messages Overhead - %03d * %03d = %ld\n", + maximum_msgs, + 0 /* PER_MSG_OVERHEAD */, + (long) size_msgs_overhead + ); + printf( + " Regions - %03d * %03ld = %ld\n", + maximum_regns, + PER_REGN, + (long) size_regns + ); + printf( + " Partitions - %03d * %03ld = %ld\n", + maximum_parts, + PER_PART, + (long) size_parts + ); + printf( + " Periods - %03d * %03ld = %ld\n", + maximum_periods, + PER_PERIOD, + (long) size_periods + ); + printf( + " Extensions - %03d * %03ld = %ld\n", + maximum_extensions, + PER_EXTENSION, + (long) size_extensions + ); + printf( + " Device Drivers - %03d * %03ld = %ld\n", + maximum_drvs, + PER_DRV, + (long) size_drvs + ); -printf( " System Requirements - %04" PRIu32 " = %"PRIu32 "\n", - sys_req, sys_req ); + printf( + " System Requirements - %04" PRIu32 " = %" PRIu32 "\n", + sys_req, + sys_req + ); -printf( " Floating Point Tasks - %03d * %03ld = %ld\n", - maximum_fps, PER_FPTASK, (long) size_fps ); -printf( " Application Task Stacks - = %d\n", - task_stacks ); -printf( " Interrupt Stacks - = %d\n", - task_stacks ); -printf( " \n" ); -printf( " Global object tables - %03d * %03ld = %ld\n", - maximum_nodes, PER_NODE, (long) size_nodes ); -printf( " Global objects - %03d * %03ld = %ld\n", - maximum_gobjs, PER_GOBJECT, (long) size_gobjs ); -printf( " Proxies - %03d * %03ld = %ld\n", - maximum_proxies, PER_PROXY, (long) size_proxies ); -printf( "\n\n" ); -printf( " TOTAL = %d bytes\n", - total_size ); + printf( + " Floating Point Tasks - %03d * %03ld = %ld\n", + maximum_fps, + PER_FPTASK, + (long) size_fps + ); + printf( + " Application Task Stacks - = %d\n", + task_stacks + ); + printf( + " Interrupt Stacks - = %d\n", + task_stacks + ); + printf( " \n" ); + printf( + " Global object tables - %03d * %03ld = %ld\n", + maximum_nodes, + PER_NODE, + (long) size_nodes + ); + printf( + " Global objects - %03d * %03ld = %ld\n", + maximum_gobjs, + PER_GOBJECT, + (long) size_gobjs + ); + printf( + " Proxies - %03d * %03ld = %ld\n", + maximum_proxies, + PER_PROXY, + (long) size_proxies + ); + printf( "\n\n" ); + printf( + " TOTAL = %d bytes\n", + total_size + ); } void print_formula() { -printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); -printf( " Tasks - maximum_tasks * %ld\n", PER_TASK ); -printf( " Timers - maximum_timers * %ld\n", PER_TIMER ); -printf( " Semaphores - maximum_semaphores * %ld\n", PER_SEMAPHORE); -printf( " Message Queues - maximum_message_queues * %ld\n", PER_MSGQ ); -printf( " Messages -\n"); -printf( " Regions - maximum_regions * %ld\n", PER_REGN ); -printf( " Partitions - maximum_partitions * %ld\n", PER_PART ); -printf( " Ports - maximum_ports * %ld\n", PER_PORT ); -printf( " Periods - maximum_periods * %ld\n", PER_PORT ); -printf( " Extensions - maximum_extensions * %ld\n", PER_EXTENSION ); -printf( " Device Drivers - number_of_device_drivers * %ld\n", PER_DRV); -printf( " System Requirements - %" PRIu32 "\n", sys_req ); -printf( " Floating Point Tasks - FPMASK Tasks * %ld\n", PER_FPTASK ); -printf( " User's Tasks' Stacks -\n" ); -printf( " Interrupt Stack -\n" ); -printf( " \n" ); -printf( " Global object tables - maximum_nodes * %ld\n", PER_NODE ); -printf( " Global objects - maximum_global_objects * %ld\n", PER_GOBJECT ); -printf( " Proxies - maximum_proxies * %ld\n", PER_PROXY ); + printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); + printf( " Tasks - maximum_tasks * %ld\n", PER_TASK ); + printf( " Timers - maximum_timers * %ld\n", PER_TIMER ); + printf( + " Semaphores - maximum_semaphores * %ld\n", + PER_SEMAPHORE + ); + printf( " Message Queues - maximum_message_queues * %ld\n", PER_MSGQ ); + printf( " Messages -\n" ); + printf( " Regions - maximum_regions * %ld\n", PER_REGN ); + printf( " Partitions - maximum_partitions * %ld\n", PER_PART ); + printf( " Ports - maximum_ports * %ld\n", PER_PORT ); + printf( " Periods - maximum_periods * %ld\n", PER_PORT ); + printf( + " Extensions - maximum_extensions * %ld\n", + PER_EXTENSION + ); + printf( + " Device Drivers - number_of_device_drivers * %ld\n", + PER_DRV + ); + printf( " System Requirements - %" PRIu32 "\n", sys_req ); + printf( " Floating Point Tasks - FPMASK Tasks * %ld\n", PER_FPTASK ); + printf( " User's Tasks' Stacks -\n" ); + printf( " Interrupt Stack -\n" ); + printf( " \n" ); + printf( " Global object tables - maximum_nodes * %ld\n", PER_NODE ); + printf( + " Global objects - maximum_global_objects * %ld\n", + PER_GOBJECT + ); + printf( " Proxies - maximum_proxies * %ld\n", PER_PROXY ); } diff --git a/testsuites/sptests/spsize/system.h b/testsuites/sptests/spsize/system.h index 2ce14a5925..f5fb8e0040 100644 --- a/testsuites/sptests/spsize/system.h +++ b/testsuites/sptests/spsize/system.h @@ -34,13 +34,9 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Test_task( - rtems_task_argument argument -); +rtems_task Test_task( rtems_task_argument argument ); int getint( void ); @@ -49,7 +45,7 @@ int getint( void ); #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE @@ -58,7 +54,7 @@ int getint( void ); /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/spstdthreads01/init.c b/testsuites/sptests/spstdthreads01/init.c index f4fdac10f0..b4d5cce9d7 100644 --- a/testsuites/sptests/spstdthreads01/init.c +++ b/testsuites/sptests/spstdthreads01/init.c @@ -50,272 +50,270 @@ const char rtems_test_name[] = "SPSTDTHREADS 1"; #define EVENT_TSS RTEMS_EVENT_4 typedef struct { - rtems_id high; - rtems_id low; + rtems_id high; + rtems_id low; once_flag once_flag; - mtx_t mtx; - cnd_t cnd; - tss_t tss; - thrd_t thrd; - int generation; + mtx_t mtx; + cnd_t cnd; + tss_t tss; + thrd_t thrd; + int generation; } test_context; -static test_context test_instance = { - .once_flag = ONCE_FLAG_INIT -}; +static test_context test_instance = { .once_flag = ONCE_FLAG_INIT }; -static void next_generation(test_context *ctx) +static void next_generation( test_context *ctx ) { ++ctx->generation; } -static void send_event(test_context *ctx, rtems_event_set events) +static void send_event( test_context *ctx, rtems_event_set events ) { rtems_status_code sc; - sc = rtems_event_send(ctx->high, events); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( ctx->high, events ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void get_abs_timeout(struct timespec *to) +static void get_abs_timeout( struct timespec *to ) { int rv; - rv = clock_gettime(CLOCK_REALTIME, to); - rtems_test_assert(rv == 0); + rv = clock_gettime( CLOCK_REALTIME, to ); + rtems_test_assert( rv == 0 ); to->tv_nsec += 2 * US_PER_TICK * 1000; - if (to->tv_nsec >= 1000000000) { + if ( to->tv_nsec >= 1000000000 ) { ++to->tv_sec; to->tv_nsec -= 1000000000; } } -static void test_init(test_context *ctx) +static void test_init( test_context *ctx ) { int status; - status = mtx_init(&ctx->mtx, mtx_plain); - rtems_test_assert(status == thrd_success); + status = mtx_init( &ctx->mtx, mtx_plain ); + rtems_test_assert( status == thrd_success ); - status = cnd_init(&ctx->cnd); - rtems_test_assert(status == thrd_success); + status = cnd_init( &ctx->cnd ); + rtems_test_assert( status == thrd_success ); } -static void test_destroy(test_context *ctx) +static void test_destroy( test_context *ctx ) { - mtx_destroy(&ctx->mtx); - cnd_destroy(&ctx->cnd); + mtx_destroy( &ctx->mtx ); + cnd_destroy( &ctx->cnd ); } -static void once_func(void) +static void once_func( void ) { test_context *ctx = &test_instance; - next_generation(ctx); + next_generation( ctx ); } -static void test_once(test_context *ctx) +static void test_once( test_context *ctx ) { int gen = ctx->generation; - call_once(&ctx->once_flag, once_func); - rtems_test_assert(ctx->generation == gen + 1); + call_once( &ctx->once_flag, once_func ); + rtems_test_assert( ctx->generation == gen + 1 ); - call_once(&ctx->once_flag, once_func); - rtems_test_assert(ctx->generation == gen + 1); + call_once( &ctx->once_flag, once_func ); + rtems_test_assert( ctx->generation == gen + 1 ); } -static void test_mtx(test_context *ctx) +static void test_mtx( test_context *ctx ) { - mtx_t *mtx = &ctx->mtx; - int gen = ctx->generation; + mtx_t *mtx = &ctx->mtx; + int gen = ctx->generation; struct timespec to; - int status; + int status; - status = mtx_trylock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_trylock( mtx ); + rtems_test_assert( status == thrd_success ); - status = mtx_lock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_lock( mtx ); + rtems_test_assert( status == thrd_success ); - get_abs_timeout(&to); - status = mtx_timedlock(mtx, &to); - rtems_test_assert(status == thrd_success); + get_abs_timeout( &to ); + status = mtx_timedlock( mtx, &to ); + rtems_test_assert( status == thrd_success ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); - send_event(ctx, EVENT_MTX_LOCK); - rtems_test_assert(ctx->generation == gen + 1); + send_event( ctx, EVENT_MTX_LOCK ); + rtems_test_assert( ctx->generation == gen + 1 ); - status = mtx_trylock(mtx); - rtems_test_assert(status == thrd_busy); + status = mtx_trylock( mtx ); + rtems_test_assert( status == thrd_busy ); - memset(&to, 0xff, sizeof(to)); - status = mtx_timedlock(mtx, &to); - rtems_test_assert(status == thrd_error); + memset( &to, 0xff, sizeof( to ) ); + status = mtx_timedlock( mtx, &to ); + rtems_test_assert( status == thrd_error ); - get_abs_timeout(&to); - status = mtx_timedlock(mtx, &to); - rtems_test_assert(status == thrd_timedout); + get_abs_timeout( &to ); + status = mtx_timedlock( mtx, &to ); + rtems_test_assert( status == thrd_timedout ); - send_event(ctx, EVENT_MTX_UNLOCK); - rtems_test_assert(ctx->generation == gen + 2); + send_event( ctx, EVENT_MTX_UNLOCK ); + rtems_test_assert( ctx->generation == gen + 2 ); } -static void test_cnd(test_context *ctx) +static void test_cnd( test_context *ctx ) { - cnd_t *cnd = &ctx->cnd; - mtx_t *mtx = &ctx->mtx; - int gen = ctx->generation; + cnd_t *cnd = &ctx->cnd; + mtx_t *mtx = &ctx->mtx; + int gen = ctx->generation; struct timespec to; - int status; + int status; - send_event(ctx, EVENT_CND_WAIT); - rtems_test_assert(ctx->generation == gen + 1); + send_event( ctx, EVENT_CND_WAIT ); + rtems_test_assert( ctx->generation == gen + 1 ); - status = mtx_lock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_lock( mtx ); + rtems_test_assert( status == thrd_success ); - status = cnd_signal(cnd); - rtems_test_assert(status == thrd_success); + status = cnd_signal( cnd ); + rtems_test_assert( status == thrd_success ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); - rtems_test_assert(ctx->generation == gen + 2); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); + rtems_test_assert( ctx->generation == gen + 2 ); - send_event(ctx, EVENT_CND_WAIT); - rtems_test_assert(ctx->generation == gen + 3); + send_event( ctx, EVENT_CND_WAIT ); + rtems_test_assert( ctx->generation == gen + 3 ); - status = mtx_lock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_lock( mtx ); + rtems_test_assert( status == thrd_success ); - status = cnd_broadcast(cnd); - rtems_test_assert(status == thrd_success); + status = cnd_broadcast( cnd ); + rtems_test_assert( status == thrd_success ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); - rtems_test_assert(ctx->generation == gen + 4); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); + rtems_test_assert( ctx->generation == gen + 4 ); - status = mtx_lock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_lock( mtx ); + rtems_test_assert( status == thrd_success ); - memset(&to, 0xff, sizeof(to)); - status = cnd_timedwait(cnd, mtx, &to); - rtems_test_assert(status == thrd_error); + memset( &to, 0xff, sizeof( to ) ); + status = cnd_timedwait( cnd, mtx, &to ); + rtems_test_assert( status == thrd_error ); - get_abs_timeout(&to); - status = cnd_timedwait(cnd, mtx, &to); - rtems_test_assert(status == thrd_timedout); + get_abs_timeout( &to ); + status = cnd_timedwait( cnd, mtx, &to ); + rtems_test_assert( status == thrd_timedout ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); - send_event(ctx, EVENT_CND_TIMEDWAIT); - rtems_test_assert(ctx->generation == gen + 5); + send_event( ctx, EVENT_CND_TIMEDWAIT ); + rtems_test_assert( ctx->generation == gen + 5 ); - status = mtx_lock(mtx); - rtems_test_assert(status == thrd_success); + status = mtx_lock( mtx ); + rtems_test_assert( status == thrd_success ); - status = cnd_signal(cnd); - rtems_test_assert(status == thrd_success); + status = cnd_signal( cnd ); + rtems_test_assert( status == thrd_success ); - status = mtx_unlock(mtx); - rtems_test_assert(status == thrd_success); - rtems_test_assert(ctx->generation == gen + 6); + status = mtx_unlock( mtx ); + rtems_test_assert( status == thrd_success ); + rtems_test_assert( ctx->generation == gen + 6 ); } static int tss_val = TSS_DTOR_ITERATIONS; -static void tss_dtor(void *val) +static void tss_dtor( void *val ) { test_context *ctx = &test_instance; - rtems_test_assert(val == &tss_val); - next_generation(ctx); + rtems_test_assert( val == &tss_val ); + next_generation( ctx ); } -static void test_tss(test_context *ctx) +static void test_tss( test_context *ctx ) { tss_dtor_t dtor = tss_dtor; - int gen = ctx->generation; - int status; + int gen = ctx->generation; + int status; - status = tss_create(&ctx->tss, dtor); - rtems_test_assert(status == thrd_success); + status = tss_create( &ctx->tss, dtor ); + rtems_test_assert( status == thrd_success ); - send_event(ctx, EVENT_TSS); - rtems_test_assert(ctx->generation == gen + 1); + send_event( ctx, EVENT_TSS ); + rtems_test_assert( ctx->generation == gen + 1 ); - tss_delete(ctx->tss); + tss_delete( ctx->tss ); } -static int thrd(void *arg) +static int thrd( void *arg ) { (void) arg; - thrd_exit(123); + thrd_exit( 123 ); } -static void test_thrd(test_context *ctx) +static void test_thrd( test_context *ctx ) { - thrd_start_t thrd_start = thrd; - int status; - int exit_status; + thrd_start_t thrd_start = thrd; + int status; + int exit_status; struct timespec duration; struct timespec remaining; - void *greedy; + void *greedy; - rtems_test_assert(thrd_equal(rtems_task_self(), thrd_current())); + rtems_test_assert( thrd_equal( rtems_task_self(), thrd_current() ) ); thrd_yield(); - memset(&duration, 0, sizeof(duration)); + memset( &duration, 0, sizeof( duration ) ); duration.tv_nsec = 1; - thrd_sleep(&duration, &remaining); - rtems_test_assert(remaining.tv_sec == 0); - rtems_test_assert(remaining.tv_nsec == 0); + thrd_sleep( &duration, &remaining ); + rtems_test_assert( remaining.tv_sec == 0 ); + rtems_test_assert( remaining.tv_nsec == 0 ); - greedy = rtems_heap_greedy_allocate(NULL, 0); - status = thrd_create(&ctx->thrd, thrd_start, ctx); - rtems_test_assert(status == thrd_nomem); - rtems_heap_greedy_free(greedy); + greedy = rtems_heap_greedy_allocate( NULL, 0 ); + status = thrd_create( &ctx->thrd, thrd_start, ctx ); + rtems_test_assert( status == thrd_nomem ); + rtems_heap_greedy_free( greedy ); - status = thrd_create(&ctx->thrd, thrd_start, ctx); - rtems_test_assert(status == thrd_success); + status = thrd_create( &ctx->thrd, thrd_start, ctx ); + rtems_test_assert( status == thrd_success ); - status = thrd_create(&ctx->thrd, thrd_start, ctx); - rtems_test_assert(status == thrd_error); + status = thrd_create( &ctx->thrd, thrd_start, ctx ); + rtems_test_assert( status == thrd_error ); exit_status = 0; - status = thrd_join(ctx->thrd, &exit_status); - rtems_test_assert(status == thrd_success); - rtems_test_assert(exit_status == 123); + status = thrd_join( ctx->thrd, &exit_status ); + rtems_test_assert( status == thrd_success ); + rtems_test_assert( exit_status == 123 ); - status = thrd_detach(thrd_current()); - rtems_test_assert(status == thrd_success); + status = thrd_detach( thrd_current() ); + rtems_test_assert( status == thrd_success ); - status = thrd_detach(11235); - rtems_test_assert(status == thrd_error); + status = thrd_detach( 11235 ); + rtems_test_assert( status == thrd_error ); } -static void high_task(rtems_task_argument idx) +static void high_task( rtems_task_argument idx ) { (void) idx; test_context *ctx = &test_instance; - while (true) { - rtems_event_set events; + while ( true ) { + rtems_event_set events; rtems_status_code sc; - int status; + int status; sc = rtems_event_receive( RTEMS_ALL_EVENTS, @@ -323,95 +321,95 @@ static void high_task(rtems_task_argument idx) RTEMS_NO_TIMEOUT, &events ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - if ((events & EVENT_MTX_LOCK) != 0) { - status = mtx_lock(&ctx->mtx); - rtems_test_assert(status == thrd_success); - next_generation(ctx); + if ( ( events & EVENT_MTX_LOCK ) != 0 ) { + status = mtx_lock( &ctx->mtx ); + rtems_test_assert( status == thrd_success ); + next_generation( ctx ); } - if ((events & EVENT_MTX_UNLOCK) != 0) { - status = mtx_unlock(&ctx->mtx); - rtems_test_assert(status == thrd_success); - next_generation(ctx); + if ( ( events & EVENT_MTX_UNLOCK ) != 0 ) { + status = mtx_unlock( &ctx->mtx ); + rtems_test_assert( status == thrd_success ); + next_generation( ctx ); } - if ((events & EVENT_CND_WAIT) != 0) { - status = mtx_lock(&ctx->mtx); - rtems_test_assert(status == thrd_success); - next_generation(ctx); + if ( ( events & EVENT_CND_WAIT ) != 0 ) { + status = mtx_lock( &ctx->mtx ); + rtems_test_assert( status == thrd_success ); + next_generation( ctx ); - status = cnd_wait(&ctx->cnd, &ctx->mtx); - rtems_test_assert(status == thrd_success); - next_generation(ctx); + status = cnd_wait( &ctx->cnd, &ctx->mtx ); + rtems_test_assert( status == thrd_success ); + next_generation( ctx ); - status = mtx_unlock(&ctx->mtx); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( &ctx->mtx ); + rtems_test_assert( status == thrd_success ); } - if ((events & EVENT_CND_TIMEDWAIT) != 0) { + if ( ( events & EVENT_CND_TIMEDWAIT ) != 0 ) { struct timespec to; - status = mtx_lock(&ctx->mtx); - rtems_test_assert(status == thrd_success); - next_generation(ctx); + status = mtx_lock( &ctx->mtx ); + rtems_test_assert( status == thrd_success ); + next_generation( ctx ); - get_abs_timeout(&to); - status = cnd_timedwait(&ctx->cnd, &ctx->mtx, &to); - rtems_test_assert(status == thrd_success); - next_generation(ctx); + get_abs_timeout( &to ); + status = cnd_timedwait( &ctx->cnd, &ctx->mtx, &to ); + rtems_test_assert( status == thrd_success ); + next_generation( ctx ); - status = mtx_unlock(&ctx->mtx); - rtems_test_assert(status == thrd_success); + status = mtx_unlock( &ctx->mtx ); + rtems_test_assert( status == thrd_success ); } - if ((events & EVENT_TSS) != 0) { + if ( ( events & EVENT_TSS ) != 0 ) { void *val; - status = tss_set(ctx->tss, &tss_val); - rtems_test_assert(status == thrd_success); + status = tss_set( ctx->tss, &tss_val ); + rtems_test_assert( status == thrd_success ); - val = tss_get(ctx->tss); - rtems_test_assert(val == &tss_val); + val = tss_get( ctx->tss ); + rtems_test_assert( val == &tss_val ); rtems_task_exit(); - rtems_test_assert(0); + rtems_test_assert( 0 ); } } } -static void test(void) +static void test( void ) { - test_context *ctx = &test_instance; + test_context *ctx = &test_instance; rtems_status_code sc; - test_init(ctx); + test_init( ctx ); ctx->low = rtems_task_self(); sc = rtems_task_create( - rtems_build_name('H', 'I', 'G', 'H'), + rtems_build_name( 'H', 'I', 'G', 'H' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx->high ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(ctx->high, high_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( ctx->high, high_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - test_once(ctx); - test_mtx(ctx); - test_cnd(ctx); - test_tss(ctx); - test_thrd(ctx); - test_destroy(ctx); + test_once( ctx ); + test_mtx( ctx ); + test_cnd( ctx ); + test_tss( ctx ); + test_thrd( ctx ); + test_destroy( ctx ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -420,7 +418,7 @@ static void Init(rtems_task_argument arg) test(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_MICROSECONDS_PER_TICK US_PER_TICK @@ -430,18 +428,18 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_MAXIMUM_TASKS 4 -#define CONFIGURE_MAXIMUM_POSIX_KEYS 1 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 1 #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1 -#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION -#define CONFIGURE_INIT_TASK_PRIORITY 4 +#define CONFIGURE_INIT_TASK_PRIORITY 4 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_SCHEDULER_NAME rtems_build_name('b', 'l', 'u', 'e') +#define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'b', 'l', 'u', 'e' ) #define CONFIGURE_INIT diff --git a/testsuites/sptests/spstkalloc/init.c b/testsuites/sptests/spstkalloc/init.c index b0ee4d4d81..a292f1e217 100644 --- a/testsuites/sptests/spstkalloc/init.c +++ b/testsuites/sptests/spstkalloc/init.c @@ -35,35 +35,34 @@ const char rtems_test_name[] = "SPSTKALLOC"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); #define MAXIMUM_STACKS 2 typedef struct { - uint8_t Space[CPU_STACK_MINIMUM_SIZE]; + uint8_t Space[ CPU_STACK_MINIMUM_SIZE ]; } StackMemory_t; -int stackToAlloc = 0; -StackMemory_t Stacks[MAXIMUM_STACKS]; -void *StackDeallocated = NULL; +int stackToAlloc = 0; +StackMemory_t Stacks[ MAXIMUM_STACKS ]; +void *StackDeallocated = NULL; -static void *StackAllocator(size_t size) +static void *StackAllocator( size_t size ) { (void) size; - if (stackToAlloc < MAXIMUM_STACKS) - return &Stacks[stackToAlloc++]; + if ( stackToAlloc < MAXIMUM_STACKS ) { + return &Stacks[ stackToAlloc++ ]; + } return NULL; } -static void StackDeallocator(void *stack) +static void StackDeallocator( void *stack ) { StackDeallocated = stack; } -rtems_task Init( - rtems_task_argument ignored -) +rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -75,23 +74,23 @@ rtems_task Init( puts( "Init - create task TA1 to use custom stack allocator - OK" ); rc = rtems_task_create( - rtems_build_name( 'T', 'A', '1', ' ' ), - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &taskId + rtems_build_name( 'T', 'A', '1', ' ' ), + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &taskId ); directive_failed( rc, "rtems_task_create of TA1" ); puts( "Init - create task TA1 to have custom stack allocator fail" ); rc = rtems_task_create( - rtems_build_name( 'F', 'A', 'I', 'L' ), - 1, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &taskId1 + rtems_build_name( 'F', 'A', 'I', 'L' ), + 1, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &taskId1 ); fatal_directive_status( rc, RTEMS_UNSATISFIED, "rtems_task_create of FAIL" ); @@ -100,7 +99,7 @@ rtems_task Init( directive_failed( rc, "rtems_task_delete of TA1" ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -108,8 +107,8 @@ rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_TASK_STACK_ALLOCATOR StackAllocator -#define CONFIGURE_TASK_STACK_DEALLOCATOR StackDeallocator +#define CONFIGURE_TASK_STACK_ALLOCATOR StackAllocator +#define CONFIGURE_TASK_STACK_DEALLOCATOR StackDeallocator #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/spstkalloc02/init.c b/testsuites/sptests/spstkalloc02/init.c index 64e9b83134..6fd20f0a58 100644 --- a/testsuites/sptests/spstkalloc02/init.c +++ b/testsuites/sptests/spstkalloc02/init.c @@ -53,19 +53,22 @@ const char rtems_test_name[] = "SPSTKALLOC 2"; static Heap_Control task_stack_heap; -static void task_stack_init(size_t stack_space_size); +static void task_stack_init( size_t stack_space_size ); -static void *task_stack_allocate(size_t stack_size); +static void *task_stack_allocate( size_t stack_size ); -static void *task_stack_allocate_for_idle(uint32_t unused, size_t *stack_size); +static void *task_stack_allocate_for_idle( + uint32_t unused, + size_t *stack_size +); -static void task_stack_free(void *addr); +static void task_stack_free( void *addr ); -static void print_info(void) +static void print_info( void ) { Heap_Information_block info; - _Heap_Get_information(&task_stack_heap, &info); + _Heap_Get_information( &task_stack_heap, &info ); printf( "used blocks = %" PRIuPTR ", " @@ -83,20 +86,20 @@ static void print_info(void) ); } -static rtems_task Init(rtems_task_argument argument) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code sc = RTEMS_SUCCESSFUL; - rtems_name name = rtems_build_name('S', 'T', 'K', 'A'); - rtems_id id = RTEMS_ID_NONE; - int i = 0; + rtems_name name = rtems_build_name( 'S', 'T', 'K', 'A' ); + rtems_id id = RTEMS_ID_NONE; + int i = 0; TEST_BEGIN(); print_info(); - for (i = 2; i < TASK_COUNT; ++i) { + for ( i = 2; i < TASK_COUNT; ++i ) { sc = rtems_task_create( name, RTEMS_MINIMUM_PRIORITY, @@ -105,7 +108,7 @@ static rtems_task Init(rtems_task_argument argument) RTEMS_DEFAULT_ATTRIBUTES, &id ); - directive_failed(sc, "rtems_task_create"); + directive_failed( sc, "rtems_task_create" ); } sc = rtems_task_create( @@ -116,7 +119,7 @@ static rtems_task Init(rtems_task_argument argument) RTEMS_DEFAULT_ATTRIBUTES, &id ); - fatal_directive_status(sc, RTEMS_UNSATISFIED, "rtems_task_create"); + fatal_directive_status( sc, RTEMS_UNSATISFIED, "rtems_task_create" ); sc = rtems_task_create( name, @@ -126,13 +129,13 @@ static rtems_task Init(rtems_task_argument argument) RTEMS_DEFAULT_ATTRIBUTES, &id ); - directive_failed(sc, "rtems_task_create"); + directive_failed( sc, "rtems_task_create" ); print_info(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER @@ -152,13 +155,13 @@ static rtems_task Init(rtems_task_argument argument) #define CONFIGURE_MAXIMUM_TASKS TASK_COUNT -#define CONFIGURE_TASK_STACK_ALLOCATOR_INIT task_stack_init -#define CONFIGURE_TASK_STACK_ALLOCATOR task_stack_allocate +#define CONFIGURE_TASK_STACK_ALLOCATOR_INIT task_stack_init +#define CONFIGURE_TASK_STACK_ALLOCATOR task_stack_allocate #define CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE task_stack_allocate_for_idle -#define CONFIGURE_TASK_STACK_DEALLOCATOR task_stack_free +#define CONFIGURE_TASK_STACK_DEALLOCATOR task_stack_free #define CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE -#define CONFIGURE_TASK_STACK_FROM_ALLOCATOR(stack_size) \ - ((stack_size) + HEAP_BLOCK_HEADER_SIZE + STACK_HEAP_PAGE_SIZE - 1) +#define CONFIGURE_TASK_STACK_FROM_ALLOCATOR( stack_size ) \ + ( ( stack_size ) + HEAP_BLOCK_HEADER_SIZE + STACK_HEAP_PAGE_SIZE - 1 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION @@ -168,28 +171,32 @@ static rtems_task Init(rtems_task_argument argument) #include -static char task_stack_space - [CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_CONFIGURE_STACK_SPACE_SIZE)]; +static char task_stack_space[ CONFIGURE_TASK_STACK_FROM_ALLOCATOR( + _CONFIGURE_STACK_SPACE_SIZE +) ]; -static void task_stack_init(size_t stack_space_size) +static void task_stack_init( size_t stack_space_size ) { bool ok = _Heap_Initialize( &task_stack_heap, task_stack_space, - sizeof(task_stack_space), + sizeof( task_stack_space ), STACK_HEAP_PAGE_SIZE ); - rtems_test_assert(stack_space_size == _CONFIGURE_STACK_SPACE_SIZE); - rtems_test_assert(ok); + rtems_test_assert( stack_space_size == _CONFIGURE_STACK_SPACE_SIZE ); + rtems_test_assert( ok ); } -static void *task_stack_allocate(size_t stack_size) +static void *task_stack_allocate( size_t stack_size ) { - return _Heap_Allocate(&task_stack_heap, stack_size); + return _Heap_Allocate( &task_stack_heap, stack_size ); } -static void *task_stack_allocate_for_idle(uint32_t unused, size_t *stack_size) +static void *task_stack_allocate_for_idle( + uint32_t unused, + size_t *stack_size +) { (void) unused; @@ -200,7 +207,7 @@ static void *task_stack_allocate_for_idle(uint32_t unused, size_t *stack_size) ); } -static void task_stack_free(void *addr) +static void task_stack_free( void *addr ) { - _Heap_Free(&task_stack_heap, addr); + _Heap_Free( &task_stack_heap, addr ); } diff --git a/testsuites/sptests/spstkalloc03/init.c b/testsuites/sptests/spstkalloc03/init.c index 5d9bc1f2f6..ecc35399bc 100644 --- a/testsuites/sptests/spstkalloc03/init.c +++ b/testsuites/sptests/spstkalloc03/init.c @@ -39,68 +39,66 @@ const char rtems_test_name[] = "SPSTKALLOC 3"; static int thread_stacks_count = 0xff; -static rtems_task Init( - rtems_task_argument ignored -) +static rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_print_printer_fprintf_putc(&rtems_test_printer); + rtems_print_printer_fprintf_putc( &rtems_test_printer ); TEST_BEGIN(); - rtems_test_assert(thread_stacks_count == 2); + rtems_test_assert( thread_stacks_count == 2 ); TEST_END(); rtems_test_exit( 0 ); } -static uint8_t stack_memory[RTEMS_MINIMUM_STACK_SIZE * 4]; +static uint8_t stack_memory[ RTEMS_MINIMUM_STACK_SIZE * 4 ]; static int stack_offset_next; -static void *allocate_helper(size_t size) +static void *allocate_helper( size_t size ) { - size_t next; - void *alloc; + size_t next; + void *alloc; - next = stack_offset_next + size; - rtems_test_assert( next < sizeof(stack_memory) ); + next = stack_offset_next + size; + rtems_test_assert( next < sizeof( stack_memory ) ); - alloc = &stack_memory[stack_offset_next]; + alloc = &stack_memory[ stack_offset_next ]; stack_offset_next = next; return alloc; } -static void thread_stacks_initialize(size_t stack_space_size) +static void thread_stacks_initialize( size_t stack_space_size ) { (void) stack_space_size; - rtems_test_assert(thread_stacks_count == 0xff); + rtems_test_assert( thread_stacks_count == 0xff ); thread_stacks_count = 0; } -static void *thread_stacks_allocate(size_t stack_size) +static void *thread_stacks_allocate( size_t stack_size ) { - rtems_test_assert(thread_stacks_count == 1); + rtems_test_assert( thread_stacks_count == 1 ); thread_stacks_count++; - return allocate_helper(stack_size); + return allocate_helper( stack_size ); } -static void thread_stacks_free(void *addr) +static void thread_stacks_free( void *addr ) { (void) addr; - rtems_test_assert(false); + rtems_test_assert( false ); } static void *thread_stacks_allocate_for_idle( - uint32_t cpu, - size_t *stack_size + uint32_t cpu, + size_t *stack_size ) { (void) cpu; - rtems_test_assert(thread_stacks_count == 0); + rtems_test_assert( thread_stacks_count == 0 ); thread_stacks_count++; - return allocate_helper(*stack_size); + return allocate_helper( *stack_size ); } /* @@ -108,17 +106,16 @@ static void *thread_stacks_allocate_for_idle( * eliminate all uses of the Workspace for most BSPs. */ #define CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE -#define CONFIGURE_TASK_STACK_ALLOCATOR_INIT thread_stacks_initialize -#define CONFIGURE_TASK_STACK_ALLOCATOR thread_stacks_allocate -#define CONFIGURE_TASK_STACK_DEALLOCATOR thread_stacks_free +#define CONFIGURE_TASK_STACK_ALLOCATOR_INIT thread_stacks_initialize +#define CONFIGURE_TASK_STACK_ALLOCATOR thread_stacks_allocate +#define CONFIGURE_TASK_STACK_DEALLOCATOR thread_stacks_free #define CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE thread_stacks_allocate_for_idle - /* NOTICE: the clock driver is explicitly disabled */ #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spstkalloc04/init.c b/testsuites/sptests/spstkalloc04/init.c index 68b723af62..8ff73eb6a0 100644 --- a/testsuites/sptests/spstkalloc04/init.c +++ b/testsuites/sptests/spstkalloc04/init.c @@ -39,46 +39,44 @@ const char rtems_test_name[] = "SPSTKALLOC 4"; static int thread_stacks_count = 0; -static rtems_task Init( - rtems_task_argument ignored -) +static rtems_task Init( rtems_task_argument ignored ) { (void) ignored; - rtems_print_printer_fprintf_putc(&rtems_test_printer); + rtems_print_printer_fprintf_putc( &rtems_test_printer ); TEST_BEGIN(); - rtems_test_assert(thread_stacks_count == 1); + rtems_test_assert( thread_stacks_count == 1 ); TEST_END(); rtems_test_exit( 0 ); } -static uint8_t stack_memory[RTEMS_MINIMUM_STACK_SIZE * 4]; +static uint8_t stack_memory[ RTEMS_MINIMUM_STACK_SIZE * 4 ]; static int stack_offset_next; -static void *allocate_helper(size_t size) +static void *allocate_helper( size_t size ) { - size_t next; - void *alloc; + size_t next; + void *alloc; - next = stack_offset_next + size; - rtems_test_assert( next < sizeof(stack_memory) ); + next = stack_offset_next + size; + rtems_test_assert( next < sizeof( stack_memory ) ); - alloc = &stack_memory[stack_offset_next]; + alloc = &stack_memory[ stack_offset_next ]; stack_offset_next = next; return alloc; } static void *thread_stacks_allocate_for_idle( - uint32_t cpu, - size_t *stack_size + uint32_t cpu, + size_t *stack_size ) { (void) cpu; - rtems_test_assert(thread_stacks_count == 0); + rtems_test_assert( thread_stacks_count == 0 ); thread_stacks_count++; - return allocate_helper(*stack_size); + return allocate_helper( *stack_size ); } /* @@ -88,12 +86,11 @@ static void *thread_stacks_allocate_for_idle( */ #define CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE thread_stacks_allocate_for_idle - /* NOTICE: the clock driver is explicitly disabled */ #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c index f24f758cbd..4918b7e892 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -160,75 +160,63 @@ typedef enum { DONE } init_step; -#define FIRST(x) \ - static void x##_first(void); \ - RTEMS_SYSINIT_ITEM( \ - x##_first, \ - x, \ - RTEMS_SYSINIT_ORDER_FIRST \ - ); \ - static void x##_first(void) +#define FIRST( x ) \ + static void x##_first( void ); \ + RTEMS_SYSINIT_ITEM( x##_first, x, RTEMS_SYSINIT_ORDER_FIRST ); \ + static void x##_first( void ) -#define LAST(x) \ - static void x##_last(void); \ - RTEMS_SYSINIT_ITEM( \ - x##_last, \ - x, \ - RTEMS_SYSINIT_ORDER_LAST_BUT_1 \ - ); \ - static void x##_last(void) +#define LAST( x ) \ + static void x##_last( void ); \ + RTEMS_SYSINIT_ITEM( x##_last, x, RTEMS_SYSINIT_ORDER_LAST_BUT_1 ); \ + static void x##_last( void ) -#define LAST_STEP(x) \ - static void last_##x(void) \ - { \ - next_step(LAST_##x); \ - } \ - RTEMS_SYSINIT_ITEM( \ - last_##x, \ - RTEMS_SYSINIT_LAST, \ - RTEMS_SYSINIT_ORDER_##x \ - ) +#define LAST_STEP( x ) \ + static void last_##x( void ) \ + { \ + next_step( LAST_##x ); \ + } \ + RTEMS_SYSINIT_ITEM( last_##x, RTEMS_SYSINIT_LAST, RTEMS_SYSINIT_ORDER_##x ) static init_step step; -static void next_step(init_step expected) +static void next_step( init_step expected ) { - assert(step == expected); + assert( step == expected ); step = expected + 1; } -static bool info_not_init(const Objects_Information *info) +static bool info_not_init( const Objects_Information *info ) { - return _Chain_Is_empty(&info->Inactive); + return _Chain_Is_empty( &info->Inactive ); } -static bool info_is_init(const Objects_Information *info, size_t count) +static bool info_is_init( const Objects_Information *info, size_t count ) { - return _Chain_Node_count_unprotected(&info->Inactive) == count; + return _Chain_Node_count_unprotected( &info->Inactive ) == count; } -FIRST(RTEMS_SYSINIT_WORKSPACE) +FIRST( RTEMS_SYSINIT_WORKSPACE ) { - assert(_Workspace_Area.area_begin == 0); - next_step(WORKSPACE_PRE); + assert( _Workspace_Area.area_begin == 0 ); + next_step( WORKSPACE_PRE ); } -LAST(RTEMS_SYSINIT_WORKSPACE) +LAST( RTEMS_SYSINIT_WORKSPACE ) { - assert(_Workspace_Area.area_begin != 0); - next_step(WORKSPACE_POST); + assert( _Workspace_Area.area_begin != 0 ); + next_step( WORKSPACE_POST ); } -FIRST(RTEMS_SYSINIT_BSP_START) +FIRST( RTEMS_SYSINIT_BSP_START ) { /* * Since the work performed here is BSP-specific, there is no way to test pre * and post conditions. */ - next_step(BSP_START_PRE); + next_step( BSP_START_PRE ); } -LAST(RTEMS_SYSINIT_BSP_START) +LAST( RTEMS_SYSINIT_BSP_START ) { /* * Some BSPs initialize the printk() support in bsp_start(). So, print begin @@ -236,747 +224,749 @@ LAST(RTEMS_SYSINIT_BSP_START) */ TEST_BEGIN(); - next_step(BSP_START_POST); + next_step( BSP_START_POST ); } -FIRST(RTEMS_SYSINIT_CPU_COUNTER) +FIRST( RTEMS_SYSINIT_CPU_COUNTER ) { /* * Since the work performed here is BSP-specific, there is no way to test pre * and post conditions. */ - next_step(CPU_COUNTER_PRE); + next_step( CPU_COUNTER_PRE ); } -LAST(RTEMS_SYSINIT_CPU_COUNTER) +LAST( RTEMS_SYSINIT_CPU_COUNTER ) { - next_step(CPU_COUNTER_POST); + next_step( CPU_COUNTER_POST ); } -FIRST(RTEMS_SYSINIT_TARGET_HASH) +FIRST( RTEMS_SYSINIT_TARGET_HASH ) { /* * Since the work performed here is BSP-specific, there is no way to test pre * and post conditions. */ - next_step(TARGET_HASH_PRE); + next_step( TARGET_HASH_PRE ); } -LAST(RTEMS_SYSINIT_TARGET_HASH) +LAST( RTEMS_SYSINIT_TARGET_HASH ) { - next_step(TARGET_HASH_POST); + next_step( TARGET_HASH_POST ); } -FIRST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) +FIRST( RTEMS_SYSINIT_INITIAL_EXTENSIONS ) { - assert(_Chain_Is_empty(&_User_extensions_Switches_list)); - next_step(INITIAL_EXTENSIONS_PRE); + assert( _Chain_Is_empty( &_User_extensions_Switches_list ) ); + next_step( INITIAL_EXTENSIONS_PRE ); } -LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) +LAST( RTEMS_SYSINIT_INITIAL_EXTENSIONS ) { - assert(!_Chain_Is_empty(&_User_extensions_Switches_list)); - next_step(INITIAL_EXTENSIONS_POST); + assert( !_Chain_Is_empty( &_User_extensions_Switches_list ) ); + next_step( INITIAL_EXTENSIONS_POST ); } -FIRST(RTEMS_SYSINIT_DATA_STRUCTURES) +FIRST( RTEMS_SYSINIT_DATA_STRUCTURES ) { - assert(info_not_init(&_Thread_Information.Objects)); - next_step(DATA_STRUCTURES_PRE); + assert( info_not_init( &_Thread_Information.Objects ) ); + next_step( DATA_STRUCTURES_PRE ); } -LAST(RTEMS_SYSINIT_DATA_STRUCTURES) +LAST( RTEMS_SYSINIT_DATA_STRUCTURES ) { - assert(info_is_init(&_Thread_Information.Objects, 1)); - next_step(DATA_STRUCTURES_POST); + assert( info_is_init( &_Thread_Information.Objects, 1 ) ); + next_step( DATA_STRUCTURES_POST ); } -FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) +FIRST( RTEMS_SYSINIT_USER_EXTENSIONS ) { - assert(info_not_init(&_Extension_Information)); - next_step(USER_EXTENSIONS_PRE); + assert( info_not_init( &_Extension_Information ) ); + next_step( USER_EXTENSIONS_PRE ); } -LAST(RTEMS_SYSINIT_USER_EXTENSIONS) +LAST( RTEMS_SYSINIT_USER_EXTENSIONS ) { - assert(info_is_init(&_Extension_Information, 1)); - next_step(USER_EXTENSIONS_POST); + assert( info_is_init( &_Extension_Information, 1 ) ); + next_step( USER_EXTENSIONS_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_TASKS) +FIRST( RTEMS_SYSINIT_CLASSIC_TASKS ) { - assert(info_not_init(&_RTEMS_tasks_Information.Objects)); - next_step(CLASSIC_TASKS_PRE); + assert( info_not_init( &_RTEMS_tasks_Information.Objects ) ); + next_step( CLASSIC_TASKS_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_TASKS) +LAST( RTEMS_SYSINIT_CLASSIC_TASKS ) { - assert(info_is_init(&_RTEMS_tasks_Information.Objects, 2)); - next_step(CLASSIC_TASKS_POST); + assert( info_is_init( &_RTEMS_tasks_Information.Objects, 2 ) ); + next_step( CLASSIC_TASKS_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_TIMER) +FIRST( RTEMS_SYSINIT_CLASSIC_TIMER ) { - assert(info_not_init(&_Timer_Information)); - next_step(CLASSIC_TIMER_PRE); + assert( info_not_init( &_Timer_Information ) ); + next_step( CLASSIC_TIMER_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_TIMER) +LAST( RTEMS_SYSINIT_CLASSIC_TIMER ) { - assert(info_is_init(&_Timer_Information, 1)); - next_step(CLASSIC_TIMER_POST); + assert( info_is_init( &_Timer_Information, 1 ) ); + next_step( CLASSIC_TIMER_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) +FIRST( RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE ) { - assert(info_not_init(&_Message_queue_Information)); - next_step(CLASSIC_MESSAGE_QUEUE_PRE); + assert( info_not_init( &_Message_queue_Information ) ); + next_step( CLASSIC_MESSAGE_QUEUE_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) +LAST( RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE ) { - assert(info_is_init(&_Message_queue_Information, 1)); - next_step(CLASSIC_MESSAGE_QUEUE_POST); + assert( info_is_init( &_Message_queue_Information, 1 ) ); + next_step( CLASSIC_MESSAGE_QUEUE_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) +FIRST( RTEMS_SYSINIT_CLASSIC_SEMAPHORE ) { - assert(info_not_init(&_Semaphore_Information)); - next_step(CLASSIC_SEMAPHORE_PRE); + assert( info_not_init( &_Semaphore_Information ) ); + next_step( CLASSIC_SEMAPHORE_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) +LAST( RTEMS_SYSINIT_CLASSIC_SEMAPHORE ) { - assert(info_is_init(&_Semaphore_Information, 1)); - next_step(CLASSIC_SEMAPHORE_POST); + assert( info_is_init( &_Semaphore_Information, 1 ) ); + next_step( CLASSIC_SEMAPHORE_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION) +FIRST( RTEMS_SYSINIT_CLASSIC_PARTITION ) { - assert(info_not_init(&_Partition_Information)); - next_step(CLASSIC_PARTITION_PRE); + assert( info_not_init( &_Partition_Information ) ); + next_step( CLASSIC_PARTITION_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_PARTITION) +LAST( RTEMS_SYSINIT_CLASSIC_PARTITION ) { - assert(info_is_init(&_Partition_Information, 1)); - next_step(CLASSIC_PARTITION_POST); + assert( info_is_init( &_Partition_Information, 1 ) ); + next_step( CLASSIC_PARTITION_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_REGION) +FIRST( RTEMS_SYSINIT_CLASSIC_REGION ) { - assert(info_not_init(&_Region_Information)); - next_step(CLASSIC_REGION_PRE); + assert( info_not_init( &_Region_Information ) ); + next_step( CLASSIC_REGION_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_REGION) +LAST( RTEMS_SYSINIT_CLASSIC_REGION ) { - assert(info_is_init(&_Region_Information, 1)); - next_step(CLASSIC_REGION_POST); + assert( info_is_init( &_Region_Information, 1 ) ); + next_step( CLASSIC_REGION_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) +FIRST( RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY ) { - assert(info_not_init(&_Dual_ported_memory_Information)); - next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); + assert( info_not_init( &_Dual_ported_memory_Information ) ); + next_step( CLASSIC_DUAL_PORTED_MEMORY_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) +LAST( RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY ) { - assert(info_is_init(&_Dual_ported_memory_Information, 1)); - next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); + assert( info_is_init( &_Dual_ported_memory_Information, 1 ) ); + next_step( CLASSIC_DUAL_PORTED_MEMORY_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) +FIRST( RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC ) { - assert(info_not_init(&_Rate_monotonic_Information)); - next_step(CLASSIC_RATE_MONOTONIC_PRE); + assert( info_not_init( &_Rate_monotonic_Information ) ); + next_step( CLASSIC_RATE_MONOTONIC_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) +LAST( RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC ) { - assert(info_is_init(&_Rate_monotonic_Information, 1)); - next_step(CLASSIC_RATE_MONOTONIC_POST); + assert( info_is_init( &_Rate_monotonic_Information, 1 ) ); + next_step( CLASSIC_RATE_MONOTONIC_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER) +FIRST( RTEMS_SYSINIT_CLASSIC_BARRIER ) { - assert(info_not_init(&_Barrier_Information)); - next_step(CLASSIC_BARRIER_PRE); + assert( info_not_init( &_Barrier_Information ) ); + next_step( CLASSIC_BARRIER_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_BARRIER) +LAST( RTEMS_SYSINIT_CLASSIC_BARRIER ) { - assert(info_is_init(&_Barrier_Information, 1)); - next_step(CLASSIC_BARRIER_POST); + assert( info_is_init( &_Barrier_Information, 1 ) ); + next_step( CLASSIC_BARRIER_POST ); } #ifdef RTEMS_POSIX_API -FIRST(RTEMS_SYSINIT_POSIX_SIGNALS) +FIRST( RTEMS_SYSINIT_POSIX_SIGNALS ) { assert( memcmp( &_POSIX_signals_Vectors, _POSIX_signals_Default_vectors, - sizeof(_POSIX_signals_Vectors) + sizeof( _POSIX_signals_Vectors ) ) != 0 ); - next_step(POSIX_SIGNALS_PRE); + next_step( POSIX_SIGNALS_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_SIGNALS) +LAST( RTEMS_SYSINIT_POSIX_SIGNALS ) { assert( memcmp( &_POSIX_signals_Vectors, _POSIX_signals_Default_vectors, - sizeof(_POSIX_signals_Vectors) + sizeof( _POSIX_signals_Vectors ) ) == 0 ); - next_step(POSIX_SIGNALS_POST); + next_step( POSIX_SIGNALS_POST ); } #endif /* RTEMS_POSIX_API */ -FIRST(RTEMS_SYSINIT_POSIX_THREADS) +FIRST( RTEMS_SYSINIT_POSIX_THREADS ) { - assert(info_not_init(&_POSIX_Threads_Information.Objects)); - next_step(POSIX_THREADS_PRE); + assert( info_not_init( &_POSIX_Threads_Information.Objects ) ); + next_step( POSIX_THREADS_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_THREADS) +LAST( RTEMS_SYSINIT_POSIX_THREADS ) { - assert(info_is_init(&_POSIX_Threads_Information.Objects, 1)); - next_step(POSIX_THREADS_POST); + assert( info_is_init( &_POSIX_Threads_Information.Objects, 1 ) ); + next_step( POSIX_THREADS_POST ); } -FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) +FIRST( RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE ) { - assert(info_not_init(&_POSIX_Message_queue_Information)); - next_step(POSIX_MESSAGE_QUEUE_PRE); + assert( info_not_init( &_POSIX_Message_queue_Information ) ); + next_step( POSIX_MESSAGE_QUEUE_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) +LAST( RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE ) { - assert(info_is_init(&_POSIX_Message_queue_Information, 1)); - next_step(POSIX_MESSAGE_QUEUE_POST); + assert( info_is_init( &_POSIX_Message_queue_Information, 1 ) ); + next_step( POSIX_MESSAGE_QUEUE_POST ); } -FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE) +FIRST( RTEMS_SYSINIT_POSIX_SEMAPHORE ) { - assert(info_not_init(&_POSIX_Semaphore_Information)); - next_step(POSIX_SEMAPHORE_PRE); + assert( info_not_init( &_POSIX_Semaphore_Information ) ); + next_step( POSIX_SEMAPHORE_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE) +LAST( RTEMS_SYSINIT_POSIX_SEMAPHORE ) { - assert(info_is_init(&_POSIX_Semaphore_Information, 1)); - next_step(POSIX_SEMAPHORE_POST); + assert( info_is_init( &_POSIX_Semaphore_Information, 1 ) ); + next_step( POSIX_SEMAPHORE_POST ); } #ifdef RTEMS_POSIX_API -FIRST(RTEMS_SYSINIT_POSIX_TIMER) +FIRST( RTEMS_SYSINIT_POSIX_TIMER ) { - assert(info_not_init(&_POSIX_Timer_Information)); - next_step(POSIX_TIMER_PRE); + assert( info_not_init( &_POSIX_Timer_Information ) ); + next_step( POSIX_TIMER_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_TIMER) +LAST( RTEMS_SYSINIT_POSIX_TIMER ) { - assert(info_is_init(&_POSIX_Timer_Information, 1)); - next_step(POSIX_TIMER_POST); + assert( info_is_init( &_POSIX_Timer_Information, 1 ) ); + next_step( POSIX_TIMER_POST ); } #endif /* RTEMS_POSIX_API */ -FIRST(RTEMS_SYSINIT_POSIX_SHM) +FIRST( RTEMS_SYSINIT_POSIX_SHM ) { - assert(info_not_init(&_POSIX_Shm_Information)); - next_step(POSIX_SHM_PRE); + assert( info_not_init( &_POSIX_Shm_Information ) ); + next_step( POSIX_SHM_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_SHM) +LAST( RTEMS_SYSINIT_POSIX_SHM ) { - assert(info_is_init(&_POSIX_Shm_Information, 1)); - next_step(POSIX_SHM_POST); + assert( info_is_init( &_POSIX_Shm_Information, 1 ) ); + next_step( POSIX_SHM_POST ); } static size_t user_extensions_pre_posix_cleanup; -FIRST(RTEMS_SYSINIT_POSIX_CLEANUP) +FIRST( RTEMS_SYSINIT_POSIX_CLEANUP ) { - user_extensions_pre_posix_cleanup = - _Chain_Node_count_unprotected(&_User_extensions_List.Active); - next_step(POSIX_CLEANUP_PRE); + user_extensions_pre_posix_cleanup = _Chain_Node_count_unprotected( + &_User_extensions_List.Active + ); + next_step( POSIX_CLEANUP_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_CLEANUP) +LAST( RTEMS_SYSINIT_POSIX_CLEANUP ) { assert( user_extensions_pre_posix_cleanup + 1 == - _Chain_Node_count_unprotected(&_User_extensions_List.Active) + _Chain_Node_count_unprotected( &_User_extensions_List.Active ) ); - next_step(POSIX_CLEANUP_POST); + next_step( POSIX_CLEANUP_POST ); } -FIRST(RTEMS_SYSINIT_POSIX_KEYS) +FIRST( RTEMS_SYSINIT_POSIX_KEYS ) { - assert(info_not_init(&_POSIX_Keys_Information)); - next_step(POSIX_KEYS_PRE); + assert( info_not_init( &_POSIX_Keys_Information ) ); + next_step( POSIX_KEYS_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_KEYS) +LAST( RTEMS_SYSINIT_POSIX_KEYS ) { - assert(info_is_init(&_POSIX_Keys_Information, 1)); - next_step(POSIX_KEYS_POST); + assert( info_is_init( &_POSIX_Keys_Information, 1 ) ); + next_step( POSIX_KEYS_POST ); } -FIRST(RTEMS_SYSINIT_IDLE_THREADS) +FIRST( RTEMS_SYSINIT_IDLE_THREADS ) { - assert(_System_state_Is_before_initialization(_System_state_Get())); - next_step(IDLE_THREADS_PRE); + assert( _System_state_Is_before_initialization( _System_state_Get() ) ); + next_step( IDLE_THREADS_PRE ); } -LAST(RTEMS_SYSINIT_IDLE_THREADS) +LAST( RTEMS_SYSINIT_IDLE_THREADS ) { - assert(_System_state_Is_before_multitasking(_System_state_Get())); - next_step(IDLE_THREADS_POST); + assert( _System_state_Is_before_multitasking( _System_state_Get() ) ); + next_step( IDLE_THREADS_POST ); } -FIRST(RTEMS_SYSINIT_LIBIO) +FIRST( RTEMS_SYSINIT_LIBIO ) { - assert(rtems_libio_iop_free_head == NULL); - next_step(LIBIO_PRE); + assert( rtems_libio_iop_free_head == NULL ); + next_step( LIBIO_PRE ); } -LAST(RTEMS_SYSINIT_LIBIO) +LAST( RTEMS_SYSINIT_LIBIO ) { - assert(rtems_libio_iop_free_head == &rtems_libio_iops[0]); - next_step(LIBIO_POST); + assert( rtems_libio_iop_free_head == &rtems_libio_iops[ 0 ] ); + next_step( LIBIO_POST ); } static size_t user_extensions_pre_user_env; -FIRST(RTEMS_SYSINIT_USER_ENVIRONMENT) +FIRST( RTEMS_SYSINIT_USER_ENVIRONMENT ) { - user_extensions_pre_user_env = - _Chain_Node_count_unprotected(&_User_extensions_List.Active); - next_step(USER_ENVIRONMENT_PRE); + user_extensions_pre_user_env = _Chain_Node_count_unprotected( + &_User_extensions_List.Active + ); + next_step( USER_ENVIRONMENT_PRE ); } -LAST(RTEMS_SYSINIT_USER_ENVIRONMENT) +LAST( RTEMS_SYSINIT_USER_ENVIRONMENT ) { assert( user_extensions_pre_user_env + 1 == - _Chain_Node_count_unprotected(&_User_extensions_List.Active) + _Chain_Node_count_unprotected( &_User_extensions_List.Active ) ); - next_step(USER_ENVIRONMENT_POST); + next_step( USER_ENVIRONMENT_POST ); } -FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM) +FIRST( RTEMS_SYSINIT_ROOT_FILESYSTEM ) { struct stat st; - int rv; + int rv; - rv = stat("/", &st); - assert(rv == -1); - next_step(ROOT_FILESYSTEM_PRE); + rv = stat( "/", &st ); + assert( rv == -1 ); + next_step( ROOT_FILESYSTEM_PRE ); } -LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM) +LAST( RTEMS_SYSINIT_ROOT_FILESYSTEM ) { struct stat st; - int rv; + int rv; - rv = stat("/", &st); - assert(rv == 0); - next_step(ROOT_FILESYSTEM_POST); + rv = stat( "/", &st ); + assert( rv == 0 ); + next_step( ROOT_FILESYSTEM_POST ); } -FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) +FIRST( RTEMS_SYSINIT_BSP_PRE_DRIVERS ) { /* * Since the work performed here is BSP-specific, there is no way to test pre * and post conditions. */ - next_step(BSP_PRE_DRIVERS_PRE); + next_step( BSP_PRE_DRIVERS_PRE ); } -LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) +LAST( RTEMS_SYSINIT_BSP_PRE_DRIVERS ) { - next_step(BSP_PRE_DRIVERS_POST); + next_step( BSP_PRE_DRIVERS_POST ); } -FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) +FIRST( RTEMS_SYSINIT_DEVICE_DRIVERS ) { - assert(!_IO_All_drivers_initialized); - next_step(DEVICE_DRIVERS_PRE); + assert( !_IO_All_drivers_initialized ); + next_step( DEVICE_DRIVERS_PRE ); } -LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) +LAST( RTEMS_SYSINIT_DEVICE_DRIVERS ) { - assert(_IO_All_drivers_initialized); - next_step(DEVICE_DRIVERS_POST); + assert( _IO_All_drivers_initialized ); + next_step( DEVICE_DRIVERS_POST ); } -FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) +FIRST( RTEMS_SYSINIT_CLASSIC_USER_TASKS ) { _Objects_Allocator_lock(); - assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0); + assert( _Objects_Active_count( &_RTEMS_tasks_Information.Objects ) == 0 ); _Objects_Allocator_unlock(); - next_step(CLASSIC_USER_TASKS_PRE); + next_step( CLASSIC_USER_TASKS_PRE ); } -LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) +LAST( RTEMS_SYSINIT_CLASSIC_USER_TASKS ) { _Objects_Allocator_lock(); - assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1); + assert( _Objects_Active_count( &_RTEMS_tasks_Information.Objects ) == 1 ); _Objects_Allocator_unlock(); - next_step(CLASSIC_USER_TASKS_POST); + next_step( CLASSIC_USER_TASKS_POST ); } -FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS) +FIRST( RTEMS_SYSINIT_POSIX_USER_THREADS ) { _Objects_Allocator_lock(); - assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0); + assert( _Objects_Active_count( &_POSIX_Threads_Information.Objects ) == 0 ); _Objects_Allocator_unlock(); - next_step(POSIX_USER_THREADS_PRE); + next_step( POSIX_USER_THREADS_PRE ); } -LAST(RTEMS_SYSINIT_POSIX_USER_THREADS) +LAST( RTEMS_SYSINIT_POSIX_USER_THREADS ) { _Objects_Allocator_lock(); - assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1); + assert( _Objects_Active_count( &_POSIX_Threads_Information.Objects ) == 1 ); _Objects_Allocator_unlock(); - next_step(POSIX_USER_THREADS_POST); + next_step( POSIX_USER_THREADS_POST ); } -FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) +FIRST( RTEMS_SYSINIT_STD_FILE_DESCRIPTORS ) { struct stat st; - int rv; + int rv; - rv = fstat(0, &st); - assert(rv == -1); - next_step(STD_FILE_DESCRIPTORS_PRE); + rv = fstat( 0, &st ); + assert( rv == -1 ); + next_step( STD_FILE_DESCRIPTORS_PRE ); } -LAST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) +LAST( RTEMS_SYSINIT_STD_FILE_DESCRIPTORS ) { struct stat st; - int rv; + int rv; - rv = fstat(0, &st); - assert(rv == 0); - next_step(STD_FILE_DESCRIPTORS_POST); + rv = fstat( 0, &st ); + assert( rv == 0 ); + next_step( STD_FILE_DESCRIPTORS_POST ); } -LAST_STEP(FIRST); -LAST_STEP(SECOND); -LAST_STEP(THIRD); -LAST_STEP(FOURTH); -LAST_STEP(FIFTH); -LAST_STEP(SIXTH); -LAST_STEP(SEVENTH); -LAST_STEP(EIGHTH); -LAST_STEP(NINETH); -LAST_STEP(TENTH); -LAST_STEP(MIDDLE); -LAST_STEP(LAST_BUT_9); -LAST_STEP(LAST_BUT_8); -LAST_STEP(LAST_BUT_7); -LAST_STEP(LAST_BUT_6); -LAST_STEP(LAST_BUT_5); -LAST_STEP(LAST_BUT_4); -LAST_STEP(LAST_BUT_3); -LAST_STEP(LAST_BUT_2); -LAST_STEP(LAST_BUT_1); -LAST_STEP(LAST); +LAST_STEP( FIRST ); +LAST_STEP( SECOND ); +LAST_STEP( THIRD ); +LAST_STEP( FOURTH ); +LAST_STEP( FIFTH ); +LAST_STEP( SIXTH ); +LAST_STEP( SEVENTH ); +LAST_STEP( EIGHTH ); +LAST_STEP( NINETH ); +LAST_STEP( TENTH ); +LAST_STEP( MIDDLE ); +LAST_STEP( LAST_BUT_9 ); +LAST_STEP( LAST_BUT_8 ); +LAST_STEP( LAST_BUT_7 ); +LAST_STEP( LAST_BUT_6 ); +LAST_STEP( LAST_BUT_5 ); +LAST_STEP( LAST_BUT_4 ); +LAST_STEP( LAST_BUT_3 ); +LAST_STEP( LAST_BUT_2 ); +LAST_STEP( LAST_BUT_1 ); +LAST_STEP( LAST ); -static void do_barrier_create(void) +static void do_barrier_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_barrier_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), RTEMS_DEFAULT_ATTRIBUTES, 1, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_barrier_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_barrier_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_extensions_create(void) +static void do_extensions_create( void ) { - rtems_status_code sc; - rtems_id id; + rtems_status_code sc; + rtems_id id; rtems_extensions_table table; - memset(&table, 0, sizeof(table)); + memset( &table, 0, sizeof( table ) ); sc = rtems_extension_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), &table, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_extension_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_extension_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_message_queue_create(void) +static void do_message_queue_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_message_queue_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), 1, 1, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_message_queue_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_message_queue_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_partition_create(void) +static void do_partition_create( void ) { rtems_status_code sc; - rtems_id id; - long buf[32]; + rtems_id id; + long buf[ 32 ]; sc = rtems_partition_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), buf, - sizeof(buf), - sizeof(buf), + sizeof( buf ), + sizeof( buf ), RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_partition_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_partition_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_period_create(void) +static void do_period_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_rate_monotonic_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_rate_monotonic_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_rate_monotonic_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_port_create(void) +static void do_port_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_port_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), NULL, NULL, 1, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_port_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_port_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_region_create(void) +static void do_region_create( void ) { rtems_status_code sc; - rtems_id id; - long buf[32]; + rtems_id id; + long buf[ 32 ]; sc = rtems_region_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), buf, - sizeof(buf), + sizeof( buf ), 1, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_region_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_region_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_semaphore_create(void) +static void do_semaphore_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_semaphore_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), 0, RTEMS_DEFAULT_ATTRIBUTES, 0, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_task_create(void) +static void do_task_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; sc = rtems_task_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_timer_create(void) +static void do_timer_create( void ) { rtems_status_code sc; - rtems_id id; + rtems_id id; - sc = rtems_timer_create(rtems_build_name('T', 'E', 'S', 'T'), &id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_create( rtems_build_name( 'T', 'E', 'S', 'T' ), &id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void do_cleanup_push_pop(void) +static void do_cleanup_push_pop( void ) { - pthread_cleanup_push(NULL, NULL); - pthread_cleanup_pop(0); + pthread_cleanup_push( NULL, NULL ); + pthread_cleanup_pop( 0 ); } -static void do_posix_key_create(void) +static void do_posix_key_create( void ) { pthread_key_t key; - int eno; + int eno; - eno = pthread_key_create(&key, NULL); - rtems_test_assert(eno == 0); + eno = pthread_key_create( &key, NULL ); + rtems_test_assert( eno == 0 ); - eno = pthread_key_delete(key); - rtems_test_assert(eno == 0); + eno = pthread_key_delete( key ); + rtems_test_assert( eno == 0 ); } -static void do_posix_mq_open(void) +static void do_posix_mq_open( void ) { struct mq_attr attr; - mqd_t mq; - int rv; + mqd_t mq; + int rv; - memset(&attr, 0, sizeof(attr)); + memset( &attr, 0, sizeof( attr ) ); attr.mq_maxmsg = 1; attr.mq_msgsize = 1; - mq = mq_open("mq", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, &attr); - rtems_test_assert(mq != (mqd_t) -1); + mq = mq_open( "mq", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, &attr ); + rtems_test_assert( mq != (mqd_t) -1 ); - rv = mq_close(mq); - rtems_test_assert(rv == 0); + rv = mq_close( mq ); + rtems_test_assert( rv == 0 ); - rv = mq_unlink("mq"); - rtems_test_assert(rv == 0); + rv = mq_unlink( "mq" ); + rtems_test_assert( rv == 0 ); } -static void do_posix_sem_open(void) +static void do_posix_sem_open( void ) { sem_t *sem; - int rv; + int rv; - sem = sem_open("sem", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, 0); - rtems_test_assert(sem != SEM_FAILED); + sem = sem_open( "sem", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, 0 ); + rtems_test_assert( sem != SEM_FAILED ); - rv = sem_close(sem); - rtems_test_assert(rv == 0); + rv = sem_close( sem ); + rtems_test_assert( rv == 0 ); - rv = sem_unlink("sem"); - rtems_test_assert(rv == 0); + rv = sem_unlink( "sem" ); + rtems_test_assert( rv == 0 ); } -static void do_posix_shm_open(void) +static void do_posix_shm_open( void ) { int fd; int rv; - fd = shm_open("/shm", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - rtems_test_assert(fd >= 0); + fd = shm_open( "/shm", O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO ); + rtems_test_assert( fd >= 0 ); - rv = close(fd); - rtems_test_assert(rv == 0); + rv = close( fd ); + rtems_test_assert( rv == 0 ); - rv = shm_unlink("/shm"); - rtems_test_assert(rv == 0); + rv = shm_unlink( "/shm" ); + rtems_test_assert( rv == 0 ); } -static void do_posix_timer_create(void) +static void do_posix_timer_create( void ) { #ifdef RTEMS_POSIX_API - int rv; + int rv; timer_t timer; - rv = timer_create(CLOCK_REALTIME, NULL, &timer); - rtems_test_assert(rv == 0); + rv = timer_create( CLOCK_REALTIME, NULL, &timer ); + rtems_test_assert( rv == 0 ); - rv = timer_delete(timer); - rtems_test_assert(rv == 0); + rv = timer_delete( timer ); + rtems_test_assert( rv == 0 ); #endif /* RTEMS_POSIX_API */ } -static void check_config(void) +static void check_config( void ) { const rtems_api_configuration_table *config; config = rtems_configuration_get_rtems_api_configuration(); - rtems_test_assert(!config->notepads_enabled); - rtems_test_assert(config->maximum_tasks == 2); - rtems_test_assert(config->maximum_timers == 1); - rtems_test_assert(config->maximum_semaphores == 1); - rtems_test_assert(config->maximum_message_queues == 1); - rtems_test_assert(config->maximum_partitions == 1); - rtems_test_assert(config->maximum_regions == 1); - rtems_test_assert(config->maximum_ports == 1); - rtems_test_assert(config->maximum_periods == 1); - rtems_test_assert(config->maximum_barriers == 1); - rtems_test_assert(config->number_of_initialization_tasks == 1); - rtems_test_assert(config->User_initialization_tasks_table != NULL); + rtems_test_assert( !config->notepads_enabled ); + rtems_test_assert( config->maximum_tasks == 2 ); + rtems_test_assert( config->maximum_timers == 1 ); + rtems_test_assert( config->maximum_semaphores == 1 ); + rtems_test_assert( config->maximum_message_queues == 1 ); + rtems_test_assert( config->maximum_partitions == 1 ); + rtems_test_assert( config->maximum_regions == 1 ); + rtems_test_assert( config->maximum_ports == 1 ); + rtems_test_assert( config->maximum_periods == 1 ); + rtems_test_assert( config->maximum_barriers == 1 ); + rtems_test_assert( config->number_of_initialization_tasks == 1 ); + rtems_test_assert( config->User_initialization_tasks_table != NULL ); } -static void do_use_global_user_env(void) +static void do_use_global_user_env( void ) { rtems_libio_use_global_env(); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; - next_step(INIT_TASK); + next_step( INIT_TASK ); do_barrier_create(); do_extensions_create(); do_message_queue_create(); @@ -996,10 +986,10 @@ static void Init(rtems_task_argument arg) do_use_global_user_env(); check_config(); TEST_END(); - exit(0); + exit( 0 ); } -static void *POSIX_Init(void *arg) +static void *POSIX_Init( void *arg ) { (void) arg; @@ -1049,7 +1039,7 @@ static void *POSIX_Init(void *arg) #define CONFIGURE_MAXIMUM_POSIX_KEYS 1 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1) + CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 1, 1 ) #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spsyslock01/init.c b/testsuites/sptests/spsyslock01/init.c index 417a944b1c..0d4803f517 100644 --- a/testsuites/sptests/spsyslock01/init.c +++ b/testsuites/sptests/spsyslock01/init.c @@ -63,45 +63,45 @@ const char rtems_test_name[] = "SPSYSLOCK 1"; #define EVENT_CONDITION_WAIT_REC RTEMS_EVENT_10 typedef struct { - rtems_id high[2]; - rtems_id mid; - rtems_id low; - struct _Mutex_Control mtx; + rtems_id high[ 2 ]; + rtems_id mid; + rtems_id low; + struct _Mutex_Control mtx; struct _Mutex_recursive_Control rec_mtx; - struct _Condition_Control cond; - struct _Semaphore_Control sem; - struct _Futex_Control futex; - int val; - int eno[2]; - int generation[2]; - int current_generation[2]; - jmp_buf deadlock_return_context; + struct _Condition_Control cond; + struct _Semaphore_Control sem; + struct _Futex_Control futex; + int val; + int eno[ 2 ]; + int generation[ 2 ]; + int current_generation[ 2 ]; + jmp_buf deadlock_return_context; } test_context; static test_context test_instance; -static int generation(test_context *ctx, size_t idx) +static int generation( test_context *ctx, size_t idx ) { - return ++ctx->current_generation[idx]; + return ++ctx->current_generation[ idx ]; } -static void send_event(test_context *ctx, size_t idx, rtems_event_set events) +static void send_event( test_context *ctx, size_t idx, rtems_event_set events ) { rtems_status_code sc; - sc = rtems_event_send(ctx->high[idx], events); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_send( ctx->high[ idx ], events ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void get_abs_timeout(struct timespec *to) +static void get_abs_timeout( struct timespec *to ) { int rv; - rv = clock_gettime(CLOCK_REALTIME, to); - rtems_test_assert(rv == 0); + rv = clock_gettime( CLOCK_REALTIME, to ); + rtems_test_assert( rv == 0 ); to->tv_nsec += 2 * US_PER_TICK * 1000; - if (to->tv_nsec >= 1000000000) { + if ( to->tv_nsec >= 1000000000 ) { ++to->tv_sec; to->tv_nsec -= 1000000000; } @@ -112,11 +112,10 @@ static bool eq_tq( const struct _Thread_queue_Queue *b ) { - return a->_Lock._next_ticket == b->_Lock._next_ticket - && a->_Lock._now_serving == b->_Lock._now_serving - && a->_heads == b->_heads - && a->_owner == b->_owner - && a->_name == b->_name; + return a->_Lock._next_ticket == b->_Lock._next_ticket && + a->_Lock._now_serving == b->_Lock._now_serving && + a->_heads == b->_heads && a->_owner == b->_owner && + a->_name == b->_name; } static bool eq_mtx( @@ -124,7 +123,7 @@ static bool eq_mtx( const struct _Mutex_Control *b ) { - return eq_tq(&a->_Queue, &b->_Queue); + return eq_tq( &a->_Queue, &b->_Queue ); } static bool eq_rec_mtx( @@ -132,8 +131,7 @@ static bool eq_rec_mtx( const struct _Mutex_recursive_Control *b ) { - return eq_mtx(&a->_Mutex, &b->_Mutex) - && a->_nest_level == b->_nest_level; + return eq_mtx( &a->_Mutex, &b->_Mutex ) && a->_nest_level == b->_nest_level; } static bool eq_cond( @@ -141,7 +139,7 @@ static bool eq_cond( const struct _Condition_Control *b ) { - return eq_tq(&a->_Queue, &b->_Queue); + return eq_tq( &a->_Queue, &b->_Queue ); } static bool eq_sem( @@ -149,8 +147,7 @@ static bool eq_sem( const struct _Semaphore_Control *b ) { - return eq_tq(&a->_Queue, &b->_Queue) - && a->_count == b->_count; + return eq_tq( &a->_Queue, &b->_Queue ) && a->_count == b->_count; } static bool eq_futex( @@ -158,435 +155,435 @@ static bool eq_futex( const struct _Futex_Control *b ) { - return eq_tq(&a->_Queue, &b->_Queue); + return eq_tq( &a->_Queue, &b->_Queue ); } -static void test_initialization(test_context *ctx) +static void test_initialization( test_context *ctx ) { - struct _Mutex_Control mtx = _MUTEX_INITIALIZER; + struct _Mutex_Control mtx = _MUTEX_INITIALIZER; struct _Mutex_recursive_Control rec_mtx = _MUTEX_RECURSIVE_INITIALIZER; - struct _Condition_Control cond = _CONDITION_INITIALIZER; - struct _Semaphore_Control sem = _SEMAPHORE_INITIALIZER(1); - struct _Futex_Control futex = _FUTEX_INITIALIZER; + struct _Condition_Control cond = _CONDITION_INITIALIZER; + struct _Semaphore_Control sem = _SEMAPHORE_INITIALIZER( 1 ); + struct _Futex_Control futex = _FUTEX_INITIALIZER; - _Mutex_Initialize(&ctx->mtx); - _Mutex_recursive_Initialize(&ctx->rec_mtx); - _Condition_Initialize(&ctx->cond); - _Semaphore_Initialize(&ctx->sem, 1); - _Futex_Initialize(&ctx->futex); + _Mutex_Initialize( &ctx->mtx ); + _Mutex_recursive_Initialize( &ctx->rec_mtx ); + _Condition_Initialize( &ctx->cond ); + _Semaphore_Initialize( &ctx->sem, 1 ); + _Futex_Initialize( &ctx->futex ); - rtems_test_assert(eq_mtx(&mtx, &ctx->mtx)); - rtems_test_assert(eq_rec_mtx(&rec_mtx, &ctx->rec_mtx)); - rtems_test_assert(eq_cond(&cond, &ctx->cond)); - rtems_test_assert(eq_sem(&sem, &ctx->sem)); - rtems_test_assert(eq_futex(&futex, &ctx->futex)); + rtems_test_assert( eq_mtx( &mtx, &ctx->mtx ) ); + rtems_test_assert( eq_rec_mtx( &rec_mtx, &ctx->rec_mtx ) ); + rtems_test_assert( eq_cond( &cond, &ctx->cond ) ); + rtems_test_assert( eq_sem( &sem, &ctx->sem ) ); + rtems_test_assert( eq_futex( &futex, &ctx->futex ) ); - _Mutex_Destroy(&mtx); - _Mutex_recursive_Destroy(&rec_mtx); - _Condition_Destroy(&cond); - _Semaphore_Destroy(&sem); - _Futex_Destroy(&futex); + _Mutex_Destroy( &mtx ); + _Mutex_recursive_Destroy( &rec_mtx ); + _Condition_Destroy( &cond ); + _Semaphore_Destroy( &sem ); + _Futex_Destroy( &futex ); } -static void test_recursive_acquire_normal(test_context *ctx) +static void test_recursive_acquire_normal( test_context *ctx ) { struct _Mutex_Control *mtx = &ctx->mtx; - size_t idx = 0; - int eno; + size_t idx = 0; + int eno; - eno = _Mutex_Try_acquire(mtx); - rtems_test_assert(eno == 0); + eno = _Mutex_Try_acquire( mtx ); + rtems_test_assert( eno == 0 ); - eno = _Mutex_Try_acquire(mtx); - rtems_test_assert(eno == EBUSY); + eno = _Mutex_Try_acquire( mtx ); + rtems_test_assert( eno == EBUSY ); - _Mutex_Release(mtx); + _Mutex_Release( mtx ); - eno = _Mutex_Try_acquire(mtx); - rtems_test_assert(eno == 0); + eno = _Mutex_Try_acquire( mtx ); + rtems_test_assert( eno == 0 ); - _Mutex_Release(mtx); + _Mutex_Release( mtx ); - _Mutex_Acquire(mtx); + _Mutex_Acquire( mtx ); - eno = _Mutex_Try_acquire(mtx); - rtems_test_assert(eno == EBUSY); + eno = _Mutex_Try_acquire( mtx ); + rtems_test_assert( eno == EBUSY ); - _Mutex_Release(mtx); + _Mutex_Release( mtx ); - send_event(ctx, idx, EVENT_MTX_ACQUIRE); + send_event( ctx, idx, EVENT_MTX_ACQUIRE ); - eno = _Mutex_Try_acquire(mtx); - rtems_test_assert(eno == EBUSY); + eno = _Mutex_Try_acquire( mtx ); + rtems_test_assert( eno == EBUSY ); - send_event(ctx, idx, EVENT_MTX_RELEASE); + send_event( ctx, idx, EVENT_MTX_RELEASE ); } -static void test_recursive_acquire_recursive(test_context *ctx) +static void test_recursive_acquire_recursive( test_context *ctx ) { struct _Mutex_recursive_Control *mtx = &ctx->rec_mtx; - size_t idx = 0; - int eno; + size_t idx = 0; + int eno; - eno = _Mutex_recursive_Try_acquire(mtx); - rtems_test_assert(eno == 0); + eno = _Mutex_recursive_Try_acquire( mtx ); + rtems_test_assert( eno == 0 ); - _Mutex_recursive_Acquire(mtx); + _Mutex_recursive_Acquire( mtx ); - eno = _Mutex_recursive_Try_acquire(mtx); - rtems_test_assert(eno == 0); + eno = _Mutex_recursive_Try_acquire( mtx ); + rtems_test_assert( eno == 0 ); - _Mutex_recursive_Release(mtx); - _Mutex_recursive_Release(mtx); - _Mutex_recursive_Release(mtx); + _Mutex_recursive_Release( mtx ); + _Mutex_recursive_Release( mtx ); + _Mutex_recursive_Release( mtx ); - send_event(ctx, idx, EVENT_REC_MTX_ACQUIRE); + send_event( ctx, idx, EVENT_REC_MTX_ACQUIRE ); - eno = _Mutex_recursive_Try_acquire(mtx); - rtems_test_assert(eno == EBUSY); + eno = _Mutex_recursive_Try_acquire( mtx ); + rtems_test_assert( eno == EBUSY ); - send_event(ctx, idx, EVENT_REC_MTX_RELEASE); + send_event( ctx, idx, EVENT_REC_MTX_RELEASE ); } -static void test_prio_acquire_order(test_context *ctx) +static void test_prio_acquire_order( test_context *ctx ) { struct _Mutex_Control *mtx = &ctx->mtx; - size_t a = 0; - size_t b = 1; - int gen_a; - int gen_b; + size_t a = 0; + size_t b = 1; + int gen_a; + int gen_b; - _Mutex_Acquire(mtx); + _Mutex_Acquire( mtx ); - gen_a = ctx->generation[a]; - gen_b = ctx->generation[b]; + gen_a = ctx->generation[ a ]; + gen_b = ctx->generation[ b ]; - send_event(ctx, b, EVENT_MTX_ACQUIRE); - send_event(ctx, a, EVENT_MTX_ACQUIRE); + send_event( ctx, b, EVENT_MTX_ACQUIRE ); + send_event( ctx, a, EVENT_MTX_ACQUIRE ); - rtems_test_assert(ctx->generation[a] == gen_a); - rtems_test_assert(ctx->generation[b] == gen_b); + rtems_test_assert( ctx->generation[ a ] == gen_a ); + rtems_test_assert( ctx->generation[ b ] == gen_b ); - _Mutex_Release(mtx); + _Mutex_Release( mtx ); - rtems_test_assert(ctx->generation[a] == gen_a + 1); - rtems_test_assert(ctx->generation[b] == gen_b); + rtems_test_assert( ctx->generation[ a ] == gen_a + 1 ); + rtems_test_assert( ctx->generation[ b ] == gen_b ); - send_event(ctx, a, EVENT_MTX_RELEASE); + send_event( ctx, a, EVENT_MTX_RELEASE ); - rtems_test_assert(ctx->generation[a] == gen_a + 1); - rtems_test_assert(ctx->generation[b] == gen_b + 1); + rtems_test_assert( ctx->generation[ a ] == gen_a + 1 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 1 ); - send_event(ctx, b, EVENT_MTX_RELEASE); + send_event( ctx, b, EVENT_MTX_RELEASE ); } -static void test_prio_inv_normal(test_context *ctx) +static void test_prio_inv_normal( test_context *ctx ) { struct _Mutex_Control *mtx = &ctx->mtx; - size_t idx = 0; - int gen; + size_t idx = 0; + int gen; - _Mutex_Acquire(mtx); - gen = ctx->generation[idx]; - send_event(ctx, idx, EVENT_MTX_PRIO_INV); - rtems_test_assert(ctx->generation[idx] == gen); - _Mutex_Release(mtx); - rtems_test_assert(ctx->generation[idx] == gen + 1); + _Mutex_Acquire( mtx ); + gen = ctx->generation[ idx ]; + send_event( ctx, idx, EVENT_MTX_PRIO_INV ); + rtems_test_assert( ctx->generation[ idx ] == gen ); + _Mutex_Release( mtx ); + rtems_test_assert( ctx->generation[ idx ] == gen + 1 ); } -static void test_prio_inv_recursive(test_context *ctx) +static void test_prio_inv_recursive( test_context *ctx ) { struct _Mutex_recursive_Control *mtx = &ctx->rec_mtx; - size_t idx = 0; - int gen; + size_t idx = 0; + int gen; - _Mutex_recursive_Acquire(mtx); - gen = ctx->generation[idx]; - send_event(ctx, idx, EVENT_REC_MTX_PRIO_INV); - rtems_test_assert(ctx->generation[idx] == gen); - _Mutex_recursive_Release(mtx); - rtems_test_assert(ctx->generation[idx] == gen + 1); + _Mutex_recursive_Acquire( mtx ); + gen = ctx->generation[ idx ]; + send_event( ctx, idx, EVENT_REC_MTX_PRIO_INV ); + rtems_test_assert( ctx->generation[ idx ] == gen ); + _Mutex_recursive_Release( mtx ); + rtems_test_assert( ctx->generation[ idx ] == gen + 1 ); } -static void test_mtx_timeout_normal(test_context *ctx) +static void test_mtx_timeout_normal( test_context *ctx ) { struct _Mutex_Control *mtx = &ctx->mtx; - size_t idx = 0; - struct timespec to; - int eno; + size_t idx = 0; + struct timespec to; + int eno; - eno = _Mutex_Acquire_timed(mtx, NULL); - rtems_test_assert(eno == 0); - _Mutex_Release(mtx); + eno = _Mutex_Acquire_timed( mtx, NULL ); + rtems_test_assert( eno == 0 ); + _Mutex_Release( mtx ); - send_event(ctx, idx, EVENT_MTX_ACQUIRE); + send_event( ctx, idx, EVENT_MTX_ACQUIRE ); - memset(&to, 0x00, sizeof(to)); - eno = _Mutex_Acquire_timed(mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); - memset(&to, 0xff, sizeof(to)); - eno = _Mutex_Acquire_timed(mtx, &to); - rtems_test_assert(eno == EINVAL); - get_abs_timeout(&to); - eno = _Mutex_Acquire_timed(mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); + memset( &to, 0x00, sizeof( to ) ); + eno = _Mutex_Acquire_timed( mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); + memset( &to, 0xff, sizeof( to ) ); + eno = _Mutex_Acquire_timed( mtx, &to ); + rtems_test_assert( eno == EINVAL ); + get_abs_timeout( &to ); + eno = _Mutex_Acquire_timed( mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); - send_event(ctx, idx, EVENT_MTX_RELEASE); + send_event( ctx, idx, EVENT_MTX_RELEASE ); } -static void test_mtx_timeout_recursive(test_context *ctx) +static void test_mtx_timeout_recursive( test_context *ctx ) { struct _Mutex_recursive_Control *mtx = &ctx->rec_mtx; - size_t idx = 0; - struct timespec to; - int eno; + size_t idx = 0; + struct timespec to; + int eno; - eno = _Mutex_recursive_Acquire_timed(mtx, NULL); - rtems_test_assert(eno == 0); - eno = _Mutex_recursive_Acquire_timed(mtx, NULL); - rtems_test_assert(eno == 0); - _Mutex_recursive_Release(mtx); - _Mutex_recursive_Release(mtx); + eno = _Mutex_recursive_Acquire_timed( mtx, NULL ); + rtems_test_assert( eno == 0 ); + eno = _Mutex_recursive_Acquire_timed( mtx, NULL ); + rtems_test_assert( eno == 0 ); + _Mutex_recursive_Release( mtx ); + _Mutex_recursive_Release( mtx ); - send_event(ctx, idx, EVENT_REC_MTX_ACQUIRE); + send_event( ctx, idx, EVENT_REC_MTX_ACQUIRE ); - memset(&to, 0x00, sizeof(to)); - eno = _Mutex_recursive_Acquire_timed(mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); - memset(&to, 0xff, sizeof(to)); - eno = _Mutex_recursive_Acquire_timed(mtx, &to); - rtems_test_assert(eno == EINVAL); - get_abs_timeout(&to); - eno = _Mutex_recursive_Acquire_timed(mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); + memset( &to, 0x00, sizeof( to ) ); + eno = _Mutex_recursive_Acquire_timed( mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); + memset( &to, 0xff, sizeof( to ) ); + eno = _Mutex_recursive_Acquire_timed( mtx, &to ); + rtems_test_assert( eno == EINVAL ); + get_abs_timeout( &to ); + eno = _Mutex_recursive_Acquire_timed( mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); - send_event(ctx, idx, EVENT_REC_MTX_RELEASE); + send_event( ctx, idx, EVENT_REC_MTX_RELEASE ); } -static void test_mtx_deadlock(test_context *ctx) +static void test_mtx_deadlock( test_context *ctx ) { struct _Mutex_Control *mtx = &ctx->mtx; - _Mutex_Acquire(mtx); + _Mutex_Acquire( mtx ); - if (setjmp(ctx->deadlock_return_context) == 0) { - _Mutex_Acquire(mtx); + if ( setjmp( ctx->deadlock_return_context ) == 0 ) { + _Mutex_Acquire( mtx ); } - _Mutex_Release(mtx); + _Mutex_Release( mtx ); } -static void test_condition(test_context *ctx) +static void test_condition( test_context *ctx ) { struct _Condition_Control *cond = &ctx->cond; - size_t a = 0; - size_t b = 1; - int gen_a; - int gen_b; + size_t a = 0; + size_t b = 1; + int gen_a; + int gen_b; - gen_a = ctx->generation[a]; - gen_b = ctx->generation[b]; + gen_a = ctx->generation[ a ]; + gen_b = ctx->generation[ b ]; - _Condition_Signal(cond); - _Condition_Broadcast(cond); + _Condition_Signal( cond ); + _Condition_Broadcast( cond ); - send_event(ctx, a, EVENT_CONDITION_WAIT); - send_event(ctx, b, EVENT_CONDITION_WAIT_REC); + send_event( ctx, a, EVENT_CONDITION_WAIT ); + send_event( ctx, b, EVENT_CONDITION_WAIT_REC ); - rtems_test_assert(ctx->generation[a] == gen_a + 1); - rtems_test_assert(ctx->generation[b] == gen_b + 1); + rtems_test_assert( ctx->generation[ a ] == gen_a + 1 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 1 ); - _Condition_Signal(cond); + _Condition_Signal( cond ); - rtems_test_assert(ctx->generation[a] == gen_a + 2); - rtems_test_assert(ctx->generation[b] == gen_b + 1); + rtems_test_assert( ctx->generation[ a ] == gen_a + 2 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 1 ); - _Condition_Signal(cond); + _Condition_Signal( cond ); - rtems_test_assert(ctx->generation[a] == gen_a + 2); - rtems_test_assert(ctx->generation[b] == gen_b + 2); + rtems_test_assert( ctx->generation[ a ] == gen_a + 2 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 2 ); - send_event(ctx, a, EVENT_CONDITION_WAIT); - send_event(ctx, b, EVENT_CONDITION_WAIT_REC); + send_event( ctx, a, EVENT_CONDITION_WAIT ); + send_event( ctx, b, EVENT_CONDITION_WAIT_REC ); - rtems_test_assert(ctx->generation[a] == gen_a + 3); - rtems_test_assert(ctx->generation[b] == gen_b + 3); + rtems_test_assert( ctx->generation[ a ] == gen_a + 3 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 3 ); - _Condition_Broadcast(cond); + _Condition_Broadcast( cond ); - rtems_test_assert(ctx->generation[a] == gen_a + 4); - rtems_test_assert(ctx->generation[b] == gen_b + 4); + rtems_test_assert( ctx->generation[ a ] == gen_a + 4 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 4 ); } -static void test_condition_timeout(test_context *ctx) +static void test_condition_timeout( test_context *ctx ) { struct timespec to; - int eno; + int eno; - _Mutex_Acquire(&ctx->mtx); - memset(&to, 0x00, sizeof(to)); - eno = _Condition_Wait_timed(&ctx->cond, &ctx->mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); - memset(&to, 0xff, sizeof(to)); - eno = _Condition_Wait_timed(&ctx->cond, &ctx->mtx, &to); - rtems_test_assert(eno == EINVAL); - get_abs_timeout(&to); - eno = _Condition_Wait_timed(&ctx->cond, &ctx->mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); - _Mutex_Release(&ctx->mtx); + _Mutex_Acquire( &ctx->mtx ); + memset( &to, 0x00, sizeof( to ) ); + eno = _Condition_Wait_timed( &ctx->cond, &ctx->mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); + memset( &to, 0xff, sizeof( to ) ); + eno = _Condition_Wait_timed( &ctx->cond, &ctx->mtx, &to ); + rtems_test_assert( eno == EINVAL ); + get_abs_timeout( &to ); + eno = _Condition_Wait_timed( &ctx->cond, &ctx->mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); + _Mutex_Release( &ctx->mtx ); - _Mutex_recursive_Acquire(&ctx->rec_mtx); - _Mutex_recursive_Acquire(&ctx->rec_mtx); - memset(&to, 0x00, sizeof(to)); - eno = _Condition_Wait_recursive_timed(&ctx->cond, &ctx->rec_mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); - memset(&to, 0xff, sizeof(to)); - eno = _Condition_Wait_recursive_timed(&ctx->cond, &ctx->rec_mtx, &to); - rtems_test_assert(eno == EINVAL); - get_abs_timeout(&to); - eno = _Condition_Wait_recursive_timed(&ctx->cond, &ctx->rec_mtx, &to); - rtems_test_assert(eno == ETIMEDOUT); - _Mutex_recursive_Release(&ctx->rec_mtx); - _Mutex_recursive_Release(&ctx->rec_mtx); + _Mutex_recursive_Acquire( &ctx->rec_mtx ); + _Mutex_recursive_Acquire( &ctx->rec_mtx ); + memset( &to, 0x00, sizeof( to ) ); + eno = _Condition_Wait_recursive_timed( &ctx->cond, &ctx->rec_mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); + memset( &to, 0xff, sizeof( to ) ); + eno = _Condition_Wait_recursive_timed( &ctx->cond, &ctx->rec_mtx, &to ); + rtems_test_assert( eno == EINVAL ); + get_abs_timeout( &to ); + eno = _Condition_Wait_recursive_timed( &ctx->cond, &ctx->rec_mtx, &to ); + rtems_test_assert( eno == ETIMEDOUT ); + _Mutex_recursive_Release( &ctx->rec_mtx ); + _Mutex_recursive_Release( &ctx->rec_mtx ); } -static void test_sem(test_context *ctx) +static void test_sem( test_context *ctx ) { struct _Semaphore_Control *sem = &ctx->sem; - size_t idx = 0; - int gen; + size_t idx = 0; + int gen; - _Semaphore_Wait(sem); - gen = ctx->generation[idx]; - send_event(ctx, idx, EVENT_SEM_WAIT); - rtems_test_assert(ctx->generation[idx] == gen); - _Semaphore_Post(sem); - rtems_test_assert(ctx->generation[idx] == gen + 1); - _Semaphore_Post(sem); + _Semaphore_Wait( sem ); + gen = ctx->generation[ idx ]; + send_event( ctx, idx, EVENT_SEM_WAIT ); + rtems_test_assert( ctx->generation[ idx ] == gen ); + _Semaphore_Post( sem ); + rtems_test_assert( ctx->generation[ idx ] == gen + 1 ); + _Semaphore_Post( sem ); } -static void test_sem_prio_wait_order(test_context *ctx) +static void test_sem_prio_wait_order( test_context *ctx ) { struct _Semaphore_Control *sem = &ctx->sem; - size_t a = 0; - size_t b = 1; - int gen_a; - int gen_b; + size_t a = 0; + size_t b = 1; + int gen_a; + int gen_b; - _Semaphore_Wait(sem); + _Semaphore_Wait( sem ); - gen_a = ctx->generation[a]; - gen_b = ctx->generation[b]; + gen_a = ctx->generation[ a ]; + gen_b = ctx->generation[ b ]; - send_event(ctx, b, EVENT_SEM_WAIT); - send_event(ctx, a, EVENT_SEM_WAIT); + send_event( ctx, b, EVENT_SEM_WAIT ); + send_event( ctx, a, EVENT_SEM_WAIT ); - rtems_test_assert(ctx->generation[a] == gen_a); - rtems_test_assert(ctx->generation[b] == gen_b); + rtems_test_assert( ctx->generation[ a ] == gen_a ); + rtems_test_assert( ctx->generation[ b ] == gen_b ); - _Semaphore_Post(sem); + _Semaphore_Post( sem ); - rtems_test_assert(ctx->generation[a] == gen_a + 1); - rtems_test_assert(ctx->generation[b] == gen_b); + rtems_test_assert( ctx->generation[ a ] == gen_a + 1 ); + rtems_test_assert( ctx->generation[ b ] == gen_b ); - _Semaphore_Post(sem); + _Semaphore_Post( sem ); - rtems_test_assert(ctx->generation[a] == gen_a + 1); - rtems_test_assert(ctx->generation[b] == gen_b + 1); + rtems_test_assert( ctx->generation[ a ] == gen_a + 1 ); + rtems_test_assert( ctx->generation[ b ] == gen_b + 1 ); } -static void test_futex(test_context *ctx) +static void test_futex( test_context *ctx ) { struct _Futex_Control *futex = &ctx->futex; - size_t a = 0; - size_t b = 1; - int eno; - int woken; + size_t a = 0; + size_t b = 1; + int eno; + int woken; - eno = _Futex_Wait(futex, &ctx->val, 1); - rtems_test_assert(eno == EWOULDBLOCK); + eno = _Futex_Wait( futex, &ctx->val, 1 ); + rtems_test_assert( eno == EWOULDBLOCK ); - woken = _Futex_Wake(futex, 0); - rtems_test_assert(woken == 0); + woken = _Futex_Wake( futex, 0 ); + rtems_test_assert( woken == 0 ); - woken = _Futex_Wake(futex, 1); - rtems_test_assert(woken == 0); + woken = _Futex_Wake( futex, 1 ); + rtems_test_assert( woken == 0 ); ctx->val = 1; - ctx->eno[a] = -1; - send_event(ctx, a, EVENT_FUTEX_WAIT); - rtems_test_assert(ctx->eno[a] == -1); + ctx->eno[ a ] = -1; + send_event( ctx, a, EVENT_FUTEX_WAIT ); + rtems_test_assert( ctx->eno[ a ] == -1 ); - woken = _Futex_Wake(futex, INT_MAX); - rtems_test_assert(woken == 1); - rtems_test_assert(ctx->eno[a] == 0); + woken = _Futex_Wake( futex, INT_MAX ); + rtems_test_assert( woken == 1 ); + rtems_test_assert( ctx->eno[ a ] == 0 ); - ctx->eno[a] = -1; - ctx->eno[b] = -1; - send_event(ctx, a, EVENT_FUTEX_WAIT); - send_event(ctx, b, EVENT_FUTEX_WAIT); - rtems_test_assert(ctx->eno[a] == -1); - rtems_test_assert(ctx->eno[b] == -1); + ctx->eno[ a ] = -1; + ctx->eno[ b ] = -1; + send_event( ctx, a, EVENT_FUTEX_WAIT ); + send_event( ctx, b, EVENT_FUTEX_WAIT ); + rtems_test_assert( ctx->eno[ a ] == -1 ); + rtems_test_assert( ctx->eno[ b ] == -1 ); - woken = _Futex_Wake(futex, 1); - rtems_test_assert(woken == 1); - rtems_test_assert(ctx->eno[a] == 0); - rtems_test_assert(ctx->eno[b] == -1); + woken = _Futex_Wake( futex, 1 ); + rtems_test_assert( woken == 1 ); + rtems_test_assert( ctx->eno[ a ] == 0 ); + rtems_test_assert( ctx->eno[ b ] == -1 ); - woken = _Futex_Wake(futex, 1); - rtems_test_assert(woken == 1); - rtems_test_assert(ctx->eno[a] == 0); - rtems_test_assert(ctx->eno[b] == 0); + woken = _Futex_Wake( futex, 1 ); + rtems_test_assert( woken == 1 ); + rtems_test_assert( ctx->eno[ a ] == 0 ); + rtems_test_assert( ctx->eno[ b ] == 0 ); - ctx->eno[a] = -1; - ctx->eno[b] = -1; - send_event(ctx, a, EVENT_FUTEX_WAIT); - send_event(ctx, b, EVENT_FUTEX_WAIT); - rtems_test_assert(ctx->eno[a] == -1); - rtems_test_assert(ctx->eno[b] == -1); + ctx->eno[ a ] = -1; + ctx->eno[ b ] = -1; + send_event( ctx, a, EVENT_FUTEX_WAIT ); + send_event( ctx, b, EVENT_FUTEX_WAIT ); + rtems_test_assert( ctx->eno[ a ] == -1 ); + rtems_test_assert( ctx->eno[ b ] == -1 ); - woken = _Futex_Wake(futex, 2); - rtems_test_assert(woken == 2); - rtems_test_assert(ctx->eno[a] == 0); - rtems_test_assert(ctx->eno[b] == 0); + woken = _Futex_Wake( futex, 2 ); + rtems_test_assert( woken == 2 ); + rtems_test_assert( ctx->eno[ a ] == 0 ); + rtems_test_assert( ctx->eno[ b ] == 0 ); } -static void test_sched(void) +static void test_sched( void ) { - rtems_test_assert(_Sched_Index() == 0); - rtems_test_assert(_Sched_Name_to_index("", 0) == -1); - rtems_test_assert(_Sched_Name_to_index("b", 1) == -1); - rtems_test_assert(_Sched_Name_to_index("bl", 2) == -1); - rtems_test_assert(_Sched_Name_to_index("blu", 3) == -1); - rtems_test_assert(_Sched_Name_to_index("blue", 4) == 0); - rtems_test_assert(_Sched_Name_to_index("blueX", 5) == 0); - rtems_test_assert(_Sched_Processor_count(-1) == 0); - rtems_test_assert(_Sched_Processor_count(0) == 1); - rtems_test_assert(_Sched_Processor_count(1) == 0); + rtems_test_assert( _Sched_Index() == 0 ); + rtems_test_assert( _Sched_Name_to_index( "", 0 ) == -1 ); + rtems_test_assert( _Sched_Name_to_index( "b", 1 ) == -1 ); + rtems_test_assert( _Sched_Name_to_index( "bl", 2 ) == -1 ); + rtems_test_assert( _Sched_Name_to_index( "blu", 3 ) == -1 ); + rtems_test_assert( _Sched_Name_to_index( "blue", 4 ) == 0 ); + rtems_test_assert( _Sched_Name_to_index( "blueX", 5 ) == 0 ); + rtems_test_assert( _Sched_Processor_count( -1 ) == 0 ); + rtems_test_assert( _Sched_Processor_count( 0 ) == 1 ); + rtems_test_assert( _Sched_Processor_count( 1 ) == 0 ); } -static void mid_task(rtems_task_argument arg) +static void mid_task( rtems_task_argument arg ) { (void) arg; - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void high_task(rtems_task_argument idx) +static void high_task( rtems_task_argument idx ) { - test_context *ctx = &test_instance; + test_context *ctx = &test_instance; rtems_status_code sc; - if (idx == 0) { - sc = rtems_task_start(ctx->mid, mid_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + if ( idx == 0 ) { + sc = rtems_task_start( ctx->mid, mid_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_suspend(ctx->mid); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_suspend( ctx->mid ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - while (true) { + while ( true ) { rtems_event_set events; sc = rtems_event_receive( @@ -595,155 +592,155 @@ static void high_task(rtems_task_argument idx) RTEMS_NO_TIMEOUT, &events ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - if ((events & EVENT_MTX_ACQUIRE) != 0) { - _Mutex_Acquire(&ctx->mtx); - ctx->generation[idx] = generation(ctx, idx); + if ( ( events & EVENT_MTX_ACQUIRE ) != 0 ) { + _Mutex_Acquire( &ctx->mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); } - if ((events & EVENT_MTX_RELEASE) != 0) { - _Mutex_Release(&ctx->mtx); + if ( ( events & EVENT_MTX_RELEASE ) != 0 ) { + _Mutex_Release( &ctx->mtx ); } - if ((events & EVENT_MTX_PRIO_INV) != 0) { - sc = rtems_task_resume(ctx->mid); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + if ( ( events & EVENT_MTX_PRIO_INV ) != 0 ) { + sc = rtems_task_resume( ctx->mid ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - _Mutex_Acquire(&ctx->mtx); - ctx->generation[idx] = generation(ctx, idx); - _Mutex_Release(&ctx->mtx); + _Mutex_Acquire( &ctx->mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); + _Mutex_Release( &ctx->mtx ); - sc = rtems_task_suspend(ctx->mid); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_suspend( ctx->mid ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - if ((events & EVENT_REC_MTX_ACQUIRE) != 0) { - _Mutex_recursive_Acquire(&ctx->rec_mtx); + if ( ( events & EVENT_REC_MTX_ACQUIRE ) != 0 ) { + _Mutex_recursive_Acquire( &ctx->rec_mtx ); } - if ((events & EVENT_REC_MTX_RELEASE) != 0) { - _Mutex_recursive_Release(&ctx->rec_mtx); + if ( ( events & EVENT_REC_MTX_RELEASE ) != 0 ) { + _Mutex_recursive_Release( &ctx->rec_mtx ); } - if ((events & EVENT_REC_MTX_PRIO_INV) != 0) { - sc = rtems_task_resume(ctx->mid); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + if ( ( events & EVENT_REC_MTX_PRIO_INV ) != 0 ) { + sc = rtems_task_resume( ctx->mid ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - _Mutex_recursive_Acquire(&ctx->rec_mtx); - ctx->generation[idx] = generation(ctx, idx); - _Mutex_recursive_Release(&ctx->rec_mtx); + _Mutex_recursive_Acquire( &ctx->rec_mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); + _Mutex_recursive_Release( &ctx->rec_mtx ); - sc = rtems_task_suspend(ctx->mid); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_suspend( ctx->mid ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - if ((events & EVENT_SEM_WAIT) != 0) { - _Semaphore_Wait(&ctx->sem); - ctx->generation[idx] = generation(ctx, idx); + if ( ( events & EVENT_SEM_WAIT ) != 0 ) { + _Semaphore_Wait( &ctx->sem ); + ctx->generation[ idx ] = generation( ctx, idx ); } - if ((events & EVENT_FUTEX_WAIT) != 0) { - ctx->eno[idx] = _Futex_Wait(&ctx->futex, &ctx->val, 1); + if ( ( events & EVENT_FUTEX_WAIT ) != 0 ) { + ctx->eno[ idx ] = _Futex_Wait( &ctx->futex, &ctx->val, 1 ); } - if ((events & EVENT_CONDITION_WAIT) != 0) { - _Mutex_Acquire(&ctx->mtx); - ctx->generation[idx] = generation(ctx, idx); - _Condition_Wait(&ctx->cond, &ctx->mtx); - ctx->generation[idx] = generation(ctx, idx); - _Mutex_Release(&ctx->mtx); + if ( ( events & EVENT_CONDITION_WAIT ) != 0 ) { + _Mutex_Acquire( &ctx->mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); + _Condition_Wait( &ctx->cond, &ctx->mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); + _Mutex_Release( &ctx->mtx ); } - if ((events & EVENT_CONDITION_WAIT_REC) != 0) { - _Mutex_recursive_Acquire(&ctx->rec_mtx); - _Mutex_recursive_Acquire(&ctx->rec_mtx); - ctx->generation[idx] = generation(ctx, idx); - _Condition_Wait_recursive(&ctx->cond, &ctx->rec_mtx); - ctx->generation[idx] = generation(ctx, idx); - _Mutex_recursive_Release(&ctx->rec_mtx); - _Mutex_recursive_Release(&ctx->rec_mtx); + if ( ( events & EVENT_CONDITION_WAIT_REC ) != 0 ) { + _Mutex_recursive_Acquire( &ctx->rec_mtx ); + _Mutex_recursive_Acquire( &ctx->rec_mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); + _Condition_Wait_recursive( &ctx->cond, &ctx->rec_mtx ); + ctx->generation[ idx ] = generation( ctx, idx ); + _Mutex_recursive_Release( &ctx->rec_mtx ); + _Mutex_recursive_Release( &ctx->rec_mtx ); } } } -static void test(void) +static void test( void ) { - test_context *ctx = &test_instance; + test_context *ctx = &test_instance; rtems_status_code sc; - test_initialization(ctx); + test_initialization( ctx ); ctx->low = rtems_task_self(); sc = rtems_task_create( - rtems_build_name('M', 'I', 'D', ' '), + rtems_build_name( 'M', 'I', 'D', ' ' ), 3, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx->mid ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('H', 'I', 'G', '0'), + rtems_build_name( 'H', 'I', 'G', '0' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &ctx->high[0] + &ctx->high[ 0 ] ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(ctx->high[0], high_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( ctx->high[ 0 ], high_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_task_create( - rtems_build_name('H', 'I', 'G', '1'), + rtems_build_name( 'H', 'I', 'G', '1' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, - &ctx->high[1] + &ctx->high[ 1 ] ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(ctx->high[1], high_task, 1); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( ctx->high[ 1 ], high_task, 1 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - test_recursive_acquire_normal(ctx); - test_recursive_acquire_recursive(ctx); - test_prio_acquire_order(ctx); - test_prio_inv_normal(ctx); - test_prio_inv_recursive(ctx); - test_mtx_timeout_normal(ctx); - test_mtx_timeout_recursive(ctx); - test_mtx_deadlock(ctx); - test_condition(ctx); - test_condition_timeout(ctx); - test_sem(ctx); - test_sem_prio_wait_order(ctx); - test_futex(ctx); + test_recursive_acquire_normal( ctx ); + test_recursive_acquire_recursive( ctx ); + test_prio_acquire_order( ctx ); + test_prio_inv_normal( ctx ); + test_prio_inv_recursive( ctx ); + test_mtx_timeout_normal( ctx ); + test_mtx_timeout_recursive( ctx ); + test_mtx_deadlock( ctx ); + test_condition( ctx ); + test_condition_timeout( ctx ); + test_sem( ctx ); + test_sem_prio_wait_order( ctx ); + test_futex( ctx ); test_sched(); - sc = rtems_task_delete(ctx->mid); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( ctx->mid ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(ctx->high[0]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( ctx->high[ 0 ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_delete(ctx->high[1]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( ctx->high[ 1 ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - _Mutex_Destroy(&ctx->mtx); - _Mutex_recursive_Destroy(&ctx->rec_mtx); - _Condition_Destroy(&ctx->cond); - _Semaphore_Destroy(&ctx->sem); - _Futex_Destroy(&ctx->futex); + _Mutex_Destroy( &ctx->mtx ); + _Mutex_recursive_Destroy( &ctx->rec_mtx ); + _Condition_Destroy( &ctx->cond ); + _Semaphore_Destroy( &ctx->sem ); + _Futex_Destroy( &ctx->futex ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -752,25 +749,23 @@ static void Init(rtems_task_argument arg) test(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } static void fatal_extension( rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code error + bool always_set_to_false, + rtems_fatal_code error ) { - if ( - source == INTERNAL_ERROR_CORE - && !always_set_to_false - && error == INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK + source == INTERNAL_ERROR_CORE && !always_set_to_false && + error == INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK ) { test_context *ctx = &test_instance; - _ISR_Set_level(0); - longjmp(ctx->deadlock_return_context, 1); + _ISR_Set_level( 0 ); + longjmp( ctx->deadlock_return_context, 1 ); } } @@ -782,15 +777,14 @@ static void fatal_extension( #define CONFIGURE_MAXIMUM_TASKS 4 #define CONFIGURE_INITIAL_EXTENSIONS \ - { .fatal = fatal_extension }, \ - RTEMS_TEST_INITIAL_EXTENSION + { .fatal = fatal_extension }, RTEMS_TEST_INITIAL_EXTENSION -#define CONFIGURE_INIT_TASK_PRIORITY 4 +#define CONFIGURE_INIT_TASK_PRIORITY 4 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_SCHEDULER_NAME rtems_build_name('b', 'l', 'u', 'e') +#define CONFIGURE_SCHEDULER_NAME rtems_build_name( 'b', 'l', 'u', 'e' ) #define CONFIGURE_INIT diff --git a/testsuites/sptests/sptask_err01/init.c b/testsuites/sptests/sptask_err01/init.c index c5cce2d804..af7dcba57a 100644 --- a/testsuites/sptests/sptask_err01/init.c +++ b/testsuites/sptests/sptask_err01/init.c @@ -35,17 +35,15 @@ const char rtems_test_name[] = "SP TASK ERROR 01"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_status_code status; - + TEST_BEGIN(); - - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); status = rtems_task_create( Task_name[ 2 ], @@ -57,11 +55,11 @@ rtems_task Init( ); directive_failed( status, "rtems_task_create of TA2" ); puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" ); - + puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" ); status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); - directive_failed( status, "rtems_task_start of TA2" ); - + directive_failed( status, "rtems_task_start of TA2" ); + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after (yield)" ); diff --git a/testsuites/sptests/sptask_err01/system.h b/testsuites/sptests/sptask_err01/system.h index 7224f5fe25..046857e115 100644 --- a/testsuites/sptests/sptask_err01/system.h +++ b/testsuites/sptests/sptask_err01/system.h @@ -35,38 +35,34 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_2( - rtems_task_argument argument -); +rtems_task Task_2( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ /* end of include file */ diff --git a/testsuites/sptests/sptask_err01/task2.c b/testsuites/sptests/sptask_err01/task2.c index f464882f99..728d9bae90 100644 --- a/testsuites/sptests/sptask_err01/task2.c +++ b/testsuites/sptests/sptask_err01/task2.c @@ -41,9 +41,7 @@ #include "system.h" -rtems_task Task_2( - rtems_task_argument argument -) +rtems_task Task_2( rtems_task_argument argument ) { (void) argument; diff --git a/testsuites/sptests/sptask_err02/init.c b/testsuites/sptests/sptask_err02/init.c index 72a4a99caa..087f346c36 100644 --- a/testsuites/sptests/sptask_err02/init.c +++ b/testsuites/sptests/sptask_err02/init.c @@ -35,17 +35,15 @@ const char rtems_test_name[] = "SP TASK ERROR 02"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_time_of_day time; rtems_status_code status; - + TEST_BEGIN(); - + /* wake when NULL param */ status = rtems_task_wake_when( NULL ); fatal_directive_status( @@ -59,8 +57,8 @@ rtems_task Init( status = rtems_task_wake_when( &time ); if ( status == RTEMS_SUCCESSFUL ) { puts( - "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- " - "DID BSP SET THE TIME OF DAY?" + "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- " + "DID BSP SET THE TIME OF DAY?" ); } else { fatal_directive_status( @@ -69,9 +67,9 @@ rtems_task Init( "rtems_task_wake_when before clock is set" ); puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" ); - } + } /* rtems_task_wake_when */ - + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); print_time( "TA1 - rtems_clock_set - ", &time, "" ); status = rtems_clock_set( &time ); @@ -80,7 +78,12 @@ rtems_task Init( build_time( &time, - 2, 5, 1988, 8, 30, 48, + 2, + 5, + 1988, + 8, + 30, + 48, rtems_clock_get_ticks_per_second() + 1 ); time.second += 3; @@ -101,7 +104,9 @@ rtems_task Init( status, "rtems_task_wake_when with invalid ticks per second" ); - puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" ); + puts( + "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" + ); build_time( &time, 2, 5, 1961, 8, 30, 48, 0 ); print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); diff --git a/testsuites/sptests/sptask_err02/system.h b/testsuites/sptests/sptask_err02/system.h index c9e57a6c79..8ce9d85247 100644 --- a/testsuites/sptests/sptask_err02/system.h +++ b/testsuites/sptests/sptask_err02/system.h @@ -35,17 +35,15 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sptask_err03/init.c b/testsuites/sptests/sptask_err03/init.c index 37e892263a..81cc6d7c38 100644 --- a/testsuites/sptests/sptask_err03/init.c +++ b/testsuites/sptests/sptask_err03/init.c @@ -35,28 +35,26 @@ const char rtems_test_name[] = "SP TASK ERROR 03"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; rtems_name task_name; rtems_status_code status; - bool skipUnsatisfied; - + bool skipUnsatisfied; + TEST_BEGIN(); - - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); - Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); - Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); - Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); - Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); - Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); - Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' ); - Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' ); - Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' ); - Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); + Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' ); + Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' ); + Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' ); + Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' ); /* task create bad name */ task_name = 1; @@ -97,30 +95,31 @@ rtems_task Init( */ skipUnsatisfied = false; - if (rtems_configuration_get_stack_allocate_hook()) + if ( rtems_configuration_get_stack_allocate_hook() ) { skipUnsatisfied = true; + } if ( skipUnsatisfied ) { puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED -- SKIPPED" ); } else { - status = rtems_task_create( - task_name, - 1, - rtems_configuration_get_work_space_size(), - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Junk_id - ); - fatal_directive_status( - status, - RTEMS_UNSATISFIED, - "rtems_task_create with a stack size larger than the workspace" - ); - puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" ); + status = rtems_task_create( + task_name, + 1, + rtems_configuration_get_work_space_size(), + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_task_create with a stack size larger than the workspace" + ); + puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" ); } - status = rtems_task_create( + status = rtems_task_create( Task_name[ 1 ], 4, RTEMS_MINIMUM_STACK_SIZE * 3, diff --git a/testsuites/sptests/sptask_err03/system.h b/testsuites/sptests/sptask_err03/system.h index b399f71e8c..5c2a73852b 100644 --- a/testsuites/sptests/sptask_err03/system.h +++ b/testsuites/sptests/sptask_err03/system.h @@ -35,34 +35,32 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 10 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_PERIODS 1 -#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 -#define CONFIGURE_TICKS_PER_TIMESLICE 100 +#define CONFIGURE_MAXIMUM_TASKS 10 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_PERIODS 1 +#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 +#define CONFIGURE_TICKS_PER_TIMESLICE 100 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 20 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 11 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 11 ]; /* array of task names */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ /* end of include file */ diff --git a/testsuites/sptests/sptask_err04/init.c b/testsuites/sptests/sptask_err04/init.c index fdee1f44ac..86e444e309 100644 --- a/testsuites/sptests/sptask_err04/init.c +++ b/testsuites/sptests/sptask_err04/init.c @@ -37,28 +37,26 @@ const char rtems_test_name[] = "TASK ERROR 04"; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_status_code status; - + rtems_status_code status; + TEST_BEGIN(); Task_id[ 0 ] = rtems_task_self(); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); /* priority of 0 error */ status = rtems_task_create( - Task_name[1], - 0, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + 0, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); fatal_directive_status( status, @@ -69,12 +67,12 @@ rtems_task Init( /* priority > 255 error */ status = rtems_task_create( - Task_name[1], - UINT32_C(0x80000000), - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &Task_id[ 1 ] + Task_name[ 1 ], + UINT32_C( 0x80000000 ), + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] ); fatal_directive_status( status, diff --git a/testsuites/sptests/sptask_err04/system.h b/testsuites/sptests/sptask_err04/system.h index 9cafac3aaf..ac584f2164 100644 --- a/testsuites/sptests/sptask_err04/system.h +++ b/testsuites/sptests/sptask_err04/system.h @@ -35,13 +35,9 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ @@ -56,9 +52,9 @@ rtems_task Task_1( /* global variables */ -TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 2 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 2 ]; /* array of task names */ -TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ +TEST_EXTERN rtems_id Junk_id; /* id used to return errors */ /* end of include file */ diff --git a/testsuites/sptests/sptask_err04/task1.c b/testsuites/sptests/sptask_err04/task1.c index 88976c17e6..987ded9ca2 100644 --- a/testsuites/sptests/sptask_err04/task1.c +++ b/testsuites/sptests/sptask_err04/task1.c @@ -41,10 +41,7 @@ #include "system.h" #include - -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; @@ -80,7 +77,11 @@ rtems_task Task_1( puts( "TA1 - rtems_task_ident - RTEMS_INVALID_ADDRESS" ); /* OK */ - status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &self_id ); + status = rtems_task_ident( + RTEMS_WHO_AM_I, + RTEMS_SEARCH_ALL_NODES, + &self_id + ); directive_failed( status, "rtems_task_ident of self" ); if ( self_id != Task_id[ 1 ] ) { puts( "ERROR - rtems_task_ident - incorrect ID returned!" ); @@ -108,7 +109,7 @@ rtems_task Task_1( */ status = rtems_task_ident( 100, 2, &Junk_id ); -#if defined(RTEMS_MULTIPROCESSING) +#if defined( RTEMS_MULTIPROCESSING ) fatal_directive_status( status, RTEMS_INVALID_NODE, @@ -159,7 +160,7 @@ rtems_task Task_1( /* bad priority */ status = rtems_task_set_priority( RTEMS_SELF, - UINT32_C(0x80000000), + UINT32_C( 0x80000000 ), &previous_priority ); fatal_directive_status( @@ -221,7 +222,7 @@ rtems_task Task_1( "rtems_task_mode with NULL param" ); puts( "TA1 - rtems_task_mode - RTEMS_INVALID_ADDRESS" ); - + TEST_END(); rtems_test_exit( 0 ); diff --git a/testsuites/sptests/sptasknopreempt01/init.c b/testsuites/sptests/sptasknopreempt01/init.c index ff32b6260d..bef1a9cb3a 100644 --- a/testsuites/sptests/sptasknopreempt01/init.c +++ b/testsuites/sptests/sptasknopreempt01/init.c @@ -35,30 +35,30 @@ const char rtems_test_name[] = "SPTASKNOPREEMPT 1"; static bool did_run; -static void do_not_run(rtems_task_argument arg) +static void do_not_run( rtems_task_argument arg ) { (void) arg; - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void test(void) +static void test( void ) { rtems_status_code sc; - rtems_id task; + rtems_id task; sc = rtems_task_create( - rtems_build_name('T', 'E', 'S', 'T'), + rtems_build_name( 'T', 'E', 'S', 'T' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(task, do_not_run, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( task, do_not_run, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); /* * This will start a task with a priority of PRIORITY_MINIMUM. Check that @@ -70,15 +70,15 @@ static void test(void) RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(!did_run); + rtems_test_assert( !did_run ); - sc = rtems_task_delete(task); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( task ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -87,7 +87,7 @@ static void Init(rtems_task_argument arg) test(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/spthread01/init.c b/testsuites/sptests/spthread01/init.c index a0f7040d9d..c522fc4322 100644 --- a/testsuites/sptests/spthread01/init.c +++ b/testsuites/sptests/spthread01/init.c @@ -22,302 +22,307 @@ const char rtems_test_name[] = "SPTHREAD 1"; #define WAKEUP_EVENT RTEMS_EVENT_0 typedef struct { - rtems_mutex *mtx; + rtems_mutex *mtx; rtems_recursive_mutex *rmtx; - rtems_id calling_task; + rtems_id calling_task; } mutex_context; -static void mutex_task(rtems_task_argument arg) +static void mutex_task( rtems_task_argument arg ) { (void) arg; mutex_context *m; - int rv; + int rv; m = (mutex_context *) arg; - rtems_test_assert(m->mtx != NULL || m->rmtx != NULL); + rtems_test_assert( m->mtx != NULL || m->rmtx != NULL ); - if (m->mtx) { - rv = rtems_mutex_try_lock(m->mtx); - rtems_test_assert(rv == EBUSY); + if ( m->mtx ) { + rv = rtems_mutex_try_lock( m->mtx ); + rtems_test_assert( rv == EBUSY ); } - if (m->rmtx) { - rv = rtems_recursive_mutex_try_lock(m->rmtx); - rtems_test_assert(rv == EBUSY); + if ( m->rmtx ) { + rv = rtems_recursive_mutex_try_lock( m->rmtx ); + rtems_test_assert( rv == EBUSY ); } - rtems_event_send(m->calling_task, WAKEUP_EVENT); + rtems_event_send( m->calling_task, WAKEUP_EVENT ); } static void test_try_lock_from_different_task( - rtems_mutex *m, + rtems_mutex *m, rtems_recursive_mutex *r ) { - mutex_context ctx; + mutex_context ctx; rtems_status_code sc; - rtems_event_set e; - rtems_id id; + rtems_event_set e; + rtems_id id; ctx.mtx = m; ctx.rmtx = r; ctx.calling_task = rtems_task_self(); sc = rtems_task_create( - rtems_build_name('M', 'T', 'X', ' '), + rtems_build_name( 'M', 'T', 'X', ' ' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(id, mutex_task, (rtems_task_argument) &ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( id, mutex_task, (rtems_task_argument) &ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_receive(WAKEUP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, 10, &e); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_receive( + WAKEUP_EVENT, + RTEMS_EVENT_ANY | RTEMS_WAIT, + 10, + &e + ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_task_delete(id); + rtems_task_delete( id ); } -static void test_mutex(void) +static void test_mutex( void ) { - rtems_mutex a = RTEMS_MUTEX_INITIALIZER("a"); + rtems_mutex a = RTEMS_MUTEX_INITIALIZER( "a" ); const char *name; - int rv; + int rv; - name = rtems_mutex_get_name(&a); - rtems_test_assert(strcmp(name, "a") == 0); + name = rtems_mutex_get_name( &a ); + rtems_test_assert( strcmp( name, "a" ) == 0 ); - rtems_mutex_set_name(&a, "b"); + rtems_mutex_set_name( &a, "b" ); - name = rtems_mutex_get_name(&a); - rtems_test_assert(strcmp(name, "b") == 0); + name = rtems_mutex_get_name( &a ); + rtems_test_assert( strcmp( name, "b" ) == 0 ); - rtems_mutex_destroy(&a); + rtems_mutex_destroy( &a ); - rtems_mutex_init(&a, "c"); + rtems_mutex_init( &a, "c" ); - name = rtems_mutex_get_name(&a); - rtems_test_assert(strcmp(name, "c") == 0); + name = rtems_mutex_get_name( &a ); + rtems_test_assert( strcmp( name, "c" ) == 0 ); - rtems_mutex_lock(&a); + rtems_mutex_lock( &a ); - test_try_lock_from_different_task(&a, NULL); + test_try_lock_from_different_task( &a, NULL ); - rtems_mutex_unlock(&a); + rtems_mutex_unlock( &a ); - rv = rtems_mutex_try_lock(&a); - rtems_test_assert(rv == 0); + rv = rtems_mutex_try_lock( &a ); + rtems_test_assert( rv == 0 ); - rtems_mutex_unlock(&a); + rtems_mutex_unlock( &a ); - rtems_mutex_destroy(&a); + rtems_mutex_destroy( &a ); } -static void test_recursive_mutex(void) +static void test_recursive_mutex( void ) { - rtems_recursive_mutex a = RTEMS_RECURSIVE_MUTEX_INITIALIZER("a"); - const char *name; - int rv; + rtems_recursive_mutex a = RTEMS_RECURSIVE_MUTEX_INITIALIZER( "a" ); + const char *name; + int rv; - name = rtems_recursive_mutex_get_name(&a); - rtems_test_assert(strcmp(name, "a") == 0); + name = rtems_recursive_mutex_get_name( &a ); + rtems_test_assert( strcmp( name, "a" ) == 0 ); - rtems_recursive_mutex_set_name(&a, "b"); + rtems_recursive_mutex_set_name( &a, "b" ); - name = rtems_recursive_mutex_get_name(&a); - rtems_test_assert(strcmp(name, "b") == 0); + name = rtems_recursive_mutex_get_name( &a ); + rtems_test_assert( strcmp( name, "b" ) == 0 ); - rtems_recursive_mutex_destroy(&a); + rtems_recursive_mutex_destroy( &a ); - rtems_recursive_mutex_init(&a, "c"); + rtems_recursive_mutex_init( &a, "c" ); - name = rtems_recursive_mutex_get_name(&a); - rtems_test_assert(strcmp(name, "c") == 0); + name = rtems_recursive_mutex_get_name( &a ); + rtems_test_assert( strcmp( name, "c" ) == 0 ); - rtems_recursive_mutex_lock(&a); + rtems_recursive_mutex_lock( &a ); - rtems_recursive_mutex_lock(&a); + rtems_recursive_mutex_lock( &a ); - rv = rtems_recursive_mutex_try_lock(&a); - rtems_test_assert(rv == 0); + rv = rtems_recursive_mutex_try_lock( &a ); + rtems_test_assert( rv == 0 ); - test_try_lock_from_different_task(NULL, &a); + test_try_lock_from_different_task( NULL, &a ); - rtems_recursive_mutex_unlock(&a); + rtems_recursive_mutex_unlock( &a ); - rtems_recursive_mutex_unlock(&a); + rtems_recursive_mutex_unlock( &a ); - rtems_recursive_mutex_unlock(&a); + rtems_recursive_mutex_unlock( &a ); - rtems_recursive_mutex_destroy(&a); + rtems_recursive_mutex_destroy( &a ); } typedef struct { - rtems_mutex mtx; + rtems_mutex mtx; rtems_condition_variable cnd; } signal_context; -static void signal_task(rtems_task_argument arg) +static void signal_task( rtems_task_argument arg ) { (void) arg; signal_context *s; s = (signal_context *) arg; - rtems_mutex_lock(&s->mtx); - rtems_condition_variable_signal(&s->cnd); - rtems_mutex_unlock(&s->mtx); + rtems_mutex_lock( &s->mtx ); + rtems_condition_variable_signal( &s->cnd ); + rtems_mutex_unlock( &s->mtx ); } -static void test_condition_variable(void) +static void test_condition_variable( void ) { - rtems_condition_variable a = RTEMS_CONDITION_VARIABLE_INITIALIZER("a"); - signal_context s; - const char *name; - rtems_status_code sc; - rtems_id id; + rtems_condition_variable a = RTEMS_CONDITION_VARIABLE_INITIALIZER( "a" ); + signal_context s; + const char *name; + rtems_status_code sc; + rtems_id id; - name = rtems_condition_variable_get_name(&a); - rtems_test_assert(strcmp(name, "a") == 0); + name = rtems_condition_variable_get_name( &a ); + rtems_test_assert( strcmp( name, "a" ) == 0 ); - rtems_condition_variable_set_name(&a, "b"); + rtems_condition_variable_set_name( &a, "b" ); - name = rtems_condition_variable_get_name(&a); - rtems_test_assert(strcmp(name, "b") == 0); + name = rtems_condition_variable_get_name( &a ); + rtems_test_assert( strcmp( name, "b" ) == 0 ); - rtems_condition_variable_destroy(&a); + rtems_condition_variable_destroy( &a ); - rtems_mutex_init(&s.mtx, "d"); - rtems_condition_variable_init(&s.cnd, "c"); + rtems_mutex_init( &s.mtx, "d" ); + rtems_condition_variable_init( &s.cnd, "c" ); - name = rtems_condition_variable_get_name(&s.cnd); - rtems_test_assert(strcmp(name, "c") == 0); + name = rtems_condition_variable_get_name( &s.cnd ); + rtems_test_assert( strcmp( name, "c" ) == 0 ); - rtems_condition_variable_signal(&s.cnd); + rtems_condition_variable_signal( &s.cnd ); - rtems_condition_variable_broadcast(&s.cnd); + rtems_condition_variable_broadcast( &s.cnd ); - rtems_mutex_lock(&s.mtx); + rtems_mutex_lock( &s.mtx ); sc = rtems_task_create( - rtems_build_name('C', 'O', 'N', 'D'), + rtems_build_name( 'C', 'O', 'N', 'D' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(id, signal_task, (rtems_task_argument) &s); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( id, signal_task, (rtems_task_argument) &s ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_condition_variable_wait(&s.cnd, &s.mtx); + rtems_condition_variable_wait( &s.cnd, &s.mtx ); - sc = rtems_task_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_mutex_unlock(&s.mtx); + rtems_mutex_unlock( &s.mtx ); - rtems_condition_variable_destroy(&s.cnd); - rtems_mutex_destroy(&s.mtx); + rtems_condition_variable_destroy( &s.cnd ); + rtems_mutex_destroy( &s.mtx ); } -static void test_counting_semaphore(void) +static void test_counting_semaphore( void ) { - rtems_counting_semaphore a = RTEMS_COUNTING_SEMAPHORE_INITIALIZER("a", 1); - const char *name; - int eno; + rtems_counting_semaphore a = RTEMS_COUNTING_SEMAPHORE_INITIALIZER( "a", 1 ); + const char *name; + int eno; - name = rtems_counting_semaphore_get_name(&a); - rtems_test_assert(strcmp(name, "a") == 0); + name = rtems_counting_semaphore_get_name( &a ); + rtems_test_assert( strcmp( name, "a" ) == 0 ); - rtems_counting_semaphore_set_name(&a, "b"); + rtems_counting_semaphore_set_name( &a, "b" ); - name = rtems_counting_semaphore_get_name(&a); - rtems_test_assert(strcmp(name, "b") == 0); + name = rtems_counting_semaphore_get_name( &a ); + rtems_test_assert( strcmp( name, "b" ) == 0 ); - rtems_counting_semaphore_destroy(&a); + rtems_counting_semaphore_destroy( &a ); - rtems_counting_semaphore_init(&a, "c", 0); + rtems_counting_semaphore_init( &a, "c", 0 ); - name = rtems_counting_semaphore_get_name(&a); - rtems_test_assert(strcmp(name, "c") == 0); + name = rtems_counting_semaphore_get_name( &a ); + rtems_test_assert( strcmp( name, "c" ) == 0 ); - eno = rtems_counting_semaphore_try_wait(&a); - rtems_test_assert(eno == EAGAIN); + eno = rtems_counting_semaphore_try_wait( &a ); + rtems_test_assert( eno == EAGAIN ); - eno = rtems_counting_semaphore_wait_timed_ticks(&a, 1); - rtems_test_assert(eno == ETIMEDOUT); + eno = rtems_counting_semaphore_wait_timed_ticks( &a, 1 ); + rtems_test_assert( eno == ETIMEDOUT ); - rtems_counting_semaphore_post(&a); + rtems_counting_semaphore_post( &a ); - rtems_counting_semaphore_wait(&a); + rtems_counting_semaphore_wait( &a ); - rtems_counting_semaphore_post(&a); + rtems_counting_semaphore_post( &a ); - eno = rtems_counting_semaphore_try_wait(&a); - rtems_test_assert(eno == 0); + eno = rtems_counting_semaphore_try_wait( &a ); + rtems_test_assert( eno == 0 ); - rtems_counting_semaphore_post(&a); + rtems_counting_semaphore_post( &a ); - eno = rtems_counting_semaphore_wait_timed_ticks(&a, 1); - rtems_test_assert(eno == 0); + eno = rtems_counting_semaphore_wait_timed_ticks( &a, 1 ); + rtems_test_assert( eno == 0 ); - rtems_counting_semaphore_destroy(&a); + rtems_counting_semaphore_destroy( &a ); } -static void test_binary_semaphore(void) +static void test_binary_semaphore( void ) { - rtems_binary_semaphore a = RTEMS_BINARY_SEMAPHORE_INITIALIZER("a"); - const char *name; - int eno; + rtems_binary_semaphore a = RTEMS_BINARY_SEMAPHORE_INITIALIZER( "a" ); + const char *name; + int eno; - name = rtems_binary_semaphore_get_name(&a); - rtems_test_assert(strcmp(name, "a") == 0); + name = rtems_binary_semaphore_get_name( &a ); + rtems_test_assert( strcmp( name, "a" ) == 0 ); - rtems_binary_semaphore_set_name(&a, "b"); + rtems_binary_semaphore_set_name( &a, "b" ); - name = rtems_binary_semaphore_get_name(&a); - rtems_test_assert(strcmp(name, "b") == 0); + name = rtems_binary_semaphore_get_name( &a ); + rtems_test_assert( strcmp( name, "b" ) == 0 ); - rtems_binary_semaphore_destroy(&a); + rtems_binary_semaphore_destroy( &a ); - rtems_binary_semaphore_init(&a, "c"); + rtems_binary_semaphore_init( &a, "c" ); - name = rtems_binary_semaphore_get_name(&a); - rtems_test_assert(strcmp(name, "c") == 0); + name = rtems_binary_semaphore_get_name( &a ); + rtems_test_assert( strcmp( name, "c" ) == 0 ); - eno = rtems_binary_semaphore_try_wait(&a); - rtems_test_assert(eno == EAGAIN); + eno = rtems_binary_semaphore_try_wait( &a ); + rtems_test_assert( eno == EAGAIN ); - eno = rtems_binary_semaphore_wait_timed_ticks(&a, 1); - rtems_test_assert(eno == ETIMEDOUT); + eno = rtems_binary_semaphore_wait_timed_ticks( &a, 1 ); + rtems_test_assert( eno == ETIMEDOUT ); - rtems_binary_semaphore_post(&a); + rtems_binary_semaphore_post( &a ); - rtems_binary_semaphore_wait(&a); + rtems_binary_semaphore_wait( &a ); - rtems_binary_semaphore_post(&a); + rtems_binary_semaphore_post( &a ); - eno = rtems_binary_semaphore_try_wait(&a); - rtems_test_assert(eno == 0); + eno = rtems_binary_semaphore_try_wait( &a ); + rtems_test_assert( eno == 0 ); - rtems_binary_semaphore_post(&a); + rtems_binary_semaphore_post( &a ); - eno = rtems_binary_semaphore_wait_timed_ticks(&a, 1); - rtems_test_assert(eno == 0); + eno = rtems_binary_semaphore_wait_timed_ticks( &a, 1 ); + rtems_test_assert( eno == 0 ); - rtems_binary_semaphore_destroy(&a); + rtems_binary_semaphore_destroy( &a ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -330,7 +335,7 @@ static void Init(rtems_task_argument arg) test_binary_semaphore(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/spthreadlife01/init.c b/testsuites/sptests/spthreadlife01/init.c index a4c7928383..d521447b7c 100644 --- a/testsuites/sptests/spthreadlife01/init.c +++ b/testsuites/sptests/spthreadlife01/init.c @@ -36,10 +36,10 @@ #include "tmacros.h" -#define PRIO_INIT 1 -#define PRIO_HIGH 2 -#define PRIO_MID 3 -#define PRIO_LOW 4 +#define PRIO_INIT 1 +#define PRIO_HIGH 2 +#define PRIO_MID 3 +#define PRIO_LOW 4 #define PRIO_VERY_LOW 5 const char rtems_test_name[] = "SPTHREADLIFE 1"; @@ -82,71 +82,71 @@ typedef enum { } test_state; typedef struct { - rtems_id main_task_id; - rtems_id worker_task_id; - rtems_id sema_id; + rtems_id main_task_id; + rtems_id worker_task_id; + rtems_id sema_id; test_state current; test_state next; } test_context; static test_context test_instance; -static void wake_up_main(const test_context *ctx) +static void wake_up_main( const test_context *ctx ) { rtems_status_code sc; - sc = rtems_event_transient_send(ctx->main_task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( ctx->main_task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void wait(void) +static void wait( void ) { rtems_status_code sc; - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } static void change_state( test_context *ctx, - test_state expected, - test_state current, - test_state next + test_state expected, + test_state current, + test_state next ) { - rtems_test_assert(ctx->current == expected); + rtems_test_assert( ctx->current == expected ); ctx->current = current; ctx->next = next; } static void change_state_and_wait( test_context *ctx, - test_state expected, - test_state current, - test_state next + test_state expected, + test_state current, + test_state next ) { - change_state(ctx, expected, current, next); + change_state( ctx, expected, current, next ); wait(); } -static void set_priority(rtems_task_priority prio) +static void set_priority( rtems_task_priority prio ) { rtems_status_code sc; - sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_priority( RTEMS_SELF, prio, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void assert_priority(rtems_task_priority expected) +static void assert_priority( rtems_task_priority expected ) { - rtems_status_code sc; + rtems_status_code sc; rtems_task_priority prio; - sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_set_priority( RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(prio == expected); + rtems_test_assert( prio == expected ); } static void restart_extension( @@ -154,24 +154,24 @@ static void restart_extension( Thread_Control *restarted ) { - test_context *ctx = &test_instance; + test_context *ctx = &test_instance; rtems_status_code sc; - rtems_test_assert(executing == restarted); + rtems_test_assert( executing == restarted ); - switch (ctx->current) { + switch ( ctx->current ) { case RESTART_0: - rtems_test_assert(ctx->worker_task_id == rtems_task_self()); + rtems_test_assert( ctx->worker_task_id == rtems_task_self() ); ctx->current = RESTART_1; - sc = rtems_task_restart(RTEMS_SELF, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_restart( RTEMS_SELF, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); break; case RESTART_1: - rtems_test_assert(ctx->worker_task_id == rtems_task_self()); + rtems_test_assert( ctx->worker_task_id == rtems_task_self() ); ctx->current = RESTART_2; break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); break; } } @@ -183,268 +183,269 @@ static void delete_extension( { test_context *ctx = &test_instance; - rtems_test_assert(executing != deleted); - rtems_test_assert(ctx->main_task_id == rtems_task_self()); + rtems_test_assert( executing != deleted ); + rtems_test_assert( ctx->main_task_id == rtems_task_self() ); - switch (ctx->current) { + switch ( ctx->current ) { case DELETE_2: - assert_priority(PRIO_INIT); + assert_priority( PRIO_INIT ); ctx->current = DELETE_3; break; case DELETE_5: - assert_priority(PRIO_INIT); + assert_priority( PRIO_INIT ); ctx->current = DELETE_6; break; case DELETE_8: - assert_priority(PRIO_VERY_LOW); + assert_priority( PRIO_VERY_LOW ); ctx->current = DELETE_9; break; case EXIT_2: - assert_priority(PRIO_VERY_LOW); + assert_priority( PRIO_VERY_LOW ); ctx->current = EXIT_3; break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); break; } } -static void terminate_extension(Thread_Control *executing) +static void terminate_extension( Thread_Control *executing ) { (void) executing; test_context *ctx = &test_instance; - rtems_test_assert(ctx->worker_task_id == rtems_task_self()); + rtems_test_assert( ctx->worker_task_id == rtems_task_self() ); - switch (ctx->current) { + switch ( ctx->current ) { case DELETE_0: - assert_priority(PRIO_INIT); + assert_priority( PRIO_INIT ); ctx->current = DELETE_1; - rtems_task_delete(RTEMS_SELF); - rtems_test_assert(0); + rtems_task_delete( RTEMS_SELF ); + rtems_test_assert( 0 ); break; case DELETE_1: - assert_priority(PRIO_INIT); + assert_priority( PRIO_INIT ); ctx->current = DELETE_2; break; case DELETE_4: - assert_priority(PRIO_INIT); + assert_priority( PRIO_INIT ); ctx->current = DELETE_5; break; case DELETE_7: - assert_priority(PRIO_LOW); + assert_priority( PRIO_LOW ); ctx->current = DELETE_8; break; case EXIT_1: - assert_priority(PRIO_LOW); + assert_priority( PRIO_LOW ); ctx->current = EXIT_2; break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); break; } } -static void worker_task(rtems_task_argument arg) +static void worker_task( rtems_task_argument arg ) { (void) arg; test_context *ctx = &test_instance; - while (true) { - test_state state = ctx->current; + while ( true ) { + test_state state = ctx->current; rtems_status_code sc; Thread_Life_state previous_thread_life_state; - Per_CPU_Control *cpu_self; + Per_CPU_Control *cpu_self; - switch (state) { + switch ( state ) { case SET_PRIO: - assert_priority(PRIO_LOW); - set_priority(PRIO_MID); + assert_priority( PRIO_LOW ); + set_priority( PRIO_MID ); break; case DO_OBTAIN_0: case DO_OBTAIN_1: - assert_priority(PRIO_MID); + assert_priority( PRIO_MID ); sc = rtems_semaphore_obtain( ctx->sema_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - assert_priority(PRIO_HIGH); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + assert_priority( PRIO_HIGH ); break; case DO_RELEASE_0: case DO_RELEASE_1: - assert_priority(PRIO_HIGH); - sc = rtems_semaphore_release(ctx->sema_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + assert_priority( PRIO_HIGH ); + sc = rtems_semaphore_release( ctx->sema_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - switch (state) { + switch ( state ) { case DO_RELEASE_0: - assert_priority(PRIO_MID); + assert_priority( PRIO_MID ); break; case DO_RELEASE_1: - assert_priority(PRIO_LOW); + assert_priority( PRIO_LOW ); break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); break; } break; case RESTART_2: - assert_priority(PRIO_HIGH); + assert_priority( PRIO_HIGH ); break; case SET_PROTECTION: cpu_self = _Thread_Dispatch_disable(); - previous_thread_life_state = - _Thread_Set_life_protection(THREAD_LIFE_PROTECTED); - rtems_test_assert( - (previous_thread_life_state & THREAD_LIFE_PROTECTED) == 0 + previous_thread_life_state = _Thread_Set_life_protection( + THREAD_LIFE_PROTECTED ); - _Thread_Dispatch_enable(cpu_self); + rtems_test_assert( + ( previous_thread_life_state & THREAD_LIFE_PROTECTED ) == 0 + ); + _Thread_Dispatch_enable( cpu_self ); break; case CLEAR_PROTECTION: cpu_self = _Thread_Dispatch_disable(); - previous_thread_life_state = _Thread_Set_life_protection(0); + previous_thread_life_state = _Thread_Set_life_protection( 0 ); rtems_test_assert( - (previous_thread_life_state & THREAD_LIFE_PROTECTED) != 0 + ( previous_thread_life_state & THREAD_LIFE_PROTECTED ) != 0 ); ctx->current = DELETE_4; - _Thread_Dispatch_enable(cpu_self); + _Thread_Dispatch_enable( cpu_self ); break; case DELETE_SELF: ctx->current = DELETE_7; - rtems_task_delete(RTEMS_SELF); - rtems_test_assert(0); + rtems_task_delete( RTEMS_SELF ); + rtems_test_assert( 0 ); break; case EXIT_0: ctx->current = EXIT_1; rtems_task_exit(); - rtems_test_assert(0); + rtems_test_assert( 0 ); break; default: - rtems_test_assert(0); + rtems_test_assert( 0 ); break; } ctx->current = ctx->next; - wake_up_main(ctx); + wake_up_main( ctx ); } } -static void create_sema(test_context *ctx) +static void create_sema( test_context *ctx ) { rtems_status_code sc; sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', 'A'), + rtems_build_name( 'S', 'E', 'M', 'A' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING, PRIO_HIGH, &ctx->sema_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void create_and_start_worker(test_context *ctx) +static void create_and_start_worker( test_context *ctx ) { rtems_status_code sc; sc = rtems_task_create( - rtems_build_name('W', 'O', 'R', 'K'), + rtems_build_name( 'W', 'O', 'R', 'K' ), PRIO_LOW, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx->worker_task_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(ctx->worker_task_id, worker_task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( ctx->worker_task_id, worker_task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test(void) +static void test( void ) { - test_context *ctx = &test_instance; - rtems_status_code sc; + test_context *ctx = &test_instance; + rtems_status_code sc; rtems_resource_snapshot snapshot; ctx->main_task_id = rtems_task_self(); - rtems_resource_snapshot_take(&snapshot); + rtems_resource_snapshot_take( &snapshot ); - create_sema(ctx); - create_and_start_worker(ctx); + create_sema( ctx ); + create_and_start_worker( ctx ); - change_state_and_wait(ctx, INIT, SET_PRIO, SET_PRIO_DONE); - change_state_and_wait(ctx, SET_PRIO_DONE, DO_OBTAIN_0, OBTAIN_DONE_0); + change_state_and_wait( ctx, INIT, SET_PRIO, SET_PRIO_DONE ); + change_state_and_wait( ctx, SET_PRIO_DONE, DO_OBTAIN_0, OBTAIN_DONE_0 ); - sc = rtems_semaphore_delete(ctx->sema_id); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_semaphore_delete( ctx->sema_id ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - change_state_and_wait(ctx, OBTAIN_DONE_0, DO_RELEASE_0, RELEASE_DONE_0); + change_state_and_wait( ctx, OBTAIN_DONE_0, DO_RELEASE_0, RELEASE_DONE_0 ); - sc = rtems_semaphore_delete(ctx->sema_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( ctx->sema_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - create_sema(ctx); + create_sema( ctx ); - change_state_and_wait(ctx, RELEASE_DONE_0, DO_OBTAIN_1, OBTAIN_DONE_1); + change_state_and_wait( ctx, RELEASE_DONE_0, DO_OBTAIN_1, OBTAIN_DONE_1 ); - sc = rtems_semaphore_delete(ctx->sema_id); - rtems_test_assert(sc == RTEMS_RESOURCE_IN_USE); + sc = rtems_semaphore_delete( ctx->sema_id ); + rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE ); - sc = rtems_task_restart(ctx->worker_task_id, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_restart( ctx->worker_task_id, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - change_state_and_wait(ctx, OBTAIN_DONE_1, RESTART_0, RESTART_3); - change_state_and_wait(ctx, RESTART_3, DO_RELEASE_1, RELEASE_DONE_1); + change_state_and_wait( ctx, OBTAIN_DONE_1, RESTART_0, RESTART_3 ); + change_state_and_wait( ctx, RESTART_3, DO_RELEASE_1, RELEASE_DONE_1 ); - sc = rtems_semaphore_delete(ctx->sema_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_delete( ctx->sema_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - change_state(ctx, RELEASE_DONE_1, DELETE_0, INVALID); + change_state( ctx, RELEASE_DONE_1, DELETE_0, INVALID ); - sc = rtems_task_delete(ctx->worker_task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( ctx->worker_task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(ctx->current == DELETE_2); + rtems_test_assert( ctx->current == DELETE_2 ); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); - create_and_start_worker(ctx); + create_and_start_worker( ctx ); - change_state_and_wait(ctx, DELETE_3, SET_PROTECTION, SET_PROTECTION_DONE); - change_state(ctx, SET_PROTECTION_DONE, CLEAR_PROTECTION, INVALID); + change_state_and_wait( ctx, DELETE_3, SET_PROTECTION, SET_PROTECTION_DONE ); + change_state( ctx, SET_PROTECTION_DONE, CLEAR_PROTECTION, INVALID ); - sc = rtems_task_delete(ctx->worker_task_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( ctx->worker_task_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); - create_and_start_worker(ctx); + create_and_start_worker( ctx ); - change_state(ctx, DELETE_6, DELETE_SELF, INVALID); - set_priority(PRIO_VERY_LOW); + change_state( ctx, DELETE_6, DELETE_SELF, INVALID ); + set_priority( PRIO_VERY_LOW ); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); - set_priority(PRIO_INIT); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); + set_priority( PRIO_INIT ); - create_and_start_worker(ctx); + create_and_start_worker( ctx ); - change_state(ctx, DELETE_9, EXIT_0, INVALID); - set_priority(PRIO_VERY_LOW); + change_state( ctx, DELETE_9, EXIT_0, INVALID ); + set_priority( PRIO_VERY_LOW ); - rtems_test_assert(rtems_resource_snapshot_check(&snapshot)); - set_priority(PRIO_INIT); + rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) ); + set_priority( PRIO_INIT ); - rtems_test_assert(ctx->current == EXIT_3); + rtems_test_assert( ctx->current == EXIT_3 ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -453,22 +454,20 @@ static void Init(rtems_task_argument arg) test(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 -#define CONFIGURE_INITIAL_EXTENSIONS \ - { \ - .thread_restart = restart_extension, \ - .thread_delete = delete_extension, \ - .thread_terminate = terminate_extension \ - }, \ - RTEMS_TEST_INITIAL_EXTENSION +#define CONFIGURE_INITIAL_EXTENSIONS \ + { .thread_restart = restart_extension, \ + .thread_delete = delete_extension, \ + .thread_terminate = terminate_extension }, \ + RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES diff --git a/testsuites/sptests/spthreadq01/init.c b/testsuites/sptests/spthreadq01/init.c index 18f68c129b..a30c8667d5 100644 --- a/testsuites/sptests/spthreadq01/init.c +++ b/testsuites/sptests/spthreadq01/init.c @@ -50,239 +50,237 @@ static Thread_queue_Control queue = THREAD_QUEUE_INITIALIZER( "Queue" ); typedef struct { Thread_Control *master; - rtems_id master_id; - rtems_id worker_id; - rtems_id sem; - rtems_id mtx; - rtems_id mq; - rtems_id br; - mqd_t pmq; + rtems_id master_id; + rtems_id worker_id; + rtems_id sem; + rtems_id mtx; + rtems_id mq; + rtems_id br; + mqd_t pmq; } test_context; static test_context test_instance; -static void wait_for_worker(test_context *ctx) +static void wait_for_worker( test_context *ctx ) { (void) ctx; rtems_status_code sc; - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void wake_up_master(test_context *ctx) +static void wake_up_master( test_context *ctx ) { rtems_status_code sc; - sc = rtems_event_transient_send(ctx->master_id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( ctx->master_id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static rtems_id get_wait_id(test_context *ctx) +static rtems_id get_wait_id( test_context *ctx ) { Thread_queue_Context queue_context; - rtems_id id; + rtems_id id; - _Thread_queue_Context_initialize(&queue_context); - _Thread_Wait_acquire(ctx->master, &queue_context); - id = _Thread_Wait_get_id(ctx->master); - _Thread_Wait_release(ctx->master, &queue_context); + _Thread_queue_Context_initialize( &queue_context ); + _Thread_Wait_acquire( ctx->master, &queue_context ); + id = _Thread_Wait_get_id( ctx->master ); + _Thread_Wait_release( ctx->master, &queue_context ); return id; } -static void classic_worker(test_context *ctx) +static void classic_worker( test_context *ctx ) { rtems_status_code sc; - char buf[1]; + char buf[ 1 ]; - wake_up_master(ctx); - rtems_test_assert(get_wait_id(ctx) == ctx->sem); + wake_up_master( ctx ); + rtems_test_assert( get_wait_id( ctx ) == ctx->sem ); - sc = rtems_semaphore_release(ctx->sem); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->sem ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_semaphore_obtain(ctx->mtx, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->mtx, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - wake_up_master(ctx); - rtems_test_assert(get_wait_id(ctx) == ctx->mtx); + wake_up_master( ctx ); + rtems_test_assert( get_wait_id( ctx ) == ctx->mtx ); - sc = rtems_semaphore_release(ctx->mtx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_release( ctx->mtx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - wake_up_master(ctx); - rtems_test_assert(get_wait_id(ctx) == ctx->mq); + wake_up_master( ctx ); + rtems_test_assert( get_wait_id( ctx ) == ctx->mq ); - buf[0] = 'X'; - sc = rtems_message_queue_send(ctx->mq, &buf[0], sizeof(buf)); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + buf[ 0 ] = 'X'; + sc = rtems_message_queue_send( ctx->mq, &buf[ 0 ], sizeof( buf ) ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - wake_up_master(ctx); - rtems_test_assert(get_wait_id(ctx) == ctx->br); + wake_up_master( ctx ); + rtems_test_assert( get_wait_id( ctx ) == ctx->br ); - sc = rtems_barrier_wait(ctx->br, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_barrier_wait( ctx->br, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void posix_worker(test_context *ctx) +static void posix_worker( test_context *ctx ) { - int rv; - char buf[1]; + int rv; + char buf[ 1 ]; - wake_up_master(ctx); - rtems_test_assert(get_wait_id(ctx) == ctx->pmq); + wake_up_master( ctx ); + rtems_test_assert( get_wait_id( ctx ) == ctx->pmq ); - buf[0] = 'x'; - rv = mq_send(ctx->pmq, &buf[0], sizeof(buf), 0); - rtems_test_assert(rv == 0); + buf[ 0 ] = 'x'; + rv = mq_send( ctx->pmq, &buf[ 0 ], sizeof( buf ), 0 ); + rtems_test_assert( rv == 0 ); } -static rtems_task worker(rtems_task_argument arg) +static rtems_task worker( rtems_task_argument arg ) { (void) arg; test_context *ctx = (test_context *) arg; - rtems_test_assert(get_wait_id(ctx) == 0); + rtems_test_assert( get_wait_id( ctx ) == 0 ); - classic_worker(ctx); - posix_worker(ctx); + classic_worker( ctx ); + posix_worker( ctx ); } -static void test_classic_init(test_context *ctx) +static void test_classic_init( test_context *ctx ) { rtems_status_code sc; sc = rtems_semaphore_create( - rtems_build_name('S', 'E', 'M', ' '), + rtems_build_name( 'S', 'E', 'M', ' ' ), 0, RTEMS_COUNTING_SEMAPHORE, 0, &ctx->sem ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_semaphore_create( - rtems_build_name('M', 'T', 'X', ' '), + rtems_build_name( 'M', 'T', 'X', ' ' ), 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0, &ctx->mtx ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_message_queue_create( - rtems_build_name('M', 'Q', ' ', ' '), + rtems_build_name( 'M', 'Q', ' ', ' ' ), 1, 1, RTEMS_DEFAULT_ATTRIBUTES, &ctx->mq ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); sc = rtems_barrier_create( - rtems_build_name('B', 'R', ' ', ' '), + rtems_build_name( 'B', 'R', ' ', ' ' ), RTEMS_BARRIER_AUTOMATIC_RELEASE, 2, &ctx->br ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_posix_init(test_context *ctx) +static void test_posix_init( test_context *ctx ) { struct mq_attr attr; - memset(&attr, 0, sizeof(attr)); + memset( &attr, 0, sizeof( attr ) ); attr.mq_maxmsg = 1; - attr.mq_msgsize = sizeof(char); + attr.mq_msgsize = sizeof( char ); - ctx->pmq = mq_open("mq", O_CREAT | O_RDWR, 0x777, &attr); - rtems_test_assert(ctx->pmq != (mqd_t) -1); + ctx->pmq = mq_open( "mq", O_CREAT | O_RDWR, 0x777, &attr ); + rtems_test_assert( ctx->pmq != (mqd_t) -1 ); } -static void test_context_init(test_context *ctx) +static void test_context_init( test_context *ctx ) { rtems_status_code sc; ctx->master = _Thread_Get_executing(); ctx->master_id = rtems_task_self(); - test_classic_init(ctx); - test_posix_init(ctx); + test_classic_init( ctx ); + test_posix_init( ctx ); sc = rtems_task_create( - rtems_build_name('W', 'O', 'R', 'K'), + rtems_build_name( 'W', 'O', 'R', 'K' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx->worker_id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(ctx->worker_id, worker, (rtems_task_argument) ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( ctx->worker_id, worker, (rtems_task_argument) ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_classic_obj(test_context *ctx) +static void test_classic_obj( test_context *ctx ) { rtems_status_code sc; - char buf[1]; - size_t n; + char buf[ 1 ]; + size_t n; - wait_for_worker(ctx); + wait_for_worker( ctx ); - sc = rtems_semaphore_obtain(ctx->sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - wait_for_worker(ctx); + wait_for_worker( ctx ); - sc = rtems_semaphore_obtain(ctx->mtx, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_semaphore_obtain( ctx->mtx, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - wait_for_worker(ctx); + wait_for_worker( ctx ); - buf[0] = 'Y'; + buf[ 0 ] = 'Y'; n = 123; sc = rtems_message_queue_receive( ctx->mq, - &buf[0], + &buf[ 0 ], &n, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - rtems_test_assert(buf[0] == 'X'); - rtems_test_assert(n == sizeof(buf)); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( buf[ 0 ] == 'X' ); + rtems_test_assert( n == sizeof( buf ) ); - wait_for_worker(ctx); + wait_for_worker( ctx ); - sc = rtems_barrier_wait(ctx->br, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_barrier_wait( ctx->br, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void test_posix_obj(test_context *ctx) +static void test_posix_obj( test_context *ctx ) { - char buf[1]; + char buf[ 1 ]; unsigned prio; - ssize_t n; + ssize_t n; - wait_for_worker(ctx); + wait_for_worker( ctx ); - buf[0] = 'y'; + buf[ 0 ] = 'y'; prio = 1; - n = mq_receive(ctx->pmq, &buf[0], sizeof(buf), &prio); - rtems_test_assert(n == (ssize_t) sizeof(buf)); - rtems_test_assert(buf[0] == 'x'); - rtems_test_assert(prio == 0); + n = mq_receive( ctx->pmq, &buf[ 0 ], sizeof( buf ), &prio ); + rtems_test_assert( n == (ssize_t) sizeof( buf ) ); + rtems_test_assert( buf[ 0 ] == 'x' ); + rtems_test_assert( prio == 0 ); } -static rtems_task Init( - rtems_task_argument ignored -) +static rtems_task Init( rtems_task_argument ignored ) { (void) ignored; @@ -290,18 +288,20 @@ static rtems_task Init( TEST_BEGIN(); - puts( "Init - _Thread_queue_Extract - thread not blocked on a thread queue" ); + puts( + "Init - _Thread_queue_Extract - thread not blocked on a thread queue" + ); _Thread_queue_Extract( _Thread_Get_executing() ); /* is there more to check? */ - test_context_init(ctx); - test_classic_obj(ctx); - test_posix_obj(ctx); + test_context_init( ctx ); + test_classic_obj( ctx ); + test_posix_obj( ctx ); rtems_test_assert( _Thread_queue_Is_empty( &queue.Queue ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ @@ -309,14 +309,14 @@ static rtems_task Init( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_SEMAPHORES 2 -#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 -#define CONFIGURE_MAXIMUM_BARRIERS 1 +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 2 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 +#define CONFIGURE_MAXIMUM_BARRIERS 1 #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \ - (2 * CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(1, 1)) + ( 2 * CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 1, 1 ) ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sptimecounter01/init.c b/testsuites/sptests/sptimecounter01/init.c index 3808a7a593..7c9ebd05cf 100644 --- a/testsuites/sptests/sptimecounter01/init.c +++ b/testsuites/sptests/sptimecounter01/init.c @@ -49,41 +49,41 @@ const char rtems_test_name[] = "SPTIMECOUNTER 1"; typedef struct { struct timecounter tc; - uint32_t counter; + uint32_t counter; struct timecounter tc_2; - uint32_t counter_2; + uint32_t counter_2; } test_context; static test_context test_instance; static Thread_Control executing; -static uint32_t test_get_timecount(struct timecounter *tc) +static uint32_t test_get_timecount( struct timecounter *tc ) { test_context *ctx; - ctx = RTEMS_CONTAINER_OF(tc, test_context, tc); + ctx = RTEMS_CONTAINER_OF( tc, test_context, tc ); ++ctx->counter; return ctx->counter; } -static uint32_t test_get_timecount_2(struct timecounter *tc) +static uint32_t test_get_timecount_2( struct timecounter *tc ) { test_context *ctx; - ctx = RTEMS_CONTAINER_OF(tc, test_context, tc_2); + ctx = RTEMS_CONTAINER_OF( tc, test_context, tc_2 ); ++ctx->counter_2; return ctx->counter_2; } -static void test_install(test_context *ctx) +static void test_install( test_context *ctx ) { struct timecounter *tc; struct timecounter *tc_2; - uint32_t c; - uint32_t c_2; + uint32_t c; + uint32_t c_2; tc = &ctx->tc; tc_2 = &ctx->tc_2; @@ -94,37 +94,37 @@ static void test_install(test_context *ctx) tc_2->tc_counter_mask = 0x0fffffff; tc_2->tc_frequency = TEST_FREQ - 1; tc_2->tc_quality = TEST_QUAL; - _Timecounter_Install(tc_2); - assert(ctx->counter == c); - assert(ctx->counter_2 == c_2); + _Timecounter_Install( tc_2 ); + assert( ctx->counter == c ); + assert( ctx->counter_2 == c_2 ); tc_2->tc_get_timecount = test_get_timecount_2; tc_2->tc_counter_mask = 0x0fffffff; tc_2->tc_frequency = TEST_FREQ - 1; tc_2->tc_quality = TEST_QUAL + 1; - _Timecounter_Install(tc_2); - assert(ctx->counter == c + 1); - assert(ctx->counter_2 == c_2 + 1); + _Timecounter_Install( tc_2 ); + assert( ctx->counter == c + 1 ); + assert( ctx->counter_2 == c_2 + 1 ); tc->tc_get_timecount = test_get_timecount; tc->tc_counter_mask = 0x0fffffff; tc->tc_frequency = TEST_FREQ; tc->tc_quality = TEST_QUAL + 1; - _Timecounter_Install(tc); - assert(ctx->counter == c + 2); - assert(ctx->counter_2 == c_2 + 2); + _Timecounter_Install( tc ); + assert( ctx->counter == c + 2 ); + assert( ctx->counter_2 == c_2 + 2 ); } -void boot_card(const char *cmdline) +void boot_card( const char *cmdline ) { (void) cmdline; - test_context *ctx; + test_context *ctx; struct timecounter *tc; - struct bintime bt; - struct timeval tv; - struct timespec ts; - Per_CPU_Control *cpu_self; + struct bintime bt; + struct timeval tv; + struct timespec ts; + Per_CPU_Control *cpu_self; ctx = &test_instance; tc = &ctx->tc; @@ -135,111 +135,111 @@ void boot_card(const char *cmdline) cpu_self->executing = &executing; cpu_self->heir = &executing; - assert(time(NULL) == TOD_SECONDS_1970_THROUGH_1988); + assert( time( NULL ) == TOD_SECONDS_1970_THROUGH_1988 ); - rtems_bsd_bintime(&bt); - assert(bt.sec == TOD_SECONDS_1970_THROUGH_1988); - assert(bt.frac == 0); + rtems_bsd_bintime( &bt ); + assert( bt.sec == TOD_SECONDS_1970_THROUGH_1988 ); + assert( bt.frac == 0 ); - rtems_bsd_getbintime(&bt); - assert(bt.sec == TOD_SECONDS_1970_THROUGH_1988); - assert(bt.frac == 0); + rtems_bsd_getbintime( &bt ); + assert( bt.sec == TOD_SECONDS_1970_THROUGH_1988 ); + assert( bt.frac == 0 ); - rtems_bsd_microtime(&tv); - assert(tv.tv_sec == TOD_SECONDS_1970_THROUGH_1988); - assert(tv.tv_usec == 0); + rtems_bsd_microtime( &tv ); + assert( tv.tv_sec == TOD_SECONDS_1970_THROUGH_1988 ); + assert( tv.tv_usec == 0 ); - rtems_bsd_getmicrotime(&tv); - assert(tv.tv_sec == TOD_SECONDS_1970_THROUGH_1988); - assert(tv.tv_usec == 0); + rtems_bsd_getmicrotime( &tv ); + assert( tv.tv_sec == TOD_SECONDS_1970_THROUGH_1988 ); + assert( tv.tv_usec == 0 ); - rtems_bsd_nanotime(&ts); - assert(ts.tv_sec == TOD_SECONDS_1970_THROUGH_1988); - assert(ts.tv_nsec == 0); + rtems_bsd_nanotime( &ts ); + assert( ts.tv_sec == TOD_SECONDS_1970_THROUGH_1988 ); + assert( ts.tv_nsec == 0 ); - rtems_bsd_getnanotime(&ts); - assert(ts.tv_sec == TOD_SECONDS_1970_THROUGH_1988); - assert(ts.tv_nsec == 0); + rtems_bsd_getnanotime( &ts ); + assert( ts.tv_sec == TOD_SECONDS_1970_THROUGH_1988 ); + assert( ts.tv_nsec == 0 ); - assert(rtems_clock_get_uptime_seconds() == 0); - assert(rtems_clock_get_uptime_nanoseconds() == 0); + assert( rtems_clock_get_uptime_seconds() == 0 ); + assert( rtems_clock_get_uptime_nanoseconds() == 0 ); - rtems_bsd_binuptime(&bt); - assert(bt.sec == 1); - assert(bt.frac == 0); + rtems_bsd_binuptime( &bt ); + assert( bt.sec == 1 ); + assert( bt.frac == 0 ); - rtems_bsd_getbinuptime(&bt); - assert(bt.sec == 1); - assert(bt.frac == 0); + rtems_bsd_getbinuptime( &bt ); + assert( bt.sec == 1 ); + assert( bt.frac == 0 ); - rtems_bsd_microuptime(&tv); - assert(tv.tv_sec == 1); - assert(tv.tv_usec == 0); + rtems_bsd_microuptime( &tv ); + assert( tv.tv_sec == 1 ); + assert( tv.tv_usec == 0 ); - rtems_bsd_getmicrouptime(&tv); - assert(tv.tv_sec == 1); - assert(tv.tv_usec == 0); + rtems_bsd_getmicrouptime( &tv ); + assert( tv.tv_sec == 1 ); + assert( tv.tv_usec == 0 ); - rtems_bsd_nanouptime(&ts); - assert(ts.tv_sec == 1); - assert(ts.tv_nsec == 0); + rtems_bsd_nanouptime( &ts ); + assert( ts.tv_sec == 1 ); + assert( ts.tv_nsec == 0 ); - rtems_bsd_getnanouptime(&ts); - assert(ts.tv_sec == 1); - assert(ts.tv_nsec == 0); + rtems_bsd_getnanouptime( &ts ); + assert( ts.tv_sec == 1 ); + assert( ts.tv_nsec == 0 ); /* On RTEMS time does not advance using the dummy timecounter */ - rtems_bsd_binuptime(&bt); - assert(bt.sec == 1); - assert(bt.frac == 0); + rtems_bsd_binuptime( &bt ); + assert( bt.sec == 1 ); + assert( bt.frac == 0 ); rtems_timecounter_tick(); - rtems_bsd_binuptime(&bt); - assert(bt.sec == 1); - assert(bt.frac == 0); + rtems_bsd_binuptime( &bt ); + assert( bt.sec == 1 ); + assert( bt.frac == 0 ); ctx->counter = 0; tc->tc_get_timecount = test_get_timecount; tc->tc_counter_mask = 0x0fffffff; tc->tc_frequency = TEST_FREQ; tc->tc_quality = TEST_QUAL; - _Timecounter_Install(tc); - assert(ctx->counter == 1); + _Timecounter_Install( tc ); + assert( ctx->counter == 1 ); - rtems_bsd_binuptime(&bt); - assert(ctx->counter == 2); + rtems_bsd_binuptime( &bt ); + assert( ctx->counter == 2 ); - assert(bt.sec == 1); - assert(bt.frac == 18446744073708); + assert( bt.sec == 1 ); + assert( bt.frac == 18446744073708 ); ctx->counter = 0xf0000000 | 1; - rtems_bsd_binuptime(&bt); - assert(ctx->counter == (0xf0000000 | 2)); + rtems_bsd_binuptime( &bt ); + assert( ctx->counter == ( 0xf0000000 | 2 ) ); - assert(bt.sec == 1); - assert(bt.frac == 18446744073708); + assert( bt.sec == 1 ); + assert( bt.frac == 18446744073708 ); /* Check that a large delta yields a correct time */ - ctx->counter = (0xf0000000 | 1) + TEST_FREQ; - rtems_bsd_binuptime(&bt); - assert(ctx->counter == (0xf0000000 | 2) + TEST_FREQ); - assert(bt.sec == 2); - assert(bt.frac == 18446742522092); + ctx->counter = ( 0xf0000000 | 1 ) + TEST_FREQ; + rtems_bsd_binuptime( &bt ); + assert( ctx->counter == ( 0xf0000000 | 2 ) + TEST_FREQ ); + assert( bt.sec == 2 ); + assert( bt.frac == 18446742522092 ); - test_install(ctx); + test_install( ctx ); TEST_END(); - _Terminate(RTEMS_FATAL_SOURCE_EXIT, 0); + _Terminate( RTEMS_FATAL_SOURCE_EXIT, 0 ); } -static void *stack_allocate(size_t size) +static void *stack_allocate( size_t size ) { (void) size; return NULL; } -static void stack_free(void *ptr) +static void stack_free( void *ptr ) { (void) ptr; } @@ -254,7 +254,9 @@ static void stack_free(void *ptr) #define CONFIGURE_SCHEDULER -#define CONFIGURE_SCHEDULER_TABLE_ENTRIES { } +#define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ + { \ + } #define CONFIGURE_TASK_STACK_ALLOCATOR stack_allocate diff --git a/testsuites/sptests/sptimecounter02/init.c b/testsuites/sptests/sptimecounter02/init.c index 922b60eb19..666c4cf18e 100644 --- a/testsuites/sptests/sptimecounter02/init.c +++ b/testsuites/sptests/sptimecounter02/init.c @@ -61,49 +61,49 @@ const char rtems_test_name[] = "SPTIMECOUNTER 2"; typedef struct { rtems_test_parallel_context base; - const char *test_sep; - const char *counter_sep; - struct timecounter tc_null; - uint32_t binuptime_per_job[CPU_COUNT]; - sbintime_t duration_per_job[CPU_COUNT]; - uint32_t rtemsuptime_per_job[CPU_COUNT]; + const char *test_sep; + const char *counter_sep; + struct timecounter tc_null; + uint32_t binuptime_per_job[ CPU_COUNT ]; + sbintime_t duration_per_job[ CPU_COUNT ]; + uint32_t rtemsuptime_per_job[ CPU_COUNT ]; } timecounter_context; static timecounter_context test_instance; -static rtems_interval test_duration(void) +static rtems_interval test_duration( void ) { return DURATION_IN_SECONDS * rtems_clock_get_ticks_per_second(); } -static uint32_t test_get_timecount_null(struct timecounter *tc) +static uint32_t test_get_timecount_null( struct timecounter *tc ) { (void) tc; return 0; } -static void install_tc_null(timecounter_context *ctx) +static void install_tc_null( timecounter_context *ctx ) { struct timecounter *tc_cpu = &ctx->tc_null; tc_cpu->tc_get_timecount = test_get_timecount_null; tc_cpu->tc_counter_mask = 0xffffffff; - tc_cpu->tc_frequency = rtems_counter_nanoseconds_to_ticks(1000000000); + tc_cpu->tc_frequency = rtems_counter_nanoseconds_to_ticks( 1000000000 ); tc_cpu->tc_quality = 2000; - rtems_timecounter_install(tc_cpu); + rtems_timecounter_install( tc_cpu ); } static void test_print_results( - const char *driver, + const char *driver, timecounter_context *ctx, - size_t active_workers + size_t active_workers ) { const char *value_sep; - size_t i; + size_t i; - if (active_workers == 1) { + if ( active_workers == 1 ) { printf( "%s{\n" " \"timecounter\": \"%s\",\n" @@ -115,28 +115,24 @@ static void test_print_results( ctx->counter_sep = "\n "; } - printf("%s[", ctx->counter_sep); + printf( "%s[", ctx->counter_sep ); ctx->counter_sep = "],\n "; value_sep = ""; - for (i = 0; i < active_workers; ++i) { - printf( - "%s%" PRIu32, - value_sep, - ctx->binuptime_per_job[i] - ); + for ( i = 0; i < active_workers; ++i ) { + printf( "%s%" PRIu32, value_sep, ctx->binuptime_per_job[ i ] ); value_sep = ", "; } - if (active_workers == rtems_scheduler_get_processor_maximum()) { - printf("]\n ]\n }"); + if ( active_workers == rtems_scheduler_get_processor_maximum() ) { + printf( "]\n ]\n }" ); } } static rtems_interval test_bintime_init( rtems_test_parallel_context *base, - void *arg, - size_t active_workers + void *arg, + size_t active_workers ) { (void) base; @@ -150,55 +146,55 @@ static rtems_interval test_bintime_init( static void test_bintime_body( rtems_test_parallel_context *base, - void *arg, - size_t active_workers, - size_t worker_index + void *arg, + size_t active_workers, + size_t worker_index ) { (void) arg; (void) active_workers; timecounter_context *ctx = (timecounter_context *) base; - uint32_t counter = 1; - struct bintime start; - struct bintime end; + uint32_t counter = 1; + struct bintime start; + struct bintime end; - rtems_bsd_binuptime(&start); + rtems_bsd_binuptime( &start ); do { ++counter; - rtems_bsd_binuptime(&end); - } while (!rtems_test_parallel_stop_job(&ctx->base)); + rtems_bsd_binuptime( &end ); + } while ( !rtems_test_parallel_stop_job( &ctx->base ) ); - ctx->binuptime_per_job[worker_index] = counter; - ctx->duration_per_job[worker_index] = bttosbt(end) - bttosbt(start); + ctx->binuptime_per_job[ worker_index ] = counter; + ctx->duration_per_job[ worker_index ] = bttosbt( end ) - bttosbt( start ); } static void test_bintime_fini( rtems_test_parallel_context *base, - void *arg, - size_t active_workers + void *arg, + size_t active_workers ) { (void) arg; timecounter_context *ctx = (timecounter_context *) base; - size_t i; + size_t i; - for (i = 0; i < active_workers; ++i) { + for ( i = 0; i < active_workers; ++i ) { sbintime_t error; - error = DURATION_IN_SECONDS * SBT_1S - ctx->duration_per_job[i]; - rtems_test_assert(error * error < SBT_1MS * SBT_1MS); + error = DURATION_IN_SECONDS * SBT_1S - ctx->duration_per_job[ i ]; + rtems_test_assert( error * error < SBT_1MS * SBT_1MS ); } - test_print_results("Clock Driver", ctx, active_workers); + test_print_results( "Clock Driver", ctx, active_workers ); } static rtems_interval test_bintime_null_init( rtems_test_parallel_context *base, - void *arg, - size_t active_workers + void *arg, + size_t active_workers ) { (void) arg; @@ -207,98 +203,95 @@ static rtems_interval test_bintime_null_init( timecounter_context *ctx = &test_instance; - install_tc_null(ctx); + install_tc_null( ctx ); return test_duration(); } static void test_bintime_null_body( rtems_test_parallel_context *base, - void *arg, - size_t active_workers, - size_t worker_index + void *arg, + size_t active_workers, + size_t worker_index ) { (void) arg; (void) active_workers; timecounter_context *ctx = (timecounter_context *) base; - struct bintime bt; - uint32_t counter = 0; + struct bintime bt; + uint32_t counter = 0; - while (!rtems_test_parallel_stop_job(&ctx->base)) { + while ( !rtems_test_parallel_stop_job( &ctx->base ) ) { ++counter; - rtems_bsd_binuptime(&bt); + rtems_bsd_binuptime( &bt ); } - ctx->binuptime_per_job[worker_index] = counter; + ctx->binuptime_per_job[ worker_index ] = counter; } static void test_bintime_null_fini( rtems_test_parallel_context *base, - void *arg, - size_t active_workers + void *arg, + size_t active_workers ) { (void) arg; - test_print_results("Null", (timecounter_context *) base, active_workers); + test_print_results( "Null", (timecounter_context *) base, active_workers ); } static const rtems_test_parallel_job timecounter_jobs[] = { - { - .init = test_bintime_init, + { .init = test_bintime_init, .body = test_bintime_body, .fini = test_bintime_fini, - .cascade = true - },{ - .init = test_bintime_null_init, + .cascade = true }, + { .init = test_bintime_null_init, .body = test_bintime_null_body, .fini = test_bintime_null_fini, - .cascade = true - } + .cascade = true } }; -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; timecounter_context *ctx = &test_instance; - struct bintime bt; - struct timespec ts; - struct timeval tv; + struct bintime bt; + struct timespec ts; + struct timeval tv; TEST_BEGIN(); - printf("*** BEGIN OF JSON DATA ***\n[\n "); + printf( "*** BEGIN OF JSON DATA ***\n[\n " ); ctx->test_sep = ""; rtems_test_parallel( &ctx->base, NULL, - &timecounter_jobs[0], - RTEMS_ARRAY_SIZE(timecounter_jobs) + &timecounter_jobs[ 0 ], + RTEMS_ARRAY_SIZE( timecounter_jobs ) ); - printf("\n]\n*** END OF JSON DATA ***\n"); + printf( "\n]\n*** END OF JSON DATA ***\n" ); /* Check for all functions available in the bsd.h user space */ - rtems_bsd_bintime(&bt); - rtems_bsd_microtime(&tv); - rtems_bsd_nanotime(&ts); - rtems_bsd_binuptime(&bt); - rtems_bsd_microuptime(&tv); - rtems_bsd_nanouptime(&ts); - rtems_bsd_getbintime(&bt); - rtems_bsd_getmicrotime(&tv); - rtems_bsd_getnanotime(&ts); - rtems_bsd_getbinuptime(&bt); - rtems_bsd_getmicrouptime(&tv); - rtems_bsd_getnanouptime(&ts); + rtems_bsd_bintime( &bt ); + rtems_bsd_microtime( &tv ); + rtems_bsd_nanotime( &ts ); + rtems_bsd_binuptime( &bt ); + rtems_bsd_microuptime( &tv ); + rtems_bsd_nanouptime( &ts ); + rtems_bsd_getbintime( &bt ); + rtems_bsd_getmicrotime( &tv ); + rtems_bsd_getnanotime( &ts ); + rtems_bsd_getbinuptime( &bt ); + rtems_bsd_getmicrouptime( &tv ); + rtems_bsd_getnanouptime( &ts ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_MICROSECONDS_PER_TICK 1000 @@ -306,8 +299,8 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS (2 + CPU_COUNT - 1) -#define CONFIGURE_MAXIMUM_TIMERS 2 +#define CONFIGURE_MAXIMUM_TASKS ( 2 + CPU_COUNT - 1 ) +#define CONFIGURE_MAXIMUM_TIMERS 2 #define CONFIGURE_MAXIMUM_PERIODS 1 #define CONFIGURE_MAXIMUM_PROCESSORS CPU_COUNT diff --git a/testsuites/sptests/sptimecounter03/init.c b/testsuites/sptests/sptimecounter03/init.c index 90003e97c0..6eb9b78444 100644 --- a/testsuites/sptests/sptimecounter03/init.c +++ b/testsuites/sptests/sptimecounter03/init.c @@ -45,8 +45,8 @@ static rtems_test_parallel_context ctx; static rtems_interval test_binuptime_init( rtems_test_parallel_context *ctx, - void *arg, - size_t active_workers + void *arg, + size_t active_workers ) { (void) ctx; @@ -58,9 +58,9 @@ static rtems_interval test_binuptime_init( static void test_binuptime_body( rtems_test_parallel_context *ctx, - void *arg, - size_t active_workers, - size_t worker_index + void *arg, + size_t active_workers, + size_t worker_index ) { (void) ctx; @@ -71,22 +71,21 @@ static void test_binuptime_body( struct bintime start; struct bintime end; - rtems_bsd_binuptime(&start); + rtems_bsd_binuptime( &start ); do { - rtems_bsd_binuptime(&end); + rtems_bsd_binuptime( &end ); rtems_test_assert( - end.sec > start.sec - || (end.sec == start.sec && end.frac >= start.frac) + end.sec > start.sec || ( end.sec == start.sec && end.frac >= start.frac ) ); start = end; - } while (!rtems_test_parallel_stop_job(ctx)); + } while ( !rtems_test_parallel_stop_job( ctx ) ); } static void test_binuptime_fini( rtems_test_parallel_context *ctx, - void *arg, - size_t active_workers + void *arg, + size_t active_workers ) { (void) ctx; @@ -97,24 +96,22 @@ static void test_binuptime_fini( } static const rtems_test_parallel_job jobs[] = { - { - .init = test_binuptime_init, + { .init = test_binuptime_init, .body = test_binuptime_body, .fini = test_binuptime_fini, - .cascade = false - } + .cascade = false } }; -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; TEST_BEGIN(); - rtems_test_parallel(&ctx, NULL, &jobs[0], RTEMS_ARRAY_SIZE(jobs)); + rtems_test_parallel( &ctx, NULL, &jobs[ 0 ], RTEMS_ARRAY_SIZE( jobs ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_MICROSECONDS_PER_TICK 1000 @@ -122,7 +119,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS CPU_COUNT +#define CONFIGURE_MAXIMUM_TASKS CPU_COUNT #define CONFIGURE_MAXIMUM_TIMERS 1 #define CONFIGURE_MAXIMUM_PROCESSORS CPU_COUNT diff --git a/testsuites/sptests/sptimecounter04/init.c b/testsuites/sptests/sptimecounter04/init.c index 222a22a031..cdd571309e 100644 --- a/testsuites/sptests/sptimecounter04/init.c +++ b/testsuites/sptests/sptimecounter04/init.c @@ -38,7 +38,7 @@ const char rtems_test_name[] = "SPTIMECOUNTER 4"; -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -56,31 +56,31 @@ static void Init(rtems_task_argument arg) TEST_BEGIN(); - rtems_timespec_set(&min, 1, 980000000); - rtems_timespec_set(&max, 2, 20000000); + rtems_timespec_set( &min, 1, 980000000 ); + rtems_timespec_set( &max, 2, 20000000 ); - rv = clock_gettime(CLOCK_REALTIME, &real_start); - rtems_test_assert(rv == 0); - rv = clock_gettime(CLOCK_MONOTONIC, &mono_start); - rtems_test_assert(rv == 0); + rv = clock_gettime( CLOCK_REALTIME, &real_start ); + rtems_test_assert( rv == 0 ); + rv = clock_gettime( CLOCK_MONOTONIC, &mono_start ); + rtems_test_assert( rv == 0 ); - rtems_task_wake_after(2 * rtems_clock_get_ticks_per_second()); + rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() ); - rv = clock_gettime(CLOCK_REALTIME, &real_end); - rtems_test_assert(rv == 0); - rv = clock_gettime(CLOCK_MONOTONIC, &mono_end); - rtems_test_assert(rv == 0); + rv = clock_gettime( CLOCK_REALTIME, &real_end ); + rtems_test_assert( rv == 0 ); + rv = clock_gettime( CLOCK_MONOTONIC, &mono_end ); + rtems_test_assert( rv == 0 ); - rtems_timespec_subtract(&real_start, &real_end, &real_elapsed); - rtems_timespec_subtract(&mono_start, &mono_end, &mono_elapsed); + rtems_timespec_subtract( &real_start, &real_end, &real_elapsed ); + rtems_timespec_subtract( &mono_start, &mono_end, &mono_elapsed ); - rtems_test_assert(rtems_timespec_greater_than(&real_elapsed, &min)); - rtems_test_assert(rtems_timespec_greater_than(&max, &real_elapsed)); - rtems_test_assert(rtems_timespec_greater_than(&mono_elapsed, &min)); - rtems_test_assert(rtems_timespec_greater_than(&max, &mono_elapsed)); + rtems_test_assert( rtems_timespec_greater_than( &real_elapsed, &min ) ); + rtems_test_assert( rtems_timespec_greater_than( &max, &real_elapsed ) ); + rtems_test_assert( rtems_timespec_greater_than( &mono_elapsed, &min ) ); + rtems_test_assert( rtems_timespec_greater_than( &max, &mono_elapsed ) ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_MICROSECONDS_PER_TICK 10000 diff --git a/testsuites/sptests/sptimer_err01/init.c b/testsuites/sptests/sptimer_err01/init.c index b649bef948..605ecf9da7 100644 --- a/testsuites/sptests/sptimer_err01/init.c +++ b/testsuites/sptests/sptimer_err01/init.c @@ -36,34 +36,32 @@ const char rtems_test_name[] = "SPTIMER_ERR 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); - rtems_status_code status; - rtems_time_of_day time; - rtems_timer_information timer_info; - rtems_name timer_name; - rtems_id timer_id; - rtems_id junk_id; + rtems_status_code status; + rtems_time_of_day time; + rtems_timer_information timer_info; + rtems_name timer_name; + rtems_id timer_id; + rtems_id junk_id; - timer_name = rtems_build_name( 'T', 'M', '1', ' ' ); + timer_name = rtems_build_name( 'T', 'M', '1', ' ' ); /* before time set */ status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL ); if ( status == RTEMS_SUCCESSFUL ) { puts( - "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" ); } else { fatal_directive_status( @@ -263,15 +261,14 @@ rtems_task Init( ); puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ID" ); - TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -285,11 +282,11 @@ rtems_timer_service_routine Delayed_routine( #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_MAXIMUM_TIMERS 1 #define CONFIGURE_INIT diff --git a/testsuites/sptests/sptimer_err02/init.c b/testsuites/sptests/sptimer_err02/init.c index 73097abefb..56f17b029b 100644 --- a/testsuites/sptests/sptimer_err02/init.c +++ b/testsuites/sptests/sptimer_err02/init.c @@ -36,31 +36,29 @@ const char rtems_test_name[] = "SPTIMER_ERR 2"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; TEST_BEGIN(); - rtems_status_code status; - rtems_time_of_day time; - rtems_id timer_id; - rtems_name timer_name; + rtems_status_code status; + rtems_time_of_day time; + rtems_id timer_id; + rtems_name timer_name; /* Set System time */ build_time( &time, 12, 31, 1992, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - timer_name = rtems_build_name( 'T', 'M', '1', ' ' ); + timer_name = rtems_build_name( 'T', 'M', '1', ' ' ); /* OK */ status = rtems_timer_create( timer_name, &timer_id ); @@ -106,8 +104,11 @@ rtems_task Init( ); puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED" ); - status = - rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, 0, 0 ); + status = rtems_timer_initiate_server( + RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, + 0, + 0 + ); directive_failed( status, "rtems_timer_initiate_server" ); puts( "TA1 - rtems_timer_initiate_server - SUCCESSFUL" ); @@ -159,8 +160,7 @@ rtems_task Init( puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" ); /* 0 ticks */ - status = rtems_timer_server_fire_after( - timer_id, 0, Delayed_routine, NULL ); + status = rtems_timer_server_fire_after( timer_id, 0, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, @@ -171,7 +171,11 @@ rtems_task Init( /* illegal time */ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); status = rtems_timer_server_fire_when( - timer_id, &time, Delayed_routine, NULL ); + timer_id, + &time, + Delayed_routine, + NULL + ); fatal_directive_status( status, RTEMS_INVALID_CLOCK, @@ -199,7 +203,11 @@ rtems_task Init( /* before current time */ build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); status = rtems_timer_server_fire_when( - timer_id, &time, Delayed_routine, NULL ); + timer_id, + &time, + Delayed_routine, + NULL + ); fatal_directive_status( status, RTEMS_INVALID_CLOCK, @@ -213,12 +221,12 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } rtems_timer_service_routine Delayed_routine( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -234,14 +242,14 @@ rtems_timer_service_routine Delayed_routine( #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER /* Two Tasks: Init and Timer Server */ -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 1 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 1 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include diff --git a/testsuites/sptests/sptimerserver01/init.c b/testsuites/sptests/sptimerserver01/init.c index f5b8b75ec0..b2da8a5e17 100644 --- a/testsuites/sptests/sptimerserver01/init.c +++ b/testsuites/sptests/sptimerserver01/init.c @@ -36,7 +36,7 @@ const char rtems_test_name[] = "SPTIMERSERVER 1"; #define TIMER_COUNT 2 typedef struct { - rtems_id timer[TIMER_COUNT]; + rtems_id timer[ TIMER_COUNT ]; rtems_id master; } test_context; @@ -51,33 +51,33 @@ static const rtems_time_of_day start = { .second = 17 }; -static void cancel(rtems_id id, void *arg) +static void cancel( rtems_id id, void *arg ) { (void) id; - test_context *ctx = arg; + test_context *ctx = arg; rtems_status_code sc; - sc = rtems_timer_cancel(ctx->timer[1]); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_cancel( ctx->timer[ 1 ] ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_transient_send(ctx->master); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( ctx->master ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void never(rtems_id id, void *arg) +static void never( rtems_id id, void *arg ) { (void) id; (void) arg; - rtems_test_assert(0); + rtems_test_assert( 0 ); } -static void test(void) +static void test( void ) { - test_context *ctx = &ctx_instance; + test_context *ctx = &ctx_instance; rtems_status_code sc; - size_t i; + size_t i; rtems_time_of_day later; ctx->master = rtems_task_self(); @@ -87,42 +87,42 @@ static void test(void) RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - for (i = 0; i < TIMER_COUNT; ++i) { + for ( i = 0; i < TIMER_COUNT; ++i ) { sc = rtems_timer_create( - rtems_build_name('T', 'M', 'R', '0' + i), - &ctx->timer[i] + rtems_build_name( 'T', 'M', 'R', '0' + i ), + &ctx->timer[ i ] ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } - sc = rtems_timer_server_fire_after(ctx->timer[0], 10, cancel, ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_server_fire_after( ctx->timer[ 0 ], 10, cancel, ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_server_fire_after(ctx->timer[1], 10, never, NULL); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_server_fire_after( ctx->timer[ 1 ], 10, never, NULL ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_clock_set(&start); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_clock_set( &start ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); later = start; ++later.second; - sc = rtems_timer_server_fire_when(ctx->timer[0], &later, cancel, ctx); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_server_fire_when( ctx->timer[ 0 ], &later, cancel, ctx ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_timer_server_fire_when(ctx->timer[1], &later, never, NULL); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_timer_server_fire_when( ctx->timer[ 1 ], &later, never, NULL ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -131,13 +131,13 @@ static void Init(rtems_task_argument arg) test(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_TIMERS TIMER_COUNT #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION diff --git a/testsuites/sptests/sptimespec01/init.c b/testsuites/sptests/sptimespec01/init.c index 789e90c752..bd20967ddd 100644 --- a/testsuites/sptests/sptimespec01/init.c +++ b/testsuites/sptests/sptimespec01/init.c @@ -37,32 +37,30 @@ const char rtems_test_name[] = "SPTIMESPEC 1"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); -void test_add(void); -void test_divide(void); -void test_divide_by_integer(void); -void test_compare(void); -void test_validity(void); -void test_subtract(void); -void test_convert(void); -void test_greaterthan32bits(void); +rtems_task Init( rtems_task_argument argument ); +void test_add( void ); +void test_divide( void ); +void test_divide_by_integer( void ); +void test_compare( void ); +void test_validity( void ); +void test_subtract( void ); +void test_convert( void ); +void test_greaterthan32bits( void ); struct timespec *timespec1; struct timespec *timespec2; struct timespec *tpointer; -struct timespec ts1; -struct timespec ts2; -struct timespec notvalid={-20,-50}; /* set very invalid timespec */ -bool result; +struct timespec ts1; +struct timespec ts2; +struct timespec notvalid = { -20, -50 }; /* set very invalid timespec */ +bool result; -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - timespec1=&ts1; - timespec2=&ts2; + timespec1 = &ts1; + timespec2 = &ts2; TEST_BEGIN(); @@ -77,10 +75,9 @@ rtems_task Init( TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } - void test_greaterthan32bits() { /* Basic test to see if addition works with a value greater than 32 bits */ @@ -91,198 +88,213 @@ void test_greaterthan32bits() rtems_test_assert( returned_timeT == rtems_timespec_add_to( timespec1, timespec2 ) ); - - puts("rtems_timespec_add_to test greater than 32 bits PASSED"); + + puts( "rtems_timespec_add_to test greater than 32 bits PASSED" ); } - -void test_add(){ -/* Basic add_to test. tv_nsec in result is in range +void test_add() +{ + /* Basic add_to test. tv_nsec in result is in range * (less than TOD_NANOSECONDS_PER_SECOND) */ - rtems_timespec_set(timespec1, 13, 300); - rtems_timespec_set(timespec2, 26, 5000); - rtems_timespec_add_to(timespec1, timespec2); - rtems_test_assert( (timespec1->tv_sec==39)&&(timespec1->tv_nsec==5300) ); -/* Another case. tv_nsec in result is greater than TOD_NANOSECONDS_PER_SECOND */ - rtems_timespec_set(timespec1, 13, (TOD_NANOSECONDS_PER_SECOND-300)); - rtems_timespec_set(timespec2, 26, 5000); - rtems_timespec_add_to(timespec1, timespec2); - rtems_test_assert( (timespec1->tv_sec==40) && (timespec1->tv_nsec==4700) ); + rtems_timespec_set( timespec1, 13, 300 ); + rtems_timespec_set( timespec2, 26, 5000 ); + rtems_timespec_add_to( timespec1, timespec2 ); + rtems_test_assert( + ( timespec1->tv_sec == 39 ) && ( timespec1->tv_nsec == 5300 ) + ); + /* Another case. tv_nsec in result is greater than TOD_NANOSECONDS_PER_SECOND */ + rtems_timespec_set( timespec1, 13, ( TOD_NANOSECONDS_PER_SECOND - 300 ) ); + rtems_timespec_set( timespec2, 26, 5000 ); + rtems_timespec_add_to( timespec1, timespec2 ); + rtems_test_assert( + ( timespec1->tv_sec == 40 ) && ( timespec1->tv_nsec == 4700 ) + ); puts( "\n rtems_timespec_add_to test PASSED " ); } -void test_divide(){ -/* RTEMS_TIMESPEC_DIVIDE TEST -PART1- divide by non-zero timespec */ +void test_divide() +{ + /* RTEMS_TIMESPEC_DIVIDE TEST -PART1- divide by non-zero timespec */ uint32_t ival_percentage, fval_percentage; - rtems_timespec_set(timespec1, 20, 5000); - rtems_timespec_set(timespec2, 61, 5000); + rtems_timespec_set( timespec1, 20, 5000 ); + rtems_timespec_set( timespec2, 61, 5000 ); rtems_timespec_divide( timespec1, timespec2, &ival_percentage, &fval_percentage ); - rtems_test_assert( (ival_percentage==32) || (fval_percentage=786) ); + rtems_test_assert( ( ival_percentage == 32 ) || ( fval_percentage = 786 ) ); puts( " rtems_timespace_divide test -part1- divide by non-zero PASSED" ); - -/* RTEMS_TIMESPEC_DIVIDE TEST -PART2- divide by zero */ - rtems_timespec_zero(timespec2); + /* RTEMS_TIMESPEC_DIVIDE TEST -PART2- divide by zero */ + rtems_timespec_zero( timespec2 ); rtems_timespec_divide( timespec1, - timespec2, - &ival_percentage, + timespec2, + &ival_percentage, &fval_percentage ); - rtems_test_assert( (ival_percentage==0) && (fval_percentage==0) ); + rtems_test_assert( ( ival_percentage == 0 ) && ( fval_percentage == 0 ) ); puts( " rtems_timespace_divide test -part2- divide by zero PASSED" ); } -void test_divide_by_integer(){ -/* RTEMS_TIMESPEC_DIVIDE_BY_INTEGER TEST - simple divide */ - rtems_timespec_set(timespec1, 40, 4700); - rtems_timespec_divide_by_integer(timespec1, 30, timespec2); - rtems_test_assert( ((timespec2->tv_sec)==1) && - ((timespec2->tv_nsec)==333333490) ); +void test_divide_by_integer() +{ + /* RTEMS_TIMESPEC_DIVIDE_BY_INTEGER TEST - simple divide */ + rtems_timespec_set( timespec1, 40, 4700 ); + rtems_timespec_divide_by_integer( timespec1, 30, timespec2 ); + rtems_test_assert( + ( ( timespec2->tv_sec ) == 1 ) && ( ( timespec2->tv_nsec ) == 333333490 ) + ); puts( " rtems_timespec_divide_by_integer test PASSED" ); - } -void test_compare(){ -/* Each case hit another single branch in timespeclessthan.c file */ -/* +void test_compare() +{ + /* Each case hit another single branch in timespeclessthan.c file */ + /* * Basic check if timespec1 is less than timespec2. Timespec1 has lower number * of either seconds and nanoseconds. */ - rtems_timespec_set(timespec1,2,300); - rtems_timespec_set(timespec2,3,400); - result = rtems_timespec_less_than(timespec1,timespec2); - rtems_test_assert(result); -/* + rtems_timespec_set( timespec1, 2, 300 ); + rtems_timespec_set( timespec2, 3, 400 ); + result = rtems_timespec_less_than( timespec1, timespec2 ); + rtems_test_assert( result ); + /* * Another check if timespec1 is less. Now number of seconds are equal in both * timespec1 and timespec2. It hits another branch in rtems_timespec_less_than * method. */ - rtems_timespec_set(timespec2,2,400); - result = rtems_timespec_less_than(timespec1,timespec2); - rtems_test_assert(result); -/* + rtems_timespec_set( timespec2, 2, 400 ); + result = rtems_timespec_less_than( timespec1, timespec2 ); + rtems_test_assert( result ); + /* * Another check if timespec1 is less. In this case timespecs are equal so it * should return false. */ - rtems_timespec_set(timespec2,2,300); - result = rtems_timespec_less_than(timespec1,timespec2); - rtems_test_assert(!result); -/* + rtems_timespec_set( timespec2, 2, 300 ); + result = rtems_timespec_less_than( timespec1, timespec2 ); + rtems_test_assert( !result ); + /* * Check if timespec1 is less. Both timespecs are equal on seconds, but * timespec2 has smaller number of nanoseconds. */ - rtems_timespec_set(timespec2,2,0); - result = rtems_timespec_less_than(timespec1,timespec2); - rtems_test_assert(!result); -/* In this case timespec2 is smaller in both seconds and nanoseconds. */ - rtems_timespec_set(timespec2,1,400); - result = rtems_timespec_less_than(timespec1,timespec2); - rtems_test_assert(!result); + rtems_timespec_set( timespec2, 2, 0 ); + result = rtems_timespec_less_than( timespec1, timespec2 ); + rtems_test_assert( !result ); + /* In this case timespec2 is smaller in both seconds and nanoseconds. */ + rtems_timespec_set( timespec2, 1, 400 ); + result = rtems_timespec_less_than( timespec1, timespec2 ); + rtems_test_assert( !result ); - puts( " rtems_timespec_less_than PASSED "); + puts( " rtems_timespec_less_than PASSED " ); } -void test_validity(){ -/* Each case hits another branch in timespecisvalid.c src file */ +void test_validity() +{ + /* Each case hits another branch in timespecisvalid.c src file */ /* #1 INVALID - pointer to timespec is null */ - result=rtems_timespec_is_valid(tpointer); - rtems_test_assert(!result); + result = rtems_timespec_is_valid( tpointer ); + rtems_test_assert( !result ); - tpointer=¬valid; /* set pointer to invalid timespec */ + tpointer = ¬valid; /* set pointer to invalid timespec */ /* #2 INVALID- tv_sec of timespec is less than 0 */ - result=rtems_timespec_is_valid(tpointer); - rtems_test_assert(!result); + result = rtems_timespec_is_valid( tpointer ); + rtems_test_assert( !result ); /* #3 INVALID- tv_nsec of timespec is less than 0 */ - notvalid.tv_sec=20; /* correct seconds */ - result=rtems_timespec_is_valid(tpointer); - rtems_test_assert(!result); + notvalid.tv_sec = 20; /* correct seconds */ + result = rtems_timespec_is_valid( tpointer ); + rtems_test_assert( !result ); /* #4 INVALID- tv_nsec is not in the range - positive but too large */ - notvalid.tv_nsec=TOD_NANOSECONDS_PER_SECOND+10; - result=rtems_timespec_is_valid(tpointer); - rtems_test_assert(!result); + notvalid.tv_nsec = TOD_NANOSECONDS_PER_SECOND + 10; + result = rtems_timespec_is_valid( tpointer ); + rtems_test_assert( !result ); /* #5 VALID- valid timespec */ - rtems_timespec_set(tpointer,13, 500); - result=rtems_timespec_is_valid(tpointer); - rtems_test_assert(result); + rtems_timespec_set( tpointer, 13, 500 ); + result = rtems_timespec_is_valid( tpointer ); + rtems_test_assert( result ); - puts(" rtems_timespec_is_valid test PASSED"); + puts( " rtems_timespec_is_valid test PASSED" ); } -void test_subtract(){ -/* +void test_subtract() +{ + /* * Simple subtraction, number of nanoseconds in timespec2 is less than in * timespec1. */ - rtems_timespec_set(timespec1,10, 800); - rtems_timespec_set(timespec2,13, 500); - rtems_timespec_subtract(timespec1,timespec2,tpointer); - rtems_test_assert( (tpointer->tv_sec==2) && - (tpointer->tv_nsec==(TOD_NANOSECONDS_PER_SECOND-300)) ); -/* + rtems_timespec_set( timespec1, 10, 800 ); + rtems_timespec_set( timespec2, 13, 500 ); + rtems_timespec_subtract( timespec1, timespec2, tpointer ); + rtems_test_assert( + ( tpointer->tv_sec == 2 ) && + ( tpointer->tv_nsec == ( TOD_NANOSECONDS_PER_SECOND - 300 ) ) + ); + /* * Simple subtraction, number of nanoseconds in timespec2 is greater than in * timespec1. It hits another branch. - */ - rtems_timespec_set(timespec1,10,200); - rtems_timespec_subtract(timespec1,timespec2,tpointer); - rtems_test_assert( (tpointer->tv_sec==3) && - (tpointer->tv_nsec==300) ); -/* + */ + rtems_timespec_set( timespec1, 10, 200 ); + rtems_timespec_subtract( timespec1, timespec2, tpointer ); + rtems_test_assert( + ( tpointer->tv_sec == 3 ) && ( tpointer->tv_nsec == 300 ) + ); + /* * Case when timespec2 (end) is less than timespec1 (start). It produce * negative result. */ - rtems_timespec_set(timespec1,13,600); - rtems_timespec_subtract(timespec1,timespec2,tpointer); - rtems_test_assert( (tpointer->tv_sec==(-1)) && \ - (tpointer->tv_nsec==999999900) ); - puts(" rtems_timespec_subtract test PASSED"); + rtems_timespec_set( timespec1, 13, 600 ); + rtems_timespec_subtract( timespec1, timespec2, tpointer ); + rtems_test_assert( + ( tpointer->tv_sec == ( -1 ) ) && ( tpointer->tv_nsec == 999999900 ) + ); + puts( " rtems_timespec_subtract test PASSED" ); } -void test_convert(){ -/* RTEMS_TIMESPEC_FROM_TICKS TEST - basic conversions */ - uint32_t ticks=0; - rtems_timespec_from_ticks(ticks, timespec1); - rtems_test_assert( ((timespec1->tv_sec)==0) && ((timespec1->tv_nsec)==0) ); - ticks=1008; - rtems_timespec_from_ticks(ticks, timespec2); - puts( " rtems_timespec_from_ticks PASSED "); +void test_convert() +{ + /* RTEMS_TIMESPEC_FROM_TICKS TEST - basic conversions */ + uint32_t ticks = 0; + rtems_timespec_from_ticks( ticks, timespec1 ); + rtems_test_assert( + ( ( timespec1->tv_sec ) == 0 ) && ( ( timespec1->tv_nsec ) == 0 ) + ); + ticks = 1008; + rtems_timespec_from_ticks( ticks, timespec2 ); + puts( " rtems_timespec_from_ticks PASSED " ); -/* RTEMS_TIMESPEC_TO_TICKS TEST - basic conversion - inverse to above ones */ - ticks = rtems_timespec_to_ticks(timespec1); - rtems_test_assert(ticks==0); - ticks = rtems_timespec_to_ticks(timespec2); - rtems_test_assert(ticks==1008); -/* + /* RTEMS_TIMESPEC_TO_TICKS TEST - basic conversion - inverse to above ones */ + ticks = rtems_timespec_to_ticks( timespec1 ); + rtems_test_assert( ticks == 0 ); + ticks = rtems_timespec_to_ticks( timespec2 ); + rtems_test_assert( ticks == 1008 ); + /* * RTEMS_TIMESPEC_TO_TICKS TEST - test case when tv_nsec of timespec isn't * multiplicity of nanoseconds_per_tick. Due to that, calculated number of ticks * should be increased by one. */ uint32_t nanoseconds_per_tick; uint32_t nanoseconds; - nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick(); + nanoseconds_per_tick = rtems_configuration_get_nanoseconds_per_tick(); nanoseconds = timespec2->tv_nsec; - if( (nanoseconds % nanoseconds_per_tick)==0 ) + if ( ( nanoseconds % nanoseconds_per_tick ) == 0 ) { nanoseconds += 1; - rtems_timespec_set(timespec1,timespec2->tv_sec,nanoseconds); - ticks = rtems_timespec_to_ticks(timespec1); - rtems_test_assert(ticks==1009); - puts( " rtems_timespec_from_ticks and rtems_timespec_to_ticks test PASSED"); + } + rtems_timespec_set( timespec1, timespec2->tv_sec, nanoseconds ); + ticks = rtems_timespec_to_ticks( timespec1 ); + rtems_test_assert( ticks == 1009 ); + puts( " rtems_timespec_from_ticks and rtems_timespec_to_ticks test PASSED" ); } - /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/sptls01/init.c b/testsuites/sptests/sptls01/init.c index ccd2404b8f..de6bfaf9ad 100644 --- a/testsuites/sptests/sptls01/init.c +++ b/testsuites/sptests/sptls01/init.c @@ -48,37 +48,37 @@ static volatile uint32_t read_write_small = 0xdeadbeefUL; static const volatile uint32_t read_only_small = 0x601dc0feUL; -static void check_tls_item(char expected) +static void check_tls_item( char expected ) { - printk("TLS item = %i\n", tls_item); - rtems_test_assert(tls_item == expected); + printk( "TLS item = %i\n", tls_item ); + rtems_test_assert( tls_item == expected ); } -static void task(rtems_task_argument arg) +static void task( rtems_task_argument arg ) { (void) arg; rtems_status_code sc; - check_tls_item(123); + check_tls_item( 123 ); tls_item = 42; - sc = rtems_event_transient_send(master_task); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_send( master_task ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_suspend(RTEMS_SELF); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_suspend( RTEMS_SELF ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); } -static void check_tls_size(void) +static void check_tls_size( void ) { const volatile TLS_Configuration *config; - uintptr_t tls_size; + uintptr_t tls_size; config = &_TLS_Configuration; tls_size = (uintptr_t) config->size; - if (tls_size != 1) { + if ( tls_size != 1 ) { printk( "WARNING: The thread-local storage size is %" PRIuPTR ". It should be\n" "exactly one for this test. Check the BSP implementation. The BSP\n" @@ -86,94 +86,94 @@ static void check_tls_size(void) "this test.\n", tls_size ); - rtems_test_assert(tls_size == 1); + rtems_test_assert( tls_size == 1 ); } } -static Thread_Control *get_thread(rtems_id id) +static Thread_Control *get_thread( rtems_id id ) { - Thread_Control *the_thread; + Thread_Control *the_thread; ISR_lock_Context lock_context; - the_thread = _Thread_Get(id, &lock_context); - _ISR_lock_ISR_enable(&lock_context); + the_thread = _Thread_Get( id, &lock_context ); + _ISR_lock_ISR_enable( &lock_context ); return the_thread; } -static void test(void) +static void test( void ) { - rtems_id id; + rtems_id id; rtems_status_code sc; - Thread_Control *self; - Thread_Control *other; - char *self_tp; - char *other_tp; - uintptr_t tls_item_offset; - char *self_tls_item; - char *other_tls_item; + Thread_Control *self; + Thread_Control *other; + char *self_tp; + char *other_tp; + uintptr_t tls_item_offset; + char *self_tls_item; + char *other_tls_item; master_task = rtems_task_self(); - rtems_test_assert(read_write_small == 0xdeadbeefUL); - rtems_test_assert(read_only_small == 0x601dc0feUL); + rtems_test_assert( read_write_small == 0xdeadbeefUL ); + rtems_test_assert( read_only_small == 0x601dc0feUL ); - check_tls_item(123); + check_tls_item( 123 ); tls_item = 5; sc = rtems_task_create( - rtems_build_name('T', 'A', 'S', 'K'), + rtems_build_name( 'T', 'A', 'S', 'K' ), RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - sc = rtems_task_start(id, task, 0); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_start( id, task, 0 ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - self = get_thread(master_task); - other = get_thread(id); - self_tp = _CPU_Get_TLS_thread_pointer(&self->Registers); - other_tp = _CPU_Get_TLS_thread_pointer(&other->Registers); - tls_item_offset = (uintptr_t) (&tls_item - self_tp); + self = get_thread( master_task ); + other = get_thread( id ); + self_tp = _CPU_Get_TLS_thread_pointer( &self->Registers ); + other_tp = _CPU_Get_TLS_thread_pointer( &other->Registers ); + tls_item_offset = (uintptr_t) ( &tls_item - self_tp ); self_tls_item = self_tp + tls_item_offset; other_tls_item = other_tp + tls_item_offset; - rtems_test_assert(*self_tls_item == 5); - rtems_test_assert(*other_tls_item == 123); + rtems_test_assert( *self_tls_item == 5 ); + rtems_test_assert( *other_tls_item == 123 ); - sc = rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_event_transient_receive( RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert(*self_tls_item == 5); - rtems_test_assert(*other_tls_item == 42); + rtems_test_assert( *self_tls_item == 5 ); + rtems_test_assert( *other_tls_item == 42 ); - sc = rtems_task_delete(id); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); + sc = rtems_task_delete( id ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - check_tls_item(5); + check_tls_item( 5 ); } -static void test_idle_during_system_init(void) +static void test_idle_during_system_init( void ) { - rtems_print_printer_printk(&rtems_test_printer); + rtems_print_printer_printk( &rtems_test_printer ); TEST_BEGIN(); - check_tls_item(123); + check_tls_item( 123 ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; test(); - rtems_test_assert(!rtems_stack_checker_is_blown()); + rtems_test_assert( !rtems_stack_checker_is_blown() ); check_tls_size(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } RTEMS_SYSINIT_ITEM( diff --git a/testsuites/sptests/sptls03/init.c b/testsuites/sptests/sptls03/init.c index f41943c9a6..05a3b417cf 100644 --- a/testsuites/sptests/sptls03/init.c +++ b/testsuites/sptests/sptls03/init.c @@ -40,17 +40,17 @@ static volatile uint32_t read_write_small = 0xdeadbeefUL; static const volatile uint32_t read_only_small = 0x601dc0feUL; -static void test(void) +static void test( void ) { Thread_Control *executing = _Thread_Get_executing(); - rtems_test_assert(read_write_small == 0xdeadbeefUL); - rtems_test_assert(read_only_small == 0x601dc0feUL); + rtems_test_assert( read_write_small == 0xdeadbeefUL ); + rtems_test_assert( read_only_small == 0x601dc0feUL ); - rtems_test_assert(executing->Start.tls_area == NULL); + rtems_test_assert( executing->Start.tls_area == NULL ); } -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; @@ -58,10 +58,10 @@ static void Init(rtems_task_argument arg) test(); - rtems_test_assert(!rtems_stack_checker_is_blown()); + rtems_test_assert( !rtems_stack_checker_is_blown() ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER diff --git a/testsuites/sptests/sptls04/init.c b/testsuites/sptests/sptls04/init.c index 2286aec154..958ccd38d8 100644 --- a/testsuites/sptests/sptls04/init.c +++ b/testsuites/sptests/sptls04/init.c @@ -28,7 +28,7 @@ #include -#define rtems_test_assert(x) assert(x) +#define rtems_test_assert( x ) assert( x ) #endif /* __rtems__ */ @@ -36,30 +36,30 @@ static _Thread_local int i; static _Thread_local int j; -static __attribute__((__constructor__)) void con(void) +static __attribute__(( __constructor__ )) void con( void ) { i = 1; } -static void test(void) +static void test( void ) { - rtems_test_assert(i == 1); - rtems_test_assert(j == 0); - rtems_test_assert(k == 2); + rtems_test_assert( i == 1 ); + rtems_test_assert( j == 0 ); + rtems_test_assert( k == 2 ); } #ifdef __rtems__ const char rtems_test_name[] = "SPTLS 4"; -static void Init(rtems_task_argument arg) +static void Init( rtems_task_argument arg ) { (void) arg; TEST_BEGIN(); test(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER @@ -75,7 +75,7 @@ static void Init(rtems_task_argument arg) #else /* __rtems__ */ -int main(void) +int main( void ) { test(); return 0; diff --git a/testsuites/sptests/sptree01/init.c b/testsuites/sptests/sptree01/init.c index 87bc6ceed1..0cc72f694d 100644 --- a/testsuites/sptests/sptree01/init.c +++ b/testsuites/sptests/sptree01/init.c @@ -46,7 +46,7 @@ static rtems_task Init( rtems_task_argument ignored ) TEST_BEGIN(); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ diff --git a/testsuites/sptests/sptree01/sys/tree.h b/testsuites/sptests/sptree01/sys/tree.h index ddf98d2ffb..068a80ebcf 100644 --- a/testsuites/sptests/sptree01/sys/tree.h +++ b/testsuites/sptests/sptree01/sys/tree.h @@ -28,8 +28,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _SYS_TREE_H_ -#define _SYS_TREE_H_ +#ifndef _SYS_TREE_H_ +#define _SYS_TREE_H_ #include @@ -71,256 +71,265 @@ * The maximum height of a rank-balanced tree is 2lg (n+1). */ -#define SPLAY_HEAD(name, type) \ -struct name { \ - struct type *sph_root; /* root of the tree */ \ -} +#define SPLAY_HEAD( name, type ) \ + struct name { \ + struct type *sph_root; /* root of the tree */ \ + } -#define SPLAY_INITIALIZER(root) \ - { NULL } +#define SPLAY_INITIALIZER( root ) { NULL } -#define SPLAY_INIT(root) do { \ - (root)->sph_root = NULL; \ -} while (/*CONSTCOND*/ 0) +#define SPLAY_INIT( root ) \ + do { \ + ( root )->sph_root = NULL; \ + } while ( /*CONSTCOND*/ 0 ) -#define SPLAY_ENTRY(type) \ -struct { \ - struct type *spe_left; /* left element */ \ - struct type *spe_right; /* right element */ \ -} +#define SPLAY_ENTRY( type ) \ + struct { \ + struct type *spe_left; /* left element */ \ + struct type *spe_right; /* right element */ \ + } -#define SPLAY_LEFT(elm, field) (elm)->field.spe_left -#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right -#define SPLAY_ROOT(head) (head)->sph_root -#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL) +#define SPLAY_LEFT( elm, field ) ( elm )->field.spe_left +#define SPLAY_RIGHT( elm, field ) ( elm )->field.spe_right +#define SPLAY_ROOT( head ) ( head )->sph_root +#define SPLAY_EMPTY( head ) ( SPLAY_ROOT( head ) == NULL ) /* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */ -#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \ - SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ - SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ - (head)->sph_root = tmp; \ -} while (/*CONSTCOND*/ 0) +#define SPLAY_ROTATE_RIGHT( head, tmp, field ) \ + do { \ + SPLAY_LEFT( ( head )->sph_root, field ) = SPLAY_RIGHT( tmp, field ); \ + SPLAY_RIGHT( tmp, field ) = ( head )->sph_root; \ + ( head )->sph_root = tmp; \ + } while ( /*CONSTCOND*/ 0 ) -#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ - SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ - SPLAY_LEFT(tmp, field) = (head)->sph_root; \ - (head)->sph_root = tmp; \ -} while (/*CONSTCOND*/ 0) +#define SPLAY_ROTATE_LEFT( head, tmp, field ) \ + do { \ + SPLAY_RIGHT( ( head )->sph_root, field ) = SPLAY_LEFT( tmp, field ); \ + SPLAY_LEFT( tmp, field ) = ( head )->sph_root; \ + ( head )->sph_root = tmp; \ + } while ( /*CONSTCOND*/ 0 ) -#define SPLAY_LINKLEFT(head, tmp, field) do { \ - SPLAY_LEFT(tmp, field) = (head)->sph_root; \ - tmp = (head)->sph_root; \ - (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ -} while (/*CONSTCOND*/ 0) +#define SPLAY_LINKLEFT( head, tmp, field ) \ + do { \ + SPLAY_LEFT( tmp, field ) = ( head )->sph_root; \ + tmp = ( head )->sph_root; \ + ( head )->sph_root = SPLAY_LEFT( ( head )->sph_root, field ); \ + } while ( /*CONSTCOND*/ 0 ) -#define SPLAY_LINKRIGHT(head, tmp, field) do { \ - SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ - tmp = (head)->sph_root; \ - (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ -} while (/*CONSTCOND*/ 0) +#define SPLAY_LINKRIGHT( head, tmp, field ) \ + do { \ + SPLAY_RIGHT( tmp, field ) = ( head )->sph_root; \ + tmp = ( head )->sph_root; \ + ( head )->sph_root = SPLAY_RIGHT( ( head )->sph_root, field ); \ + } while ( /*CONSTCOND*/ 0 ) -#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ - SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ - SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\ - SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ - SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ -} while (/*CONSTCOND*/ 0) +#define SPLAY_ASSEMBLE( head, node, left, right, field ) \ + do { \ + SPLAY_RIGHT( left, field ) = SPLAY_LEFT( ( head )->sph_root, field ); \ + SPLAY_LEFT( right, field ) = SPLAY_RIGHT( ( head )->sph_root, field ); \ + SPLAY_LEFT( ( head )->sph_root, field ) = SPLAY_RIGHT( node, field ); \ + SPLAY_RIGHT( ( head )->sph_root, field ) = SPLAY_LEFT( node, field ); \ + } while ( /*CONSTCOND*/ 0 ) /* Generates prototypes and inline functions */ -#define SPLAY_PROTOTYPE(name, type, field, cmp) \ -void name##_SPLAY(struct name *, struct type *); \ -void name##_SPLAY_MINMAX(struct name *, int); \ -struct type *name##_SPLAY_INSERT(struct name *, struct type *); \ -struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \ - \ -/* Finds the node with the same key as elm */ \ -static __unused __inline struct type * \ -name##_SPLAY_FIND(struct name *head, struct type *elm) \ -{ \ - if (SPLAY_EMPTY(head)) \ - return(NULL); \ - name##_SPLAY(head, elm); \ - if ((cmp)(elm, (head)->sph_root) == 0) \ - return (head->sph_root); \ - return (NULL); \ -} \ - \ -static __unused __inline struct type * \ -name##_SPLAY_NEXT(struct name *head, struct type *elm) \ -{ \ - name##_SPLAY(head, elm); \ - if (SPLAY_RIGHT(elm, field) != NULL) { \ - elm = SPLAY_RIGHT(elm, field); \ - while (SPLAY_LEFT(elm, field) != NULL) { \ - elm = SPLAY_LEFT(elm, field); \ - } \ - } else \ - elm = NULL; \ - return (elm); \ -} \ - \ -static __unused __inline struct type * \ -name##_SPLAY_MIN_MAX(struct name *head, int val) \ -{ \ - name##_SPLAY_MINMAX(head, val); \ - return (SPLAY_ROOT(head)); \ -} +#define SPLAY_PROTOTYPE( name, type, field, cmp ) \ + void name##_SPLAY( struct name *, struct type * ); \ + void name##_SPLAY_MINMAX( struct name *, int ); \ + struct type *name##_SPLAY_INSERT( struct name *, struct type * ); \ + struct type *name##_SPLAY_REMOVE( struct name *, struct type * ); \ + \ + /* Finds the node with the same key as elm */ \ + static __unused __inline struct type *name##_SPLAY_FIND( \ + struct name *head, \ + struct type *elm \ + ) \ + { \ + if ( SPLAY_EMPTY( head ) ) \ + return ( NULL ); \ + name##_SPLAY( head, elm ); \ + if ( (cmp) ( elm, ( head )->sph_root ) == 0 ) \ + return ( head->sph_root ); \ + return ( NULL ); \ + } \ + \ + static __unused __inline struct type *name##_SPLAY_NEXT( \ + struct name *head, \ + struct type *elm \ + ) \ + { \ + name##_SPLAY( head, elm ); \ + if ( SPLAY_RIGHT( elm, field ) != NULL ) { \ + elm = SPLAY_RIGHT( elm, field ); \ + while ( SPLAY_LEFT( elm, field ) != NULL ) { \ + elm = SPLAY_LEFT( elm, field ); \ + } \ + } else \ + elm = NULL; \ + return ( elm ); \ + } \ + \ + static __unused __inline struct type *name##_SPLAY_MIN_MAX( \ + struct name *head, \ + int val \ + ) \ + { \ + name##_SPLAY_MINMAX( head, val ); \ + return ( SPLAY_ROOT( head ) ); \ + } /* Main splay operation. * Moves node close to the key of elm to top */ -#define SPLAY_GENERATE(name, type, field, cmp) \ -struct type * \ -name##_SPLAY_INSERT(struct name *head, struct type *elm) \ -{ \ - if (SPLAY_EMPTY(head)) { \ - SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \ - } else { \ - __typeof(cmp(NULL, NULL)) __comp; \ - name##_SPLAY(head, elm); \ - __comp = (cmp)(elm, (head)->sph_root); \ - if (__comp < 0) { \ - SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\ - SPLAY_RIGHT(elm, field) = (head)->sph_root; \ - SPLAY_LEFT((head)->sph_root, field) = NULL; \ - } else if (__comp > 0) { \ - SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\ - SPLAY_LEFT(elm, field) = (head)->sph_root; \ - SPLAY_RIGHT((head)->sph_root, field) = NULL; \ - } else \ - return ((head)->sph_root); \ - } \ - (head)->sph_root = (elm); \ - return (NULL); \ -} \ - \ -struct type * \ -name##_SPLAY_REMOVE(struct name *head, struct type *elm) \ -{ \ - struct type *__tmp; \ - if (SPLAY_EMPTY(head)) \ - return (NULL); \ - name##_SPLAY(head, elm); \ - if ((cmp)(elm, (head)->sph_root) == 0) { \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \ - (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\ - } else { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - (head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\ - name##_SPLAY(head, elm); \ - SPLAY_RIGHT((head)->sph_root, field) = __tmp; \ - } \ - return (elm); \ - } \ - return (NULL); \ -} \ - \ -void \ -name##_SPLAY(struct name *head, struct type *elm) \ -{ \ - struct type __node, *__left, *__right, *__tmp; \ - __typeof(cmp(NULL, NULL)) __comp; \ -\ - SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ - __left = __right = &__node; \ -\ - while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \ - if (__comp < 0) { \ - __tmp = SPLAY_LEFT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if ((cmp)(elm, __tmp) < 0){ \ - SPLAY_ROTATE_RIGHT(head, __tmp, field); \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKLEFT(head, __right, field); \ - } else if (__comp > 0) { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if ((cmp)(elm, __tmp) > 0){ \ - SPLAY_ROTATE_LEFT(head, __tmp, field); \ - if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKRIGHT(head, __left, field); \ - } \ - } \ - SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ -} \ - \ -/* Splay with either the minimum or the maximum element \ +#define SPLAY_GENERATE( name, type, field, cmp ) \ + struct type *name##_SPLAY_INSERT( struct name *head, struct type *elm ) \ + { \ + if ( SPLAY_EMPTY( head ) ) { \ + SPLAY_LEFT( elm, field ) = SPLAY_RIGHT( elm, field ) = NULL; \ + } else { \ + __typeof( cmp( NULL, NULL ) ) __comp; \ + name##_SPLAY( head, elm ); \ + __comp = (cmp) ( elm, ( head )->sph_root ); \ + if ( __comp < 0 ) { \ + SPLAY_LEFT( elm, field ) = SPLAY_LEFT( ( head )->sph_root, field ); \ + SPLAY_RIGHT( elm, field ) = ( head )->sph_root; \ + SPLAY_LEFT( ( head )->sph_root, field ) = NULL; \ + } else if ( __comp > 0 ) { \ + SPLAY_RIGHT( elm, field ) = SPLAY_RIGHT( ( head )->sph_root, field ); \ + SPLAY_LEFT( elm, field ) = ( head )->sph_root; \ + SPLAY_RIGHT( ( head )->sph_root, field ) = NULL; \ + } else \ + return ( ( head )->sph_root ); \ + } \ + ( head )->sph_root = ( elm ); \ + return ( NULL ); \ + } \ + \ + struct type *name##_SPLAY_REMOVE( struct name *head, struct type *elm ) \ + { \ + struct type *__tmp; \ + if ( SPLAY_EMPTY( head ) ) \ + return ( NULL ); \ + name##_SPLAY( head, elm ); \ + if ( (cmp) ( elm, ( head )->sph_root ) == 0 ) { \ + if ( SPLAY_LEFT( ( head )->sph_root, field ) == NULL ) { \ + ( head )->sph_root = SPLAY_RIGHT( ( head )->sph_root, field ); \ + } else { \ + __tmp = SPLAY_RIGHT( ( head )->sph_root, field ); \ + ( head )->sph_root = SPLAY_LEFT( ( head )->sph_root, field ); \ + name##_SPLAY( head, elm ); \ + SPLAY_RIGHT( ( head )->sph_root, field ) = __tmp; \ + } \ + return ( elm ); \ + } \ + return ( NULL ); \ + } \ + \ + void name##_SPLAY( struct name *head, struct type *elm ) \ + { \ + struct type __node, *__left, *__right, *__tmp; \ + __typeof( cmp( NULL, NULL ) ) __comp; \ + \ + SPLAY_LEFT( &__node, field ) = SPLAY_RIGHT( &__node, field ) = NULL; \ + __left = __right = &__node; \ + \ + while ( ( __comp = (cmp) ( elm, ( head )->sph_root ) ) != 0 ) { \ + if ( __comp < 0 ) { \ + __tmp = SPLAY_LEFT( ( head )->sph_root, field ); \ + if ( __tmp == NULL ) \ + break; \ + if ( (cmp) ( elm, __tmp ) < 0 ) { \ + SPLAY_ROTATE_RIGHT( head, __tmp, field ); \ + if ( SPLAY_LEFT( ( head )->sph_root, field ) == NULL ) \ + break; \ + } \ + SPLAY_LINKLEFT( head, __right, field ); \ + } else if ( __comp > 0 ) { \ + __tmp = SPLAY_RIGHT( ( head )->sph_root, field ); \ + if ( __tmp == NULL ) \ + break; \ + if ( (cmp) ( elm, __tmp ) > 0 ) { \ + SPLAY_ROTATE_LEFT( head, __tmp, field ); \ + if ( SPLAY_RIGHT( ( head )->sph_root, field ) == NULL ) \ + break; \ + } \ + SPLAY_LINKRIGHT( head, __left, field ); \ + } \ + } \ + SPLAY_ASSEMBLE( head, &__node, __left, __right, field ); \ + } \ + \ + /* Splay with either the minimum or the maximum element \ * Used to find minimum or maximum element in tree. \ - */ \ -void name##_SPLAY_MINMAX(struct name *head, int __comp) \ -{ \ - struct type __node, *__left, *__right, *__tmp; \ -\ - SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ - __left = __right = &__node; \ -\ - while (1) { \ - if (__comp < 0) { \ - __tmp = SPLAY_LEFT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if (__comp < 0){ \ - SPLAY_ROTATE_RIGHT(head, __tmp, field); \ - if (SPLAY_LEFT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKLEFT(head, __right, field); \ - } else if (__comp > 0) { \ - __tmp = SPLAY_RIGHT((head)->sph_root, field); \ - if (__tmp == NULL) \ - break; \ - if (__comp > 0) { \ - SPLAY_ROTATE_LEFT(head, __tmp, field); \ - if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\ - break; \ - } \ - SPLAY_LINKRIGHT(head, __left, field); \ - } \ - } \ - SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \ -} + */ \ + void name##_SPLAY_MINMAX( struct name *head, int __comp ) \ + { \ + struct type __node, *__left, *__right, *__tmp; \ + \ + SPLAY_LEFT( &__node, field ) = SPLAY_RIGHT( &__node, field ) = NULL; \ + __left = __right = &__node; \ + \ + while ( 1 ) { \ + if ( __comp < 0 ) { \ + __tmp = SPLAY_LEFT( ( head )->sph_root, field ); \ + if ( __tmp == NULL ) \ + break; \ + if ( __comp < 0 ) { \ + SPLAY_ROTATE_RIGHT( head, __tmp, field ); \ + if ( SPLAY_LEFT( ( head )->sph_root, field ) == NULL ) \ + break; \ + } \ + SPLAY_LINKLEFT( head, __right, field ); \ + } else if ( __comp > 0 ) { \ + __tmp = SPLAY_RIGHT( ( head )->sph_root, field ); \ + if ( __tmp == NULL ) \ + break; \ + if ( __comp > 0 ) { \ + SPLAY_ROTATE_LEFT( head, __tmp, field ); \ + if ( SPLAY_RIGHT( ( head )->sph_root, field ) == NULL ) \ + break; \ + } \ + SPLAY_LINKRIGHT( head, __left, field ); \ + } \ + } \ + SPLAY_ASSEMBLE( head, &__node, __left, __right, field ); \ + } -#define SPLAY_NEGINF -1 -#define SPLAY_INF 1 +#define SPLAY_NEGINF -1 +#define SPLAY_INF 1 -#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y) -#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y) -#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y) -#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y) -#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \ - : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF)) -#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \ - : name##_SPLAY_MIN_MAX(x, SPLAY_INF)) +#define SPLAY_INSERT( name, x, y ) name##_SPLAY_INSERT( x, y ) +#define SPLAY_REMOVE( name, x, y ) name##_SPLAY_REMOVE( x, y ) +#define SPLAY_FIND( name, x, y ) name##_SPLAY_FIND( x, y ) +#define SPLAY_NEXT( name, x, y ) name##_SPLAY_NEXT( x, y ) +#define SPLAY_MIN( name, x ) \ + ( SPLAY_EMPTY( x ) ? NULL : name##_SPLAY_MIN_MAX( x, SPLAY_NEGINF ) ) +#define SPLAY_MAX( name, x ) \ + ( SPLAY_EMPTY( x ) ? NULL : name##_SPLAY_MIN_MAX( x, SPLAY_INF ) ) -#define SPLAY_FOREACH(x, name, head) \ - for ((x) = SPLAY_MIN(name, head); \ - (x) != NULL; \ - (x) = SPLAY_NEXT(name, head, x)) +#define SPLAY_FOREACH( x, name, head ) \ + for ( \ + ( x ) = SPLAY_MIN( name, head ); ( x ) != NULL; \ + ( x ) = SPLAY_NEXT( name, head, x ) \ + ) /* Macros that define a rank-balanced tree */ -#define RB_HEAD(name, type) \ -struct name { \ - struct type *rbh_root; /* root of the tree */ \ -} +#define RB_HEAD( name, type ) \ + struct name { \ + struct type *rbh_root; /* root of the tree */ \ + } -#define RB_INITIALIZER(root) \ - { NULL } +#define RB_INITIALIZER( root ) { NULL } -#define RB_INIT(root) do { \ - (root)->rbh_root = NULL; \ -} while (/*CONSTCOND*/ 0) +#define RB_INIT( root ) \ + do { \ + ( root )->rbh_root = NULL; \ + } while ( /*CONSTCOND*/ 0 ) -#define RB_ENTRY(type) \ -struct { \ - struct type *rbe_link[3]; \ -} +#define RB_ENTRY( type ) \ + struct { \ + struct type *rbe_link[ 3 ]; \ + } /* * With the expectation that any object of struct type has an @@ -329,31 +338,32 @@ struct { \ * always zero, this implementation sets those bits to indicate * that the left or right child of the tree node is "red". */ -#define _RB_LINK(elm, dir, field) (elm)->field.rbe_link[dir] -#define _RB_UP(elm, field) _RB_LINK(elm, 0, field) -#define _RB_L ((__uintptr_t)1) -#define _RB_R ((__uintptr_t)2) -#define _RB_LR ((__uintptr_t)3) -#define _RB_BITS(elm) (*(__uintptr_t *)&elm) -#define _RB_BITSUP(elm, field) _RB_BITS(_RB_UP(elm, field)) -#define _RB_PTR(elm) (__typeof(elm)) \ - ((__uintptr_t)elm & ~_RB_LR) +#define _RB_LINK( elm, dir, field ) ( elm )->field.rbe_link[ dir ] +#define _RB_UP( elm, field ) _RB_LINK( elm, 0, field ) +#define _RB_L ( (__uintptr_t) 1 ) +#define _RB_R ( (__uintptr_t) 2 ) +#define _RB_LR ( (__uintptr_t) 3 ) +#define _RB_BITS( elm ) ( *(__uintptr_t *) &elm ) +#define _RB_BITSUP( elm, field ) _RB_BITS( _RB_UP( elm, field ) ) +#define _RB_PTR( elm ) (__typeof( elm )) ( (__uintptr_t) elm & ~_RB_LR ) -#define RB_PARENT(elm, field) _RB_PTR(_RB_UP(elm, field)) -#define RB_LEFT(elm, field) _RB_LINK(elm, _RB_L, field) -#define RB_RIGHT(elm, field) _RB_LINK(elm, _RB_R, field) -#define RB_ROOT(head) (head)->rbh_root -#define RB_EMPTY(head) (RB_ROOT(head) == NULL) +#define RB_PARENT( elm, field ) _RB_PTR( _RB_UP( elm, field ) ) +#define RB_LEFT( elm, field ) _RB_LINK( elm, _RB_L, field ) +#define RB_RIGHT( elm, field ) _RB_LINK( elm, _RB_R, field ) +#define RB_ROOT( head ) ( head )->rbh_root +#define RB_EMPTY( head ) ( RB_ROOT( head ) == NULL ) -#define RB_SET_PARENT(dst, src, field) do { \ - _RB_BITSUP(dst, field) = (__uintptr_t)src | \ - (_RB_BITSUP(dst, field) & _RB_LR); \ -} while (/*CONSTCOND*/ 0) +#define RB_SET_PARENT( dst, src, field ) \ + do { \ + _RB_BITSUP( dst, field ) = (__uintptr_t) src | \ + ( _RB_BITSUP( dst, field ) & _RB_LR ); \ + } while ( /*CONSTCOND*/ 0 ) -#define RB_SET(elm, parent, field) do { \ - _RB_UP(elm, field) = parent; \ - RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ -} while (/*CONSTCOND*/ 0) +#define RB_SET( elm, parent, field ) \ + do { \ + _RB_UP( elm, field ) = parent; \ + RB_LEFT( elm, field ) = RB_RIGHT( elm, field ) = NULL; \ + } while ( /*CONSTCOND*/ 0 ) /* * Either RB_AUGMENT or RB_AUGMENT_CHECK is invoked in a loop at the root of @@ -364,27 +374,30 @@ struct { \ */ #ifndef RB_AUGMENT_CHECK #ifndef RB_AUGMENT -#define RB_AUGMENT_CHECK(x) 0 +#define RB_AUGMENT_CHECK( x ) 0 #else -#define RB_AUGMENT_CHECK(x) (RB_AUGMENT(x), 1) +#define RB_AUGMENT_CHECK( x ) ( RB_AUGMENT( x ), 1 ) #endif #endif -#define RB_UPDATE_AUGMENT(elm, field) do { \ - __typeof(elm) rb_update_tmp = (elm); \ - while (RB_AUGMENT_CHECK(rb_update_tmp) && \ - (rb_update_tmp = RB_PARENT(rb_update_tmp, field)) != NULL) \ - ; \ -} while (0) +#define RB_UPDATE_AUGMENT( elm, field ) \ + do { \ + __typeof( elm ) rb_update_tmp = ( elm ); \ + while ( \ + RB_AUGMENT_CHECK( rb_update_tmp ) && \ + ( rb_update_tmp = RB_PARENT( rb_update_tmp, field ) ) != NULL \ + ); \ + } while ( 0 ) -#define RB_SWAP_CHILD(head, par, out, in, field) do { \ - if (par == NULL) \ - RB_ROOT(head) = (in); \ - else if ((out) == RB_LEFT(par, field)) \ - RB_LEFT(par, field) = (in); \ - else \ - RB_RIGHT(par, field) = (in); \ -} while (/*CONSTCOND*/ 0) +#define RB_SWAP_CHILD( head, par, out, in, field ) \ + do { \ + if ( par == NULL ) \ + RB_ROOT( head ) = ( in ); \ + else if ( ( out ) == RB_LEFT( par, field ) ) \ + RB_LEFT( par, field ) = ( in ); \ + else \ + RB_RIGHT( par, field ) = ( in ); \ + } while ( /*CONSTCOND*/ 0 ) /* * RB_ROTATE macro partially restructures the tree to improve balance. In the @@ -396,137 +409,160 @@ struct { \ * caller of RB_ROTATE to clean up, so that a pair of rotations does not twice * update the same pair of pointer fields with distinct values. */ -#define RB_ROTATE(elm, tmp, dir, field) do { \ - if ((_RB_LINK(elm, dir ^ _RB_LR, field) = \ - _RB_LINK(tmp, dir, field)) != NULL) \ - RB_SET_PARENT(_RB_LINK(tmp, dir, field), elm, field); \ - _RB_LINK(tmp, dir, field) = (elm); \ - RB_SET_PARENT(elm, tmp, field); \ -} while (/*CONSTCOND*/ 0) +#define RB_ROTATE( elm, tmp, dir, field ) \ + do { \ + if ( \ + ( \ + _RB_LINK( elm, dir ^ _RB_LR, field ) = _RB_LINK( tmp, dir, field ) \ + ) != NULL \ + ) \ + RB_SET_PARENT( _RB_LINK( tmp, dir, field ), elm, field ); \ + _RB_LINK( tmp, dir, field ) = ( elm ); \ + RB_SET_PARENT( elm, tmp, field ); \ + } while ( /*CONSTCOND*/ 0 ) /* Generates prototypes and inline functions */ -#define RB_PROTOTYPE(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) -#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ - RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static) -#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ - RB_PROTOTYPE_RANK(name, type, attr) \ - RB_PROTOTYPE_INSERT_COLOR(name, type, attr); \ - RB_PROTOTYPE_REMOVE_COLOR(name, type, attr); \ - RB_PROTOTYPE_INSERT_FINISH(name, type, attr); \ - RB_PROTOTYPE_INSERT(name, type, attr); \ - RB_PROTOTYPE_REMOVE(name, type, attr); \ - RB_PROTOTYPE_FIND(name, type, attr); \ - RB_PROTOTYPE_NFIND(name, type, attr); \ - RB_PROTOTYPE_NEXT(name, type, attr); \ - RB_PROTOTYPE_INSERT_NEXT(name, type, attr); \ - RB_PROTOTYPE_PREV(name, type, attr); \ - RB_PROTOTYPE_INSERT_PREV(name, type, attr); \ - RB_PROTOTYPE_MINMAX(name, type, attr); \ - RB_PROTOTYPE_REINSERT(name, type, attr); +#define RB_PROTOTYPE( name, type, field, cmp ) \ + RB_PROTOTYPE_INTERNAL( name, type, field, cmp, ) +#define RB_PROTOTYPE_STATIC( name, type, field, cmp ) \ + RB_PROTOTYPE_INTERNAL( name, type, field, cmp, __unused static ) +#define RB_PROTOTYPE_INTERNAL( name, type, field, cmp, attr ) \ + RB_PROTOTYPE_RANK( name, type, attr ) \ + RB_PROTOTYPE_INSERT_COLOR( name, type, attr ); \ + RB_PROTOTYPE_REMOVE_COLOR( name, type, attr ); \ + RB_PROTOTYPE_INSERT_FINISH( name, type, attr ); \ + RB_PROTOTYPE_INSERT( name, type, attr ); \ + RB_PROTOTYPE_REMOVE( name, type, attr ); \ + RB_PROTOTYPE_FIND( name, type, attr ); \ + RB_PROTOTYPE_NFIND( name, type, attr ); \ + RB_PROTOTYPE_NEXT( name, type, attr ); \ + RB_PROTOTYPE_INSERT_NEXT( name, type, attr ); \ + RB_PROTOTYPE_PREV( name, type, attr ); \ + RB_PROTOTYPE_INSERT_PREV( name, type, attr ); \ + RB_PROTOTYPE_MINMAX( name, type, attr ); \ + RB_PROTOTYPE_REINSERT( name, type, attr ); #ifdef _RB_DIAGNOSTIC -#define RB_PROTOTYPE_RANK(name, type, attr) \ - attr int name##_RB_RANK(struct type *); +#define RB_PROTOTYPE_RANK( name, type, attr ) \ + attr int name##_RB_RANK( struct type * ); #else -#define RB_PROTOTYPE_RANK(name, type, attr) +#define RB_PROTOTYPE_RANK( name, type, attr ) #endif -#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr) \ - attr struct type *name##_RB_INSERT_COLOR(struct name *, \ - struct type *, struct type *) -#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \ - attr struct type *name##_RB_REMOVE_COLOR(struct name *, \ - struct type *, struct type *) -#define RB_PROTOTYPE_REMOVE(name, type, attr) \ - attr struct type *name##_RB_REMOVE(struct name *, struct type *) -#define RB_PROTOTYPE_INSERT_FINISH(name, type, attr) \ - attr struct type *name##_RB_INSERT_FINISH(struct name *, \ - struct type *, struct type **, struct type *) -#define RB_PROTOTYPE_INSERT(name, type, attr) \ - attr struct type *name##_RB_INSERT(struct name *, struct type *) -#define RB_PROTOTYPE_FIND(name, type, attr) \ - attr struct type *name##_RB_FIND(struct name *, struct type *) -#define RB_PROTOTYPE_NFIND(name, type, attr) \ - attr struct type *name##_RB_NFIND(struct name *, struct type *) -#define RB_PROTOTYPE_NEXT(name, type, attr) \ - attr struct type *name##_RB_NEXT(struct type *) -#define RB_PROTOTYPE_INSERT_NEXT(name, type, attr) \ - attr struct type *name##_RB_INSERT_NEXT(struct name *, \ - struct type *, struct type *) -#define RB_PROTOTYPE_PREV(name, type, attr) \ - attr struct type *name##_RB_PREV(struct type *) -#define RB_PROTOTYPE_INSERT_PREV(name, type, attr) \ - attr struct type *name##_RB_INSERT_PREV(struct name *, \ - struct type *, struct type *) -#define RB_PROTOTYPE_MINMAX(name, type, attr) \ - attr struct type *name##_RB_MINMAX(struct name *, int) -#define RB_PROTOTYPE_REINSERT(name, type, attr) \ - attr struct type *name##_RB_REINSERT(struct name *, struct type *) +#define RB_PROTOTYPE_INSERT_COLOR( name, type, attr ) \ + attr struct type *name##_RB_INSERT_COLOR( \ + struct name *, \ + struct type *, \ + struct type * \ + ) +#define RB_PROTOTYPE_REMOVE_COLOR( name, type, attr ) \ + attr struct type *name##_RB_REMOVE_COLOR( \ + struct name *, \ + struct type *, \ + struct type * \ + ) +#define RB_PROTOTYPE_REMOVE( name, type, attr ) \ + attr struct type *name##_RB_REMOVE( struct name *, struct type * ) +#define RB_PROTOTYPE_INSERT_FINISH( name, type, attr ) \ + attr struct type *name##_RB_INSERT_FINISH( \ + struct name *, \ + struct type *, \ + struct type **, \ + struct type * \ + ) +#define RB_PROTOTYPE_INSERT( name, type, attr ) \ + attr struct type *name##_RB_INSERT( struct name *, struct type * ) +#define RB_PROTOTYPE_FIND( name, type, attr ) \ + attr struct type *name##_RB_FIND( struct name *, struct type * ) +#define RB_PROTOTYPE_NFIND( name, type, attr ) \ + attr struct type *name##_RB_NFIND( struct name *, struct type * ) +#define RB_PROTOTYPE_NEXT( name, type, attr ) \ + attr struct type *name##_RB_NEXT( struct type * ) +#define RB_PROTOTYPE_INSERT_NEXT( name, type, attr ) \ + attr struct type *name##_RB_INSERT_NEXT( \ + struct name *, \ + struct type *, \ + struct type * \ + ) +#define RB_PROTOTYPE_PREV( name, type, attr ) \ + attr struct type *name##_RB_PREV( struct type * ) +#define RB_PROTOTYPE_INSERT_PREV( name, type, attr ) \ + attr struct type *name##_RB_INSERT_PREV( \ + struct name *, \ + struct type *, \ + struct type * \ + ) +#define RB_PROTOTYPE_MINMAX( name, type, attr ) \ + attr struct type *name##_RB_MINMAX( struct name *, int ) +#define RB_PROTOTYPE_REINSERT( name, type, attr ) \ + attr struct type *name##_RB_REINSERT( struct name *, struct type * ) /* Main rb operation. * Moves node close to the key of elm to top */ -#define RB_GENERATE(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp,) -#define RB_GENERATE_STATIC(name, type, field, cmp) \ - RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static) -#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ - RB_GENERATE_RANK(name, type, field, attr) \ - RB_GENERATE_INSERT_COLOR(name, type, field, attr) \ - RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ - RB_GENERATE_INSERT_FINISH(name, type, field, attr) \ - RB_GENERATE_INSERT(name, type, field, cmp, attr) \ - RB_GENERATE_REMOVE(name, type, field, attr) \ - RB_GENERATE_FIND(name, type, field, cmp, attr) \ - RB_GENERATE_NFIND(name, type, field, cmp, attr) \ - RB_GENERATE_NEXT(name, type, field, attr) \ - RB_GENERATE_INSERT_NEXT(name, type, field, cmp, attr) \ - RB_GENERATE_PREV(name, type, field, attr) \ - RB_GENERATE_INSERT_PREV(name, type, field, cmp, attr) \ - RB_GENERATE_MINMAX(name, type, field, attr) \ - RB_GENERATE_REINSERT(name, type, field, cmp, attr) +#define RB_GENERATE( name, type, field, cmp ) \ + RB_GENERATE_INTERNAL( name, type, field, cmp, ) +#define RB_GENERATE_STATIC( name, type, field, cmp ) \ + RB_GENERATE_INTERNAL( name, type, field, cmp, __unused static ) +#define RB_GENERATE_INTERNAL( name, type, field, cmp, attr ) \ + RB_GENERATE_RANK( name, type, field, attr ) \ + RB_GENERATE_INSERT_COLOR( name, type, field, attr ) \ + RB_GENERATE_REMOVE_COLOR( name, type, field, attr ) \ + RB_GENERATE_INSERT_FINISH( name, type, field, attr ) \ + RB_GENERATE_INSERT( name, type, field, cmp, attr ) \ + RB_GENERATE_REMOVE( name, type, field, attr ) \ + RB_GENERATE_FIND( name, type, field, cmp, attr ) \ + RB_GENERATE_NFIND( name, type, field, cmp, attr ) \ + RB_GENERATE_NEXT( name, type, field, attr ) \ + RB_GENERATE_INSERT_NEXT( name, type, field, cmp, attr ) \ + RB_GENERATE_PREV( name, type, field, attr ) \ + RB_GENERATE_INSERT_PREV( name, type, field, cmp, attr ) \ + RB_GENERATE_MINMAX( name, type, field, attr ) \ + RB_GENERATE_REINSERT( name, type, field, cmp, attr ) #ifdef _RB_DIAGNOSTIC #ifndef RB_AUGMENT -#define _RB_AUGMENT_VERIFY(x) RB_AUGMENT_CHECK(x) +#define _RB_AUGMENT_VERIFY( x ) RB_AUGMENT_CHECK( x ) #else -#define _RB_AUGMENT_VERIFY(x) 0 +#define _RB_AUGMENT_VERIFY( x ) 0 #endif -#define RB_GENERATE_RANK(name, type, field, attr) \ -/* \ +#define RB_GENERATE_RANK( name, type, field, attr ) \ + /* \ * Return the rank of the subtree rooted at elm, or -1 if the subtree \ * is not rank-balanced, or has inconsistent augmentation data. - */ \ -attr int \ -name##_RB_RANK(struct type *elm) \ -{ \ - struct type *left, *right, *up; \ - int left_rank, right_rank; \ - \ - if (elm == NULL) \ - return (0); \ - up = _RB_UP(elm, field); \ - left = RB_LEFT(elm, field); \ - left_rank = ((_RB_BITS(up) & _RB_L) ? 2 : 1) + \ - name##_RB_RANK(left); \ - right = RB_RIGHT(elm, field); \ - right_rank = ((_RB_BITS(up) & _RB_R) ? 2 : 1) + \ - name##_RB_RANK(right); \ - if (left_rank != right_rank || \ - (left_rank == 2 && left == NULL && right == NULL) || \ - _RB_AUGMENT_VERIFY(elm)) \ - return (-1); \ - return (left_rank); \ -} + */ \ + attr int name##_RB_RANK( struct type *elm ) \ + { \ + struct type *left, *right, *up; \ + int left_rank, right_rank; \ + \ + if ( elm == NULL ) \ + return ( 0 ); \ + up = _RB_UP( elm, field ); \ + left = RB_LEFT( elm, field ); \ + left_rank = ( ( _RB_BITS( up ) & _RB_L ) ? 2 : 1 ) + \ + name##_RB_RANK( left ); \ + right = RB_RIGHT( elm, field ); \ + right_rank = ( ( _RB_BITS( up ) & _RB_R ) ? 2 : 1 ) + \ + name##_RB_RANK( right ); \ + if ( \ + left_rank != right_rank || \ + ( left_rank == 2 && left == NULL && right == NULL ) || \ + _RB_AUGMENT_VERIFY( elm ) \ + ) \ + return ( -1 ); \ + return ( left_rank ); \ + } #else -#define RB_GENERATE_RANK(name, type, field, attr) +#define RB_GENERATE_RANK( name, type, field, attr ) #endif -#define RB_GENERATE_INSERT_COLOR(name, type, field, attr) \ -attr struct type * \ -name##_RB_INSERT_COLOR(struct name *head, \ - struct type *parent, struct type *elm) \ -{ \ - /* \ +#define RB_GENERATE_INSERT_COLOR( name, type, field, attr ) \ + attr struct type *name##_RB_INSERT_COLOR( \ + struct name *head, \ + struct type *parent, \ + struct type *elm \ + ) \ + { \ + /* \ * Initially, elm is a leaf. Either its parent was previously \ * a leaf, with two black null children, or an interior node \ * with a black non-null child and a red null child. The \ @@ -536,31 +572,31 @@ name##_RB_INSERT_COLOR(struct name *head, \ * uninitialized 'child', and a later iteration can only happen \ * when a value has been assigned to 'child' in the previous \ * one. \ - */ \ - struct type *child, *child_up, *gpar; \ - __uintptr_t elmdir, sibdir; \ - \ - do { \ - /* the rank of the tree rooted at elm grew */ \ - gpar = _RB_UP(parent, field); \ - elmdir = RB_RIGHT(parent, field) == elm ? _RB_R : _RB_L; \ - if (_RB_BITS(gpar) & elmdir) { \ - /* shorten the parent-elm edge to rebalance */ \ - _RB_BITSUP(parent, field) ^= elmdir; \ - return (NULL); \ - } \ - sibdir = elmdir ^ _RB_LR; \ - /* the other edge must change length */ \ - _RB_BITSUP(parent, field) ^= sibdir; \ - if ((_RB_BITS(gpar) & _RB_LR) == 0) { \ - /* both edges now short, retry from parent */ \ - child = elm; \ - elm = parent; \ - continue; \ - } \ - _RB_UP(parent, field) = gpar = _RB_PTR(gpar); \ - if (_RB_BITSUP(elm, field) & elmdir) { \ - /* \ + */ \ + struct type *child, *child_up, *gpar; \ + __uintptr_t elmdir, sibdir; \ + \ + do { \ + /* the rank of the tree rooted at elm grew */ \ + gpar = _RB_UP( parent, field ); \ + elmdir = RB_RIGHT( parent, field ) == elm ? _RB_R : _RB_L; \ + if ( _RB_BITS( gpar ) & elmdir ) { \ + /* shorten the parent-elm edge to rebalance */ \ + _RB_BITSUP( parent, field ) ^= elmdir; \ + return ( NULL ); \ + } \ + sibdir = elmdir ^ _RB_LR; \ + /* the other edge must change length */ \ + _RB_BITSUP( parent, field ) ^= sibdir; \ + if ( ( _RB_BITS( gpar ) & _RB_LR ) == 0 ) { \ + /* both edges now short, retry from parent */ \ + child = elm; \ + elm = parent; \ + continue; \ + } \ + _RB_UP( parent, field ) = gpar = _RB_PTR( gpar ); \ + if ( _RB_BITSUP( elm, field ) & elmdir ) { \ + /* \ * Exactly one of the edges descending from elm \ * is long. The long one is in the same \ * direction as the edge from parent to elm, \ @@ -579,23 +615,23 @@ name##_RB_INSERT_COLOR(struct name *head, \ * w / \ / \ y \ * x y w \ \ * x \ - */ \ - RB_ROTATE(elm, child, elmdir, field); \ - child_up = _RB_UP(child, field); \ - if (_RB_BITS(child_up) & sibdir) \ - _RB_BITSUP(parent, field) ^= elmdir; \ - if (_RB_BITS(child_up) & elmdir) \ - _RB_BITSUP(elm, field) ^= _RB_LR; \ - else \ - _RB_BITSUP(elm, field) ^= elmdir; \ - /* if child is a leaf, don't augment elm, \ - * since it is restored to be a leaf again. */ \ - if ((_RB_BITS(child_up) & _RB_LR) == 0) \ - elm = child; \ - } else \ - child = elm; \ - \ - /* \ + */ \ + RB_ROTATE( elm, child, elmdir, field ); \ + child_up = _RB_UP( child, field ); \ + if ( _RB_BITS( child_up ) & sibdir ) \ + _RB_BITSUP( parent, field ) ^= elmdir; \ + if ( _RB_BITS( child_up ) & elmdir ) \ + _RB_BITSUP( elm, field ) ^= _RB_LR; \ + else \ + _RB_BITSUP( elm, field ) ^= elmdir; \ + /* if child is a leaf, don't augment elm, \ + * since it is restored to be a leaf again. */ \ + if ( ( _RB_BITS( child_up ) & _RB_LR ) == 0 ) \ + elm = child; \ + } else \ + child = elm; \ + \ + /* \ * The long edge descending from 'child' points back \ * in the direction of 'parent'. Rotate to make \ * 'parent' a child of 'child', then make both edges \ @@ -608,21 +644,21 @@ name##_RB_INSERT_COLOR(struct name *head, \ * / \ / z \ * x \ y \ * y \ - */ \ - RB_ROTATE(parent, child, sibdir, field); \ - _RB_UP(child, field) = gpar; \ - RB_SWAP_CHILD(head, gpar, parent, child, field); \ - /* \ + */ \ + RB_ROTATE( parent, child, sibdir, field ); \ + _RB_UP( child, field ) = gpar; \ + RB_SWAP_CHILD( head, gpar, parent, child, field ); \ + /* \ * Elements rotated down have new, smaller subtrees, \ * so update augmentation for them. \ - */ \ - if (elm != child) \ - (void)RB_AUGMENT_CHECK(elm); \ - (void)RB_AUGMENT_CHECK(parent); \ - return (child); \ - } while ((parent = gpar) != NULL); \ - return (NULL); \ -} + */ \ + if ( elm != child ) \ + (void) RB_AUGMENT_CHECK( elm ); \ + (void) RB_AUGMENT_CHECK( parent ); \ + return ( child ); \ + } while ( ( parent = gpar ) != NULL ); \ + return ( NULL ); \ + } #ifndef RB_STRICT_HST /* @@ -635,51 +671,54 @@ name##_RB_INSERT_COLOR(struct name *head, \ #define RB_STRICT_HST 0 #endif -#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ -attr struct type * \ -name##_RB_REMOVE_COLOR(struct name *head, \ - struct type *parent, struct type *elm) \ -{ \ - struct type *gpar, *sib, *up; \ - __uintptr_t elmdir, sibdir; \ - \ - if (RB_RIGHT(parent, field) == elm && \ - RB_LEFT(parent, field) == elm) { \ - /* Deleting a leaf that is an only-child creates a \ - * rank-2 leaf. Demote that leaf. */ \ - _RB_UP(parent, field) = _RB_PTR(_RB_UP(parent, field)); \ - elm = parent; \ - if ((parent = _RB_UP(elm, field)) == NULL) \ - return (NULL); \ - } \ - do { \ - /* the rank of the tree rooted at elm shrank */ \ - gpar = _RB_UP(parent, field); \ - elmdir = RB_RIGHT(parent, field) == elm ? _RB_R : _RB_L; \ - _RB_BITS(gpar) ^= elmdir; \ - if (_RB_BITS(gpar) & elmdir) { \ - /* lengthen the parent-elm edge to rebalance */ \ - _RB_UP(parent, field) = gpar; \ - return (NULL); \ - } \ - if (_RB_BITS(gpar) & _RB_LR) { \ - /* shorten other edge, retry from parent */ \ - _RB_BITS(gpar) ^= _RB_LR; \ - _RB_UP(parent, field) = gpar; \ - gpar = _RB_PTR(gpar); \ - continue; \ - } \ - sibdir = elmdir ^ _RB_LR; \ - sib = _RB_LINK(parent, sibdir, field); \ - up = _RB_UP(sib, field); \ - _RB_BITS(up) ^= _RB_LR; \ - if ((_RB_BITS(up) & _RB_LR) == 0) { \ - /* shorten edges descending from sib, retry */ \ - _RB_UP(sib, field) = up; \ - continue; \ - } \ - if ((_RB_BITS(up) & sibdir) == 0) { \ - /* \ +#define RB_GENERATE_REMOVE_COLOR( name, type, field, attr ) \ + attr struct type *name##_RB_REMOVE_COLOR( \ + struct name *head, \ + struct type *parent, \ + struct type *elm \ + ) \ + { \ + struct type *gpar, *sib, *up; \ + __uintptr_t elmdir, sibdir; \ + \ + if ( \ + RB_RIGHT( parent, field ) == elm && RB_LEFT( parent, field ) == elm \ + ) { \ + /* Deleting a leaf that is an only-child creates a \ + * rank-2 leaf. Demote that leaf. */ \ + _RB_UP( parent, field ) = _RB_PTR( _RB_UP( parent, field ) ); \ + elm = parent; \ + if ( ( parent = _RB_UP( elm, field ) ) == NULL ) \ + return ( NULL ); \ + } \ + do { \ + /* the rank of the tree rooted at elm shrank */ \ + gpar = _RB_UP( parent, field ); \ + elmdir = RB_RIGHT( parent, field ) == elm ? _RB_R : _RB_L; \ + _RB_BITS( gpar ) ^= elmdir; \ + if ( _RB_BITS( gpar ) & elmdir ) { \ + /* lengthen the parent-elm edge to rebalance */ \ + _RB_UP( parent, field ) = gpar; \ + return ( NULL ); \ + } \ + if ( _RB_BITS( gpar ) & _RB_LR ) { \ + /* shorten other edge, retry from parent */ \ + _RB_BITS( gpar ) ^= _RB_LR; \ + _RB_UP( parent, field ) = gpar; \ + gpar = _RB_PTR( gpar ); \ + continue; \ + } \ + sibdir = elmdir ^ _RB_LR; \ + sib = _RB_LINK( parent, sibdir, field ); \ + up = _RB_UP( sib, field ); \ + _RB_BITS( up ) ^= _RB_LR; \ + if ( ( _RB_BITS( up ) & _RB_LR ) == 0 ) { \ + /* shorten edges descending from sib, retry */ \ + _RB_UP( sib, field ) = up; \ + continue; \ + } \ + if ( ( _RB_BITS( up ) & sibdir ) == 0 ) { \ + /* \ * The edge descending from 'sib' away from \ * 'parent' is long. The short edge descending \ * from 'sib' toward 'parent' points to 'elm*' \ @@ -698,33 +737,34 @@ name##_RB_REMOVE_COLOR(struct name *head, \ * / \ \ * / z \ * y \ - */ \ - elm = _RB_LINK(sib, elmdir, field); \ - /* elm is a 1-child. First rotate at elm. */ \ - RB_ROTATE(sib, elm, sibdir, field); \ - up = _RB_UP(elm, field); \ - _RB_BITSUP(parent, field) ^= \ - (_RB_BITS(up) & elmdir) ? _RB_LR : elmdir; \ - _RB_BITSUP(sib, field) ^= \ - (_RB_BITS(up) & sibdir) ? _RB_LR : sibdir; \ - _RB_BITSUP(elm, field) |= _RB_LR; \ - } else { \ - if ((_RB_BITS(up) & elmdir) == 0 && \ - RB_STRICT_HST && elm != NULL) { \ - /* if parent does not become a leaf, \ - do not demote parent yet. */ \ - _RB_BITSUP(parent, field) ^= sibdir; \ - _RB_BITSUP(sib, field) ^= _RB_LR; \ - } else if ((_RB_BITS(up) & elmdir) == 0) { \ - /* demote parent. */ \ - _RB_BITSUP(parent, field) ^= elmdir; \ - _RB_BITSUP(sib, field) ^= sibdir; \ - } else \ - _RB_BITSUP(sib, field) ^= sibdir; \ - elm = sib; \ - } \ - \ - /* \ + */ \ + elm = _RB_LINK( sib, elmdir, field ); \ + /* elm is a 1-child. First rotate at elm. */ \ + RB_ROTATE( sib, elm, sibdir, field ); \ + up = _RB_UP( elm, field ); \ + _RB_BITSUP( parent, field ) ^= ( _RB_BITS( up ) & elmdir ) ? _RB_LR \ + : elmdir; \ + _RB_BITSUP( sib, field ) ^= ( _RB_BITS( up ) & sibdir ) ? _RB_LR \ + : sibdir; \ + _RB_BITSUP( elm, field ) |= _RB_LR; \ + } else { \ + if ( \ + ( _RB_BITS( up ) & elmdir ) == 0 && RB_STRICT_HST && elm != NULL \ + ) { \ + /* if parent does not become a leaf, \ + do not demote parent yet. */ \ + _RB_BITSUP( parent, field ) ^= sibdir; \ + _RB_BITSUP( sib, field ) ^= _RB_LR; \ + } else if ( ( _RB_BITS( up ) & elmdir ) == 0 ) { \ + /* demote parent. */ \ + _RB_BITSUP( parent, field ) ^= elmdir; \ + _RB_BITSUP( sib, field ) ^= sibdir; \ + } else \ + _RB_BITSUP( sib, field ) ^= sibdir; \ + elm = sib; \ + } \ + \ + /* \ * The edge descending from 'elm' away from 'parent' \ * is short. Rotate to make 'parent' a child of 'elm', \ * then lengthen the short edges descending from \ @@ -738,325 +778,338 @@ name##_RB_REMOVE_COLOR(struct name *head, \ * / \ / \ \ * / \ e \ \ * x s x \ - */ \ - RB_ROTATE(parent, elm, elmdir, field); \ - RB_SET_PARENT(elm, gpar, field); \ - RB_SWAP_CHILD(head, gpar, parent, elm, field); \ - /* \ + */ \ + RB_ROTATE( parent, elm, elmdir, field ); \ + RB_SET_PARENT( elm, gpar, field ); \ + RB_SWAP_CHILD( head, gpar, parent, elm, field ); \ + /* \ * An element rotated down, but not into the search \ * path has a new, smaller subtree, so update \ * augmentation for it. \ - */ \ - if (sib != elm) \ - (void)RB_AUGMENT_CHECK(sib); \ - return (parent); \ - } while (elm = parent, (parent = gpar) != NULL); \ - return (NULL); \ -} + */ \ + if ( sib != elm ) \ + (void) RB_AUGMENT_CHECK( sib ); \ + return ( parent ); \ + } while ( elm = parent, ( parent = gpar ) != NULL ); \ + return ( NULL ); \ + } -#define _RB_AUGMENT_WALK(elm, match, field) \ -do { \ - if (match == elm) \ - match = NULL; \ -} while (RB_AUGMENT_CHECK(elm) && \ - (elm = RB_PARENT(elm, field)) != NULL) +#define _RB_AUGMENT_WALK( elm, match, field ) \ + do { \ + if ( match == elm ) \ + match = NULL; \ + } while ( \ + RB_AUGMENT_CHECK( elm ) && ( elm = RB_PARENT( elm, field ) ) != NULL \ + ) -#define RB_GENERATE_REMOVE(name, type, field, attr) \ -attr struct type * \ -name##_RB_REMOVE(struct name *head, struct type *out) \ -{ \ - struct type *child, *in, *opar, *parent; \ - \ - child = RB_LEFT(out, field); \ - in = RB_RIGHT(out, field); \ - opar = _RB_UP(out, field); \ - if (in == NULL || child == NULL) { \ - in = child = (in == NULL ? child : in); \ - parent = opar = _RB_PTR(opar); \ - } else { \ - parent = in; \ - while (RB_LEFT(in, field)) \ - in = RB_LEFT(in, field); \ - RB_SET_PARENT(child, in, field); \ - RB_LEFT(in, field) = child; \ - child = RB_RIGHT(in, field); \ - if (parent != in) { \ - RB_SET_PARENT(parent, in, field); \ - RB_RIGHT(in, field) = parent; \ - parent = RB_PARENT(in, field); \ - RB_LEFT(parent, field) = child; \ - } \ - _RB_UP(in, field) = opar; \ - opar = _RB_PTR(opar); \ - } \ - RB_SWAP_CHILD(head, opar, out, in, field); \ - if (child != NULL) \ - _RB_UP(child, field) = parent; \ - if (parent != NULL) { \ - opar = name##_RB_REMOVE_COLOR(head, parent, child); \ - /* if rotation has made 'parent' the root of the same \ - * subtree as before, don't re-augment it. */ \ - if (parent == in && RB_LEFT(parent, field) == NULL) { \ - opar = NULL; \ - parent = RB_PARENT(parent, field); \ - } \ - _RB_AUGMENT_WALK(parent, opar, field); \ - if (opar != NULL) { \ - /* \ +#define RB_GENERATE_REMOVE( name, type, field, attr ) \ + attr struct type *name##_RB_REMOVE( struct name *head, struct type *out ) \ + { \ + struct type *child, *in, *opar, *parent; \ + \ + child = RB_LEFT( out, field ); \ + in = RB_RIGHT( out, field ); \ + opar = _RB_UP( out, field ); \ + if ( in == NULL || child == NULL ) { \ + in = child = ( in == NULL ? child : in ); \ + parent = opar = _RB_PTR( opar ); \ + } else { \ + parent = in; \ + while ( RB_LEFT( in, field ) ) in = RB_LEFT( in, field ); \ + RB_SET_PARENT( child, in, field ); \ + RB_LEFT( in, field ) = child; \ + child = RB_RIGHT( in, field ); \ + if ( parent != in ) { \ + RB_SET_PARENT( parent, in, field ); \ + RB_RIGHT( in, field ) = parent; \ + parent = RB_PARENT( in, field ); \ + RB_LEFT( parent, field ) = child; \ + } \ + _RB_UP( in, field ) = opar; \ + opar = _RB_PTR( opar ); \ + } \ + RB_SWAP_CHILD( head, opar, out, in, field ); \ + if ( child != NULL ) \ + _RB_UP( child, field ) = parent; \ + if ( parent != NULL ) { \ + opar = name##_RB_REMOVE_COLOR( head, parent, child ); \ + /* if rotation has made 'parent' the root of the same \ + * subtree as before, don't re-augment it. */ \ + if ( parent == in && RB_LEFT( parent, field ) == NULL ) { \ + opar = NULL; \ + parent = RB_PARENT( parent, field ); \ + } \ + _RB_AUGMENT_WALK( parent, opar, field ); \ + if ( opar != NULL ) { \ + /* \ * Elements rotated into the search path have \ * changed subtrees, so update augmentation for \ * them if AUGMENT_WALK didn't. \ - */ \ - (void)RB_AUGMENT_CHECK(opar); \ - (void)RB_AUGMENT_CHECK(RB_PARENT(opar, field)); \ - } \ - } \ - return (out); \ -} + */ \ + (void) RB_AUGMENT_CHECK( opar ); \ + (void) RB_AUGMENT_CHECK( RB_PARENT( opar, field ) ); \ + } \ + } \ + return ( out ); \ + } -#define RB_GENERATE_INSERT_FINISH(name, type, field, attr) \ -/* Inserts a node into the RB tree */ \ -attr struct type * \ -name##_RB_INSERT_FINISH(struct name *head, struct type *parent, \ - struct type **pptr, struct type *elm) \ -{ \ - struct type *tmp = NULL; \ - \ - RB_SET(elm, parent, field); \ - *pptr = elm; \ - if (parent != NULL) \ - tmp = name##_RB_INSERT_COLOR(head, parent, elm); \ - _RB_AUGMENT_WALK(elm, tmp, field); \ - if (tmp != NULL) \ - /* \ +#define RB_GENERATE_INSERT_FINISH( name, type, field, attr ) \ + /* Inserts a node into the RB tree */ \ + attr struct type *name##_RB_INSERT_FINISH( \ + struct name *head, \ + struct type *parent, \ + struct type **pptr, \ + struct type *elm \ + ) \ + { \ + struct type *tmp = NULL; \ + \ + RB_SET( elm, parent, field ); \ + *pptr = elm; \ + if ( parent != NULL ) \ + tmp = name##_RB_INSERT_COLOR( head, parent, elm ); \ + _RB_AUGMENT_WALK( elm, tmp, field ); \ + if ( tmp != NULL ) \ + /* \ * An element rotated into the search path has a \ * changed subtree, so update augmentation for it if \ * AUGMENT_WALK didn't. \ - */ \ - (void)RB_AUGMENT_CHECK(tmp); \ - return (NULL); \ -} + */ \ + (void) RB_AUGMENT_CHECK( tmp ); \ + return ( NULL ); \ + } -#define RB_GENERATE_INSERT(name, type, field, cmp, attr) \ -/* Inserts a node into the RB tree */ \ -attr struct type * \ -name##_RB_INSERT(struct name *head, struct type *elm) \ -{ \ - struct type *tmp; \ - struct type **tmpp = &RB_ROOT(head); \ - struct type *parent = NULL; \ - \ - while ((tmp = *tmpp) != NULL) { \ - parent = tmp; \ - __typeof(cmp(NULL, NULL)) comp = (cmp)(elm, parent); \ - if (comp < 0) \ - tmpp = &RB_LEFT(parent, field); \ - else if (comp > 0) \ - tmpp = &RB_RIGHT(parent, field); \ - else \ - return (parent); \ - } \ - return (name##_RB_INSERT_FINISH(head, parent, tmpp, elm)); \ -} +#define RB_GENERATE_INSERT( name, type, field, cmp, attr ) \ + /* Inserts a node into the RB tree */ \ + attr struct type *name##_RB_INSERT( struct name *head, struct type *elm ) \ + { \ + struct type *tmp; \ + struct type **tmpp = &RB_ROOT( head ); \ + struct type *parent = NULL; \ + \ + while ( ( tmp = *tmpp ) != NULL ) { \ + parent = tmp; \ + __typeof( cmp( NULL, NULL ) ) comp = (cmp) ( elm, parent ); \ + if ( comp < 0 ) \ + tmpp = &RB_LEFT( parent, field ); \ + else if ( comp > 0 ) \ + tmpp = &RB_RIGHT( parent, field ); \ + else \ + return ( parent ); \ + } \ + return ( name##_RB_INSERT_FINISH( head, parent, tmpp, elm ) ); \ + } -#define RB_GENERATE_FIND(name, type, field, cmp, attr) \ -/* Finds the node with the same key as elm */ \ -attr struct type * \ -name##_RB_FIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - __typeof(cmp(NULL, NULL)) comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) \ - tmp = RB_LEFT(tmp, field); \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (NULL); \ -} +#define RB_GENERATE_FIND( name, type, field, cmp, attr ) \ + /* Finds the node with the same key as elm */ \ + attr struct type *name##_RB_FIND( struct name *head, struct type *elm ) \ + { \ + struct type *tmp = RB_ROOT( head ); \ + __typeof( cmp( NULL, NULL ) ) comp; \ + while ( tmp ) { \ + comp = cmp( elm, tmp ); \ + if ( comp < 0 ) \ + tmp = RB_LEFT( tmp, field ); \ + else if ( comp > 0 ) \ + tmp = RB_RIGHT( tmp, field ); \ + else \ + return ( tmp ); \ + } \ + return ( NULL ); \ + } -#define RB_GENERATE_NFIND(name, type, field, cmp, attr) \ -/* Finds the first node greater than or equal to the search key */ \ -attr struct type * \ -name##_RB_NFIND(struct name *head, struct type *elm) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *res = NULL; \ - __typeof(cmp(NULL, NULL)) comp; \ - while (tmp) { \ - comp = cmp(elm, tmp); \ - if (comp < 0) { \ - res = tmp; \ - tmp = RB_LEFT(tmp, field); \ - } \ - else if (comp > 0) \ - tmp = RB_RIGHT(tmp, field); \ - else \ - return (tmp); \ - } \ - return (res); \ -} +#define RB_GENERATE_NFIND( name, type, field, cmp, attr ) \ + /* Finds the first node greater than or equal to the search key */ \ + attr struct type *name##_RB_NFIND( struct name *head, struct type *elm ) \ + { \ + struct type *tmp = RB_ROOT( head ); \ + struct type *res = NULL; \ + __typeof( cmp( NULL, NULL ) ) comp; \ + while ( tmp ) { \ + comp = cmp( elm, tmp ); \ + if ( comp < 0 ) { \ + res = tmp; \ + tmp = RB_LEFT( tmp, field ); \ + } else if ( comp > 0 ) \ + tmp = RB_RIGHT( tmp, field ); \ + else \ + return ( tmp ); \ + } \ + return ( res ); \ + } -#define RB_GENERATE_NEXT(name, type, field, attr) \ -/* ARGSUSED */ \ -attr struct type * \ -name##_RB_NEXT(struct type *elm) \ -{ \ - if (RB_RIGHT(elm, field)) { \ - elm = RB_RIGHT(elm, field); \ - while (RB_LEFT(elm, field)) \ - elm = RB_LEFT(elm, field); \ - } else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - return (elm); \ -} +#define RB_GENERATE_NEXT( name, type, field, attr ) \ + /* ARGSUSED */ \ + attr struct type *name##_RB_NEXT( struct type *elm ) \ + { \ + if ( RB_RIGHT( elm, field ) ) { \ + elm = RB_RIGHT( elm, field ); \ + while ( RB_LEFT( elm, field ) ) elm = RB_LEFT( elm, field ); \ + } else { \ + while ( \ + RB_PARENT( elm, field ) && \ + ( elm == RB_RIGHT( RB_PARENT( elm, field ), field ) ) \ + ) \ + elm = RB_PARENT( elm, field ); \ + elm = RB_PARENT( elm, field ); \ + } \ + return ( elm ); \ + } -#if defined(_KERNEL) && defined(DIAGNOSTIC) -#define _RB_ORDER_CHECK(cmp, lo, hi) do { \ - KASSERT((cmp)(lo, hi) < 0, ("out of order insertion")); \ -} while (0) +#if defined( _KERNEL ) && defined( DIAGNOSTIC ) +#define _RB_ORDER_CHECK( cmp, lo, hi ) \ + do { \ + KASSERT( (cmp) ( lo, hi ) < 0, ( "out of order insertion" ) ); \ + } while ( 0 ) #else -#define _RB_ORDER_CHECK(cmp, lo, hi) do {} while (0) +#define _RB_ORDER_CHECK( cmp, lo, hi ) \ + do { \ + } while ( 0 ) #endif -#define RB_GENERATE_INSERT_NEXT(name, type, field, cmp, attr) \ -/* Inserts a node into the next position in the RB tree */ \ -attr struct type * \ -name##_RB_INSERT_NEXT(struct name *head, \ - struct type *elm, struct type *next) \ -{ \ - struct type *tmp; \ - struct type **tmpp = &RB_RIGHT(elm, field); \ - \ - _RB_ORDER_CHECK(cmp, elm, next); \ - if (name##_RB_NEXT(elm) != NULL) \ - _RB_ORDER_CHECK(cmp, next, name##_RB_NEXT(elm)); \ - while ((tmp = *tmpp) != NULL) { \ - elm = tmp; \ - tmpp = &RB_LEFT(elm, field); \ - } \ - return (name##_RB_INSERT_FINISH(head, elm, tmpp, next)); \ -} +#define RB_GENERATE_INSERT_NEXT( name, type, field, cmp, attr ) \ + /* Inserts a node into the next position in the RB tree */ \ + attr struct type *name##_RB_INSERT_NEXT( \ + struct name *head, \ + struct type *elm, \ + struct type *next \ + ) \ + { \ + struct type *tmp; \ + struct type **tmpp = &RB_RIGHT( elm, field ); \ + \ + _RB_ORDER_CHECK( cmp, elm, next ); \ + if ( name##_RB_NEXT( elm ) != NULL ) \ + _RB_ORDER_CHECK( cmp, next, name##_RB_NEXT( elm ) ); \ + while ( ( tmp = *tmpp ) != NULL ) { \ + elm = tmp; \ + tmpp = &RB_LEFT( elm, field ); \ + } \ + return ( name##_RB_INSERT_FINISH( head, elm, tmpp, next ) ); \ + } -#define RB_GENERATE_PREV(name, type, field, attr) \ -/* ARGSUSED */ \ -attr struct type * \ -name##_RB_PREV(struct type *elm) \ -{ \ - if (RB_LEFT(elm, field)) { \ - elm = RB_LEFT(elm, field); \ - while (RB_RIGHT(elm, field)) \ - elm = RB_RIGHT(elm, field); \ - } else { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - elm = RB_PARENT(elm, field); \ - elm = RB_PARENT(elm, field); \ - } \ - return (elm); \ -} +#define RB_GENERATE_PREV( name, type, field, attr ) \ + /* ARGSUSED */ \ + attr struct type *name##_RB_PREV( struct type *elm ) \ + { \ + if ( RB_LEFT( elm, field ) ) { \ + elm = RB_LEFT( elm, field ); \ + while ( RB_RIGHT( elm, field ) ) elm = RB_RIGHT( elm, field ); \ + } else { \ + while ( \ + RB_PARENT( elm, field ) && \ + ( elm == RB_LEFT( RB_PARENT( elm, field ), field ) ) \ + ) \ + elm = RB_PARENT( elm, field ); \ + elm = RB_PARENT( elm, field ); \ + } \ + return ( elm ); \ + } -#define RB_GENERATE_INSERT_PREV(name, type, field, cmp, attr) \ -/* Inserts a node into the prev position in the RB tree */ \ -attr struct type * \ -name##_RB_INSERT_PREV(struct name *head, \ - struct type *elm, struct type *prev) \ -{ \ - struct type *tmp; \ - struct type **tmpp = &RB_LEFT(elm, field); \ - \ - _RB_ORDER_CHECK(cmp, prev, elm); \ - if (name##_RB_PREV(elm) != NULL) \ - _RB_ORDER_CHECK(cmp, name##_RB_PREV(elm), prev); \ - while ((tmp = *tmpp) != NULL) { \ - elm = tmp; \ - tmpp = &RB_RIGHT(elm, field); \ - } \ - return (name##_RB_INSERT_FINISH(head, elm, tmpp, prev)); \ -} +#define RB_GENERATE_INSERT_PREV( name, type, field, cmp, attr ) \ + /* Inserts a node into the prev position in the RB tree */ \ + attr struct type *name##_RB_INSERT_PREV( \ + struct name *head, \ + struct type *elm, \ + struct type *prev \ + ) \ + { \ + struct type *tmp; \ + struct type **tmpp = &RB_LEFT( elm, field ); \ + \ + _RB_ORDER_CHECK( cmp, prev, elm ); \ + if ( name##_RB_PREV( elm ) != NULL ) \ + _RB_ORDER_CHECK( cmp, name##_RB_PREV( elm ), prev ); \ + while ( ( tmp = *tmpp ) != NULL ) { \ + elm = tmp; \ + tmpp = &RB_RIGHT( elm, field ); \ + } \ + return ( name##_RB_INSERT_FINISH( head, elm, tmpp, prev ) ); \ + } -#define RB_GENERATE_MINMAX(name, type, field, attr) \ -attr struct type * \ -name##_RB_MINMAX(struct name *head, int val) \ -{ \ - struct type *tmp = RB_ROOT(head); \ - struct type *parent = NULL; \ - while (tmp) { \ - parent = tmp; \ - if (val < 0) \ - tmp = RB_LEFT(tmp, field); \ - else \ - tmp = RB_RIGHT(tmp, field); \ - } \ - return (parent); \ -} +#define RB_GENERATE_MINMAX( name, type, field, attr ) \ + attr struct type *name##_RB_MINMAX( struct name *head, int val ) \ + { \ + struct type *tmp = RB_ROOT( head ); \ + struct type *parent = NULL; \ + while ( tmp ) { \ + parent = tmp; \ + if ( val < 0 ) \ + tmp = RB_LEFT( tmp, field ); \ + else \ + tmp = RB_RIGHT( tmp, field ); \ + } \ + return ( parent ); \ + } -#define RB_GENERATE_REINSERT(name, type, field, cmp, attr) \ -attr struct type * \ -name##_RB_REINSERT(struct name *head, struct type *elm) \ -{ \ - struct type *cmpelm; \ - if (((cmpelm = RB_PREV(name, head, elm)) != NULL && \ - cmp(cmpelm, elm) >= 0) || \ - ((cmpelm = RB_NEXT(name, head, elm)) != NULL && \ - cmp(elm, cmpelm) >= 0)) { \ - /* XXXLAS: Remove/insert is heavy handed. */ \ - RB_REMOVE(name, head, elm); \ - return (RB_INSERT(name, head, elm)); \ - } \ - return (NULL); \ -} \ +#define RB_GENERATE_REINSERT( name, type, field, cmp, attr ) \ + attr struct type *name##_RB_REINSERT( struct name *head, struct type *elm ) \ + { \ + struct type *cmpelm; \ + if ( \ + ( ( cmpelm = RB_PREV( name, head, elm ) ) != NULL && \ + cmp( cmpelm, elm ) >= 0 ) || \ + ( ( cmpelm = RB_NEXT( name, head, elm ) ) != NULL && \ + cmp( elm, cmpelm ) >= 0 ) \ + ) { \ + /* XXXLAS: Remove/insert is heavy handed. */ \ + RB_REMOVE( name, head, elm ); \ + return ( RB_INSERT( name, head, elm ) ); \ + } \ + return ( NULL ); \ + } -#define RB_NEGINF -1 -#define RB_INF 1 +#define RB_NEGINF -1 +#define RB_INF 1 -#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) -#define RB_INSERT_NEXT(name, x, y, z) name##_RB_INSERT_NEXT(x, y, z) -#define RB_INSERT_PREV(name, x, y, z) name##_RB_INSERT_PREV(x, y, z) -#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) -#define RB_FIND(name, x, y) name##_RB_FIND(x, y) -#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) -#define RB_NEXT(name, x, y) name##_RB_NEXT(y) -#define RB_PREV(name, x, y) name##_RB_PREV(y) -#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) -#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) -#define RB_REINSERT(name, x, y) name##_RB_REINSERT(x, y) +#define RB_INSERT( name, x, y ) name##_RB_INSERT( x, y ) +#define RB_INSERT_NEXT( name, x, y, z ) name##_RB_INSERT_NEXT( x, y, z ) +#define RB_INSERT_PREV( name, x, y, z ) name##_RB_INSERT_PREV( x, y, z ) +#define RB_REMOVE( name, x, y ) name##_RB_REMOVE( x, y ) +#define RB_FIND( name, x, y ) name##_RB_FIND( x, y ) +#define RB_NFIND( name, x, y ) name##_RB_NFIND( x, y ) +#define RB_NEXT( name, x, y ) name##_RB_NEXT( y ) +#define RB_PREV( name, x, y ) name##_RB_PREV( y ) +#define RB_MIN( name, x ) name##_RB_MINMAX( x, RB_NEGINF ) +#define RB_MAX( name, x ) name##_RB_MINMAX( x, RB_INF ) +#define RB_REINSERT( name, x, y ) name##_RB_REINSERT( x, y ) -#define RB_FOREACH(x, name, head) \ - for ((x) = RB_MIN(name, head); \ - (x) != NULL; \ - (x) = name##_RB_NEXT(x)) +#define RB_FOREACH( x, name, head ) \ + for ( \ + ( x ) = RB_MIN( name, head ); ( x ) != NULL; ( x ) = name##_RB_NEXT( x ) \ + ) -#define RB_FOREACH_FROM(x, name, y) \ - for ((x) = (y); \ - ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ - (x) = (y)) +#define RB_FOREACH_FROM( x, name, y ) \ + for ( \ + ( x ) = ( y ); \ + ( ( x ) != NULL ) && ( ( y ) = name##_RB_NEXT( x ), ( x ) != NULL ); \ + ( x ) = ( y ) \ + ) -#define RB_FOREACH_SAFE(x, name, head, y) \ - for ((x) = RB_MIN(name, head); \ - ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ - (x) = (y)) +#define RB_FOREACH_SAFE( x, name, head, y ) \ + for ( \ + ( x ) = RB_MIN( name, head ); \ + ( ( x ) != NULL ) && ( ( y ) = name##_RB_NEXT( x ), ( x ) != NULL ); \ + ( x ) = ( y ) \ + ) -#define RB_FOREACH_REVERSE(x, name, head) \ - for ((x) = RB_MAX(name, head); \ - (x) != NULL; \ - (x) = name##_RB_PREV(x)) +#define RB_FOREACH_REVERSE( x, name, head ) \ + for ( \ + ( x ) = RB_MAX( name, head ); ( x ) != NULL; ( x ) = name##_RB_PREV( x ) \ + ) -#define RB_FOREACH_REVERSE_FROM(x, name, y) \ - for ((x) = (y); \ - ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ - (x) = (y)) +#define RB_FOREACH_REVERSE_FROM( x, name, y ) \ + for ( \ + ( x ) = ( y ); \ + ( ( x ) != NULL ) && ( ( y ) = name##_RB_PREV( x ), ( x ) != NULL ); \ + ( x ) = ( y ) \ + ) -#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ - for ((x) = RB_MAX(name, head); \ - ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ - (x) = (y)) +#define RB_FOREACH_REVERSE_SAFE( x, name, head, y ) \ + for ( \ + ( x ) = RB_MAX( name, head ); \ + ( ( x ) != NULL ) && ( ( y ) = name##_RB_PREV( x ), ( x ) != NULL ); \ + ( x ) = ( y ) \ + ) -#endif /* _SYS_TREE_H_ */ +#endif /* _SYS_TREE_H_ */ diff --git a/testsuites/sptests/spunlimited01/init.c b/testsuites/sptests/spunlimited01/init.c index 42fa9c83e9..aa8f756a22 100644 --- a/testsuites/sptests/spunlimited01/init.c +++ b/testsuites/sptests/spunlimited01/init.c @@ -44,9 +44,9 @@ void __wrap__Workspace_Free( void * ); void __wrap__Workspace_Free( void *ptr ) { - uintptr_t alloc_begin; - uintptr_t block_size; - uintptr_t block_end; + uintptr_t alloc_begin; + uintptr_t block_size; + uintptr_t block_end; Heap_Block *block; if ( ptr == NULL ) { @@ -72,8 +72,8 @@ static void delete_mutex( rtems_id id ) T_TEST_CASE( UnlimitedShrink ) { - rtems_id ids[ 6 ]; - size_t i; + rtems_id ids[ 6 ]; + size_t i; rtems_status_code sc; for ( i = 0; i < RTEMS_ARRAY_SIZE( ids ); ++i ) { diff --git a/testsuites/sptests/spversion01/init.c b/testsuites/sptests/spversion01/init.c index c462b1ce98..7161633906 100644 --- a/testsuites/sptests/spversion01/init.c +++ b/testsuites/sptests/spversion01/init.c @@ -37,9 +37,7 @@ const char rtems_test_name[] = "VERSION 1"; -static rtems_task Init( - rtems_task_argument argument -) +static rtems_task Init( rtems_task_argument argument ) { (void) argument; @@ -49,18 +47,18 @@ static rtems_task Init( TEST_BEGIN(); key = rtems_version_control_key(); - valid = rtems_version_control_key_is_valid(key) ? "valid" : "invalid"; + valid = rtems_version_control_key_is_valid( key ) ? "valid" : "invalid"; - printf("Release : %s\n", rtems_version()); - printf("Major : %d\n", rtems_version_major()); - printf("Minor : %d\n", rtems_version_minor()); - printf("Revision : %d\n", rtems_version_revision()); - printf("VC Key : %s (%s)\n", key, valid); - printf("BSP : %s\n", rtems_board_support_package()); + printf( "Release : %s\n", rtems_version() ); + printf( "Major : %d\n", rtems_version_major() ); + printf( "Minor : %d\n", rtems_version_minor() ); + printf( "Revision : %d\n", rtems_version_revision() ); + printf( "VC Key : %s (%s)\n", key, valid ); + printf( "BSP : %s\n", rtems_board_support_package() ); TEST_END(); - rtems_test_exit(0); + rtems_test_exit( 0 ); } /* configuration information */ diff --git a/testsuites/sptests/spwatchdog/delay.c b/testsuites/sptests/spwatchdog/delay.c index 1dd0c9f9ce..d5c43ae70c 100644 --- a/testsuites/sptests/spwatchdog/delay.c +++ b/testsuites/sptests/spwatchdog/delay.c @@ -41,8 +41,8 @@ #include "system.h" rtems_timer_service_routine Delayed_resume( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ) { (void) ignored_id; @@ -50,7 +50,6 @@ rtems_timer_service_routine Delayed_resume( rtems_status_code status; - status = rtems_task_resume( Task_id[ 1 ] ); directive_failed_with_level( status, "rtems_task_resume of self", 1 ); } diff --git a/testsuites/sptests/spwatchdog/init.c b/testsuites/sptests/spwatchdog/init.c index 2cec029f72..0adc46d7ca 100644 --- a/testsuites/sptests/spwatchdog/init.c +++ b/testsuites/sptests/spwatchdog/init.c @@ -47,7 +47,7 @@ const char rtems_test_name[] = "SPWATCHDOG"; typedef struct { Watchdog_Control Base; - int counter; + int counter; } test_watchdog; static void test_watchdog_routine( Watchdog_Control *base ) @@ -59,17 +59,12 @@ static void test_watchdog_routine( Watchdog_Control *base ) static void test_watchdog_static_init( void ) { - static Watchdog_Control a = WATCHDOG_INITIALIZER( - test_watchdog_routine - ); - Watchdog_Control b; + static Watchdog_Control a = WATCHDOG_INITIALIZER( test_watchdog_routine ); + Watchdog_Control b; memset( &b, 0, sizeof( b ) ); _Watchdog_Preinitialize( &b, _Per_CPU_Get_by_index( 0 ) ); - _Watchdog_Initialize( - &b, - test_watchdog_routine - ); + _Watchdog_Initialize( &b, test_watchdog_routine ); rtems_test_assert( memcmp( &a, &b, sizeof( a ) ) == 0 ); } @@ -92,7 +87,7 @@ static void test_watchdog_init( test_watchdog *watchdog, int counter ) { _Watchdog_Preinitialize( &watchdog->Base, _Per_CPU_Get_snapshot() ); _Watchdog_Initialize( &watchdog->Base, test_watchdog_routine ); - rtems_test_assert( test_watchdog_is_inactive( watchdog ) ) ; + rtems_test_assert( test_watchdog_is_inactive( watchdog ) ); watchdog->counter = counter; } @@ -101,7 +96,7 @@ static uint64_t test_watchdog_tick( Watchdog_Header *header, uint64_t now ) #if ISR_LOCK_NEEDS_OBJECT ISR_lock_Control lock = ISR_LOCK_INITIALIZER( "Test" ); #endif - ISR_lock_Context lock_context; + ISR_lock_Context lock_context; Watchdog_Control *first; _ISR_lock_ISR_disable_and_acquire( &lock, &lock_context ); @@ -122,10 +117,10 @@ static uint64_t test_watchdog_tick( Watchdog_Header *header, uint64_t now ) static void test_watchdog_operations( void ) { Watchdog_Header header; - uint64_t now; - test_watchdog a; - test_watchdog b; - test_watchdog c; + uint64_t now; + test_watchdog a; + test_watchdog b; + test_watchdog c; _Watchdog_Header_initialize( &header ); rtems_test_assert( _RBTree_Is_empty( &header.Watchdogs ) ); @@ -140,126 +135,124 @@ static void test_watchdog_operations( void ) _Watchdog_Insert( &header, &a.Base, now + 1 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 2 ); rtems_test_assert( a.counter == 10 ); _Watchdog_Remove( &header, &a.Base ); rtems_test_assert( header.first == NULL ); - rtems_test_assert( test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 2 ); rtems_test_assert( a.counter == 10 ); _Watchdog_Remove( &header, &a.Base ); rtems_test_assert( header.first == NULL ); - rtems_test_assert( test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 2 ); rtems_test_assert( a.counter == 10 ); _Watchdog_Insert( &header, &a.Base, now + 1 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 2 ); rtems_test_assert( a.counter == 10 ); _Watchdog_Insert( &header, &b.Base, now + 1 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &b ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &b ) ); rtems_test_assert( b.Base.expire == 2 ); rtems_test_assert( b.counter == 20 ); _Watchdog_Insert( &header, &c.Base, now + 2 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &c ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &c ) ); rtems_test_assert( c.Base.expire == 3 ); rtems_test_assert( c.counter == 30 ); _Watchdog_Remove( &header, &a.Base ); rtems_test_assert( header.first == &b.Base.Node.RBTree ); - rtems_test_assert( test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 2 ); rtems_test_assert( a.counter == 10 ); _Watchdog_Remove( &header, &b.Base ); rtems_test_assert( header.first == &c.Base.Node.RBTree ); - rtems_test_assert( test_watchdog_is_inactive( &b ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &b ) ); rtems_test_assert( b.Base.expire == 2 ); rtems_test_assert( b.counter == 20 ); _Watchdog_Remove( &header, &c.Base ); rtems_test_assert( header.first == NULL ); - rtems_test_assert( test_watchdog_is_inactive( &c ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &c ) ); rtems_test_assert( c.Base.expire == 3 ); rtems_test_assert( c.counter == 30 ); _Watchdog_Insert( &header, &a.Base, now + 2 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 3 ); rtems_test_assert( a.counter == 10 ); _Watchdog_Insert( &header, &b.Base, now + 2 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &b ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &b ) ); rtems_test_assert( b.Base.expire == 3 ); rtems_test_assert( b.counter == 20 ); _Watchdog_Insert( &header, &c.Base, now + 3 ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &c ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &c ) ); rtems_test_assert( c.Base.expire == 4 ); rtems_test_assert( c.counter == 30 ); now = test_watchdog_tick( &header, now ); rtems_test_assert( !_RBTree_Is_empty( &header.Watchdogs ) ); rtems_test_assert( header.first == &a.Base.Node.RBTree ); - rtems_test_assert( !test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 3 ); rtems_test_assert( a.counter == 10 ); - rtems_test_assert( !test_watchdog_is_inactive( &b ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &b ) ); rtems_test_assert( b.Base.expire == 3 ); rtems_test_assert( b.counter == 20 ); - rtems_test_assert( !test_watchdog_is_inactive( &c ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &c ) ); rtems_test_assert( c.Base.expire == 4 ); rtems_test_assert( c.counter == 30 ); now = test_watchdog_tick( &header, now ); rtems_test_assert( !_RBTree_Is_empty( &header.Watchdogs ) ); rtems_test_assert( header.first == &c.Base.Node.RBTree ); - rtems_test_assert( test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 3 ); rtems_test_assert( a.counter == 11 ); - rtems_test_assert( test_watchdog_is_inactive( &b ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &b ) ); rtems_test_assert( b.Base.expire == 3 ); rtems_test_assert( b.counter == 21 ); - rtems_test_assert( !test_watchdog_is_inactive( &c ) ) ; + rtems_test_assert( !test_watchdog_is_inactive( &c ) ); rtems_test_assert( c.Base.expire == 4 ); rtems_test_assert( c.counter == 30 ); now = test_watchdog_tick( &header, now ); rtems_test_assert( _RBTree_Is_empty( &header.Watchdogs ) ); rtems_test_assert( header.first == NULL ); - rtems_test_assert( test_watchdog_is_inactive( &a ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &a ) ); rtems_test_assert( a.Base.expire == 3 ); rtems_test_assert( a.counter == 11 ); - rtems_test_assert( test_watchdog_is_inactive( &b ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &b ) ); rtems_test_assert( b.Base.expire == 3 ); rtems_test_assert( b.counter == 21 ); - rtems_test_assert( test_watchdog_is_inactive( &c ) ) ; + rtems_test_assert( test_watchdog_is_inactive( &c ) ); rtems_test_assert( c.Base.expire == 4 ); rtems_test_assert( c.counter == 31 ); _Watchdog_Header_destroy( &header ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - rtems_time_of_day time; - rtems_status_code status; + rtems_time_of_day time; + rtems_status_code status; TEST_BEGIN(); @@ -272,7 +265,7 @@ rtems_task Init( status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); - Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); status = rtems_task_create( diff --git a/testsuites/sptests/spwatchdog/system.h b/testsuites/sptests/spwatchdog/system.h index 51b6b340de..9650a3e8df 100644 --- a/testsuites/sptests/spwatchdog/system.h +++ b/testsuites/sptests/spwatchdog/system.h @@ -34,44 +34,40 @@ /* functions */ -rtems_task Init( - rtems_task_argument argument -); +rtems_task Init( rtems_task_argument argument ); rtems_timer_service_routine Delayed_resume( - rtems_id ignored_id, - void *ignored_address + rtems_id ignored_id, + void *ignored_address ); void Print_time( void ); -rtems_task Task_1( - rtems_task_argument argument -); +rtems_task Task_1( rtems_task_argument argument ); /* configuration information */ #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 2 -#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2) +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_TIMERS 2 +#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 ) #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE ) #include /* global variables */ -TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ -TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ +TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ -TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ -TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ +TEST_EXTERN rtems_id Timer_id[ 2 ]; /* array of timer ids */ +TEST_EXTERN rtems_name Timer_name[ 2 ]; /* array of timer names */ /* end of include file */ diff --git a/testsuites/sptests/spwatchdog/task1.c b/testsuites/sptests/spwatchdog/task1.c index 30500a5d19..29040da9da 100644 --- a/testsuites/sptests/spwatchdog/task1.c +++ b/testsuites/sptests/spwatchdog/task1.c @@ -42,23 +42,21 @@ #include -rtems_task Task_1( - rtems_task_argument argument -) +rtems_task Task_1( rtems_task_argument argument ) { (void) argument; rtems_id tmid; rtems_status_code status; -/* Get id */ + /* Get id */ puts( "TA1 - rtems_timer_ident - identing timer 1" ); status = rtems_timer_ident( Timer_name[ 1 ], &tmid ); directive_failed( status, "rtems_timer_ident" ); printf( "TA1 - timer 1 has id (0x%" PRIxrtems_id ")\n", tmid ); -/* after which is allowed to fire */ + /* after which is allowed to fire */ Print_time(); @@ -77,7 +75,7 @@ rtems_task Task_1( Print_time(); -/* after which is reset and allowed to fire */ + /* after which is reset and allowed to fire */ puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_fire_after( diff --git a/testsuites/sptests/spwkspace/init.c b/testsuites/sptests/spwkspace/init.c index de6528fe15..1913f88134 100644 --- a/testsuites/sptests/spwkspace/init.c +++ b/testsuites/sptests/spwkspace/init.c @@ -41,21 +41,21 @@ const char rtems_test_name[] = "SPWKSPACE"; /* forward declarations to avoid warnings */ -rtems_task Init(rtems_task_argument argument); +rtems_task Init( rtems_task_argument argument ); -static void test_workspace_string_duplicate(void) +static void test_workspace_string_duplicate( void ) { - char a [] = "abcd"; - char b [] = "abc"; - char c [] = "ab"; - char d [] = "a"; - char e [] = ""; + char a[] = "abcd"; + char b[] = "abc"; + char c[] = "ab"; + char d[] = "a"; + char e[] = ""; size_t maxlen = 3; - char *dup_a = _Workspace_String_duplicate( a, maxlen ); - char *dup_b = _Workspace_String_duplicate( b, maxlen ); - char *dup_c = _Workspace_String_duplicate( c, maxlen ); - char *dup_d = _Workspace_String_duplicate( d, maxlen ); - char *dup_e = _Workspace_String_duplicate( e, maxlen ); + char *dup_a = _Workspace_String_duplicate( a, maxlen ); + char *dup_b = _Workspace_String_duplicate( b, maxlen ); + char *dup_c = _Workspace_String_duplicate( c, maxlen ); + char *dup_d = _Workspace_String_duplicate( d, maxlen ); + char *dup_e = _Workspace_String_duplicate( e, maxlen ); rtems_test_assert( dup_a != NULL ); rtems_test_assert( dup_b != NULL ); @@ -75,15 +75,13 @@ static void test_workspace_string_duplicate(void) _Workspace_Free( dup_e ); } -rtems_task Init( - rtems_task_argument argument -) +rtems_task Init( rtems_task_argument argument ) { (void) argument; - void *p1; - bool retbool; - Heap_Information_block info; + void *p1; + bool retbool; + Heap_Information_block info; TEST_BEGIN(); @@ -136,7 +134,7 @@ rtems_task Init( #define CONFIGURE_RTEMS_INIT_TASKS_TABLE -#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_MEMORY_OVERHEAD 1