二级指针的一种使用

二级指针的一种使用

1、代码

/*******************************************************************************
 * Definitions
 ******************************************************************************/
typedef uint32 tLogicalAddr;

typedef struct
{
	tLogicalAddr xBlockStartLogicalAddr; /*block start logical addr*/
	tLogicalAddr xBlockEndLogicalAddr;	 /*block end logical addr*/
}BlockInfo_t;

typedef enum
{
	APP_A_TYPE = 0u,         /*APP A type*/		
	APP_INVLID_TYPE = 0xFFu, /*APP invalid type*/
}tAPPType;

/*application can used space*/
const BlockInfo_t gs_astBlockNumA[] = {
    {0x14000u, 0x80000u},    /*block logical 0*/
}; 

/*logical num*/
const uint32 gs_blockNumA = sizeof(gs_astBlockNumA) / sizeof(gs_astBlockNumA[0u]);

boolean FLASH_HAL_GetFlashConfigInfo(const tAPPType i_appType,
							BlockInfo_t ** o_ppBlockInfo,
							uint32 *o_pItemLen)
{
	boolean result = FALSE;
	
	if(APP_A_TYPE == i_appType)
	{
		*o_ppBlockInfo = (BlockInfo_t *)gs_astBlockNumA;
		*o_pItemLen = gs_blockNumA;

		result = TRUE;
	}
	else
	{
	}


	return result;
}

void TestFunction( uint8* address, uint32 size )
{
	tAPPType s_appType = APP_INVLID_TYPE;
	BlockInfo_t * s_pAppFlashMemoryInfo = NULL_PTR;
	uint32 s_appFlashItem = 0u;
	
	if(TRUE == FLASH_HAL_GetFlashConfigInfo(s_appType, &s_pAppFlashMemoryInfo, &s_appFlashItem))
	{
		if((s_pAppFlashMemoryInfo->xBlockStartLogicalAddr <= (tLogicalAddr)address) && (s_appFlashItem >= size))
		{
			printf("get the data successfully !!!");
		}
	}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值