Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rt_TypeDef.h 8.5KB

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