skeleton for lab1
Dependencies: AvailableMemory mbed-rtos mbed
Fork of helloaabbc by
mbed-rtos/rtx/os_tcb.h@1:55e99f6e2aa5, 2014-04-04 (annotated)
- Committer:
- mbed36372
- Date:
- Fri Apr 04 21:31:22 2014 +0000
- Revision:
- 1:55e99f6e2aa5
- Parent:
- 0:1c8f2727e9f5
SP14_lab1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
y7jin | 0:1c8f2727e9f5 | 1 | #ifndef OS_TCB_H |
y7jin | 0:1c8f2727e9f5 | 2 | #define OS_TCB_H |
y7jin | 0:1c8f2727e9f5 | 3 | |
y7jin | 0:1c8f2727e9f5 | 4 | /* Types */ |
y7jin | 0:1c8f2727e9f5 | 5 | typedef char S8; |
y7jin | 0:1c8f2727e9f5 | 6 | typedef unsigned char U8; |
y7jin | 0:1c8f2727e9f5 | 7 | typedef short S16; |
y7jin | 0:1c8f2727e9f5 | 8 | typedef unsigned short U16; |
y7jin | 0:1c8f2727e9f5 | 9 | typedef int S32; |
y7jin | 0:1c8f2727e9f5 | 10 | typedef unsigned int U32; |
y7jin | 0:1c8f2727e9f5 | 11 | typedef long long S64; |
y7jin | 0:1c8f2727e9f5 | 12 | typedef unsigned long long U64; |
y7jin | 0:1c8f2727e9f5 | 13 | typedef unsigned char BIT; |
y7jin | 0:1c8f2727e9f5 | 14 | typedef unsigned int BOOL; |
y7jin | 0:1c8f2727e9f5 | 15 | typedef void (*FUNCP)(void); |
y7jin | 0:1c8f2727e9f5 | 16 | |
y7jin | 0:1c8f2727e9f5 | 17 | typedef struct OS_TCB { |
y7jin | 0:1c8f2727e9f5 | 18 | /* General part: identical for all implementations. */ |
y7jin | 0:1c8f2727e9f5 | 19 | U8 cb_type; /* Control Block Type */ |
y7jin | 0:1c8f2727e9f5 | 20 | U8 state; /* Task state */ |
y7jin | 0:1c8f2727e9f5 | 21 | U8 prio; /* Execution priority */ |
y7jin | 0:1c8f2727e9f5 | 22 | U8 task_id; /* Task ID value for optimized TCB access */ |
y7jin | 0:1c8f2727e9f5 | 23 | struct OS_TCB *p_lnk; /* Link pointer for ready/sem. wait list */ |
y7jin | 0:1c8f2727e9f5 | 24 | struct OS_TCB *p_rlnk; /* Link pointer for sem./mbx lst backwards */ |
y7jin | 0:1c8f2727e9f5 | 25 | struct OS_TCB *p_dlnk; /* Link pointer for delay list */ |
y7jin | 0:1c8f2727e9f5 | 26 | struct OS_TCB *p_blnk; /* Link pointer for delay list backwards */ |
y7jin | 0:1c8f2727e9f5 | 27 | U16 delta_time; /* Time until time out */ |
y7jin | 0:1c8f2727e9f5 | 28 | U16 interval_time; /* Time interval for periodic waits */ |
y7jin | 0:1c8f2727e9f5 | 29 | U16 events; /* Event flags */ |
y7jin | 0:1c8f2727e9f5 | 30 | U16 waits; /* Wait flags */ |
y7jin | 0:1c8f2727e9f5 | 31 | void **msg; /* Direct message passing when task waits */ |
y7jin | 0:1c8f2727e9f5 | 32 | |
y7jin | 0:1c8f2727e9f5 | 33 | /* Hardware dependant part: specific for CM processor */ |
y7jin | 0:1c8f2727e9f5 | 34 | U8 stack_frame; /* Stack frame: 0=Basic, 1=Extended */ |
y7jin | 0:1c8f2727e9f5 | 35 | U8 reserved; |
y7jin | 0:1c8f2727e9f5 | 36 | U16 priv_stack; /* Private stack size in bytes */ |
y7jin | 0:1c8f2727e9f5 | 37 | U32 tsk_stack; /* Current task Stack pointer (R13) */ |
y7jin | 0:1c8f2727e9f5 | 38 | U32 *stack; /* Pointer to Task Stack memory block */ |
y7jin | 0:1c8f2727e9f5 | 39 | |
y7jin | 0:1c8f2727e9f5 | 40 | /* Library dependant part */ |
y7jin | 0:1c8f2727e9f5 | 41 | #if defined (__CC_ARM) && !defined (__MICROLIB) |
y7jin | 0:1c8f2727e9f5 | 42 | /* A memory space for arm standard library. */ |
y7jin | 0:1c8f2727e9f5 | 43 | U32 std_libspace[96/4]; |
y7jin | 0:1c8f2727e9f5 | 44 | #endif |
y7jin | 0:1c8f2727e9f5 | 45 | |
y7jin | 0:1c8f2727e9f5 | 46 | /* Task entry point used for uVision debugger */ |
y7jin | 0:1c8f2727e9f5 | 47 | FUNCP ptask; /* Task entry address */ |
y7jin | 0:1c8f2727e9f5 | 48 | } *P_TCB; |
y7jin | 0:1c8f2727e9f5 | 49 | |
y7jin | 0:1c8f2727e9f5 | 50 | #endif |