RTEMS  5.1
b1553brm.h
Go to the documentation of this file.
1 
6 /*
7  * COPYRIGHT (c) 2006.
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 __B1553BRM_H__
16 #define __B1553BRM_H__
17 
28 #include <drvmgr/drvmgr.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct brm_reg {
35  volatile unsigned int ctrl; /* 0x00 */
36  volatile unsigned int oper; /* 0x04 */
37  volatile unsigned int cur_cmd; /* 0x08 */
38  volatile unsigned int imask; /* 0x0C */
39  volatile unsigned int ipend; /* 0x10 */
40  volatile unsigned int ipoint; /* 0x14 */
41  volatile unsigned int bit_reg; /* 0x18 */
42  volatile unsigned int ttag; /* 0x1C */
43  volatile unsigned int dpoint; /* 0x20 */
44  volatile unsigned int sw; /* 0x24 */
45  volatile unsigned int initcount; /* 0x28 */
46  volatile unsigned int mcpoint; /* 0x2C */
47  volatile unsigned int mdpoint; /* 0x30 */
48  volatile unsigned int mbc; /* 0x34 */
49  volatile unsigned int mfilta; /* 0x38 */
50  volatile unsigned int mfiltb; /* 0x3C */
51  volatile unsigned int rt_cmd_leg[16]; /* 0x40-0x80 */
52  volatile unsigned int enhanced; /* 0x84 */
53 
54  volatile unsigned int dummy[31];
55 
56  volatile unsigned int w_ctrl; /* 0x100 */
57  volatile unsigned int w_irqctrl; /* 0x104 */
58  volatile unsigned int w_ahbaddr; /* 0x108 */
59 };
60 
61 struct bm_msg {
62  unsigned short miw;
63  unsigned short cw1;
64  unsigned short cw2;
65  unsigned short sw1;
66  unsigned short sw2;
67  unsigned short time;
68  unsigned short data[32];
69 };
70 
71 struct rt_msg {
72  unsigned short miw;
73  unsigned short time;
74  unsigned short data[32];
75  unsigned short desc;
76 };
77 
78 /*
79  * rtaddr[0] and subaddr[0] : RT address and subaddress (for rt-rt receive addresses)
80  * rtaddr[1] and subaddr[1] : Only for RT-RT. Transmit addresses.
81  *
82  * wc : word count, or mode code if subaddress 0 or 31.
83  *
84  * ctrl, bit 0 (TR) : 1 - transmit, 0 - receive. Ignored for rt-rt
85  * bit 1 (RTRT) : 1 - rt to rt, 0 - normal
86  * bit 2 (AB) : 1 - Bus B, 0 - Bus A
87  * bit 4:3 (Retry) : 1 - 1, 2 - 2, 3 - 3, 0 - 4
88  * bit 5 (END) : End of list
89  * bit 15 (BAME) : Message error. Set by BRM if protocol error is detected
90  *
91  * tsw[0] : status word
92  * tsw[1] : Only for rt-rt, status word 2
93  *
94  * data : data to be transmitted, or received data
95  *
96  */
97 struct bc_msg {
98  unsigned char rtaddr[2];
99  unsigned char subaddr[2];
100  unsigned short wc;
101  unsigned short ctrl;
102  unsigned short tsw[2];
103  unsigned short data[32];
104 };
105 
106 /* BC control bits */
107 #define BC_TR 0x0001
108 #define BC_RTRT 0x0002
109 #define BC_BUSA 0x0004
110 #define BC_EOL 0x0020
111 #define BC_SKIP 0x0040
112 #define BC_BAME 0x8000
113 
114 #define BRM_MBC_IRQ 1 /* Monitor Block Counter irq */
115 #define BRM_CBA_IRQ 2 /* Command Block Accessed irq */
116 #define BRM_RTF_IRQ 4 /* Retry Fail irq */
117 #define BRM_ILLOP_IRQ 8 /* Illogical Opcode irq */
118 #define BRM_BC_ILLCMD_IRQ 16 /* BC Illocigal Command irq */
119 #define BRM_EOL_IRQ 32 /* End Of List irq */
120 #define BRM_RT_ILLCMD_IRQ 128 /* RT Illegal Command irq */
121 #define BRM_IXEQ0_IRQ 256 /* Index Equal Zero irq */
122 #define BRM_BDRCV_IRQ 512 /* Broadcast Command Received irq */
123 #define BRM_SUBAD_IRQ 1024 /* Subaddress Accessed irq */
124 #define BRM_MERR_IRQ 2048 /* Message Error irq */
125 #define BRM_TAPF_IRQ 8192 /* Terminal Address Parity Fail irq */
126 #define BRM_WRAPF_IRQ 16384 /* Wrap Fail irq */
127 #define BRM_DMAF_IRQ 32768 /* DMA Fail irq */
128 
129 
130 #define BRM_SET_MODE 0
131 #define BRM_SET_BUS 1
132 #define BRM_SET_MSGTO 2
133 #define BRM_SET_RT_ADDR 3
134 #define BRM_SET_STD 4
135 #define BRM_SET_BCE 5
136 #define BRM_TX_BLOCK 7
137 #define BRM_RX_BLOCK 8
138 
139 #define BRM_DO_LIST 10
140 #define BRM_LIST_DONE 11
141 
142 #define BRM_CLR_STATUS 12
143 #define BRM_GET_STATUS 13
144 #define BRM_SET_EVENTID 14
145 
146 #define GET_ERROR_DESCRIPTOR(event_in) (event_in>>16)
147 
148 
149 #define BRM_MODE_BC 0x0
150 #define BRM_MODE_RT 0x1
151 #define BRM_MODE_BM 0x2
152 #define BRM_MODE_BM_RT 0x3 /* both RT and BM */
153 
154 #define BRM_FREQ_12MHZ 0
155 #define BRM_FREQ_16MHZ 1
156 #define BRM_FREQ_20MHZ 2
157 #define BRM_FREQ_24MHZ 3
158 #define BRM_FREQ_MASK 0x3
159 
160 #define CLKDIV_MASK 0xf
161 
162 #define CLKSEL_MASK 0x7
163 
164 void b1553brm_register_drv(void);
165 
166 /* Default initialization of the RT legalization registers. The values in this
167  * array are written to the registers on boot driver initialization and when
168  * the user set the mode to RT-mode by calling ioctl(BRM_SET_MODE). Thus,
169  * update the array first then call ioctl(BRM_SET_MODE) for the changes to have
170  * an affect. Note that this affects all B1553BRM RTs in the system.
171  */
172 extern unsigned short b1553brm_rt_cmd_legalize[16];
173 
174 /* Print information about all BRM devices handled by this driver */
175 void b1553brm_print(int options);
176 
177 /* Print information about one BRM device */
178 void b1553brm_print_dev(struct drvmgr_dev *dev, int options);
179 
180 #ifdef __cplusplus
181 }
182 #endif
183 
186 #endif /* __BRM_H__ */
187 
Definition: b1553brm.h:97
Definition: b1553brm.h:34
Definition: b1553brm.h:71
Definition: drvmgr.h:275
Definition: b1553brm.h:61