mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
83 lines
1.8 KiB
C
83 lines
1.8 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
|
|
#ifndef __ESP_SPIRAM_H
|
|
#define __ESP_SPIRAM_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "esp_err.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Initialize spiram interface/hardware. Normally called from cpu_start.c.
|
|
*
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t esp_spiram_init(void);
|
|
|
|
/**
|
|
* @brief Add the initialized SPI RAM to the heap allocator.
|
|
*/
|
|
esp_err_t esp_spiram_add_to_heapalloc(void);
|
|
|
|
/**
|
|
* @brief Get the size of the attached SPI RAM chip selected in menuconfig
|
|
*
|
|
* @return Size in bytes, or 0 if no external RAM chip support compiled in.
|
|
*/
|
|
size_t esp_spiram_get_size(void);
|
|
|
|
/**
|
|
* @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever
|
|
* cache is disabled, because disabling cache on the ESP32 discards the data in the SPI
|
|
* RAM cache.
|
|
*
|
|
* This is meant for use from within the SPI flash code.
|
|
*/
|
|
void esp_spiram_writeback_cache(void);
|
|
|
|
/**
|
|
* @brief get psram CS IO
|
|
*
|
|
* This interface should be called after PSRAM is enabled, otherwise it will
|
|
* return an invalid value -1/0xff.
|
|
*
|
|
* @return psram CS IO or -1/0xff if psram not enabled
|
|
*/
|
|
uint8_t esp_spiram_get_cs_io(void);
|
|
|
|
/**
|
|
* @brief Reserve a pool of internal memory for specific DMA/internal allocations
|
|
*
|
|
* @param size Size of reserved pool in bytes
|
|
*
|
|
* @return
|
|
* - ESP_OK on success
|
|
* - ESP_ERR_NO_MEM when no memory available for pool
|
|
*/
|
|
esp_err_t esp_spiram_reserve_dma_pool(size_t size);
|
|
|
|
/**
|
|
* @brief If SPI RAM(PSRAM) has been initialized
|
|
*
|
|
* @return
|
|
* - true SPI RAM has been initialized successfully
|
|
* - false SPI RAM hasn't been initialized or initialized failed
|
|
*/
|
|
bool esp_spiram_is_initialized(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|