summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/include/mach/mbox_channels-db5500.h
blob: 0b2fc604873faeaa296e64c828e04a95cd8947ba (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
/*
 * Copyright (C) ST-Ericsson SA 2011
 * Author: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com> for ST-Ericsson.
 *         Bibek Basu <bibek.basu@stericsson.com>
 * License terms: GNU General Public License (GPL), version 2.
 */

#ifndef __INC_MBOX_CHANNELS_H
#define __INC_MBOX_CHANNELS_H

/* Maximum number of datawords which can be send in one PDU */
#define MAILBOX_NR_OF_DATAWORDS	3

/**
 * mbox_channel_cb_t - Definition of the mailbox channel callback.
 * @data:	Pointer to the data.
 * @length:	Length of the data.
 * @priv:	The client's private data.
 *
 * This function will be called upon reception of complete mbox channel PDU
 * or after completion of send operation.
 */
typedef void mbox_channel_cb_t (u32 *data, u32 length, void *priv);

/**
 * struct mbox_channel_msg - Definition of mbox channel message
 * @channel:	Channel number.
 * @data:	Pointer to data to be sent.
 * @length:	Length of data to be sent.
 * @cb:	Pointer to the callback function to be called when send
 *		operation will be finished.
 * @priv:	The client's private data.
 *
 * This structure describes mailbox channel message.
 */
struct mbox_channel_msg {
	u16			channel;
	u32			*data;
	u8			length;
	mbox_channel_cb_t	*cb;
	void			*priv;
};

/**
 * mbox_channel_register - Set up a given mailbox channel.
 * @channel:	Mailbox channel number.
 * @cb:	Pointer to the callback function to be called when a new message
 *		is received.
 * @priv:	Client user data which will be returned in the callback.
 *
 * Returns 0 on success or a negative error code on error.
 */
int mbox_channel_register(u16 channel, mbox_channel_cb_t *cb, void *priv);

/**
 * mbox_channel_send - Send data on given mailbox channel.
 * @msg:	Mailbox channel message to be sent.
 *
 * Returns 0 on success or a negative error code on error.
 */
int mbox_channel_send(struct mbox_channel_msg *msg);

/**
 * mbox_channel_revoke_messages - Revoke messages on given mailbox channel.
 * @channel:	Mailbox channel number.
 *
 * Returns 0 on success or a negative error code on error.
 */
int mbox_channel_revoke_messages(u16 channel);

#endif /*INC_STE_MBOX_H*/