12 #ifndef __GRSPW_ROUTER_H__ 13 #define __GRSPW_ROUTER_H__ 22 #define ROUTER_ERR_OK 0 23 #define ROUTER_ERR_EINVAL -1 24 #define ROUTER_ERR_ERROR -2 25 #define ROUTER_ERR_TOOMANY -3 26 #define ROUTER_ERR_IMPLEMENTED -4 43 uint8_t amba_port_fifo_size;
44 uint8_t spw_port_fifo_size;
47 int8_t aux_dist_int_support;
48 int8_t dual_port_support;
49 int8_t dist_int_support;
51 uint8_t pktcnt_support;
52 uint8_t charcnt_support;
55 #define ROUTER_FLG_CFG 0x01 56 #define ROUTER_FLG_IID 0x02 57 #define ROUTER_FLG_IDIV 0x04 58 #define ROUTER_FLG_TPRES 0x08 59 #define ROUTER_FLG_TRLD 0x10 60 #define ROUTER_FLG_ALL 0x1f 75 uint32_t timer_prescaler;
81 uint32_t control_logical[224];
87 uint32_t pmap_logical[224];
91 #define ROUTER_ROUTE_FLG_MAP 0x01 92 #define ROUTER_ROUTE_FLG_CTRL 0x02 93 #define ROUTER_ROUTE_FLG_ALL 0x3 102 #define ROUTER_PORT_FLG_SET_CTRL 0x01 103 #define ROUTER_PORT_FLG_GET_CTRL 0x02 104 #define ROUTER_PORT_FLG_SET_STS 0x04 105 #define ROUTER_PORT_FLG_GET_STS 0x08 106 #define ROUTER_PORT_FLG_SET_CTRL2 0x10 107 #define ROUTER_PORT_FLG_GET_CTRL2 0x20 108 #define ROUTER_PORT_FLG_SET_TIMER 0x40 109 #define ROUTER_PORT_FLG_GET_TIMER 0x80 110 #define ROUTER_PORT_FLG_SET_PKTLEN 0x100 111 #define ROUTER_PORT_FLG_GET_PKTLEN 0x200 121 uint32_t timer_reload;
123 uint32_t packet_length;
127 void router_register_drv(
void);
129 extern void *router_open(
unsigned int dev_no);
130 extern int router_close(
void *d);
131 extern int router_print(
void *d);
132 extern int router_hwinfo_get(
void *d,
struct router_hw_info *hwinfo);
135 extern int router_config_set(
void *d,
struct router_config *cfg);
136 extern int router_config_get(
void *d,
struct router_config *cfg);
139 extern int router_routing_table_set(
void *d,
141 extern int router_routing_table_get(
void *d,
147 #define PCTRL_RD (0xff << PCTRL_RD_BIT) 148 #define PCTRL_ST (0x1 << PCTRL_ST_BIT) 149 #define PCTRL_SR (0x1 << PCTRL_SR_BIT) 150 #define PCTRL_AD (0x1 << PCTRL_AD_BIT) 151 #define PCTRL_LR (0x1 << PCTRL_LR_BIT) 152 #define PCTRL_PL (0x1 << PCTRL_PL_BIT) 153 #define PCTRL_TS (0x1 << PCTRL_TS_BIT) 154 #define PCTRL_IC (0x1 << PCTRL_IC_BIT) 155 #define PCTRL_ET (0x1 << PCTRL_ET_BIT) 156 #define PCTRL_NP (0x1 << PCTRL_NP_BIT) 157 #define PCTRL_PS (0x1 << PCTRL_PS_BIT) 158 #define PCTRL_BE (0x1 << PCTRL_BE_BIT) 159 #define PCTRL_DI (0x1 << PCTRL_DI_BIT) 160 #define PCTRL_TR (0x1 << PCTRL_TR_BIT) 161 #define PCTRL_PR (0x1 << PCTRL_PR_BIT) 162 #define PCTRL_TF (0x1 << PCTRL_TF_BIT) 163 #define PCTRL_RS (0x1 << PCTRL_RS_BIT) 164 #define PCTRL_TE (0x1 << PCTRL_TE_BIT) 165 #define PCTRL_CE (0x1 << PCTRL_CE_BIT) 166 #define PCTRL_AS (0x1 << PCTRL_AS_BIT) 167 #define PCTRL_LS (0x1 << PCTRL_LS_BIT) 168 #define PCTRL_LD (0x1 << PCTRL_LD_BIT) 170 #define PCTRL_RD_BIT 24 171 #define PCTRL_ST_BIT 21 172 #define PCTRL_SR_BIT 20 173 #define PCTRL_AD_BIT 19 174 #define PCTRL_LR_BIT 18 175 #define PCTRL_PL_BIT 17 176 #define PCTRL_TS_BIT 16 177 #define PCTRL_IC_BIT 15 178 #define PCTRL_ET_BIT 14 179 #define PCTRL_NP_BIT 13 180 #define PCTRL_PS_BIT 12 181 #define PCTRL_BE_BIT 11 182 #define PCTRL_DI_BIT 10 183 #define PCTRL_TR_BIT 9 184 #define PCTRL_PR_BIT 8 185 #define PCTRL_TF_BIT 7 186 #define PCTRL_RS_BIT 6 187 #define PCTRL_TE_BIT 5 188 #define PCTRL_CE_BIT 3 189 #define PCTRL_AS_BIT 2 190 #define PCTRL_LS_BIT 1 191 #define PCTRL_LD_BIT 0 196 #define PCTRL2_SM (0xff << PCTRL2_SM_BIT) 197 #define PCTRL2_SV (0xff << PCTRL2_SV_BIT) 198 #define PCTRL2_OR (0x1 << PCTRL2_OR_BIT) 199 #define PCTRL2_UR (0x1 << PCTRL2_UR_BIT) 200 #define PCTRL2_AT (0x1 << PCTRL2_AT_BIT) 201 #define PCTRL2_AR (0x1 << PCTRL2_AR_BIT) 202 #define PCTRL2_IT (0x1 << PCTRL2_IT_BIT) 203 #define PCTRL2_IR (0x1 << PCTRL2_IR_BIT) 204 #define PCTRL2_SD (0x1f << PCTRL2_SD_BIT) 205 #define PCTRL2_SC (0x1f << PCTRL2_SC_BIT) 207 #define PCTRL2_SM_BIT 24 208 #define PCTRL2_SV_BIT 16 209 #define PCTRL2_OR_BIT 15 210 #define PCTRL2_UR_BIT 14 211 #define PCTRL2_AT_BIT 12 212 #define PCTRL2_AR_BIT 11 213 #define PCTRL2_IT_BIT 10 214 #define PCTRL2_IR_BIT 9 215 #define PCTRL2_SD_BIT 1 216 #define PCTRL2_SC_BIT 0 219 extern int router_port_ioc(
void *d,
int port,
struct router_port *cfg);
222 extern int router_port_ctrl_rmw(
void *d,
int port, uint32_t *oldvalue, uint32_t bitmask, uint32_t value);
224 extern int router_port_ctrl2_rmw(
void *d,
int port, uint32_t *oldvalue, uint32_t bitmask, uint32_t value);
226 extern int router_port_ctrl_get(
void *d,
int port, uint32_t *ctrl);
228 extern int router_port_ctrl2_get(
void *d,
int port, uint32_t *ctrl2);
230 extern int router_port_ctrl_set(
void *d,
int port, uint32_t mask, uint32_t ctrl);
232 extern int router_port_ctrl2_set(
void *d,
int port, uint32_t mask, uint32_t ctrl2);
234 extern int router_port_treload_set(
void *d,
int port, uint32_t reload);
236 extern int router_port_treload_get(
void *d,
int port, uint32_t *reload);
238 extern int router_port_maxplen_get(
void *d,
int port, uint32_t *length);
240 extern int router_port_maxplen_set(
void *d,
int port, uint32_t length);
245 #define PSTSCFG_EO (0x1 << PSTSCFG_EO_BIT) 246 #define PSTSCFG_EE (0x1 << PSTSCFG_EE_BIT) 247 #define PSTSCFG_PL (0x1 << PSTSCFG_PL_BIT) 248 #define PSTSCFG_TT (0x1 << PSTSCFG_TT_BIT) 249 #define PSTSCFG_PT (0x1 << PSTSCFG_PT_BIT) 250 #define PSTSCFG_HC (0x1 << PSTSCFG_HC_BIT) 251 #define PSTSCFG_PI (0x1 << PSTSCFG_PI_BIT) 252 #define PSTSCFG_CE (0x1 << PSTSCFG_CE_BIT) 253 #define PSTSCFG_EC (0xf << PSTSCFG_EC_BIT) 254 #define PSTSCFG_TS (0x1 << PSTSCFG_TS_BIT) 255 #define PSTSCFG_ME (0x1 << PSTSCFG_ME_BIT) 256 #define PSTSCFG_IP (0x1f << PSTSCFG_IP_BIT) 257 #define PSTSCFG_CP (0x1 << PSTSCFG_CP_BIT) 258 #define PSTSCFG_PC (0xf << PSTSCFG_PC_BIT) 259 #define PSTSCFG_WCLEAR (PSTSCFG_EO | PSTSCFG_EE | PSTSCFG_PL | \ 260 PSTSCFG_TT | PSTSCFG_PT | PSTSCFG_HC | \ 261 PSTSCFG_PI | PSTSCFG_CE | PSTSCFG_TS | \ 262 PSTSCFG_ME | PSTSCFG_CP) 263 #define PSTSCFG_WCLEAR2 (PSTSCFG_CE | PSTSCFG_CP) 265 #define PSTSCFG_EO_BIT 31 266 #define PSTSCFG_EE_BIT 30 267 #define PSTSCFG_PL_BIT 29 268 #define PSTSCFG_TT_BIT 28 269 #define PSTSCFG_PT_BIT 27 270 #define PSTSCFG_HC_BIT 26 271 #define PSTSCFG_PI_BIT 25 272 #define PSTSCFG_CE_BIT 24 273 #define PSTSCFG_EC_BIT 20 274 #define PSTSCFG_TS_BIT 18 275 #define PSTSCFG_ME_BIT 17 276 #define PSTSCFG_IP_BIT 7 277 #define PSTSCFG_CP_BIT 4 278 #define PSTSCFG_PC_BIT 0 283 #define PSTS_PT (0x3 << PSTS_PT_BIT) 284 #define PSTS_PL (0x1 << PSTS_PL_BIT) 285 #define PSTS_TT (0x1 << PSTS_TT_BIT) 286 #define PSTS_RS (0x1 << PSTS_RS_BIT) 287 #define PSTS_SR (0x1 << PSTS_SR_BIT) 288 #define PSTS_LR (0x1 << PSTS_LR_BIT) 289 #define PSTS_SP (0x1 << PSTS_SP_BIT) 290 #define PSTS_AC (0x1 << PSTS_AC_BIT) 291 #define PSTS_TS (0x1 << PSTS_TS_BIT) 292 #define PSTS_ME (0x1 << PSTS_ME_BIT) 293 #define PSTS_TF (0x1 << PSTS_TF_BIT) 294 #define PSTS_RE (0x1 << PSTS_RE_BIT) 295 #define PSTS_LS (0x7 << PSTS_LS_BIT) 296 #define PSTS_IP (0x1f << PSTS_IP_BIT) 297 #define PSTS_PR (0x1 << PSTS_PR_BIT) 298 #define PSTS_PB (0x1 << PSTS_PB_BIT) 299 #define PSTS_IA (0x1 << PSTS_IA_BIT) 300 #define PSTS_CE (0x1 << PSTS_CE_BIT) 301 #define PSTS_ER (0x1 << PSTS_ER_BIT) 302 #define PSTS_DE (0x1 << PSTS_DE_BIT) 303 #define PSTS_PE (0x1 << PSTS_PE_BIT) 304 #define PSTS_WCLEAR (PSTS_PL | PSTS_TT | PSTS_RS | PSTS_SR | \ 305 PSTS_TS | PSTS_ME | PSTS_IA | PSTS_CE | \ 306 PSTS_ER | PSTS_DE | PSTS_PE) 308 #define PSTS_PT_BIT 30 309 #define PSTS_PL_BIT 29 310 #define PSTS_TT_BIT 28 311 #define PSTS_RS_BIT 27 312 #define PSTS_SR_BIT 26 313 #define PSTS_LR_BIT 22 314 #define PSTS_SP_BIT 21 315 #define PSTS_AC_BIT 20 316 #define PSTS_TS_BIT 18 317 #define PSTS_ME_BIT 17 318 #define PSTS_TF_BIT 16 319 #define PSTS_RE_BIT 15 320 #define PSTS_LS_BIT 12 321 #define PSTS_IP_BIT 7 322 #define PSTS_PR_BIT 6 323 #define PSTS_PB_BIT 5 324 #define PSTS_IA_BIT 4 325 #define PSTS_CE_BIT 3 326 #define PSTS_ER_BIT 2 327 #define PSTS_DE_BIT 1 328 #define PSTS_PE_BIT 0 331 extern int router_port_status(
void *d,
int port, uint32_t *sts, uint32_t clrmsk);
333 #define ROUTER_LINK_STATUS_ERROR_RESET 0 334 #define ROUTER_LINK_STATUS_ERROR_WAIT 1 335 #define ROUTER_LINK_STATUS_READY 2 336 #define ROUTER_LINK_STATUS_STARTED 3 337 #define ROUTER_LINK_STATUS_CONNECTING 4 338 #define ROUTER_LINK_STATUS_RUN_STATE 5 340 extern int router_port_link_status(
void *d,
int port);
342 extern int router_port_enable(
void *d,
int port);
343 extern int router_port_disable(
void *d,
int port);
344 extern int router_port_link_stop(
void *d,
int port);
345 extern int router_port_link_start(
void *d,
int port);
346 extern int router_port_link_receive_spill(
void *d,
int port);
347 extern int router_port_link_transmit_reset(
void *d,
int port);
350 extern int router_port_cred_get(
void *d,
int port, uint32_t *cred);
355 #define RTACTRL_SR (0x1 << RTACTRL_SR_BIT) 356 #define RTACTRL_EN (0x1 << RTACTRL_EN_BIT) 357 #define RTACTRL_PR (0x1 << RTACTRL_PR_BIT) 358 #define RTACTRL_HD (0x1 << RTACTRL_HD_BIT) 360 #define RTACTRL_SR_BIT 3 361 #define RTACTRL_EN_BIT 2 362 #define RTACTRL_PR_BIT 1 363 #define RTACTRL_HD_BIT 0 366 #define ROUTER_ROUTE_PACKETDISTRIBUTION_ENABLE (0x1 << 16) 367 #define ROUTER_ROUTE_PACKETDISTRIBUTION_DISABLE (0x0 << 16) 368 #define ROUTER_ROUTE_SPILLIFNOTREADY_ENABLE RTACTRL_SR 369 #define ROUTER_ROUTE_SPILLIFNOTREADY_DISABLE 0 370 #define ROUTER_ROUTE_ENABLE RTACTRL_EN 371 #define ROUTER_ROUTE_DISABLE 0 372 #define ROUTER_ROUTE_PRIORITY_HIGH RTACTRL_PR 373 #define ROUTER_ROUTE_PRIORITY_LOW 0 374 #define ROUTER_ROUTE_HEADERDELETION_ENABLE RTACTRL_HD 375 #define ROUTER_ROUTE_HEADERDELETION_DISABLE 0 377 uint8_t from_address;
382 extern int router_route_set(
void *d,
struct router_route *route);
383 extern int router_route_get(
void *d,
struct router_route *route);
386 extern int router_write_enable(
void *d);
387 extern int router_write_disable(
void *d);
390 extern int router_reset(
void *d);
393 extern int router_instance_set(
void *d, uint8_t iid);
395 extern int router_instance_get(
void *d, uint8_t *iid);
398 extern int router_idiv_set(
void *d, uint8_t idiv);
400 extern int router_idiv_get(
void *d, uint8_t *idiv);
403 extern int router_tpresc_set(
void *d, uint32_t prescaler);
405 extern int router_tpresc_get(
void *d, uint32_t *prescaler);
408 extern int router_cfgsts_set(
void *d, uint32_t cfgsts);
409 extern int router_cfgsts_get(
void *d, uint32_t *cfgsts);
412 extern int router_tc_enable(
void *d);
413 extern int router_tc_disable(
void *d);
414 extern int router_tc_reset(
void *d);
415 extern int router_tc_get(
void *d);
421 #define IMASK_PE (0x1 << IMASK_PE_BIT) 422 #define IMASK_SR (0x1 << IMASK_SR_BIT) 423 #define IMASK_RS (0x1 << IMASK_RS_BIT) 424 #define IMASK_TT (0x1 << IMASK_TT_BIT) 425 #define IMASK_PL (0x1 << IMASK_PL_BIT) 426 #define IMASK_TS (0x1 << IMASK_TS_BIT) 427 #define IMASK_AC (0x1 << IMASK_AC_BIT) 428 #define IMASK_RE (0x1 << IMASK_RE_BIT) 429 #define IMASK_IA (0x1 << IMASK_IA_BIT) 430 #define IMASK_LE (0x1 << IMASK_LE_BIT) 431 #define IMASK_ME (0x1 << IMASK_ME_BIT) 432 #define IMASK_ALL ( IMASK_PE | IMASK_SR | IMASK_RS | IMASK_TT \ 433 IMASK_PL | IMASK_TS | IMASK_AC | IMASK_RE | IMASK_IA \ 436 #define IMASK_PE_BIT 10 437 #define IMASK_SR_BIT 9 438 #define IMASK_RS_BIT 8 439 #define IMASK_TT_BIT 7 440 #define IMASK_PL_BIT 6 441 #define IMASK_TS_BIT 5 442 #define IMASK_AC_BIT 4 443 #define IMASK_RE_BIT 3 444 #define IMASK_IA_BIT 2 445 #define IMASK_LE_BIT 1 446 #define IMASK_ME_BIT 0 448 #define ROUTER_INTERRUPT_ALL IMASK_ALL 449 #define ROUTER_INTERRUPT_SPWPNP_ERROR IMASK_PE 450 #define ROUTER_INTERRUPT_SPILLED IMASK_SR 451 #define ROUTER_INTERRUPT_RUNSTATE IMASK_RS 452 #define ROUTER_INTERRUPT_TC_TRUNCATION IMASK_TT 453 #define ROUTER_INTERRUPT_PACKET_TRUNCATION IMASK_PL 454 #define ROUTER_INTERRUPT_TIMEOUT IMASK_TS 455 #define ROUTER_INTERRUPT_CFGPORT IMASK_AC 456 #define ROUTER_INTERRUPT_RMAP_ERROR IMASK_RE 457 #define ROUTER_INTERRUPT_INVALID_ADDRESS IMASK_IA 458 #define ROUTER_INTERRUPT_LINK_ERROR IMASK_LE 459 #define ROUTER_INTERRUPT_MEMORY_ERROR IMASK_ME 460 extern int router_port_interrupt_unmask(
void *d,
int port);
461 extern int router_port_interrupt_mask(
void *d,
int port);
462 extern int router_interrupt_unmask(
void *d,
int options);
463 extern int router_interrupt_mask(
void *d,
int options);
469 #define ICODEGEN_UA (0x1 << ICODEGEN_UA_BIT) 470 #define ICODEGEN_AH (0x1 << ICODEGEN_AH_BIT) 471 #define ICODEGEN_IT (0x1 << ICODEGEN_IT_BIT) 472 #define ICODEGEN_TE (0x1 << ICODEGEN_TE_BIT) 473 #define ICODEGEN_EN (0x1 << ICODEGEN_EN_BIT) 474 #define ICODEGEN_IN (0x1f << ICODEGEN_IN_BIT) 476 #define ICODEGEN_UA_BIT 20 477 #define ICODEGEN_AH_BIT 19 478 #define ICODEGEN_IT_BIT 18 479 #define ICODEGEN_TE_BIT 17 480 #define ICODEGEN_EN_BIT 16 481 #define ICODEGEN_IN_BIT 0 483 #define ROUTER_ICODEGEN_ITYPE_EDGE ICODEGEN_IT 484 #define ROUTER_ICODEGEN_ITYPE_LEVEL 0 485 #define ROUTER_ICODEGEN_AUTOUNACK_ENABLE ICODEGEN_UA 486 #define ROUTER_ICODEGEN_AUTOUNACK_DISABLE 0 487 #define ROUTER_ICODEGEN_AUTOACK_ENABLE ICODEGEN_AH 488 #define ROUTER_ICODEGEN_AUTOACK_DISABLE 0 489 extern int router_icodegen_enable(
void *d, uint8_t intn, uint32_t aitimer,
491 extern int router_icodegen_disable(
void *d);
494 extern int router_isrctimer_set(
void *d, uint32_t reloadvalue);
495 extern int router_isrctimer_get(
void *d, uint32_t *reloadvalue);
498 extern int router_isrtimer_set(
void *d, uint32_t reloadvalue);
499 extern int router_isrtimer_get(
void *d, uint32_t *reloadvalue);
Definition: deflate.c:115
Definition: grspw_router.h:112
Definition: grspw_router.h:376
Definition: grspw_router.h:29
Definition: grspw_router.h:79
Definition: grspw_router.h:85
Definition: grspw_router.h:62
Definition: intercom.c:74
Definition: grspw_router.h:94