summaryrefslogtreecommitdiff
path: root/arch/arm/plat-omap/include/syslink/notify.h
blob: 0f9a399e5ceb7f9bfb4544c02ecd327b9ce40153 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
 * notify.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_H_)
#define _NOTIFY_H_

/* The resource is still in use */
#define NOTIFY_S_BUSY			2

/* Module already set up */
#define NOTIFY_S_ALREADYSETUP		1

/* Operation is successful. */
#define NOTIFY_S_SUCCESS		0

/* Generic failure */
#define NOTIFY_E_FAIL			-1

/* Argument passed to function is invalid.. */
#define NOTIFY_E_INVALIDARG		-2

/* Operation resulted in memory failure. */
#define NOTIFY_E_MEMORY			-3

/* The specified entity already exists. */
#define NOTIFY_E_ALREADYEXISTS		-4

/* Unable to find the specified entity. */
#define NOTIFY_E_NOTFOUND		-5

/* Operation timed out. */
#define NOTIFY_E_TIMEOUT		-6

/* Module is not initialized. */
#define NOTIFY_E_INVALIDSTATE		-7

/* A failure occurred in an OS-specific call */
#define NOTIFY_E_OSFAILURE		-8

/* The module has been already setup */
#define NOTIFY_E_ALREADYSETUP		-9

/* Specified resource is not available */
#define NOTIFY_E_RESOURCE		-10

/* Operation was interrupted. Please restart the operation */
#define NOTIFY_E_RESTART		-11

/* The resource is still in use */
#define NOTIFY_E_BUSY			-12

/* Driver corresponding to the specified eventId is not registered */
#define NOTIFY_E_DRIVERNOTREGISTERED	-13

/* Event not registered */
#define NOTIFY_E_EVTNOTREGISTERED	-14

/* Event is disabled */
#define NOTIFY_E_EVTDISABLED		-15

/* Remote notification is not initialized */
#define NOTIFY_E_NOTINITIALIZED		-16

/* Trying to illegally use a reserved event */
#define NOTIFY_E_EVTRESERVED		-17

/* Macro to make a correct module magic number with refCount */
#define NOTIFY_MAKE_MAGICSTAMP(x) ((NOTIFY_MODULEID << 12u) | (x))

#define REG volatile

/* Maximum number of events supported by the Notify module */
#define NOTIFY_MAXEVENTS		(u16)32

/* 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
 * registering for an event, if any reserved event numbers are to be
 * used. */
#define NOTIFY_SYSTEMKEY		0xC1D2


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 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);

/* 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(u16 proc_id, u16 line_id, u32 event_id,
			notify_fn_notify_cbck notify_callback_fxn,
			void *cbck_arg);

/* 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 restore Notify module state */
void notify_restore(u16 proc_id, u16 line_id, u32 key);

/* 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 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_) */