config SPIRAM
    bool "Support for external PSRAM"
    default "n"
    help
        This enables support for an external PSRAM chip, connected in parallel with the
        main SPI flash chip.

menu "PSRAM config"
    depends on SPIRAM

    choice SPIRAM_MODE
        prompt "Line Mode of PSRAM chip in use"
        default SPIRAM_MODE_HEX

        config SPIRAM_MODE_HEX
            bool "16-Line-Mode PSRAM"
    endchoice

    config SPIRAM_USE_8LINE_MODE
        bool
        depends on SPIRAM_MODE_HEX
        default n

        help
            Enable 8-Line-Mode of the AP HEX PSRAM

    choice SPIRAM_SPEED
        prompt "Set PSRAM clock speed"
        default SPIRAM_SPEED_20M
        help
            Select the speed for the PSRAM chip.

        config SPIRAM_SPEED_20M
            bool "20MHz clock speed"
    endchoice

    config SPIRAM_SPEED
        int
        default 20 if SPIRAM_SPEED_20M

    config SPIRAM_ECC_ENABLE
        bool "Enable PSRAM ECC"
        default n
        help
            Enable Error-Correcting Code function when accessing PSRAM.

            If enabled, 1/8 of the PSRAM total size will be reserved for error-correcting code.

    config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
        bool "Allow external memory as an argument to xTaskCreateStatic"
        default y
        help
            Accessing memory in PSRAM has certain restrictions, so task stacks allocated by xTaskCreate
            are by default allocated from internal RAM.

            This option allows for passing memory allocated from PSRAM to be passed to xTaskCreateStatic.
            This should only be used for tasks where the stack is never accessed while the L2Cache is
            disabled, e.g. during SPI Flash operations

    source "$IDF_PATH/components/esp_psram/Kconfig.spiram.common"    # insert non-chip-specific items here

endmenu