RTEMS 6.1-rc4
Loading...
Searching...
No Matches
b1553brm.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
8/*
9 * COPYRIGHT (c) 2006.
10 * Cobham Gaisler AB.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef __B1553BRM_H__
35#define __B1553BRM_H__
36
47#include <drvmgr/drvmgr.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53struct brm_reg {
54 volatile unsigned int ctrl; /* 0x00 */
55 volatile unsigned int oper; /* 0x04 */
56 volatile unsigned int cur_cmd; /* 0x08 */
57 volatile unsigned int imask; /* 0x0C */
58 volatile unsigned int ipend; /* 0x10 */
59 volatile unsigned int ipoint; /* 0x14 */
60 volatile unsigned int bit_reg; /* 0x18 */
61 volatile unsigned int ttag; /* 0x1C */
62 volatile unsigned int dpoint; /* 0x20 */
63 volatile unsigned int sw; /* 0x24 */
64 volatile unsigned int initcount; /* 0x28 */
65 volatile unsigned int mcpoint; /* 0x2C */
66 volatile unsigned int mdpoint; /* 0x30 */
67 volatile unsigned int mbc; /* 0x34 */
68 volatile unsigned int mfilta; /* 0x38 */
69 volatile unsigned int mfiltb; /* 0x3C */
70 volatile unsigned int rt_cmd_leg[16]; /* 0x40-0x80 */
71 volatile unsigned int enhanced; /* 0x84 */
72
73 volatile unsigned int dummy[31];
74
75 volatile unsigned int w_ctrl; /* 0x100 */
76 volatile unsigned int w_irqctrl; /* 0x104 */
77 volatile unsigned int w_ahbaddr; /* 0x108 */
78};
79
80struct bm_msg {
81 unsigned short miw;
82 unsigned short cw1;
83 unsigned short cw2;
84 unsigned short sw1;
85 unsigned short sw2;
86 unsigned short time;
87 unsigned short data[32];
88};
89
90struct rt_msg {
91 unsigned short miw;
92 unsigned short time;
93 unsigned short data[32];
94 unsigned short desc;
95};
96
97/*
98 * rtaddr[0] and subaddr[0] : RT address and subaddress (for rt-rt receive addresses)
99 * rtaddr[1] and subaddr[1] : Only for RT-RT. Transmit addresses.
100 *
101 * wc : word count, or mode code if subaddress 0 or 31.
102 *
103 * ctrl, bit 0 (TR) : 1 - transmit, 0 - receive. Ignored for rt-rt
104 * bit 1 (RTRT) : 1 - rt to rt, 0 - normal
105 * bit 2 (AB) : 1 - Bus B, 0 - Bus A
106 * bit 4:3 (Retry) : 1 - 1, 2 - 2, 3 - 3, 0 - 4
107 * bit 5 (END) : End of list
108 * bit 15 (BAME) : Message error. Set by BRM if protocol error is detected
109 *
110 * tsw[0] : status word
111 * tsw[1] : Only for rt-rt, status word 2
112 *
113 * data : data to be transmitted, or received data
114 *
115 */
116struct bc_msg {
117 unsigned char rtaddr[2];
118 unsigned char subaddr[2];
119 unsigned short wc;
120 unsigned short ctrl;
121 unsigned short tsw[2];
122 unsigned short data[32];
123};
124
125/* BC control bits */
126#define BC_TR 0x0001
127#define BC_RTRT 0x0002
128#define BC_BUSA 0x0004
129#define BC_EOL 0x0020
130#define BC_SKIP 0x0040
131#define BC_BAME 0x8000
132
133#define BRM_MBC_IRQ 1 /* Monitor Block Counter irq */
134#define BRM_CBA_IRQ 2 /* Command Block Accessed irq */
135#define BRM_RTF_IRQ 4 /* Retry Fail irq */
136#define BRM_ILLOP_IRQ 8 /* Illogical Opcode irq */
137#define BRM_BC_ILLCMD_IRQ 16 /* BC Illocigal Command irq */
138#define BRM_EOL_IRQ 32 /* End Of List irq */
139#define BRM_RT_ILLCMD_IRQ 128 /* RT Illegal Command irq */
140#define BRM_IXEQ0_IRQ 256 /* Index Equal Zero irq */
141#define BRM_BDRCV_IRQ 512 /* Broadcast Command Received irq */
142#define BRM_SUBAD_IRQ 1024 /* Subaddress Accessed irq */
143#define BRM_MERR_IRQ 2048 /* Message Error irq */
144#define BRM_TAPF_IRQ 8192 /* Terminal Address Parity Fail irq */
145#define BRM_WRAPF_IRQ 16384 /* Wrap Fail irq */
146#define BRM_DMAF_IRQ 32768 /* DMA Fail irq */
147
148
149#define BRM_SET_MODE 0
150#define BRM_SET_BUS 1
151#define BRM_SET_MSGTO 2
152#define BRM_SET_RT_ADDR 3
153#define BRM_SET_STD 4
154#define BRM_SET_BCE 5
155#define BRM_TX_BLOCK 7
156#define BRM_RX_BLOCK 8
157
158#define BRM_DO_LIST 10
159#define BRM_LIST_DONE 11
160
161#define BRM_CLR_STATUS 12
162#define BRM_GET_STATUS 13
163#define BRM_SET_EVENTID 14
164
165#define GET_ERROR_DESCRIPTOR(event_in) (event_in>>16)
166
167
168#define BRM_MODE_BC 0x0
169#define BRM_MODE_RT 0x1
170#define BRM_MODE_BM 0x2
171#define BRM_MODE_BM_RT 0x3 /* both RT and BM */
172
173#define BRM_FREQ_12MHZ 0
174#define BRM_FREQ_16MHZ 1
175#define BRM_FREQ_20MHZ 2
176#define BRM_FREQ_24MHZ 3
177#define BRM_FREQ_MASK 0x3
178
179#define CLKDIV_MASK 0xf
180
181#define CLKSEL_MASK 0x7
182
183void b1553brm_register_drv(void);
184
185/* Default initialization of the RT legalization registers. The values in this
186 * array are written to the registers on boot driver initialization and when
187 * the user set the mode to RT-mode by calling ioctl(BRM_SET_MODE). Thus,
188 * update the array first then call ioctl(BRM_SET_MODE) for the changes to have
189 * an affect. Note that this affects all B1553BRM RTs in the system.
190 */
191extern unsigned short b1553brm_rt_cmd_legalize[16];
192
193/* Print information about all BRM devices handled by this driver */
194void b1553brm_print(int options);
195
196/* Print information about one BRM device */
197void b1553brm_print_dev(struct drvmgr_dev *dev, int options);
198
199#ifdef __cplusplus
200}
201#endif
202
205#endif /* __BRM_H__ */
206
Driver Manager Interface.
Definition: b1553brm.h:116
Definition: b1553brm.h:80
Definition: b1553brm.h:53
Definition: drvmgr.h:297
Definition: b1553brm.h:90