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 modes */ 26 #define CHNL_MODETODSP 0 /* Data streaming to the DSP. */ 27 #define CHNL_MODEFROMDSP 1 /* Data streaming from the DSP. */ 28 29 /* GetIOCompletion flags */ 30 #define CHNL_IOCINFINITE 0xffffffff /* Wait forever for IO completion. */ 31 #define CHNL_IOCNOWAIT 0x0 /* Dequeue an IOC, if available. */ 32 33 /* IO Completion Record status: */ 34 #define CHNL_IOCSTATCOMPLETE 0x0000 /* IO Completed. */ 35 #define CHNL_IOCSTATCANCEL 0x0002 /* IO was cancelled */ 36 #define CHNL_IOCSTATTIMEOUT 0x0008 /* Wait for IOC timed out. */ 37 #define CHNL_IOCSTATEOS 0x8000 /* End Of Stream reached. */ 38 39 /* Macros for checking I/O Completion status: */ 40 #define CHNL_IS_IO_COMPLETE(ioc) (!(ioc.status & ~CHNL_IOCSTATEOS)) 41 #define CHNL_IS_IO_CANCELLED(ioc) (ioc.status & CHNL_IOCSTATCANCEL) 42 #define CHNL_IS_TIMED_OUT(ioc) (ioc.status & CHNL_IOCSTATTIMEOUT) 43 44 /* Channel attributes: */ 45 struct chnl_attr { 46 u32 uio_reqs; /* Max # of preallocated I/O requests. */ 47 void *event_obj; /* User supplied auto-reset event object. */ 48 char *str_event_name; /* Ptr to name of user event object. */ 49 void *reserved1; /* Reserved for future use. */ 50 u32 reserved2; /* Reserved for future use. */ 51 52 }; 53 54 /* I/O completion record: */ 55 struct chnl_ioc { 56 void *buf; /* Buffer to be filled/emptied. */ 57 u32 byte_size; /* Bytes transferred. */ 58 u32 buf_size; /* Actual buffer size in bytes */ 59 u32 status; /* Status of IO completion. */ 60 u32 arg; /* User argument associated with buf. */ 61 }; 62 63 #endif /* CHNLDEFS_ */ 64