1
|
#ifndef _REQ_CTX_H
|
2
|
#define _REQ_CTX_H
|
3
|
|
4
|
#define RCTX_SIZE_LARGE 960
|
5
|
#define RCTX_SIZE_SMALL 320
|
6
|
|
7
|
#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
|
#include <lib_AT91SAM7.h>
|
14
|
|
15
|
struct req_ctx {
|
16
|
volatile uint32_t state;
|
17
|
volatile struct req_ctx *prev, *next;
|
18
|
uint16_t size;
|
19
|
uint16_t tot_len;
|
20
|
uint8_t *data;
|
21
|
};
|
22
|
|
23
|
#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
|
|
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
|
unsigned int req_ctx_count(unsigned long state);
|
50
|
|
51
|
#endif /* _REQ_CTX_H */
|