📄 kernellib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/kernelLib.html - generated by refgen from kernelLib.c --> <title> kernelLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>kernelLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>kernelLib</strong> - VxWorks kernel library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./kernelLib.html#kernelInit">kernelInit</a></i>( )</b> - initialize the kernel<br><b><i><a href="./kernelLib.html#kernelVersion">kernelVersion</a></i>( )</b> - return the kernel revision string<br><b><i><a href="./kernelLib.html#kernelTimeSlice">kernelTimeSlice</a></i>( )</b> - enable round-robin selection<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>The VxWorks kernel provides tasking control services to an application. Thelibraries <b><a href="./kernelLib.html#top">kernelLib</a></b>, <b><a href="./taskLib.html#top">taskLib</a></b>, <b><a href="./semLib.html#top">semLib</a></b>, <b><a href="./tickLib.html#top">tickLib</a></b>, and <b><a href="./wdLib.html#top">wdLib</a></b> comprise the kernelfunctionality. This library is the interface to the VxWorks kernelinitialization, revision information, and scheduling control.<p></blockquote><h4>KERNEL INITIALIZATION</h4><blockquote><p>The kernel must be initialized before any other kernel operation isperformed. Normally kernel initialization is taken care of by the systemconfiguration code in <b><i><a href="./usrConfig.html#usrInit">usrInit</a></i>( )</b> in <b>usrConfig.c</b>.<p>Kernel initialization consists of the following:<dl><dt>(1)<dd>Defining the starting address and size of the system memory partition.The <b><i><a href="./memPartLib.html#malloc">malloc</a></i>( )</b> routine uses this partition to satisfy memory allocationrequests of other facilities in VxWorks.<p><dt>(2)<dd>Allocating the specified memory size for an interrupt stack. Interruptservice routines will use this stack unless the underlying architecturedoes not support a separate interrupt stack, in which case the serviceroutine will use the stack of the interrupted task.<p><dt>(3)<dd>Specifying the interrupt lock-out level. VxWorks will not exceed thespecified level during any operation. The lock-out level is normallydefined to mask the highest priority possible. However, in situationswhere extremely low interrupt latency is required, the lock-out level maybe set to ensure timely response to the interrupt in question. Interruptservice routines handling interrupts of priority greater than theinterrupt lock-out level may not call any VxWorks routine. </dl><p>Once the kernel initialization is complete, a root task is spawned withthe specified entry point and stack size. The root entry point is normally<b><i><a href="./usrConfig.html#usrRoot">usrRoot</a></i>( )</b> of the <b>usrConfig.c</b> module. The remaining VxWorks initializationtakes place in <b><i><a href="./usrConfig.html#usrRoot">usrRoot</a></i>( )</b>.<p></blockquote><h4>ROUND-ROBIN SCHEDULING</h4><blockquote><p>Round-robin scheduling allows the processor to be shared fairly by all tasksof the same priority. Without round-robin scheduling, when multiple tasks ofequal priority must share the processor, a single non-blocking task can usurpthe processor until preempted by a task of higher priority, thus never givingthe other equal-priority tasks a chance to run.<p>Round-robin scheduling is disabled by default. It can be enabled ordisabled with the routine <b><i><a href="./kernelLib.html#kernelTimeSlice">kernelTimeSlice</a></i>( )</b>, which takes a parameter forthe "time slice" (or interval) that each task will be allowed to runbefore relinquishing the processor to another equal-priority task. If theparameter is zero, round-robin scheduling is turned off. If round-robinscheduling is enabled and preemption is enabled for the executing task, the routine <b><i><a href="./tickLib.html#tickAnnounce">tickAnnounce</a></i>( )</b> will increment the task's time-slice count.When the specified time-slice interval is completed, the counter iscleared and the task is placed at the tail of the list of tasks at itspriority. New tasks joining a given priority group are placed at the tailof the group with a run-time counter initialized to zero.<p>If a higher priority task preempts a task during its time-slice, thetime-slice of the preempted task count is not changed for the duration ofthe preemption. If preemption is disabled during round-robin scheduling,the time-slice count of the executing task is not incremented.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>kernelLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./kernelLib.html#top">kernelLib</a></b>, <b><a href="./taskLib.html#top">taskLib</a></b>, <b><a href="./intLib.html#top">intLib</a></b>, <i>VxWorks Programmer's Guide: Basic OS</i><hr><a name="kernelInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>kernelInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>kernelInit</i>( )</strong> - initialize the kernel</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void kernelInit ( FUNCPTR rootRtn, /* user start-up routine */ unsigned rootMemSize, /* memory for TCB and root stack */ char * pMemPoolStart, /* beginning of memory pool */ char * pMemPoolEnd, /* end of memory pool */ unsigned intStackSize, /* interrupt stack size */ int lockOutLevel /* interrupt lock-out level (1-7) */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes and starts the kernel. It should be called onlyonce. The parameter <i>rootRtn</i> specifies the entry point of the user'sstart-up code that subsequently initializes system facilities (i.e., theI/O system, network). Typically, <i>rootRtn</i> is set to <b><i><a href="./usrConfig.html#usrRoot">usrRoot</a></i>( )</b>.<p>Interrupts are enabled for the first time after <b><i><a href="./kernelLib.html#kernelInit">kernelInit</a></i>( )</b> exits.VxWorks will not exceed the specified interrupt lock-out level during anyof its brief uses of interrupt locking as a means of mutual exclusion.<p>The system memory partition is initialized by <b><i><a href="./kernelLib.html#kernelInit">kernelInit</a></i>( )</b> with the sizeset by <i>pMemPoolStart</i> and <i>pMemPoolEnd</i>. Architectures that support aseparate interrupt stack allocate a portion of memory for thispurpose, of <i>intStackSize</i> bytes starting at <i>pMemPoolStart</i>.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./kernelLib.html#top">kernelLib</a></b>, <b><i><a href="./intArchLib.html#intLockLevelSet">intLockLevelSet</a></i>( )</b><hr><a name="kernelVersion"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>kernelVersion</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>kernelVersion</i>( )</strong> - return the kernel revision string</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>char *kernelVersion (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns a string which contains the current revision of thekernel. The string is of the form "WIND version x.y", where "x"corresponds to the kernel major revision, and "y" corresponds to thekernel minor revision.<p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to a string of format "WIND version x.y".</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./kernelLib.html#top">kernelLib</a></b><hr><a name="kernelTimeSlice"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>kernelTimeSlice</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>kernelTimeSlice</i>( )</strong> - enable round-robin selection</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS kernelTimeSlice ( int ticks /* time-slice in ticks or 0 to disable round-robin */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine enables round-robin selection among tasks of same priorityand sets the system time-slice to <i>ticks</i>. Round-robin scheduling isdisabled by default. A time-slice of zero ticks disables round-robinscheduling.<p>For more information about round-robin scheduling, see the manual entryfor kernelLib.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, always.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./kernelLib.html#top">kernelLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -