![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
#include <io.h>#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <types.h>#include <timer.h>#include <common.h>#include <log.h>#include <sys-clk.h>#include <sys-dma.h>#include <sys-gpio.h>#include "sys-spi-nand.h"#include "sys-spi.h"
Enumerations | |
| enum | { OPCODE_READ_ID = 0x9f , OPCODE_READ_STATUS = 0x0f , OPCODE_WRITE_STATUS = 0x1f , OPCODE_READ_PAGE = 0x13 , OPCODE_READ = 0x03 , OPCODE_FAST_READ = 0x0b , OPCODE_FAST_READ_DUAL_O = 0x3b , OPCODE_FAST_READ_QUAD_O = 0x6b , OPCODE_FAST_READ_DUAL_IO = 0xbb , OPCODE_FAST_READ_QUAD_IO = 0xeb , OPCODE_WRITE_ENABLE = 0x06 , OPCODE_BLOCK_ERASE = 0xd8 , OPCODE_PROGRAM_LOAD = 0x02 , OPCODE_PROGRAM_EXEC = 0x10 , OPCODE_RESET = 0xff } |
| enum | { CONFIG_ADDR_PROTECT = 0xa0 , CONFIG_ADDR_OTP = 0xb0 , CONFIG_ADDR_STATUS = 0xc0 , CONFIG_POS_BUF = 0x08 } |
| enum | spi_mfr_id { SPI_NAND_MFR_WINBOND = 0xef , SPI_NAND_MFR_GIGADEVICE = 0xc8 , SPI_NAND_MFR_MACRONIX = 0xc2 , SPI_NAND_MFR_MICRON = 0x2c , SPI_NAND_MFR_FORESEE = 0xcd , SPI_NAND_MFR_ETRON = 0xd5 , SPI_NAND_MFR_XTX = 0x0b } |
Functions | |
| static int | spi_nand_info (sunxi_spi_t *spi) |
| Retrieve SPI NAND information. | |
| __attribute__ ((unused)) | |
| Perform a reset operation on the SPI NAND. | |
| static int | spi_nand_get_config (sunxi_spi_t *spi, uint8_t addr, uint8_t *val) |
| Get configuration value from SPI NAND at specified address. | |
| static int | spi_nand_set_config (sunxi_spi_t *spi, uint8_t addr, uint8_t val) |
| Set configuration value to SPI NAND at specified address. | |
| static bool | spi_nand_wait_while_busy (sunxi_spi_t *spi) |
| Wait until SPI NAND is not busy. | |
| int | spi_nand_detect (sunxi_spi_t *spi) |
| Detect and initialize SPI NAND flash. | |
| static int | spi_nand_load_page (sunxi_spi_t *spi, uint32_t offset) |
| Load a page from SPI NAND flash at the specified offset. | |
| uint32_t | spi_nand_read (sunxi_spi_t *spi, uint8_t *buf, uint32_t addr, uint32_t rxlen) |
| Read data from SPI NAND flash. | |
Variables | |
| static const spi_nand_info_t | spi_nand_infos [] |
| static spi_nand_info_t | info |
| anonymous enum |
| enum spi_mfr_id |
| __attribute__ | ( | (unused) | ) |
Perform a reset operation on the SPI NAND.
| spi | Pointer to the sunxi_spi_t structure. |
| int spi_nand_detect | ( | sunxi_spi_t * | spi | ) |
Detect and initialize SPI NAND flash.
| spi | Pointer to the sunxi_spi_t structure. |
|
static |
Get configuration value from SPI NAND at specified address.
| spi | Pointer to the sunxi_spi_t structure. |
| addr | Address to read from. |
| val | Pointer to store the configuration value. |
|
static |
Retrieve SPI NAND information.
| spi | Pointer to the sunxi_spi_t structure. |
|
static |
Load a page from SPI NAND flash at the specified offset.
| spi | Pointer to the sunxi_spi_t structure. |
| offset | Offset of the page to load. |
| uint32_t spi_nand_read | ( | sunxi_spi_t * | spi, |
| uint8_t * | buf, | ||
| uint32_t | addr, | ||
| uint32_t | rxlen | ||
| ) |
Read data from SPI NAND flash.
| spi | Pointer to the sunxi_spi_t structure. |
| buf | Pointer to the buffer to store the read data. |
| addr | Starting address to read from. |
| rxlen | Number of bytes to read. |
|
static |
Set configuration value to SPI NAND at specified address.
| spi | Pointer to the sunxi_spi_t structure. |
| addr | Address to write to. |
| val | Value to be written. |
|
static |
Wait until SPI NAND is not busy.
| spi | Pointer to the sunxi_spi_t structure. |
|
static |
|
static |