lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /************************************************************************
|
| 2 | * °æÈ¨ËùÓÐ (C)2001,ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
|
| 3 | *
|
| 4 | * ÎļþÃû³Æ£º base_api.h
|
| 5 | * Îļþ±êʶ£º
|
| 6 | * ÄÚÈÝÕªÒª£º
|
| 7 | *
|
| 8 | * ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
|
| 9 | * ---------------------------------------------------------------------
|
| 10 | * 2007/11/24 V0.5 ¹¨Òí create
|
| 11 | ************************************************************************/
|
| 12 |
|
| 13 | #ifndef BASE_API_H_
|
| 14 | #define BASE_API_H_
|
| 15 | /**************************************************************************
|
| 16 | * Í·Îļþ°üº¬ *
|
| 17 | **************************************************************************/
|
| 18 | #include "oss_api.h"
|
| 19 | #include "base_pub.h"
|
| 20 |
|
| 21 |
|
| 22 | /**************************************************************************
|
| 23 | * ³£Á¿ *
|
| 24 | **************************************************************************/
|
| 25 |
|
| 26 |
|
| 27 | /**************************************************************************
|
| 28 | * ºê¶¨Òå *
|
| 29 | **************************************************************************/
|
| 30 | /*KangShuJie 2008.04.03*/
|
| 31 | #ifndef CLOCK_TICK
|
| 32 | #define CLOCK_TICK 4615385
|
| 33 | #endif
|
| 34 |
|
| 35 | #define P_many_receiver 126
|
| 36 | #define P_no_receiver 125
|
| 37 |
|
| 38 |
|
| 39 | #define HISR_ENTRY_CONG(HISR_NAME,ENTRY,PRIO,STACK_SIZE) \
|
| 40 | {#HISR_NAME"HISR",ENTRY, &HISR_NAME##_HISR_control,STACK_SIZE,PRIO}
|
| 41 |
|
| 42 | #define PROCESS_ENTRY(PROC_NAME,INSTANCE,ENTRY,PRIO,TIME_SLICE,STACK_SIZE) \
|
| 43 | #PROC_NAME":"#INSTANCE, ENTRY, &PROC_NAME##INSTANCE##_task, STACK_SIZE, \
|
| 44 | PRIO, TIME_SLICE, { ( P_##PROC_NAME + INSTANCE - 1 ), (queue_table+P_##PROC_NAME+INSTANCE-1) }
|
| 45 |
|
| 46 | #define SIGNAL_NAME(SIG_NAME, SIG_IDNODE) \
|
| 47 | (XSIGTYPE)(SIG_NAME & (SIGREFTYPE)0xFFFFFFFF)
|
| 48 |
|
| 49 | #define NU_SUSPEND 0xFFFFFFFFUL
|
| 50 |
|
| 51 | #define NU_MAX_NAME 8
|
| 52 |
|
| 53 | #define SDL_pid SDL_PId
|
| 54 | #define SDL_Pid SDL_PId
|
| 55 |
|
| 56 | #define SIGREFTYPE UINT32
|
| 57 |
|
| 58 | #define XINPUTREFTYPE SIGREFTYPE
|
| 59 |
|
| 60 | #define XSIGTYPE SIGREFTYPE
|
| 61 |
|
| 62 | #define XSIGNALHEADERTYPE xSignalHeaderRec
|
| 63 |
|
| 64 | /*SDLÈÎÎñ״̬*/
|
| 65 | #define xInput (xInputAction)0
|
| 66 | #define xSave (xInputAction)1
|
| 67 | #define xDiscard (xInputAction)2
|
| 68 | #define xEnablCond (xInputAction)3
|
| 69 | #define xPrioInput (xInputAction)4
|
| 70 | #define xNotInSignalSet (xInputAction)5
|
| 71 |
|
| 72 | #define SDL_NULL (SDL_PId)0
|
| 73 |
|
| 74 | #define STARTUP_SIGNAL_NAME SIGNAL_NAME(~0, 0)
|
| 75 |
|
| 76 | #define OSS_TASKSELFID_BEGIN 0x00007f00
|
| 77 |
|
| 78 | #define MS_OS_CRITICAL_SECTION_SUPPORT 1
|
| 79 |
|
| 80 | /**************************************************************************
|
| 81 | * Êý¾ÝÀàÐÍ *
|
| 82 | **************************************************************************/
|
| 83 | /*Ïß³ÌÈë¿Úº¯ÊýÀàÐÍ*/
|
| 84 | typedef void (*ENTRY)(unsigned long, void *);
|
| 85 | typedef void (*HISRENTRY)(void);
|
| 86 |
|
| 87 | typedef struct s_queue *QID;
|
| 88 |
|
| 89 | typedef QID SDL_PId;
|
| 90 |
|
| 91 | typedef struct xSignalHeaderStruct *xSignalHeader;
|
| 92 | typedef struct xTimerHeaderStruct *xTimerHeader;
|
| 93 |
|
| 94 | /**************************************************************************
|
| 95 | * Êý¾Ý½á¹¹ *
|
| 96 | **************************************************************************/
|
| 97 | /*HISRÈÎÎñ¿ØÖÆ¿é*/
|
| 98 | typedef struct NU_HISR_STRUCT{
|
| 99 | UNSIGNED words[22];
|
| 100 | VOID(*hisrEntry)(VOID);
|
| 101 | ZOSS_THREAD_ID hisrTaskId;
|
| 102 | } NU_HISR;
|
| 103 |
|
| 104 | /*Ïß³ÌÈë²Î£¬±£´æÕæÕýµÄÈë¿Úº¯ÊýºÍ²ÎÊý*/
|
| 105 | typedef struct entryCb{
|
| 106 | ENTRY entry;
|
| 107 | unsigned long argc;
|
| 108 | VOID *argv;
|
| 109 | }EntryCB;
|
| 110 |
|
| 111 | /*HISRÏß³ÌÈë²Î£¬±£´æÈë¿Úº¯Êý*/
|
| 112 | typedef struct hisrEntryCb{
|
| 113 | HISRENTRY entry;
|
| 114 | }HisrEntryCB;
|
| 115 |
|
| 116 | /*´æ·ÅSDLÈÎÎñµÄIDºÍͨѶID*/
|
| 117 | struct args{
|
| 118 | UINT32 self_id;
|
| 119 | SDL_PId self;
|
| 120 | };
|
| 121 |
|
| 122 | /*SDLÈÎÎñºÍÏ̵߳ǼDZí*/
|
| 123 | struct process_desc{
|
| 124 | CHAR *name;
|
| 125 | VOID (*entry)(UNSIGNED, VOID *);
|
| 126 | ZOSS_THREAD_ID task;
|
| 127 | UNSIGNED stack_size;
|
| 128 | UINT32 prio;
|
| 129 | UNSIGNED time_slice;
|
| 130 | struct args args;
|
| 131 | };
|
| 132 |
|
| 133 | /*HISRÈÎÎñµÇ¼Ç±í*/
|
| 134 | struct hisr_desc{
|
| 135 | CHAR *name;
|
| 136 | VOID (*entry)( VOID );
|
| 137 | NU_HISR *hcb;
|
| 138 | UNSIGNED stack_size;
|
| 139 | UINT32 prio;
|
| 140 | };
|
| 141 |
|
| 142 | typedef struct NU_PROTECT_STRUCT
|
| 143 | {
|
| 144 | UNSIGNED words[2];
|
| 145 | }NU_PROTECT;
|
| 146 |
|
| 147 | /*ÐźÅÁ¿±êʶ*/
|
| 148 | typedef struct NU_SEMAPHORE_STRUCT{
|
| 149 | ZOSS_SEMAPHORE_ID sem_id;
|
| 150 | UNSIGNED initial_count;
|
| 151 | DATA_ELEMENT sm_fifo_suspend;
|
| 152 | }NU_SEMAPHORE;
|
| 153 |
|
| 154 | /*SDLÈÎÎñÏûϢͷ*/
|
| 155 | typedef struct xSignalHeaderStruct{
|
| 156 | xSignalHeader pred;
|
| 157 | xSignalHeader succ;
|
| 158 | SIGREFTYPE SignalCode;
|
| 159 | UINT32 sender_id;
|
| 160 | SDL_PId Sender;
|
| 161 | }xSignalHeaderRec;
|
| 162 |
|
| 163 | /*SDLÈÎÎñͨѶID*/
|
| 164 | typedef struct s_queue{
|
| 165 | #if 0
|
| 166 | ZOSS_THREAD_ID thread_id;
|
| 167 | #endif
|
| 168 | xSignalHeaderRec list;
|
| 169 | ZOSS_SEMAPHORE_ID events;
|
| 170 | ZOSS_MUTEX_ID mutex;
|
| 171 | VOID *ECB;
|
| 172 | }t_queue;
|
| 173 |
|
| 174 | /*SDLÈÎÎñÏêϸÐÅÏ¢£¬Ã¿¸öSDLÈÎÎñ×Ô¼ºÎ¬»¤*/
|
| 175 | typedef struct process_vars{
|
| 176 | SDL_PId Offspring;
|
| 177 | SDL_PId Parent;
|
| 178 | SDL_PId Self;
|
| 179 | SDL_PId Sender;
|
| 180 | xSignalHeaderRec *yInSignalPtr;
|
| 181 | xSignalHeaderRec SaveQ;
|
| 182 | xSignalHeader CurrentInSaveQ;
|
| 183 | UINT8 xState;
|
| 184 | XINPUTREFTYPE RestartAddress;
|
| 185 | UINT32 SelfId;
|
| 186 | }t_process_vars;
|
| 187 |
|
| 188 | /*SDLÈÎÎñ×´Ì¬×ªÒÆ±í*/
|
| 189 | typedef struct s_trans_desc{
|
| 190 | const xInputAction *ystah;
|
| 191 | const XINPUTREFTYPE *ystai;
|
| 192 | }t_trans_desc;
|
| 193 |
|
| 194 | /*¶¨Ê±Æ÷¿ØÖƿ飬¿ÉÒÔµ±×÷ÏûϢͷʹÓÃ*/
|
| 195 | typedef struct xTimerHeaderStruct{
|
| 196 | xTimerHeader ee_succ;
|
| 197 | xTimerHeader le_succ;
|
| 198 | SIGREFTYPE SignalCode;
|
| 199 | SDL_PId Sender;
|
| 200 | SdlTimeSpec ee_time;
|
| 201 | SdlTimeSpec le_time;
|
| 202 | t_timer_param param;
|
| 203 | }xTimerHeaderRec;
|
| 204 |
|
| 205 | #if 0
|
| 206 | #define MAXIMUMTIMER 1024
|
| 207 | typedef struct _TimerContext
|
| 208 | {
|
| 209 | char timerName[MAX_THREADNAME_LEN];/* ¶¨Ê±Æ÷Ãû³Æ ,×î´óֵͬÏß³ÌÃû*/
|
| 210 | ZOSS_TIMER_FUN timerFun; /* ¶¨Ê±Æ÷Ö´Ðлص÷º¯Êý */
|
| 211 | UINT32 input; /* »Øµ÷º¯ÊýÈë¿Ú²ÎÊý */
|
| 212 | UINT32 timer_expire; /* ¶¨Ê±Æ÷¶¨Ê±³¬Ê±Ê±¼ä */
|
| 213 | UINT32 auto_activate; /* ¶¨Ê±Æ÷ÊÇ·ñ¸Õ´´½¨ºÃ¾Í¼¤»î */
|
| 214 | BOOL active; /* µ±Ç°¶¨Ê±Æ÷ÊÇ·ñ´¦ÓÚ¼¤»î״̬ */
|
| 215 | UINT32 index; /* µ±Ç°ÏîÉÏÏÂÎĵÄË÷Òý */
|
| 216 | ZOSS_TIMER_ID timerid; /* ¶¨Ê±Æ÷µÄID */
|
| 217 | HANDLE threadHandle; /* ¶¨Ê±Æ÷ËùÔÚÏ̵߳ľä±ú */
|
| 218 | BOOL isInUse; /* µ±Ç°ÏîÉÏÏÂÎÄÊÇ·ñÒѾ±»Ê¹Óà */
|
| 219 | BOOL cycle; /* µ±Ç°¶¨Ê±Æ÷ÊÇÖÜÆÚÐԵϹÊÇÖ»Ö´ÐÐÒ»´Î */
|
| 220 | }TimerContext;
|
| 221 | #endif
|
| 222 |
|
| 223 | /**************************************************************************
|
| 224 | * È«¾Öº¯ÊýÔÐÍ *
|
| 225 | **************************************************************************/
|
| 226 | /*===========================================*/
|
| 227 | /*ϵͳ¹ÜÀíÄ£¿é*/
|
| 228 | /*===========================================*/
|
| 229 | /**************************************************************************
|
| 230 | * º¯ÊýÃû³Æ£º nu_is_booting
|
| 231 | * ¹¦ÄÜÃèÊö£º ¼ì²âÊÇ·ñ³õʼ»¯Íê³É
|
| 232 | * ²ÎÊý˵Ã÷£º (IN)
|
| 233 | (OUT)
|
| 234 | * ·µ »Ø Öµ£º TURE: the system is booted
|
| 235 | FALSE: not completed
|
| 236 | * ÆäËü˵Ã÷£º
|
| 237 | **************************************************************************/
|
| 238 | extern SINT32 nu_is_booting(VOID);
|
| 239 |
|
| 240 | /**************************************************************************
|
| 241 | * º¯ÊýÃû³Æ£º SDL_Task_Start
|
| 242 | * ¹¦ÄÜÃèÊö£º Æô¶¯SDL ÈÎÎñ
|
| 243 | * ²ÎÊý˵Ã÷£º (IN)
|
| 244 | process:
|
| 245 | staticEntry:
|
| 246 | (OUT)
|
| 247 | * ·µ »Ø Öµ£º ³É¹¦·´»ØZOSS_SUCCESS£¬Ê§°Ü·´»ØZOSS_ERROR
|
| 248 | * ÆäËü˵Ã÷£º
|
| 249 | **************************************************************************/
|
| 250 | extern UINT32 SDL_Task_Start(struct process_desc *process);
|
| 251 |
|
| 252 | /**************************************************************************
|
| 253 | * º¯ÊýÃû³Æ£º Non_SDL_Task_Start
|
| 254 | * ¹¦ÄÜÃèÊö£º Æô¶¯SDL ÈÎÎñ
|
| 255 | * ²ÎÊý˵Ã÷£º (IN)
|
| 256 | process:
|
| 257 | additionalEntry:
|
| 258 | (OUT)
|
| 259 | * ·µ »Ø Öµ£º ³É¹¦·´»ØZOSS_SUCCESS£¬Ê§°Ü·´»ØZOSS_ERROR
|
| 260 | * ÆäËü˵Ã÷£º
|
| 261 | **************************************************************************/
|
| 262 | extern UINT32 Non_SDL_Task_Start(struct process_desc *process);
|
| 263 |
|
| 264 | /**************************************************************************
|
| 265 | * º¯ÊýÃû³Æ£º HIRS_Task_Start
|
| 266 | * ¹¦ÄÜÃèÊö£º Æô¶¯HISR ÈÎÎñ
|
| 267 | * ²ÎÊý˵Ã÷£º (IN)
|
| 268 | hisr:
|
| 269 | (OUT)
|
| 270 | * ·µ »Ø Öµ£º ³É¹¦·´»ØZOSS_SUCCESS£¬Ê§°Ü·´»ØZOSS_ERROR
|
| 271 | * ÆäËü˵Ã÷£º
|
| 272 | **************************************************************************/
|
| 273 | extern UINT32 HIRS_Task_Start(struct hisr_desc *hisr);
|
| 274 |
|
| 275 | /*===========================================*/
|
| 276 | /*HISRÈÎÎñ¹ÜÀíÄ£¿é*/
|
| 277 | /*===========================================*/
|
| 278 | /**************************************************************************
|
| 279 | * º¯ÊýÃû³Æ: NU_Create_HISR
|
| 280 | * ¹¦ÄÜÃèÊö: ´´½¨HISRÏß³Ì
|
| 281 | * ²ÎÊý˵Ã÷: hisr:HISRÖ¸Õë
|
| 282 | name:Ïß³ÌÃû³Æ
|
| 283 | hisr_entry:Ïß³ÌÈë¿Úº¯Êý
|
| 284 | priority:ÓÅÏȼ¶
|
| 285 | stack_address:Õ»µØÖ·
|
| 286 | stack_size:Õ»´óС
|
| 287 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 288 | * ÆäËü˵Ã÷:
|
| 289 | **************************************************************************/
|
| 290 | extern UINT32 NU_Create_HISR(NU_HISR *hisr, CHAR *name, VOID (*hisr_entry)(VOID),
|
| 291 | OPTION priority, VOID *stack_address, UNSIGNED stack_size);
|
| 292 |
|
| 293 | /**************************************************************************
|
| 294 | * º¯ÊýÃû³Æ: NU_Activate_HISR
|
| 295 | * ¹¦ÄÜÃèÊö: ¼¤»îHISRÏß³Ì
|
| 296 | * ²ÎÊý˵Ã÷: HISRÖ¸Õë
|
| 297 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 298 | * ÆäËü˵Ã÷:
|
| 299 | **************************************************************************/
|
| 300 | extern UINT32 NU_Activate_HISR(NU_HISR *hisr);
|
| 301 |
|
| 302 | /**************************************************************************
|
| 303 | * º¯ÊýÃû³Æ: NU_Init_HISR_Sem
|
| 304 | * ¹¦ÄÜÃèÊö: ³õʼ»¯HISRÏ̵߳ĿìËÙÐźÅÁ¿
|
| 305 | * ²ÎÊý˵Ã÷:
|
| 306 | * ·µ »Ø Öµ:
|
| 307 | * ÆäËü˵Ã÷:
|
| 308 | **************************************************************************/
|
| 309 | extern VOID NU_Init_HISR_Sem(VOID);
|
| 310 | /**************************************************************************
|
| 311 | * º¯ÊýÃû³Æ: NU_Wait_HISR_Sem
|
| 312 | * ¹¦ÄÜÃèÊö: µÈ´ý¿ìËÙÐźÅÁ¿±»ÊÍ·Å
|
| 313 | * ²ÎÊý˵Ã÷:
|
| 314 | * ·µ »Ø Öµ:
|
| 315 | * ÆäËü˵Ã÷:
|
| 316 | **************************************************************************/
|
| 317 | extern VOID NU_Wait_HISR_Sem(VOID);
|
| 318 |
|
| 319 | /**************************************************************************
|
| 320 | * º¯ÊýÃû³Æ: NU_Delete_HISR
|
| 321 | * ¹¦ÄÜÃèÊö: ɾ³ýHISR
|
| 322 | * ²ÎÊý˵Ã÷: ÎÞ
|
| 323 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 324 | * ÆäËü˵Ã÷:
|
| 325 | **************************************************************************/
|
| 326 | // P98C-YXS extern UINT32 NU_Delete_HISR(NU_HISR *hisr);
|
| 327 |
|
| 328 | /**************************************************************************
|
| 329 | * º¯ÊýÃû³Æ: NU_Current_HISR_Pointer
|
| 330 | * ¹¦ÄÜÃèÊö: »ñµÃµ±Ç°HISRÖ¸Õë
|
| 331 | * ²ÎÊý˵Ã÷: ÎÞ
|
| 332 | * ·µ »Ø Öµ: »ñµÃµ±Ç°HISRÖ¸Õë
|
| 333 | * ÆäËü˵Ã÷:
|
| 334 | **************************************************************************/
|
| 335 | // P98C-YXS extern NU_HISR *NU_Current_HISR_Pointer(VOID);
|
| 336 |
|
| 337 | /**************************************************************************
|
| 338 | * º¯ÊýÃû³Æ: NU_Current_Task_Pointer
|
| 339 | * ¹¦ÄÜÃèÊö: »ñµÃµ±Ç°ÈÎÎñÖ¸Õë
|
| 340 | * ²ÎÊý˵Ã÷: ÎÞ
|
| 341 | * ·µ »Ø Öµ: µ±Ç°ÈÎÎñÖ¸Õë
|
| 342 | * ÆäËü˵Ã÷: ÖжÏÏ̷߳µ»Ø¿Õ
|
| 343 | **************************************************************************/
|
| 344 | extern VOID *NU_Current_Task_Pointer(VOID);
|
| 345 |
|
| 346 | /**************************************************************************
|
| 347 | * º¯ÊýÃû³Æ: NU_Create_Semaphore
|
| 348 | * ¹¦ÄÜÃèÊö: ´´½¨ÐźÅÁ¿
|
| 349 | * ²ÎÊý˵Ã÷: semaphore£ºÐźÅÁ¿Ö¸Õë
|
| 350 | name:ÐźÅÁ¿Ãû³Æ
|
| 351 | initial_count:³õʼֵ
|
| 352 | suspend_type:ÀàÐÍ
|
| 353 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 354 | * ÆäËü˵Ã÷:
|
| 355 | **************************************************************************/
|
| 356 | extern UINT32 NU_Create_Semaphore(NU_SEMAPHORE *semaphore, CHAR *name,
|
| 357 | UNSIGNED initial_count, OPTION suspend_type);
|
| 358 |
|
| 359 | /**************************************************************************
|
| 360 | * º¯ÊýÃû³Æ: NU_Delete_Semaphore
|
| 361 | * ¹¦ÄÜÃèÊö: ɾ³ýÐźÅÁ¿
|
| 362 | * ²ÎÊý˵Ã÷: semaphore:ÐźÅÁ¿Ö¸Õë
|
| 363 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 364 | * ÆäËü˵Ã÷:
|
| 365 | **************************************************************************/
|
| 366 | extern UINT32 NU_Delete_Semaphore(NU_SEMAPHORE *semaphore);
|
| 367 |
|
| 368 | /**************************************************************************
|
| 369 | * º¯ÊýÃû³Æ: NU_Obtain_Semaphore
|
| 370 | * ¹¦ÄÜÃèÊö: »ñµÃÐźÅÁ¿
|
| 371 | * ²ÎÊý˵Ã÷: semaphore:ÐźÅÁ¿Ö¸Õë
|
| 372 | suspend:ÀàÐÍ
|
| 373 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 374 | * ÆäËü˵Ã÷:
|
| 375 | **************************************************************************/
|
| 376 | extern UINT32 NU_Obtain_Semaphore(NU_SEMAPHORE *semaphore, UNSIGNED suspend);
|
| 377 |
|
| 378 | /**************************************************************************
|
| 379 | * º¯ÊýÃû³Æ: NU_Release_Semaphore
|
| 380 | * ¹¦ÄÜÃèÊö: ÊÍ·ÅÐźÅÁ¿
|
| 381 | * ²ÎÊý˵Ã÷: semaphore:ÐźÅÁ¿Ö¸Õë
|
| 382 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 383 | * ÆäËü˵Ã÷:
|
| 384 | **************************************************************************/
|
| 385 | extern UINT32 NU_Release_Semaphore(NU_SEMAPHORE *semaphore);
|
| 386 |
|
| 387 | /**************************************************************************
|
| 388 | * º¯ÊýÃû³Æ: NU_Reset_Semaphore
|
| 389 | * ¹¦ÄÜÃèÊö: ÖØÉèÐźÅÁ¿
|
| 390 | * ²ÎÊý˵Ã÷: semaphore:ÐźÅÁ¿Ö¸Õë
|
| 391 | initial_count:³õʼֵ
|
| 392 | * ·µ »Ø Öµ: ÕýÈ··µ»ØZOSS_SUCCESS£¬´íÎó·µ»ØZOSS_ERROR
|
| 393 | * ÆäËü˵Ã÷:
|
| 394 | **************************************************************************/
|
| 395 | extern UINT32 NU_Reset_Semaphore(NU_SEMAPHORE *semaphore, UNSIGNED initial_count);
|
| 396 |
|
| 397 | /*===========================================*/
|
| 398 | /*Òì³£´¦ÀíÄ£¿é*/
|
| 399 | /*===========================================*/
|
| 400 | /**************************************************************************
|
| 401 | * º¯ÊýÃû³Æ£ºnu_exception
|
| 402 | * ¹¦ÄÜÃèÊö£º Òì³£´¦Àí
|
| 403 | * ²ÎÊý˵Ã÷£º (IN)
|
| 404 | line_number:ÐÐÊý
|
| 405 | filename:ÎļþÃû
|
| 406 | un_status:״ֵ̬
|
| 407 | (OUT)
|
| 408 | * ·µ »Ø Öµ£º ÎÞ
|
| 409 | * ÆäËü˵Ã÷£º
|
| 410 | **************************************************************************/
|
| 411 | // P98C-YXS extern VOID nu_exception (SINT32 line_number, CHAR *filename, STATUS nu_status);
|
| 412 |
|
| 413 | /*===========================================*/
|
| 414 | /*ÄÚ´æ¹ÜÀíÄ£¿é*/
|
| 415 | /*===========================================*/
|
| 416 | /**************************************************************************
|
| 417 | * º¯ÊýÃû³Æ: ps_calloc
|
| 418 | * ¹¦ÄÜÃèÊö: ·ÖÅäÒ»×é¿Õ¼ä
|
| 419 | * ²ÎÊý˵Ã÷: (IN)
|
| 420 | nel:¿éÊý
|
| 421 | size:ÿ¿éµÄ´óС
|
| 422 | (OUT)
|
| 423 | * ·µ »Ø Öµ: ÎÞ
|
| 424 | * ÆäËü˵Ã÷:
|
| 425 | **************************************************************************/
|
| 426 | extern VOID *ps_calloc(size_t nel, size_t size);
|
| 427 |
|
| 428 | /**************************************************************************
|
| 429 | * º¯ÊýÃû³Æ: ps_malloc
|
| 430 | * ¹¦ÄÜÃèÊö: ´Ó¶ÑÖзÖÅä¿Õ¼ä
|
| 431 | * ²ÎÊý˵Ã÷: (IN)
|
| 432 | size:´óС
|
| 433 | (OUT)
|
| 434 | * ·µ »Ø Öµ: ÎÞ
|
| 435 | * ÆäËü˵Ã÷:
|
| 436 | **************************************************************************/
|
| 437 | extern VOID *ps_malloc(size_t size);
|
| 438 |
|
| 439 | /**************************************************************************
|
| 440 | * º¯ÊýÃû³Æ: zrealloc
|
| 441 | * ¹¦ÄÜÃèÊö: ´ÓзÖÅä¿Õ¼ä
|
| 442 | * ²ÎÊý˵Ã÷: (IN)
|
| 443 | block:ÔÓÐÄÚ´æÖ¸Õë
|
| 444 | newsize:еĴóС
|
| 445 | (OUT)
|
| 446 | * ·µ »Ø Öµ: ÎÞ
|
| 447 | * ÆäËü˵Ã÷:
|
| 448 | **************************************************************************/
|
| 449 | extern VOID *zrealloc(void *block, size_t newsize);
|
| 450 |
|
| 451 | /**************************************************************************
|
| 452 | * º¯ÊýÃû³Æ: ps_free
|
| 453 | * ¹¦ÄÜÃèÊö: Êͷſռä
|
| 454 | * ²ÎÊý˵Ã÷: (IN)
|
| 455 | memp:ÄÚ´æÖ¸Õë
|
| 456 | (OUT)
|
| 457 | * ·µ »Ø Öµ: ÎÞ
|
| 458 | * ÆäËü˵Ã÷:
|
| 459 | **************************************************************************/
|
| 460 | extern VOID ps_free(void *memp);
|
| 461 |
|
| 462 | #if 0
|
| 463 | extern VOID *malloc_dma_buffer(size_t size);
|
| 464 | extern VOID free_dma_buffer(void *ptr);
|
| 465 | #endif
|
| 466 |
|
| 467 | /*===========================================*/
|
| 468 | /*ÏûÏ¢¹ÜÀíÄ£¿é*/
|
| 469 | /*===========================================*/
|
| 470 | /**************************************************************************
|
| 471 | * º¯ÊýÃû³Æ: alloc_sig_loc
|
| 472 | * ¹¦ÄÜÃèÊö: ·ÖÅäÏûÏ¢¿Õ¼ä
|
| 473 | * ²ÎÊý˵Ã÷: (IN)
|
| 474 | size:´óС
|
| 475 | file:ÎļþÃû
|
| 476 | line:³õʼֵ
|
| 477 | (OUT)
|
| 478 | * ·µ »Ø Öµ: ÕýÈ··µ»ØÄÚ´æÖ¸Õ룬´íÎó·µ»ØNULL
|
| 479 | * ÆäËü˵Ã÷:
|
| 480 | **************************************************************************/
|
| 481 | extern xSignalHeaderRec *alloc_sig_loc(UINT32 size, CHAR *file, SINT32 line);
|
| 482 | #define alloc_sig(_size) alloc_sig_loc ((_size), __FILE__, __LINE__)
|
| 483 |
|
| 484 | /**************************************************************************
|
| 485 | * º¯ÊýÃû³Æ: free_sig_loc
|
| 486 | * ¹¦ÄÜÃèÊö: ÊÍ·ÅÏûÏ¢¿Õ¼ä
|
| 487 | * ²ÎÊý˵Ã÷: (IN)
|
| 488 | signal_ptr:ÒªÊͷŵÄÄÚ´æÖ¸Õë
|
| 489 | file:ÎļþÃû
|
| 490 | line:³õʼֵ
|
| 491 | (OUT)
|
| 492 | * ·µ »Ø Öµ: ÎÞ
|
| 493 | * ÆäËü˵Ã÷:
|
| 494 | **************************************************************************/
|
| 495 | extern VOID free_sig_loc(xSignalHeaderRec *signal_ptr, CHAR *file, SINT32 line);
|
| 496 | #define free_sig(_sig_ptr) free_sig_loc((_sig_ptr), __FILE__, __LINE__)
|
| 497 |
|
| 498 | /**************************************************************************
|
| 499 | * º¯ÊýÃû³Æ: send_sig_loc
|
| 500 | * ¹¦ÄÜÃèÊö: ÏòÒ»¸öSDLÏ̷߳¢ËÍÏûÏ¢
|
| 501 | * ²ÎÊý˵Ã÷: (IN)
|
| 502 | signal_ptr:ÏûÏ¢¿é
|
| 503 | rec_queue:½ÓÊÕ¶ÓÁÐÍ·Ö¸Õë
|
| 504 | sig_name:ÐźÅÃû
|
| 505 | file:ÎļþÃû
|
| 506 | line:ÐÐÊý
|
| 507 | (OUT)
|
| 508 | * ·µ »Ø Öµ: ÎÞ
|
| 509 | * ÆäËü˵Ã÷:
|
| 510 | **************************************************************************/
|
| 511 | extern void send_sig_loc(
|
| 512 | xSignalHeaderRec *signal_ptr, t_queue *rec_queue, char *sig_name, char *file, int line );
|
| 513 |
|
| 514 | #define send_sig(_signal_ptr,_rec_queue ,_sig_name) \
|
| 515 | send_sig_loc ((_signal_ptr), (_rec_queue),(_sig_name), __FILE__, __LINE__)
|
| 516 |
|
| 517 | /**************************************************************************
|
| 518 | * º¯ÊýÃû³Æ: send_sig_no_to_loc
|
| 519 | * ¹¦ÄÜÃèÊö: ¸ù¾ÝÏûÏ¢ÂëÏòÒ»¸öSDLÏ̷߳¢ËÍÏûÏ¢
|
| 520 | * ²ÎÊý˵Ã÷: (IN)
|
| 521 | signal_ptr:ÏûÏ¢¿é
|
| 522 | signal_cod:ÏûÏ¢Âë
|
| 523 | file:ÎļþÃû
|
| 524 | line:ÐÐÊý
|
| 525 | (OUT)
|
| 526 | * ·µ »Ø Öµ: ÎÞ
|
| 527 | * ÆäËü˵Ã÷: hehaijian for win debug
|
| 528 | **************************************************************************/
|
| 529 | extern void send_sig_no_to_loc (
|
| 530 | xSignalHeaderRec *signal_ptr, unsigned signal_code, CHAR *file, SINT32 line );
|
| 531 |
|
| 532 | #define send_sig_no_to(_signal_ptr, _signal_code, _sig_name ) \
|
| 533 | send_sig_no_to_loc ((_signal_ptr), ( _signal_code), __FILE__, __LINE__)
|
| 534 |
|
| 535 | /**************************************************************************
|
| 536 | * º¯ÊýÃû³Æ: send_startup_sig_loc
|
| 537 | * ¹¦ÄÜÃèÊö: ÏòÒ»¸öSDLÏ̷߳¢ËÍÆô¶¯ÏûÏ¢
|
| 538 | * ²ÎÊý˵Ã÷: (IN)
|
| 539 | rec_queue:ÏòÒ»¸öÏ̷߳¢ËÍÆô¶¯ÏûÏ¢
|
| 540 | file:ÎļþÃû
|
| 541 | line:ÐÐÊý
|
| 542 | (OUT)
|
| 543 | * ·µ »Ø Öµ: ÎÞ
|
| 544 | * ÆäËü˵Ã÷:
|
| 545 | **************************************************************************/
|
| 546 | extern VOID send_startup_sig_loc (
|
| 547 | t_queue *rec_queue, CHAR *file, SINT32 line );
|
| 548 |
|
| 549 | #define send_startup_sig(_rec_queue) \
|
| 550 | send_startup_sig_loc ((_rec_queue), __FILE__, __LINE__)
|
| 551 |
|
| 552 | /**************************************************************************
|
| 553 | * º¯ÊýÃû³Æ: receive_sig_loc
|
| 554 | * ¹¦ÄÜÃèÊö: ½ÓÊÕÏûÏ¢
|
| 555 | * ²ÎÊý˵Ã÷: (IN)
|
| 556 | queue:ÏûÏ¢¶ÓÁÐÍ·
|
| 557 | file:ÎļþÃû
|
| 558 | line:ÐÐÊý
|
| 559 | (OUT)
|
| 560 | * ·µ »Ø Öµ: ÏûÏ¢Ö¸Õë
|
| 561 | * ÆäËü˵Ã÷: ÓÉSDLÈÎÎñµ÷ÓÃ
|
| 562 | **************************************************************************/
|
| 563 | extern xSignalHeaderRec *receive_sig_loc(t_queue *queue, CHAR *file, SINT32 line);
|
| 564 | #define receive_sig(_queue) receive_sig_loc ((_queue), __FILE__, __LINE__)
|
| 565 |
|
| 566 | /*===========================================*/
|
| 567 | /*SDL¶¨Ê±Æ÷¹ÜÀíÄ£¿é*/
|
| 568 | /*===========================================*/
|
| 569 | /**************************************************************************
|
| 570 | * º¯ÊýÃû³Æ: SDL_Set_Dur
|
| 571 | * ¹¦ÄÜÃèÊö: ´´½¨Ò»¸öSDL¶¨Ê±Æ÷
|
| 572 | * ²ÎÊý˵Ã÷: (IN)
|
| 573 | Tick_Expr:¶¨Ê±Æ÷ÖÜÆÚ
|
| 574 | timer_name:¶¨Ê±Æ÷Ãû
|
| 575 | timer_param:¶¨Ê±Æ÷²ÎÊý
|
| 576 | yVarP:Ïß³ÌÐÅÏ¢Ö¸Õë
|
| 577 | (OUT)
|
| 578 | * ·µ »Ø Öµ: ÎÞ
|
| 579 | * ÆäËü˵Ã÷: ÏÈÕÒ¶¨Ê±Æ÷£¬Èç¹ûÕÒµ½Ôò»Ö¸´£¬·ñÔò´´½¨Ò»¸öеÄ
|
| 580 | **************************************************************************/
|
| 581 | extern VOID SDL_Set_Dur(SDL_Duration Tick_Expr, UINT32 timer_name,
|
| 582 | t_timer_param timer_param, t_process_vars *yVarP,BYTE sample_id);
|
| 583 |
|
| 584 | /**************************************************************************
|
| 585 | * º¯ÊýÃû³Æ: SDL_Set_Dur_Ex
|
| 586 | * ¹¦ÄÜÃèÊö: ´´½¨Ò»¸öSDL¶¨Ê±Æ÷
|
| 587 | * ²ÎÊý˵Ã÷: (IN)
|
| 588 | Earliest_Tick_Expr:¶¨Ê±Æ÷×îÔçÖÜÆÚ
|
| 589 | Latest_Tick_Expr:¶¨Ê±Æ÷×îÍíÖÜÆÚ
|
| 590 | timer_name:¶¨Ê±Æ÷Ãû
|
| 591 | timer_param:¶¨Ê±Æ÷²ÎÊý
|
| 592 | yVarP:Ïß³ÌÐÅÏ¢Ö¸Õë
|
| 593 | (OUT)
|
| 594 | * ·µ »Ø Öµ: ÎÞ
|
| 595 | * ÆäËü˵Ã÷: ÏÈÕÒ¶¨Ê±Æ÷£¬Èç¹ûÕÒµ½ÔòÓÃÐÂÖÜÆÚ»Ö¸´£¬·ñÔò´´½¨Ò»¸öеÄ
|
| 596 | **************************************************************************/
|
| 597 | extern VOID SDL_Set_Dur_Ex(SDL_Duration Earliest_Tick_Expr, SDL_Duration Latest_Tick_Expr,
|
| 598 | UINT32 timer_name, t_timer_param timer_param, t_process_vars *yVarP,BYTE sample_id);
|
| 599 |
|
| 600 | /**************************************************************************
|
| 601 | * º¯ÊýÃû³Æ: SDL_Set
|
| 602 | * ¹¦ÄÜÃèÊö: ´´½¨Ò»¸öSDL¶¨Ê±Æ÷
|
| 603 | * ²ÎÊý˵Ã÷: (IN)
|
| 604 | Tick_Expr:¶¨Ê±Æ÷ÖÜÆÚ
|
| 605 | timer_name:¶¨Ê±Æ÷Ãû
|
| 606 | timer_param:¶¨Ê±Æ÷²ÎÊý
|
| 607 | yVarP:Ïß³ÌÐÅÏ¢Ö¸Õë
|
| 608 | (OUT)
|
| 609 | * ·µ »Ø Öµ: ÎÞ
|
| 610 | * ÆäËü˵Ã÷: ÏÈÕÒ¶¨Ê±Æ÷£¬Èç¹ûÕÒµ½Ôò»Ö¸´£¬·ñÔò´´½¨Ò»¸öеÄ
|
| 611 | **************************************************************************/
|
| 612 | // P98C-YXS extern VOID SDL_Set(SDL_Time Time, UINT32 timer_name,
|
| 613 | // P98C-YXS t_timer_param timer_param, t_process_vars *yVarP);
|
| 614 |
|
| 615 | /**************************************************************************
|
| 616 | * º¯ÊýÃû³Æ: SDL_Set_Ex
|
| 617 | * ¹¦ÄÜÃèÊö: ´´½¨Ò»¸öSDL¶¨Ê±Æ÷
|
| 618 | * ²ÎÊý˵Ã÷: (IN)
|
| 619 | Earliest_Tick_Expr:¶¨Ê±Æ÷×îÔçÖÜÆÚ
|
| 620 | Latest_Tick_Expr:¶¨Ê±Æ÷×îÍíÖÜÆÚ
|
| 621 | timer_name:¶¨Ê±Æ÷Ãû
|
| 622 | timer_param:¶¨Ê±Æ÷²ÎÊý
|
| 623 | yVarP:Ïß³ÌÐÅÏ¢Ö¸Õë
|
| 624 | (OUT)
|
| 625 | * ·µ »Ø Öµ: ÎÞ
|
| 626 | * ÆäËü˵Ã÷: ÏÈÕÒ¶¨Ê±Æ÷£¬Èç¹ûÕÒµ½Ôò»Ö¸´£¬·ñÔò´´½¨Ò»¸öеÄ
|
| 627 | **************************************************************************/
|
| 628 | // P98C-YXS extern VOID SDL_Set_Ex(SDL_Time Earliest_Time, SDL_Time Latest_Time, UINT32 timer_name,
|
| 629 | // P98C-YXS t_timer_param timer_param, t_process_vars *yVarP);
|
| 630 |
|
| 631 | /**************************************************************************
|
| 632 | * º¯ÊýÃû³Æ: SDL_Reset
|
| 633 | * ¹¦ÄÜÃèÊö: ɾ³ýÒ»¸öSDL¶¨Ê±Æ÷
|
| 634 | * ²ÎÊý˵Ã÷: (IN)
|
| 635 | timer_name:¶¨Ê±Æ÷Ãû
|
| 636 | timer_param:¶¨Ê±Æ÷²ÎÊý
|
| 637 | yVarP:Ïß³ÌÐÅÏ¢Ö¸Õë
|
| 638 | (OUT)
|
| 639 | * ·µ »Ø Öµ: ÎÞ
|
| 640 | * ÆäËü˵Ã÷:
|
| 641 | **************************************************************************/
|
| 642 | extern VOID SDL_Reset (UINT32 TimerName, t_timer_param timer_param,
|
| 643 | t_process_vars *yVarP,BYTE sample_id);
|
| 644 |
|
| 645 | /**************************************************************************
|
| 646 | * º¯ÊýÃû³Æ: SDL_Active
|
| 647 | * ¹¦ÄÜÃèÊö: ¼ì²é¶¨Ê±Æ÷ÊÇ·ñ´æÔÚ
|
| 648 | * ²ÎÊý˵Ã÷: (IN)
|
| 649 | timer_name:¶¨Ê±Æ÷Ãû
|
| 650 | timer_param:¶¨Ê±Æ÷²ÎÊý
|
| 651 | yVarP:Ïß³ÌÐÅÏ¢Ö¸Õë
|
| 652 | (OUT)
|
| 653 | * ·µ »Ø Öµ: ´æÔÚ·µ»ØTRUE£¬·ñÔò·µ»ØFALSE
|
| 654 | * ÆäËü˵Ã÷:
|
| 655 | **************************************************************************/
|
| 656 | // P98C-YXS extern SDL_Boolean SDL_Active(UINT32 TimerName, t_timer_param timer_param,
|
| 657 | // P98C-YXS t_process_vars *yVarP);
|
| 658 |
|
| 659 | extern SDL_Time RetrieveClock(BYTE sample_id);
|
| 660 |
|
| 661 | extern SDL_Duration SDL_Duration_Lit (SINT32 secs, SINT32 nsecs);
|
| 662 |
|
| 663 | /*===========================================*/
|
| 664 | /*SDLÈÎÎñ¹ÜÀíÄ£¿é*/
|
| 665 | /*===========================================*/
|
| 666 | /**************************************************************************
|
| 667 | * º¯ÊýÃû³Æ: SDL_Create
|
| 668 | * ¹¦ÄÜÃèÊö: ´´½¨Ò»¸öSDLÈÎÎñ
|
| 669 | * ²ÎÊý˵Ã÷: (IN)
|
| 670 | task_entry:ÈÎÎñÈë¿Úº¯Êý
|
| 671 | stack_size:¶ÑÕ»´óС
|
| 672 | self_id:ÈÎÎñID
|
| 673 | prio:ÓÅÏȼ¶
|
| 674 | task_name:ÈÎÎñÃû
|
| 675 | startup_signal:³õʼ»¯ÏûÏ¢
|
| 676 | (OUT)
|
| 677 | * ·µ »Ø Öµ: ÎÞ
|
| 678 | * ÆäËü˵Ã÷:
|
| 679 | **************************************************************************/
|
| 680 | extern SDL_PId SDL_Create (
|
| 681 | VOID ( *task_entry )( UNSIGNED argc, VOID *argv ),
|
| 682 | SINT32 stack_size,
|
| 683 | SINT32 self_id,
|
| 684 | SINT32 prio,
|
| 685 | CHAR *task_name,
|
| 686 | xSignalHeader startup_signal
|
| 687 | );
|
| 688 |
|
| 689 | /**************************************************************************
|
| 690 | * º¯ÊýÃû³Æ: SDL_Stop
|
| 691 | * ¹¦ÄÜÃèÊö: ɾ³ýÒ»¸öSDLÈÎÎñ
|
| 692 | * ²ÎÊý˵Ã÷: (IN)
|
| 693 | varp:Ïß³ÌÐÅÏ¢
|
| 694 | yInSignalPtr:ÏûÏ¢Ö¸Õë
|
| 695 | self_if:ÈÎÎñID
|
| 696 | (OUT)
|
| 697 | * ·µ »Ø Öµ: ÎÞ
|
| 698 | * ÆäËü˵Ã÷: ÔÚÈÎÎñÈë¿ÚÖе÷Óã¬Ò»°ãÓÃÀ´É¾³ý×Ô¼º
|
| 699 | **************************************************************************/
|
| 700 | extern VOID SDL_Stop(t_process_vars *varp, xSignalHeaderRec *yInSignalPtr);
|
| 701 |
|
| 702 | /**************************************************************************
|
| 703 | * º¯ÊýÃû³Æ: SDL_Loop
|
| 704 | * ¹¦ÄÜÃèÊö: Ñ»·½ÓÊÕÏûÏ¢
|
| 705 | * ²ÎÊý˵Ã÷: (IN)
|
| 706 | proc_insig_tab:ÏûϢ״̬Êý×é
|
| 707 | trans_tab:×´Ì¬×ªÒÆ¾ØÕó
|
| 708 | yVarP:Ïß³ÌÐÅÏ¢½á¹¹ÌåÖ¸Õë
|
| 709 | self_id:Ïß³ÌID
|
| 710 | (OUT)
|
| 711 | * ·µ »Ø Öµ: ÏûÏ¢Ö¸Õë
|
| 712 | * ÆäËü˵Ã÷: ÓÐÎÊÌâ
|
| 713 | **************************************************************************/
|
| 714 | extern xSignalHeaderRec *SDL_Loop(const XSIGTYPE *proc_insig_tab,
|
| 715 | const t_trans_desc *trans_tab,
|
| 716 | struct process_vars *yVarP,
|
| 717 | char *file, int line);
|
| 718 |
|
| 719 | #endif
|
| 720 |
|