ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

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