本文整理匯總了C++中Fill_Buffer函數的典型用法代碼示例。如果您正苦於以下問題:C++ Fill_Buffer函數的具體用法?C++ Fill_Buffer怎麽用?C++ Fill_Buffer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Fill_Buffer函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: UsartDMA_Send
void UsartDMA_Send(INT8U *data)
{
if(usart_reset_key < 5)
{
Fill_Buffer(TxBuffer_dma_save[tx_count], 24, data);
tx_count++;
if (tx_count > 9) tx_count = 0;
if(data_complete)
{
Fill_Buffer(TxBuffer_dma, 24, TxBuffer_dma_save[tx_now_send]);
data_complete = FALSE;
DMA_Cmd(USARTx_TX_DMA_STREAM, ENABLE);
}
}
}
示例2: main
int main(void)
{
uint8_t i;
printf("SBN1 test 5 \r\n");
// lock 0xAB 01000
Fill_Buffer(0x0A, 0x53, 0x42, 0x4E, 0x31, 0x00, 0x03, 0xB4, 0x07, 0xAB, 0x02);
SBN1_Handle_Reveived();
// lock 0xAB 00111
Fill_Buffer(0x0A, 0x53, 0x42, 0x4E, 0x31, 0x01, 0x03, 0xCE, 0x07, 0xAB, 0x1C);
SBN1_Handle_Reveived();
return 0;
}
示例3: SD_SingleBlockTest
/**
* @brief Tests the SD card Single Blocks operations.
* @param None
* @retval None
*/
static void SD_SingleBlockTest(void)
{
SD_Error status;
/*---------------Block Read/Write----------------*/
/* Fill the buffer to send */
Fill_Buffer(aBuffer_Block_Tx, BLOCK_SIZE, 0x320F);
/* Write Block of 512 bytes on address 0 */
status = SD_WriteBlock(aBuffer_Block_Tx, 0x00, BLOCK_SIZE);
/* check if the Transfer finished */
status = SD_WaitWriteOperation();
while(SD_GetStatus() != SD_TRANSFER_OK);
if(status == SD_OK)
{
/* Read Block of 512 bytes on address 0 */
status = SD_ReadBlock(aBuffer_Block_Rx, 0x00, BLOCK_SIZE);
/* check if the Transfer finished */
status = SD_WaitReadOperation();
while(SD_GetStatus() != SD_TRANSFER_OK);
}
/* Check the correctness of written data */
if(status == SD_OK)
{
TransferStatus1 = Buffercmp(aBuffer_Block_Tx, aBuffer_Block_Rx,BLOCK_SIZE);
}
if(TransferStatus1 == PASSED) printf("SD single block test passed!\n\r");
}
示例4: SD_MultiBlockTest
/**
* @brief Tests the SD card Multiple Blocks operations.
* @param None
* @retval None
*/
static void SD_MultiBlockTest(void)
{
SD_Error status;
/* Fill the buffer to send */
Fill_Buffer(aBuffer_MultiBlock_Tx, MULTI_BUFFER_SIZE, 0x0);
/* Write Multiple Block of many bytes on address 0 */
status = SD_WriteMultiBlocksFIXED(aBuffer_MultiBlock_Tx, 0, BLOCK_SIZE, NUMBER_OF_BLOCKS);
/* check if the Transfer finished */
status = SD_WaitWriteOperation();
while(SD_GetStatus() != SD_TRANSFER_OK);
if(status == SD_OK)
{
/* Read Block of many bytes from address 0 */
status = SD_ReadMultiBlocksFIXED(aBuffer_MultiBlock_Rx, 0, BLOCK_SIZE, NUMBER_OF_BLOCKS);
/* check if the Transfer finished */
status = SD_WaitReadOperation();
while(SD_GetStatus() != SD_TRANSFER_OK);
}
/* Check the correctness of written data */
if(status == SD_OK)
{
TransferStatus2 = Buffercmp(aBuffer_MultiBlock_Tx, aBuffer_MultiBlock_Rx,MULTI_BUFFER_SIZE);
}
if(TransferStatus2 == PASSED) printf("SD Multiple block test passed!\n\r");
}
示例5: Sram_thread_entry
void Sram_thread_entry(void* parameter)
{
rt_tick_t t1,t2;
SRAM_Init();
Fill_Buffer(aTxBuffer, BUFFER_SIZE, 0xA244250F);
//DMA_Config();
// while(flag)
// {
// rt_thread_delay(1);
// }
rt_sem_take(&rt_sram_sem, RT_WAITING_FOREVER);
while(flag1)
{
int fd;
//int i=1024;
fd = open("/ud/text.txt", O_WRONLY | O_CREAT,0);
if (fd >= 0)
{
t1 = rt_tick_get();
// while(i>0)
// {
write(fd, RAM_Buffer, sizeof(RAM_Buffer));
// i--;
// }
t2 = rt_tick_get();
rt_kprintf("%d\n\r",t2-t1);
close(fd);
}
rt_thread_delay(100);
//SRAM_ReadBuffer(aTxBuffer,0,BUFFER_SIZE);
}
while(1);
//Fill_Buffer(aTxBuffer, BUFFER_SIZE, 0xA244250F);
}
示例6: SDRAM_demo
/**
* @brief SDRAM Demo
* @param None
* @retval None
*/
void SDRAM_demo (void)
{
SDRAM_SetHint();
/* SDRAM device configuration */
if(BSP_SDRAM_Init() != SDRAM_OK)
{
BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM Initialization : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SDRAM Initialization : OK.", LEFT_MODE);
}
/* Fill the buffer to write */
Fill_Buffer(sdram_aTxBuffer, SDRAM_BUFFER_SIZE, 0xA244250F);
/* Write data to the SDRAM memory */
if(BSP_SDRAM_WriteData(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR_OFFSET, sdram_aTxBuffer, SDRAM_BUFFER_SIZE) != SDRAM_OK)
{
BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : OK.", LEFT_MODE);
}
/* Read back data from the SDRAM memory */
if(BSP_SDRAM_ReadData(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR_OFFSET, sdram_aRxBuffer, SDRAM_BUFFER_SIZE) != SDRAM_OK)
{
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : OK.", LEFT_MODE);
}
if(Buffercmp(sdram_aTxBuffer, sdram_aRxBuffer, SDRAM_BUFFER_SIZE) > 0)
{
BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM COMPARE : FAILED.", LEFT_MODE);
BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
}
else
{
BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test : OK.", LEFT_MODE);
}
while (1)
{
if(CheckForUserInput() > 0)
{
BSP_SDRAM_DeInit();
return;
}
}
}
示例7: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/
startup_stm32f429_439xx.s/startup_stm32f401xx.s) before to branch to
application main. To reconfigure the default setting of SystemInit()
function, refer to system_stm32f4xx.c file
*/
/* Initialize LEDs on STM324x9I-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Configure the FMC interface : SDRAM */
FMC_Config();
/* Fill the buffer to write */
Fill_Buffer(aTxBuffer, BUFFER_SIZE, 0x250F);
/* Write data to the SDRAM memory */
for (uwIndex = 0; uwIndex < BUFFER_SIZE; uwIndex++)
{
*(__IO uint32_t*) (SDRAM_BANK_ADDR + WRITE_READ_ADDR + 4*uwIndex) = aTxBuffer[uwIndex];
}
/* Read back data from the SDRAM memory */
for (uwIndex = 0; uwIndex < BUFFER_SIZE; uwIndex++)
{
aRxBuffer[uwIndex] = *(__IO uint32_t*) (SDRAM_BANK_ADDR + WRITE_READ_ADDR + 4*uwIndex);
}
/* Check the SDRAM memory content correctness */
for (uwIndex = 0; (uwIndex < BUFFER_SIZE) && (uwWriteReadStatus == 0); uwIndex++)
{
if (aRxBuffer[uwIndex] != aTxBuffer[uwIndex])
{
uwWriteReadStatus++;
}
}
if (uwWriteReadStatus)
{
/* KO */
/* Turn on LD2 */
STM_EVAL_LEDOn(LED2);
}
else
{
/* OK */
/* Turn on LD1 */
STM_EVAL_LEDOn(LED1);
}
while (1)
{
}
}
示例8: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/* System Clocks Configuration */
RCC_Configuration();
/* Initialize Leds mounted on STM3210X-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Write/read to/from FSMC SRAM memory *************************************/
/* Enable the FSMC Clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
/* Configure FSMC Bank1 NOR/SRAM2 */
FSMC_NOR_Init();
/* Read NOR memory ID */
FSMC_NOR_ReadID(&NOR_ID);
FSMC_NOR_ReturnToReadMode();
/* Erase the NOR memory block to write on */
FSMC_NOR_EraseBlock(WRITE_READ_ADDR);
/* Write data to FSMC NOR memory */
/* Fill the buffer to send */
Fill_Buffer(TxBuffer, BUFFER_SIZE, 0x3210);
FSMC_NOR_WriteBuffer(TxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read data from FSMC NOR memory */
FSMC_NOR_ReadBuffer(RxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read back NOR memory and check content correctness */
for (Index = 0x00; (Index < BUFFER_SIZE) && (WriteReadStatus == 0); Index++)
{
if (RxBuffer[Index] != TxBuffer[Index])
{
WriteReadStatus = Index + 1;
}
}
if (WriteReadStatus == 0)
{
/* OK */
/* Turn on LED1 */
STM_EVAL_LEDOn(LED1);
}
else
{
/* KO */
/* Turn on LED2 */
STM_EVAL_LEDOn(LED2);
}
while (1)
{
}
}
示例9: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/* Configure the MPU attributes as Write Through */
MPU_Config();
/* Enable the CPU Cache */
CPU_CACHE_Enable();
/* STM32F7xx HAL library initialization:
- Configure the Flash ART accelerator on ITCM interface
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure LED1 and LED3 */
BSP_LED_Init(LED1);
BSP_LED_Init(LED3);
/* Configure the system clock to 200 MHz */
/* This function will be executed from SDRAM */
SystemClock_Config();
/*##-1- Fill the buffer in the SDRAM device ##########################################*/
Fill_Buffer(aTable, 1024, 0);
/*##-2- Read address of the buffer and stack pointer address ########################*/
uwTabAddr = (uint32_t)aTable; /* should be above 0x60000000 */
/* Get main stack pointer value */
MSPValue = __get_MSP(); /* should be above 0x60000000 */
/*##-3- Activate LEDs pending on read values ########################################*/
if ((uwTabAddr >= SDRAM_ADDRESS) && (MSPValue >= SDRAM_ADDRESS))
{
BSP_LED_On(LED1);
}
else
{ /* Toggle LED3 in an infinite loop */
while (1)
{
BSP_LED_Toggle(LED3);
/* Insert delay 100 ms */
HAL_Delay(100);
}
}
/* Infinite loop */
while (1)
{
}
}
示例10: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
/* Initialize Leds mounted on STM3210X-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Write/read to/from FSMC SRAM memory *************************************/
/* Enable the FSMC Clock */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
/* Configure FSMC Bank1 NOR/SRAM3 */
SRAM_Init();
/* Write data to FSMC SRAM memory */
/* Fill the buffer to send */
Fill_Buffer(TxBuffer, BUFFER_SIZE, 0x3212);
SRAM_WriteBuffer(TxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read data from FSMC SRAM memory */
SRAM_ReadBuffer(RxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read back SRAM memory and check content correctness */
for (Index = 0x00; (Index < BUFFER_SIZE) && (WriteReadStatus == 0); Index++)
{
if (RxBuffer[Index] != TxBuffer[Index])
{
WriteReadStatus = Index + 1;
}
}
if (WriteReadStatus == 0)
{
/* OK */
/* Turn on LED1 */
STM_EVAL_LEDOn(LED1);
}
else
{
/* KO */
/* Turn on LED2 */
STM_EVAL_LEDOn(LED2);
}
while (1)
{
}
}
示例11: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40xx.s/startup_stm32f427x.s) before to branch to
application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f4xx.c file
*/
/* Initialize LEDs on EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Initialize the SRAM memory */
SRAM_Init();
/* Fill the buffer to send */
Fill_Buffer(aTxBuffer, BUFFER_SIZE, 0x250F);
/* Write data to the SRAM memory */
SRAM_WriteBuffer(aTxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Read back data from the SRAM memory */
SRAM_ReadBuffer(aRxBuffer, WRITE_READ_ADDR, BUFFER_SIZE);
/* Check the SRAM memory content correctness */
for (uwIndex = 0; (uwIndex < BUFFER_SIZE) && (uwWriteReadStatus_SRAM == 0); uwIndex++)
{
if (aRxBuffer[uwIndex] != aTxBuffer[uwIndex])
{
uwWriteReadStatus_SRAM++;
}
}
if (uwWriteReadStatus_SRAM)
{
/* KO */
/* Turn on LD2 */
STM_EVAL_LEDOn(LED2);
}
else
{
/* OK */
/* Turn on LD1 */
STM_EVAL_LEDOn(LED1);
}
while (1)
{
}
}
示例12: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f0xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f0xx.c file
*/
/* Initialize Leds mounted on STM320518-EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
/* Initializes the SD/SPI communication */
Status = SD_Init();
/* If SD is responding */
if (Status == SD_RESPONSE_NO_ERROR)
{
/* Fill the buffer to send */
Fill_Buffer(Buffer_Block_Tx, BUFFERSIZE, 0x0);
/* Write block of 512 bytes on address 0 */
Status = SD_WriteBlock(Buffer_Block_Tx, 0, BUFFERSIZE);
/* Read block of 512 bytes from address 0 */
Status = SD_ReadBlock(Buffer_Block_Rx, 0, BUFFERSIZE);
/* Check the corectness of written dada */
TransferStatus = Buffercmp(Buffer_Block_Tx, Buffer_Block_Rx, BUFFERSIZE);
if (TransferStatus == PASSED)
{
/* OK: Turn on LD1 */
STM_EVAL_LEDOn(LED1);
}
else
{
/* Error: Turn on LD2 */
STM_EVAL_LEDOn(LED2);
}
}
else
{
/* Error: Turn on LD2 */
STM_EVAL_LEDOn(LED2);
}
while (1)
{
}
}
示例13: SD_SingleBlockTest
/**
* @brief Tests the SD card Single Blocks operations.
* @param None
* @retval None
*/
void SD_SingleBlockTest(void)
{
TestStatus TransferStatus1 = FAILED;
/* Fill the buffer to send */
Fill_Buffer(Buffer_Block_Tx, BLOCK_SIZE, 0x320F);
/* Write block of 512 bytes on address 0 */
Status = SDC_WriteBlock(Buffer_Block_Tx, 0x00, BLOCK_SIZE);
/* Check if the Transfer is finished */
Status = SDC_WaitWriteOperation();
while(SDC_GetStatus() != SD_TRANSFER_OK);
if (Status == SD_OK)
{
/* Read block of 512 bytes from address 0 */
Status = SDC_ReadBlock(Buffer_Block_Rx, 0x00, BLOCK_SIZE);
/* Check if the Transfer is finished */
Status = SDC_WaitReadOperation();
while(SDC_GetStatus() != SD_TRANSFER_OK);
}
else
{
printf("SD_SingleBlockTest:SDC_WriteBlock failed with %d\n",Status);
}
/* Check the correctness of written data */
if (Status == SD_OK)
{
TransferStatus1 = Buffercmp(Buffer_Block_Tx, Buffer_Block_Rx, \
BLOCK_SIZE);
if(TransferStatus1 == PASSED)
{
printf("SD_SingleBlockTest() passed\n");
}
else
{
printf("SD_SingleBlockTest():Buffercmp failed\n");
}
}
else
{
printf("SD_SingleBlockTest:SDC_ReadBlock failed with %d\n",Status);
}
}
示例14: SD_MultiBlockTest
/**
* @brief Tests the SD card Multiple Blocks operations.
* @param None
* @retval None
*/
void SD_MultiBlockTest(void)
{
TestStatus TransferStatus2 = FAILED;
/* Fill the buffer to send */
Fill_Buffer(Buffer_MultiBlock_Tx, MULTI_BUFFER_SIZE, 0x0);
/* Write multiple block of many bytes on address 0 */
Status = SDC_WriteMultiBlocks(Buffer_MultiBlock_Tx, 0x00, \
BLOCK_SIZE, NUMBER_OF_BLOCKS);
/* Check if the Transfer is finished */
Status = SDC_WaitWriteOperation();
while(SDC_GetStatus() != SD_TRANSFER_OK);
if (Status == SD_OK)
{
/* Read block of many bytes from address 0 */
Status = SDC_ReadMultiBlocks(Buffer_MultiBlock_Rx, 0x00, \
BLOCK_SIZE, NUMBER_OF_BLOCKS);
/* Check if the Transfer is finished */
Status = SDC_WaitReadOperation();
while(SDC_GetStatus() != SD_TRANSFER_OK);
}
else
{
printf("SD_MultiBlockTest:SDC_WriteMultiBlock failed\n");
}
/* Check the correctness of written data */
if (Status == SD_OK)
{
TransferStatus2 = Buffercmp(Buffer_MultiBlock_Tx, \
Buffer_MultiBlock_Rx, MULTI_BUFFER_SIZE);
if(TransferStatus2 == PASSED)
{
printf("SD_MultiBlockTest passed\n");
}
else
{
printf("SD_MultiBlockTest:Buffercmp failed\n");
}
}
else
{
printf("SD_MultiBlockTest:SDC_ReadMultiBlock failed\n");
}
}
示例15: main
int main(void)
{
uint8_t i;
printf("SBN1 test 2 \r\n");
Fill_Buffer(0x09, 0x53, 0x42, 0x4E, 0x31, 0x00, 0x02, 0x04, 0x03, 0x01);
SBN1_Handle_Reveived();
for(i = 0x00; i < 0xff; i++)
{
SBN1_Loop();
}
return 0;
}