URL
https://opencores.org/ocsvn/igor/igor/trunk
[/] [igor/] [trunk/] [avr/] [src/] [req.h] - Blame information for rev 4
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
4 |
atypic |
#ifndef _REQ_H_
|
2 |
|
|
#define _REQ_H_
|
3 |
|
|
#include <stdint.h>
|
4 |
|
|
#include "device.h"
|
5 |
|
|
|
6 |
|
|
/* Will make callback on this function with idev->priv as arg. */
|
7 |
|
|
typedef void req_fn_t(void *);
|
8 |
|
|
|
9 |
|
|
struct req {
|
10 |
|
|
struct igordev *dev; /* What device we wish to communicate with. */
|
11 |
|
|
uint8_t type; /* What operation do we wish to perform. */
|
12 |
|
|
/* Request types. */
|
13 |
|
|
#define REQ_TYPE_READ 1
|
14 |
|
|
#define REQ_TYPE_WRITE 2
|
15 |
|
|
#define REQ_TYPE_FUNC 3
|
16 |
|
|
#define REQ_TYPE_FLUSH 4
|
17 |
|
|
uint8_t flags; /* Flags for request. */
|
18 |
|
|
/* Request flags. */
|
19 |
|
|
#define REQ_CALLBACK 0x01
|
20 |
|
|
uint32_t devnum; /* What device we are performing the request on. */
|
21 |
|
|
req_fn_t *func; /* Perform the running of this function. */
|
22 |
|
|
};
|
23 |
|
|
|
24 |
|
|
#define MAXREQ 64
|
25 |
|
|
|
26 |
|
|
struct rqueue {
|
27 |
|
|
struct req queue[MAXREQ];
|
28 |
|
|
uint8_t off_read;
|
29 |
|
|
uint8_t off_write;
|
30 |
|
|
uint8_t rcount;
|
31 |
|
|
uint8_t wcount;
|
32 |
|
|
int8_t status;
|
33 |
|
|
/* Status codes. **/
|
34 |
|
|
#define RQUEUE_STATUS_FULL 0x1
|
35 |
|
|
#define RQUEUE_STATUS_EMPTY 0x2
|
36 |
|
|
};
|
37 |
|
|
|
38 |
|
|
#define RQUEUE_FULL(rq) ((rq)->status & RQUEUE_STATUS_FULL)
|
39 |
|
|
#define RQUEUE_EMPTY(rq) ((rq)->status & RQUEUE_STATUS_EMPTY)
|
40 |
|
|
void rqueue_init(struct rqueue *);
|
41 |
|
|
uint8_t rqueue_used(struct rqueue *);
|
42 |
|
|
uint8_t rqueue_unused(struct rqueue *);
|
43 |
|
|
struct req *req_peak(struct rqueue *);
|
44 |
|
|
int8_t req_alloc(struct rqueue *, struct igordev *, uint8_t, uint8_t,
|
45 |
|
|
uint32_t, req_fn_t *);
|
46 |
|
|
int8_t req_free(struct rqueue *);
|
47 |
|
|
#endif /* !_REQ_H_ */
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.