RTEMS  5.1
grspw.h
Go to the documentation of this file.
1 
6 /*
7  * COPYRIGHT (c) 2007.
8  * Cobham Gaisler AB.
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifndef __GRSPW_H__
16 #define __GRSPW_H__
17 
28 #include <grlib/ambapp.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define SPW_LINKERR_EVENT RTEMS_EVENT_0
35 
36 typedef struct {
37  unsigned int rxsize;
38  unsigned int txdsize;
39  unsigned int txhsize;
41 
42 #define GRSPW_PKTSEND_OPTION_HDR_CRC 0x1
43 #define GRSPW_PKTSEND_OPTION_DATA_CRC 0x2
44 #define GRSPW_PKTSEND_OPTION_NOCRCLEN(len) ((len & 0xf) << 8)
45 #define GRSPW_PKTSEND_OPTION_NOCRCLEN_MASK 0xf00
46 
47 typedef struct {
48  unsigned int hlen;
49  char *hdr;
50  unsigned int dlen;
51  char *data;
52  unsigned int sent;
53  unsigned int options;
55 
56 typedef struct {
57  unsigned int tx_link_err;
58  unsigned int rx_rmap_header_crc_err;
59  unsigned int rx_rmap_data_crc_err;
60  unsigned int rx_eep_err;
61  unsigned int rx_truncated;
62  unsigned int parity_err;
63  unsigned int escape_err;
64  unsigned int credit_err;
65  unsigned int write_sync_err;
66  unsigned int disconnect_err;
67  unsigned int early_ep;
68  unsigned int invalid_address;
69  unsigned int packets_sent;
70  unsigned int packets_received;
71 } spw_stats;
72 
73 typedef struct {
74  unsigned int nodeaddr;
75  unsigned int destkey;
76  unsigned int clkdiv; /* Note: contain both CLKDIVSTART and CLKDIVRUN, but IOCTL_SET_CLKDIV* commands are split into two */
77  unsigned int rxmaxlen;
78  unsigned int timer;
79  unsigned int disconnect;
80  unsigned int promiscuous;
81  unsigned int rmapen;
82  unsigned int rmapbufdis;
83  unsigned int linkdisabled;
84  unsigned int linkstart;
85 
86  unsigned int check_rmap_err; /* check incoming packets for rmap errors */
87  unsigned int rm_prot_id; /* remove protocol id from incoming packets */
88  unsigned int tx_blocking; /* use blocking tx */
89  unsigned int tx_block_on_full; /* block when all tx_buffers are used */
90  unsigned int rx_blocking; /* block when no data is available */
91  unsigned int disable_err; /* disable link automatically when link error is detected */
92  unsigned int link_err_irq; /* generate an interrupt when link error occurs */
93  rtems_id event_id; /* task id that should receive link err irq event */
94 
95  unsigned int is_rmap;
96  unsigned int is_rxunaligned;
97  unsigned int is_rmapcrc;
98 
99  unsigned int nodemask;
100  unsigned int keep_source; /* copy source address to user-buffer in read() operations
101  * Note that rm_prot_id has no effect when keep_source is
102  * set.
103  */
104  unsigned int rtimeout; /* Read timeout if != 0 */
105 } spw_config;
106 
107 #define SPACEWIRE_IOCTRL_SET_NODEADDR 1
108 #define SPACEWIRE_IOCTRL_SET_RXBLOCK 2
109 #define SPACEWIRE_IOCTRL_SET_DESTKEY 4
110 #define SPACEWIRE_IOCTRL_SET_CLKDIV 5
111 #define SPACEWIRE_IOCTRL_SET_TIMER 6
112 #define SPACEWIRE_IOCTRL_SET_DISCONNECT 7
113 #define SPACEWIRE_IOCTRL_SET_PROMISCUOUS 8
114 #define SPACEWIRE_IOCTRL_SET_RMAPEN 9
115 #define SPACEWIRE_IOCTRL_SET_RMAPBUFDIS 10
116 #define SPACEWIRE_IOCTRL_SET_CHECK_RMAP 11
117 #define SPACEWIRE_IOCTRL_SET_RM_PROT_ID 12
118 #define SPACEWIRE_IOCTRL_SET_TXBLOCK 14
119 #define SPACEWIRE_IOCTRL_SET_DISABLE_ERR 15
120 #define SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ 16
121 #define SPACEWIRE_IOCTRL_SET_EVENT_ID 17
122 #define SPACEWIRE_IOCTRL_SET_PACKETSIZE 20
123 #define SPACEWIRE_IOCTRL_GET_LINK_STATUS 23
124 #define SPACEWIRE_IOCTRL_GET_CONFIG 25
125 #define SPACEWIRE_IOCTRL_GET_STATISTICS 26
126 #define SPACEWIRE_IOCTRL_CLR_STATISTICS 27
127 #define SPACEWIRE_IOCTRL_SEND 28
128 #define SPACEWIRE_IOCTRL_LINKDISABLE 29
129 #define SPACEWIRE_IOCTRL_LINKSTART 30
130 #define SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL 31
131 #define SPACEWIRE_IOCTRL_SET_COREFREQ 32
132 #define SPACEWIRE_IOCTRL_SET_CLKDIVSTART 33
133 #define SPACEWIRE_IOCTRL_SET_NODEMASK 34
134 #define SPACEWIRE_IOCTRL_SET_KEEP_SOURCE 35
135 #define SPACEWIRE_IOCTRL_SET_TCODE_CTRL 36
136 #define SPACEWIRE_IOCTRL_SET_TCODE 37
137 #define SPACEWIRE_IOCTRL_GET_TCODE 38
138 #define SPACEWIRE_IOCTRL_SET_READ_TIMEOUT 39
139 
140 #define SPACEWIRE_IOCTRL_START 64
141 #define SPACEWIRE_IOCTRL_STOP 65
142 
143 /* Defines what register bits that will be touched
144  * for SPACEWIRE_IOCTRL_SET_TCODE_CTRL
145  */
146 #define SPACEWIRE_TCODE_CTRL_IE_MSK 0x001
147 #define SPACEWIRE_TCODE_CTRL_TT_MSK 0x004
148 #define SPACEWIRE_TCODE_CTRL_TR_MSK 0x008
149 
150 /* Defines what register bits that should be set
151  * for SPACEWIRE_IOCTRL_SET_TCODE_CTRL
152  */
153 #define SPACEWIRE_TCODE_CTRL_IE 0x100
154 #define SPACEWIRE_TCODE_CTRL_TT 0x400
155 #define SPACEWIRE_TCODE_CTRL_TR 0x800
156 
157 /* SPACEWIRE_IOCTRL_SET_TCODE argument mask */
158 #define SPACEWIRE_TCODE_TCODE 0x0ff
159 #define SPACEWIRE_TCODE_SET 0x100 /* Set Timecode register */
160 #define SPACEWIRE_TCODE_TX 0x400
161 
162 void grspw_register_drv (void);
163 
164 void grspw_print(int options);
165 
166 /* Global GRSPW Function pointer called upon timecode receive interrupt */
167 extern void (*grspw_timecode_callback)
168  (void *pDev, void *regs, int minor, unsigned int tc);
169 
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 
177 #endif /* __GRSPW_H__ */
Definition: grspw.h:56
Definition: grspw.h:36
Definition: grspw.h:73
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
Definition: grspw.h:47