Clone of mbed rtos 2 for easy accessibility.
Fork of mbed-rtos by
rtx/TARGET_CORTEX_M/rt_TypeDef.h@123:58563e6cba1e, 2016-11-14 (annotated)
- Committer:
- c1728p9
- Date:
- Mon Nov 14 17:14:42 2016 -0600
- Revision:
- 123:58563e6cba1e
- Parent:
- 118:6635230e06ba
Configure RTOS to behave as it did before 5.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
c1728p9 | 123:58563e6cba1e | 1 | |
c1728p9 | 123:58563e6cba1e | 2 | /** \addtogroup rtos */ |
c1728p9 | 123:58563e6cba1e | 3 | /** @{*/ |
mbed_official | 49:77c8e4604045 | 4 | /*---------------------------------------------------------------------------- |
mbed_official | 112:53ace74b190c | 5 | * CMSIS-RTOS - RTX |
mbed_official | 49:77c8e4604045 | 6 | *---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 7 | * Name: RT_TYPEDEF.H |
mbed_official | 49:77c8e4604045 | 8 | * Purpose: Type Definitions |
mbed_official | 112:53ace74b190c | 9 | * Rev.: V4.79 |
mbed_official | 49:77c8e4604045 | 10 | *---------------------------------------------------------------------------- |
mbed_official | 49:77c8e4604045 | 11 | * |
mbed_official | 112:53ace74b190c | 12 | * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH |
mbed_official | 49:77c8e4604045 | 13 | * All rights reserved. |
mbed_official | 49:77c8e4604045 | 14 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 49:77c8e4604045 | 15 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 49:77c8e4604045 | 16 | * - Redistributions of source code must retain the above copyright |
mbed_official | 49:77c8e4604045 | 17 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 49:77c8e4604045 | 18 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 49:77c8e4604045 | 19 | * notice, this list of conditions and the following disclaimer in the |
mbed_official | 49:77c8e4604045 | 20 | * documentation and/or other materials provided with the distribution. |
mbed_official | 49:77c8e4604045 | 21 | * - Neither the name of ARM nor the names of its contributors may be used |
mbed_official | 49:77c8e4604045 | 22 | * to endorse or promote products derived from this software without |
mbed_official | 49:77c8e4604045 | 23 | * specific prior written permission. |
mbed_official | 49:77c8e4604045 | 24 | * |
mbed_official | 49:77c8e4604045 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 49:77c8e4604045 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 49:77c8e4604045 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 49:77c8e4604045 | 28 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
mbed_official | 49:77c8e4604045 | 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
mbed_official | 49:77c8e4604045 | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
mbed_official | 49:77c8e4604045 | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 49:77c8e4604045 | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 49:77c8e4604045 | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
mbed_official | 49:77c8e4604045 | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 49:77c8e4604045 | 35 | * POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 49:77c8e4604045 | 36 | *---------------------------------------------------------------------------*/ |
mbed_official | 49:77c8e4604045 | 37 | #ifndef RT_TYPE_DEF_H |
mbed_official | 49:77c8e4604045 | 38 | #define RT_TYPE_DEF_H |
mbed_official | 49:77c8e4604045 | 39 | |
mbed_official | 112:53ace74b190c | 40 | /* Types */ |
mbed_official | 112:53ace74b190c | 41 | typedef char S8; |
mbed_official | 112:53ace74b190c | 42 | typedef unsigned char U8; |
mbed_official | 112:53ace74b190c | 43 | typedef short S16; |
mbed_official | 112:53ace74b190c | 44 | typedef unsigned short U16; |
mbed_official | 112:53ace74b190c | 45 | typedef int S32; |
mbed_official | 112:53ace74b190c | 46 | typedef unsigned int U32; |
mbed_official | 112:53ace74b190c | 47 | typedef long long S64; |
mbed_official | 112:53ace74b190c | 48 | typedef unsigned long long U64; |
mbed_official | 112:53ace74b190c | 49 | typedef unsigned char BIT; |
mbed_official | 112:53ace74b190c | 50 | typedef unsigned int BOOL; |
mbed_official | 112:53ace74b190c | 51 | typedef void (*FUNCP)(void); |
mbed_official | 49:77c8e4604045 | 52 | |
mbed_official | 49:77c8e4604045 | 53 | typedef U32 OS_TID; |
mbed_official | 49:77c8e4604045 | 54 | typedef void *OS_ID; |
mbed_official | 49:77c8e4604045 | 55 | typedef U32 OS_RESULT; |
mbed_official | 49:77c8e4604045 | 56 | |
mbed_official | 112:53ace74b190c | 57 | typedef struct OS_TCB { |
mbed_official | 112:53ace74b190c | 58 | /* General part: identical for all implementations. */ |
mbed_official | 112:53ace74b190c | 59 | U8 cb_type; /* Control Block Type */ |
mbed_official | 112:53ace74b190c | 60 | U8 state; /* Task state */ |
mbed_official | 112:53ace74b190c | 61 | U8 prio; /* Execution priority */ |
mbed_official | 112:53ace74b190c | 62 | U8 task_id; /* Task ID value for optimized TCB access */ |
mbed_official | 112:53ace74b190c | 63 | struct OS_TCB *p_lnk; /* Link pointer for ready/sem. wait list */ |
mbed_official | 112:53ace74b190c | 64 | struct OS_TCB *p_rlnk; /* Link pointer for sem./mbx lst backwards */ |
mbed_official | 112:53ace74b190c | 65 | struct OS_TCB *p_dlnk; /* Link pointer for delay list */ |
mbed_official | 112:53ace74b190c | 66 | struct OS_TCB *p_blnk; /* Link pointer for delay list backwards */ |
mbed_official | 112:53ace74b190c | 67 | U16 delta_time; /* Time until time out */ |
mbed_official | 112:53ace74b190c | 68 | U16 interval_time; /* Time interval for periodic waits */ |
mbed_official | 112:53ace74b190c | 69 | U16 events; /* Event flags */ |
mbed_official | 112:53ace74b190c | 70 | U16 waits; /* Wait flags */ |
mbed_official | 112:53ace74b190c | 71 | void **msg; /* Direct message passing when task waits */ |
mbed_official | 112:53ace74b190c | 72 | struct OS_MUCB *p_mlnk; /* Link pointer for mutex owner list */ |
mbed_official | 112:53ace74b190c | 73 | U8 prio_base; /* Base priority */ |
mbed_official | 112:53ace74b190c | 74 | |
mbed_official | 112:53ace74b190c | 75 | /* Hardware dependant part: specific for CM processor */ |
mbed_official | 112:53ace74b190c | 76 | U8 stack_frame; /* Stack frame: 0=Basic, 1=Extended, */ |
mbed_official | 112:53ace74b190c | 77 | U16 reserved; /* Two reserved bytes for alignment */ |
mbed_official | 112:53ace74b190c | 78 | /* (2=VFP/D16 stacked, 4=NEON/D32 stacked) */ |
mbed_official | 112:53ace74b190c | 79 | U32 priv_stack; /* Private stack size, 0= system assigned */ |
mbed_official | 112:53ace74b190c | 80 | U32 tsk_stack; /* Current task Stack pointer (R13) */ |
mbed_official | 112:53ace74b190c | 81 | U32 *stack; /* Pointer to Task Stack memory block */ |
mbed_official | 112:53ace74b190c | 82 | |
mbed_official | 112:53ace74b190c | 83 | /* Task entry point used for uVision debugger */ |
mbed_official | 112:53ace74b190c | 84 | FUNCP ptask; /* Task entry address */ |
c1728p9 | 123:58563e6cba1e | 85 | void *argv; /* Task argument */ |
Kojto | 118:6635230e06ba | 86 | void *context; /* Pointer to thread context */ |
mbed_official | 112:53ace74b190c | 87 | } *P_TCB; |
mbed_official | 112:53ace74b190c | 88 | #define TCB_STACKF 37 /* 'stack_frame' offset */ |
mbed_official | 112:53ace74b190c | 89 | #define TCB_TSTACK 44 /* 'tsk_stack' offset */ |
mbed_official | 49:77c8e4604045 | 90 | |
mbed_official | 49:77c8e4604045 | 91 | typedef struct OS_PSFE { /* Post Service Fifo Entry */ |
mbed_official | 49:77c8e4604045 | 92 | void *id; /* Object Identification */ |
mbed_official | 49:77c8e4604045 | 93 | U32 arg; /* Object Argument */ |
mbed_official | 49:77c8e4604045 | 94 | } *P_PSFE; |
mbed_official | 49:77c8e4604045 | 95 | |
mbed_official | 49:77c8e4604045 | 96 | typedef struct OS_PSQ { /* Post Service Queue */ |
mbed_official | 49:77c8e4604045 | 97 | U8 first; /* FIFO Head Index */ |
mbed_official | 49:77c8e4604045 | 98 | U8 last; /* FIFO Tail Index */ |
mbed_official | 49:77c8e4604045 | 99 | U8 count; /* Number of stored items in FIFO */ |
mbed_official | 49:77c8e4604045 | 100 | U8 size; /* FIFO Size */ |
mbed_official | 49:77c8e4604045 | 101 | struct OS_PSFE q[1]; /* FIFO Content */ |
mbed_official | 49:77c8e4604045 | 102 | } *P_PSQ; |
mbed_official | 49:77c8e4604045 | 103 | |
mbed_official | 49:77c8e4604045 | 104 | typedef struct OS_TSK { |
mbed_official | 49:77c8e4604045 | 105 | P_TCB run; /* Current running task */ |
mbed_official | 112:53ace74b190c | 106 | P_TCB new_tsk; /* Scheduled task to run */ |
mbed_official | 49:77c8e4604045 | 107 | } *P_TSK; |
mbed_official | 49:77c8e4604045 | 108 | |
mbed_official | 49:77c8e4604045 | 109 | typedef struct OS_ROBIN { /* Round Robin Control */ |
mbed_official | 49:77c8e4604045 | 110 | P_TCB task; /* Round Robin task */ |
mbed_official | 49:77c8e4604045 | 111 | U16 time; /* Round Robin switch time */ |
mbed_official | 49:77c8e4604045 | 112 | U16 tout; /* Round Robin timeout */ |
mbed_official | 49:77c8e4604045 | 113 | } *P_ROBIN; |
mbed_official | 49:77c8e4604045 | 114 | |
mbed_official | 49:77c8e4604045 | 115 | typedef struct OS_XCB { |
mbed_official | 49:77c8e4604045 | 116 | U8 cb_type; /* Control Block Type */ |
mbed_official | 49:77c8e4604045 | 117 | struct OS_TCB *p_lnk; /* Link pointer for ready/sem. wait list */ |
mbed_official | 49:77c8e4604045 | 118 | struct OS_TCB *p_rlnk; /* Link pointer for sem./mbx lst backwards */ |
mbed_official | 49:77c8e4604045 | 119 | struct OS_TCB *p_dlnk; /* Link pointer for delay list */ |
mbed_official | 49:77c8e4604045 | 120 | struct OS_TCB *p_blnk; /* Link pointer for delay list backwards */ |
mbed_official | 49:77c8e4604045 | 121 | U16 delta_time; /* Time until time out */ |
mbed_official | 49:77c8e4604045 | 122 | } *P_XCB; |
mbed_official | 49:77c8e4604045 | 123 | |
mbed_official | 49:77c8e4604045 | 124 | typedef struct OS_MCB { |
mbed_official | 49:77c8e4604045 | 125 | U8 cb_type; /* Control Block Type */ |
mbed_official | 49:77c8e4604045 | 126 | U8 state; /* State flag variable */ |
mbed_official | 49:77c8e4604045 | 127 | U8 isr_st; /* State flag variable for isr functions */ |
mbed_official | 49:77c8e4604045 | 128 | struct OS_TCB *p_lnk; /* Chain of tasks waiting for message */ |
mbed_official | 49:77c8e4604045 | 129 | U16 first; /* Index of the message list begin */ |
mbed_official | 49:77c8e4604045 | 130 | U16 last; /* Index of the message list end */ |
mbed_official | 49:77c8e4604045 | 131 | U16 count; /* Actual number of stored messages */ |
mbed_official | 49:77c8e4604045 | 132 | U16 size; /* Maximum number of stored messages */ |
mbed_official | 49:77c8e4604045 | 133 | void *msg[1]; /* FIFO for Message pointers 1st element */ |
mbed_official | 49:77c8e4604045 | 134 | } *P_MCB; |
mbed_official | 49:77c8e4604045 | 135 | |
mbed_official | 49:77c8e4604045 | 136 | typedef struct OS_SCB { |
mbed_official | 49:77c8e4604045 | 137 | U8 cb_type; /* Control Block Type */ |
mbed_official | 49:77c8e4604045 | 138 | U8 mask; /* Semaphore token mask */ |
mbed_official | 49:77c8e4604045 | 139 | U16 tokens; /* Semaphore tokens */ |
mbed_official | 49:77c8e4604045 | 140 | struct OS_TCB *p_lnk; /* Chain of tasks waiting for tokens */ |
mbed_official | 49:77c8e4604045 | 141 | } *P_SCB; |
mbed_official | 49:77c8e4604045 | 142 | |
mbed_official | 49:77c8e4604045 | 143 | typedef struct OS_MUCB { |
mbed_official | 49:77c8e4604045 | 144 | U8 cb_type; /* Control Block Type */ |
mbed_official | 49:77c8e4604045 | 145 | U16 level; /* Call nesting level */ |
mbed_official | 49:77c8e4604045 | 146 | struct OS_TCB *p_lnk; /* Chain of tasks waiting for mutex */ |
mbed_official | 49:77c8e4604045 | 147 | struct OS_TCB *owner; /* Mutex owner task */ |
mbed_official | 112:53ace74b190c | 148 | struct OS_MUCB *p_mlnk; /* Chain of mutexes by owner task */ |
mbed_official | 49:77c8e4604045 | 149 | } *P_MUCB; |
mbed_official | 49:77c8e4604045 | 150 | |
mbed_official | 49:77c8e4604045 | 151 | typedef struct OS_XTMR { |
mbed_official | 49:77c8e4604045 | 152 | struct OS_TMR *next; |
mbed_official | 49:77c8e4604045 | 153 | U16 tcnt; |
mbed_official | 49:77c8e4604045 | 154 | } *P_XTMR; |
mbed_official | 49:77c8e4604045 | 155 | |
mbed_official | 49:77c8e4604045 | 156 | typedef struct OS_TMR { |
mbed_official | 49:77c8e4604045 | 157 | struct OS_TMR *next; /* Link pointer to Next timer */ |
mbed_official | 49:77c8e4604045 | 158 | U16 tcnt; /* Timer delay count */ |
mbed_official | 49:77c8e4604045 | 159 | U16 info; /* User defined call info */ |
mbed_official | 49:77c8e4604045 | 160 | } *P_TMR; |
mbed_official | 49:77c8e4604045 | 161 | |
mbed_official | 49:77c8e4604045 | 162 | typedef struct OS_BM { |
mbed_official | 49:77c8e4604045 | 163 | void *free; /* Pointer to first free memory block */ |
mbed_official | 49:77c8e4604045 | 164 | void *end; /* Pointer to memory block end */ |
mbed_official | 49:77c8e4604045 | 165 | U32 blk_size; /* Memory block size */ |
mbed_official | 49:77c8e4604045 | 166 | } *P_BM; |
mbed_official | 49:77c8e4604045 | 167 | |
mbed_official | 49:77c8e4604045 | 168 | /* Definitions */ |
mbed_official | 112:53ace74b190c | 169 | #define __TRUE 1U |
mbed_official | 112:53ace74b190c | 170 | #define __FALSE 0U |
mbed_official | 49:77c8e4604045 | 171 | #define NULL ((void *) 0) |
mbed_official | 49:77c8e4604045 | 172 | |
mbed_official | 49:77c8e4604045 | 173 | #endif |
c1728p9 | 123:58563e6cba1e | 174 | |
c1728p9 | 123:58563e6cba1e | 175 | /** @}*/ |