/*******************************************************************************
 * @file    rbuf_mem.h
 * @author  MEMS Application Team
 * @version V1.0
 * @date    2020-08-12
 * @brief   memory layout
*******************************************************************************/

#ifndef _RBUF_MEM_H
#define _RBUF_MEM_H

/******************************************************************************/
//includes
/******************************************************************************/
#include <rbuf/rbuf_conf.h>
#include <rbuf/rbuf_core.h>
#include <rbuf/rbuf_pool.h>

/******************************************************************************/
//configs
/******************************************************************************/

/* Core Name */
typedef enum core_e {
	CPU = 0,
	DSP,
	BT,
	SC,
	CORE_MAX
} core_t;

/******************************************************************************/
//Memory Layout
/******************************************************************************/

// Rbuf Msg
#define RB_ST_MSG							(INTER_RAM_ADDR)
#define RB_SZ_MSG							(CORE_MAX * CORE_MAX * 2)

// Rbuf Pool
#define RB_ST_POOL						(RB_ST_MSG + RB_SZ_MSG)
#define RB_SZ_POOL						(INTER_RAM_SIZE - RB_SZ_MSG)

/******************************************************************************/
//macros
/******************************************************************************/

/* RBUF Get */
#define RB_GET_MSG(f,t)				((unsigned short*)RB_ST_MSG)[f*CORE_MAX+t]
#define RB_GET_POOL						((rbuf_pool_t*)RB_ST_POOL)

/******************************************************************************/
//functions
/******************************************************************************/

#endif  /* _RBUF_MEM_H */