yb_arm/osp/inc/ospHeap.h
2023-07-18 19:28:16 +08:00

58 lines
2.3 KiB
C

#ifndef __OSPHEAP__
#define __OSPHEAP__
#include "typedef.h"
#define ECS_SM_DM_BASE_PHY_ADDR 0x007200000UL
#define PET_SM_DM_BASE_PHY_ADDR 0x008700000UL
#define APE_DM_BASE_PHY_ADDR 0x009400000UL //APCx(x:0-3):0x009400000+x*0x200000,2M per APC
#define SHARE_MEM_BASE_PHY_ADDR 0x009D00000UL
#define APE_PHY_BASE_PHY_ADDR 0x010000000UL
#define APE_TEXT_BASE_PHY_ADDR 0x09C000000UL
#define ARM_APE_MSG_BASE_PHY_ADDR 0x0A0000000UL
#define APE_LOG_BASE_PHY_ADDR 0x0A8000000UL
#define RESERVED_BASE_PHY_ADDR 0x100000000UL
#define ARM_STACK_BASE_PHY_ADDR 0x100000000UL
#define LEN_OF_ECS_SM_DM 0x000060000UL //sm(0x20000) + dm(0x40000)
#define LEN_OF_PET_SM_DM 0x000060000UL //sm(0x20000) + dm(0x40000)
#define LEN_OF_APE_DM 0x000800000UL
#define LEN_OF_SHARE_MEM 0x000800000UL
#define LEN_OF_APE_PHY 0x08C000000UL
#define LEN_OF_APE_TEXT 0x004000000UL
#define LEN_OF_ARM_APE_MSG 0x008000000UL
#define LEN_OF_APE_LOG 0x010000000UL
#define LEN_OF_ARM_STACK 0x100000000UL
#define OSP_DISPLAY_MAX_LEN 0x400
#define OSP_DISPLAY_PAGE_LEN 0x1000
typedef enum
{
ECS_SM = 0, //actual ECS_SM_DM 384 total SM:128KB:0x007200000UL,DM:256KB:0x007220000UL
PET_SM, //actual PET_SM_DM 384 total SM:128KB:0x008700000UL,DM:256KB:0x008720000UL
APE_DM,
SHARE_MEM,
APE_PHY,
APE_TEXT,
ARM_APE_MSG,
APE_LOG,
ARM_STACK,
MEM_RESERVE
}module_type_e;
void *get_static_mem(module_type_e module, uint64_t *len);
void *osp_heap_mem_init(char *pbuf, uint64_t size,void *head_of_static_mem,module_type_e module);
int8_t *osp_alloc_heap_mem(void *heap, uint32_t size);
int32_t osp_free_heap_mem(void *heap, char *pbuf);
int32_t osp_show_heap_mem(void *heap);
int32_t osp_virt_to_phy(module_type_e module, uint64_t virt_addr, uint64_t *phy_addr);
int32_t osp_phy_to_virt(module_type_e module, uint64_t phy_addr, uint64_t *virt_addr);
void osp_flush_dcache_area(void * volatile addr, uint64_t volatile len);
void osp_clean_dcache_area(void * volatile addr, uint64_t volatile len);
int32_t osp_invalid_dcache_area(module_type_e module, uint64_t virt_addr, uint64_t len);
int32_t osp_display_phy_mem(uint64_t phy_addr, uint32_t len);
#endif