Ejemplo n.º 1
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : ftfl_flash_init
* Returned Value   : TRUE if successful, FALSE otherwise
* Comments         :
*   Initialize flash specific information.
*
*END*-----------------------------------------------------------------------*/
boolean ftfl_flash_init
(
    /* [IN] Device instance */
    IO_FLASHX_STRUCT_PTR dev_ptr
)
{
    FTFL_FLASH_INTERNAL_STRUCT_PTR    dev_spec_ptr;
    FTFL_MemMapPtr                    ftfl_ptr;

    if (_bsp_ftfx_io_init(0)) {
        /* Cannot initialize FTF module */
        return FALSE;
    }

    /* allocate internal structure */
    dev_spec_ptr = _mem_alloc(sizeof(FTFL_FLASH_INTERNAL_STRUCT));
#if MQX_CHECK_MEMORY_ALLOCATION_ERRORS
    if( dev_spec_ptr == NULL)
    {
        return FALSE;
    }
#endif
    dev_ptr->DEVICE_SPECIFIC_DATA = dev_spec_ptr;

    /* get the pointer to ftfl registers structure */
    ftfl_ptr = (FTFL_MemMapPtr)_bsp_get_ftfl_address();
    dev_spec_ptr->ftfl_ptr = (vchar_ptr)ftfl_ptr;

    /* save pointer to function in ram */
    dev_spec_ptr->flash_execute_code_ptr = ftfl_init_ram_function ();


    return TRUE;
}
Ejemplo n.º 2
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : ftfa_flash_init
* Returned Value   : TRUE if successful, FALSE otherwise
* Comments         :
*   Initialize flash specific information.
*
*END*----------------------------------------------------------------------*/
bool ftfa_flash_init 
(
    /* [IN] File pointer */
    IO_FLASHX_STRUCT_PTR dev_ptr
)
{
    FTFA_FLASH_INTERNAL_STRUCT_PTR    dev_spec_ptr;
    FTFA_MemMapPtr                    ftfa_ptr;

    if (_bsp_ftfx_io_init(0)) {
        /* Cannot initialize FTF module */
        return FALSE;
    }

    /* allocate internal structure */
    dev_spec_ptr = _mem_alloc(sizeof(FTFA_FLASH_INTERNAL_STRUCT));
#if MQX_CHECK_MEMORY_ALLOCATION_ERRORS
    if (dev_spec_ptr == NULL)
    {
        return FALSE;
    }
#endif
    dev_ptr->DEVICE_SPECIFIC_DATA = dev_spec_ptr;
        
    /* get the pointer to ftfa registers structure */
    ftfa_ptr = _bsp_get_ftfa_address();
    dev_spec_ptr->ftfa_ptr = (volatile char *)ftfa_ptr;
    
    /* save pointer to function in ram */
    dev_spec_ptr->flash_execute_code_ptr = ftfa_init_ram_function((char *)ftfa_ram_function, (char *)ftfa_ram_function_end);
#if PSP_MQX_CPU_IS_KINETIS
    dev_spec_ptr->flash_invalidate_code_ptr = ftfa_init_ram_function((char *)kinetis_flash_invalidate_cache, (char *)kinetis_flash_invalidate_cache_end);
#endif

#if MQX_CHECK_MEMORY_ALLOCATION_ERRORS
    if (dev_spec_ptr->flash_execute_code_ptr == NULL)
    {
        return FALSE;
    }
#if PSP_MQX_CPU_IS_KINETIS
    if (dev_spec_ptr->flash_invalidate_code_ptr == NULL)
    {
        return FALSE;
    }
#endif
#endif

    /* 
    ** TODO: Currently, MQX FlashX driver for FTFA 
    ** doesn't support chips using FlexNVM so no need to configure FlexRAM 
    ** to traditional RAM when using Programing Acceleration RAM 
    */
        
    return TRUE;    
}
Ejemplo n.º 3
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : ftfl_flash_init
* Returned Value   : TRUE if successful, FALSE otherwise
* Comments         :
*   Initialize flash specific information.
*
*END*-----------------------------------------------------------------------*/
bool ftfl_flash_init
(
    /* [IN] Device instance */
    IO_FLASHX_STRUCT_PTR dev_ptr
)
{
    FTFL_FLASH_INTERNAL_STRUCT_PTR    dev_spec_ptr;
    FTFL_MemMapPtr                    ftfl_ptr;

    if (_bsp_ftfx_io_init(0)) {
        /* Cannot initialize FTF module */
        return FALSE;
    }

    /* allocate internal structure */
    dev_spec_ptr = _mem_alloc(sizeof(FTFL_FLASH_INTERNAL_STRUCT));
#if MQX_CHECK_MEMORY_ALLOCATION_ERRORS
    if (dev_spec_ptr == NULL)
    {
        return FALSE;
    }
#endif
    dev_ptr->DEVICE_SPECIFIC_DATA = dev_spec_ptr;

    /* get the pointer to ftfl registers structure */
    ftfl_ptr = (FTFL_MemMapPtr)_bsp_get_ftfl_address();
    dev_spec_ptr->ftfl_ptr = (volatile char *)ftfl_ptr;

    /* save pointer to function in ram */
    dev_spec_ptr->flash_execute_code_ptr = ftfl_init_ram_function((char *)ftfl_ram_function, (char *)ftfl_ram_function_end);
#if PSP_MQX_CPU_IS_KINETIS
    dev_spec_ptr->flash_invalidate_code_ptr = ftfl_init_ram_function((char *)kinetis_flash_invalidate_cache, (char *)kinetis_flash_invalidate_cache_end);
#endif

#if MQX_CHECK_MEMORY_ALLOCATION_ERRORS
    if (dev_spec_ptr->flash_execute_code_ptr == NULL)
    {
        return FALSE;
    }
#if PSP_MQX_CPU_IS_KINETIS
    if (dev_spec_ptr->flash_invalidate_code_ptr == NULL)
    {
        return FALSE;
    }
#endif
#endif

#if BSPCFG_FLASHX_USE_PA_RAM && BSP_INTERNAL_FLEXRAM_BASE
    /* Make sure Programing Acceleration RAM was enabled */
    flexnvm_set_flexram(dev_ptr, (unsigned char)FLEXNVM_FLEXRAM_RAM);
#endif

    return TRUE;
}