DEVICE_API not able to execute in ncs v2.6.1

I need to add DEVICE_API in my code. How can I do that? Currently, I’m using NCS v2.6.1.

Parents
  • Hi Chirag,
    Could you clarify what you are trying to achieve here? I need more information.

    Best regards,
    Benjamin

  • Hi,

    I want to use the flash driver.
    Initially, I defined the API like this:

    static const struct flash_driver_api micron_spi_nand_api = {
    .read = micron_spi_nand_read,
    .write = micron_spi_nand_write,
    .erase = micron_spi_nand_erase,
    .get_parameters = flash_nand_get_parameters,
    .read_jedec_id = micron_spi_nand_read_jedec_id,
    #if defined(CONFIG_FLASH_PAGE_LAYOUT)
    .page_layout = micron_spi_nand_pages_layout,
    #endif };

    When I tried to change this to use the DEVICE_API() macro:

    // static DEVICE_API(flash, micron_spi_nand_api) = {

    the build failed with an error. I also noticed that DEVICE_API is not defined in zephyr/include/zephyr/device.h in NCS v2.6.1.

    So my question is: how can I correctly use the device API mechanism in NCS v2.6.1?

Reply
  • Hi,

    I want to use the flash driver.
    Initially, I defined the API like this:

    static const struct flash_driver_api micron_spi_nand_api = {
    .read = micron_spi_nand_read,
    .write = micron_spi_nand_write,
    .erase = micron_spi_nand_erase,
    .get_parameters = flash_nand_get_parameters,
    .read_jedec_id = micron_spi_nand_read_jedec_id,
    #if defined(CONFIG_FLASH_PAGE_LAYOUT)
    .page_layout = micron_spi_nand_pages_layout,
    #endif };

    When I tried to change this to use the DEVICE_API() macro:

    // static DEVICE_API(flash, micron_spi_nand_api) = {

    the build failed with an error. I also noticed that DEVICE_API is not defined in zephyr/include/zephyr/device.h in NCS v2.6.1.

    So my question is: how can I correctly use the device API mechanism in NCS v2.6.1?

Children
Related