39#define SPWTDP_ERR_OK 0
40#define SPWTDP_ERR_EINVAL -1
41#define SPWTDP_ERR_ERROR -2
42#define SPWTDP_ERR_NOINIT -3
49 volatile unsigned int conf[4];
50 volatile unsigned int stat[4];
51 volatile unsigned int cmd_ctrl;
52 volatile unsigned int cmd_et[5];
53 volatile unsigned int resv1[2];
54 volatile unsigned int dat_ctrl;
55 volatile unsigned int dat_et[5];
56 volatile unsigned int resv2[2];
57 volatile unsigned int ts_rx_ctrl;
58 volatile unsigned int ts_rx_et[5];
59 volatile unsigned int resv3[2];
60 volatile unsigned int ts_tx_ctrl;
61 volatile unsigned int ts_tx_et[5];
62 volatile unsigned int resv4[2];
63 volatile unsigned int lat_ctrl;
64 volatile unsigned int lat_et[5];
65 volatile unsigned int resv5[2];
66 volatile unsigned int ien;
67 volatile unsigned int ists;
68 volatile unsigned int dlycnt;
69 volatile unsigned int dissync;
70 volatile unsigned int resv6[12];
71 volatile unsigned int edmask[4];
73 volatile unsigned int ctrl;
74 volatile unsigned int et[5];
75 volatile unsigned int resv0[2];
77 volatile unsigned int resv7[4];
78 volatile unsigned int pulse[8];
79 volatile unsigned int resv8[16];
85#define CONF0_JE (0x1 << CONF0_JE_BIT)
86#define CONF0_ST (0x1 << CONF0_ST_BIT)
87#define CONF0_EP (0x1 << CONF0_EP_BIT)
88#define CONF0_ET (0x1 << CONF0_ET_BIT)
89#define CONF0_SP (0x1 << CONF0_SP_BIT)
90#define CONF0_SE (0x1 << CONF0_SE_BIT)
91#define CONF0_LE (0x1 << CONF0_LE_BIT)
92#define CONF0_AE (0x1 << CONF0_AE_BIT)
93#define CONF0_MAP (0x1f << CONF0_MAP_BIT)
94#define CONF0_TD (0x1 << CONF0_TD_BIT)
95#define CONF0_MU (0x1 << CONF0_MU_BIT)
96#define CONF0_SEL (0x3 << CONF0_SEL_BIT)
97#define CONF0_ME (0x1 << CONF0_ME_BIT)
98#define CONF0_RE (0x1 << CONF0_RE_BIT)
99#define CONF0_TE (0x1 << CONF0_TE_BIT)
100#define CONF0_RS (0x1 << CONF0_RS_BIT)
102#define CONF0_JE_BIT 24
103#define CONF0_ST_BIT 21
104#define CONF0_EP_BIT 20
105#define CONF0_ET_BIT 19
106#define CONF0_SP_BIT 18
107#define CONF0_SE_BIT 17
108#define CONF0_LE_BIT 16
109#define CONF0_AE_BIT 15
110#define CONF0_MAP_BIT 8
111#define CONF0_TD_BIT 7
112#define CONF0_MU_BIT 6
113#define CONF0_SEL_BIT 4
114#define CONF0_ME_BIT 3
115#define CONF0_RE_BIT 2
116#define CONF0_TE_BIT 1
117#define CONF0_RS_BIT 0
119#define CONF1_FSINC (0x3fffffff << CONF1_FSINC_BIT)
121#define CONF1_FSINC_BIT 0
123#define CONF2_CV (0xffffff << CONF2_CV_BIT)
124#define CONF2_ETINC (0xff << CONF2_ETINC_BIT)
126#define CONF2_CV_BIT 8
127#define CONF2_ETINC_BIT 0
129#define CONF3_OUTPORT (0xf << CONF3_OUTPORT_BIT)
130#define CONF3_INPORT (0xf << CONF3_INPORT_BIT)
131#define CONF3_STM (0x3f << CONF3_STM_BIT)
132#define CONF3_DI64R (0x1 << CONF3_DI64R_BIT)
133#define CONF3_DI64T (0x1 << CONF3_DI64T_BIT)
134#define CONF3_DI64 (0x1 << CONF3_DI64_BIT)
135#define CONF3_DI (0x1 << CONF3_DI_BIT)
136#define CONF3_INRX (0x1f << CONF3_INRX_BIT)
137#define CONF3_INTX (0x1f << CONF3_INTX_BIT)
139#define CONF3_OUTPORT_BIT 28
140#define CONF3_INPORT_BIT 24
141#define CONF3_STM_BIT 16
142#define CONF3_DI64R_BIT 13
143#define CONF3_DI64T_BIT 12
144#define CONF3_DI64_BIT 11
145#define CONF3_DI_BIT 10
146#define CONF3_INRX_BIT 5
147#define CONF3_INTX_BIT 0
152#define CTRL_NC (0x1 << CTRL_NC_BIT)
153#define CTRL_IS (0x1 << CTRL_IS_BIT)
154#define CTRL_SPWTC (0xff << CTRL_SPWTC_BIT)
155#define CTRL_CPF (0xffff << CTRL_CPF_BIT)
157#define CTRL_NC_BIT 31
158#define CTRL_IS_BIT 30
159#define CTRL_SPWTC_BIT 16
160#define CTRL_CPF_BIT 0
165#define SPWTDP_IRQ_S (0x1 << SPWTDP_IRQ_S_BIT)
166#define SPWTDP_IRQ_TR (0x1 << SPWTDP_IRQ_TR_BIT)
167#define SPWTDP_IRQ_TM (0x1 << SPWTDP_IRQ_TM_BIT)
168#define SPWTDP_IRQ_TT (0x1 << SPWTDP_IRQ_TT_BIT)
169#define SPWTDP_IRQ_DIR (0x1 << SPWTDP_IRQ_DIR_BIT)
170#define SPWTDP_IRQ_DIT (0x1 << SPWTDP_IRQ_DIT_BIT)
171#define SPWTDP_IRQ_EDI0 (0x1 << SPWTDP_IRQ_EDI0_BIT)
172#define SPWTDP_IRQ_EDI1 (0x1 << SPWTDP_IRQ_EDI1_BIT)
173#define SPWTDP_IRQ_EDI2 (0x1 << SPWTDP_IRQ_EDI2_BIT)
174#define SPWTDP_IRQ_EDI3 (0x1 << SPWTDP_IRQ_EDI3_BIT)
175#define SPWTDP_IRQ_SET (0x1 << SPWTDP_IRQ_SET_BIT)
176#define SPWTDP_IRQ_P0 (0x1 << SPWTDP_IRQ_P0_BIT)
177#define SPWTDP_IRQ_P1 (0x1 << SPWTDP_IRQ_P1_BIT)
178#define SPWTDP_IRQ_P2 (0x1 << SPWTDP_IRQ_P2_BIT)
179#define SPWTDP_IRQ_P3 (0x1 << SPWTDP_IRQ_P3_BIT)
180#define SPWTDP_IRQ_P4 (0x1 << SPWTDP_IRQ_P4_BIT)
181#define SPWTDP_IRQ_P5 (0x1 << SPWTDP_IRQ_P5_BIT)
182#define SPWTDP_IRQ_P6 (0x1 << SPWTDP_IRQ_P6_BIT)
183#define SPWTDP_IRQ_P7 (0x1 << SPWTDP_IRQ_P7_BIT)
184#define SPWTDP_IRQ_NCTC (0x1 << SPWTDP_IRQ_NCTC_BIT)
185#define SPWTDP_IRQ_WCLEAR \
186 (SPWTDP_IRQ_S | SPWTDP_IRQ_TR | SPWTDP_IRQ_TM | \
187 SPWTDP_IRQ_TT | SPWTDP_IRQ_DIR | SPWTDP_IRQ_DIT | SPWTDP_IRQ_EDI0 | \
188 SPWTDP_IRQ_EDI1 | SPWTDP_IRQ_EDI2 | SPWTDP_IRQ_EDI3 | SPWTDP_IRQ_SET |\
189 SPWTDP_IRQ_P0 | SPWTDP_IRQ_P1 | SPWTDP_IRQ_P2 | SPWTDP_IRQ_P3 | \
190 SPWTDP_IRQ_P4 | SPWTDP_IRQ_P5 | SPWTDP_IRQ_P6 | SPWTDP_IRQ_P7 | \
192#define SPWTDP_IRQ_ALL (SPWTDP_IRQ_WCLEAR)
194#define SPWTDP_IRQ_S_BIT 0
195#define SPWTDP_IRQ_TR_BIT 1
196#define SPWTDP_IRQ_TM_BIT 2
197#define SPWTDP_IRQ_TT_BIT 3
198#define SPWTDP_IRQ_DIR_BIT 4
199#define SPWTDP_IRQ_DIT_BIT 5
200#define SPWTDP_IRQ_EDI0_BIT 6
201#define SPWTDP_IRQ_EDI1_BIT 7
202#define SPWTDP_IRQ_EDI2_BIT 8
203#define SPWTDP_IRQ_EDI3_BIT 9
204#define SPWTDP_IRQ_SET_BIT 10
205#define SPWTDP_IRQ_P0_BIT 11
206#define SPWTDP_IRQ_P1_BIT 12
207#define SPWTDP_IRQ_P2_BIT 13
208#define SPWTDP_IRQ_P3_BIT 14
209#define SPWTDP_IRQ_P4_BIT 15
210#define SPWTDP_IRQ_P5_BIT 16
211#define SPWTDP_IRQ_P6_BIT 17
212#define SPWTDP_IRQ_P7_BIT 18
213#define SPWTDP_IRQ_NCTC_BIT 19
216void spwtdp_register_drv(
void);
222extern void *spwtdp_open(
int dev_no);
225extern int spwtdp_close(
void *
spwtdp);
228extern int spwtdp_reset(
void *
spwtdp);
231extern int spwtdp_freq_setup(
void *
spwtdp, uint32_t fsinc, uint32_t
cv,
235extern int spwtdp_interrupt_unmask(
void *
spwtdp, uint32_t irqmask);
238extern int spwtdp_interrupt_mask(
void *
spwtdp, uint32_t irqmask);
245typedef void (*spwtdp_isr_t)(
unsigned int ists,
void *data);
250extern int spwtdp_isr_register(
void *
spwtdp, spwtdp_isr_t isr,
void *data);
253extern int spwtdp_isr_unregister(
void *
spwtdp);
256extern int spwtdp_interrupt_status(
void *
spwtdp, uint32_t *sts,
260#define SPWTDP_TDP_ENABLE CONF0_TD
261#define SPWTDP_TDP_DISABLE 0
262#define SPWTDP_LATENCY_ENABLE CONF0_LE
263#define SPWTDP_LATENCY_DISABLE 0
264#define SPWTDP_EXTET_INC_POLARITY_RISING CONF0_EP
265#define SPWTDP_EXTET_INC_POLARITY_FALLING 0
266#define SPWTDP_EXTET_INC_ENABLE CONF0_ET
267#define SPWTDP_EXTET_INC_DISABLE 0
268#define SPWTDP_EXTET_POLARITY_RISING CONF0_SP
269#define SPWTDP_EXTET_POLARITY_FALLING 0
270#define SPWTDP_EXTET_ENABLE CONF0_SE
271#define SPWTDP_EXTET_DISABLE 0
272#define SPWTDP_TARGET_SPWSYNC_ENABLE CONF0_ST
273#define SPWTDP_TARGET_SPWSYNC_DISABLE 0
274#define SPWTDP_TARGET_JITTERC_ENABLE CONF0_JE
275#define SPWTDP_TARGET_JITTERC_DISABLE 0
276#define SPWTDP_TARGET_MITIGATION_ENABLE CONF0_ME
277#define SPWTDP_TARGET_MITIGATION_DISABLE 0
278extern int spwtdp_initiator_conf(
void *
spwtdp, uint8_t mapping,
280extern int spwtdp_target_conf(
void *
spwtdp, uint8_t mapping, uint32_t options);
283extern int spwtdp_initiator_int_conf(
void *
spwtdp, uint8_t stm, uint8_t inrx,
285#define SPWTDP_TARGET_DISTINT_INTACK CONF3_DI
286#define SPWTDP_TARGET_DISTINT_INT 0
287extern int spwtdp_target_int_conf(
void *
spwtdp, uint8_t inrx, uint8_t intx,
291extern int spwtdp_initiator_enable(
void *
spwtdp);
292extern int spwtdp_target_enable(
void *
spwtdp);
295extern int spwtdp_initiator_disable(
void *
spwtdp);
296extern int spwtdp_target_disable(
void *
spwtdp);
299extern int spwtdp_status(
void *
spwtdp, uint32_t *sts, uint32_t clrmask);
305#define SPWTDP_TIME_DATA_LENGTH 20
307 uint8_t data[SPWTDP_TIME_DATA_LENGTH];
320extern int spwtdp_initiator_tstx_conf(
void *
spwtdp, uint8_t tstc);
324extern int spwtdp_initiator_cmd_spwtc_set(
void *
spwtdp, uint8_t spwtc);
325#define SPWTDP_TARGET_CTRL_NEWCOMMAND_ENABLE CTRL_NC
326#define SPWTDP_TARGET_CTRL_NEWCOMMAND_DISABLE 0
327#define SPWTDP_TARGET_CTRL_INIT CTRL_IS
328#define SPWTDP_TARGET_CTRL_SYNC 0
329extern int spwtdp_target_cmd_conf(
void *
spwtdp, uint8_t spwtc, uint16_t cpf,
333extern int spwtdp_precision_get(
void *
spwtdp, uint8_t *fine, uint8_t *coarse);
This structure defines the SPWTDP register block memory map.
Definition: spwtdp-regs.h:1055
unsigned cv
Definition: tte.h:15