readme_countingsemdemo

来自「This is the demo source code for embedde」· 代码 · 共 101 行

TXT
101
字号
FLE LIST -	      countingSemDemo.cDESCRIPTION -	      Counting semaphore example.  Using binary semaphores for task	      synchronization may, if the events can occur rapidly enough, cause	      a loss of data, i.e. an event can be missed if the events can 	      occur faster then a task can process them.	      Using counting semaphores may solve this problem. This 	      program demonstrates task synchronization using counting 	      semaphores. The user can also select to use a binary semaphore 	      instead of a counting semaphore in this demonstration, for	      comparision between the two semaphores.	      To run this code invoke the function countingSemDemo()RUNNING DEMO -	      Place the countingSemDemo.c file in your <Tornado> dir. Depending 	      on the target you have, define the CPU in your compile line and	      use the Makefile in the BSP dir. to compile.	      Run countingSemDemo() on vxworks target.TESTED ON -   Host/Target : Solaris 2.5.1 / mv1604	      VxWorks     : 5.3.1	      EXAMPLE COMPILE LINE - 			    make CPU=PPC604 countingSemDemo.o% make countingSemDemo.occppc -B/petaluma1/mayur/tor101-ppc/host/sun4-solaris2/lib/gcc-lib/ -mstrict-align -ansi -nostdinc -O2 -fvolatile -fno-builtin -fno-for-scope -Wall -I/h   -I. -I/petaluma1/mayur/tor101-ppc/target/config/all -I/petaluma1/mayur/tor101-ppc/target/h -I/petaluma1/mayur/tor101-ppc/target/src/config -I/petaluma1/mayur/tor101-ppc/target/src/drv -DCPU=PPC604  -DMV1600 -DTARGET_DIR="\"mv1604\""   -c countingSemDemo.cOUTPUTS/LOGFILE -On VxWorks target:==================-> sp countingSemDemo, 'c'task spawned: id = 5b7b40, name = u0value = 5995328 = 0x5b7b40The Output on Console:======================Semaphore Id        : 0x7fd238    Semaphore Type      : COUNTING  Task Queuing        : PRIORITY  Pended Tasks        : 0         Count               : 2         semaphore taken 1 timesSemaphore Id        : 0x7fd238    Semaphore Type      : COUNTING  Task Queuing        : PRIORITY  Pended Tasks        : 0         Count               : 1         semaphore taken 2 timesSemaphore Id        : 0x7fd238    Semaphore Type      : COUNTING  Task Queuing        : PRIORITY  Pended Tasks        : 0         Count               : 0         semaphore taken 3 timesOn VxWorks target:==================-> sp countingSemDemo, 'b'task spawned: id = 5b7b40, name = u1value = 5995328 = 0x5b7b40The Output on Console:======================Semaphore Id        : 0x7fd238    Semaphore Type      : BINARY    Task Queuing        : PRIORITY  Pended Tasks        : 0         State               : FULL      semaphore taken 1 timesSemaphore Id        : 0x7fd238    Semaphore Type      : BINARY    Task Queuing        : PRIORITY  Pended Tasks        : 0         State               : EMPTY     semaphore taken 2 times  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?