lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /************************************************************************ |
| 2 | * °æÈ¨ËùÓÐ (C)2007,ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£ |
| 3 | * |
| 4 | * ÎļþÃû³Æ£º ps_hisr.h |
| 5 | * Îļþ±êʶ£º |
| 6 | * ÄÚÈÝÕªÒª£º Ö÷ÒªÌæ»»nucleus½Ó¿ÚΪOSSÏà¹ØµÄ½Ó¿Ú |
| 7 | * |
| 8 | * ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ |
| 9 | * ----------------------------------------------------------------------- |
| 10 | * 2008/06/27 V0.5 ¹¨Òí ´´½¨ |
| 11 | ************************************************************************/ |
| 12 | |
| 13 | #ifndef MS_HISR |
| 14 | #define MS_HISR |
| 15 | |
| 16 | /************************************************************************** |
| 17 | * Í·Îļþ°üº¬ * |
| 18 | **************************************************************************/ |
| 19 | #include "base_api.h" |
| 20 | |
| 21 | /***************************************************************************** |
| 22 | * Typedef hisr_type_f |
| 23 | *****************************************************************************/ |
| 24 | typedef VOID (*hisr_type_f) (VOID); |
| 25 | |
| 26 | /***************************************************************************** |
| 27 | * Typedef ms_hisr_t |
| 28 | *****************************************************************************/ |
| 29 | typedef struct ms_hisr_s |
| 30 | { |
| 31 | /* hisr handling */ |
| 32 | volatile UINT32 event; /* event staring the hisr */ |
| 33 | volatile UINT8 active; /* hisr is active */ |
| 34 | |
| 35 | NU_HISR hisr_cb; /* receive HISR structure */ |
| 36 | VOID *hisr_device; /* must be placed directly after hisr_cb */ |
| 37 | VOID *hisr_stack; /* enable with size */ |
| 38 | } ms_hisr_t; |
| 39 | |
| 40 | |
| 41 | /***************************************************************************** |
| 42 | * Function: ms_hisr_create |
| 43 | *----------------------------------------------------------------------------- |
| 44 | * Purpose: create a new hisr |
| 45 | * |
| 46 | * Parameters: mshisr pointer to hisrtype |
| 47 | * name name |
| 48 | * size of the new hisr |
| 49 | * priority hisr priority |
| 50 | * hisr_type_f hisr function |
| 51 | * hisr_device device to call |
| 52 | * |
| 53 | * Returns: void |
| 54 | * |
| 55 | * Remarks: |
| 56 | *****************************************************************************/ |
| 57 | |
| 58 | extern VOID ms_hisr_create(ms_hisr_t *mshisr, CHAR *name, SINT32 size, |
| 59 | SINT32 priority, hisr_type_f used_hisr, |
| 60 | VOID *hisr_device); |
| 61 | |
| 62 | |
| 63 | /***************************************************************************** |
| 64 | * Function: ms_hisr_free |
| 65 | *----------------------------------------------------------------------------- |
| 66 | * Purpose: frees an created hisr |
| 67 | * |
| 68 | * Parameters: mshisr |
| 69 | * |
| 70 | * Returns: |
| 71 | * |
| 72 | * Remarks: |
| 73 | *****************************************************************************/ |
| 74 | |
| 75 | // P98C-YXS extern VOID ms_hisr_free(ms_hisr_t *mshisr); |
| 76 | |
| 77 | |
| 78 | /***************************************************************************** |
| 79 | * Function: ms_hisr_get_io_associated_to_hisr |
| 80 | *----------------------------------------------------------------------------- |
| 81 | * Purpose: Determines the io descriptor which contains the active HISR |
| 82 | * |
| 83 | * Parameters: None |
| 84 | * |
| 85 | * Returns: The UART descriptor |
| 86 | * |
| 87 | * Remarks: - NU_Current_HISR_Pointer() is a very simple Nucleus function |
| 88 | *****************************************************************************/ |
| 89 | |
| 90 | // P98C-YXS extern VOID *ms_hisr_get_associated(VOID); |
| 91 | |
| 92 | |
| 93 | /***************************************************************************** |
| 94 | * Function: ms_hisr_activate |
| 95 | *----------------------------------------------------------------------------- |
| 96 | * Purpose: activates the hisr |
| 97 | * |
| 98 | * Parameters: mshisr pointer to hisrtype |
| 99 | * |
| 100 | * Returns: void |
| 101 | * |
| 102 | * Remarks: none |
| 103 | *****************************************************************************/ |
| 104 | |
| 105 | extern VOID ms_hisr_activate(ms_hisr_t *mshisr); |
| 106 | |
| 107 | /***************************************************************************** |
| 108 | * Function: ms_hisr_start |
| 109 | *----------------------------------------------------------------------------- |
| 110 | * Purpose: starts the hisr according to the settings of |
| 111 | * event and hisr_active. The event will be set |
| 112 | * |
| 113 | * Parameters: mshisr pointer to hisrtype |
| 114 | * event event which has been set |
| 115 | * |
| 116 | * Returns: void |
| 117 | * |
| 118 | * Remarks: none |
| 119 | *****************************************************************************/ |
| 120 | |
| 121 | // P98C-YXS extern VOID ms_hisr_start(ms_hisr_t *mshisr, UINT32 event); |
| 122 | |
| 123 | |
| 124 | /***************************************************************************** |
| 125 | * Function: ms_hisr_reset_event |
| 126 | *----------------------------------------------------------------------------- |
| 127 | * Purpose: resets the hisr event int the hisr |
| 128 | * |
| 129 | * |
| 130 | * Parameters: mshisr pointer to hisrtype |
| 131 | * event event which has been reset |
| 132 | * |
| 133 | * Returns: void |
| 134 | * |
| 135 | * Remarks: none |
| 136 | *****************************************************************************/ |
| 137 | |
| 138 | // P98C-YXS extern VOID ms_hisr_reset_event(ms_hisr_t *mshisr, UINT32 event); |
| 139 | |
| 140 | |
| 141 | /***************************************************************************** |
| 142 | * Function: ms_hisr_active |
| 143 | *----------------------------------------------------------------------------- |
| 144 | * Purpose: sets the hisr active flag according to the |
| 145 | * status of the hisr |
| 146 | * |
| 147 | * Parameters: mshisr pointer to hisrtype |
| 148 | * active 1 hisr is running |
| 149 | * 0 hisr is stopped |
| 150 | * |
| 151 | * Returns: void |
| 152 | * |
| 153 | * Remarks: none |
| 154 | *****************************************************************************/ |
| 155 | |
| 156 | // P98C-YXS extern VOID ms_hisr_active(ms_hisr_t *mshisr, UINT8 active); |
| 157 | |
| 158 | extern VOID ms_hisr_wait_sem(ms_hisr_t *mshisr); |
| 159 | |
| 160 | #endif |
| 161 | |
| 162 | |