PDK-9368: j721s2: Sciclient/Sciserver fixes to match RM/PM data
[processor-sdk/pdk.git] / packages / ti / drv / sciclient / src / sciserver / j721s2 / sciserver_hwiData.h
1 /*
2  * Copyright (c) 2021, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * *  Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  * *  Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
33 /**
34  *  \file sciserver_hwi_data.h
35  *
36  *  \brief This file contains HWI data for the Sciserver
37  */
39 #ifndef SCISERVER_HWI_DATA_H
40 #define SCISERVER_HWI_DATA_H
42 #include <string.h>
43 #include <ti/csl/csl_types.h>
44 #include <ti/csl/hw_types.h>
45 #include <ti/csl/csl_sec_proxy.h>
46 #include <ti/drv/sciclient/sciserver.h>
47 #include <sciserver_secproxyConfigData.h>
49 /** Maximum number of Secure Proxy Instances */
50 #define SCISERVER_SECPROXY_INSTANCE_COUNT (0x2U)
52 /*
53  * Task stacks are also static memory blocks so the size must be
54  * defined below.
55  */
56 #define SCISERVER_TASK_STACK_SIZE         (1536)
58 /** Buffers to be used by user space */
59 static uint32_t user_hi_msg_buffer[SCISERVER_HW_QUEUE_SIZE];
60 static uint32_t user_lo_msg_buffer[SCISERVER_HW_QUEUE_SIZE];
61 static uint32_t user_hi_main_msg_buffer[SCISERVER_HW_QUEUE_SIZE];
62 static uint32_t user_lo_main_msg_buffer[SCISERVER_HW_QUEUE_SIZE];
64 static Sciserver_taskState user_hi_msg_state;
65 static Sciserver_taskState user_lo_msg_state;
67 static Sciserver_msgData user_hi_msg_data;
68 static Sciserver_msgData user_lo_msg_data;
69 static Sciserver_msgData user_hi_main_msg_data;
70 static Sciserver_msgData user_lo_main_msg_data;
72 /* Task stack memory regions */
73 static uint8_t user_hi_task_stack[SCISERVER_TASK_STACK_SIZE];
74 static uint8_t user_lo_task_stack[SCISERVER_TASK_STACK_SIZE];
76 static uint32_t *const user_hi_msg_buffer_list[SCISERVER_SECPROXY_INSTANCE_COUNT] = {
77     user_hi_msg_buffer,
78     user_hi_main_msg_buffer
79 };
81 static uint32_t *const user_lo_msg_buffer_list[SCISERVER_SECPROXY_INSTANCE_COUNT] = {
82     user_lo_msg_buffer,
83     user_lo_main_msg_buffer,
84 };
86 static Sciserver_msgData *const user_hi_msg_data_list[SCISERVER_SECPROXY_INSTANCE_COUNT] = {
87     &user_hi_msg_data,
88     &user_hi_main_msg_data,
89 };
91 static Sciserver_msgData *const user_lo_msg_data_list[SCISERVER_SECPROXY_INSTANCE_COUNT] = {
92     &user_lo_msg_data,
93     &user_lo_main_msg_data,
94 };
96 static const Sciserver_hwiData sciserver_hwi_list[] = {
97     /* user_mcu_nav_high_priority */
98     {
99         .irq_num =
100             CSLR_MCU_R5FSS0_CORE0_INTR_MCU_NAVSS0_INTR_ROUTER_0_OUTL_INTR_6,
101         .hw_msg_queue_id =
102             J721S2_MCU_NAVSS0_SEC_PROXY0_RX_DM_NONSEC_HIGH_PRIORITY_RX_THR078_CONF045,
103         .hw_msg_buffer = user_hi_msg_buffer,
104         .semaphore_id = SCISERVER_SEMAPHORE_USER_HI,
105         .user_msg_data = &user_hi_msg_data,
106     },
107     /* user_main_nav_high_priority */
108     {
109         .irq_num =
110             CSLR_MCU_R5FSS0_CORE0_INTR_MCU_NAVSS0_INTR_ROUTER_0_OUTL_INTR_7,
111         .hw_msg_queue_id =
112             J721S2_NAVSS0_SEC_PROXY_0_RX_DM_NONSEC_HIGH_PRIORITY_RX_THR140_CONF003,
113         .hw_msg_buffer = user_hi_main_msg_buffer,
114         .semaphore_id = SCISERVER_SEMAPHORE_USER_HI,
115         .user_msg_data = &user_hi_main_msg_data,
116     },
117     /* user_mcu_nav_low_priority */
118     {
119         .irq_num =
120             CSLR_MCU_R5FSS0_CORE0_INTR_MCU_NAVSS0_INTR_ROUTER_0_OUTL_INTR_8,
121         .hw_msg_queue_id = 
122             J721S2_MCU_NAVSS0_SEC_PROXY0_RX_DM_NONSEC_LOW_PRIORITY_RX_THR077_CONF046,
123         .hw_msg_buffer = user_lo_msg_buffer,
124         .semaphore_id = SCISERVER_SEMAPHORE_USER_LO,
125         .user_msg_data = &user_lo_msg_data,
126     },
127     /* user_main_nav_low_priority */
128     {
129         .irq_num =
130             CSLR_MCU_R5FSS0_CORE0_INTR_MCU_NAVSS0_INTR_ROUTER_0_OUTL_INTR_9,
131         .hw_msg_queue_id = 
132             J721S2_NAVSS0_SEC_PROXY_0_RX_DM_NONSEC_LOW_PRIORITY_RX_THR139_CONF004,
133         .hw_msg_buffer = user_lo_main_msg_buffer,
134         .semaphore_id = SCISERVER_SEMAPHORE_USER_LO,
135         .user_msg_data = &user_lo_main_msg_data,
136     },
137 };
139 static const Sciserver_taskData gSciserverTaskList[SCISERVER_TASK_MAX_CNT] = {
140     /* user_hi_msg_task_data */
141     {
142         .task_id = SCISERVER_TASK_USER_HI,
143         .hw_msg_buffer_list = user_hi_msg_buffer_list,
144         .hw_msg_buffer_count = SCISERVER_SECPROXY_INSTANCE_COUNT,
145         .hw_msg_buffer_sz = SCISERVER_HW_QUEUE_SIZE,
146         .semaphore_id = SCISERVER_SEMAPHORE_USER_HI,
147         .state = &user_hi_msg_state,
148         .user_msg_data = user_hi_msg_data_list,
149         .stack = user_hi_task_stack,
150     },
152     /* user_lo_msg_task_data */
153     {
154         .task_id = SCISERVER_TASK_USER_LO,
155         .hw_msg_buffer_list = user_lo_msg_buffer_list,
156         .hw_msg_buffer_count = SCISERVER_SECPROXY_INSTANCE_COUNT,
157         .hw_msg_buffer_sz = SCISERVER_HW_QUEUE_SIZE,
158         .semaphore_id = SCISERVER_SEMAPHORE_USER_LO,
159         .state = &user_lo_msg_state,
160         .user_msg_data = user_lo_msg_data_list,
161         .stack = user_lo_task_stack,
162     },
163 };
165 #endif /* SCISERVER_HWI_DATA_H */