20 #define SPWTDP_ERR_OK 0 21 #define SPWTDP_ERR_EINVAL -1 22 #define SPWTDP_ERR_ERROR -2 23 #define SPWTDP_ERR_NOINIT -3 30 volatile unsigned int conf[4];
31 volatile unsigned int stat[4];
32 volatile unsigned int cmd_ctrl;
33 volatile unsigned int cmd_et[5];
34 volatile unsigned int resv1[2];
35 volatile unsigned int dat_ctrl;
36 volatile unsigned int dat_et[5];
37 volatile unsigned int resv2[2];
38 volatile unsigned int ts_rx_ctrl;
39 volatile unsigned int ts_rx_et[5];
40 volatile unsigned int resv3[2];
41 volatile unsigned int ts_tx_ctrl;
42 volatile unsigned int ts_tx_et[5];
43 volatile unsigned int resv4[2];
44 volatile unsigned int lat_ctrl;
45 volatile unsigned int lat_et[5];
46 volatile unsigned int resv5[2];
47 volatile unsigned int ien;
48 volatile unsigned int ists;
49 volatile unsigned int dlycnt;
50 volatile unsigned int dissync;
51 volatile unsigned int resv6[12];
52 volatile unsigned int edmask[4];
54 volatile unsigned int ctrl;
55 volatile unsigned int et[5];
56 volatile unsigned int resv0[2];
58 volatile unsigned int resv7[4];
59 volatile unsigned int pulse[8];
60 volatile unsigned int resv8[16];
66 #define CONF0_JE (0x1 << CONF0_JE_BIT) 67 #define CONF0_ST (0x1 << CONF0_ST_BIT) 68 #define CONF0_EP (0x1 << CONF0_EP_BIT) 69 #define CONF0_ET (0x1 << CONF0_ET_BIT) 70 #define CONF0_SP (0x1 << CONF0_SP_BIT) 71 #define CONF0_SE (0x1 << CONF0_SE_BIT) 72 #define CONF0_LE (0x1 << CONF0_LE_BIT) 73 #define CONF0_AE (0x1 << CONF0_AE_BIT) 74 #define CONF0_MAP (0x1f << CONF0_MAP_BIT) 75 #define CONF0_TD (0x1 << CONF0_TD_BIT) 76 #define CONF0_MU (0x1 << CONF0_MU_BIT) 77 #define CONF0_SEL (0x3 << CONF0_SEL_BIT) 78 #define CONF0_ME (0x1 << CONF0_ME_BIT) 79 #define CONF0_RE (0x1 << CONF0_RE_BIT) 80 #define CONF0_TE (0x1 << CONF0_TE_BIT) 81 #define CONF0_RS (0x1 << CONF0_RS_BIT) 83 #define CONF0_JE_BIT 24 84 #define CONF0_ST_BIT 21 85 #define CONF0_EP_BIT 20 86 #define CONF0_ET_BIT 19 87 #define CONF0_SP_BIT 18 88 #define CONF0_SE_BIT 17 89 #define CONF0_LE_BIT 16 90 #define CONF0_AE_BIT 15 91 #define CONF0_MAP_BIT 8 92 #define CONF0_TD_BIT 7 93 #define CONF0_MU_BIT 6 94 #define CONF0_SEL_BIT 4 95 #define CONF0_ME_BIT 3 96 #define CONF0_RE_BIT 2 97 #define CONF0_TE_BIT 1 98 #define CONF0_RS_BIT 0 100 #define CONF1_FSINC (0x3fffffff << CONF1_FSINC_BIT) 102 #define CONF1_FSINC_BIT 0 104 #define CONF2_CV (0xffffff << CONF2_CV_BIT) 105 #define CONF2_ETINC (0xff << CONF2_ETINC_BIT) 107 #define CONF2_CV_BIT 8 108 #define CONF2_ETINC_BIT 0 110 #define CONF3_OUTPORT (0xf << CONF3_OUTPORT_BIT) 111 #define CONF3_INPORT (0xf << CONF3_INPORT_BIT) 112 #define CONF3_STM (0x3f << CONF3_STM_BIT) 113 #define CONF3_DI64R (0x1 << CONF3_DI64R_BIT) 114 #define CONF3_DI64T (0x1 << CONF3_DI64T_BIT) 115 #define CONF3_DI64 (0x1 << CONF3_DI64_BIT) 116 #define CONF3_DI (0x1 << CONF3_DI_BIT) 117 #define CONF3_INRX (0x1f << CONF3_INRX_BIT) 118 #define CONF3_INTX (0x1f << CONF3_INTX_BIT) 120 #define CONF3_OUTPORT_BIT 28 121 #define CONF3_INPORT_BIT 24 122 #define CONF3_STM_BIT 16 123 #define CONF3_DI64R_BIT 13 124 #define CONF3_DI64T_BIT 12 125 #define CONF3_DI64_BIT 11 126 #define CONF3_DI_BIT 10 127 #define CONF3_INRX_BIT 5 128 #define CONF3_INTX_BIT 0 133 #define CTRL_NC (0x1 << CTRL_NC_BIT) 134 #define CTRL_IS (0x1 << CTRL_IS_BIT) 135 #define CTRL_SPWTC (0xff << CTRL_SPWTC_BIT) 136 #define CTRL_CPF (0xffff << CTRL_CPF_BIT) 138 #define CTRL_NC_BIT 31 139 #define CTRL_IS_BIT 30 140 #define CTRL_SPWTC_BIT 16 141 #define CTRL_CPF_BIT 0 146 #define SPWTDP_IRQ_S (0x1 << SPWTDP_IRQ_S_BIT) 147 #define SPWTDP_IRQ_TR (0x1 << SPWTDP_IRQ_TR_BIT) 148 #define SPWTDP_IRQ_TM (0x1 << SPWTDP_IRQ_TM_BIT) 149 #define SPWTDP_IRQ_TT (0x1 << SPWTDP_IRQ_TT_BIT) 150 #define SPWTDP_IRQ_DIR (0x1 << SPWTDP_IRQ_DIR_BIT) 151 #define SPWTDP_IRQ_DIT (0x1 << SPWTDP_IRQ_DIT_BIT) 152 #define SPWTDP_IRQ_EDI0 (0x1 << SPWTDP_IRQ_EDI0_BIT) 153 #define SPWTDP_IRQ_EDI1 (0x1 << SPWTDP_IRQ_EDI1_BIT) 154 #define SPWTDP_IRQ_EDI2 (0x1 << SPWTDP_IRQ_EDI2_BIT) 155 #define SPWTDP_IRQ_EDI3 (0x1 << SPWTDP_IRQ_EDI3_BIT) 156 #define SPWTDP_IRQ_SET (0x1 << SPWTDP_IRQ_SET_BIT) 157 #define SPWTDP_IRQ_P0 (0x1 << SPWTDP_IRQ_P0_BIT) 158 #define SPWTDP_IRQ_P1 (0x1 << SPWTDP_IRQ_P1_BIT) 159 #define SPWTDP_IRQ_P2 (0x1 << SPWTDP_IRQ_P2_BIT) 160 #define SPWTDP_IRQ_P3 (0x1 << SPWTDP_IRQ_P3_BIT) 161 #define SPWTDP_IRQ_P4 (0x1 << SPWTDP_IRQ_P4_BIT) 162 #define SPWTDP_IRQ_P5 (0x1 << SPWTDP_IRQ_P5_BIT) 163 #define SPWTDP_IRQ_P6 (0x1 << SPWTDP_IRQ_P6_BIT) 164 #define SPWTDP_IRQ_P7 (0x1 << SPWTDP_IRQ_P7_BIT) 165 #define SPWTDP_IRQ_NCTC (0x1 << SPWTDP_IRQ_NCTC_BIT) 166 #define SPWTDP_IRQ_WCLEAR \ 167 (SPWTDP_IRQ_S | SPWTDP_IRQ_TR | SPWTDP_IRQ_TM | \ 168 SPWTDP_IRQ_TT | SPWTDP_IRQ_DIR | SPWTDP_IRQ_DIT | SPWTDP_IRQ_EDI0 | \ 169 SPWTDP_IRQ_EDI1 | SPWTDP_IRQ_EDI2 | SPWTDP_IRQ_EDI3 | SPWTDP_IRQ_SET |\ 170 SPWTDP_IRQ_P0 | SPWTDP_IRQ_P1 | SPWTDP_IRQ_P2 | SPWTDP_IRQ_P3 | \ 171 SPWTDP_IRQ_P4 | SPWTDP_IRQ_P5 | SPWTDP_IRQ_P6 | SPWTDP_IRQ_P7 | \ 173 #define SPWTDP_IRQ_ALL (SPWTDP_IRQ_WCLEAR) 175 #define SPWTDP_IRQ_S_BIT 0 176 #define SPWTDP_IRQ_TR_BIT 1 177 #define SPWTDP_IRQ_TM_BIT 2 178 #define SPWTDP_IRQ_TT_BIT 3 179 #define SPWTDP_IRQ_DIR_BIT 4 180 #define SPWTDP_IRQ_DIT_BIT 5 181 #define SPWTDP_IRQ_EDI0_BIT 6 182 #define SPWTDP_IRQ_EDI1_BIT 7 183 #define SPWTDP_IRQ_EDI2_BIT 8 184 #define SPWTDP_IRQ_EDI3_BIT 9 185 #define SPWTDP_IRQ_SET_BIT 10 186 #define SPWTDP_IRQ_P0_BIT 11 187 #define SPWTDP_IRQ_P1_BIT 12 188 #define SPWTDP_IRQ_P2_BIT 13 189 #define SPWTDP_IRQ_P3_BIT 14 190 #define SPWTDP_IRQ_P4_BIT 15 191 #define SPWTDP_IRQ_P5_BIT 16 192 #define SPWTDP_IRQ_P6_BIT 17 193 #define SPWTDP_IRQ_P7_BIT 18 194 #define SPWTDP_IRQ_NCTC_BIT 19 197 void spwtdp_register_drv(
void);
203 extern void *spwtdp_open(
int dev_no);
206 extern int spwtdp_close(
void *spwtdp);
209 extern int spwtdp_reset(
void *spwtdp);
212 extern int spwtdp_freq_setup(
void *spwtdp, uint32_t fsinc, uint32_t
cv,
216 extern int spwtdp_interrupt_unmask(
void *spwtdp, uint32_t irqmask);
219 extern int spwtdp_interrupt_mask(
void *spwtdp, uint32_t irqmask);
226 typedef void (*spwtdp_isr_t)(
unsigned int ists,
void *data);
231 extern int spwtdp_isr_register(
void *spwtdp, spwtdp_isr_t isr,
void *data);
234 extern int spwtdp_isr_unregister(
void *spwtdp);
237 extern int spwtdp_interrupt_status(
void *spwtdp, uint32_t *sts,
241 #define SPWTDP_TDP_ENABLE CONF0_TD 242 #define SPWTDP_TDP_DISABLE 0 243 #define SPWTDP_LATENCY_ENABLE CONF0_LE 244 #define SPWTDP_LATENCY_DISABLE 0 245 #define SPWTDP_EXTET_INC_POLARITY_RISING CONF0_EP 246 #define SPWTDP_EXTET_INC_POLARITY_FALLING 0 247 #define SPWTDP_EXTET_INC_ENABLE CONF0_ET 248 #define SPWTDP_EXTET_INC_DISABLE 0 249 #define SPWTDP_EXTET_POLARITY_RISING CONF0_SP 250 #define SPWTDP_EXTET_POLARITY_FALLING 0 251 #define SPWTDP_EXTET_ENABLE CONF0_SE 252 #define SPWTDP_EXTET_DISABLE 0 253 #define SPWTDP_TARGET_SPWSYNC_ENABLE CONF0_ST 254 #define SPWTDP_TARGET_SPWSYNC_DISABLE 0 255 #define SPWTDP_TARGET_JITTERC_ENABLE CONF0_JE 256 #define SPWTDP_TARGET_JITTERC_DISABLE 0 257 #define SPWTDP_TARGET_MITIGATION_ENABLE CONF0_ME 258 #define SPWTDP_TARGET_MITIGATION_DISABLE 0 259 extern int spwtdp_initiator_conf(
void *spwtdp, uint8_t mapping,
261 extern int spwtdp_target_conf(
void *spwtdp, uint8_t mapping, uint32_t options);
264 extern int spwtdp_initiator_int_conf(
void *spwtdp, uint8_t stm, uint8_t inrx,
266 #define SPWTDP_TARGET_DISTINT_INTACK CONF3_DI 267 #define SPWTDP_TARGET_DISTINT_INT 0 268 extern int spwtdp_target_int_conf(
void *spwtdp, uint8_t inrx, uint8_t intx,
272 extern int spwtdp_initiator_enable(
void *spwtdp);
273 extern int spwtdp_target_enable(
void *spwtdp);
276 extern int spwtdp_initiator_disable(
void *spwtdp);
277 extern int spwtdp_target_disable(
void *spwtdp);
280 extern int spwtdp_status(
void *spwtdp, uint32_t *sts, uint32_t clrmask);
286 #define SPWTDP_TIME_DATA_LENGTH 20 288 uint8_t data[SPWTDP_TIME_DATA_LENGTH];
294 extern int spwtdp_dat_et_get(
void *spwtdp,
spwtdp_time_t * val);
295 extern int spwtdp_tsrx_et_get(
void *spwtdp,
spwtdp_time_t * val);
296 extern int spwtdp_tstx_et_get(
void *spwtdp,
spwtdp_time_t * val);
297 extern int spwtdp_lat_et_get(
void *spwtdp,
spwtdp_time_t * val);
298 extern int spwtdp_cmd_et_get(
void *spwtdp,
spwtdp_time_t * val);
301 extern int spwtdp_initiator_tstx_conf(
void *spwtdp, uint8_t tstc);
304 extern int spwtdp_initiator_cmd_et_set(
void *spwtdp,
spwtdp_time_t val);
305 extern int spwtdp_initiator_cmd_spwtc_set(
void *spwtdp, uint8_t spwtc);
306 #define SPWTDP_TARGET_CTRL_NEWCOMMAND_ENABLE CTRL_NC 307 #define SPWTDP_TARGET_CTRL_NEWCOMMAND_DISABLE 0 308 #define SPWTDP_TARGET_CTRL_INIT CTRL_IS 309 #define SPWTDP_TARGET_CTRL_SYNC 0 310 extern int spwtdp_target_cmd_conf(
void *spwtdp, uint8_t spwtc, uint16_t cpf,
314 extern int spwtdp_precision_get(
void *spwtdp, uint8_t *fine, uint8_t *coarse);
unsigned cv
Definition: tte.h:88