hwi_defs.h
来自「澳洲人写的Cortex,包括uC_IP协议栈」· C头文件 代码 · 共 389 行 · 第 1/2 页
H
389 行
*/</font><font color="#6920ac">/* Install ISR handler for specified interrupt source */</font><font size="+1"><i>crtx_Status_t</i> <a href="hrdi_Install.FIND-FUNC">hrdi_Install</a>(<i>hrdi_Vector_t</i> Vector_a, <i>hrdi_Handler_t</i> Handler_a, <i>hrdi_Context_t</i> Context_a, <i>crtx_Int_t</i> HandlerType_a, <i>hrdi_Attr_t</i> *pAttr_a);</font><font color="#6920ac">/* Uninstall ISR handler for specified interrupt source */</font><font size="+1"><i>crtx_Status_t</i> <a href="hrdi_Uninstall.FIND-FUNC">hrdi_Uninstall</a>(<i>hrdi_Vector_t</i> Vector_a);</font><font color="#6920ac">/* get LISR handler */</font><font size="+1"><i>hrdi_Handler_t</i> <a href="hrdi_GetHandler.FIND-FUNC">hrdi_GetHandler</a>(<i>hrdi_Vector_t</i> Vector_a);</font><font color="#6920ac">/* get LISR context */</font><font size="+1"><i>hrdi_Context_t</i> <a href="hrdi_GetContext.FIND-FUNC">hrdi_GetContext</a>(<i>hrdi_Vector_t</i> Vector_a);</font><font color="#6920ac">/* get LISR flags */</font><font size="+1"><i>crtx_Int_t</i> <a href="hrdi_GetFlags.FIND-FUNC">hrdi_GetFlags</a>(<i>hrdi_Vector_t</i> Vector_a);</font><font color="#6920ac">/* get LISR attributes */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_GetAttr.FIND-FUNC">hrdi_GetAttr</a>(<i>hrdi_Vector_t</i> Vector_a, <i>hrdi_Attr_t</i> *pAttr_a);</font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> HRDI_INTR_MASK_MODEL</font><font color="#6920ac">/* get mask of defined LISRs */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_GetDefined.FIND-FUNC">hrdi_GetDefined</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* get mask of enabled LISRs */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_GetEnabled.FIND-FUNC">hrdi_GetEnabled</a>(<i>crtx_Void_t</i>);</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* HRDI_INTR_MASK_MODEL */</font></font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> HRDI_PRIO_LEVEL_MODEL</font><font color="#6920ac">/* get highest interrupt priority level */</font><font size="+1"><i>hrdi_Priority_t</i> <a href="hrdi_GetMaxPriority.FIND-FUNC">hrdi_GetMaxPriority</a>(<i>crtx_Void_t</i>);</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* HRDI_PRIO_LEVEL_MODEL */</font></font><font color="#6920ac">/* is LISR installed? */</font><font size="+1"><i>crtx_Boolean_t</i> <a href="hrdi_IsInstalled.FIND-FUNC">hrdi_IsInstalled</a>(<i>hrdi_Vector_t</i> Vector_a);</font><font color="#6920ac">/* Get LISR/DISR info */</font><font size="+1"><i>crtx_Status_t</i> <a href="hrdi_GetInfo.FIND-FUNC">hrdi_GetInfo</a>(<i>hrdi_Vector_t</i> Vector_a, <i>hrdi_Info_t</i> *pInfo_a);</font><font color="#6920ac">/* activate interrupt subsystem. CPU specifiec service may do nothing * on some CPU platforms */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_Start.FIND-FUNC">hrdi_Start</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* service pending software interrupts. Shall be called by interrupts * dispatcher */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_ServicePending.FIND-FUNC">hrdi_ServicePending</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Forbids all currently registered hardware interrupt sources. Can be nested. */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_Forbid.FIND-FUNC">hrdi_Forbid</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Permits interrupt previously disabled by hrdi_Forbid() */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_Permit.FIND-FUNC">hrdi_Permit</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Forbids ALL hardware interrupts (normaly disables global interrupt flag * (shall be used within critical area where no interruptions shall occur). * Can be nested. */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_GlobalForbid.FIND-FUNC">hrdi_GlobalForbid</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Re-enables hardware interrupts disabled by hrdi_GlobalForbid */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_GlobalPermit.FIND-FUNC">hrdi_GlobalPermit</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Protect critical area from interruption by specified * hardware interrupt source. This service can be used * by HISR/Application to protect data shared with LISR. * Returns some magic value which shall be used to restore * previous interrupts disposition (Implementation depends on * CPU platform). */</font><font size="+1"><i>hrdi_ProtectCookie_t</i> <a href="hrdi_Protect.FIND-FUNC">hrdi_Protect</a>(<i>hrdi_Vector_t</i> Vector_a);</font><font color="#6920ac">/* Unprotect critical area shared between LISR and HISR/Application */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_Unprotect.FIND-FUNC">hrdi_Unprotect</a>(<i>hrdi_ProtectCookie_t</i> Cookie_a);</font><font color="#6920ac">/* * ========= CPU specific services ======== */</font><font color="#6920ac">/* increment specified location as an atomic operation * and return new value*/</font><font size="+1"><i>crtx_Int_t</i> <a href="hrdi_Inc.FIND-FUNC">hrdi_Inc</a>(<i>crtx_Int_t</i> *pVar_a);</font><font color="#6920ac">/* decrement specified location as an atomic operation * and return new value*/</font><font size="+1"><i>crtx_Int_t</i> <a href="hrdi_Dec.FIND-FUNC">hrdi_Dec</a>(<i>crtx_Int_t</i> *pVar_a);</font><font color="#6920ac">/* set specified location to zero and return previous value */</font><font size="+1"><i>crtx_Int_t</i> <a href="hrdi_Zero.FIND-FUNC">hrdi_Zero</a>(<i>crtx_Int_t</i> *pVar_a);</font><font color="#6920ac">/* assign new value to specified location and return previous value */</font><font size="+1"><i>crtx_Int_t</i> <a href="hrdi_Assign.FIND-FUNC">hrdi_Assign</a>(<i>crtx_Int_t</i> *pVar_a, <i>crtx_Int_t</i> Value_a);</font><font color="#6920ac">/* logically AND specified location and mask as an atomic operation * and return new value */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_And.FIND-FUNC">hrdi_And</a>(<i>hrdi_Mask_t</i> *pVar_a, <i>hrdi_Mask_t</i> Mask_a);</font><font color="#6920ac">/* logically OR specified location and mask as an atomic operation * and return new value */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_Or.FIND-FUNC">hrdi_Or</a>(<i>hrdi_Mask_t</i> *pVar_a, <i>hrdi_Mask_t</i> Mask_a);</font><font color="#6920ac">/* logically XOR specified location and mask as an atomic operation * and return new value */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_Xor.FIND-FUNC">hrdi_Xor</a>(<i>hrdi_Mask_t</i> *pVar_a, <i>hrdi_Mask_t</i> Mask_a);</font><font color="#6920ac">/* invert all bits at specified location as an atomic operation * and return new value */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_Not.FIND-FUNC">hrdi_Not</a>(<i>hrdi_Mask_t</i> *pVar_a);</font><font color="#6920ac">/* Convenient and efficient way to disable registerd hardware interrupts * for a short time. Where possible disables registered interrupts * sources only. If performance is a concern. global interrupts * may be disabled. Implementation depends on CPU platform. */</font><font size="+1"><i>hrdi_FastIntrCookie_t</i> <a href="hrdi_FastIntrDisable.FIND-FUNC">hrdi_FastIntrDisable</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Re-enable interrupts disabled by hrdi_FastIntrDisable */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_FastIntrEnable.FIND-FUNC">hrdi_FastIntrEnable</a>(<i>hrdi_FastIntrCookie_t</i> Cookie_a);</font><font color="#6920ac">/* quickest way to disable global interrupt flag (whatever it is * on current CPU. CPU specific implementation. */</font><font size="+1"><i>hrdi_GlobalIntrCookie_t</i> <a href="hrdi_GlobalIntrDisable.FIND-FUNC">hrdi_GlobalIntrDisable</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* re-enable interrupts disabled by hrdi_GlobaIntrDisable */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_GlobalIntrEnable.FIND-FUNC">hrdi_GlobalIntrEnable</a>(<i>hrdi_GlobalIntrCookie_t</i> Cookie_a);</font><font color="#6920ac">/* Disable interrupt sources according interrupt mask. Returns mask * of interrupt sources disabled by this service */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_Disable.FIND-FUNC">hrdi_Disable</a>(<i>hrdi_Mask_t</i> Mask_a);</font><font color="#6920ac">/* Enable interrupt sources specified by argument */</font><font size="+1"><i>crtx_Void_t</i> <a href="hrdi_Enable.FIND-FUNC">hrdi_Enable</a>(<i>hrdi_Mask_t</i> Mask_a);</font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> HRDI_PRIO_LEVEL_MODEL</font><font color="#6920ac">/* set new CPU priority level and returns previous CPU priority level */</font><font size="+1"><i>hrdi_Priority_t</i> <a href="hrdi_SetPrioLevel.FIND-FUNC">hrdi_SetPrioLevel</a>(<i>hrdi_Priority_t</i>);</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* HRDI_PRIO_LEVEL_MODEL */</font></font><font color="#6920ac">/* checks for nested hardware interrutps */</font><font size="+1"><i>crtx_Boolean_t</i> <a href="hrdi_IsNested.FIND-FUNC">hrdi_IsNested</a>(<i>crtx_Void_t</i>);</font><font color="#6920ac">/* Calculate interrupt mask for specified interrupt vector. * This service is available for both interrupt models but * behaves differently. * * For HRDI_PRIO_LEVEL_MODEL this service returns interrupt priority * mask (IPM) which is calculated from priority level assigned to * specified interrupt source. If no LISR is registered for the vector * it will return 0. As a common rule DON'T USE hrdi_Mask() for UNREGISTERED * interrupt sources. * * For HRDI_INTR_MASK_MODEL this service is less restrictive and calculates * mask according interrupt vector number and can be used for unregistered * sources. Still may return 0 if vector number is reserved for current CPU * or is not hardware interrupt. */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_Mask.FIND-FUNC">hrdi_Mask</a>(<i>hrdi_Vector_t</i> Vector_a);</font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> HRDI_PRIO_LEVEL_MODEL</font><font color="#6920ac">/* calculate interrupt priority mask from interrupts priority */</font><font size="+1"><i>hrdi_Mask_t</i> <a href="hrdi_PriorityMask.FIND-FUNC">hrdi_PriorityMask</a>(<i>hrdi_Priority_t</i> Priority_a);</font><font color="#6920ac">/* return highest intrrupt priority level */</font><font size="+1"><i>hrdi_Priority_t</i> <a href="hrdi_MaxPriority.FIND-FUNC">hrdi_MaxPriority</a>(<i>hrdi_Priority_t</i> Prio_1_a, <i>hrdi_Priority_t</i> Prio_2_a);</font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* HRDI_PRIO_LEVEL_MODEL */</font></font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> HRDI_INTR_MASK_MODEL</font><font color="#6920ac">/* same as hrdi_Mask() but defines for HRDI_INTR_MASK_MODEL only. * The only purpose of this definition is to catch incompatibility problems * when porting existing software into different CPU platform */</font><b><font color='DarkGreen'>#define</font></b> <font color="maroon"><a name="hrdi_VectorMask">hrdi_VectorMask</a></font>(_Vector_a) hrdi_Mask(_Vector_a)<b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* HRDI_INTR_MASK_MODEL */</font></font><font color="#6920ac">/* ===== END OF THE DEFINITION FILE ===== */</font><b><font color='DarkGreen'>#ifdef</font></b><font color="maroon"> __cplusplus</font>}<b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* __cplusplus */</font></font><b><font color='DarkGreen'>#endif</font></b><font color="maroon"> <font color="#6920ac">/* __HWI_DEFS__H */</font></font></pre></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?