4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * IO manager interface: Manages IO between CHNL and msg_ctrl.
8 * Copyright (C) 2005-2006 Texas Instruments, Inc.
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.
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.
18 #include <linux/types.h>
20 /* ----------------------------------- Host OS */
21 #include <dspbridge/host_os.h>
23 /* ----------------------------------- DSP/BIOS Bridge */
24 #include <dspbridge/dbdefs.h>
26 /* ----------------------------------- Trace & Debug */
27 #include <dspbridge/dbc.h>
29 /* ----------------------------------- OS Adaptation Layer */
30 #include <dspbridge/cfg.h>
32 /* ----------------------------------- Platform Manager */
33 #include <dspbridge/dev.h>
35 /* ----------------------------------- This */
37 #include <dspbridge/iodefs.h>
38 #include <dspbridge/io.h>
40 /* ----------------------------------- Globals */
44 * ======== io_create ========
46 * Create an IO manager object, responsible for managing IO between
49 int io_create(OUT struct io_mgr **io_man, struct dev_object *hdev_obj,
50 IN CONST struct io_attrs *mgr_attrts)
52 struct bridge_drv_interface *intf_fxns;
53 struct io_mgr *hio_mgr = NULL;
54 struct io_mgr_ *pio_mgr = NULL;
57 DBC_REQUIRE(refs > 0);
58 DBC_REQUIRE(io_man != NULL);
59 DBC_REQUIRE(mgr_attrts != NULL);
63 /* A memory base of 0 implies no memory base: */
64 if ((mgr_attrts->shm_base != 0) && (mgr_attrts->usm_length == 0))
67 if (mgr_attrts->word_size == 0)
70 if (DSP_SUCCEEDED(status)) {
71 dev_get_intf_fxns(hdev_obj, &intf_fxns);
73 /* Let Bridge channel module finish the create: */
74 status = (*intf_fxns->pfn_io_create) (&hio_mgr, hdev_obj,
77 if (DSP_SUCCEEDED(status)) {
78 pio_mgr = (struct io_mgr_ *)hio_mgr;
79 pio_mgr->intf_fxns = intf_fxns;
80 pio_mgr->hdev_obj = hdev_obj;
82 /* Return the new channel manager handle: */
91 * ======== io_destroy ========
95 int io_destroy(struct io_mgr *hio_mgr)
97 struct bridge_drv_interface *intf_fxns;
98 struct io_mgr_ *pio_mgr = (struct io_mgr_ *)hio_mgr;
101 DBC_REQUIRE(refs > 0);
103 intf_fxns = pio_mgr->intf_fxns;
105 /* Let Bridge channel module destroy the io_mgr: */
106 status = (*intf_fxns->pfn_io_destroy) (hio_mgr);
112 * ======== io_exit ========
114 * Discontinue usage of the IO module.
118 DBC_REQUIRE(refs > 0);
122 DBC_ENSURE(refs >= 0);
126 * ======== io_init ========
128 * Initialize the IO module's private state.
134 DBC_REQUIRE(refs >= 0);
139 DBC_ENSURE((ret && (refs > 0)) || (!ret && (refs >= 0)));