osmo-sdr/firmware/include/req_ctx.h @ master
1 |
#ifndef _REQ_CTX_H
|
---|---|
2 |
#define _REQ_CTX_H
|
3 |
|
4 |
#define __ramfunc
|
5 |
|
6 |
#define RCTX_SIZE_LARGE 2048
|
7 |
#define RCTX_SIZE_SMALL 1024
|
8 |
|
9 |
#define MAX_HDRSIZE sizeof(struct openpcd_hdr)
|
10 |
#define MAX_REQSIZE (64-MAX_HDRSIZE)
|
11 |
|
12 |
#define req_buf_payload(x) (x->data[x->hdr_len])
|
13 |
#define req_buf_hdr(x) (x->data[0])
|
14 |
|
15 |
#include <stdint.h>
|
16 |
#include <dmad/dmad.h>
|
17 |
#include <linuxlist.h>
|
18 |
|
19 |
struct req_ctx { |
20 |
struct llist_head list; |
21 |
volatile uint32_t state; |
22 |
uint16_t size; |
23 |
uint16_t tot_len; |
24 |
DmaLinkList dma_lli; |
25 |
uint8_t *data; |
26 |
};
|
27 |
|
28 |
#define RCTX_STATE_FREE 0xfe
|
29 |
#define RCTX_STATE_UDP_RCV_BUSY 0x01
|
30 |
#define RCTX_STATE_UDP_RCV_DONE 0x02
|
31 |
#define RCTX_STATE_MAIN_PROCESSING 0x03
|
32 |
|
33 |
#define RCTX_STATE_UDP_EP2_PENDING 0x10
|
34 |
#define RCTX_STATE_UDP_EP2_BUSY 0x11
|
35 |
|
36 |
#define RCTX_STATE_UDP_EP3_PENDING 0x12
|
37 |
#define RCTX_STATE_UDP_EP3_BUSY 0x13
|
38 |
|
39 |
#define RCTX_STATE_SSC_RX_BUSY 0x20 /* currently being processed by Rx DMA */ |
40 |
#define RCTX_STATE_SSC_RX_PENDING 0x21 /* waiting in queue for Rx SSC DMA */ |
41 |
|
42 |
#define RCTX_STATE_INVALID 0xff
|
43 |
|
44 |
extern struct req_ctx __ramfunc *req_ctx_find_get(int large, unsigned long old_state, unsigned long new_state); |
45 |
extern struct req_ctx *req_ctx_find_busy(void); |
46 |
extern void req_ctx_set_state(struct req_ctx *ctx, unsigned long new_state); |
47 |
extern void req_ctx_put(struct req_ctx *ctx); |
48 |
extern uint8_t req_ctx_num(struct req_ctx *ctx); |
49 |
|
50 |
void req_ctx_enqueue(struct llist_head *list, struct req_ctx *rctx); |
51 |
struct req_ctx *req_ctx_dequeue(struct llist_head *list); |
52 |
|
53 |
void req_ctx_dump(); |
54 |
|
55 |
#endif /* _REQ_CTX_H */ |