diff options
author | Suman Anna <s-anna@ti.com> | 2010-03-23 13:01:09 -0500 |
---|---|---|
committer | Hari Kanigeri <h-kanigeri2@ti.com> | 2010-07-09 17:57:42 -0500 |
commit | cf4731c169c8ddb17abed977197d03be64a49a39 (patch) | |
tree | ca45839f991e4de6de268069890a6e5fd4f135a7 /arch/arm | |
parent | 804687331d1b2a286e0aa01082636053f698ab05 (diff) |
SYSLINK: notify - notify module migrated to SysLink-2.0
Notify module is migrated to SysLink-2.0 version.
TODO: Detailed changes
Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-omap/include/syslink/_notify.h | 83 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/syslink/notify.h | 289 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/syslink/notify_driver.h | 31 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/syslink/notify_driverdefs.h | 411 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/syslink/notify_ioctl.h | 262 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/syslink/notify_setup_proxy.h | 53 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/syslink/notifydefs.h | 83 |
7 files changed, 627 insertions, 585 deletions
diff --git a/arch/arm/plat-omap/include/syslink/_notify.h b/arch/arm/plat-omap/include/syslink/_notify.h new file mode 100644 index 000000000000..9f9d88914160 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/_notify.h @@ -0,0 +1,83 @@ +/* + * _notify.h + * + * The MessageQ module supports the structured sending and receiving of + * variable length messages. This module can be used for homogeneous or + * heterogeneous multi-processor messaging. + * + * Copyright (C) 2009 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. + */ + +#if !defined(__NOTIFY_H_) +#define __NOTIFY_H_ + + +/* Module headers */ +#include <syslink/notify.h> + + +/* Module ID for notify. */ +#define NOTIFY_MODULEID ((u16) 0x5F84) + +/* Mask to check for event ID. */ +#define NOTIFY_EVENT_MASK ((u16) 0xFFFF) + +#define ISRESERVED(event_id, reserved_event) \ + (((event_id & NOTIFY_EVENT_MASK) >= reserved_event) || \ + ((event_id >> 16) == NOTIFY_SYSTEMKEY)) + +/* This structure defines attributes for initialization of the notify module. */ +struct notify_config { + u32 num_events; + /* Number of events to be supported */ + u32 send_event_poll_count; + /* Poll for specified amount before send_event times out */ + u32 num_lines; + /* Max. number of interrupt lines between a single pair of processors */ + u32 reserved_events; + /* Number of reserved events to be supported */ +}; + +/* This structure defines the configuration structure for initialization + * of the notify object. */ +struct notify_params { + u32 reserved; /* Reserved field */ +}; + + +/* Function to get the default configuration for the notify module. */ +void notify_get_config(struct notify_config *cfg); + +/* Function to setup the notify module */ +int notify_setup(struct notify_config *cfg); + +/* Function to destroy the notify module */ +int notify_destroy(void); + +/* Function to create an instance of notify driver */ +struct notify_object *notify_create(void *driver_handle, u16 remote_proc_id, + u16 line_id, const struct notify_params *params); + +/* Function to delete an instance of notify driver */ +int notify_delete(struct notify_object **handle_ptr); + +/* Function to call device specific the notify module setup */ +int notify_attach(u16 proc_id, void *shared_addr); + +/* Function to destroy the device specific notify module */ +int notify_detach(u16 proc_id); + +/* Function registered as callback with the notify driver */ +void notify_exec(struct notify_object *obj, u32 event_id, u32 payload); + + +#endif /* !defined(__NOTIFY_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify.h b/arch/arm/plat-omap/include/syslink/notify.h index 6cf0e943b85d..0f9a399e5ceb 100644 --- a/arch/arm/plat-omap/include/syslink/notify.h +++ b/arch/arm/plat-omap/include/syslink/notify.h @@ -15,253 +15,132 @@ */ -#if !defined NOTIFY_H -#define NOTIFY_H +#if !defined(_NOTIFY_H_) +#define _NOTIFY_H_ -#include <syslink/host_os.h> +/* The resource is still in use */ +#define NOTIFY_S_BUSY 2 -#define NOTIFY_MAX_DRIVERS 16 +/* Module already set up */ +#define NOTIFY_S_ALREADYSETUP 1 -/* - * desc Maximum length of the name of Notify drivers, inclusive of NULL - * string terminator. - * - */ -#define NOTIFY_MAX_NAMELEN 32 - -#define NOTIFY_MODULEID 0x5f84 - -/* - *Status code base for Notify module. - */ -#define NOTIFY_STATUSCODEBASE (NOTIFY_MODULEID << 12u) +/* Operation is successful. */ +#define NOTIFY_S_SUCCESS 0 -/* - * Macro to make error code. - */ -#define NOTIFY_MAKE_FAILURE(x) ((int)(0x80000000\ - | (NOTIFY_STATUSCODEBASE + (x)))) - -/* - * Macro to make success code. - */ -#define NOTIFY_MAKE_SUCCESS(x) (NOTIFY_STATUSCODEBASE + (x)) - -/* - * Generic failure. - */ -#define NOTIFY_E_FAIL NOTIFY_MAKE_FAILURE(1) - -/* - * A timeout occurred while performing the specified operation. - */ -#define NOTIFY_E_TIMEOUT NOTIFY_MAKE_FAILURE(2) - -/* - *Configuration failure. - */ -#define NOTIFY_E_CONFIG NOTIFY_MAKE_FAILURE(3) - -/* - * The module is already initialized - */ -#define NOTIFY_E_ALREADYINIT NOTIFY_MAKE_FAILURE(4) - -/* - * Unable to find the specified entity (e.g. registered event, driver). - */ -#define NOTIFY_E_NOTFOUND NOTIFY_MAKE_FAILURE(5) +/* Generic failure */ +#define NOTIFY_E_FAIL -1 -/* - * The specified operation is not supported. - */ -#define NOTIFY_E_NOTSUPPORTED NOTIFY_MAKE_FAILURE(6) - -/* -* Invalid event number specified to the Notify operation. - */ -#define NOTIFY_E_INVALIDEVENT NOTIFY_MAKE_FAILURE(7) - -/* - * Invalid pointer provided. - */ -#define NOTIFY_E_POINTER NOTIFY_MAKE_FAILURE(8) -/* - * The specified value is out of valid range. - */ -#define NOTIFY_E_RANGE NOTIFY_MAKE_FAILURE(9) - -/* An invalid handle was provided. - */ -#define NOTIFY_E_HANDLE NOTIFY_MAKE_FAILURE(10) - -/* - * An invalid argument was provided to the API. - */ -#define NOTIFY_E_INVALIDARG NOTIFY_MAKE_FAILURE(11) - -/* - * A memory allocation failure occurred. - */ -#define NOTIFY_E_MEMORY NOTIFY_MAKE_FAILURE(12) - -/* - * The module has not been setup. - */ -#define NOTIFY_E_INVALIDSTATE NOTIFY_MAKE_FAILURE(13) - -/* - * Maximum number of supported drivers have already been registered. - */ -#define NOTIFY_E_MAXDRIVERS NOTIFY_MAKE_FAILURE(14) - -/* - * Invalid attempt to use a reserved event number. - */ -#define NOTIFY_E_RESERVEDEVENT NOTIFY_MAKE_FAILURE(15) +/* Argument passed to function is invalid.. */ +#define NOTIFY_E_INVALIDARG -2 -/* - * The specified entity (e.g. driver) already exists. - */ -#define NOTIFY_E_ALREADYEXISTS NOTIFY_MAKE_FAILURE(16) +/* Operation resulted in memory failure. */ +#define NOTIFY_E_MEMORY -3 -/* - * brief The Notify driver has not been initialized. - */ -#define NOTIFY_E_DRIVERINIT NOTIFY_MAKE_FAILURE(17) +/* The specified entity already exists. */ +#define NOTIFY_E_ALREADYEXISTS -4 -/* -* The remote processor is not ready to receive the event. - */ -#define NOTIFY_E_NOTREADY NOTIFY_MAKE_FAILURE(18) +/* Unable to find the specified entity. */ +#define NOTIFY_E_NOTFOUND -5 -/* - * brief Failed to register driver with Notify module. - */ -#define NOTIFY_E_REGDRVFAILED NOTIFY_MAKE_FAILURE(19) +/* Operation timed out. */ +#define NOTIFY_E_TIMEOUT -6 -/* -* Failed to unregister driver with Notify module. - */ -#define NOTIFY_E_UNREGDRVFAILED NOTIFY_MAKE_FAILURE(20) +/* Module is not initialized. */ +#define NOTIFY_E_INVALIDSTATE -7 -/* -* Failure in an OS-specific operation. - */ -#define NOTIFY_E_OSFAILURE NOTIFY_MAKE_FAILURE(21) +/* A failure occurred in an OS-specific call */ +#define NOTIFY_E_OSFAILURE -8 -/* - *Maximum number of supported events have already been registered. - */ -#define NOTIFY_E_MAXEVENTS NOTIFY_MAKE_FAILURE(22) +/* The module has been already setup */ +#define NOTIFY_E_ALREADYSETUP -9 -/* Maximum number of supported user clients have already been - * registered. - */ -#define NOTIFY_E_MAXCLIENTS NOTIFY_MAKE_FAILURE(23) +/* Specified resource is not available */ +#define NOTIFY_E_RESOURCE -10 -/* Operation is successful. - */ -#define NOTIFY_SUCCESS NOTIFY_MAKE_SUCCESS(0) +/* Operation was interrupted. Please restart the operation */ +#define NOTIFY_E_RESTART -11 -/* The ProcMgr module has already been setup in this process. - */ -#define NOTIFY_S_ALREADYSETUP NOTIFY_MAKE_SUCCESS(1) +/* The resource is still in use */ +#define NOTIFY_E_BUSY -12 -/* Other ProcMgr clients have still setup the ProcMgr module. - */ -#define NOTIFY_S_SETUP NOTIFY_MAKE_SUCCESS(2) +/* Driver corresponding to the specified eventId is not registered */ +#define NOTIFY_E_DRIVERNOTREGISTERED -13 -/* Other ProcMgr handles are still open in this process. - */ -#define NOTIFY_S_OPENHANDLE NOTIFY_MAKE_SUCCESS(3) +/* Event not registered */ +#define NOTIFY_E_EVTNOTREGISTERED -14 -/* The ProcMgr instance has already been created/opened in this process - */ -#define NOTIFY_S_ALREADYEXISTS NOTIFY_MAKE_SUCCESS(4) +/* Event is disabled */ +#define NOTIFY_E_EVTDISABLED -15 -/* Maximum depth for nesting Notify_disable / Notify_restore calls. - */ -#define NOTIFY_MAXNESTDEPTH 2 +/* Remote notification is not initialized */ +#define NOTIFY_E_NOTINITIALIZED -16 +/* Trying to illegally use a reserved event */ +#define NOTIFY_E_EVTRESERVED -17 -/* brief Macro to make a correct module magic number with refCount */ +/* Macro to make a correct module magic number with refCount */ #define NOTIFY_MAKE_MAGICSTAMP(x) ((NOTIFY_MODULEID << 12u) | (x)) +#define REG volatile -/* - * const NOTIFYSHMDRV_DRIVERNAME - * - * desc Name of the Notify Shared Memory Mailbox driver. - * - */ -#define NOTIFYMBXDRV_DRIVERNAME "NOTIFYMBXDRV" +/* Maximum number of events supported by the Notify module */ +#define NOTIFY_MAXEVENTS (u16)32 -#define REG volatile -/* - * const NOTIFYSHMDRV_RESERVED_EVENTS - * - * desc Maximum number of events marked as reserved events by the - * notify_shmdrv driver. - * If required, this value can be changed by the system integrator. - * - */ -#define NOTIFYSHMDRV_RESERVED_EVENTS 3 +/* Maximum number of IPC interrupt lines per processor. */ +#define NOTIFY_MAX_INTLINES 4u -/* -* This key must be provided as the upper 16 bits of the eventNo when +/* This key must be provided as the upper 16 bits of the eventNo when * registering for an event, if any reserved event numbers are to be - * used. - */ -#define NOTIFY_SYSTEM_KEY 0xC1D2 + * used. */ +#define NOTIFY_SYSTEMKEY 0xC1D2 -struct notify_config { - u32 maxDrivers; - /* Maximum number of drivers that can be created for Notify at a time */ -}; -typedef void (*notify_callback_fxn)(u16 proc_id, u32 eventNo, void *arg, - u32 payload); +typedef void (*notify_fn_notify_cbck)(u16 proc_id, u16 line_id, u32 event_id, + uint *arg, u32 payload); extern struct notify_module_object notify_state; -/* Function to get the default configuration for the Notify module. */ -void notify_get_config(struct notify_config *cfg); -/* Function to setup the Notify Module */ -int notify_setup(struct notify_config *cfg); +/* Function to disable Notify module */ +u32 notify_disable(u16 procId, u16 line_id); + +/* Function to disable particular event */ +void notify_disable_event(u16 proc_id, u16 line_id, u32 event_id); + +/* Function to enable particular event */ +void notify_enable_event(u16 proc_id, u16 line_id, u32 event_id); + +/* Function to find out whether notification via interrupt line has been + * registered. */ +bool notify_is_registered(u16 proc_id, u16 line_id); -/* Function to destroy the Notify module */ -int notify_destroy(void); +/* Returns the amount of shared memory used by one Notify instance. */ +uint notify_shared_mem_req(u16 proc_id, void *shared_addr); /* Function to register an event */ -int notify_register_event(void *notify_driver_handle, u16 proc_id, - u32 event_no, - notify_callback_fxn notify_callback_fxn, +int notify_register_event(u16 proc_id, u16 line_id, u32 event_id, + notify_fn_notify_cbck notify_callback_fxn, void *cbck_arg); -/* Function to unregister an event */ -int notify_unregister_event(void *notify_driver_handle, u16 proc_id, - u32 event_no, - notify_callback_fxn notify_callback_fxn, +/* Function to register an event */ +int notify_register_event_single(u16 proc_id, u16 line_id, u32 event_id, + notify_fn_notify_cbck notify_callback_fxn, void *cbck_arg); -/* Function to send an event to other processor */ -int notify_sendevent(void *notify_driver_handle, u16 proc_id, - u32 event_no, u32 payload, bool wait_clear); - -/* Function to disable Notify module */ -u32 notify_disable(u16 procId); - /* Function to restore Notify module state */ -void notify_restore(u32 key, u16 proc_id); +void notify_restore(u16 proc_id, u16 line_id, u32 key); -/* Function to disable particular event */ -void notify_disable_event(void *notify_driver_handle, u16 proc_id, - u32 event_no); +/* Function to send an event to other processor */ +int notify_send_event(u16 proc_id, u16 line_id, u32 event_id, u32 payload, + bool wait_clear); -/* Function to enable particular event */ -void notify_enable_event(void *notify_driver_handle, u16 proc_id, u32 event_no); +/* Function to unregister an event */ +int notify_unregister_event(u16 proc_id, u16 line_id, u32 event_id, + notify_fn_notify_cbck notify_callback_fxn, + void *cbck_arg); + +/* Function to unregister an event */ +int notify_unregister_event_single(u16 proc_id, u16 line_id, u32 event_id); -#endif /* !defined NOTIFY_H */ +#endif /* !defined(_NOTIFY_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_driver.h b/arch/arm/plat-omap/include/syslink/notify_driver.h index 30a150174654..95c586b77626 100644 --- a/arch/arm/plat-omap/include/syslink/notify_driver.h +++ b/arch/arm/plat-omap/include/syslink/notify_driver.h @@ -15,30 +15,31 @@ */ -#if !defined NOTIFYDRIVER_H -#define NOTIFYDRIVER_H +#if !defined _NOTIFY_DRIVER_H_ +#define _NOTIFY_DRIVER_H_ -#include<linux/list.h> -/* ----------------------------------- Notify */ -#include <syslink/notifyerr.h> - -/* ----------------------------------- Notify driver */ +/* Module includes */ #include <syslink/notify_driverdefs.h> +#include <syslink/_notify.h> -/* Function to register notify driver */ -int notify_register_driver(char *driver_name, - struct notify_interface *fn_table, - struct notify_driver_attrs *drv_attrs, - struct notify_driver_object **driver_handle); +/* Function to register notify driver */ +int notify_register_driver(u16 remote_proc_id, + u16 line_id, + struct notify_driver_fxn_table *fxn_table, + struct notify_driver_object **driver_handle); /* Function to unregister notify driver */ int notify_unregister_driver(struct notify_driver_object *drv_handle); +/* Function to set the driver handle */ +int notify_set_driver_handle(u16 remote_proc_id, u16 line_id, + struct notify_object *handle); + /* Function to find the driver in the list of drivers */ -int notify_get_driver_handle(char *driver_name, - struct notify_driver_object **handle); +struct notify_driver_object *notify_get_driver_handle(u16 remote_proc_id, + u16 line_id); -#endif /* !defined (NOTIFYDRIVER_H) */ +#endif /* !defined (_NOTIFY_DRIVER_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_driverdefs.h b/arch/arm/plat-omap/include/syslink/notify_driverdefs.h index 0e79562d0867..56f6b282caf7 100644 --- a/arch/arm/plat-omap/include/syslink/notify_driverdefs.h +++ b/arch/arm/plat-omap/include/syslink/notify_driverdefs.h @@ -15,211 +15,18 @@ */ -#if !defined NOTIFYDRIVERDEFS_H -#define NOTIFYDRIVERDEFS_H +#if !defined(_NOTIFY_DRIVERDEFS_H_) +#define _NOTIFY_DRIVERDEFS_H_ -#include <syslink/host_os.h> - -/* ----------------------------------- Notify */ -#include <syslink/notify.h> -#include <syslink/notify_shmdriver.h> -#include <syslink/notifydefs.h> +/* Module headers */ #include <syslink/multiproc.h> - -#define NOTIFY_BASE_CMD (0x100) - -/* - * Command for Notify_getConfig - */ -#define CMD_NOTIFY_GETCONFIG (NOTIFY_BASE_CMD + 1u) - -/* - * Command for Notify_setup - */ -#define CMD_NOTIFY_SETUP (NOTIFY_BASE_CMD + 2u) - -/* - * Command for Notify_destroy - */ -#define CMD_NOTIFY_DESTROY (NOTIFY_BASE_CMD + 3u) - -/* - * Command for Notify_registerEvent - */ -#define CMD_NOTIFY_REGISTEREVENT (NOTIFY_BASE_CMD + 4u) - -/* - * Command for Notify_unregisterEvent - */ -#define CMD_NOTIFY_UNREGISTEREVENT (NOTIFY_BASE_CMD + 5u) - -/* - * Command for Notify_sendEvent - */ -#define CMD_NOTIFY_SENDEVENT (NOTIFY_BASE_CMD + 6u) - -/* - * Command for Notify_disable - */ -#define CMD_NOTIFY_DISABLE (NOTIFY_BASE_CMD + 7u) - -/* - * Command for Notify_restore - */ -#define CMD_NOTIFY_RESTORE (NOTIFY_BASE_CMD + 8u) - -/* - * Command for Notify_disableEvent - */ -#define CMD_NOTIFY_DISABLEEVENT (NOTIFY_BASE_CMD + 9u) - -/* - * Command for Notify_enableEvent - */ -#define CMD_NOTIFY_ENABLEEVENT (NOTIFY_BASE_CMD + 10u) - -/*! - * @brief Command for Notify_attach - */ -#define CMD_NOTIFY_ATTACH (NOTIFY_BASE_CMD + 11u) - -/*! - * @brief Command for Notify_detach - */ -#define CMD_NOTIFY_DETACH (NOTIFY_BASE_CMD + 12u) - -/* - * const NOTIFY_SYSTEM_KEY_MASK - * - * desc Mask to check for system key. - * - */ - -#define NOTIFY_SYSTEM_KEY_MASK (unsigned short int) 0xFFFF0000 - -/* - * const NOTIFY_EVENT_MASK - * - * desc Mask to check for event ID. - * - */ - -#define NOTIFY_EVENT_MASK (unsigned short int) 0x0000FFFF - -struct notify_cmd_args { - int apiStatus; - /* Status of the API being called. */ -}; - -/* - * Command arguments for Notify_getConfig - */ -struct notify_cmd_args_get_config { - struct notify_cmd_args commonArgs; - struct notify_config *cfg; -}; - -/* - * Command arguments for Notify_setup - */ -struct notify_cmd_args_setup { - struct notify_cmd_args commonArgs; - struct notify_config *cfg; -}; - -/* - * Command arguments for Notify_destroy - */ -struct notify_cmd_args_destroy { - struct notify_cmd_args commonArgs; -}; - -/* - * Command arguments for Notify_registerEvent - */ -struct notify_cmd_args_register_event { - struct notify_cmd_args commonArgs; - struct notify_driver_object *handle; - u16 procId; - u32 eventNo; - notify_callback_fxn fnNotifyCbck; - void *cbckArg; - u32 pid; -}; - -/* - * Command arguments for Notify_unregisterEvent - */ -struct notify_cmd_args_unregister_event { - struct notify_cmd_args commonArgs; - struct notify_driver_object *handle; - u16 procId; - u32 eventNo; - notify_callback_fxn fnNotifyCbck; - void *cbckArg; - u32 pid; -}; - -/* - * Command arguments for Notify_sendEvent - */ -struct notify_cmd_args_send_event { - struct notify_cmd_args commonArgs; - struct notify_driver_object *handle; - u16 procId; - u32 eventNo; - u32 payload; - bool waitClear; -}; - -/* - * Command arguments for Notify_disable - */ -struct notify_cmd_args_disable { - struct notify_cmd_args commonArgs; - u16 procId; - u32 flags; -}; - -/* - * Command arguments for Notify_restore - */ -struct notify_cmd_args_restore { - struct notify_cmd_args commonArgs; - u32 key; - u16 procId; -}; - -/* - * Command arguments for Notify_disableEvent - */ -struct notify_cmd_args_disable_event { - struct notify_cmd_args commonArgs; - struct notify_driver_object *handle; - u16 procId; - u32 eventNo; -}; - -/* - * Command arguments for Notify_enableEvent - */ -struct notify_cmd_args_enable_event { - struct notify_cmd_args commonArgs; - void *notify_driver_handle; - u16 procId; - u32 eventNo; -}; - -/* - * Command arguments for Notify_exit - */ -struct notify_cmd_args_exit { - struct notify_cmd_args commonArgs; -}; +#include <syslink/notify.h> +#include <syslink/_notify.h> -enum { +/* Enumerations to indicate types of Driver initialization status */ +enum notify_driver_init_status { NOTIFY_DRIVERINITSTATUS_NOTDONE = 0, /* Driver initialization is not done. */ NOTIFY_DRIVERINITSTATUS_DONE = 1, @@ -230,6 +37,44 @@ enum { /* End delimiter indicating start of invalid values for this enum */ }; +struct notify_driver_object; + +/* This structure defines the function table interface for the Notify + * driver. + * This function table interface must be implemented by each Notify + * driver and registered with the Notify module. */ +struct notify_driver_fxn_table { + int (*register_event)(struct notify_driver_object *handle, + u32 event_id); + /* interface function register_event */ + int (*unregister_event)(struct notify_driver_object *handle, + u32 event_id); + /* interface function unregister_event */ + int (*send_event)(struct notify_driver_object *handle, u32 event_id, + u32 payload, bool wait_clear); + /* interface function send_event */ + u32 (*disable)(struct notify_driver_object *handle); + /* interface function disable */ + void (*enable)(struct notify_driver_object *handle); + /* interface function enable */ + void (*disable_event)(struct notify_driver_object *handle, + u32 event_id); + /* interface function disable_event */ + void (*enable_event)(struct notify_driver_object *handle, u32 event_id); + /* interface function enable_event */ +}; + +/* This structure defines the Notify driver object and handle used + * internally to contain all information required for the Notify driver + * This object contains all information for the Notify module to be + * able to identify and interact with the Notify driver. */ +struct notify_driver_object { + enum notify_driver_init_status is_init; + struct notify_driver_fxn_table fxn_table; + struct notify_object *notify_handle; +}; + +#if 0 /* *This structure defines information for all processors supported by *the Notify driver. @@ -260,115 +105,11 @@ struct notify_driver_attrs { proc_info[MULTIPROC_MAXPROCESSORS]; }; - -/* ======================================== - * Function pointer types - * ======================================== - */ -/* - * This type defines the function to register a callback for an event - * with the Notify driver. - * This function gets called internally from the Notify_registerEvent - * API. The Notify_registerEvent () function passes on the - * request into the Notify driver identified by the Notify Handle. - * - */ -typedef int(*NotifyDriver_RegisterEvent)(struct notify_driver_object *handle, - u16 procId, u32 eventNo, notify_callback_fxn cbckFxn, - void *cbckArg); -/* - * This type defines the function to unregister a callback for an event - * with the Notify driver. - * This function gets called internally from the Notify_unregisterEvent - * API. The Notify_unregisterEvent () function passes on the - * request into the Notify driver identified by the Notify Handle. - * - */ -typedef int(*NotifyDriver_UnregisterEvent) (struct notify_driver_object *handle, - u16 procId, u32 eventNo, notify_callback_fxn cbckFxn, - void *cbckArg); - -/* - * This type defines the function to send a notification event to the - * registered users for this notification on the specified processor. - * This function gets called internally from the Notify_sendEvent () - * API. The Notify_sendEvent () function passes on the initialization - * request into the Notify driver identified by the Notify Handle. - */ -typedef int(*NotifyDriver_SendEvent) (struct notify_driver_object *handle, - u16 procId, u32 eventNo, u32 payload, bool waitClear); - -/* - * This type defines the function to disable all events for the - * specified processor ID. - * This function gets called internally from the Notify_disable () - * API. The Notify_disable () function passes on the request into the - * Notify driver identified by the Notify Handle. - */ -typedef u32(*NotifyDriver_Disable) (struct notify_driver_object *handle, - u16 procId); - -/* - * This type defines the function to restore all events for the - * specified processor ID. - * This function gets called internally from the Notify_restore () - * API. The Notify_restore () function passes on the request into the - * Notify driver identified by the Notify Handle. - */ -typedef void (*NotifyDriver_Restore) (struct notify_driver_object *handle, - u32 key, u16 procId); - -/* - * This type defines the function to disable specified event for the - * specified processor ID. - * This function gets called internally from the Notify_disableEvent () - * API. The Notify_disableEvent () function passes on the request into - * the Notify driver identified by the Notify Handle. - */ -typedef void (*NotifyDriver_DisableEvent) (struct notify_driver_object *handle, - u16 procId, u32 eventNo); - -/* - * This type defines the function to enable specified event for the - * specified processor ID. - * This function gets called internally from the Notify_enableEvent () - * API. The Notify_enableEvent () function passes on the request into - * the Notify driver identified by the Notify Handle. - * - */ -typedef void (*NotifyDriver_EnableEvent) (struct notify_driver_object *handle, - u16 procId, u32 eventNo); - - -/* - * This structure defines the function table interface for the Notify - * driver. - * This function table interface must be implemented by each Notify - * driver and registered with the Notify module. - * - */ -struct notify_interface { - NotifyDriver_RegisterEvent register_event; - /* interface function registerEvent */ - NotifyDriver_UnregisterEvent unregister_event; - /* interface function unregisterEvent */ - NotifyDriver_SendEvent send_event; - /* interface function sendEvent */ - NotifyDriver_Disable disable; - /* interface function disable */ - NotifyDriver_Restore restore; - /* interface function restore */ - NotifyDriver_DisableEvent disable_event; - /* interface function disableEvent */ - NotifyDriver_EnableEvent enable_event; -}; - - union notify_drv_procevents{ struct { struct notify_shmdrv_attrs attrs; struct notify_shmdrv_ctrl *ctrl_ptr; - } shm_events; + } shm_events; struct { /*Attributes */ @@ -380,61 +121,17 @@ union notify_drv_procevents{ } non_shm_events; }; - -/* - * This structure defines the Notify driver object and handle used - * internally to contain all information required for the Notify driver - * This object contains all information for the Notify module to be - * able to identify and interact with the Notify driver. - */ -struct notify_driver_object { - int is_init; - struct notify_interface fn_table; - char name[NOTIFY_MAX_NAMELEN]; - struct notify_driver_attrs attrs; - u32 *disable_flag[NOTIFY_MAXNESTDEPTH]; - void *driver_object; -}; - - struct notify_drv_eventlist { - unsigned long int event_handler_count; - struct list_head listeners; + unsigned long int event_handler_count; + struct list_head listeners; }; - - -struct notify_drv_eventlistner{ - struct list_head element; - fn_notify_cbck fn_notify_cbck; - void *cbck_arg; -}; - - struct notify_drv_proc_module { - - unsigned long int proc_id; - struct notify_drv_eventlist *event_list; - struct notify_shmdrv_eventreg *reg_chart; - union notify_drv_procevents events_obj; -}; - -/* - * Defines the Notify state object, which contains all the module - * specific information. - */ -struct notify_module_object { - atomic_t ref_count; - struct notify_config cfg; - /* Notify configuration structure */ - struct notify_config def_cfg; - /* Default module configuration */ - struct mutex *gate_handle; - /* Handle of gate to be used for local thread safety */ - struct notify_driver_object drivers[NOTIFY_MAX_DRIVERS]; - /* Array of configured drivers. */ - u32 disable_depth; - /* Current disable depth for Notify module. */ + unsigned long int proc_id; + struct notify_drv_eventlist *event_list; + struct notify_shmdrv_eventreg *reg_chart; + union notify_drv_procevents events_obj; }; -#endif /* !defined (NOTIFYDRIVERDEFS_H) */ +#endif +#endif /* !defined(_NOTIFY_DRIVERDEFS_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_ioctl.h b/arch/arm/plat-omap/include/syslink/notify_ioctl.h new file mode 100644 index 000000000000..7216e6f4e2d5 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_ioctl.h @@ -0,0 +1,262 @@ +/* + * notify_driverdefs.h + * + * Notify driver support for OMAP Processors. + * + * Copyright (C) 2008-2009 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. + */ + + +#if !defined(_NOTIFY_IOCTL_H_) +#define _NOTIFY_IOCTL_H_ + +/* Linux headers */ +#include <linux/ioctl.h> + +/* Utilities headers */ +#include <syslink/host_os.h> + +/* Module headers */ +#include <syslink/notify.h> +#include <syslink/notify_shmdriver.h> +#include <syslink/notifydefs.h> + + +/* Base command ID for Notify */ +#define NOTIFYCMDBASE (0xE0) + +/* Base command ID for Notify */ +#define NOTIFY_BASE_CMD (0x170) + +/* Command for notify_get_config */ +#define CMD_NOTIFY_GETCONFIG _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 1u, \ + struct notify_cmd_args_get_config) + +/* Command for notify_setup */ +#define CMD_NOTIFY_SETUP _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 2u, \ + struct notify_cmd_args_setup) + +/* Command for notify_destroy */ +#define CMD_NOTIFY_DESTROY _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 3u, \ + struct notify_cmd_args_destroy) + +/* Command for notify_register_event */ +#define CMD_NOTIFY_REGISTEREVENT _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 4u, \ + struct notify_cmd_args_register_event) + +/* Command for notify_unregister_event */ +#define CMD_NOTIFY_UNREGISTEREVENT _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 5u, \ + struct notify_cmd_args_unregister_event) + +/* Command for notify_send_event */ +#define CMD_NOTIFY_SENDEVENT _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 6u, \ + struct notify_cmd_args_send_event) +/* Command for notify_disable */ +#define CMD_NOTIFY_DISABLE _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 7u, \ + struct notify_cmd_args_disable) + +/* Command for notify_restore */ +#define CMD_NOTIFY_RESTORE _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 8u, \ + struct notify_cmd_args_restore) + +/* Command for notify_disable_event */ +#define CMD_NOTIFY_DISABLEEVENT _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 9u, \ + struct notify_cmd_args_disable_event) + +/* Command for notify_enable_event */ +#define CMD_NOTIFY_ENABLEEVENT _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 10u, \ + struct notify_cmd_args_enable_event) + +/* Command for notify_attach */ +#define CMD_NOTIFY_ATTACH _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 11u, \ + struct notify_cmd_args_attach) + +/* Command for notify_detach */ +#define CMD_NOTIFY_DETACH _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 12u, \ + struct notify_cmd_args_detach) + +/* Command for notify_thread_attach */ +#define CMD_NOTIFY_THREADATTACH _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 13u, \ + struct notify_cmd_args) + +/* Command for notify_thread_detach */ +#define CMD_NOTIFY_THREADDETACH _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 14u, \ + struct notify_cmd_args) + +/* Command for notify_is_registered */ +#define CMD_NOTIFY_ISREGISTERED _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 15u, \ + struct notify_cmd_args_is_registered) + +/* Command for notify_shared_mem_req */ +#define CMD_NOTIFY_SHAREDMEMREQ _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 16u, \ + struct notify_cmd_args_shared_mem_req) +/* Command for notify_register_event_single */ +#define CMD_NOTIFY_REGISTEREVENTSINGLE _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 17u, \ + struct notify_cmd_args_register_event) + +/* Command for notify_unregister_event_single */ +#define CMD_NOTIFY_UNREGISTEREVENTSINGLE _IOWR(NOTIFYCMDBASE, \ + NOTIFY_BASE_CMD + 18u, \ + struct notify_cmd_args_unregister_event) + + +/*Structure of Event Packet read from notify kernel-side..*/ +struct notify_drv_event_packet { + struct list_head element; + u32 pid; + u32 proc_id; + u32 event_id; + u16 line_id; + u32 data; + notify_fn_notify_cbck func; + void *param; + bool is_exit; +}; + +/* Common arguments for all ioctl commands */ +struct notify_cmd_args { + int api_status; +}; + +/* Command arguments for notify_get_config */ +struct notify_cmd_args_get_config { + struct notify_cmd_args common_args; + struct notify_config *cfg; +}; + +/* Command arguments for notify_setup */ +struct notify_cmd_args_setup { + struct notify_cmd_args common_args; + struct notify_config *cfg; +}; + +/* Command arguments for notify_destroy */ +struct notify_cmd_args_destroy { + struct notify_cmd_args common_args; +}; + +/* Command arguments for notify_attach */ +struct notify_cmd_args_attach { + struct notify_cmd_args common_args; + u16 proc_id; + void *shared_addr; +}; + +/* Command arguments for notify_detach */ +struct notify_cmd_args_detach { + struct notify_cmd_args common_args; + u16 proc_id; +}; + +/* Command arguments for notify_cmd_args_shared_mem_req */ +struct notify_cmd_args_shared_mem_req { + struct notify_cmd_args common_args; + u16 proc_id; + void *shared_addr; + uint shared_mem_size; +}; + +/* Command arguments for notify_cmd_args_is_registered */ +struct notify_cmd_args_is_registered { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + bool is_registered; +}; + +/* Command arguments for notify_register_event */ +struct notify_cmd_args_register_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; + notify_fn_notify_cbck fn_notify_cbck; + uint *cbck_arg; + u32 pid; +}; + +/* Command arguments for notify_unregister_event */ +struct notify_cmd_args_unregister_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; + notify_fn_notify_cbck fn_notify_cbck; + uint *cbck_arg; + u32 pid; +}; + +/* Command arguments for notify_send_event */ +struct notify_cmd_args_send_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; + u32 payload; + bool wait_clear; +}; + +/* Command arguments for notify_disable */ +struct notify_cmd_args_disable { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 flags; +}; + +/* Command arguments for notify_restore */ +struct notify_cmd_args_restore { + struct notify_cmd_args common_args; + u32 key; + u16 proc_id; + u16 line_id; +}; + +/* Command arguments for notify_disable_event */ +struct notify_cmd_args_disable_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; +}; + +/* Command arguments for notify_enable_event */ +struct notify_cmd_args_enable_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; +}; + +/* Command arguments for notify_exit */ +struct notify_cmd_args_exit { + struct notify_cmd_args common_args; +}; + + +#endif /* !defined(_NOTIFY_IOCTL_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h b/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h new file mode 100644 index 000000000000..383b3150a7d7 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h @@ -0,0 +1,53 @@ +/* + * notify_setup_proxy.h + * + * Proxy to connect notify setup to device specific implementation + * + * Copyright (C) 2008-2009 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. + */ + +#if !defined(_NOTIFYSETUPPROXY_H_0x5f84) +#define _NOTIFYSETUPPROXY_H_0x5f84 + +#if defined(CONFIG_ARCH_OMAP4) +/* Function that will be called in Notify_attach */ +extern int notify_setup_omap4_attach(u16 proc_id, void *shared_addr); +#define notify_setup_proxy_attach(proc_id, shared_addr) \ + notify_setup_omap4_attach(proc_id, shared_addr) + +/* Function that will be called in notify_stop */ +extern int notify_setup_omap4_detach(u16 proc_id); +#define notify_setup_proxy_detach notify_setup_omap4_detach + +/* Shared Memory Required for notify setup */ +extern uint notify_setup_omap4_shared_mem_req(u16 proc_id, void *shared_addr); +#define notify_setup_proxy_shared_mem_req(proc_id, shared_addr) \ + notify_setup_omap4_shared_mem_req(proc_id, shared_addr) + +/* Is interrupt line available? */ +extern bool notify_setup_omap4_int_line_available(u16 remote_proc_id); +#define notify_setup_proxy_int_line_available(remote_proc_id) \ + notify_setup_omap4_int_line_available(remote_proc_id) +#else +/* Function that will be called in Notify_attach */ +#define notify_setup_proxy_attach(proc_id, shared_addr) + +/* Function that will be called in notify_stop */ +#define notify_setup_proxy_detach + +/* Shared Memory Required for notify setup */ +#define notify_setup_proxy_shared_mem_req(proc_id, shared_addr) + +/* Is interrupt line available? */ +#define notify_setup_proxy_int_line_available(remote_proc_id) +#endif /* if defined (SYSLINK_PLATFORM_OMAPL1XX) */ + +#endif /* !defined(_NOTIFYSETUPPROXY_H_0x5f84) */ diff --git a/arch/arm/plat-omap/include/syslink/notifydefs.h b/arch/arm/plat-omap/include/syslink/notifydefs.h index 7f37346a7f75..b0df5d536168 100644 --- a/arch/arm/plat-omap/include/syslink/notifydefs.h +++ b/arch/arm/plat-omap/include/syslink/notifydefs.h @@ -15,11 +15,78 @@ */ -#if !defined NOTIFYDEFS_H -#define NOTIFYDEFS_H -typedef void (*fn_notify_cbck) (unsigned long int procId, - u32 eventNo, - void *arg, - u32 payload) ; - -#endif /* !defined (NOTIFYDEFS_H) */ +#if !defined(_NOTIFYDEFS_H_) +#define _NOTIFYDEFS_H_ + +/* Linux headers */ +#include <linux/list.h> + +/* Osal And Utils headers */ +#include <syslink/atomic_linux.h> + +/* Module headers */ +#include <syslink/notify.h> +#include <syslink/_notify.h> +#include <syslink/notify_driverdefs.h> + + +/*Macro to make a correct module magic number with ref Count */ +#define NOTIFY_MAKE_MAGICSTAMP(x) ((NOTIFY_MODULEID << 12u) | (x)) + +/* Maximum number of Notify drivers supported. */ +#define NOTIFY_MAX_DRIVERS 4u + +/* Mask to check for system key. */ +#define NOTIFY_SYSTEMKEY_MASK ((u16)0xFFFF0000) + + +/* Defines the Event callback information instance */ +struct notify_event_callback { + notify_fn_notify_cbck fn_notify_cbck; + /* Callback function pointer */ + uint *cbck_arg; + /* Argument associated with callback function */ +}; + +/* Defines the Notify state object, which contains all the module + * specific information. */ +struct notify_module_object { + atomic_t ref_count; + /* Reference count */ + struct notify_config cfg; + /* Notify configuration structure */ + struct notify_config def_cfg; + /* Default module configuration */ + struct mutex *gate_handle; + /* Handle of gate to be used for local thread safety */ + struct notify_driver_object + drivers[NOTIFY_MAX_DRIVERS][NOTIFY_MAX_INTLINES]; + /* Array of configured drivers. */ + u32 local_enable_mask; + /* This is used for local/loopback events. Default to enabled (-1) */ + bool start_complete; + /* TRUE if start() was called */ + bool is_setup; + /* Indicates whether the Notify module is setup. */ + struct notify_object *local_notify_handle; + /* Handle to Notify object for local notifications. */ +}; + +/* Defines the Notify instance object. */ +struct notify_object { + uint nesting; + /* Disable/restore nesting */ + void *driver_handle; + /* Handle to device specific driver */ + u16 remote_proc_id; + /* Remote MultiProc id */ + u16 line_id; + /* Interrupt line id */ + struct notify_event_callback callbacks[NOTIFY_MAXEVENTS]; + /* List of event callbacks registered */ + struct list_head event_list[NOTIFY_MAXEVENTS]; + /* List of event listeners registered */ +}; + + +#endif /* !defined (_NOTIFYDEFS_H_) */ |