• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _DUET_RAM_LAYOUT_H_
17 #define _DUET_RAM_LAYOUT_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 typedef enum {
24     ITCM_DTCM_32_192,   // default
25     ITCM_DTCM_96_128,
26     ITCM_DTCM_NUM
27 } Tcm_Config_Type;
28 
29 typedef enum {
30     WIFI_RAM_0,         // default
31     WIFI_RAM_32,
32     WIFI_RAM_64,
33     WIFI_RAM_96,
34     WIFI_RAM_NUM
35 } Wifi_Ram_Config_Type;
36 
37 typedef enum {
38     BT_RAM_0,           // default
39     BT_RAM_16,
40     BT_RAM_32,
41     BT_RAM_NUM
42 } Bt_Ram_Config_Type;
43 
44 typedef struct {
45     uint32_t itcm_addr;
46     uint32_t itcm_size;
47 
48     uint32_t dtcm_addr;
49     uint32_t dtcm_size;
50 
51     uint32_t soc_addr;
52     uint32_t soc_size;
53 
54     uint32_t wifi_addr;
55     uint32_t wifi_size;
56 
57     uint32_t bt_addr;
58     uint32_t bt_size;
59 } Ram_Layout_Type;
60 
61 /**
62  * ram layout init
63  *
64  * @note This function must be called before the using of wifi and bt ram
65  *
66  * @param[in]  tcm_config   The config type of tcm.
67  * @param[in]  wifi_config  The config type of wifi.
68  * @param[in]  bt_config    The config type of bluetooth.
69  *
70  * @return  0 : On success, EIO : If an error occurred with any step
71 */
72 uint32_t duet_ram_layout_init(Tcm_Config_Type tcm_config, Wifi_Ram_Config_Type wifi_config,
73                               Bt_Ram_Config_Type bt_config);
74 
75 /**
76  * Get the current ram layout parameters
77  *
78  * @param[out] ram_layout   The layout parameters of the hole tcm and ram.
79  *
80  * @return  0 : On success, EIO : If an error occurred with any step
81 */
82 uint32_t duet_get_ram_layout(Ram_Layout_Type *ram_layout);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif // _DUET_RAM_LAYOUT_H_
89 
90