4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * DSP/BIOS Bridge msg_ctrl Module.
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 /* ----------------------------------- Bridge Driver */
30 #include <dspbridge/dspdefs.h>
32 /* ----------------------------------- Platform Manager */
33 #include <dspbridge/dev.h>
35 /* ----------------------------------- This */
37 #include <dspbridge/msg.h>
39 /* ----------------------------------- Globals */
40 static u32 refs
; /* module reference count */
43 * ======== msg_create ========
45 * Create an object to manage message queues. Only one of these objects
46 * can exist per device object.
48 int msg_create(struct msg_mgr
**msg_man
,
49 struct dev_object
*hdev_obj
, msg_onexit msg_callback
)
51 struct bridge_drv_interface
*intf_fxns
;
52 struct msg_mgr_
*msg_mgr_obj
;
53 struct msg_mgr
*hmsg_mgr
;
56 DBC_REQUIRE(refs
> 0);
57 DBC_REQUIRE(msg_man
!= NULL
);
58 DBC_REQUIRE(msg_callback
!= NULL
);
59 DBC_REQUIRE(hdev_obj
!= NULL
);
63 dev_get_intf_fxns(hdev_obj
, &intf_fxns
);
65 /* Let Bridge message module finish the create: */
67 (*intf_fxns
->msg_create
) (&hmsg_mgr
, hdev_obj
, msg_callback
);
70 /* Fill in DSP API message module's fields of the msg_mgr
72 msg_mgr_obj
= (struct msg_mgr_
*)hmsg_mgr
;
73 msg_mgr_obj
->intf_fxns
= intf_fxns
;
75 /* Finally, return the new message manager handle: */
84 * ======== msg_delete ========
86 * Delete a msg_ctrl manager allocated in msg_create().
88 void msg_delete(struct msg_mgr
*hmsg_mgr
)
90 struct msg_mgr_
*msg_mgr_obj
= (struct msg_mgr_
*)hmsg_mgr
;
91 struct bridge_drv_interface
*intf_fxns
;
93 DBC_REQUIRE(refs
> 0);
96 intf_fxns
= msg_mgr_obj
->intf_fxns
;
98 /* Let Bridge message module destroy the msg_mgr: */
99 (*intf_fxns
->msg_delete
) (hmsg_mgr
);
101 dev_dbg(bridge
, "%s: Error hmsg_mgr handle: %p\n",
107 * ======== msg_exit ========
111 DBC_REQUIRE(refs
> 0);
114 DBC_ENSURE(refs
>= 0);
118 * ======== msg_mod_init ========
120 bool msg_mod_init(void)
122 DBC_REQUIRE(refs
>= 0);
126 DBC_ENSURE(refs
>= 0);