1 | /* |
---|
2 | * GRSPW ROUTER APB-Register Driver. |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 2010. |
---|
5 | * Cobham Gaisler AB. |
---|
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_ROUTER_H__ |
---|
13 | #define __GRSPW_ROUTER_H__ |
---|
14 | |
---|
15 | /* Hardware Information */ |
---|
16 | struct router_hw_info { |
---|
17 | unsigned char nports_spw; |
---|
18 | unsigned char nports_amba; |
---|
19 | unsigned char nports_fifo; |
---|
20 | char timers_avail; |
---|
21 | char pnp_avail; |
---|
22 | unsigned char ver_major; |
---|
23 | unsigned char ver_minor; |
---|
24 | unsigned char ver_patch; |
---|
25 | unsigned char iid; |
---|
26 | }; |
---|
27 | |
---|
28 | #define ROUTER_FLG_CFG 0x01 |
---|
29 | #define ROUTER_FLG_IID 0x02 |
---|
30 | #define ROUTER_FLG_IDIV 0x04 |
---|
31 | #define ROUTER_FLG_TPRES 0x08 |
---|
32 | #define ROUTER_FLG_TRLD 0x10 |
---|
33 | #define ROUTER_FLG_ALL 0x1f /* All Above Flags */ |
---|
34 | |
---|
35 | struct router_config { |
---|
36 | unsigned int flags; /* Determine what configuration should be updated */ |
---|
37 | |
---|
38 | /* Router Configuration Register */ |
---|
39 | unsigned int config; |
---|
40 | |
---|
41 | /* Set Instance ID */ |
---|
42 | unsigned char iid; |
---|
43 | |
---|
44 | /* SpaceWire Link Initialization Clock Divisor */ |
---|
45 | unsigned char idiv; |
---|
46 | |
---|
47 | /* Timer Prescaler and Reload */ |
---|
48 | unsigned int timer_prescaler; |
---|
49 | unsigned int timer_reload[32]; |
---|
50 | }; |
---|
51 | |
---|
52 | /* Logical routing table */ |
---|
53 | struct router_routes { |
---|
54 | unsigned int route[224]; |
---|
55 | }; |
---|
56 | |
---|
57 | /* Port Setup, see register definitions for "Port setup register" */ |
---|
58 | struct router_ps { |
---|
59 | unsigned int ps[31]; /* Port Setup for ports 1-31 */ |
---|
60 | unsigned int ps_logical[224]; /* Port setup for locgical addresses 32-255 */ |
---|
61 | }; |
---|
62 | |
---|
63 | /* Set/Get Port Control/Status */ |
---|
64 | #define ROUTER_PORTFLG_SET_CTRL 0x01 |
---|
65 | #define ROUTER_PORTFLG_GET_CTRL 0x02 |
---|
66 | #define ROUTER_PORTFLG_SET_STS 0x04 |
---|
67 | #define ROUTER_PORTFLG_GET_STS 0x08 |
---|
68 | struct router_port { |
---|
69 | unsigned int flag; |
---|
70 | int port; |
---|
71 | unsigned int ctrl; |
---|
72 | unsigned int sts; |
---|
73 | }; |
---|
74 | |
---|
75 | /* Get Hardware support/information available */ |
---|
76 | #define GRSPWR_IOCTL_HWINFO 0x01 /* OUT: struct router_hw_info */ |
---|
77 | |
---|
78 | /* Router Configuration */ |
---|
79 | #define GRSPWR_IOCTL_CFG_SET 0x02 /* IN: struct router_config */ |
---|
80 | #define GRSPWR_IOCTL_CFG_GET 0x03 /* OUT: struct router_config */ |
---|
81 | |
---|
82 | /* Routes */ |
---|
83 | #define GRSPWR_IOCTL_ROUTES_SET 0x04 /* IN: struct router_routes */ |
---|
84 | #define GRSPWR_IOCTL_ROUTES_GET 0x05 /* OUT: struct router_routes */ |
---|
85 | |
---|
86 | /* Port Setup */ |
---|
87 | #define GRSPWR_IOCTL_PS_SET 0x06 /* IN: struct router_ps */ |
---|
88 | #define GRSPWR_IOCTL_PS_GET 0x07 /* OUT: struct router_ps */ |
---|
89 | |
---|
90 | /* Set configuration write enable */ |
---|
91 | #define GRSPWR_IOCTL_WE_SET 0x08 /* INT: int */ |
---|
92 | |
---|
93 | /* Set/Get Port Control/Status */ |
---|
94 | #define GRSPWR_IOCTL_PORT 0x09 /* IN/OUT: struct router_port */ |
---|
95 | |
---|
96 | /* Set Router Configuration/Status Register */ |
---|
97 | #define GRSPWR_IOCTL_CFGSTS_SET 0x0a /* IN: unsigned int */ |
---|
98 | /* Get Router Configuration/Status Register */ |
---|
99 | #define GRSPWR_IOCTL_CFGSTS_GET 0x0b /* OUT: unsigned int */ |
---|
100 | |
---|
101 | /* Get Current Time-Code Register */ |
---|
102 | #define GRSPWR_IOCTL_TC_GET 0x0c /* OUT: unsigned int */ |
---|
103 | |
---|
104 | #endif |
---|