lib/nxp_evkmimxrt1020_rev.b/flash_algo/IAR_ROM_API_Simplify_Generate/FlashIMXRT_FlexSPI.c
/*************************************************************************
 * Function Name: FlashWrite
 * Parameters: block base address, offet in block, data size, ram buffer
 *             pointer
 * Return: RESULT_OK - Write Successful
 *         RESULT_ERROR - Write Fail
 * Description. Writes data in to NOR
 *************************************************************************/
Function Name: FlashWrite
Parameters: block base address, offet in block, data size, ram buffer
pointer
Return: RESULT_OK - Write Successful
RESULT_ERROR - Write Fail
Description. Writes data in to NOR
Function Name : FlashWrite Parameters : block base address offet in block data size ram buffer pointer Return : RESULT_OK - Write Successful RESULT_ERROR - Write Fail Description . Writes data in to NOR
uint32_t FlashWrite(void *block_start,
                    uint32_t offset_into_block,
                    uint32_t count,
                    char const *buffer)
{
    uint32_t result = (RESULT_OK);
    uint32_t instance = g_uflTargetDesc.flexspiInstance;
    uint32_t baseAddr = g_uflTargetDesc.flashBaseAddr;
    uint32_t addr = (uint32_t)block_start-baseAddr+offset_into_block;
    for (uint32_t size = 0; size < count; size += flashConfig.pageSize,
                                          buffer += flashConfig.pageSize,
                                          addr += flashConfig.pageSize)
    {
        if (flexspi_nor_flash_page_program(instance, (void *)&flashConfig, addr, (uint32_t *)buffer) != kStatus_Success)
        {
            result = (RESULT_ERROR);
            break;
        }
    }
    return result;
}
uint32_t FlashWrite ( void * block_start , uint32_t offset_into_block , uint32_t count , char const * buffer ) { uint32_t result = ( RESULT_OK ) ; uint32_t instance = g_uflTargetDesc . flexspiInstance ; uint32_t baseAddr = g_uflTargetDesc . flashBaseAddr ; uint32_t addr = ( uint32_t ) block_start - baseAddr + offset_into_block ; for ( uint32_t size = 0 ; size < count ; size += flashConfig . pageSize , buffer += flashConfig . pageSize , addr += flashConfig . pageSize ) { if ( flexspi_nor_flash_page_program ( instance , ( void * ) & flashConfig , addr , ( uint32_t * ) buffer ) != kStatus_Success ) { result = ( RESULT_ERROR ) ; break ; } } return result ; }
Function Name: FlashWrite
 Parameters: block base address, offet in block, data size, ram buffer
             pointer
 Return: RESULT_OK - Write Successful
         RESULT_ERROR - Write Fail
 Description.
Function Name : FlashWrite Parameters : block base address offet in block data size ram buffer pointer Return : RESULT_OK - Write Successful RESULT_ERROR - Write Fail Description .