// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 SmartLogic.
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : mem_section.h
// Author        : xianfeng.du
// Created On    : 2022-06-25
// Last Modified :
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------


#ifndef __MEM_SECTIONS_H__
#define __MEM_SECTIONS_H__

#include "typedef.h"

#define MEM_ALIGNED_4BYTES 4
#define MEM_ALIGNED_64BYTES 64
#define RFM_IM_SECTION __attribute__((aligned(MEM_ALIGNED_4BYTES)))

#define PET_SRAM_BASE_ADDR 0x08700000
#define PET_SRAM_SIZE 0x20000//128KBytes

#define ECS_SRAM_BASE_ADDR 0x07200000
#define ECS_SRAM_SIZE (0x20000 - 0x2000)//128KBytes,reserved 8KBytes for CPRI CSU

#define UCP_MSG_MEM_BASE_ADDR (0xA0000000)
#define UCP_MSG_MEM_SIZE (128*1024*1024)//128MBytes

typedef struct
{
    uint64_t baseAddr;
    uint64_t currAddr;
    uint32_t maxSize;

    char* memSectionName;
} MEM_SECTION_INFO;

void memSectionInit(MEM_SECTION_INFO* memSecInfo, uint64_t baseAddr, uint32_t maxSize, char* memSectionName);
void memSectionReset(MEM_SECTION_INFO* memSecInfo);
void* memSectionAlloc(MEM_SECTION_INFO* memSecInfo, uint32_t allocSize, uint32_t allocAlign, char* varString);
//void memSectionAllocPrint(MEM_SECTION_INFO* memSecInfo, uint32_t allocSize, char* varString);

//MEM_SECTION_INFO* GetEcsSramSection();
MEM_SECTION_INFO* GetPetSramSection();
MEM_SECTION_INFO* GetMsgDdrSection();

#endif
