PDK API Guide for J721E
mailbox.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
45 #ifndef MAILBOX_H_
46 #define MAILBOX_H_
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /* ========================================================================== */
53 /* Include Files */
54 /* ========================================================================== */
55 #include "ti/csl/hw_types.h"
56 #include "ti/csl/cslr_mailbox.h"
57 
58 /* ========================================================================== */
59 /* Macros */
60 /* ========================================================================== */
61 /*
62  * \name User Id's Corresponds to the Core using the mailbox
63  * Mailbox Queue's Corresponds to the Mailbox Queue Number
64  * @{
65  */
69 #define MAILBOX_QUEUE_0 0U
70 
73 #define MAILBOX_QUEUE_1 1U
74 
77 #define MAILBOX_QUEUE_2 2U
78 
81 #define MAILBOX_QUEUE_3 3U
82 
85 #define MAILBOX_QUEUE_4 4U
86 
89 #define MAILBOX_QUEUE_5 5U
90 
93 #define MAILBOX_QUEUE_6 6U
94 
97 #define MAILBOX_QUEUE_7 7U
98 
101 #define MAILBOX_QUEUE_8 8U
102 
105 #define MAILBOX_QUEUE_9 9U
106 
109 #define MAILBOX_QUEUE_10 10U
110 
113 #define MAILBOX_QUEUE_11 11U
114 
117 #define MAILBOX_QUEUE_12 12U
118 
121 #define MAILBOX_QUEUE_13 13U
122 
125 #define MAILBOX_QUEUE_14 14U
126 
129 #define MAILBOX_QUEUE_15 15U
130 /* Incase of SOC_AM65XX, there are 64 queues; macros not provided for simplicity */
131 /* @} */
132 
133 /*
134  * \name Values that can be returned by MailboxGetMessage/MailboxSendMessage
135  * to notify whether the message received/send is valid
136  * @{
137  */
141 #define MESSAGE_VALID 0U
142 
145 #define MESSAGE_INVALID 1U
146 /* @} */
147 
148 /* ========================================================================== */
149 /* Function Declarations */
150 /* ========================================================================== */
151 
152 /* Queue Access API's */
162 void MailboxReset(uintptr_t baseAddr);
163 
177 void MailboxConfigIdleMode(uintptr_t baseAddr, uint32_t idleMode);
178 
188 uint32_t MailboxGetMessage(uintptr_t baseAddr, uint32_t queueId,
189  uint32_t *msgPtr);
190 
203 uint32_t MailboxSendMessage(uintptr_t baseAddr, uint32_t queueId, uint32_t msg);
204 
205 /* Mailbox user(HW using mailbox) access API's */
216 void MailboxEnableNewMsgInt(uintptr_t baseAddr, uint32_t userId,
217  uint32_t queueId);
218 
230 void MailboxEnableQueueNotFullInt(uintptr_t baseAddr, uint32_t userId,
231  uint32_t queueId);
232 
243 void MailboxDisableNewMsgInt(uintptr_t baseAddr, uint32_t userId,
244  uint32_t queueId);
245 
256 void MailboxDisableQueueNotFullInt(uintptr_t baseAddr, uint32_t userId,
257  uint32_t queueId);
258 
268 void MailboxClrNewMsgStatus(uintptr_t baseAddr, uint32_t userId,
269  uint32_t queueId);
270 
280 void MailboxClrQueueNotFullStatus(uintptr_t baseAddr, uint32_t userId,
281  uint32_t queueId);
282 
292 uint32_t MailboxGetRawNewMsgStatus(uintptr_t baseAddr, uint32_t userId,
293  uint32_t queueId);
294 
304 uint32_t MailboxGetRawQueueNotFullStatus(uintptr_t baseAddr, uint32_t userId,
305  uint32_t queueId);
306 
316 uint32_t MailboxGetIrqEnableStatus(uintptr_t baseAddr, uint32_t userId,
317  uint32_t queueId);
326 uint32_t MailboxGetMessageCount(uintptr_t baseAddr, uint32_t queueId);
327 
337 void MailboxWriteMessage(uintptr_t baseAddr, uint32_t queueId, uint32_t msg);
338 
347 void MailboxWriteEOI(uintptr_t baseAddr, uint32_t value);
348 
358 void MailboxReadMessage(uintptr_t baseAddr, uint32_t queueId,
359  uint32_t *msgPtr);
360 
361 #ifdef __cplusplus
362 }
363 #endif
364 #endif
365 
366 /********************************* End of file ******************************/
void MailboxReadMessage(uintptr_t baseAddr, uint32_t queueId, uint32_t *msgPtr)
This function reads mailbox register.
uint32_t MailboxGetIrqEnableStatus(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function gets IRQ enable status.
uint32_t MailboxGetRawNewMsgStatus(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function gets the raw new message status.
uint32_t MailboxGetRawQueueNotFullStatus(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function gets the raw queue not-full status.
void MailboxEnableNewMsgInt(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function enables the new message interrupt for a user for given queue.
void MailboxReset(uintptr_t baseAddr)
This function resets the mailbox.
uint32_t value
Definition: tisci_otp_revision.h:199
void MailboxClrNewMsgStatus(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function clears the queue not-full status.
void MailboxDisableNewMsgInt(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function disables the new message interrupt for a user for given queue.
void MailboxWriteMessage(uintptr_t baseAddr, uint32_t queueId, uint32_t msg)
This function writes mailbox register.
void MailboxConfigIdleMode(uintptr_t baseAddr, uint32_t idleMode)
This function configures the idle mode of the mailbox.
void MailboxWriteEOI(uintptr_t baseAddr, uint32_t value)
This function writes EOI register.
uint32_t MailboxGetMessage(uintptr_t baseAddr, uint32_t queueId, uint32_t *msgPtr)
This function gets the first message in the queue.
void MailboxEnableQueueNotFullInt(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function enables the queue not full interrupt for a user for given queue.
void MailboxDisableQueueNotFullInt(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function disables the queue not full interrupt for a user for given queue.
void MailboxClrQueueNotFullStatus(uintptr_t baseAddr, uint32_t userId, uint32_t queueId)
This function clears the queue not-full status.
uint32_t MailboxSendMessage(uintptr_t baseAddr, uint32_t queueId, uint32_t msg)
This function writes message in the queue.
uint32_t MailboxGetMessageCount(uintptr_t baseAddr, uint32_t queueId)
This function gets message count in the mailbox.