1 | /* |
---|
2 | * Macros used for Spacewire bus |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 2007. |
---|
5 | * Gaisler Research |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef __GRSPW_H__ |
---|
13 | #define __GRSPW_H__ |
---|
14 | |
---|
15 | #include <ambapp.h> |
---|
16 | |
---|
17 | #ifdef __cplusplus |
---|
18 | extern "C" { |
---|
19 | #endif |
---|
20 | |
---|
21 | #define SPW_LINKERR_EVENT RTEMS_EVENT_0 |
---|
22 | |
---|
23 | typedef struct { |
---|
24 | unsigned int rxsize; |
---|
25 | unsigned int txdsize; |
---|
26 | unsigned int txhsize; |
---|
27 | } spw_ioctl_packetsize; |
---|
28 | |
---|
29 | typedef struct { |
---|
30 | unsigned int hlen; |
---|
31 | char *hdr; |
---|
32 | unsigned int dlen; |
---|
33 | char *data; |
---|
34 | unsigned int sent; |
---|
35 | } spw_ioctl_pkt_send; |
---|
36 | |
---|
37 | typedef struct { |
---|
38 | unsigned int tx_link_err; |
---|
39 | unsigned int rx_rmap_header_crc_err; |
---|
40 | unsigned int rx_rmap_data_crc_err; |
---|
41 | unsigned int rx_eep_err; |
---|
42 | unsigned int rx_truncated; |
---|
43 | unsigned int parity_err; |
---|
44 | unsigned int escape_err; |
---|
45 | unsigned int credit_err; |
---|
46 | unsigned int write_sync_err; |
---|
47 | unsigned int disconnect_err; |
---|
48 | unsigned int early_ep; |
---|
49 | unsigned int invalid_address; |
---|
50 | unsigned int packets_sent; |
---|
51 | unsigned int packets_received; |
---|
52 | } spw_stats; |
---|
53 | |
---|
54 | typedef struct { |
---|
55 | unsigned int nodeaddr; |
---|
56 | unsigned int destkey; |
---|
57 | unsigned int clkdiv; |
---|
58 | unsigned int rxmaxlen; |
---|
59 | unsigned int timer; |
---|
60 | unsigned int disconnect; |
---|
61 | unsigned int promiscuous; |
---|
62 | unsigned int rmapen; |
---|
63 | unsigned int rmapbufdis; |
---|
64 | unsigned int linkdisabled; |
---|
65 | unsigned int linkstart; |
---|
66 | |
---|
67 | unsigned int check_rmap_err; /* check incoming packets for rmap errors */ |
---|
68 | unsigned int rm_prot_id; /* remove protocol id from incoming packets */ |
---|
69 | unsigned int tx_blocking; /* use blocking tx */ |
---|
70 | unsigned int tx_block_on_full; /* block when all tx_buffers are used */ |
---|
71 | unsigned int rx_blocking; /* block when no data is available */ |
---|
72 | unsigned int disable_err; /* disable link automatically when link error is detected */ |
---|
73 | unsigned int link_err_irq; /* generate an interrupt when link error occurs */ |
---|
74 | rtems_id event_id; /* task id that should receive link err irq event */ |
---|
75 | |
---|
76 | unsigned int is_rmap; |
---|
77 | unsigned int is_rxunaligned; |
---|
78 | unsigned int is_rmapcrc; |
---|
79 | } spw_config; |
---|
80 | |
---|
81 | #define SPACEWIRE_IOCTRL_SET_NODEADDR 1 |
---|
82 | #define SPACEWIRE_IOCTRL_SET_RXBLOCK 2 |
---|
83 | #define SPACEWIRE_IOCTRL_SET_DESTKEY 4 |
---|
84 | #define SPACEWIRE_IOCTRL_SET_CLKDIV 5 |
---|
85 | #define SPACEWIRE_IOCTRL_SET_TIMER 6 |
---|
86 | #define SPACEWIRE_IOCTRL_SET_DISCONNECT 7 |
---|
87 | #define SPACEWIRE_IOCTRL_SET_PROMISCUOUS 8 |
---|
88 | #define SPACEWIRE_IOCTRL_SET_RMAPEN 9 |
---|
89 | #define SPACEWIRE_IOCTRL_SET_RMAPBUFDIS 10 |
---|
90 | #define SPACEWIRE_IOCTRL_SET_CHECK_RMAP 11 |
---|
91 | #define SPACEWIRE_IOCTRL_SET_RM_PROT_ID 12 |
---|
92 | #define SPACEWIRE_IOCTRL_SET_TXBLOCK 14 |
---|
93 | #define SPACEWIRE_IOCTRL_SET_DISABLE_ERR 15 |
---|
94 | #define SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ 16 |
---|
95 | #define SPACEWIRE_IOCTRL_SET_EVENT_ID 17 |
---|
96 | #define SPACEWIRE_IOCTRL_SET_PACKETSIZE 20 |
---|
97 | #define SPACEWIRE_IOCTRL_GET_LINK_STATUS 23 |
---|
98 | #define SPACEWIRE_IOCTRL_GET_CONFIG 25 |
---|
99 | #define SPACEWIRE_IOCTRL_GET_STATISTICS 26 |
---|
100 | #define SPACEWIRE_IOCTRL_CLR_STATISTICS 27 |
---|
101 | #define SPACEWIRE_IOCTRL_SEND 28 |
---|
102 | #define SPACEWIRE_IOCTRL_LINKDISABLE 29 |
---|
103 | #define SPACEWIRE_IOCTRL_LINKSTART 30 |
---|
104 | #define SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL 31 |
---|
105 | #define SPACEWIRE_IOCTRL_SET_COREFREQ 32 |
---|
106 | |
---|
107 | #define SPACEWIRE_IOCTRL_START 64 |
---|
108 | #define SPACEWIRE_IOCTRL_STOP 65 |
---|
109 | |
---|
110 | int grspw_register(amba_confarea_type *bus); |
---|
111 | |
---|
112 | |
---|
113 | #if 0 |
---|
114 | struct grspw_buf; |
---|
115 | |
---|
116 | struct grspw_buf { |
---|
117 | grspw_buf *next; /* next packet in chain */ |
---|
118 | |
---|
119 | /* Always used */ |
---|
120 | unsigned int dlen; /* data length of '*data' */ |
---|
121 | unsigned int max_dlen; /* allocated length of '*data' */ |
---|
122 | void *data; /* pointer to beginning of cargo data */ |
---|
123 | |
---|
124 | /* Only used when transmitting */ |
---|
125 | unsigned int hlen; /* length of header '*header' */ |
---|
126 | unsigned int max_hlen; /* allocated length of '*header' */ |
---|
127 | void *header; /* pointer to beginning of header data */ |
---|
128 | }; |
---|
129 | #endif |
---|
130 | |
---|
131 | #ifdef __cplusplus |
---|
132 | } |
---|
133 | #endif |
---|
134 | |
---|
135 | #endif /* __GRSPW_H__ */ |
---|