Control a robot over the internet using UDP and a Ethernet interface.

Dependencies:   EthernetInterface Motor TextLCD mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rt_TypeDef.h Source File

rt_TypeDef.h

00001 /*----------------------------------------------------------------------------
00002  *      RL-ARM - RTX
00003  *----------------------------------------------------------------------------
00004  *      Name:    RT_TYPEDEF.H
00005  *      Purpose: Type Definitions
00006  *      Rev.:    V4.60
00007  *----------------------------------------------------------------------------
00008  *
00009  * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
00010  * All rights reserved.
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions are met:
00013  *  - Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  *  - Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  *  - Neither the name of ARM  nor the names of its contributors may be used 
00019  *    to endorse or promote products derived from this software without 
00020  *    specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00023  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
00026  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00027  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00028  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00031  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  * POSSIBILITY OF SUCH DAMAGE.
00033  *---------------------------------------------------------------------------*/
00034 #ifndef RT_TYPE_DEF_H
00035 #define RT_TYPE_DEF_H
00036 
00037 #include "os_tcb.h"
00038 
00039 typedef U32     OS_TID;
00040 typedef void    *OS_ID;
00041 typedef U32     OS_RESULT;
00042 
00043 #define TCB_STACKF      32        /* 'stack_frame' offset                    */
00044 #define TCB_TSTACK      36        /* 'tsk_stack' offset                      */
00045 
00046 typedef struct OS_PSFE {          /* Post Service Fifo Entry                 */
00047   void  *id;                      /* Object Identification                   */
00048   U32    arg;                     /* Object Argument                         */
00049 } *P_PSFE;
00050 
00051 typedef struct OS_PSQ {           /* Post Service Queue                      */
00052   U8     first;                   /* FIFO Head Index                         */
00053   U8     last;                    /* FIFO Tail Index                         */
00054   U8     count;                   /* Number of stored items in FIFO          */
00055   U8     size;                    /* FIFO Size                               */
00056   struct OS_PSFE q[1];            /* FIFO Content                            */
00057 } *P_PSQ;
00058 
00059 typedef struct OS_TSK {
00060   P_TCB  run;                     /* Current running task                    */
00061   P_TCB  new_tsk;                 /* Scheduled task to run                   */
00062 } *P_TSK;
00063 
00064 typedef struct OS_ROBIN {         /* Round Robin Control                     */
00065   P_TCB  task;                    /* Round Robin task                        */
00066   U16    time;                    /* Round Robin switch time                 */
00067   U16    tout;                    /* Round Robin timeout                     */
00068 } *P_ROBIN;
00069 
00070 typedef struct OS_XCB {
00071   U8     cb_type;                 /* Control Block Type                      */
00072   struct OS_TCB *p_lnk;           /* Link pointer for ready/sem. wait list   */
00073   struct OS_TCB *p_rlnk;          /* Link pointer for sem./mbx lst backwards */
00074   struct OS_TCB *p_dlnk;          /* Link pointer for delay list             */
00075   struct OS_TCB *p_blnk;          /* Link pointer for delay list backwards   */
00076   U16    delta_time;              /* Time until time out                     */
00077 } *P_XCB;
00078 
00079 typedef struct OS_MCB {
00080   U8     cb_type;                 /* Control Block Type                      */
00081   U8     state;                   /* State flag variable                     */
00082   U8     isr_st;                  /* State flag variable for isr functions   */
00083   struct OS_TCB *p_lnk;           /* Chain of tasks waiting for message      */
00084   U16    first;                   /* Index of the message list begin         */
00085   U16    last;                    /* Index of the message list end           */
00086   U16    count;                   /* Actual number of stored messages        */
00087   U16    size;                    /* Maximum number of stored messages       */
00088   void   *msg[1];                 /* FIFO for Message pointers 1st element   */
00089 } *P_MCB;
00090 
00091 typedef struct OS_SCB {
00092   U8     cb_type;                 /* Control Block Type                      */
00093   U8     mask;                    /* Semaphore token mask                    */
00094   U16    tokens;                  /* Semaphore tokens                        */
00095   struct OS_TCB *p_lnk;           /* Chain of tasks waiting for tokens       */
00096 } *P_SCB;
00097 
00098 typedef struct OS_MUCB {
00099   U8     cb_type;                 /* Control Block Type                      */
00100   U8     prio;                    /* Owner task default priority             */
00101   U16    level;                   /* Call nesting level                      */
00102   struct OS_TCB *p_lnk;           /* Chain of tasks waiting for mutex        */
00103   struct OS_TCB *owner;           /* Mutex owner task                        */
00104 } *P_MUCB;
00105 
00106 typedef struct OS_XTMR {
00107   struct OS_TMR  *next;
00108   U16    tcnt;
00109 } *P_XTMR;
00110 
00111 typedef struct OS_TMR {
00112   struct OS_TMR  *next;           /* Link pointer to Next timer              */
00113   U16    tcnt;                    /* Timer delay count                       */
00114   U16    info;                    /* User defined call info                  */
00115 } *P_TMR;
00116 
00117 typedef struct OS_BM {
00118   void *free;                     /* Pointer to first free memory block      */
00119   void *end;                      /* Pointer to memory block end             */
00120   U32  blk_size;                  /* Memory block size                       */
00121 } *P_BM;
00122 
00123 /* Definitions */
00124 #define __TRUE          1
00125 #define __FALSE         0
00126 #define NULL            ((void *) 0)
00127 
00128 #endif