12 #ifndef __GRSPW_PKT_H__ 13 #define __GRSPW_PKT_H__ 23 extern int grspw_work_task_priority;
25 #ifndef GRSPW_PKT_FLAGS 26 #define GRSPW_PKT_FLAGS 30 #define TXPKT_FLAG_IE 0x0040 35 #define TXPKT_FLAG_HCRC 0x0100 41 #define TXPKT_FLAG_DCRC 0x0200 44 #define TXPKT_FLAG_DCRCT_MASK 0x0c00 46 #define TXPKT_FLAG_DCRCT_RMAP 0x0000 48 #define TXPKT_FLAG_DCRCT_CCSDS 0x0400 50 #define TXPKT_FLAG_DCRCT_ISO16 0x0800 54 #define TXPKT_FLAG_NOCRC_MASK 0x0000000f 55 #define TXPKT_FLAG_NOCRC_LEN0 0x00000000 56 #define TXPKT_FLAG_NOCRC_LEN1 0x00000001 57 #define TXPKT_FLAG_NOCRC_LEN2 0x00000002 58 #define TXPKT_FLAG_NOCRC_LEN3 0x00000003 59 #define TXPKT_FLAG_NOCRC_LEN4 0x00000004 60 #define TXPKT_FLAG_NOCRC_LEN5 0x00000005 61 #define TXPKT_FLAG_NOCRC_LEN6 0x00000006 62 #define TXPKT_FLAG_NOCRC_LEN7 0x00000007 63 #define TXPKT_FLAG_NOCRC_LEN8 0x00000008 64 #define TXPKT_FLAG_NOCRC_LEN9 0x00000009 65 #define TXPKT_FLAG_NOCRC_LENa 0x0000000a 66 #define TXPKT_FLAG_NOCRC_LENb 0x0000000b 67 #define TXPKT_FLAG_NOCRC_LENc 0x0000000c 68 #define TXPKT_FLAG_NOCRC_LENd 0x0000000d 69 #define TXPKT_FLAG_NOCRC_LENe 0x0000000e 70 #define TXPKT_FLAG_NOCRC_LENf 0x0000000f 72 #define TXPKT_FLAG_INPUT_MASK (TXPKT_FLAG_NOCRC_MASK | TXPKT_FLAG_IE | \ 73 TXPKT_FLAG_HCRC | TXPKT_FLAG_DCRC | \ 74 TXPKT_FLAG_DCRCT_MASK) 77 #define TXPKT_FLAG_TX 0x4000 80 #define TXPKT_FLAG_LINKERR 0x8000 82 #define TXPKT_FLAG_OUTPUT_MASK (TXPKT_FLAG_TX | TXPKT_FLAG_LINKERR) 87 #define RXPKT_FLAG_IE 0x0010 89 #define RXPKT_FLAG_INPUT_MASK (RXPKT_FLAG_IE) 92 #define RXPKT_FLAG_TRUNK 0x0800 94 #define RXPKT_FLAG_DCRC 0x0400 96 #define RXPKT_FLAG_HCRC 0x0200 98 #define RXPKT_FLAG_EEOP 0x0100 100 #define RXPKT_FLAG_RX 0x8000 102 #define RXPKT_FLAG_OUTPUT_MASK (RXPKT_FLAG_TRUNK | RXPKT_FLAG_DCRC | \ 103 RXPKT_FLAG_HCRC | RXPKT_FLAG_EEOP) 108 #define PKT_FLAG_TR_DATA 0x1000 109 #define PKT_FLAG_TR_HDR 0x2000 111 #define PKT_FLAG_MASK 0x3000 134 unsigned short flags;
135 unsigned char reserved;
153 SPW_LS_CONNECTING = 3,
166 unsigned char def_addr;
167 unsigned char def_mask;
171 unsigned char node_addr;
172 unsigned char node_mask;
205 #define LINKOPTS_ENABLE 0x0000 206 #define LINKOPTS_DISABLE 0x0001 207 #define LINKOPTS_START 0x0002 208 #define LINKOPTS_AUTOSTART 0x0004 209 #define LINKOPTS_DIS_ONERR 0x0008 212 #define LINKOPTS_DIS_ON_CE 0x0020000 213 #define LINKOPTS_DIS_ON_ER 0x0040000 214 #define LINKOPTS_DIS_ON_DE 0x0080000 215 #define LINKOPTS_DIS_ON_PE 0x0100000 216 #define LINKOPTS_DIS_ON_WE 0x0400000 219 #define LINKOPTS_DIS_ON_EE 0x1000000 222 #define LINKOPTS_EIRQ 0x0200 224 #define LINKOPTS_MASK 0x15e020f 225 #define LINKOPTS_MASK_DIS_ON 0x15e0000 232 #define LINKSTS_CE 0x002 233 #define LINKSTS_ER 0x004 234 #define LINKSTS_DE 0x008 235 #define LINKSTS_PE 0x010 236 #define LINKSTS_WE 0x040 237 #define LINKSTS_IA 0x080 238 #define LINKSTS_EE 0x100 239 #define LINKSTS_MASK 0x1de 242 #define TCOPTS_EN_RXIRQ 0x0001 243 #define TCOPTS_EN_TX 0x0004 244 #define TCOPTS_EN_RX 0x0008 249 #define ICOPTS_INTNUM (0x1f << 27) 250 #define ICOPTS_EN_SPWIRQ_ON_EE (1 << 24) 251 #define ICOPTS_EN_SPWIRQ_ON_IA (1 << 23) 252 #define ICOPTS_EN_PRIO (1 << 22) 253 #define ICOPTS_EN_TIMEOUTIRQ (1 << 20) 254 #define ICOPTS_EN_ACKIRQ (1 << 19) 255 #define ICOPTS_EN_TICKOUTIRQ (1 << 18) 256 #define ICOPTS_EN_RX (1 << 17) 257 #define ICOPTS_EN_TX (1 << 16) 258 #define ICOPTS_BASEIRQ (0x1f << 8) 259 #define ICOPTS_EN_FLAGFILTER (1 << 0) 262 #define ICRELOAD_EN (1 << 31) 263 #define ICRELOAD_MASK 0x7fffffff 266 #define RMAPOPTS_EN_RMAP 0x0001 267 #define RMAPOPTS_EN_BUF 0x0002 270 #define DMAFLAG_NO_SPILL 0x0001 271 #define DMAFLAG_RESV1 0x0002 272 #define DMAFLAG_STRIP_ADR 0x0004 273 #define DMAFLAG_STRIP_PID 0x0008 274 #define DMAFLAG_RESV2 0x0010 275 #define DMAFLAG_MASK (DMAFLAG_NO_SPILL|DMAFLAG_STRIP_ADR|DMAFLAG_STRIP_PID) 277 #define DMAFLAG2_TXIE 0x00100000 281 #define DMAFLAG2_RXIE 0x00200000 292 #define DMAFLAG2_IRQD_SRC 0x01000000 293 #define DMAFLAG2_IRQD_NONE 0x00c00000 294 #define DMAFLAG2_IRQD_BOTH 0x00000000 295 #define DMAFLAG2_IRQD_MASK 0x01c00000 296 #define DMAFLAG2_IRQD_BIT 22 298 #define DMAFLAG2_MASK (DMAFLAG2_TXIE | DMAFLAG2_RXIE | DMAFLAG2_IRQD_MASK) 324 int tx_sched_cnt_min;
325 int tx_sched_cnt_max;
332 int rx_sched_cnt_min;
333 int rx_sched_cnt_max;
348 typedef int (*grspw_msgqisr_t)(
void *data,
unsigned int *buf,
unsigned int n);
361 #define WORK_SHUTDOWN 0x1000 362 #define WORK_QUIT_TASK 0x2000 363 #define WORK_FREE_MSGQ 0x4000 364 #define WORK_DMA(chan, rxtx) (((rxtx) & 0x3) << ((chan) * 2)) 365 #define WORK_DMA_TX(chan) WORK_DMA(chan, 1) 366 #define WORK_DMA_RX(chan) WORK_DMA(chan, 2) 367 #define WORK_DMA_ER(chan) (0x1 << ((chan) + 8)) 368 #define WORK_DMA_MASK 0xfff 369 #define WORK_DMA_TX_MASK 0x055 370 #define WORK_DMA_RX_MASK 0x0aa 371 #define WORK_DMA_ER_MASK 0xf00 372 #define WORK_DMA_CHAN_MASK(chan) (WORK_DMA_ER(chan) | WORK_DMA(chan, 0x3)) 373 #define WORK_CORE_BIT 16 374 #define WORK_CORE_MASK 0x00ff0000 375 #define WORK_CORE(device) ((device) << WORK_CORE_BIT) 379 grspw_msgqisr_t msgisr;
383 extern void grspw_initialize_user(
385 void *(*devfound)(
int),
390 void (*devremove)(
int,
void*)
405 extern rtems_id grspw_work_spawn(
int prio,
int stack,
rtems_id *pMsgQ,
int msgMax);
429 extern void grspw_work_func(
rtems_id msgQ);
431 enum grspw_worktask_ev {
432 WORKTASK_EV_NONE = 0,
433 WORKTASK_EV_QUIT = 1,
434 WORKTASK_EV_SHUTDOWN = 2,
435 WORKTASK_EV_DMA_STOP = 3,
444 extern void grspw_work_event(
enum grspw_worktask_ev ev,
unsigned int msg);
450 extern int grspw_isr_affinity(
void *d,
const cpu_set_t *cpus);
453 extern int grspw_dev_count(
void);
454 extern void *grspw_open(
int dev_no);
455 extern int grspw_close(
void *d);
456 extern void grspw_hw_support(
void *d,
struct grspw_hw_sup *hw);
458 extern void grspw_stats_clr(
void *d);
469 extern spw_link_state_t grspw_link_state(
void *d);
476 extern void grspw_link_ctrl(
void *d,
int *options,
int *stscfg,
int *clkdiv);
478 extern unsigned int grspw_link_status(
void *d);
480 extern void grspw_link_status_clr(
void *d,
unsigned int clearmask);
484 extern void grspw_tc_tx(
void *d);
486 extern void grspw_tc_ctrl(
void *d,
int *options);
488 extern void grspw_tc_isr(
void *d,
void (*tcisr)(
void *data,
int tc),
void *data);
493 extern void grspw_tc_time(
void *d,
int *time);
500 unsigned int isr_reload;
501 unsigned int ack_reload;
517 typedef void (*spwpkt_ic_isr_t)(
void *data,
unsigned int rxirq,
518 unsigned int rxack,
unsigned int intto);
522 extern void grspw_ic_ctrl(
void *d,
unsigned int *options);
531 extern void grspw_ic_sts(
void *d,
unsigned int *rxirq,
unsigned int *rxack,
532 unsigned int *intto);
540 extern int grspw_ic_tickin(
void *d,
int ic);
542 extern void grspw_ic_isr(
void *d, spwpkt_ic_isr_t handler,
void *data);
546 extern int grspw_rmap_ctrl(
void *d,
int *options,
int *dstkey);
547 extern void grspw_rmap_support(
void *d,
char *rmap,
char *rmap_crc);
557 extern int grspw_port_ctrl(
void *d,
int *port);
559 extern int grspw_port_count(
void *d);
561 extern int grspw_port_active(
void *d);
564 extern void *grspw_dma_open(
void *d,
int chan_no);
565 extern int grspw_dma_close(
void *c);
567 extern int grspw_dma_start(
void *c);
568 extern void grspw_dma_stop(
void *c);
571 extern unsigned int grspw_dma_enable_int(
void *c,
int rxtx,
int force);
574 extern unsigned int grspw_dma_ctrlsts(
void *c);
604 extern int grspw_dma_tx_send(
void *c,
int opts,
struct grspw_list *pkts,
int count);
627 extern int grspw_dma_tx_reclaim(
void *c,
int opts,
struct grspw_list *pkts,
int *count);
630 extern void grspw_dma_tx_count(
void *c,
int *send,
int *sched,
int *sent,
int *hw);
632 #define GRSPW_OP_AND 0 633 #define GRSPW_OP_OR 1 653 extern int grspw_dma_tx_wait(
void *c,
int send_cnt,
int op,
int sent_cnt,
int timeout);
676 extern int grspw_dma_rx_recv(
void *c,
int opts,
struct grspw_list *pkts,
int *count);
699 extern int grspw_dma_rx_prepare(
void *c,
int opts,
struct grspw_list *pkts,
int count);
702 extern void grspw_dma_rx_count(
void *c,
int *ready,
int *sched,
int *recv,
int *hw);
723 extern int grspw_dma_rx_wait(
void *c,
int recv_cnt,
int op,
int ready_cnt,
int timeout);
728 extern void grspw_dma_stats_read(
void *c,
struct grspw_dma_stats *sts);
729 extern void grspw_dma_stats_clr(
void *c);
732 void grspw2_register_drv (
void);
736 static inline void grspw_list_clr(
struct grspw_list *list)
742 static inline int grspw_list_is_empty(
struct grspw_list *list)
744 return (list->head ==
NULL);
748 static inline int grspw_list_cnt(
struct grspw_list *list)
757 if ( lastpkt && (list->tail != lastpkt) )
766 if ( list->tail ==
NULL ) {
769 list->tail->next = pkt;
777 pkt->next = list->head;
778 if ( list->head ==
NULL ) {
787 if (grspw_list_is_empty(alist)) {
790 alist->tail->next =
NULL;
791 if ( list->tail ==
NULL ) {
792 list->head = alist->head;
794 list->tail->next = alist->head;
796 list->tail = alist->tail;
802 if (grspw_list_is_empty(alist)) {
805 if ( list->head ==
NULL ) {
806 list->tail = alist->tail;
807 alist->tail->next =
NULL;
809 alist->tail->next = list->head;
811 list->head = alist->head;
818 if (grspw_list_is_empty(dlist)) {
821 list->head = dlist->tail->next;
822 if ( list->head ==
NULL ) {
825 dlist->tail->next =
NULL;
839 if ( (max < 1) || (pkt ==
NULL) ) {
840 grspw_list_clr(rlist);
847 while ((cnt < max) && pkt) {
853 grspw_list_remove_head_list(list, rlist);
Definition: grspw_pkt.h:496
Definition: grspw_pkt.h:308
Definition: grspw_pkt.h:177
rtems_status_code
Classic API Status.
Definition: status.h:43
Definition: grspw_pkt.h:159
Definition: grspw_pkt.h:131
Definition: b1553brm.c:75
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
Definition: grspw_pkt.h:378
Definition: grspw_pkt.h:143
Definition: grspw_pkt.h:300
Definition: grspw_pkt.h:193
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77