util.h

来自「SAMSUNG 5009的源代码」· C头文件 代码 · 共 79 行

H
79
字号
/******************************************************************************
 *   Filename    : Utilities.h
 *   Start       : 2002. 11. 11
 *   By          : Taejin Kwon
 *   Contact     : eric.kwon@samsung.com
 *   Description : 
 ******************************************************************************
 */
#ifndef	_UTIL_H_
#define _UTIL_H_

#define BM_SUCCESS 			0x00000001
#define BM_FAIL 			0x00000000

#define BM_WAIT_RB_AVAIL	 	0x00000001
#define BM_WAIT_WB_AVAIL		0x00000002

#define INVALID_BUFFER_INDEX	0x0FFFFFFF

typedef struct {
	/* 
		common feature for Buffer Manager 
	*/
	UCHAR		*p_StartAddress;	/* start address of first BE (word aligned) */
	UCHAR		*p_StopAddress;		/* start address of first BE (word aligned) */
	
	UCHAR		*p_Info;		/* start address of first BE (word aligned) */
} BufferElement_t;

typedef VOID (*BM_CALLBACK)(VOID);

typedef struct {
	/* 
		common feature for Buffer Manager 
	*/
	UCHAR		*p_StartAddress;	/* start address of first BE (word aligned) */
	UCHAR		*p_StopAddress;	/* start address of first BE (word aligned) */

	/* sz_TotalBuffer must be (sz_Chunk*n_Chunk)  */
	UINT		sz_TotalBuffer;		/* size of Total buffer */
	UINT		sz_Chunk;			/* size of one chunk */	
	UINT		n_Chunk;		/* number of BufferElement */

	UCHAR	*p_Info;
	UINT	sz_Info;


	/* 
		current status of Buffer Manager 
	*/
	UINT	status;
	
	UINT		cR;		/* index for current reading chunk */
	UINT		cW;		/* index for current writing chunk */	

	UINT		sF;		/* index for starting chunk of FreeList*/	
	UINT		sV;		/* index for starting chunk of ValidList*/
	
	UINT		nF;		/* count for FreeChunks */
	UINT		nV;		/* count for ValidChunks */

	BM_CALLBACK ReadBufferAvailCallback;
	BM_CALLBACK WriteBufferAvailCallback;
	
} BufferManager_t;

VOID InitBufferManager(BufferManager_t *bm, UCHAR *p, UINT szChunk, UINT n, UCHAR *pInfo, UINT szInfo);
UINT PutSReadBuffer(BufferManager_t *bm);
	
UINT GetReadBuffer(BufferManager_t *bm, BufferElement_t *be);
UINT PutReadBuffer(BufferManager_t *bm);
UINT GetWriteBuffer(BufferManager_t *bm, BufferElement_t *be);
UINT PutWriteBuffer(BufferManager_t *bm);
VOID ResetBufferState(BufferManager_t *bm);
VOID SetReadAvailCallback(BufferManager_t *bm,  BM_CALLBACK func);
VOID SetWriteAvailCallback(BufferManager_t *bm,  BM_CALLBACK func);

#endif	/* _UTIL_H_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?