diff options
author | Omar Ramirez Luna <omar.ramirez@ti.com> | 2010-06-23 17:01:57 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-24 02:39:07 +0400 |
commit | c4ca3d5a4b02b484fdb1bab59489699b94998fad (patch) | |
tree | 6dbacf20c033d7c15d983ec563d1ec9ac5fc2eb8 /drivers/staging/tidspbridge/pmgr/msg.c | |
parent | 999e07d63289f7a401972cf390f569ffcd3d3a7b (diff) | |
download | linux-c4ca3d5a4b02b484fdb1bab59489699b94998fad.tar.xz |
staging: ti dspbridge: add platform manager code
Add TI's DSP Bridge platform manager driver sources
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
Signed-off-by: Kanigeri, Hari <h-kanigeri2@ti.com>
Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Signed-off-by: Guzman Lugo, Fernando <fernando.lugo@ti.com>
Signed-off-by: Hebbar, Shivananda <x0hebbar@ti.com>
Signed-off-by: Ramos Falcon, Ernesto <ernesto@ti.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Anna, Suman <s-anna@ti.com>
Signed-off-by: Gupta, Ramesh <grgupta@ti.com>
Signed-off-by: Gomez Castellanos, Ivan <ivan.gomez@ti.com>
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Armando Uribe De Leon <x0095078@ti.com>
Signed-off-by: Deepak Chitriki <deepak.chitriki@ti.com>
Signed-off-by: Menon, Nishanth <nm@ti.com>
Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/tidspbridge/pmgr/msg.c')
-rw-r--r-- | drivers/staging/tidspbridge/pmgr/msg.c | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/drivers/staging/tidspbridge/pmgr/msg.c b/drivers/staging/tidspbridge/pmgr/msg.c new file mode 100644 index 000000000000..64f1cb4bf5ac --- /dev/null +++ b/drivers/staging/tidspbridge/pmgr/msg.c @@ -0,0 +1,129 @@ +/* + * msg.c + * + * DSP-BIOS Bridge driver support functions for TI OMAP processors. + * + * DSP/BIOS Bridge msg_ctrl Module. + * + * Copyright (C) 2005-2006 Texas Instruments, Inc. + * + * This package is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* ----------------------------------- Host OS */ +#include <dspbridge/host_os.h> + +/* ----------------------------------- DSP/BIOS Bridge */ +#include <dspbridge/std.h> +#include <dspbridge/dbdefs.h> + +/* ----------------------------------- Trace & Debug */ +#include <dspbridge/dbc.h> + +/* ----------------------------------- Bridge Driver */ +#include <dspbridge/dspdefs.h> + +/* ----------------------------------- Platform Manager */ +#include <dspbridge/dev.h> + +/* ----------------------------------- This */ +#include <msgobj.h> +#include <dspbridge/msg.h> + +/* ----------------------------------- Globals */ +static u32 refs; /* module reference count */ + +/* + * ======== msg_create ======== + * Purpose: + * Create an object to manage message queues. Only one of these objects + * can exist per device object. + */ +int msg_create(OUT struct msg_mgr **phMsgMgr, + struct dev_object *hdev_obj, msg_onexit msgCallback) +{ + struct bridge_drv_interface *intf_fxns; + struct msg_mgr_ *msg_mgr_obj; + struct msg_mgr *hmsg_mgr; + int status = 0; + + DBC_REQUIRE(refs > 0); + DBC_REQUIRE(phMsgMgr != NULL); + DBC_REQUIRE(msgCallback != NULL); + DBC_REQUIRE(hdev_obj != NULL); + + *phMsgMgr = NULL; + + dev_get_intf_fxns(hdev_obj, &intf_fxns); + + /* Let Bridge message module finish the create: */ + status = + (*intf_fxns->pfn_msg_create) (&hmsg_mgr, hdev_obj, msgCallback); + + if (DSP_SUCCEEDED(status)) { + /* Fill in DSP API message module's fields of the msg_mgr + * structure */ + msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr; + msg_mgr_obj->intf_fxns = intf_fxns; + + /* Finally, return the new message manager handle: */ + *phMsgMgr = hmsg_mgr; + } else { + status = -EPERM; + } + return status; +} + +/* + * ======== msg_delete ======== + * Purpose: + * Delete a msg_ctrl manager allocated in msg_create(). + */ +void msg_delete(struct msg_mgr *hmsg_mgr) +{ + struct msg_mgr_ *msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr; + struct bridge_drv_interface *intf_fxns; + + DBC_REQUIRE(refs > 0); + + if (msg_mgr_obj) { + intf_fxns = msg_mgr_obj->intf_fxns; + + /* Let Bridge message module destroy the msg_mgr: */ + (*intf_fxns->pfn_msg_delete) (hmsg_mgr); + } else { + dev_dbg(bridge, "%s: Error hmsg_mgr handle: %p\n", + __func__, hmsg_mgr); + } +} + +/* + * ======== msg_exit ======== + */ +void msg_exit(void) +{ + DBC_REQUIRE(refs > 0); + refs--; + + DBC_ENSURE(refs >= 0); +} + +/* + * ======== msg_mod_init ======== + */ +bool msg_mod_init(void) +{ + DBC_REQUIRE(refs >= 0); + + refs++; + + DBC_ENSURE(refs >= 0); + + return true; +} |