File indexing completed on 2025-05-11 08:23:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 #ifndef __GR1553B_H__
0043 #define __GR1553B_H__
0044
0045 #include <stdint.h>
0046
0047 #ifdef __cplusplus
0048 extern "C" {
0049 #endif
0050
0051
0052 struct gr1553b_regs {
0053
0054 volatile uint32_t irq;
0055 volatile uint32_t imask;
0056 int unused0[(0x10-0x08)/4];
0057 volatile uint32_t hwcfg;
0058
0059 int unused1[(0x40-0x14)/4];
0060
0061
0062 volatile uint32_t bc_stat;
0063 volatile uint32_t bc_ctrl;
0064 volatile uint32_t bc_bd;
0065 volatile uint32_t bc_abd;
0066 volatile uint32_t bc_timer;
0067 volatile uint32_t bc_wake;
0068 volatile uint32_t bc_irqptr;
0069 volatile uint32_t bc_busmsk;
0070
0071 int unused2[(0x68-0x60)/4];
0072
0073 volatile uint32_t bc_slot;
0074 volatile uint32_t bc_aslot;
0075
0076 int unused3[(0x80-0x70)/4];
0077
0078
0079 volatile uint32_t rt_stat;
0080 volatile uint32_t rt_cfg;
0081 volatile uint32_t rt_stat2;
0082 volatile uint32_t rt_statw;
0083 volatile uint32_t rt_sync;
0084 volatile uint32_t rt_tab;
0085 volatile uint32_t rt_mcctrl;
0086 int unused4[(0xa4-0x9c)/4];
0087 volatile uint32_t rt_ttag;
0088 int unused5;
0089 volatile uint32_t rt_evsz;
0090 volatile uint32_t rt_evlog;
0091 volatile uint32_t rt_evirq;
0092
0093 int unused6[(0xc0-0xb8)/4];
0094
0095
0096 volatile uint32_t bm_stat;
0097 volatile uint32_t bm_ctrl;
0098 volatile uint32_t bm_adr;
0099 volatile uint32_t bm_subadr;
0100 volatile uint32_t bm_mc;
0101 volatile uint32_t bm_start;
0102 volatile uint32_t bm_end;
0103 volatile uint32_t bm_pos;
0104 volatile uint32_t bm_ttag;
0105 };
0106
0107 #define GR1553BC_KEY 0x15520000
0108 #define GR1553RT_KEY 0x15530000
0109
0110
0111 #define GR1553BC_IRQLOG_SIZE 64
0112 #define GR1553BC_IRQLOG_CNT (GR1553BC_IRQLOG_SIZE/sizeof(uint32_t))
0113
0114
0115 #define GR1553B_IRQ_BCEV_BIT 0
0116 #define GR1553B_IRQ_BCD_BIT 1
0117 #define GR1553B_IRQ_BCWK_BIT 2
0118 #define GR1553B_IRQ_RTEV_BIT 8
0119 #define GR1553B_IRQ_RTD_BIT 9
0120 #define GR1553B_IRQ_RTTE_BIT 10
0121 #define GR1553B_IRQ_BMD_BIT 16
0122 #define GR1553B_IRQ_BMTOF_BIT 17
0123
0124 #define GR1553B_IRQ_BCEV (1<<GR1553B_IRQ_BCEV_BIT)
0125 #define GR1553B_IRQ_BCD (1<<GR1553B_IRQ_BCD_BIT)
0126 #define GR1553B_IRQ_BCWK (1<<GR1553B_IRQ_BCWK_BIT)
0127 #define GR1553B_IRQ_RTEV (1<<GR1553B_IRQ_RTEV_BIT)
0128 #define GR1553B_IRQ_RTD (1<<GR1553B_IRQ_RTD_BIT)
0129 #define GR1553B_IRQ_RTTE (1<<GR1553B_IRQ_RTTE_BIT)
0130 #define GR1553B_IRQ_BMD (1<<GR1553B_IRQ_BMD_BIT)
0131 #define GR1553B_IRQ_BMTOF (1<<GR1553B_IRQ_BMTOF_BIT)
0132
0133
0134 #define GR1553B_IRQEN_BCEVE_BIT 0
0135 #define GR1553B_IRQEN_BCDE_BIT 1
0136 #define GR1553B_IRQEN_BCWKE_BIT 2
0137 #define GR1553B_IRQEN_RTEVE_BIT 8
0138 #define GR1553B_IRQEN_RTDE_BIT 9
0139 #define GR1553B_IRQEN_RTTEE_BIT 10
0140 #define GR1553B_IRQEN_BMDE_BIT 16
0141 #define GR1553B_IRQEN_BMTOE_BIT 17
0142
0143 #define GR1553B_IRQEN_BCEVE (1<<GR1553B_IRQEN_BCEVE_BIT)
0144 #define GR1553B_IRQEN_BCDE (1<<GR1553B_IRQEN_BCDE_BIT)
0145 #define GR1553B_IRQEN_BCWKE (1<<GR1553B_IRQEN_BCWKE_BIT)
0146 #define GR1553B_IRQEN_RTEVE (1<<GR1553B_IRQEN_RTEVE_BIT)
0147 #define GR1553B_IRQEN_RTDE (1<<GR1553B_IRQEN_RTDE_BIT)
0148 #define GR1553B_IRQEN_RTTEE (1<<GR1553B_IRQEN_RTTEE_BIT)
0149 #define GR1553B_IRQEN_BMDE (1<<GR1553B_IRQEN_BMDE_BIT)
0150 #define GR1553B_IRQEN_BMTOE (1<<GR1553B_IRQEN_BMTOE_BIT)
0151
0152
0153 #define GR1553B_BC_STAT_SCST_BIT 0
0154 #define GR1553B_BC_STAT_SCADL_BIT 3
0155 #define GR1553B_BC_STAT_ASST_BIT 8
0156 #define GR1553B_BC_STAT_ASADL_BIT 11
0157 #define GR1553B_BC_STAT_BCSUP_BIT 31
0158
0159 #define GR1553B_BC_STAT_SCST (0x3<<GR1553B_BC_STAT_SCST_BIT)
0160 #define GR1553B_BC_STAT_SCADL (0x1f<<GR1553B_BC_STAT_SCADL_BIT)
0161 #define GR1553B_BC_STAT_ASST (0x3<<GR1553B_BC_STAT_ASST_BIT)
0162 #define GR1553B_BC_STAT_ASADL (0x1f<<GR1553B_BC_STAT_ASADL_BIT)
0163 #define GR1553B_BC_STAT_BCSUP (1<<GR1553B_BC_STAT_BCSUP_BIT)
0164
0165
0166 #define GR1553B_BC_ACT_SCSRT_BIT 0
0167 #define GR1553B_BC_ACT_SCSUS_BIT 1
0168 #define GR1553B_BC_ACT_SCSTP_BIT 2
0169 #define GR1553B_BC_ACT_SETT_BIT 3
0170 #define GR1553B_BC_ACT_CLRT_BIT 4
0171 #define GR1553B_BC_ACT_ASSRT_BIT 8
0172 #define GR1553B_BC_ACT_ASSTP_BIT 9
0173 #define GR1553B_BC_ACT_BCKEY_BIT 16
0174
0175 #define GR1553B_BC_ACT_SCSRT (1<<GR1553B_BC_ACT_SCSRT_BIT)
0176 #define GR1553B_BC_ACT_SCSUS (1<<GR1553B_BC_ACT_SCSUS_BIT)
0177 #define GR1553B_BC_ACT_SCSTP (1<<GR1553B_BC_ACT_SCSTP_BIT)
0178 #define GR1553B_BC_ACT_SETT (1<<GR1553B_BC_ACT_SETT_BIT)
0179 #define GR1553B_BC_ACT_CLRT (1<<GR1553B_BC_ACT_CLRT_BIT)
0180 #define GR1553B_BC_ACT_ASSRT (1<<GR1553B_BC_ACT_ASSRT_BIT)
0181 #define GR1553B_BC_ACT_ASSTP (1<<GR1553B_BC_ACT_ASSTP_BIT)
0182 #define GR1553B_BC_ACT_BCKEY (0xffff<<GR1553B_BC_ACT_BCKEY_BIT)
0183
0184
0185 #define GR1553B_BC_TIMER_SCTM_BIT 0
0186
0187 #define GR1553B_BC_TIMER_SCTM (0xffffff<<GR1553B_BC_TIMER_SCTM_BIT)
0188
0189
0190 #define GR1553B_BC_WAKE_TIME_BIT 0
0191 #define GR1553B_BC_WAKE_WKEN_BIT 31
0192
0193 #define GR1553B_BC_WAKE_TIME (0xffffff<<GR1553B_BC_WAKE_TIME_BIT)
0194 #define GR1553B_BC_WAKE_WKEN (1<GR1553B_BC_WAKE_WKEN_BIT)
0195
0196
0197 #define GR1553B_RT_STAT_RUN_BIT 0
0198 #define GR1553B_RT_STAT_SHDB_BIT 1
0199 #define GR1553B_RT_STAT_SHDA_BIT 2
0200 #define GR1553B_RT_STAT_ACT_BIT 3
0201 #define GR1553B_RT_STAT_RTSUP_BIT 31
0202
0203 #define GR1553B_RT_STAT_RUN (1<<GR1553B_RT_STAT_RUN_BIT)
0204 #define GR1553B_RT_STAT_SHDB (1<<GR1553B_RT_STAT_SHDB_BIT)
0205 #define GR1553B_RT_STAT_SHDA (1<<GR1553B_RT_STAT_SHDA_BIT)
0206 #define GR1553B_RT_STAT_ACT (1<<GR1553B_RT_STAT_ACT_BIT)
0207 #define GR1553B_RT_STAT_RTSUP (1<<GR1553B_RT_STAT_RTSUP_BIT)
0208
0209
0210
0211 #define GR1553B_RT_CFG_RTEN_BIT 0
0212 #define GR1553B_RT_CFG_RTADDR_BIT 1
0213 #define GR1553B_RT_CFG_RTKEY_BIT 16
0214
0215 #define GR1553B_RT_CFG_RTEN (1<<GR1553B_RT_CFG_RTEN_BIT)
0216 #define GR1553B_RT_CFG_RTADDR (1<<GR1553B_RT_CFG_RTADDR_BIT)
0217 #define GR1553B_RT_CFG_RTKEY (0xffff<<GR1553B_RT_CFG_RTKEY_BIT)
0218
0219
0220 #define GR1553B_RT_STAT2_TFLG_BIT 0
0221 #define GR1553B_RT_STAT2_DBCA_BIT 1
0222 #define GR1553B_RT_STAT2_SSF_BIT 2
0223 #define GR1553B_RT_STAT2_BUSY_BIT 3
0224 #define GR1553B_RT_STAT2_SREQ_BIT 4
0225 #define GR1553B_RT_STAT2_TFDE_BIT 8
0226
0227 #define GR1553B_RT_STAT2_TFLG (1<<GR1553B_RT_STAT2_TFLG_BIT)
0228 #define GR1553B_RT_STAT2_DBCA (1<<GR1553B_RT_STAT2_DBCA_BIT)
0229 #define GR1553B_RT_STAT2_SSF (1<<GR1553B_RT_STAT2_SSF_BIT)
0230 #define GR1553B_RT_STAT2_BUSY (1<<GR1553B_RT_STAT2_BUSY_BIT)
0231 #define GR1553B_RT_STAT2_SREQ (1<<GR1553B_RT_STAT2_SREQ_BIT)
0232 #define GR1553B_RT_STAT2_TFDE (1<<GR1553B_RT_STAT2_TFDE_BIT)
0233
0234
0235 #define GR1553B_RT_STATW_VECW_BIT 0
0236 #define GR1553B_RT_STATW_BITW_BIT 16
0237
0238 #define GR1553B_RT_STATW_VECW (0xffff<<GR1553B_RT_STATW_VECW_BIT)
0239 #define GR1553B_RT_STATW_BITW (0xffff<<GR1553B_RT_STATW_BITW_BIT)
0240
0241
0242 #define GR1553B_RT_SYNC_SYD_BIT 0
0243 #define GR1553B_RT_SYNC_SYTM_BIT 16
0244
0245 #define GR1553B_RT_SYNC_SYD (0xffff<<GR1553B_RT_SYNC_SYD_BIT)
0246 #define GR1553B_RT_SYNC_SYTM (0xffff<<GR1553B_RT_SYNC_SYTM_BIT)
0247
0248
0249 #define GR1553B_RT_TAB_SATB_BIT 0
0250
0251 #define GR1553B_RT_TAB_SATB (0xffff<<GR1553B_RT_TAB_SATB_BIT)
0252
0253
0254 #define GR1553B_RT_MCCTRL_S_BIT 0
0255 #define GR1553B_RT_MCCTRL_SB_BIT 2
0256 #define GR1553B_RT_MCCTRL_SD_BIT 4
0257 #define GR1553B_RT_MCCTRL_SDB_BIT 6
0258 #define GR1553B_RT_MCCTRL_TS_BIT 8
0259 #define GR1553B_RT_MCCTRL_TSB_BIT 10
0260 #define GR1553B_RT_MCCTRL_TVW_BIT 12
0261 #define GR1553B_RT_MCCTRL_TBW_BIT 14
0262 #define GR1553B_RT_MCCTRL_DBC_BIT 16
0263 #define GR1553B_RT_MCCTRL_IST_BIT 18
0264 #define GR1553B_RT_MCCTRL_ISTB_BIT 20
0265 #define GR1553B_RT_MCCTRL_ITF_BIT 22
0266 #define GR1553B_RT_MCCTRL_ITFB_BIT 24
0267 #define GR1553B_RT_MCCTRL_RRT_BIT 26
0268 #define GR1553B_RT_MCCTRL_RRTB_BIT 28
0269
0270 #define GR1553B_RT_MCCTRL_S (1<<GR1553B_RT_MCCTRL_S_BIT)
0271 #define GR1553B_RT_MCCTRL_SB (1<<GR1553B_RT_MCCTRL_SB_BIT)
0272 #define GR1553B_RT_MCCTRL_SD (1<<GR1553B_RT_MCCTRL_SD_BIT)
0273 #define GR1553B_RT_MCCTRL_SDB (1<<GR1553B_RT_MCCTRL_SDB_BIT)
0274 #define GR1553B_RT_MCCTRL_TS (1<<GR1553B_RT_MCCTRL_TS_BIT)
0275 #define GR1553B_RT_MCCTRL_TSB (1<<GR1553B_RT_MCCTRL_TSB_BIT)
0276 #define GR1553B_RT_MCCTRL_TVW (1<<GR1553B_RT_MCCTRL_TVW_BIT)
0277 #define GR1553B_RT_MCCTRL_TBW (1<<GR1553B_RT_MCCTRL_TBW_BIT)
0278 #define GR1553B_RT_MCCTRL_DBC (1<<GR1553B_RT_MCCTRL_DBC_BIT)
0279 #define GR1553B_RT_MCCTRL_IST (1<<GR1553B_RT_MCCTRL_IST_BIT)
0280 #define GR1553B_RT_MCCTRL_ISTB (1<<GR1553B_RT_MCCTRL_ISTB_BIT)
0281 #define GR1553B_RT_MCCTRL_ITF (1<<GR1553B_RT_MCCTRL_ITF_BIT)
0282 #define GR1553B_RT_MCCTRL_ITFB (1<<GR1553B_RT_MCCTRL_ITFB_BIT)
0283 #define GR1553B_RT_MCCTRL_RRT (1<<GR1553B_RT_MCCTRL_RRT_BIT)
0284 #define GR1553B_RT_MCCTRL_RRTB (1<<GR1553B_RT_MCCTRL_RRTB_BIT)
0285
0286
0287 #define GR1553B_RT_TTAG_TVAL_BIT 0
0288 #define GR1553B_RT_TTAG_TRES_BIT 16
0289
0290 #define GR1553B_RT_TTAG_TVAL (0xffff<<GR1553B_RT_TTAG_TVAL_BIT)
0291 #define GR1553B_RT_TTAG_TRES (0xffff<<GR1553B_RT_TTAG_TRES_BIT)
0292
0293
0294 #define GR1553B_BM_STAT_BMSUP_BIT 31
0295
0296 #define GR1553B_BM_STAT_BMSUP (1<<GR1553B_BM_STAT_BMSUP_BIT)
0297
0298
0299 #define GR1553B_BM_CTRL_BMEN_BIT 0
0300 #define GR1553B_BM_CTRL_MANL_BIT 1
0301 #define GR1553B_BM_CTRL_UDWL_BIT 2
0302 #define GR1553B_BM_CTRL_IMCL_BIT 3
0303
0304 #define GR1553B_BM_CTRL_BMEN (1<<GR1553B_BM_CTRL_BMEN_BIT)
0305 #define GR1553B_BM_CTRL_MANL (1<<GR1553B_BM_CTRL_MANL_BIT)
0306 #define GR1553B_BM_CTRL_UDWL (1<<GR1553B_BM_CTRL_UDWL_BIT)
0307 #define GR1553B_BM_CTRL_IMCL (1<<GR1553B_BM_CTRL_IMCL_BIT)
0308
0309
0310 #define GR1553B_BM_MC_S_BIT 0
0311 #define GR1553B_BM_MC_SB_BIT 1
0312 #define GR1553B_BM_MC_SD_BIT 2
0313 #define GR1553B_BM_MC_SDB_BIT 3
0314 #define GR1553B_BM_MC_TS_BIT 4
0315 #define GR1553B_BM_MC_TSB_BIT 5
0316 #define GR1553B_BM_MC_TVW_BIT 6
0317 #define GR1553B_BM_MC_TBW_BIT 7
0318 #define GR1553B_BM_MC_DBC_BIT 8
0319 #define GR1553B_BM_MC_IST_BIT 9
0320 #define GR1553B_BM_MC_ISTB_BIT 10
0321 #define GR1553B_BM_MC_ITF_BIT 11
0322 #define GR1553B_BM_MC_ITFB_BIT 12
0323 #define GR1553B_BM_MC_RRT_BIT 13
0324 #define GR1553B_BM_MC_RRTB_BIT 14
0325 #define GR1553B_BM_MC_TSW_BIT 15
0326 #define GR1553B_BM_MC_TLC_BIT 16
0327 #define GR1553B_BM_MC_STS_BIT 17
0328 #define GR1553B_BM_MC_STSB_BIT 18
0329
0330 #define GR1553B_BM_MC_S (1<<GR1553B_BM_MC_S_BIT)
0331 #define GR1553B_BM_MC_SB (1<<GR1553B_BM_MC_SB_BIT)
0332 #define GR1553B_BM_MC_SD (1<<GR1553B_BM_MC_SD_BIT)
0333 #define GR1553B_BM_MC_SDB (1<<GR1553B_BM_MC_SDB_BIT)
0334 #define GR1553B_BM_MC_TS (1<<GR1553B_BM_MC_TS_BIT)
0335 #define GR1553B_BM_MC_TSB (1<<GR1553B_BM_MC_TSB_BIT)
0336 #define GR1553B_BM_MC_TVW (1<<GR1553B_BM_MC_TVW_BIT)
0337 #define GR1553B_BM_MC_TBW (1<<GR1553B_BM_MC_TBW_BIT)
0338 #define GR1553B_BM_MC_DBC (1<<GR1553B_BM_MC_DBC_BIT)
0339 #define GR1553B_BM_MC_IST (1<<GR1553B_BM_MC_IST_BIT)
0340 #define GR1553B_BM_MC_ISTB (1<<GR1553B_BM_MC_ISTB_BIT)
0341 #define GR1553B_BM_MC_ITF (1<<GR1553B_BM_MC_ITF_BIT)
0342 #define GR1553B_BM_MC_ITFB (1<<GR1553B_BM_MC_ITFB_BIT)
0343 #define GR1553B_BM_MC_RRT (1<<GR1553B_BM_MC_RRT_BIT)
0344 #define GR1553B_BM_MC_RRTB (1<<GR1553B_BM_MC_RRTB_BIT)
0345 #define GR1553B_BM_MC_TSW (1<<GR1553B_BM_MC_TSW_BIT)
0346 #define GR1553B_BM_MC_TLC (1<<GR1553B_BM_MC_TLC_BIT)
0347 #define GR1553B_BM_MC_STS (1<<GR1553B_BM_MC_STS_BIT)
0348 #define GR1553B_BM_MC_STSB (1<<GR1553B_BM_MC_STSB_BIT)
0349
0350
0351 #define GR1553B_BM_TTAG_VAL_BIT 0
0352 #define GR1553B_BM_TTAG_RES_BIT 24
0353
0354 #define GR1553B_BM_TTAG_VAL (0xffffff<<GR1553B_BM_TTAG_VAL_BIT)
0355 #define GR1553B_BM_TTAG_RES (0xff<<GR1553B_BM_TTAG_RES_BIT)
0356
0357
0358 extern void gr1553_register(void);
0359
0360
0361
0362
0363
0364 extern struct drvmgr_dev **gr1553_bc_open(int minor);
0365
0366 extern void gr1553_bc_close(struct drvmgr_dev **dev);
0367
0368
0369
0370
0371
0372 extern struct drvmgr_dev **gr1553_rt_open(int minor);
0373
0374 extern void gr1553_rt_close(struct drvmgr_dev **dev);
0375
0376
0377
0378
0379
0380 extern struct drvmgr_dev **gr1553_bm_open(int minor);
0381
0382 extern void gr1553_bm_close(struct drvmgr_dev **dev);
0383
0384 #ifdef __cplusplus
0385 }
0386 #endif
0387
0388 #endif