hook os_idle_demon
Fork of mbed-rtos by
rtx/rt_TypeDef.h@7:80173c64d05d, 2012-11-23 (annotated)
- Committer:
- emilmont
- Date:
- Fri Nov 23 10:16:38 2012 +0000
- Revision:
- 7:80173c64d05d
- Parent:
- 6:350b53afb889
Avoid using C++ keyword for C structure filed name
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 6:350b53afb889 | 1 | /*---------------------------------------------------------------------------- |
emilmont | 6:350b53afb889 | 2 | * RL-ARM - RTX |
emilmont | 6:350b53afb889 | 3 | *---------------------------------------------------------------------------- |
emilmont | 6:350b53afb889 | 4 | * Name: RT_TYPEDEF.H |
emilmont | 6:350b53afb889 | 5 | * Purpose: Type Definitions |
emilmont | 6:350b53afb889 | 6 | * Rev.: V4.60 |
emilmont | 6:350b53afb889 | 7 | *---------------------------------------------------------------------------- |
emilmont | 6:350b53afb889 | 8 | * |
emilmont | 6:350b53afb889 | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH |
emilmont | 6:350b53afb889 | 10 | * All rights reserved. |
emilmont | 6:350b53afb889 | 11 | * Redistribution and use in source and binary forms, with or without |
emilmont | 6:350b53afb889 | 12 | * modification, are permitted provided that the following conditions are met: |
emilmont | 6:350b53afb889 | 13 | * - Redistributions of source code must retain the above copyright |
emilmont | 6:350b53afb889 | 14 | * notice, this list of conditions and the following disclaimer. |
emilmont | 6:350b53afb889 | 15 | * - Redistributions in binary form must reproduce the above copyright |
emilmont | 6:350b53afb889 | 16 | * notice, this list of conditions and the following disclaimer in the |
emilmont | 6:350b53afb889 | 17 | * documentation and/or other materials provided with the distribution. |
emilmont | 6:350b53afb889 | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
emilmont | 6:350b53afb889 | 19 | * to endorse or promote products derived from this software without |
emilmont | 6:350b53afb889 | 20 | * specific prior written permission. |
emilmont | 6:350b53afb889 | 21 | * |
emilmont | 6:350b53afb889 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
emilmont | 6:350b53afb889 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
emilmont | 6:350b53afb889 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
emilmont | 6:350b53afb889 | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
emilmont | 6:350b53afb889 | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
emilmont | 6:350b53afb889 | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
emilmont | 6:350b53afb889 | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
emilmont | 6:350b53afb889 | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
emilmont | 6:350b53afb889 | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
emilmont | 6:350b53afb889 | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
emilmont | 6:350b53afb889 | 32 | * POSSIBILITY OF SUCH DAMAGE. |
emilmont | 6:350b53afb889 | 33 | *---------------------------------------------------------------------------*/ |
emilmont | 6:350b53afb889 | 34 | #ifndef RT_TYPE_DEF_H |
emilmont | 6:350b53afb889 | 35 | #define RT_TYPE_DEF_H |
emilmont | 6:350b53afb889 | 36 | |
emilmont | 6:350b53afb889 | 37 | #include "os_tcb.h" |
emilmont | 6:350b53afb889 | 38 | |
emilmont | 6:350b53afb889 | 39 | typedef U32 OS_TID; |
emilmont | 6:350b53afb889 | 40 | typedef void *OS_ID; |
emilmont | 6:350b53afb889 | 41 | typedef U32 OS_RESULT; |
emilmont | 6:350b53afb889 | 42 | |
emilmont | 6:350b53afb889 | 43 | #define TCB_STACKF 32 /* 'stack_frame' offset */ |
emilmont | 6:350b53afb889 | 44 | #define TCB_TSTACK 36 /* 'tsk_stack' offset */ |
emilmont | 6:350b53afb889 | 45 | |
emilmont | 6:350b53afb889 | 46 | typedef struct OS_PSFE { /* Post Service Fifo Entry */ |
emilmont | 6:350b53afb889 | 47 | void *id; /* Object Identification */ |
emilmont | 6:350b53afb889 | 48 | U32 arg; /* Object Argument */ |
emilmont | 6:350b53afb889 | 49 | } *P_PSFE; |
emilmont | 6:350b53afb889 | 50 | |
emilmont | 6:350b53afb889 | 51 | typedef struct OS_PSQ { /* Post Service Queue */ |
emilmont | 6:350b53afb889 | 52 | U8 first; /* FIFO Head Index */ |
emilmont | 6:350b53afb889 | 53 | U8 last; /* FIFO Tail Index */ |
emilmont | 6:350b53afb889 | 54 | U8 count; /* Number of stored items in FIFO */ |
emilmont | 6:350b53afb889 | 55 | U8 size; /* FIFO Size */ |
emilmont | 6:350b53afb889 | 56 | struct OS_PSFE q[1]; /* FIFO Content */ |
emilmont | 6:350b53afb889 | 57 | } *P_PSQ; |
emilmont | 6:350b53afb889 | 58 | |
emilmont | 6:350b53afb889 | 59 | typedef struct OS_TSK { |
emilmont | 6:350b53afb889 | 60 | P_TCB run; /* Current running task */ |
emilmont | 7:80173c64d05d | 61 | P_TCB new_tsk; /* Scheduled task to run */ |
emilmont | 6:350b53afb889 | 62 | } *P_TSK; |
emilmont | 6:350b53afb889 | 63 | |
emilmont | 6:350b53afb889 | 64 | typedef struct OS_ROBIN { /* Round Robin Control */ |
emilmont | 6:350b53afb889 | 65 | P_TCB task; /* Round Robin task */ |
emilmont | 6:350b53afb889 | 66 | U16 time; /* Round Robin switch time */ |
emilmont | 6:350b53afb889 | 67 | U16 tout; /* Round Robin timeout */ |
emilmont | 6:350b53afb889 | 68 | } *P_ROBIN; |
emilmont | 6:350b53afb889 | 69 | |
emilmont | 6:350b53afb889 | 70 | typedef struct OS_XCB { |
emilmont | 6:350b53afb889 | 71 | U8 cb_type; /* Control Block Type */ |
emilmont | 6:350b53afb889 | 72 | struct OS_TCB *p_lnk; /* Link pointer for ready/sem. wait list */ |
emilmont | 6:350b53afb889 | 73 | struct OS_TCB *p_rlnk; /* Link pointer for sem./mbx lst backwards */ |
emilmont | 6:350b53afb889 | 74 | struct OS_TCB *p_dlnk; /* Link pointer for delay list */ |
emilmont | 6:350b53afb889 | 75 | struct OS_TCB *p_blnk; /* Link pointer for delay list backwards */ |
emilmont | 6:350b53afb889 | 76 | U16 delta_time; /* Time until time out */ |
emilmont | 6:350b53afb889 | 77 | } *P_XCB; |
emilmont | 6:350b53afb889 | 78 | |
emilmont | 6:350b53afb889 | 79 | typedef struct OS_MCB { |
emilmont | 6:350b53afb889 | 80 | U8 cb_type; /* Control Block Type */ |
emilmont | 6:350b53afb889 | 81 | U8 state; /* State flag variable */ |
emilmont | 6:350b53afb889 | 82 | U8 isr_st; /* State flag variable for isr functions */ |
emilmont | 6:350b53afb889 | 83 | struct OS_TCB *p_lnk; /* Chain of tasks waiting for message */ |
emilmont | 6:350b53afb889 | 84 | U16 first; /* Index of the message list begin */ |
emilmont | 6:350b53afb889 | 85 | U16 last; /* Index of the message list end */ |
emilmont | 6:350b53afb889 | 86 | U16 count; /* Actual number of stored messages */ |
emilmont | 6:350b53afb889 | 87 | U16 size; /* Maximum number of stored messages */ |
emilmont | 6:350b53afb889 | 88 | void *msg[1]; /* FIFO for Message pointers 1st element */ |
emilmont | 6:350b53afb889 | 89 | } *P_MCB; |
emilmont | 6:350b53afb889 | 90 | |
emilmont | 6:350b53afb889 | 91 | typedef struct OS_SCB { |
emilmont | 6:350b53afb889 | 92 | U8 cb_type; /* Control Block Type */ |
emilmont | 6:350b53afb889 | 93 | U8 mask; /* Semaphore token mask */ |
emilmont | 6:350b53afb889 | 94 | U16 tokens; /* Semaphore tokens */ |
emilmont | 6:350b53afb889 | 95 | struct OS_TCB *p_lnk; /* Chain of tasks waiting for tokens */ |
emilmont | 6:350b53afb889 | 96 | } *P_SCB; |
emilmont | 6:350b53afb889 | 97 | |
emilmont | 6:350b53afb889 | 98 | typedef struct OS_MUCB { |
emilmont | 6:350b53afb889 | 99 | U8 cb_type; /* Control Block Type */ |
emilmont | 6:350b53afb889 | 100 | U8 prio; /* Owner task default priority */ |
emilmont | 6:350b53afb889 | 101 | U16 level; /* Call nesting level */ |
emilmont | 6:350b53afb889 | 102 | struct OS_TCB *p_lnk; /* Chain of tasks waiting for mutex */ |
emilmont | 6:350b53afb889 | 103 | struct OS_TCB *owner; /* Mutex owner task */ |
emilmont | 6:350b53afb889 | 104 | } *P_MUCB; |
emilmont | 6:350b53afb889 | 105 | |
emilmont | 6:350b53afb889 | 106 | typedef struct OS_XTMR { |
emilmont | 6:350b53afb889 | 107 | struct OS_TMR *next; |
emilmont | 6:350b53afb889 | 108 | U16 tcnt; |
emilmont | 6:350b53afb889 | 109 | } *P_XTMR; |
emilmont | 6:350b53afb889 | 110 | |
emilmont | 6:350b53afb889 | 111 | typedef struct OS_TMR { |
emilmont | 6:350b53afb889 | 112 | struct OS_TMR *next; /* Link pointer to Next timer */ |
emilmont | 6:350b53afb889 | 113 | U16 tcnt; /* Timer delay count */ |
emilmont | 6:350b53afb889 | 114 | U16 info; /* User defined call info */ |
emilmont | 6:350b53afb889 | 115 | } *P_TMR; |
emilmont | 6:350b53afb889 | 116 | |
emilmont | 6:350b53afb889 | 117 | typedef struct OS_BM { |
emilmont | 6:350b53afb889 | 118 | void *free; /* Pointer to first free memory block */ |
emilmont | 6:350b53afb889 | 119 | void *end; /* Pointer to memory block end */ |
emilmont | 6:350b53afb889 | 120 | U32 blk_size; /* Memory block size */ |
emilmont | 6:350b53afb889 | 121 | } *P_BM; |
emilmont | 6:350b53afb889 | 122 | |
emilmont | 6:350b53afb889 | 123 | /* Definitions */ |
emilmont | 6:350b53afb889 | 124 | #define __TRUE 1 |
emilmont | 6:350b53afb889 | 125 | #define __FALSE 0 |
emilmont | 6:350b53afb889 | 126 | #define NULL ((void *) 0) |
emilmont | 6:350b53afb889 | 127 | |
emilmont | 6:350b53afb889 | 128 | #endif |