openpcd/firmware/src/os/req_ctx.h @ master
1 | 520784c7 | (no author) | #ifndef _REQ_CTX_H
|
---|---|---|---|
2 | #define _REQ_CTX_H
|
||
3 | |||
4 | 9662f283 | Min Xu | #define RCTX_SIZE_LARGE 960
|
5 | #define RCTX_SIZE_SMALL 320
|
||
6 | 706ffa9f | laforge | |
7 | 520784c7 | (no author) | #define MAX_HDRSIZE sizeof(struct openpcd_hdr)
|
8 | |||
9 | #define req_buf_payload(x) (x->data[x->hdr_len])
|
||
10 | #define req_buf_hdr(x) (x->data[0])
|
||
11 | |||
12 | #include <sys/types.h>
|
||
13 | 2db7d2d9 | laforge | #include <lib_AT91SAM7.h>
|
14 | 520784c7 | (no author) | |
15 | struct req_ctx { |
||
16 | 373c172a | Harald Welte | volatile uint32_t state; |
17 | b6b2c7d4 | Min Xu | volatile struct req_ctx *prev, *next; |
18 | 373c172a | Harald Welte | uint16_t size; |
19 | uint16_t tot_len; |
||
20 | uint8_t *data; |
||
21 | 520784c7 | (no author) | };
|
22 | |||
23 | 3b7035dc | Min Xu | #define RCTX_STATE_FREE 0
|
24 | #define RCTX_STATE_UDP_RCV_BUSY 1
|
||
25 | #define RCTX_STATE_UDP_RCV_DONE 2
|
||
26 | #define RCTX_STATE_MAIN_PROCESSING 3
|
||
27 | #define RCTX_STATE_RC632IRQ_BUSY 4
|
||
28 | #define RCTX_STATE_UDP_EP2_PENDING 5
|
||
29 | #define RCTX_STATE_UDP_EP2_BUSY 6
|
||
30 | #define RCTX_STATE_UDP_EP3_PENDING 7
|
||
31 | #define RCTX_STATE_UDP_EP3_BUSY 8
|
||
32 | #define RCTX_STATE_SSC_RX_BUSY 9
|
||
33 | #define RCTX_STATE_LIBRFID_BUSY 10
|
||
34 | #define RCTX_STATE_PIOIRQ_BUSY 11
|
||
35 | #define RCTX_STATE_INVALID 12
|
||
36 | // Nominally UNUSED states
|
||
37 | #define RCTX_STATE_UDP_EP0_PENDING 13
|
||
38 | #define RCTX_STATE_UDP_EP0_BUSY 14
|
||
39 | #define RCTX_STATE_UDP_EP1_PENDING 15
|
||
40 | #define RCTX_STATE_UDP_EP1_BUSY 16
|
||
41 | // Count of the number of STATES
|
||
42 | #define RCTX_STATE_COUNT 17
|
||
43 | 706ffa9f | laforge | |
44 | 2db7d2d9 | laforge | extern struct req_ctx __ramfunc *req_ctx_find_get(int large, unsigned long old_state, unsigned long new_state); |
45 | 520784c7 | (no author) | 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 | 373c172a | Harald Welte | extern uint8_t req_ctx_num(struct req_ctx *ctx); |
49 | 3cd467a8 | Min Xu | unsigned int req_ctx_count(unsigned long state); |
50 | 520784c7 | (no author) | |
51 | #endif /* _REQ_CTX_H */ |