⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kernellib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 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.htm"><i>VxWorks API Reference :  OS 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><a href="./kernelLib.html#kernelInit">kernelInit</a>(&nbsp;)</b>  -  initialize the kernel<br><b><a href="./kernelLib.html#kernelVersion">kernelVersion</a>(&nbsp;)</b>  -  return the kernel revision string<br><b><a href="./kernelLib.html#kernelTimeSlice">kernelTimeSlice</a>(&nbsp;)</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><a href="./usrConfig.html#usrInit">usrInit</a>(&nbsp;)</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><a href="./memPartLib.html#malloc">malloc</a>(&nbsp;)</b> routine uses this partition to satisfy memory allocationrequests of other facilities in VxWorks.<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.<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><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</b> of the <b>usrConfig.c</b> module.  The remaining VxWorks initializationtakes place in <b><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</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><a href="./kernelLib.html#kernelTimeSlice">kernelTimeSlice</a>(&nbsp;)</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 system tick handler will increment the task's time-slice count.When the specified time-slice interval is completed, the system tickhandler clears the counter and the task is placed at the tail of the listof tasks at its priority.  New tasks joining a given priority group areplaced at the tail of the group with a run-time counter initialized to zero.<p>Enabling round-robin scheduling does not affect the performance of taskcontext switches, nor is additional memory allocated.<p>If a task blocks or is preempted by a higher priority task during itsinterval, it's time-slice count is saved and then restored when the taskis eligible for execution.  In the case of preemption, the task willresume execution once the higher priority task completes, assuming noother task of a higher priority is ready to run.  For the case when thetask blocks, it is placed at the tail of the list of tasks at its priority.If preemption is disabled during round-robin scheduling, the time-slicecount of the executing task is not incremented.<p>Time-slice counts are accrued against the task that is executing when a systemtick occurs regardless of whether the task has executed for the entire tickinterval.  Due to preemption by higher priority tasks or ISRs stealing CPUtime from the task, scenarios exist where a task can execute for less or moretotal CPU time than it's allotted time slice.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>kernelLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><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.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>kernelInit(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>kernelInit(&nbsp;)</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><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</b>.<p>Interrupts are enabled for the first time after <b><a href="./kernelLib.html#kernelInit">kernelInit</a>(&nbsp;)</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><a href="./kernelLib.html#kernelInit">kernelInit</a>(&nbsp;)</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>NOTE SH77XX</h4><blockquote><p><p>The interrupt stack is emulated by software, and it has to be located ina fixed physical address space (P1 or P2) if the on-chip MMU is enabled.If <i>pMemPoolStart</i> is in a logical address space (P0 or P3), the interruptstack area is reserved on the same logical address space.  The actualinterrupt stack is relocated to a fixed physical space pointed by VBR.<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><a href="./intArchLib.html#intLockLevelSet">intLockLevelSet</a>(&nbsp;)</b><hr><a name="kernelVersion"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>kernelVersion(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>kernelVersion(&nbsp;)</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.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>kernelTimeSlice(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>kernelTimeSlice(&nbsp;)</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 <b><a href="./kernelLib.html#top">kernelLib</a></b>.<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 + -