31#ifndef __GRSPW_PKT_H__
32#define __GRSPW_PKT_H__
42extern int grspw_work_task_priority;
44#ifndef GRSPW_PKT_FLAGS
45#define GRSPW_PKT_FLAGS
49#define TXPKT_FLAG_IE 0x0040
54#define TXPKT_FLAG_HCRC 0x0100
60#define TXPKT_FLAG_DCRC 0x0200
63#define TXPKT_FLAG_DCRCT_MASK 0x0c00
65#define TXPKT_FLAG_DCRCT_RMAP 0x0000
67#define TXPKT_FLAG_DCRCT_CCSDS 0x0400
69#define TXPKT_FLAG_DCRCT_ISO16 0x0800
73#define TXPKT_FLAG_NOCRC_MASK 0x0000000f
74#define TXPKT_FLAG_NOCRC_LEN0 0x00000000
75#define TXPKT_FLAG_NOCRC_LEN1 0x00000001
76#define TXPKT_FLAG_NOCRC_LEN2 0x00000002
77#define TXPKT_FLAG_NOCRC_LEN3 0x00000003
78#define TXPKT_FLAG_NOCRC_LEN4 0x00000004
79#define TXPKT_FLAG_NOCRC_LEN5 0x00000005
80#define TXPKT_FLAG_NOCRC_LEN6 0x00000006
81#define TXPKT_FLAG_NOCRC_LEN7 0x00000007
82#define TXPKT_FLAG_NOCRC_LEN8 0x00000008
83#define TXPKT_FLAG_NOCRC_LEN9 0x00000009
84#define TXPKT_FLAG_NOCRC_LENa 0x0000000a
85#define TXPKT_FLAG_NOCRC_LENb 0x0000000b
86#define TXPKT_FLAG_NOCRC_LENc 0x0000000c
87#define TXPKT_FLAG_NOCRC_LENd 0x0000000d
88#define TXPKT_FLAG_NOCRC_LENe 0x0000000e
89#define TXPKT_FLAG_NOCRC_LENf 0x0000000f
91#define TXPKT_FLAG_INPUT_MASK (TXPKT_FLAG_NOCRC_MASK | TXPKT_FLAG_IE | \
92 TXPKT_FLAG_HCRC | TXPKT_FLAG_DCRC | \
93 TXPKT_FLAG_DCRCT_MASK)
96#define TXPKT_FLAG_TX 0x4000
99#define TXPKT_FLAG_LINKERR 0x8000
101#define TXPKT_FLAG_OUTPUT_MASK (TXPKT_FLAG_TX | TXPKT_FLAG_LINKERR)
106#define RXPKT_FLAG_IE 0x0010
108#define RXPKT_FLAG_INPUT_MASK (RXPKT_FLAG_IE)
111#define RXPKT_FLAG_TRUNK 0x0800
113#define RXPKT_FLAG_DCRC 0x0400
115#define RXPKT_FLAG_HCRC 0x0200
117#define RXPKT_FLAG_EEOP 0x0100
119#define RXPKT_FLAG_RX 0x8000
121#define RXPKT_FLAG_OUTPUT_MASK (RXPKT_FLAG_TRUNK | RXPKT_FLAG_DCRC | \
122 RXPKT_FLAG_HCRC | RXPKT_FLAG_EEOP)
127#define PKT_FLAG_TR_DATA 0x1000
128#define PKT_FLAG_TR_HDR 0x2000
130#define PKT_FLAG_MASK 0x3000
153 unsigned short flags;
154 unsigned char reserved;
173 SPW_LS_CONNECTING = 4,
185 unsigned char def_addr;
186 unsigned char def_mask;
190 unsigned char node_addr;
191 unsigned char node_mask;
224#define LINKOPTS_ENABLE 0x0000
225#define LINKOPTS_DISABLE 0x0001
226#define LINKOPTS_START 0x0002
227#define LINKOPTS_AUTOSTART 0x0004
228#define LINKOPTS_DIS_ONERR 0x0008
231#define LINKOPTS_DIS_ON_CE 0x0020000
232#define LINKOPTS_DIS_ON_ER 0x0040000
233#define LINKOPTS_DIS_ON_DE 0x0080000
234#define LINKOPTS_DIS_ON_PE 0x0100000
235#define LINKOPTS_DIS_ON_WE 0x0400000
238#define LINKOPTS_DIS_ON_EE 0x1000000
241#define LINKOPTS_EIRQ 0x0200
243#define LINKOPTS_MASK 0x15e020f
244#define LINKOPTS_MASK_DIS_ON 0x15e0000
251#define LINKSTS_CE 0x002
252#define LINKSTS_ER 0x004
253#define LINKSTS_DE 0x008
254#define LINKSTS_PE 0x010
255#define LINKSTS_WE 0x040
256#define LINKSTS_IA 0x080
257#define LINKSTS_EE 0x100
258#define LINKSTS_MASK 0x1de
261#define TCOPTS_EN_RXIRQ 0x0001
262#define TCOPTS_EN_TX 0x0004
263#define TCOPTS_EN_RX 0x0008
268#define ICOPTS_INTNUM (0x1f << 27)
269#define ICOPTS_EN_SPWIRQ_ON_EE (1 << 24)
270#define ICOPTS_EN_SPWIRQ_ON_IA (1 << 23)
271#define ICOPTS_EN_PRIO (1 << 22)
272#define ICOPTS_EN_TIMEOUTIRQ (1 << 20)
273#define ICOPTS_EN_ACKIRQ (1 << 19)
274#define ICOPTS_EN_TICKOUTIRQ (1 << 18)
275#define ICOPTS_EN_RX (1 << 17)
276#define ICOPTS_EN_TX (1 << 16)
277#define ICOPTS_BASEIRQ (0x1f << 8)
278#define ICOPTS_EN_FLAGFILTER (1 << 0)
281#define ICRELOAD_EN (1 << 31)
282#define ICRELOAD_MASK 0x7fffffff
285#define RMAPOPTS_EN_RMAP 0x0001
286#define RMAPOPTS_EN_BUF 0x0002
289#define DMAFLAG_NO_SPILL 0x0001
290#define DMAFLAG_RESV1 0x0002
291#define DMAFLAG_STRIP_ADR 0x0004
292#define DMAFLAG_STRIP_PID 0x0008
293#define DMAFLAG_RESV2 0x0010
294#define DMAFLAG_MASK (DMAFLAG_NO_SPILL|DMAFLAG_STRIP_ADR|DMAFLAG_STRIP_PID)
296#define DMAFLAG2_TXIE 0x00100000
300#define DMAFLAG2_RXIE 0x00200000
311#define DMAFLAG2_IRQD_SRC 0x01000000
312#define DMAFLAG2_IRQD_NONE 0x00c00000
313#define DMAFLAG2_IRQD_BOTH 0x00000000
314#define DMAFLAG2_IRQD_MASK 0x01c00000
315#define DMAFLAG2_IRQD_BIT 22
317#define DMAFLAG2_MASK (DMAFLAG2_TXIE | DMAFLAG2_RXIE | DMAFLAG2_IRQD_MASK)
343 int tx_sched_cnt_min;
344 int tx_sched_cnt_max;
351 int rx_sched_cnt_min;
352 int rx_sched_cnt_max;
367typedef int (*grspw_msgqisr_t)(
void *data,
unsigned int *buf,
unsigned int n);
380#define WORK_SHUTDOWN 0x1000
381#define WORK_QUIT_TASK 0x2000
382#define WORK_FREE_MSGQ 0x4000
383#define WORK_DMA(chan, rxtx) (((rxtx) & 0x3) << ((chan) * 2))
384#define WORK_DMA_TX(chan) WORK_DMA(chan, 1)
385#define WORK_DMA_RX(chan) WORK_DMA(chan, 2)
386#define WORK_DMA_ER(chan) (0x1 << ((chan) + 8))
387#define WORK_DMA_MASK 0xfff
388#define WORK_DMA_TX_MASK 0x055
389#define WORK_DMA_RX_MASK 0x0aa
390#define WORK_DMA_ER_MASK 0xf00
391#define WORK_DMA_CHAN_MASK(chan) (WORK_DMA_ER(chan) | WORK_DMA(chan, 0x3))
392#define WORK_CORE_BIT 16
393#define WORK_CORE_MASK 0x00ff0000
394#define WORK_CORE(device) ((device) << WORK_CORE_BIT)
398 grspw_msgqisr_t msgisr;
402extern void grspw_initialize_user(
404 void *(*devfound)(
int),
409 void (*devremove)(
int,
void*)
424extern rtems_id grspw_work_spawn(
int prio,
int stack,
rtems_id *pMsgQ,
int msgMax);
448extern void grspw_work_func(
rtems_id msgQ);
450enum grspw_worktask_ev {
451 WORKTASK_EV_NONE = 0,
452 WORKTASK_EV_QUIT = 1,
453 WORKTASK_EV_SHUTDOWN = 2,
454 WORKTASK_EV_DMA_STOP = 3,
463extern void grspw_work_event(
enum grspw_worktask_ev ev,
unsigned int msg);
469extern int grspw_isr_affinity(
void *d,
const cpu_set_t *cpus);
472extern int grspw_dev_count(
void);
473extern void *grspw_open(
int dev_no);
474extern int grspw_close(
void *d);
475extern void grspw_hw_support(
void *d,
struct grspw_hw_sup *hw);
477extern void grspw_stats_clr(
void *d);
488extern spw_link_state_t grspw_link_state(
void *d);
495extern void grspw_link_ctrl(
void *d,
int *options,
int *stscfg,
int *clkdiv);
497extern unsigned int grspw_link_status(
void *d);
499extern void grspw_link_status_clr(
void *d,
unsigned int clearmask);
503extern void grspw_tc_tx(
void *d);
505extern void grspw_tc_ctrl(
void *d,
int *options);
507extern void grspw_tc_isr(
void *d,
void (*tcisr)(
void *data,
int tc),
void *data);
512extern void grspw_tc_time(
void *d,
int *time);
519 unsigned int isr_reload;
520 unsigned int ack_reload;
536typedef void (*spwpkt_ic_isr_t)(
void *data,
unsigned int rxirq,
537 unsigned int rxack,
unsigned int intto);
541extern void grspw_ic_ctrl(
void *d,
unsigned int *options);
550extern void grspw_ic_sts(
void *d,
unsigned int *rxirq,
unsigned int *rxack,
551 unsigned int *intto);
559extern int grspw_ic_tickin(
void *d,
int ic);
561extern void grspw_ic_isr(
void *d, spwpkt_ic_isr_t handler,
void *data);
565extern int grspw_rmap_ctrl(
void *d,
int *options,
int *dstkey);
566extern void grspw_rmap_support(
void *d,
char *rmap,
char *rmap_crc);
576extern int grspw_port_ctrl(
void *d,
int *port);
578extern int grspw_port_count(
void *d);
580extern int grspw_port_active(
void *d);
583extern void *grspw_dma_open(
void *d,
int chan_no);
584extern int grspw_dma_close(
void *c);
586extern int grspw_dma_start(
void *c);
587extern void grspw_dma_stop(
void *c);
590extern unsigned int grspw_dma_enable_int(
void *c,
int rxtx,
int force);
593extern unsigned int grspw_dma_ctrlsts(
void *c);
623extern int grspw_dma_tx_send(
void *c,
int opts,
struct grspw_list *pkts,
int count);
646extern int grspw_dma_tx_reclaim(
void *c,
int opts,
struct grspw_list *pkts,
int *count);
649extern void grspw_dma_tx_count(
void *c,
int *send,
int *sched,
int *sent,
int *hw);
651#define GRSPW_OP_AND 0
672extern int grspw_dma_tx_wait(
void *c,
int send_cnt,
int op,
int sent_cnt,
int timeout);
695extern int grspw_dma_rx_recv(
void *c,
int opts,
struct grspw_list *pkts,
int *count);
718extern int grspw_dma_rx_prepare(
void *c,
int opts,
struct grspw_list *pkts,
int count);
721extern void grspw_dma_rx_count(
void *c,
int *ready,
int *sched,
int *recv,
int *hw);
742extern int grspw_dma_rx_wait(
void *c,
int recv_cnt,
int op,
int ready_cnt,
int timeout);
748extern void grspw_dma_stats_clr(
void *c);
751void grspw2_register_drv (
void);
755static inline void grspw_list_clr(
struct grspw_list *list)
761static inline int grspw_list_is_empty(
struct grspw_list *list)
763 return (list->head ==
NULL);
767static inline int grspw_list_cnt(
struct grspw_list *list)
776 if ( lastpkt && (list->tail != lastpkt) )
785 if ( list->tail ==
NULL ) {
788 list->tail->next = pkt;
796 pkt->next = list->head;
797 if ( list->head ==
NULL ) {
806 if (grspw_list_is_empty(alist)) {
809 alist->tail->next =
NULL;
810 if ( list->tail ==
NULL ) {
811 list->head = alist->head;
813 list->tail->next = alist->head;
815 list->tail = alist->tail;
821 if (grspw_list_is_empty(alist)) {
824 if ( list->head ==
NULL ) {
825 list->tail = alist->tail;
826 alist->tail->next =
NULL;
828 alist->tail->next = list->head;
830 list->head = alist->head;
837 if (grspw_list_is_empty(dlist)) {
840 list->head = dlist->tail->next;
841 if ( list->head ==
NULL ) {
844 dlist->tail->next =
NULL;
858 if ( (max < 1) || (pkt ==
NULL) ) {
859 grspw_list_clr(rlist);
866 while ((cnt < max) && pkt) {
872 grspw_list_remove_head_list(list, rlist);
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
Definition: grspw_pkt.h:178
Definition: grspw_pkt.h:212
Definition: grspw_pkt.h:304
Definition: grspw_pkt.h:312
Definition: grspw_pkt.h:196
Definition: grspw_pkt.h:162
Definition: grspw_pkt.h:150
Definition: grspw_pkt.h:382
Definition: b1553brm.c:94
Definition: grspw_pkt.h:500