int libmem_register_cfi_amd_driver libmem_driver_handle_t h,
uint8_t *  start,
size_t  size,
const libmem_geometry_t geometry,
const libmem_flash_info_t flash_info
 

Register a multi-width CFI command set 2 (AMD) LIBMEM driver.

Parameters:
h   A pointer to the LIBMEM handle structure to use for this LIBMEM driver.
start   The start address of the FLASH memory.
size   The size of the FLASH memory.
geometry   A NULL terminated description of the FLASH's geometry.
flash_info   A pointer to the FLASH information structure.
Returns:
The LIBMEM status result.
This function registers a multi-width CFI command set 2 (AMD) LIBMEM driver. The advantage of this driver over the individual single width and command set drivers is that one driver will support a range of FLASH chips, the disadvantage is that of increased code size and reduced performance.

Example:

    const int flash1_max_geometry_regions = 4;
    libmem_driver_handle_t flash1_handle;
    uint8_t *flash1_start = (uint8_t *)0x10000000;
    libmem_geometry_t flash1_geometry[flash1_max_geometry_regions];
    libmem_flash_info_t flash1_info;
    size_t flash1_size;
    int res;

    // Detect the type, size and geometry of the Intel FLASH.
    res = libmem_cfi_get_info(flash1_start,
                              &flash1_size,
                              flash1_geometry,
                              flash1_max_geometry_regions,
                              &flash1_info);

    if (res == LIBMEM_STATUS_SUCCESS)
      {
        // Register the driver
        res = libmem_register_cfi_amd_driver(&flash1_handle,
                                               flash1_start,
                                               flash1_size),
                                               flash1_geometry,
                                               flash1_info);

        if (res == LIBMEM_STATUS_SUCCESS)
          printf("libmem_register_cfi_amd_driver : success\n");
        else
          printf("libmem_register_cfi_amd_driver : failed (%d)\n", res);

      }
    else
      printf("libmem_cfi_get_info : failed (%d)\n", res);