pc.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:15k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * Copyright (C) Eicon Technology Corporation, 2000.
  3.  *
  4.  * Eicon File Revision :    1.2  
  5.  *
  6.  * This software may be used and distributed according to the terms
  7.  * of the GNU General Public License, incorporated herein by reference.
  8.  *
  9.  */
  10. #ifndef PC_H_INCLUDED
  11. #define PC_H_INCLUDED
  12. #define byte unsigned char
  13. #define word unsigned short
  14. #define dword unsigned long
  15. /*------------------------------------------------------------------*/
  16. /* buffer definition                                                */
  17. /*------------------------------------------------------------------*/
  18. typedef struct {
  19.   word length;          /* length of data/parameter field           */
  20.   byte P[270];          /* data/parameter field                     */
  21. } PBUFFER;
  22. /*------------------------------------------------------------------*/
  23. /* dual port ram structure                                          */
  24. /*------------------------------------------------------------------*/
  25. struct dual
  26. {
  27.   byte Req;             /* request register                         */
  28.   byte ReqId;           /* request task/entity identification       */
  29.   byte Rc;              /* return code register                     */
  30.   byte RcId;            /* return code task/entity identification   */
  31.   byte Ind;             /* Indication register                      */
  32.   byte IndId;           /* Indication task/entity identification    */
  33.   byte IMask;           /* Interrupt Mask Flag                      */
  34.   byte RNR;             /* Receiver Not Ready (set by PC)           */
  35.   byte XLock;           /* XBuffer locked Flag                      */
  36.   byte Int;             /* ISDN-S interrupt                         */
  37.   byte ReqCh;           /* Channel field for layer-3 Requests       */
  38.   byte RcCh;            /* Channel field for layer-3 Returncodes    */
  39.   byte IndCh;           /* Channel field for layer-3 Indications    */
  40.   byte MInd;            /* more data indication field               */
  41.   word MLength;         /* more data total packet length            */
  42.   byte ReadyInt;        /* request field for ready interrupt        */
  43.   byte SWReg;           /* Software register for special purposes   */  
  44.   byte Reserved[11];    /* reserved space                           */
  45.   byte InterfaceType;   /* interface type 1=16K interface           */
  46.   word Signature;       /* ISDN-S adapter Signature (GD)            */
  47.   PBUFFER XBuffer;      /* Transmit Buffer                          */
  48.   PBUFFER RBuffer;      /* Receive Buffer                           */
  49. };
  50. /*------------------------------------------------------------------*/
  51. /* SWReg Values (0 means no command)                                */
  52. /*------------------------------------------------------------------*/
  53. #define SWREG_DIE_WITH_LEDON  0x01
  54. #define SWREG_HALT_CPU        0x02 /* Push CPU into a while(1) loop */         
  55. /*------------------------------------------------------------------*/
  56. /* Id Fields Coding                                                 */
  57. /*------------------------------------------------------------------*/
  58. #define ID_MASK 0xe0    /* Mask for the ID field                    */
  59. #define GL_ERR_ID 0x1f  /* ID for error reporting on global requests*/
  60. #define DSIG_ID  0x00   /* ID for D-channel signaling               */
  61. #define NL_ID    0x20   /* ID for network-layer access (B or D)     */
  62. #define BLLC_ID  0x60   /* ID for B-channel link level access       */
  63. #define TASK_ID  0x80   /* ID for dynamic user tasks                */
  64. #define TIMER_ID 0xa0   /* ID for timer task                        */
  65. #define TEL_ID   0xc0   /* ID for telephone support                 */
  66. #define MAN_ID   0xe0   /* ID for management                        */
  67. /*------------------------------------------------------------------*/
  68. /* ASSIGN and REMOVE requests are the same for all entities         */
  69. /*------------------------------------------------------------------*/
  70. #define ASSIGN  0x01
  71. #define UREMOVE  0xfe   /* without returncode */  
  72. #define REMOVE  0xff
  73. /*------------------------------------------------------------------*/
  74. /* Timer Interrupt Task Interface                                   */
  75. /*------------------------------------------------------------------*/
  76. #define ASSIGN_TIM 0x01
  77. #define REMOVE_TIM 0xff
  78. /*------------------------------------------------------------------*/
  79. /* dynamic user task interface                                      */
  80. /*------------------------------------------------------------------*/
  81. #define ASSIGN_TSK 0x01
  82. #define REMOVE_TSK 0xff
  83. #define LOAD 0xf0
  84. #define RELOCATE 0xf1
  85. #define START 0xf2
  86. #define LOAD2 0xf3
  87. #define RELOCATE2 0xf4
  88. /*------------------------------------------------------------------*/
  89. /* dynamic user task messages                                       */
  90. /*------------------------------------------------------------------*/
  91. #define TSK_B2          0x0000
  92. #define TSK_WAKEUP      0x2000
  93. #define TSK_TIMER       0x4000
  94. #define TSK_TSK         0x6000
  95. #define TSK_PC          0xe000
  96. /*------------------------------------------------------------------*/
  97. /* LL management primitives                                         */
  98. /*------------------------------------------------------------------*/
  99. #define ASSIGN_LL 1     /* assign logical link                      */
  100. #define REMOVE_LL 0xff  /* remove logical link                      */
  101. /*------------------------------------------------------------------*/
  102. /* LL service primitives                                            */
  103. /*------------------------------------------------------------------*/
  104. #define LL_UDATA 1      /* link unit data request/indication        */
  105. #define LL_ESTABLISH 2  /* link establish request/indication        */
  106. #define LL_RELEASE 3    /* link release request/indication          */
  107. #define LL_DATA 4       /* data request/indication                  */
  108. #define LL_LOCAL 5      /* switch to local operation (COM only)     */
  109. #define LL_DATA_PEND 5  /* data pending indication (SDLC SHM only)  */
  110. #define LL_REMOTE 6     /* switch to remote operation (COM only)    */
  111. #define LL_TEST 8       /* link test request                        */
  112. #define LL_MDATA 9      /* more data request/indication             */
  113. #define LL_BUDATA 10    /* broadcast unit data request/indication   */
  114. #define LL_XID 12       /* XID command request/indication           */
  115. #define LL_XID_R 13     /* XID response request/indication          */
  116. /*------------------------------------------------------------------*/
  117. /* NL service primitives                                            */
  118. /*------------------------------------------------------------------*/
  119. #define N_MDATA         1       /* more data to come REQ/IND        */
  120. #define N_CONNECT       2       /* OSI N-CONNECT REQ/IND            */
  121. #define N_CONNECT_ACK   3       /* OSI N-CONNECT CON/RES            */
  122. #define N_DISC          4       /* OSI N-DISC REQ/IND               */
  123. #define N_DISC_ACK      5       /* OSI N-DISC CON/RES               */
  124. #define N_RESET         6       /* OSI N-RESET REQ/IND              */
  125. #define N_RESET_ACK     7       /* OSI N-RESET CON/RES              */
  126. #define N_DATA          8       /* OSI N-DATA REQ/IND               */
  127. #define N_EDATA         9       /* OSI N-EXPEDITED DATA REQ/IND     */
  128. #define N_UDATA         10      /* OSI D-UNIT-DATA REQ/IND          */
  129. #define N_BDATA         11      /* BROADCAST-DATA REQ/IND           */
  130. #define N_DATA_ACK      12      /* data ack ind for D-bit procedure */
  131. #define N_EDATA_ACK     13      /* data ack ind for INTERRUPT       */
  132. #define N_Q_BIT         0x10    /* Q-bit for req/ind                */
  133. #define N_M_BIT         0x20    /* M-bit for req/ind                */
  134. #define N_D_BIT         0x40    /* D-bit for req/ind                */
  135. /*------------------------------------------------------------------*/
  136. /* Signaling management primitives                                  */
  137. /*------------------------------------------------------------------*/
  138. #define ASSIGN_SIG 1    /* assign signaling task                    */
  139. #define UREMOVE_SIG 0xfe /* remove signaling task without returncode */
  140. #define REMOVE_SIG 0xff /* remove signaling task                    */
  141. /*------------------------------------------------------------------*/
  142. /* Signaling service primitives                                     */
  143. /*------------------------------------------------------------------*/
  144. #define CALL_REQ 1      /* call request                             */
  145. #define CALL_CON 1      /* call confirmation                        */
  146. #define CALL_IND 2      /* incoming call connected                  */
  147. #define LISTEN_REQ 2    /* listen request                           */
  148. #define HANGUP 3        /* hangup request/indication                */
  149. #define SUSPEND 4       /* call suspend request/confirm             */
  150. #define RESUME 5        /* call resume request/confirm              */
  151. #define SUSPEND_REJ 6   /* suspend rejected indication              */
  152. #define USER_DATA 8     /* user data for user to user signaling     */
  153. #define CONGESTION 9    /* network congestion indication            */
  154. #define INDICATE_REQ 10 /* request to indicate an incoming call     */
  155. #define INDICATE_IND 10 /* indicates that there is an incoming call */
  156. #define CALL_RES 11     /* accept an incoming call                  */
  157. #define CALL_ALERT 12   /* send ALERT for incoming call             */
  158. #define INFO_REQ 13     /* INFO request                             */
  159. #define INFO_IND 13     /* INFO indication                          */
  160. #define REJECT 14       /* reject an incoming call                  */
  161. #define RESOURCES 15    /* reserve B-Channel hardware resources     */
  162. #define TEL_CTRL 16     /* Telephone control request/indication     */
  163. #define STATUS_REQ 17   /* Request D-State (returned in INFO_IND)   */
  164. #define FAC_REG_REQ 18  /* connection idependent fac registration   */
  165. #define FAC_REG_ACK 19  /* fac registration acknowledge             */
  166. #define FAC_REG_REJ 20  /* fac registration reject                  */
  167. #define CALL_COMPLETE 21/* send a CALL_PROC for incoming call       */
  168. #define FACILITY_REQ 22 /* send a Facility Message type             */
  169. #define FACILITY_IND 22 /* Facility Message type indication         */
  170. #define SIG_CTRL     29 /* Control for signalling hardware          */
  171. #define DSP_CTRL     30 /* Control for DSPs                         */
  172. #define LAW_REQ      31 /* Law config request for (returns info_i)  */ 
  173.  
  174. /*------------------------------------------------------------------*/
  175. /* management service primitives                                    */
  176. /*------------------------------------------------------------------*/
  177. #define MAN_READ        2
  178. #define MAN_WRITE       3
  179. #define MAN_EXECUTE     4
  180. #define MAN_EVENT_ON    5
  181. #define MAN_EVENT_OFF   6
  182. #define MAN_LOCK        7
  183. #define MAN_UNLOCK      8   
  184. #define MAN_INFO_IND    2
  185. #define MAN_EVENT_IND   3
  186. #define MAN_TRACE_IND   4  
  187. #define MAN_ESC         0x80
  188. /*------------------------------------------------------------------*/
  189. /* return code coding                                               */
  190. /*------------------------------------------------------------------*/
  191. #define UNKNOWN_COMMAND         0x01    /* unknown command          */
  192. #define WRONG_COMMAND           0x02    /* wrong command            */
  193. #define WRONG_ID                0x03    /* unknown task/entity id   */
  194. #define WRONG_CH                0x04    /* wrong task/entity id     */
  195. #define UNKNOWN_IE              0x05    /* unknown information el.  */
  196. #define WRONG_IE                0x06    /* wrong information el.    */
  197. #define OUT_OF_RESOURCES        0x07    /* ISDN-S card out of res.  */
  198. #define ADAPTER_DEAD            0x08    /* ISDN card CPU halted     */ 
  199. #define N_FLOW_CONTROL          0x10    /* Flow-Control, retry      */
  200. #define ASSIGN_RC               0xe0    /* ASSIGN acknowledgement   */
  201. #define ASSIGN_OK               0xef    /* ASSIGN OK                */
  202. #define OK_FC                   0xfc    /* Flow-Control RC          */
  203. #define READY_INT               0xfd    /* Ready interrupt          */
  204. #define TIMER_INT               0xfe    /* timer interrupt          */
  205. #define OK                      0xff    /* command accepted         */
  206. /*------------------------------------------------------------------*/
  207. /* information elements                                             */
  208. /*------------------------------------------------------------------*/
  209. #define SHIFT 0x90              /* codeset shift                    */
  210. #define MORE 0xa0               /* more data                        */
  211. #define CL 0xb0                 /* congestion level                 */
  212.         /* codeset 0                                                */
  213. #define BC  0x04                /* Bearer Capability                */
  214. #define CAU 0x08                /* cause                            */
  215. #define CAD 0x0c                /* Connected address                */
  216. #define CAI 0x10                /* call identity                    */
  217. #define CHI 0x18                /* channel identification           */
  218. #define LLI 0x19                /* logical link id                  */
  219. #define CHA 0x1a                /* charge advice                    */
  220. #define DT  0x29                /* ETSI date/time                   */
  221. #define KEY 0x2c                /* keypad information element       */
  222. #define FTY 0x1c                /* facility information element     */ 
  223. #define DSP 0x28                /* display                          */
  224. #define OAD 0x6c                /* origination address              */
  225. #define OSA 0x6d                /* origination sub-address          */
  226. #define CPN 0x70                /* called party number              */
  227. #define DSA 0x71                /* destination sub-address          */
  228. #define RDX 0x73                /* redirected number extended       */
  229. #define RDN 0x74                /* redirected number                */  
  230. #define LLC 0x7c                /* low layer compatibility          */
  231. #define HLC 0x7d                /* high layer compatibility         */
  232. #define UUI 0x7e                /* user user information            */
  233. #define ESC 0x7f                /* escape extension                 */
  234. #define DLC 0x20                /* data link layer configuration    */
  235. #define NLC 0x21                /* network layer configuration      */
  236.         /* codeset 6                                                */
  237. #define SIN 0x01                /* service indicator                */
  238. #define CIF 0x02                /* charging information             */
  239. #define DATE 0x03               /* date                             */
  240. #define CPS 0x07                /* called party status              */
  241. /*------------------------------------------------------------------*/
  242. /* TEL_CTRL contents                                                */
  243. /*------------------------------------------------------------------*/
  244. #define RING_ON         0x01
  245. #define RING_OFF        0x02
  246. #define HANDS_FREE_ON   0x03
  247. #define HANDS_FREE_OFF  0x04
  248. #define ON_HOOK         0x80
  249. #define OFF_HOOK        0x90
  250. #endif