Lab Checkoff

Dependencies:   SDFileSystem TextLCD mbed-rtos mbed wave_player FATFileSystem

Committer:
doubster
Date:
Wed Nov 13 20:00:28 2013 +0000
Revision:
0:67dbd54e60d4
Lab Checkoff

Who changed what in which revision?

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