upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / tidspbridge / include / dspbridge / chnldefs.h
1 /*
2  * chnldefs.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * System-wide channel objects and constants.
7  *
8  * Copyright (C) 2005-2006 Texas Instruments, Inc.
9  *
10  * This package is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17  */
18
19 #ifndef CHNLDEFS_
20 #define CHNLDEFS_
21
22 /* Channel id option. */
23 #define CHNL_PICKFREE       (~0UL)      /* Let manager pick a free channel. */
24
25 /* Channel manager limits: */
26 #define CHNL_INITIOREQS      4  /* Default # of I/O requests. */
27
28 /* Channel modes */
29 #define CHNL_MODETODSP          0       /* Data streaming to the DSP. */
30 #define CHNL_MODEFROMDSP        1       /* Data streaming from the DSP. */
31
32 /* GetIOCompletion flags */
33 #define CHNL_IOCINFINITE     0xffffffff /* Wait forever for IO completion. */
34 #define CHNL_IOCNOWAIT       0x0        /* Dequeue an IOC, if available. */
35
36 /* IO Completion Record status: */
37 #define CHNL_IOCSTATCOMPLETE 0x0000     /* IO Completed. */
38 #define CHNL_IOCSTATCANCEL   0x0002     /* IO was cancelled */
39 #define CHNL_IOCSTATTIMEOUT  0x0008     /* Wait for IOC timed out. */
40 #define CHNL_IOCSTATEOS      0x8000     /* End Of Stream reached. */
41
42 /* Macros for checking I/O Completion status: */
43 #define CHNL_IS_IO_COMPLETE(ioc)  (!(ioc.status & ~CHNL_IOCSTATEOS))
44 #define CHNL_IS_IO_CANCELLED(ioc) (ioc.status & CHNL_IOCSTATCANCEL)
45 #define CHNL_IS_TIMED_OUT(ioc)    (ioc.status & CHNL_IOCSTATTIMEOUT)
46
47 /* Channel attributes: */
48 struct chnl_attr {
49         u32 uio_reqs;           /* Max # of preallocated I/O requests. */
50         void *event_obj;        /* User supplied auto-reset event object. */
51         char *pstr_event_name;  /* Ptr to name of user event object. */
52         void *reserved1;        /* Reserved for future use. */
53         u32 reserved2;          /* Reserved for future use. */
54
55 };
56
57 /* I/O completion record: */
58 struct chnl_ioc {
59         void *pbuf;             /* Buffer to be filled/emptied. */
60         u32 byte_size;          /* Bytes transferred. */
61         u32 buf_size;           /* Actual buffer size in bytes */
62         u32 status;             /* Status of IO completion. */
63         u32 dw_arg;             /* User argument associated with pbuf. */
64 };
65
66 #endif /* CHNLDEFS_ */