本文整理匯總了C++中ADDR_SHIFT函數的典型用法代碼示例。如果您正苦於以下問題:C++ ADDR_SHIFT函數的具體用法?C++ ADDR_SHIFT怎麽用?C++ ADDR_SHIFT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ADDR_SHIFT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: FSMC_NOR_ReadHalfWord
/******************************************************************************
* Function Name : FSMC_NOR_ReadHalfWord
* Description : Reads a half-word from the NOR memory.
* Input : - ReadAddr : NOR memory internal address to read from.
* Output : None
* Return : Half-word read from the NOR memory
*******************************************************************************/
uint16_t FSMC_NOR_ReadHalfWord(uint32_t ReadAddr)
{
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x002AA), 0x0055);
NOR_WRITE((Bank1_NOR2_ADDR + ReadAddr), 0x00F0 );
return (*(__IO uint16_t *)((Bank1_NOR2_ADDR + ReadAddr)));
}
示例2: FSMC_NOR_Reset
/******************************************************************************
* Function Name : FSMC_NOR_Reset
* Description : Returns the NOR memory to Read mode and resets the errors in
* the NOR memory Status Register.
* Input : None
* Output : None
* Return : NOR_SUCCESS
*******************************************************************************/
NOR_Status FSMC_NOR_Reset(void)
{
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x002AA), 0x0055);
NOR_WRITE(Bank1_NOR2_ADDR, 0x00F0);
return (NOR_SUCCESS);
}
示例3: NOR_WriteHalfWord
/**
* @brief Writes a half-word to the NOR memory.
* This function returns the NOR memory status after block erase operation.
* @param uwWriteAddress : NOR memory internal address to write to.
* uhData : Data to write.
* @retval NOR_Status: The returned value can be: NOR_SUCCESS, NOR_ERROR
* or NOR_TIMEOUT.
*/
NOR_Status NOR_WriteHalfWord(uint32_t uwWriteAddress, uint16_t uhData)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00A0);
NOR_WRITE((NOR_BANK_ADDR + uwWriteAddress), uhData);
return (NOR_GetStatus(PROGRAM_TIMEOUT));
}
示例4: FSMC_NOR_WriteHalfWord
/******************************************************************************
* Function Name : FSMC_NOR_WriteHalfWord
* Description : Writes a half-word to the NOR memory.
* Input : - WriteAddr : NOR memory internal address to write to.
* - Data : Data to write.
* Output : None
* Return : NOR_Status:The returned value can be: NOR_SUCCESS, NOR_ERROR
* or NOR_TIMEOUT
*******************************************************************************/
NOR_Status FSMC_NOR_WriteHalfWord(uint32_t WriteAddr, uint16_t Data)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00A0);
NOR_WRITE((Bank1_NOR2_ADDR + WriteAddr), Data);
return (FSMC_NOR_GetStatus(Program_Timeout));
}
示例5: NOR_ReadHalfWord
/**
* @brief Reads a half-word from the NOR memory.
* @param uwReadAddress : NOR memory internal address to read from.
* @retval Half-word read from the NOR memory.
*/
uint16_t NOR_ReadHalfWord(uint32_t uwReadAddress)
{
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x002AA), 0x0055);
/* Send read data command */
NOR_WRITE((NOR_BANK_ADDR + uwReadAddress), 0x00F0 );
/* Return the data read */
return (*(__IO uint16_t *)((NOR_BANK_ADDR + uwReadAddress)));
}
示例6: NOR_Reset
/**
* @brief Returns the NOR memory to Read mode and resets the errors in the NOR
* memory Status Register.
* @param None
* @retval NOR_SUCCESS
*/
NOR_Status NOR_Reset(void)
{
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x002AA), 0x0055);
/* Send read mode command */
NOR_WRITE(NOR_BANK_ADDR, 0x00F0);
/* Return status success operation */
return (NOR_SUCCESS);
}
示例7: NOR_EraseSector
/*
*********************************************************************************************************
* 函 數 名: NOR_EraseSector
* 功能說明: 擦除NOR Flash指定的扇區
* 形 參: 扇區地址
* 返 回 值: NOR_SUCCESS, NOR_ERROR, NOR_TIMEOUT
*********************************************************************************************************
*/
uint8_t NOR_EraseSector(uint32_t _uiBlockAddr)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x0080);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE((NOR_FLASH_ADDR + _uiBlockAddr), 0x30);
return (NOR_GetStatus(BlockErase_Timeout));
}
示例8: NOR_EraseBlock
/**
* @brief Performs a block erase operation giving its address.
* This function returns the NOR memory status after block erase operation.
* @param uwBlockAddress: Address of the block to erase.
* @retval NOR_Status: The returned value can be: NOR_SUCCESS, NOR_ERROR
* or NOR_TIMEOUT.
*/
NOR_Status NOR_EraseBlock(uint32_t uwBlockAddress)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x0080);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE((NOR_BANK_ADDR + uwBlockAddress), 0x30);
return (NOR_GetStatus(BLOCKERASE_TIMEOUT));
}
示例9: FSMC_NOR_EraseBlock
/*******************************************************************************
* Function Name : FSMC_NOR_EraseBlock
* Description : Erases the specified Nor memory block.
* Input : - BlockAddr: address of the block to erase.
* Output : None
* Return : NOR_Status:The returned value can be: NOR_SUCCESS, NOR_ERROR
* or NOR_TIMEOUT
*******************************************************************************/
NOR_Status FSMC_NOR_EraseBlock(uint32_t BlockAddr)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x0080);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE((Bank1_NOR2_ADDR + BlockAddr), 0x30);
return (FSMC_NOR_GetStatus(BlockErase_Timeout));
}
示例10: FSMC_NOR_ReadBuffer
/*******************************************************************************
* Function Name : FSMC_NOR_ReadBuffer
* Description : Reads a block of data from the FSMC NOR memory.
* Input : - pBuffer : pointer to the buffer that receives the data read
* from the NOR memory.
* - ReadAddr : NOR memory internal address to read from.
* - NumHalfwordToRead : number of Half word to read.
* Output : None
* Return : None
*******************************************************************************/
void FSMC_NOR_ReadBuffer(uint16_t* pBuffer, uint32_t ReadAddr, uint32_t NumHalfwordToRead)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE((Bank1_NOR2_ADDR + ReadAddr), 0x00F0);
for(; NumHalfwordToRead != 0x00; NumHalfwordToRead--) /* while there is data to read */
{
/* Read a Halfword from the NOR */
*pBuffer++ = *(__IO uint16_t *)((Bank1_NOR2_ADDR + ReadAddr));
ReadAddr = ReadAddr + 2;
}
}
示例11: NOR_ReadBuffer
/**
* @brief Reads a block of data from the FMC NOR memory.
* @param pBuffer: pointer to the buffer that receives the data read from the
* NOR memory.
* @param uwReadAddress: NOR memory internal address to read from.
* @param uwBufferSize : number of Half word to read.
* @retval None
*/
void NOR_ReadBuffer(uint16_t* pBuffer, uint32_t uwReadAddress, uint32_t uwBufferSize)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE((NOR_BANK_ADDR + uwReadAddress), 0x00F0);
for(; uwBufferSize != 0x00; uwBufferSize--) /* while there is data to read */
{
/* Read a Halfword from the NOR */
*pBuffer++ = *(__IO uint16_t *)((NOR_BANK_ADDR + uwReadAddress));
uwReadAddress = uwReadAddress + 2;
}
}
示例12: NOR_ProgramBuffer
/**
* @brief Writes a half-word buffer to the FMC NOR memory. This function
* must be used only with S29GL128P NOR memory.
* @param pBuffer : pointer to buffer.
* uwWriteAddress : NOR memory internal address from which the data
* will be written.
* uwBufferSize : number of Half words to write. The maximum allowed
* value is 32 Half words (64 bytes).
* @retval NOR_Status: The returned value can be: NOR_SUCCESS, NOR_ERROR
* or NOR_TIMEOUT.
*/
NOR_Status NOR_ProgramBuffer(uint16_t* pBuffer, uint32_t uwWriteAddress, uint32_t uwBufferSize)
{
uint32_t lastloadedaddress = 0;
uint32_t currentaddress = 0;
uint32_t endaddress = 0;
/* Initialize variables */
currentaddress = uwWriteAddress;
endaddress = uwWriteAddress + uwBufferSize - 1;
lastloadedaddress = uwWriteAddress;
/* Issue unlock command sequence */
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
/* Write Buffer Load Command */
NOR_WRITE(ADDR_SHIFT(uwWriteAddress), 0x0025);
NOR_WRITE(ADDR_SHIFT(uwWriteAddress), (uwBufferSize - 1));
/* Load Data into NOR Buffer */
while(currentaddress <= endaddress)
{
/* Store last loaded address & data value (for polling) */
lastloadedaddress = currentaddress;
NOR_WRITE(ADDR_SHIFT(currentaddress), *pBuffer++);
currentaddress += 1;
}
NOR_WRITE(ADDR_SHIFT(lastloadedaddress), 0x29);
return(NOR_GetStatus(PROGRAM_TIMEOUT));
}
示例13: FSMC_NOR_ProgramBuffer
/*******************************************************************************
* Function Name : FSMC_NOR_ProgramBuffer
* Description : Writes a half-word buffer to the FSMC NOR memory. This function
* must be used only with S29GL128P NOR memory.
* Input : - pBuffer : pointer to buffer.
* - WriteAddr: NOR memory internal address from which the data
* will be written.
* - NumHalfwordToWrite: number of Half words to write.
* The maximum allowed value is 32 Half words (64 bytes).
* Output : None
* Return : NOR_Status:The returned value can be: NOR_SUCCESS, NOR_ERROR
* or NOR_TIMEOUT
*******************************************************************************/
NOR_Status FSMC_NOR_ProgramBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
{
uint32_t lastloadedaddress = 0x00;
uint32_t currentaddress = 0x00;
uint32_t endaddress = 0x00;
/* Initialize variables */
currentaddress = WriteAddr;
endaddress = WriteAddr + NumHalfwordToWrite - 1;
lastloadedaddress = WriteAddr;
/* Issue unlock command sequence */
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
/* Write Write Buffer Load Command */
NOR_WRITE(ADDR_SHIFT(WriteAddr), 0x0025);
NOR_WRITE(ADDR_SHIFT(WriteAddr), (NumHalfwordToWrite - 1));
/* Load Data into NOR Buffer */
while(currentaddress <= endaddress)
{
/* Store last loaded address & data value (for polling) */
lastloadedaddress = currentaddress;
NOR_WRITE(ADDR_SHIFT(currentaddress), *pBuffer++);
currentaddress += 1;
}
NOR_WRITE(ADDR_SHIFT(lastloadedaddress), 0x29);
return(FSMC_NOR_GetStatus(Program_Timeout));
}
示例14: FSMC_NOR_ReadID
/******************************************************************************
* Function Name : FSMC_NOR_ReadID
* Description : Reads NOR memory's Manufacturer and Device Code.
* Input : - NOR_ID: pointer to a NOR_IDTypeDef structure which will hold
* the Manufacturer and Device Code.
* Output : None
* Return : None
*******************************************************************************/
void FSMC_NOR_ReadID(NOR_IDTypeDef* NOR_ID)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x0090);
NOR_ID->Manufacturer_Code = *(__IO uint16_t *) ADDR_SHIFT(0x0000);
NOR_ID->Device_Code1 = *(__IO uint16_t *) ADDR_SHIFT(0x0001);
NOR_ID->Device_Code2 = *(__IO uint16_t *) ADDR_SHIFT(0x000E);
NOR_ID->Device_Code3 = *(__IO uint16_t *) ADDR_SHIFT(0x000F);
}
示例15: NOR_StartEraseChip
/*
*********************************************************************************************************
* 函 數 名: NOR_StartEraseChip
* 功能說明: 開始擦除NOR Flash整個芯片, 不等待結束
* 形 參: 無
* 返 回 值: 0表示成功
*********************************************************************************************************
*/
void NOR_StartEraseChip(void)
{
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x0080);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
NOR_WRITE(ADDR_SHIFT(0x0555), 0x0010);
NOR_GetStatus(1000);
}