summaryrefslogtreecommitdiff
path: root/plat/sun50iw1p1/scp/include/arisc_hwmsgbox.h
blob: 4bab7bcbfdf64fb650b944fcb68fcabfbfdead94 (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
/*
 *  arch/arm/mach-sunxi/arisc/include/arisc_hwmsgbox.h
 *
 * Copyright (c) 2012 Allwinner.
 * 2012-10-01 Written by superm (superm@allwinnertech.com).
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __ARISC_HWMSGBOX_H
#define __ARISC_HWMSGBOX_H

//the number of hardware message queue.
#define AW_HWMSG_QUEUE_NUMBER	(8)

//the user of hardware message queue.
typedef enum aw_hwmsg_queue_user
{
	AW_HWMSG_QUEUE_USER_ARISC,	//arisc
	AW_HWMSG_QUEUE_USER_AC327,	//cpu0
} aw_hwmsg_queue_user_e;

/**
 * initialize hwmsgbox.
 * @para:  none.
 *
 * returns:  OK if initialize hwmsgbox succeeded, others if failed.
 */
int arisc_hwmsgbox_init(void);

/**
 * exit hwmsgbox.
 * @para:  none.
 *
 * returns:  OK if exit hwmsgbox succeeded, others if failed.
 */
int arisc_hwmsgbox_exit(void);

/**
 * send one message to another processor by hwmsgbox.
 * @pmessage:  the pointer of sended message frame.
 * @timeout:   the wait time limit when message fifo is full,
 * it is valid only when parameter mode = SEND_MESSAGE_WAIT_TIMEOUT.
 *
 * returns:  OK if send message succeeded, other if failed.
 */
int arisc_hwmsgbox_send_message(struct arisc_message *pmessage, unsigned int timeout);

/**
 * Description:     query message of hwmsgbox by hand, mainly for.
 * @para:  none.
 *
 * returns:  the point of message, NULL if timeout.
 */
struct arisc_message *arisc_hwmsgbox_query_message(void);

int arisc_hwmsgbox_enable_receiver_int(int queue, int user);
int arisc_hwmsgbox_disable_receiver_int(int queue, int user);

int arisc_hwmsgbox_feedback_message(struct arisc_message *pmessage, unsigned int timeout);

int arisc_hwmsgbox_standby_resume(void);
int arisc_hwmsgbox_standby_suspend(void);

#endif  /* __ARISC_HWMSGBOX_H */