Macros | Functions
spi_flash.c File Reference

SPI Flash. More...

#include "spi_flash/include/spi_flash.h"
Include dependency graph for spi_flash.c:

Go to the source code of this file.

Macros

#define CORTUS_SHARE_MEM_BASE   (0x60000000UL)
 
#define DUMMY_REGISTER   (0x1084)
 
#define GET_UINT32(X, Y)   (X[0+Y] + ((uint32)X[1+Y]<<8) + ((uint32)X[2+Y]<<16) +((uint32)X[3+Y]<<24))
 
#define HOST_SHARE_MEM_BASE   (0xd0000UL)
 
#define NMI_SPI_FLASH_ADDR   (0x111c)
 
#define SPI_FLASH_BASE   (0x10200)
 
#define SPI_FLASH_BUF1   (SPI_FLASH_BASE + 0x0c)
 
#define SPI_FLASH_BUF2   (SPI_FLASH_BASE + 0x10)
 
#define SPI_FLASH_BUF_DIR   (SPI_FLASH_BASE + 0x14)
 
#define SPI_FLASH_CMD_CNT   (SPI_FLASH_BASE + 0x04)
 
#define SPI_FLASH_DATA_CNT   (SPI_FLASH_BASE + 0x08)
 
#define SPI_FLASH_DMA_ADDR   (SPI_FLASH_BASE + 0x1c)
 
#define SPI_FLASH_MODE   (SPI_FLASH_BASE + 0x00)
 
#define SPI_FLASH_MSB_CTL   (SPI_FLASH_BASE + 0x20)
 
#define SPI_FLASH_TR_DONE   (SPI_FLASH_BASE + 0x18)
 
#define SPI_FLASH_TX_CTL   (SPI_FLASH_BASE + 0x24)
 
#define TIMEOUT   (-1) /*MS*/
 

Functions

sint8 spi_flash_erase (uint32 u32Offset, uint32 u32Sz)
 Erase a specified portion of SPI Flash.
. More...
 
uint32 spi_flash_get_size (void)
 Returns with uint32 value which is total flash size
. More...
 
static sint8 spi_flash_load_to_cortus_mem (uint32 u32MemAdr, uint32 u32FlashAdr, uint32 u32Sz)
 
static sint8 spi_flash_page_program (uint32 u32MemAdr, uint32 u32FlashAdr, uint32 u32Sz)
 
static sint8 spi_flash_pp (uint32 u32Offset, uint8 *pu8Buf, uint16 u16Sz)
 
static uint32 spi_flash_rdid (void)
 Read SPI Flash ID. More...
 
sint8 spi_flash_read (uint8 *pu8Buf, uint32 u32offset, uint32 u32Sz)
 Read a specified portion of data from SPI Flash.
. More...
 
static sint8 spi_flash_read_internal (uint8 *pu8Buf, uint32 u32Addr, uint32 u32Sz)
 
static sint8 spi_flash_read_status_reg (uint8 *val)
 
static sint8 spi_flash_sector_erase (uint32 u32FlashAdr)
 
sint8 spi_flash_write (uint8 *pu8Buf, uint32 u32Offset, uint32 u32Sz)
 Write a specified portion of data to SPI Flash.
. More...
 
static sint8 spi_flash_write_disable (void)
 Send write disable command to SPI flash. More...
 
static sint8 spi_flash_write_enable (void)
 Send write enable command to SPI flash. More...
 

Detailed Description

SPI Flash.

Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.

Definition in file spi_flash.c.

Macro Definition Documentation

◆ CORTUS_SHARE_MEM_BASE

#define CORTUS_SHARE_MEM_BASE   (0x60000000UL)

Definition at line 46 of file spi_flash.c.

◆ DUMMY_REGISTER

#define DUMMY_REGISTER   (0x1084)

Definition at line 39 of file spi_flash.c.

◆ GET_UINT32

#define GET_UINT32 (   X,
 
)    (X[0+Y] + ((uint32)X[1+Y]<<8) + ((uint32)X[2+Y]<<16) +((uint32)X[3+Y]<<24))

Definition at line 51 of file spi_flash.c.

◆ HOST_SHARE_MEM_BASE

#define HOST_SHARE_MEM_BASE   (0xd0000UL)

Definition at line 45 of file spi_flash.c.

◆ NMI_SPI_FLASH_ADDR

