summaryrefslogtreecommitdiff
path: root/arch/arm/plat-omap/include/syslink/ipc.h
blob: ceb239219b79832393792e23e548fb4ea877550f (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
 *  sysmgr.h
 *
 *  Defines for System manager.
 *
 *  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.
 */

#ifndef _IPC_H_
#define _IPC_H_


/* Module headers */
#include <multiproc.h>
#include <gatepeterson.h>
#include <sharedregion.h>
#include <notify.h>
#include <notify_ducatidriver.h>
#include <heap.h>
#include <heapbufmp.h>
#include <heapmemmp.h>



/* Unique module ID. */
#define IPC_MODULEID			(0xF086)


/* =============================================================================
 * Module Success and Failure codes
 * =============================================================================
 */
/* The resource is still in use */
#define IPC_S_BUSY		2

/* The module has been already setup */
#define IPC_S_ALREADYSETUP	1

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

/* Generic failure. */
#define IPC_E_FAIL		-1

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

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

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

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

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

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

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

/* Specified resource is not available */
#define IPC_E_RESOURCE		-9

/* Operation was interrupted. Please restart the operation */
#define IPC_E_RESTART		-10


/* =============================================================================
 * Macros
 * =============================================================================
 */
/* IPC_CONTROLCMD_LOADCALLBACK */
#define IPC_CONTROLCMD_LOADCALLBACK	(0xBABE0000)

/* IPC_CONTROLCMD_STARTCALLBACK */
#define IPC_CONTROLCMD_STARTCALLBACK	(0xBABE0001)

/* IPC_CONTROLCMD_STOPCALLBACK */
#define IPC_CONTROLCMD_STOPCALLBACK	(0xBABE0002)


/* =============================================================================
 * Enums & Structures
 * =============================================================================
 */
/* the different options for processor synchronization */
enum ipc_proc_sync {
	IPC_PROCSYNC_NONE,          /* don't do any processor sync            */
	IPC_PROCSYNC_PAIR,          /* sync pair of processors in ipc_attach  */
	IPC_PROCSYNC_ALL            /* sync all processors, done in ipc_start */
};

/* ipc configuration structure. */
struct ipc_config {
	enum ipc_proc_sync proc_sync;
	/* the different options for processor synchronization */
};

/* ipc configuration structure. */
struct ipc_params {
	bool setup_messageq;
	bool setup_notify;
	bool setup_ipu_pm;
	bool slave;
	enum ipc_proc_sync proc_sync;
};

/* IPC events. */
enum {
	IPC_CLOSE = 0,
	IPC_START = 1,
	IPC_STOP = 2,
};

/* =============================================================================
 * APIs
 * =============================================================================
 */
/* Attach to remote processor */
int ipc_attach(u16 remote_proc_id);

/* Detach from the remote processor */
int ipc_detach(u16 remote_proc_id);

/* Reads the config entry from the config area. */
int ipc_read_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);

/* Reserves memory, creates default gatemp and heapmemmp */
int ipc_start(void);

/* Writes the config entry to the config area. */
int ipc_write_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);

/* Returns default configuration values for ipc. */
void ipc_get_config(struct ipc_config *cfg_params);

/* Sets up ipc for this processor. */
int ipc_setup(const struct ipc_config *cfg_params);

/* Destroys ipc for this processor. */
int ipc_destroy(void);

/* Creates a ipc. */
int ipc_create(u16 proc_id, struct ipc_params *params);

/* Function to control a Ipc instance for a slave */
int ipc_control(u16 proc_id, u32 cmd_id, void *arg);

/* Function to read configuration information from ipc module */
int ipc_read_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);

/* Function to write configuration information to ipc module */
int ipc_write_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);

/* Clears memory, deletes  default gatemp and heapmemmp */
int ipc_stop(void);

/* IPC event notifications. */
int ipc_notify_event(int event, void *data);

/* Register for IPC events. */
int ipc_register_notifier(struct notifier_block *nb);

/* Un-register for IPC events. */
int ipc_unregister_notifier(struct notifier_block *nb);

/* check if ipc is in recovery state */
#ifdef CONFIG_SYSLINK_RECOVERY
bool ipc_recovering(void);
#endif

/* Indicate to schedule the recovery mechanism */
void ipc_recover_schedule(void);

#endif /* ifndef _IPC_H_ */