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 /* ----------------------------------- Platform Manager */
30 #include <dspbridge/dev.h>
32 /* ----------------------------------- This */
34 #include <dspbridge/io.h>
36 /* ----------------------------------- Globals */
40 * ======== io_create ========
42 * Create an IO manager object, responsible for managing IO between
45 int io_create(struct io_mgr
**io_man
, struct dev_object
*hdev_obj
,
46 const struct io_attrs
*mgr_attrts
)
48 struct bridge_drv_interface
*intf_fxns
;
49 struct io_mgr
*hio_mgr
= NULL
;
50 struct io_mgr_
*pio_mgr
= NULL
;
53 DBC_REQUIRE(refs
> 0);
54 DBC_REQUIRE(io_man
!= NULL
);
55 DBC_REQUIRE(mgr_attrts
!= NULL
);
59 /* A memory base of 0 implies no memory base: */
60 if ((mgr_attrts
->shm_base
!= 0) && (mgr_attrts
->sm_length
== 0))
63 if (mgr_attrts
->word_size
== 0)
67 dev_get_intf_fxns(hdev_obj
, &intf_fxns
);
69 /* Let Bridge channel module finish the create: */
70 status
= (*intf_fxns
->io_create
) (&hio_mgr
, hdev_obj
,
74 pio_mgr
= (struct io_mgr_
*)hio_mgr
;
75 pio_mgr
->intf_fxns
= intf_fxns
;
76 pio_mgr
->dev_obj
= hdev_obj
;
78 /* Return the new channel manager handle: */
87 * ======== io_destroy ========
91 int io_destroy(struct io_mgr
*hio_mgr
)
93 struct bridge_drv_interface
*intf_fxns
;
94 struct io_mgr_
*pio_mgr
= (struct io_mgr_
*)hio_mgr
;
97 DBC_REQUIRE(refs
> 0);
99 intf_fxns
= pio_mgr
->intf_fxns
;
101 /* Let Bridge channel module destroy the io_mgr: */
102 status
= (*intf_fxns
->io_destroy
) (hio_mgr
);
108 * ======== io_exit ========
110 * Discontinue usage of the IO module.
114 DBC_REQUIRE(refs
> 0);
118 DBC_ENSURE(refs
>= 0);
122 * ======== io_init ========
124 * Initialize the IO module's private state.
130 DBC_REQUIRE(refs
>= 0);
135 DBC_ENSURE((ret
&& (refs
> 0)) || (!ret
&& (refs
>= 0)));