HPM SDK
HPMicro Software Development Kit
hpm_misc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_MISC_H
9 #define HPM_MISC_H
10 
11 #define ILM_LOCAL_BASE (0x0U)
12 #define ILM_SIZE_IN_BYTE (0x40000U)
13 #define DLM_LOCAL_BASE (0x80000U)
14 #define DLM_SIZE_IN_BYTE (0x40000U)
15 #define CORE0_ILM_SYSTEM_BASE (0x1040000U)
16 #define CORE0_DLM_SYSTEM_BASE (0x1060000U)
17 #define CORE1_ILM_SYSTEM_BASE (0x1180000U)
18 #define CORE1_DLM_SYSTEM_BASE (0x11C0000U)
19 
20 #define ADDRESS_IN_ILM(address) \
21  ((ILM_LOCAL_BASE) <= (address)) && \
22  ((ILM_LOCAL_BASE + ILM_SIZE_IN_BYTE) > (address))
23 #define ADDRESS_IN_DLM(address) \
24  ((DLM_LOCAL_BASE) <= (address)) && \
25  ((DLM_LOCAL_BASE + DLM_SIZE_IN_BYTE) > (address))
26 #define ADDRESS_IN_CORE0_DLM_SYSTEM(address) \
27  ((CORE0_DLM_SYSTEM_BASE) <= (address)) && \
28  ((CORE0_DLM_SYSTEM_BASE + DLM_SIZE_IN_BYTE) > (address))
29 
30 #define DLM_TO_SYSTEM(address) \
31  (CORE0_DLM_SYSTEM_BASE + (address) - (DLM_LOCAL_BASE))
32 #define ILM_TO_SYSTEM(address) \
33  (CORE0_ILM_SYSTEM_BASE + (address) - (ILM_LOCAL_BASE))
34 #define SYSTEM_TO_DLM(address) \
35  ((address) - CORE0_DLM_SYSTEM_BASE + (DLM_LOCAL_BASE))
36 
37 #define HPM_CORE0 (0U)
38 #define HPM_CORE1 (1U)
39 
40 /* map core local memory(DLM/ILM) to system address */
41 static inline uint32_t core_local_mem_to_sys_address(uint8_t core_id, uint32_t addr)
42 {
43  (void) core_id;
44  return addr;
45 }
46 
47 /* map system address to core local memory(DLM/ILM) */
48 static inline uint32_t sys_address_to_core_local_mem(uint8_t core_id, uint32_t addr)
49 {
50  (void) core_id;
51  return addr;
52 }
53 #endif /* HPM_MISC_H */
static uint32_t sys_address_to_core_local_mem(uint8_t core_id, uint32_t addr)
Definition: hpm_misc.h:48
static uint32_t core_local_mem_to_sys_address(uint8_t core_id, uint32_t addr)
Definition: hpm_misc.h:41