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

📄 intarchlib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/intArchLib.html - generated by refgen from intArchLib.c --> <title> intArchLib </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>intArchLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>intArchLib</strong> - architecture-dependent interrupt library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./intArchLib.html#intLevelSet">intLevelSet</a></i>(&nbsp;)</b>  -  set the interrupt level (MC680x0, SPARC, i960, x86, ARM)<br><b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b>  -  lock out interrupts<br><b><i><a href="./intArchLib.html#intUnlock">intUnlock</a></i>(&nbsp;)</b>  -  cancel interrupt locks<br><b><i><a href="./intArchLib.html#intEnable">intEnable</a></i>(&nbsp;)</b>  -  enable corresponding interrupt bits (MIPS, PowerPC, ARM)<br><b><i><a href="./intArchLib.html#intDisable">intDisable</a></i>(&nbsp;)</b>  -  disable corresponding interrupt bits (MIPS, PowerPC, ARM)<br><b><i><a href="./intArchLib.html#intCRGet">intCRGet</a></i>(&nbsp;)</b>  -  read the contents of the cause register (MIPS)<br><b><i><a href="./intArchLib.html#intCRSet">intCRSet</a></i>(&nbsp;)</b>  -  write the contents of the cause register (MIPS)<br><b><i><a href="./intArchLib.html#intSRGet">intSRGet</a></i>(&nbsp;)</b>  -  read the contents of the status register (MIPS)<br><b><i><a href="./intArchLib.html#intSRSet">intSRSet</a></i>(&nbsp;)</b>  -  update the contents of the status register (MIPS)<br><b><i><a href="./intArchLib.html#intConnect">intConnect</a></i>(&nbsp;)</b>  -  connect a C routine to a hardware interrupt<br><b><i><a href="./intArchLib.html#intHandlerCreate">intHandlerCreate</a></i>(&nbsp;)</b>  -  construct an interrupt handler for a C routine (MC680x0, SPARC, i960, x86, MIPS)<br><b><i><a href="./intArchLib.html#intLockLevelSet">intLockLevelSet</a></i>(&nbsp;)</b>  -  set the current interrupt lock-out level (MC680x0, SPARC, i960, x86, ARM)<br><b><i><a href="./intArchLib.html#intLockLevelGet">intLockLevelGet</a></i>(&nbsp;)</b>  -  get the current interrupt lock-out level (MC680x0, SPARC, i960, x86, ARM)<br><b><i><a href="./intArchLib.html#intVecBaseSet">intVecBaseSet</a></i>(&nbsp;)</b>  -  set the vector (trap) base address (MC680x0, SPARC, i960, x86, MIPS, ARM)<br><b><i><a href="./intArchLib.html#intVecBaseGet">intVecBaseGet</a></i>(&nbsp;)</b>  -  get the vector (trap) base address (MC680x0, SPARC, i960, x86, MIPS, ARM)<br><b><i><a href="./intArchLib.html#intVecSet">intVecSet</a></i>(&nbsp;)</b>  -  set a CPU vector (trap) (MC680x0, SPARC, i960, x86, MIPS)<br><b><i><a href="./intArchLib.html#intVecGet">intVecGet</a></i>(&nbsp;)</b>  -  get an interrupt vector (MC680x0, SPARC, i960, x86, MIPS)<br><b><i><a href="./intArchLib.html#intVecTableWriteProtect">intVecTableWriteProtect</a></i>(&nbsp;)</b>  -  write-protect exception vector table (MC680x0, SPARC, i960, x86, ARM)<br><b><i><a href="./intArchLib.html#intUninitVecSet">intUninitVecSet</a></i>(&nbsp;)</b>  -  set the uninitialized vector handler (ARM)<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides architecture-dependent routines to manipulateand connect to hardware interrupts.  Any C language routine can beconnected to any interrupt by calling <b><i><a href="./intArchLib.html#intConnect">intConnect</a></i>(&nbsp;)</b>.  Vectors can beaccessed directly by <b><i><a href="./intArchLib.html#intVecSet">intVecSet</a></i>(&nbsp;)</b> and <b><i><a href="./intArchLib.html#intVecGet">intVecGet</a></i>(&nbsp;)</b>.  The vector (trap)base register (if present) can be accessed by the routines<b><i><a href="./intArchLib.html#intVecBaseSet">intVecBaseSet</a></i>(&nbsp;)</b> and <b><i><a href="./intArchLib.html#intVecBaseGet">intVecBaseGet</a></i>(&nbsp;)</b>.<p>Tasks can lock and unlock interrupts by calling <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b> and <b><i><a href="./intArchLib.html#intUnlock">intUnlock</a></i>(&nbsp;)</b>.The lock-out level can be set and reported by <b><i><a href="./intArchLib.html#intLockLevelSet">intLockLevelSet</a></i>(&nbsp;)</b> and<b><i><a href="./intArchLib.html#intLockLevelGet">intLockLevelGet</a></i>(&nbsp;)</b> (MC680x0, SPARC, i960, i386/i486 and ARM only).The routine <b><i><a href="./intArchLib.html#intLevelSet">intLevelSet</a></i>(&nbsp;)</b> changes the current interrupt level of theprocessor (MC680x0, SPARC, i960 and ARM).<p></blockquote><h4>WARNING</h4><blockquote><p>Do not call VxWorks system routines with interrupts locked.Violating this rule may re-enable interrupts unpredictably.<p></blockquote><h4>INTERRUPT VECTORS AND NUMBERS</h4><blockquote><p>Most of the routines in this library take an interrupt vector as aparameter, which is generally the byte offset into the vector table.Macros are provided to convert between interrupt vectors and interruptnumbers:<dl><dt><b>IVEC_TO_INUM</b>(intVector)<dd>converts a vector to a number.<p><dt><b>INUM_TO_IVEC</b>(intNumber)<dd>converts a number to a vector.<p><dt><b>TRAPNUM_TO_IVEC</b>(trapNumber)<dd>converts a trap number to a vector.<p></dl></blockquote><h4>EXAMPLE</h4><blockquote><p><p>To switch between one of several routines for a particular interrupt,the following code fragment is one alternative:<pre>    vector  = INUM_TO_IVEC(some_int_vec_num);    oldfunc = intVecGet (vector);    newfunc = intHandlerCreate (routine, parameter);    intVecSet (vector, newfunc);    ...    intVecSet (vector, oldfunc);    /* use original routine */    ...    intVecSet (vector, newfunc);    /* reconnect new routine */</pre></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>iv.h</b>, <b>intLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./intArchLib.html#top">intArchLib</a></b>, <b><a href="./intLib.html#top">intLib</a></b><hr><a name="intLevelSet"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>intLevelSet</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>intLevelSet</i>(&nbsp;)</strong> - set the interrupt level (MC680x0, SPARC, i960, x86, ARM)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int intLevelSet    (    int level /* new interrupt level mask */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine changes the interrupt mask in the status register to take onthe value specified by <i>level</i>.  Interrupts are locked out at or belowthat level.  The value of <i>level</i> must be in the following range:<p><table><tr valign=top><td align=left>    MC680x0: </td><td align=left> </td><td align=left> 0 - 7</tr><tr valign=top><td align=left>    SPARC: </td><td align=left> </td><td align=left> 0 - 15</tr><tr valign=top><td align=left>    i960: </td><td align=left> </td><td align=left> 0 - 31</tr><tr valign=top><td align=left>    ARM </td><td align=left> </td><td align=left> BSP-specific</tr><tr valign=top><td align=left></tr></tr></table>On SPARC systems, traps must be enabled before the call.<p></blockquote><h4>WARNING</h4><blockquote><p>Do not call VxWorks system routines with interrupts locked.Violating this rule may re-enable interrupts unpredictably.<p></blockquote><h4>RETURNS</h4><blockquote><p>The previous interrupt level.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./intArchLib.html#top">intArchLib</a></b><hr><a name="intLock"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>intLock</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>intLock</i>(&nbsp;)</strong> - lock out interrupts</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int intLock (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine disables interrupts.  The <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b> routine returns anarchitecture-dependent lock-out key representing the interrupt levelprior to the call; this key can be passed to <b><i><a href="./intArchLib.html#intUnlock">intUnlock</a></i>(&nbsp;)</b> tore-enable interrupts.<p>For MC680x0, SPARC, i960, and i386/i486 architectures, interruptsare disabled at the level set by <b><i><a href="./intArchLib.html#intLockLevelSet">intLockLevelSet</a></i>(&nbsp;)</b>.  The defaultlock-out level is the highest interrupt level (MC680x0 = 7, SPARC =15, i960 = 31, i386/i486 = 1).  <p>For MIPS processors, interrupts are disabled at themaster lock-out level; this means no interrupt can occur even ifunmasked in the IntMask bits (15-8) of the status register.<p>For ARM processors, interrupts (IRQs) are disabled by setting the I bitin the CPSR. This means no IRQs can occur.<p>For PowerPC processors, there is only one interrupt vector.  The externalinterrupt (vector offset 0x500) is disabled when <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b> is called; thismeans that the processor cannot be interrupted by any external event.<p></blockquote><h4>IMPLEMENTATION</h4><blockquote><p>The lock-out key is implemented differently for different architectures:<p><table><tr valign=top><td align=left>    MC680x0:     </td><td align=left> interrupt field mask</tr><tr valign=top><td align=left>    SPARC:       </td><td align=left> interrupt level (0 - 15)</tr><tr valign=top><td align=left>    i960:        </td><td align=left> interrupt level (0 - 31)</tr><tr valign=top><td align=left>    MIPS:        </td><td align=left> status register</tr><tr valign=top><td align=left>    i386/i486:   </td><td align=left> interrupt enable flag (IF) bit from EFLAGS register</tr><tr valign=top><td align=left>    PowerPC:     </td><td align=left> MSR register value</tr><tr valign=top><td align=left>    ARM          </td><td align=left> I bit from the CPSR</tr><tr valign=top><td align=left></tr></tr></table></blockquote><h4>WARNINGS</h4><blockquote><p>Do not call VxWorks system routines with interrupts locked.Violating this rule may re-enable interrupts unpredictably.<p>The routine <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b> can be called from either interrupt or task level.When called from a task context, the interrupt lock level is part of thetask context.  Locking out interrupts does not prevent rescheduling.Thus, if a task locks out interrupts and invokes kernel services thatcause the task to block (e.g., <b><i><a href="./taskLib.html#taskSuspend">taskSuspend</a></i>(&nbsp;)</b> or <b><i><a href="./taskLib.html#taskDelay">taskDelay</a></i>(&nbsp;)</b>) or that cause ahigher priority task to be ready (e.g., <b><i><a href="./semLib.html#semGive">semGive</a></i>(&nbsp;)</b> or <b><i><a href="./taskLib.html#taskResume">taskResume</a></i>(&nbsp;)</b>), thenrescheduling occurs and interrupts are unlocked while other tasksrun.  Rescheduling may be explicitly disabled with <b><i><a href="./taskLib.html#taskLock">taskLock</a></i>(&nbsp;)</b>.Traps must be enabled when calling this routine.<p></blockquote><h4>EXAMPLES</h4><blockquote><p><pre>    lockKey = intLock ();     ... (work with interrupts locked out)    intUnlock (lockKey);</pre>To lock out interrupts and task scheduling as well (see WARNING above):<pre>    if (taskLock() == OK)        {        lockKey = intLock ();        ... (critical section)        intUnlock (lockKey);        taskUnlock();        }     else        {        ... (error message or recovery attempt)        }</pre></blockquote><h4>RETURNS</h4><blockquote><p>An architecture-dependent lock-out key for the interrupt levelprior to the call.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./intArchLib.html#top">intArchLib</a></b>, <b><i><a href="./intArchLib.html#intUnlock">intUnlock</a></i>(&nbsp;)</b>, <b><i><a href="./taskLib.html#taskLock">taskLock</a></i>(&nbsp;)</b>, <b><i><a href="./intArchLib.html#intLockLevelSet">intLockLevelSet</a></i>(&nbsp;)</b><hr><a name="intUnlock"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>intUnlock</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>intUnlock</i>(&nbsp;)</strong> - cancel interrupt locks</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void intUnlock    (    int lockKey /* lock-out key returned by preceding intLock() */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine re-enables interrupts that have been disabled by <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b>.The parameter <i>lockKey</i> is an architecture-dependent lock-out keyreturned by a preceding <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b> call.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./intArchLib.html#top">intArchLib</a></b>, <b><i><a href="./intArchLib.html#intLock">intLock</a></i>(&nbsp;)</b><hr><a name="intEnable"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>intEnable</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>intEnable</i>(&nbsp;)</strong> - enable corresponding interrupt bits (MIPS, PowerPC, ARM)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int intEnable    (    int level /* new interrupt bits (0x00 - 0xff00) */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine enables the input interrupt bits on the present statusregister of the MIPS and PowerPC processors.<p>

⌨️ 快捷键说明

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