OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [armnommu/] [drivers/] [scsi/] [msgqueue.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1622 jcastillo
/*
2
 * msgqueue.h: message queue handling
3
 *
4
 * (c) 1997 Russell King
5
 */
6
#ifndef MSGQUEUE_H
7
#define MSGQUEUE_H
8
 
9
struct message {
10
        char msg[8];
11
        int length;
12
        int fifo;
13
};
14
 
15
struct msgqueue_entry {
16
        struct message msg;
17
        struct msgqueue_entry *next;
18
};
19
 
20
#define NR_MESSAGES 4
21
 
22
typedef struct {
23
    struct msgqueue_entry *qe;
24
    struct msgqueue_entry *free;
25
    struct msgqueue_entry entries[NR_MESSAGES];
26
} MsgQueue_t;
27
 
28
/*
29
 * Function: void msgqueue_initialise (MsgQueue_t *msgq)
30
 * Purpose : initialise a message queue
31
 * Params  : msgq - queue to initialise
32
 */
33
extern void msgqueue_initialise(MsgQueue_t *msgq);
34
 
35
/*
36
 * Function: void msgqueue_free(MsgQueue_t *msgq)
37
 * Purpose : free a queue
38
 * Params  : msgq - queue to free
39
 */
40
extern void msgqueue_free(MsgQueue_t *msgq);
41
 
42
/*
43
 * Function: int msgqueue_msglength (MsgQueue_t *msgq)
44
 * Purpose : calculate the total length of all messages on the message queue
45
 * Params  : msgq - queue to examine
46
 * Returns : number of bytes of messages in queue
47
 */
48
extern int msgqueue_msglength(MsgQueue_t *msgq);
49
 
50
/*
51
 * Function: struct message *msgqueue_getmsg (MsgQueue_t *msgq, int msgno)
52
 * Purpose : return a message & its length
53
 * Params  : msgq   - queue to obtain message from
54
 *         : msgno  - message number
55
 * Returns : pointer to message string, or NULL
56
 */
57
extern struct message *msgqueue_getmsg(MsgQueue_t *msgq, int msgno);
58
 
59
/*
60
 * Function: int msgqueue_addmsg (MsgQueue_t *msgq, int length, ...)
61
 * Purpose : add a message onto a message queue
62
 * Params  : msgq   - queue to add message on
63
 *           length - length of message
64
 *           ...    - message bytes
65
 * Returns : != 0 if successful
66
 */
67
extern int msgqueue_addmsg(MsgQueue_t *msgq, int length, ...);
68
 
69
/*
70
 * Function: void msgqueue_flush (MsgQueue_t *msgq)
71
 * Purpose : flush all messages from message queue
72
 * Params  : msgq - queue to flush
73
 */
74
extern void msgqueue_flush (MsgQueue_t *msgq);
75
 
76
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.