#ifndef __OSPBUFH__ #define __OSPBUFH__ #ifdef __cplusplus extern "C" { #endif #define OSPBUF_SIZE (6*1024*1024UL) //(577*1024*1024UL) /* 512M->1G */ #define MAX_BLOCK_NUM 512 /*256*/ /* 1024->512 */ #define MIN_SIZE_ORDER 6 #define MAX_SIZE_ORDER 12/* 21 */ /* 16->19 64K->512K */ #define MAX_OSPBUF_LEN (1 << MAX_SIZE_ORDER) /*when mem is empty , we should make sure cmd is OK*/ #define SIZE_ORDER_SHELL 10 // origin: 16 #define SHELL_BUF_SIZE 1024 // origin: 1665535 #define SIZE_ORDER_PRINT_LOG SIZE_ORDER_SHELL /*change with SIZE_ORDER_PRINT_LOG*/ #define PRINT_LOG_BUF_SIZE SHELL_BUF_SIZE #define BUF_FOR_MEMORY 0 #define BUF_FOR_MSG 1 typedef struct tag_Osp_BufQ_Tcb { Osp_SoftQue soft_que; uint64_t data[MAX_BLOCK_NUM]; int32_t order; }Osp_BufQ_Tcb; #define OSP_BUFQ_TCBSIZE (sizeof(Osp_BufQ_Tcb)) #define OSP_BUFQ_ENCNT(que) que->soft_que.EnCnt #define OSP_BUFQ_DECNT(que) que->soft_que.DeCnt #define OSP_BUFQ_CUR(que) que->soft_que.CurNum #define OSP_BUFQ_DEP(que) que->soft_que.Dep #define OSP_BUFQ_ORDER(que) que->order #define OSP_BUFQ_QUE(que) que->soft_que typedef struct tag_Osp_Block_Head { uint32_t UserId; /*0x55aa???? */ uint16_t RelaOrder; /*for TCB*/ uint16_t UseType; /*memory or msg */ uint16_t rev[2]; uint32_t MagicOffset; /*for dect write over*/ uint32_t idx; /*idx of this pool*/ uint32_t NormalFlag; /*1: norbuffer 0: Pribuffer*/ uint32_t Rev[2]; }Osp_Block_Head; extern char *OspBufferBase; #define BUFFER_BASE OspBufferBase #define BUFFERQUE_BASE_PRINT_LOG OspBufferqueBasePrintLog #define BUFFERDATA_BASE_PRINT_LOG OspBufferDataBasePrintLog #define BUFFERQUE_BASE_SHELL OspBufferqueBaseShell #define BUFFERDATA_BASE_SHELL OspBufferDataBaseShell #define BUFFERQUE_BASE_NOR OspBufferQueBaseNor #define BUFFERDATA_BASE_NOR OspBufferDataBaseNor #define BUFFER_NORMAL_LEVEL 0 #define BUFFER_SHELL_LEVEL 1 #define BUFFER_PRINTLOG_LEVEL 2 #define VALIDIDMASK 0x55aa0000 #define FREEUSERID 0x0000FFFF #define BUF_MAGIC_NUM (0x12348765) #define OSP_BLOCK_HEAD_SIZE ((uint32_t)(sizeof(Osp_Block_Head))) #define OSP_BUF_MAGICDATA_SIZE ((uint32_t)(sizeof(uint32_t))) extern void *osp_get_buffer(uint32_t size, uint16_t UseType, uint16_t PriLevel); extern OSP_STATUS osp_free_buffer(void *pBuffer); extern void osp_show_buf_count(void); extern OSP_STATUS osp_buf_init(void); #ifdef __cplusplus } #endif #endif /*__OSPBUFH__ */