/*================================================================ Copyright (c) 2022, Quectel Wireless Solutions Co., Ltd. All rights reserved. Quectel Wireless Solutions Proprietary and Confidential. =================================================================*/ #ifndef __QL_SPI_NOR_H #define __QL_SPI_NOR_H //spiʱÖÓÆµÂÊ #define _APBC_SSP_FNCLKSEL_6_5MHZ_ (0x00) #define _APBC_SSP_FNCLKSEL_13MHZ_ (0x01) #define _APBC_SSP_FNCLKSEL_26MHZ_ (0x02) #define _APBC_SSP_FNCLKSEL_52MHZ_ (0x03) #define _APBC_SSP_FNCLKSEL_3_25MHZ_ (0x04) #define _APBC_SSP_FNCLKSEL_1_625MHZ_ (0x05) #define _APBC_SSP_FNCLKSEL_812_5KHZ_ (0x06) #define EXTERNAL_NORFLASH_PORT16_19 0 //SSP0 #define EXTERNAL_NORFLASH_PORT33_36_SSP0 1 //SSP0 #define EXTERNAL_NORFLASH_PORT33_36 2 //SSP2 #define EXTERNAL_NORFLASH_PORT12_15_SSP2 3 //SSP2 //SPI_Nor operation ERROR CODE #define QUEC_SSPOperationNoError 0x0 #define QUEC_SSPPortInvalidError 0x20 #define QUEC_SSPBufferParamInvalidError 0x21 #define QUEC_FlashAddrOutOfRange 0x3d #define QUEC_SSPWaitTxEmptyTimeOutError 0x80 #define QUEC_SSPRdStatusTimeOutError 0x81 #define QUEC_SSPWelWaitTxEmptyTimeOutError 0x82 #define QUEC_SSPWaitForWELTimeOutError 0x83 #define QUEC_SSPWaitCompleteTimeOutError 0x84 #define QUEC_SSPRxChannelTimeOutError 0x85 #define QUEC_SSPTxChannelTimeOutError 0x86 #define QUEC_SSPNOTREADY 0x87 unsigned char *ql_spi_nor_read_id(int port); unsigned int ql_spi_nor_init(int port, int clk); unsigned int ql_spi_nor_read(int port, unsigned char* pBuffer,unsigned int ReadAddr,unsigned short NumByteToRead); unsigned int ql_spi_nor_read_fifo(int port, unsigned char* pBuffer,unsigned int ReadAddr,unsigned short NumByteToRead); unsigned int ql_spi_nor_write(int port, unsigned char* pBuffer,unsigned int WriteAddr,unsigned short NumByteToWrite); unsigned int ql_spi_nor_erase_chip(int port); unsigned int ql_spi_nor_erase_sector(int port, unsigned int Dst_Addr); void ql_spi_nor_reg_write_read(int port, unsigned char *cmd, unsigned char *data, unsigned char len); #endif