31#ifndef __GRSPW_ROUTER_H__
32#define __GRSPW_ROUTER_H__
41#define ROUTER_ERR_OK 0
42#define ROUTER_ERR_EINVAL -1
43#define ROUTER_ERR_ERROR -2
44#define ROUTER_ERR_TOOMANY -3
45#define ROUTER_ERR_IMPLEMENTED -4
62 uint8_t amba_port_fifo_size;
63 uint8_t spw_port_fifo_size;
66 int8_t aux_dist_int_support;
67 int8_t dual_port_support;
68 int8_t dist_int_support;
70 uint8_t pktcnt_support;
71 uint8_t charcnt_support;
74#define ROUTER_FLG_CFG 0x01
75#define ROUTER_FLG_IID 0x02
76#define ROUTER_FLG_IDIV 0x04
77#define ROUTER_FLG_TPRES 0x08
78#define ROUTER_FLG_TRLD 0x10
79#define ROUTER_FLG_ALL 0x1f
94 uint32_t timer_prescaler;
100 uint32_t control_logical[224];
106 uint32_t pmap_logical[224];
110#define ROUTER_ROUTE_FLG_MAP 0x01
111#define ROUTER_ROUTE_FLG_CTRL 0x02
112#define ROUTER_ROUTE_FLG_ALL 0x3
121#define ROUTER_PORT_FLG_SET_CTRL 0x01
122#define ROUTER_PORT_FLG_GET_CTRL 0x02
123#define ROUTER_PORT_FLG_SET_STS 0x04
124#define ROUTER_PORT_FLG_GET_STS 0x08
125#define ROUTER_PORT_FLG_SET_CTRL2 0x10
126#define ROUTER_PORT_FLG_GET_CTRL2 0x20
127#define ROUTER_PORT_FLG_SET_TIMER 0x40
128#define ROUTER_PORT_FLG_GET_TIMER 0x80
129#define ROUTER_PORT_FLG_SET_PKTLEN 0x100
130#define ROUTER_PORT_FLG_GET_PKTLEN 0x200
140 uint32_t timer_reload;
142 uint32_t packet_length;
146void router_register_drv(
void);
148extern void *router_open(
unsigned int dev_no);
149extern int router_close(
void *d);
150extern int router_print(
void *d);
151extern int router_hwinfo_get(
void *d,
struct router_hw_info *hwinfo);
154extern int router_config_set(
void *d,
struct router_config *cfg);
155extern int router_config_get(
void *d,
struct router_config *cfg);
158extern int router_routing_table_set(
void *d,
160extern int router_routing_table_get(
void *d,
166#define PCTRL_RD (0xff << PCTRL_RD_BIT)
167#define PCTRL_ST (0x1 << PCTRL_ST_BIT)
168#define PCTRL_SR (0x1 << PCTRL_SR_BIT)
169#define PCTRL_AD (0x1 << PCTRL_AD_BIT)
170#define PCTRL_LR (0x1 << PCTRL_LR_BIT)
171#define PCTRL_PL (0x1 << PCTRL_PL_BIT)
172#define PCTRL_TS (0x1 << PCTRL_TS_BIT)
173#define PCTRL_IC (0x1 << PCTRL_IC_BIT)
174#define PCTRL_ET (0x1 << PCTRL_ET_BIT)
175#define PCTRL_NP (0x1 << PCTRL_NP_BIT)
176#define PCTRL_PS (0x1 << PCTRL_PS_BIT)
177#define PCTRL_BE (0x1 << PCTRL_BE_BIT)
178#define PCTRL_DI (0x1 << PCTRL_DI_BIT)
179#define PCTRL_TR (0x1 << PCTRL_TR_BIT)
180#define PCTRL_PR (0x1 << PCTRL_PR_BIT)
181#define PCTRL_TF (0x1 << PCTRL_TF_BIT)
182#define PCTRL_RS (0x1 << PCTRL_RS_BIT)
183#define PCTRL_TE (0x1 << PCTRL_TE_BIT)
184#define PCTRL_CE (0x1 << PCTRL_CE_BIT)
185#define PCTRL_AS (0x1 << PCTRL_AS_BIT)
186#define PCTRL_LS (0x1 << PCTRL_LS_BIT)
187#define PCTRL_LD (0x1 << PCTRL_LD_BIT)
189#define PCTRL_RD_BIT 24
190#define PCTRL_ST_BIT 21
191#define PCTRL_SR_BIT 20
192#define PCTRL_AD_BIT 19
193#define PCTRL_LR_BIT 18
194#define PCTRL_PL_BIT 17
195#define PCTRL_TS_BIT 16
196#define PCTRL_IC_BIT 15
197#define PCTRL_ET_BIT 14
198#define PCTRL_NP_BIT 13
199#define PCTRL_PS_BIT 12
200#define PCTRL_BE_BIT 11
201#define PCTRL_DI_BIT 10
202#define PCTRL_TR_BIT 9
203#define PCTRL_PR_BIT 8
204#define PCTRL_TF_BIT 7
205#define PCTRL_RS_BIT 6
206#define PCTRL_TE_BIT 5
207#define PCTRL_CE_BIT 3
208#define PCTRL_AS_BIT 2
209#define PCTRL_LS_BIT 1
210#define PCTRL_LD_BIT 0
215#define PCTRL2_SM (0xff << PCTRL2_SM_BIT)
216#define PCTRL2_SV (0xff << PCTRL2_SV_BIT)
217#define PCTRL2_OR (0x1 << PCTRL2_OR_BIT)
218#define PCTRL2_UR (0x1 << PCTRL2_UR_BIT)
219#define PCTRL2_AT (0x1 << PCTRL2_AT_BIT)
220#define PCTRL2_AR (0x1 << PCTRL2_AR_BIT)
221#define PCTRL2_IT (0x1 << PCTRL2_IT_BIT)
222#define PCTRL2_IR (0x1 << PCTRL2_IR_BIT)
223#define PCTRL2_SD (0x1f << PCTRL2_SD_BIT)
224#define PCTRL2_SC (0x1f << PCTRL2_SC_BIT)
226#define PCTRL2_SM_BIT 24
227#define PCTRL2_SV_BIT 16
228#define PCTRL2_OR_BIT 15
229#define PCTRL2_UR_BIT 14
230#define PCTRL2_AT_BIT 12
231#define PCTRL2_AR_BIT 11
232#define PCTRL2_IT_BIT 10
233#define PCTRL2_IR_BIT 9
234#define PCTRL2_SD_BIT 1
235#define PCTRL2_SC_BIT 0
238extern int router_port_ioc(
void *d,
int port,
struct router_port *cfg);
241extern int router_port_ctrl_rmw(
void *d,
int port, uint32_t *oldvalue, uint32_t bitmask, uint32_t value);
243extern int router_port_ctrl2_rmw(
void *d,
int port, uint32_t *oldvalue, uint32_t bitmask, uint32_t value);
245extern int router_port_ctrl_get(
void *d,
int port, uint32_t *ctrl);
247extern int router_port_ctrl2_get(
void *d,
int port, uint32_t *ctrl2);
249extern int router_port_ctrl_set(
void *d,
int port, uint32_t mask, uint32_t ctrl);
251extern int router_port_ctrl2_set(
void *d,
int port, uint32_t mask, uint32_t ctrl2);
253extern int router_port_treload_set(
void *d,
int port, uint32_t reload);
255extern int router_port_treload_get(
void *d,
int port, uint32_t *reload);
257extern int router_port_maxplen_get(
void *d,
int port, uint32_t *length);
259extern int router_port_maxplen_set(
void *d,
int port, uint32_t length);
264#define PSTSCFG_EO (0x1 << PSTSCFG_EO_BIT)
265#define PSTSCFG_EE (0x1 << PSTSCFG_EE_BIT)
266#define PSTSCFG_PL (0x1 << PSTSCFG_PL_BIT)
267#define PSTSCFG_TT (0x1 << PSTSCFG_TT_BIT)
268#define PSTSCFG_PT (0x1 << PSTSCFG_PT_BIT)
269#define PSTSCFG_HC (0x1 << PSTSCFG_HC_BIT)
270#define PSTSCFG_PI (0x1 << PSTSCFG_PI_BIT)
271#define PSTSCFG_CE (0x1 << PSTSCFG_CE_BIT)
272#define PSTSCFG_EC (0xf << PSTSCFG_EC_BIT)
273#define PSTSCFG_TS (0x1 << PSTSCFG_TS_BIT)
274#define PSTSCFG_ME (0x1 << PSTSCFG_ME_BIT)
275#define PSTSCFG_IP (0x1f << PSTSCFG_IP_BIT)
276#define PSTSCFG_CP (0x1 << PSTSCFG_CP_BIT)
277#define PSTSCFG_PC (0xf << PSTSCFG_PC_BIT)
278#define PSTSCFG_WCLEAR (PSTSCFG_EO | PSTSCFG_EE | PSTSCFG_PL | \
279 PSTSCFG_TT | PSTSCFG_PT | PSTSCFG_HC | \
280 PSTSCFG_PI | PSTSCFG_CE | PSTSCFG_TS | \
281 PSTSCFG_ME | PSTSCFG_CP)
282#define PSTSCFG_WCLEAR2 (PSTSCFG_CE | PSTSCFG_CP)
284#define PSTSCFG_EO_BIT 31
285#define PSTSCFG_EE_BIT 30
286#define PSTSCFG_PL_BIT 29
287#define PSTSCFG_TT_BIT 28
288#define PSTSCFG_PT_BIT 27
289#define PSTSCFG_HC_BIT 26
290#define PSTSCFG_PI_BIT 25
291#define PSTSCFG_CE_BIT 24
292#define PSTSCFG_EC_BIT 20
293#define PSTSCFG_TS_BIT 18
294#define PSTSCFG_ME_BIT 17
295#define PSTSCFG_IP_BIT 7
296#define PSTSCFG_CP_BIT 4
297#define PSTSCFG_PC_BIT 0
302#define PSTS_PT (0x3 << PSTS_PT_BIT)
303#define PSTS_PL (0x1 << PSTS_PL_BIT)
304#define PSTS_TT (0x1 << PSTS_TT_BIT)
305#define PSTS_RS (0x1 << PSTS_RS_BIT)
306#define PSTS_SR (0x1 << PSTS_SR_BIT)
307#define PSTS_LR (0x1 << PSTS_LR_BIT)
308#define PSTS_SP (0x1 << PSTS_SP_BIT)
309#define PSTS_AC (0x1 << PSTS_AC_BIT)
310#define PSTS_TS (0x1 << PSTS_TS_BIT)
311#define PSTS_ME (0x1 << PSTS_ME_BIT)
312#define PSTS_TF (0x1 << PSTS_TF_BIT)
313#define PSTS_RE (0x1 << PSTS_RE_BIT)
314#define PSTS_LS (0x7 << PSTS_LS_BIT)
315#define PSTS_IP (0x1f << PSTS_IP_BIT)
316#define PSTS_PR (0x1 << PSTS_PR_BIT)
317#define PSTS_PB (0x1 << PSTS_PB_BIT)
318#define PSTS_IA (0x1 << PSTS_IA_BIT)
319#define PSTS_CE (0x1 << PSTS_CE_BIT)
320#define PSTS_ER (0x1 << PSTS_ER_BIT)
321#define PSTS_DE (0x1 << PSTS_DE_BIT)
322#define PSTS_PE (0x1 << PSTS_PE_BIT)
323#define PSTS_WCLEAR (PSTS_PL | PSTS_TT | PSTS_RS | PSTS_SR | \
324 PSTS_TS | PSTS_ME | PSTS_IA | PSTS_CE | \
325 PSTS_ER | PSTS_DE | PSTS_PE)
327#define PSTS_PT_BIT 30
328#define PSTS_PL_BIT 29
329#define PSTS_TT_BIT 28
330#define PSTS_RS_BIT 27
331#define PSTS_SR_BIT 26
332#define PSTS_LR_BIT 22
333#define PSTS_SP_BIT 21
334#define PSTS_AC_BIT 20
335#define PSTS_TS_BIT 18
336#define PSTS_ME_BIT 17
337#define PSTS_TF_BIT 16
338#define PSTS_RE_BIT 15
339#define PSTS_LS_BIT 12
350extern int router_port_status(
void *d,
int port, uint32_t *sts, uint32_t clrmsk);
352#define ROUTER_LINK_STATUS_ERROR_RESET 0
353#define ROUTER_LINK_STATUS_ERROR_WAIT 1
354#define ROUTER_LINK_STATUS_READY 2
355#define ROUTER_LINK_STATUS_STARTED 3
356#define ROUTER_LINK_STATUS_CONNECTING 4
357#define ROUTER_LINK_STATUS_RUN_STATE 5
359extern int router_port_link_status(
void *d,
int port);
361extern int router_port_enable(
void *d,
int port);
362extern int router_port_disable(
void *d,
int port);
363extern int router_port_link_stop(
void *d,
int port);
364extern int router_port_link_start(
void *d,
int port);
365extern int router_port_link_div(
void *d,
int port,
int rundiv);
366extern int router_port_link_receive_spill(
void *d,
int port);
367extern int router_port_link_transmit_reset(
void *d,
int port);
370extern int router_port_cred_get(
void *d,
int port, uint32_t *cred);
375#define RTACTRL_SR (0x1 << RTACTRL_SR_BIT)
376#define RTACTRL_EN (0x1 << RTACTRL_EN_BIT)
377#define RTACTRL_PR (0x1 << RTACTRL_PR_BIT)
378#define RTACTRL_HD (0x1 << RTACTRL_HD_BIT)
380#define RTACTRL_SR_BIT 3
381#define RTACTRL_EN_BIT 2
382#define RTACTRL_PR_BIT 1
383#define RTACTRL_HD_BIT 0
386#define ROUTER_ROUTE_PACKETDISTRIBUTION_ENABLE (0x1 << 16)
387#define ROUTER_ROUTE_PACKETDISTRIBUTION_DISABLE (0x0 << 16)
388#define ROUTER_ROUTE_SPILLIFNOTREADY_ENABLE RTACTRL_SR
389#define ROUTER_ROUTE_SPILLIFNOTREADY_DISABLE 0
390#define ROUTER_ROUTE_ENABLE RTACTRL_EN
391#define ROUTER_ROUTE_DISABLE 0
392#define ROUTER_ROUTE_PRIORITY_HIGH RTACTRL_PR
393#define ROUTER_ROUTE_PRIORITY_LOW 0
394#define ROUTER_ROUTE_HEADERDELETION_ENABLE RTACTRL_HD
395#define ROUTER_ROUTE_HEADERDELETION_DISABLE 0
397 uint8_t from_address;
402extern int router_route_set(
void *d,
struct router_route *route);
403extern int router_route_get(
void *d,
struct router_route *route);
406extern int router_write_enable(
void *d);
407extern int router_write_disable(
void *d);
410extern int router_reset(
void *d);
413extern int router_instance_set(
void *d, uint8_t iid);
415extern int router_instance_get(
void *d, uint8_t *iid);
418extern int router_idiv_set(
void *d, uint8_t idiv);
420extern int router_idiv_get(
void *d, uint8_t *idiv);
423extern int router_tpresc_set(
void *d, uint32_t prescaler);
425extern int router_tpresc_get(
void *d, uint32_t *prescaler);
428extern int router_cfgsts_set(
void *d, uint32_t cfgsts);
429extern int router_cfgsts_get(
void *d, uint32_t *cfgsts);
432extern int router_tc_enable(
void *d);
433extern int router_tc_disable(
void *d);
434extern int router_tc_reset(
void *d);
435extern int router_tc_get(
void *d);
441#define IMASK_PE (0x1 << IMASK_PE_BIT)
442#define IMASK_SR (0x1 << IMASK_SR_BIT)
443#define IMASK_RS (0x1 << IMASK_RS_BIT)
444#define IMASK_TT (0x1 << IMASK_TT_BIT)
445#define IMASK_PL (0x1 << IMASK_PL_BIT)
446#define IMASK_TS (0x1 << IMASK_TS_BIT)
447#define IMASK_AC (0x1 << IMASK_AC_BIT)
448#define IMASK_RE (0x1 << IMASK_RE_BIT)
449#define IMASK_IA (0x1 << IMASK_IA_BIT)
450#define IMASK_LE (0x1 << IMASK_LE_BIT)
451#define IMASK_ME (0x1 << IMASK_ME_BIT)
452#define IMASK_ALL ( IMASK_PE | IMASK_SR | IMASK_RS | IMASK_TT \
453 IMASK_PL | IMASK_TS | IMASK_AC | IMASK_RE | IMASK_IA \
456#define IMASK_PE_BIT 10
457#define IMASK_SR_BIT 9
458#define IMASK_RS_BIT 8
459#define IMASK_TT_BIT 7
460#define IMASK_PL_BIT 6
461#define IMASK_TS_BIT 5
462#define IMASK_AC_BIT 4
463#define IMASK_RE_BIT 3
464#define IMASK_IA_BIT 2
465#define IMASK_LE_BIT 1
466#define IMASK_ME_BIT 0
468#define ROUTER_INTERRUPT_ALL IMASK_ALL
469#define ROUTER_INTERRUPT_SPWPNP_ERROR IMASK_PE
470#define ROUTER_INTERRUPT_SPILLED IMASK_SR
471#define ROUTER_INTERRUPT_RUNSTATE IMASK_RS
472#define ROUTER_INTERRUPT_TC_TRUNCATION IMASK_TT
473#define ROUTER_INTERRUPT_PACKET_TRUNCATION IMASK_PL
474#define ROUTER_INTERRUPT_TIMEOUT IMASK_TS
475#define ROUTER_INTERRUPT_CFGPORT IMASK_AC
476#define ROUTER_INTERRUPT_RMAP_ERROR IMASK_RE
477#define ROUTER_INTERRUPT_INVALID_ADDRESS IMASK_IA
478#define ROUTER_INTERRUPT_LINK_ERROR IMASK_LE
479#define ROUTER_INTERRUPT_MEMORY_ERROR IMASK_ME
480extern int router_port_interrupt_unmask(
void *d,
int port);
481extern int router_port_interrupt_mask(
void *d,
int port);
482extern int router_interrupt_unmask(
void *d,
int options);
483extern int router_interrupt_mask(
void *d,
int options);
489#define ICODEGEN_UA (0x1 << ICODEGEN_UA_BIT)
490#define ICODEGEN_AH (0x1 << ICODEGEN_AH_BIT)
491#define ICODEGEN_IT (0x1 << ICODEGEN_IT_BIT)
492#define ICODEGEN_TE (0x1 << ICODEGEN_TE_BIT)
493#define ICODEGEN_EN (0x1 << ICODEGEN_EN_BIT)
494#define ICODEGEN_IN (0x1f << ICODEGEN_IN_BIT)
496#define ICODEGEN_UA_BIT 20
497#define ICODEGEN_AH_BIT 19
498#define ICODEGEN_IT_BIT 18
499#define ICODEGEN_TE_BIT 17
500#define ICODEGEN_EN_BIT 16
501#define ICODEGEN_IN_BIT 0
503#define ROUTER_ICODEGEN_ITYPE_EDGE ICODEGEN_IT
504#define ROUTER_ICODEGEN_ITYPE_LEVEL 0
505#define ROUTER_ICODEGEN_AUTOUNACK_ENABLE ICODEGEN_UA
506#define ROUTER_ICODEGEN_AUTOUNACK_DISABLE 0
507#define ROUTER_ICODEGEN_AUTOACK_ENABLE ICODEGEN_AH
508#define ROUTER_ICODEGEN_AUTOACK_DISABLE 0
509extern int router_icodegen_enable(
void *d, uint8_t intn, uint32_t aitimer,
511extern int router_icodegen_disable(
void *d);
514extern int router_isrctimer_set(
void *d, uint32_t reloadvalue);
515extern int router_isrctimer_get(
void *d, uint32_t *reloadvalue);
518extern int router_isrtimer_set(
void *d, uint32_t reloadvalue);
519extern int router_isrtimer_get(
void *d, uint32_t *reloadvalue);
Definition: deflate.c:114
Definition: intercom.c:87
Definition: grspw_router.h:81
Definition: grspw_router.h:48
Definition: grspw_router.h:131
Definition: grspw_router.h:98
Definition: grspw_router.h:104
Definition: grspw_router.h:396
Definition: grspw_router.h:113