#define NMI_SPI_FLASH_ADDR   (0x111c)

Definition at line 47 of file spi_flash.c.

◆ SPI_FLASH_BASE

#define SPI_FLASH_BASE   (0x10200)

Definition at line 52 of file spi_flash.c.

◆ SPI_FLASH_BUF1

#define SPI_FLASH_BUF1   (SPI_FLASH_BASE + 0x0c)

Definition at line 56 of file spi_flash.c.

◆ SPI_FLASH_BUF2

#define SPI_FLASH_BUF2   (SPI_FLASH_BASE + 0x10)

Definition at line 57 of file spi_flash.c.

◆ SPI_FLASH_BUF_DIR

#define SPI_FLASH_BUF_DIR   (SPI_FLASH_BASE + 0x14)

Definition at line 58 of file spi_flash.c.

◆ SPI_FLASH_CMD_CNT

#define SPI_FLASH_CMD_CNT   (SPI_FLASH_BASE + 0x04)

Definition at line 54 of file spi_flash.c.

◆ SPI_FLASH_DATA_CNT

#define SPI_FLASH_DATA_CNT   (SPI_FLASH_BASE + 0x08)

Definition at line 55 of file spi_flash.c.

◆ SPI_FLASH_DMA_ADDR

#define SPI_FLASH_DMA_ADDR   (SPI_FLASH_BASE + 0x1c)

Definition at line 60 of file spi_flash.c.

◆ SPI_FLASH_MODE

#define SPI_FLASH_MODE   (SPI_FLASH_BASE + 0x00)

Definition at line 53 of file spi_flash.c.

◆ SPI_FLASH_MSB_CTL

#define SPI_FLASH_MSB_CTL   (SPI_FLASH_BASE + 0x20)

Definition at line 61 of file spi_flash.c.

◆ SPI_FLASH_TR_DONE

#define SPI_FLASH_TR_DONE   (SPI_FLASH_BASE + 0x18)

Definition at line 59 of file spi_flash.c.

◆ SPI_FLASH_TX_CTL

#define SPI_FLASH_TX_CTL   (SPI_FLASH_BASE + 0x24)

Definition at line 62 of file spi_flash.c.

◆ TIMEOUT

#define TIMEOUT   (-1) /*MS*/

Definition at line 41 of file spi_flash.c.

Function Documentation

◆ spi_flash_load_to_cortus_mem()

static sint8 spi_flash_load_to_cortus_mem ( uint32  u32MemAdr,
uint32  u32FlashAdr,
uint32  u32Sz 
)
static

Definition at line 211 of file spi_flash.c.

◆ spi_flash_page_program()

static sint8 spi_flash_page_program ( uint32  u32MemAdr,
uint32  u32FlashAdr,
uint32  u32Sz 
)
static

Definition at line 348 of file spi_flash.c.

◆ spi_flash_pp()

static sint8 spi_flash_pp ( uint32  u32Offset,
uint8 pu8Buf,
uint16  u16Sz 
)
static

Definition at line 411 of file spi_flash.c.

◆ spi_flash_rdid()

spi_flash_rdid ( void  )
static

Read SPI Flash ID.

Returns
SPI FLash ID
Author
M.S.M
Version
1.0

Definition at line 437 of file spi_flash.c.

◆ spi_flash_read_internal()

static sint8 spi_flash_read_internal ( uint8 pu8Buf,
uint32  u32Addr,
uint32  u32Sz 
)
static

Definition at line 387 of file spi_flash.c.

◆ spi_flash_read_status_reg()

static sint8 spi_flash_read_status_reg ( uint8 val)
static

Definition at line 78 of file spi_flash.c.

◆ spi_flash_sector_erase()

static sint8 spi_flash_sector_erase ( uint32  u32FlashAdr)
static

Definition at line 249 of file spi_flash.c.

◆ spi_flash_write_disable()

spi_flash_write_disable ( void  )
static

Send write disable command to SPI flash.

Note
Compatible with MX25L6465E and should be working with other types
Author
M. Abdelmawla
Version
1.0

Definition at line 313 of file spi_flash.c.

◆ spi_flash_write_enable()

spi_flash_write_enable ( void  )
static

Send write enable command to SPI flash.

Returns
Status of execution
Note
Compatible with MX25L6465E and should be working with other types
Author
M. Abdelmawla
Version
1.0

Definition at line 283 of file spi_flash.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00