4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * DSP API channel interface: multiplexes data streams through the single
7 * physical link managed by a Bridge driver.
9 * See DSP API chnl.h for more details.
11 * Copyright (C) 2005-2006 Texas Instruments, Inc.
13 * This package is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
17 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25 #include <dspbridge/chnlpriv.h>
28 * ======== chnl_close ========
30 * Ensures all pending I/O on this channel is cancelled, discards all
31 * queued I/O completion notifications, then frees the resources allocated
32 * for this channel, and makes the corresponding logical channel id
33 * available for subsequent use.
35 * chnl_obj: Channel object handle.
38 * -EFAULT: Invalid chnl_obj.
40 * chnl_init(void) called.
41 * No thread must be blocked on this channel's I/O completion event.
43 * 0: The I/O completion event for this channel is freed.
44 * chnl_obj is no longer valid.
46 extern int chnl_close(struct chnl_object *chnl_obj);
49 * ======== chnl_create ========
51 * Create a channel manager object, responsible for opening new channels
52 * and closing old ones for a given board.
54 * channel_mgr: Location to store a channel manager object on output.
55 * hdev_obj: Handle to a device object.
56 * mgr_attrts: Channel manager attributes.
57 * mgr_attrts->max_channels: Max channels
58 * mgr_attrts->birq: Channel's I/O IRQ number.
59 * mgr_attrts->irq_shared: TRUE if the IRQ is shareable.
60 * mgr_attrts->word_size: DSP Word size in equivalent PC bytes..
63 * -EFAULT: hdev_obj is invalid.
64 * -EINVAL: max_channels is 0.
65 * Invalid DSP word size (must be > 0).
66 * Invalid base address for DSP communications.
67 * -ENOMEM: Insufficient memory for requested resources.
68 * -EIO: Unable to plug channel ISR for configured IRQ.
69 * -ECHRNG: This manager cannot handle this many channels.
70 * -EEXIST: Channel manager already exists for this device.
72 * chnl_init(void) called.
73 * channel_mgr != NULL.
76 * 0: Subsequent calls to chnl_create() for the same
77 * board without an intervening call to
78 * chnl_destroy() will fail.
80 extern int chnl_create(OUT struct chnl_mgr **channel_mgr,
81 struct dev_object *hdev_obj,
82 IN CONST struct chnl_mgrattrs *mgr_attrts);
85 * ======== chnl_destroy ========
87 * Close all open channels, and destroy the channel manager.
89 * hchnl_mgr: Channel manager object.
92 * -EFAULT: hchnl_mgr was invalid.
94 * chnl_init(void) called.
96 * 0: Cancels I/O on each open channel.
97 * Closes each open channel.
98 * chnl_create may subsequently be called for the
101 extern int chnl_destroy(struct chnl_mgr *hchnl_mgr);
104 * ======== chnl_exit ========
106 * Discontinue usage of the CHNL module.
110 * chnl_init(void) previously called.
112 * Resources, if any acquired in chnl_init(void), are freed when the last
113 * client of CHNL calls chnl_exit(void).
115 extern void chnl_exit(void);
118 * ======== chnl_init ========
120 * Initialize the CHNL module's private state.
123 * TRUE if initialized; FALSE if error occurred.
126 * A requirement for each of the other public CHNL functions.
128 extern bool chnl_init(void);