|
| 1 | +/* |
| 2 | + * notifydefs.h |
| 3 | + * |
| 4 | + * Notify driver support for OMAP Processors. |
| 5 | + * |
| 6 | + * Copyright (C) 2008-2009 Texas Instruments, Inc. |
| 7 | + * |
| 8 | + * This package is free software; you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU General Public License version 2 as |
| 10 | + * published by the Free Software Foundation. |
| 11 | + * |
| 12 | + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 13 | + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 14 | + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | + */ |
| 16 | + |
| 17 | + |
| 18 | +#if !defined(_NOTIFYDEFS_H_) |
| 19 | +#define _NOTIFYDEFS_H_ |
| 20 | + |
| 21 | +/* Linux headers */ |
| 22 | +#include <linux/list.h> |
| 23 | + |
| 24 | +/* Osal And Utils headers */ |
| 25 | +#include <syslink/atomic_linux.h> |
| 26 | + |
| 27 | +/* Module headers */ |
| 28 | +#include <syslink/notify.h> |
| 29 | +#include <syslink/_notify.h> |
| 30 | +#include <syslink/notify_driverdefs.h> |
| 31 | + |
| 32 | + |
| 33 | +/*Macro to make a correct module magic number with ref Count */ |
| 34 | +#define NOTIFY_MAKE_MAGICSTAMP(x) ((NOTIFY_MODULEID << 12u) | (x)) |
| 35 | + |
| 36 | +/* Maximum number of Notify drivers supported. */ |
| 37 | +#define NOTIFY_MAX_DRIVERS 4u |
| 38 | + |
| 39 | +/* Mask to check for system key. */ |
| 40 | +#define NOTIFY_SYSTEMKEY_MASK ((u16)0xFFFF0000) |
| 41 | + |
| 42 | + |
| 43 | +/* Defines the Event callback information instance */ |
| 44 | +struct notify_event_callback { |
| 45 | + notify_fn_notify_cbck fn_notify_cbck; |
| 46 | + /* Callback function pointer */ |
| 47 | + uint *cbck_arg; |
| 48 | + /* Argument associated with callback function */ |
| 49 | +}; |
| 50 | + |
| 51 | +/* Defines the Notify state object, which contains all the module |
| 52 | + * specific information. */ |
| 53 | +struct notify_module_object { |
| 54 | + atomic_t ref_count; |
| 55 | + /* Reference count */ |
| 56 | + struct notify_config cfg; |
| 57 | + /* Notify configuration structure */ |
| 58 | + struct notify_config def_cfg; |
| 59 | + /* Default module configuration */ |
| 60 | + struct mutex *gate_handle; |
| 61 | + /* Handle of gate to be used for local thread safety */ |
| 62 | + struct notify_driver_object |
| 63 | + drivers[NOTIFY_MAX_DRIVERS][NOTIFY_MAX_INTLINES]; |
| 64 | + /* Array of configured drivers. */ |
| 65 | + u32 local_enable_mask; |
| 66 | + /* This is used for local/loopback events. Default to enabled (-1) */ |
| 67 | + bool start_complete; |
| 68 | + /* TRUE if start() was called */ |
| 69 | + bool is_setup; |
| 70 | + /* Indicates whether the Notify module is setup. */ |
| 71 | + struct notify_object *local_notify_handle; |
| 72 | + /* Handle to Notify object for local notifications. */ |
| 73 | +}; |
| 74 | + |
| 75 | +/* Defines the Notify instance object. */ |
| 76 | +struct notify_object { |
| 77 | + uint nesting; |
| 78 | + /* Disable/restore nesting */ |
| 79 | + void *driver_handle; |
| 80 | + /* Handle to device specific driver */ |
| 81 | + u16 remote_proc_id; |
| 82 | + /* Remote MultiProc id */ |
| 83 | + u16 line_id; |
| 84 | + /* Interrupt line id */ |
| 85 | + struct notify_event_callback callbacks[NOTIFY_MAXEVENTS]; |
| 86 | + /* List of event callbacks registered */ |
| 87 | + struct list_head event_list[NOTIFY_MAXEVENTS]; |
| 88 | + /* List of event listeners registered */ |
| 89 | + struct mutex lock; |
| 90 | + /* Lock for event_list */ |
| 91 | +}; |
| 92 | + |
| 93 | + |
| 94 | +#endif /* !defined (_NOTIFYDEFS_H_) */ |
0 commit comments