Main Page Data Structures File List Data Fields Globals Related Pages

# clib/RTXAPI.H

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 *
    00003 * (C) 1999 by BECK IPC GmbH
    00004 *
    00005 *  BECK IPC GmbH
    00006 *  Garbenheimerstr. 38
    00007 *  D-35578 Wetzlar
    00008 *
    00009 *  Phone : (49)-6441-905-240
    00010 *  Fax   : (49)-6441-905-245
    00011 *
    00012 * ---------------------------------------------------------------------------
    00013 * Module        : RTXAPI.H
    00014 * Function      : Constants, protoypes for RTX, use model large at your program,
    00015 *                 if you use this include file.
    00016 *                 See html documentation of the RTOS API for details.
    00017 * Author        : Schloesser/Bartat
    00018 * Date          : 05.11.99
    00019 * ---------------------------------------------------------------------------
    00020
    00021 $Header: RTXAPI.H, 8, 14.02.2002 10:47:27, Christoph Stoidner$
    00022
    00023 $Log:
    00024  8    IPC@CHIP  1.7         14.02.2002 10:47:27  Christoph Stoidner add Find
    00025       Semaphore Function
    00026  7    IPC@CHIP  1.6         16.01.2002 11:45:06  Christoph Stoidner add starteam
    00027       directives
    00028  6    IPC@CHIP  1.5         14.01.2002 13:18:54  Christoph Stoidner add new
    00029       functions
    00030  5    IPC@CHIP  1.4         01.06.2001 12:20:27  Markus Bartat   added new
    00031       functions
    00032  4    IPC@CHIP  1.3         31.05.2001 16:18:26  Christoph Stoidner
    00033  3    IPC@CHIP  1.2         31.05.2001 14:27:46  Christoph Stoidner
    00034  2    IPC@CHIP  1.1         29.05.2001 16:03:58  Markus Bartat   added API call
    00035       0x11 Create a task without starting it
    00036  1    IPC@CHIP  1.0         14.02.2001 16:09:47  Christoph Stoidner
    00037 $
    00038
    00039
    00040 * History       :
    00041 *
    00042 *  Vx.yy                 Author  Changes
    00043 *
    00044 *             05.11.99   es    Create
    00045 *             17.01.00   mb    add more RTOS calls (see html-documentation)
    00046 *             22.07.00   mb    add timer procedure calls,
    00047 *                               change API call defines from dec to hex
    00048 *             20.08.00   mb    add task state API calls
    00049 *             24.08.00   mb    add API calls suspend and resume tasks
    00050 *             23.10.00   mb    add event group calls
    00051 *             26.10.00   mb    add message exchange calls
    00052 *             29.05.01   mb    add task create call without running the task
    00053 *             01.06.01   mb    add get task state call without using taskmonitoring
    00054 ******************************************************************************/
    00055 #ifndef RTX_API_H_
    00056 #define RTX_API_H_
    00057 /*****************************************************************************/
    00058 //function numbers
    00059 /*****************************************************************************/
    00060 //Taskcontrol
    00061 #define RTX_SLEEP_TIME              0x00   /* Sleep for a defined time */
    00062 #define RTX_TASK_CREATE             0x01   /* Create and start a task  */
    00063 #define RTX_TASK_KILL               0x02   /* Stop and kill a task*/
    00064 #define RTX_TASK_DELETE             0x03   /* Remove a task from the system */
    00065 #define RTX_GET_TASKID              0x04   /* Get ID of the current running task*/
    00066 #define RTX_SLEEP_REQ               0x05   /* Sleep, until a wake request occurs*/
    00067 #define RTX_WAKEUP_TASK             0x06   /* Wake a task, which is waiting*/
    00068 #define RTX_END_EXEC                0x07   /* End task execution*/
    00069 #define RTX_CHANGE_PRIO             0x08   /* Change the priority of a task*/
    00070 #define RTX_ACCESS_FILESYSTEM       0x09    /* Enable filesystem access for task*/
    00071 #define RTX_GET_TASK_STATE          0x0A    /* Get the state of a task, using taskmonitoring mode*/
    00072 #define RTX_GET_TASK_LIST           0x0B    /* Get tasklist*/
    00073 #define RTX_START_TASK_MONITOR      0x0C    /* Start task monitoring*/
    00074 #define RTX_STOP_TASK_MONITOR       0x0D    /* Stop task monitoring*/
    00075 #define RTX_SUSPEND_TASK            0x0E    /* Suspend a task */
    00076 #define RTX_RESUME_TASK             0x0F    /* Resume a task */
    00077 #define RTX_RESTART_TASK            0x10    /* Restart a killed task */
    00078 #define RTX_TASK_CREATE_WITHOUT_RUN 0x11    /* Create a task without startingRestart a killed task*/
    00079 #define RTX_GET_TASK_STATE_EXT      0x12    /* Get the state of a task without taskmonitoring mode*/
    00080 #define RTX_DISABLE_TASK_SCHEDULING 0x20    /* Disable the taskscheduler (Taskswitching) */
    00081 #define RTX_ENABLE_TASK_SCHEDULING  0x21    /* Enable the taskscheduler (Taskswitching) */
    00082
    00083
    00084 //Semaphores
    00085 #define RTX_CREATE_SEM    0x14   /* Create a semaphore */
    00086 #define RTX_DELETE_SEM    0x15   /* Delete a semaphore */
    00087 #define RTX_FREE_RES      0x16   /* Free a resource semaphore  */
    00088 #define RTX_GET_SEM       0x17   /* Get use of a counting semaphore(no wait)*/
    00089 #define RTX_RELEASE_SEM   0x18   /* Release a resource semaphore*/
    00090 #define RTX_RESERVE_RES   0x19   /* Reserve a resource semaphore*/
    00091 #define RTX_SIGNAL_SEM    0x1A   /* Signal a counting semaphore */
    00092 #define RTX_WAIT_SEM      0x1B   /* Wait on a counting semaphore (optional timeout)*/
    00093 #define RTX_FIND_SEM      0x1C   /* Find a Semaphore, using 4 char name tag */
    00094
    00095
    00096 //Time/Date control
    00097 #define RTX_GET_TIMEDATE  0x28
    00098 #define RTX_SET_TIMEDATE  0x29
    00099 #define RTX_GET_TICKS     0x2A
    00100
    00101
    00102 /* Timer procedures */
    00103 #define RTX_INSTALL_TIMER 0x30     /*Install a timer procedure*/
    00104 #define RTX_REMOVE_TIMER  0x31    /*Remove a timer procedure from the system*/
    00105 #define RTX_START_TIMER   0x32    /*Start periodic execution of a installed timer procedure*/
    00106 #define RTX_STOP_TIMER    0x33    /*Stop periodic execution of a timer procedure*/
    00107
    00108
    00109
    00110 //Event manager
    00111 #define  RTX_CREATE_EVENTGROUP    0x40 /*Create an event group*/
    00112 #define  RTX_DELETE_EVENTGROUP    0x41 /*Delete an event group*/
    00113 #define  RTX_SIGNAL_EVENTS        0x42 /* Signal one or more events in a group*/
    00114 #define  RTX_WAIT_EVENTS          0x43 /*Wait for all/any of a set of events in a group*/
    00115 #define  RTX_GET_EVENTGROUP_STATE 0x44 /*Read current state of events in a group*/
    00116 #define  RTX_GET_EVENT_FLAGS      0x45 /*Get saved event flags*/
    00117 #define  RTX_FIND_EVENTGROUP      0x46 /*ind the eventgroup id of an event group with a specific tag*/
    00118
    00119
    00120
    00121
    00122 //Message exchange manager
    00123 #define RTX_CREATE_MSG    0x50  /*Create a messsage exchange*/
    00124 #define RTX_DELETE_MSG    0x51  /*Delete a message exchange*/
    00125 #define RTX_SEND_MSG      0x52  /*Send a message to a message exchange*/
    00126 #define RTX_GET_MSG       0x53  /*Get a message ,if any (no wait)*/
    00127 #define RTX_WAIT_MSG      0x54  /*Wait for message to arrive (optional timeout)*/
    00128 #define RTX_FIND_MSG      0x55  /*Find exchange ID of a message exchange by name tag*/
    00129
    00130
    00131 /**************************************************************************************************/
    00132 //returned common API errorcodes at dx register, special RTOS errorcodes are listed at the HTML-Docs
    00133 /************************************++++**********************************************************/
    00134 #define RTX_ENOERROR        0
    00135 #define RTX_ERROR          -1
    00136 #define RTX_NOT_SUPPORTED  -2
    00137
    00138
    00139 /*****************************************************************************/
    00140 //typedefs
    00141 /*****************************************************************************/
    00142 /* ID type for tasks ,semaphores */
    00143
    00144 typedef unsigned int RTOS_ID ;
    00145
    00146
    00147
    00148 /*Task Definition Structure */
    00149 typedef struct tag_taskdefblock
    00150 {
    00151   void  (*proc)();              /* task procedure pointer */
    00152   char  name[4];                 /* name 4 characters not null terminated */
    00153   unsigned int * stackptr;     /* task stack pointer    */
    00154   unsigned int stacksize;       /* size of task stack (bytes) */
    00155   unsigned short int attrib;      /* task attributes, not supported by the RTOS API */
    00156   short int priority;          /* task priority,  range: 20<=priority<=127*/
    00157   unsigned short int time_slice; /* 0: none, !=0: number of milliseconds before task force to relinquish processor*/
    00158   short int mailboxlevel1;     /* depth of mailbox i: 0 not used, else 1 - 8 mailboxdepth*/
    00159   short int mailboxlevel2;       /* max. number of messages resides inside a task mailbox*/
    00160   short int mailboxlevel3;
    00161   short int mailboxlevel4;
    00162 }TaskDefBlock;
    00163
    00164
    00165
    00166 typedef struct tagtasklist
    00167 {
    00168      unsigned int taskID;         /*task identifier*/
    00169      char taskname[5];            /* unique name 4 characters , 0 terminated */
    00170 }TaskList;
    00171
    00172
    00173
    00174 typedef struct tag_task_statedata{
    00175                                unsigned int taskID;
    00176                                unsigned int taskPrio;
    00177                                unsigned int taskState;   /*taskstate see below*/
    00178                                unsigned int taskCount;   /*count of the taskmonitor, if taskmon is active*/
    00179                                unsigned int stackused;   /*used stack in percent*/
    00180                                unsigned int stacksize;   /*whole stacksize*/
    00181 }Task_StateData;
    00182
    00183 /*taskstates (16Bit value)
    00184 Bit0 timer wait (used with other bits)
    00185 Bit1 trigger wait (i.e. idle)
    00186 Bit2 semaphore wait
    00187 Bit3 event group wait
    00188 Bit4 message exchange wait
    00189 Bit5 message send wait
    00190 Bit6 suspended (waiting for resume)
    00191 Bit7 waiting for wake
    00192 >Bit7 internal use only
    00193 */
    00194
    00195
    00196 /*Time/Date Structure*/
    00197 typedef struct tag_time
    00198 {
    00199   unsigned char sec;  /* seconds  (0-59)  */
    00200   unsigned char min;  /* minutes  (0-59)  */
    00201   unsigned char hr;    /* hours (0-23)    */
    00202   unsigned char dy;    /* day   (1-31)  */
    00203   unsigned char mn;    /* month (1-12)    */
    00204   unsigned char yr;    /* year    (0-99)  */
    00205   unsigned char dow;  /* day of week  (Mon=1 to Sun=7)     */
    00206   unsigned char dcen;  /* century if time/date is correct */
    00207 }TimeDate_Structure;
    00208
    00209 /*Timer procedure structure*/
    00210 typedef struct tag_timer_proc
    00211 {
    00212    unsigned int    *  timerID;     /*pointer to storage the unique timerID*/
    00213    void (*proc)();       /*pointer to the procedure to be executed*/
    00214    void  *dummyptr;       /*dummypointer, not used at the moment */
    00215    char  name[4];         /*pointer to a unique 4 character name*/
    00216    long       interval;   /*timer execution interval*/
    00217 }TimerProc_Structure;
    00218
    00219
    00220 /*Event manager: Wait for event structure*/
    00221 typedef struct tag_rtx_event_wait
    00222 {
    00223   unsigned int mask;   //16-Bit mask identifying the flags of interest of the group.
    00224   unsigned int value;  //16 Bit value, which specfies the states of interest for each flag selcted by the mask.
    00225   int match;           //event match requirements, 0:only one flag must match with value, !=0: all by mask specified flags must match
    00226   long timeout;        //Maximum time (milliseconds) for waiting for an event match
    00227 }RTX_Wait_Event;
    00228
    00229
    00230 /*Message exchange create structure*/
    00231 typedef struct tag_rtx_msg{
    00232   unsigned int  msgID;    //for storage the unique message exchange ID
    00233   char name[4]; // name 4 characters, not null terminated
    00234   int  mb0;     //numbers of message envelopes, which can reside in each of the exchange mailbox, max. 8
    00235   int  mb1;
    00236   int  mb2;
    00237   int  mb3;
    00238 }RTX_Msg;
    00239
    00240
    00241 /*Message exchange wait structure*/
    00242 typedef struct tag_rtx_wait_msg{
    00243   unsigned int   msgID;      //ID of the message exchange
    00244   int   prio;      // priority for wait (0-3),  0=highest
    00245   char *msg;        //pointer ot userbuffer to storage the arrived message
    00246   long timeout;    //Maximum time (milliseconds) for waiting for a message
    00247 }RTX_Wait_Msg;
    00248
    00249
    00250
    00251
    00252 /*****************************************************************************/
    00253 #endif  /*RTX_API_H_*/
    00254 /*****************************************************************************/
    00255 //rtxapi.h