123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /**
- * Copyright 2016, yichip Semiconductor(shenzhen office)
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Yichip Semiconductor;
- * the contents of this file may not be disclosed to third parties, copied
- * or duplicated in any form, in whole or in part, without the prior
- * written permission of Yichip Semiconductor.
- */
-
- /**
- *@file qspi.h
- *@brief Queued SPI support for application.
- */
- #ifndef _QSPI_H_
- #define _QSPI_H_
- #include "yc11xx.h"
- #include "ycdef.h"
- #include "yc_drv_common.h"
- #define FlashCMD_ReadRegister1 0x05
- #define FlashCMD_ReadRegister2 0x35
- #define FlashCMD_WriteRegister 0x01
- #define FlashCMD_PageProgram 0x02
- #define FlashCMD_READ_DATA 0x03
- #define FlashCMD_WriteEnable 0x06
- #define FlashCMD_WriteDisable 0x04
- #define FlashCMD_ReadDual 0x3b
- #define FlashCMD_RDID 0x9f
- #define FlashCMD_REMS 0x90
- #define FlashCMD_UID 0x4b
- #define FlashCMD_PageErase 0x81
- #define FlashCMD_SectorErase 0x20
- #define FlashCMD_32kErase 0x52
- #define FlashCMD_64kErase 0xd8
- #define FlashCMD_ChipErase 0x60
- #define FlashCMD_DeepPowerDown 0xb9
- #define FLASHCMD_RELEASE_POWERDOWN 0xAB
- void __attribute__((noinline)) SetLockQSPI(void);
- void __attribute__((noinline)) SetReleaseQSPI(void);
- /*
- * @brief:sector erase 4kB
- * @param:flash addr
- * @return: ERROR ,SUCCESS
- */
- uint8_t qspi_flash_sectorerase(uint32_t flash_addr);
- /*
- * @brief:block erase 32K
- * @param:flash addr
- * @return: ERROR ,SUCCESS
- */
- uint8_t qspi_flash_blockerase32k(uint32_t flash_addr);
- /*
- * @brief:block erase 64K
- * @param:flash addr
- * @return: ERROR ,SUCCESS
- */
- uint8_t qspi_flash_blockerase64k(uint32_t flash_addr);
- /*
- * @brief:chip erase
- * @param:None
- * @return: ERROR ,SUCCESS
- */
- uint8_t qspi_flash_chiperase(void);
- /*
- * @brief: flash write
- * @param: flash_addr
- * @param: len
- * @param: txbuf
- * @return: ERROR ,SUCCESS
- */
- uint8_t qspi_flash_write(uint32_t flash_addr,uint32_t len,uint8_t *tbuf);
- /*
- * @brief: flash read
- * @param: flash_addr
- * @param: len
- * @param: rxbuf
- * @return: ERROR ,SUCCESS
- */
- uint8_t qspi_flash_read(uint32_t flash_addr,uint32_t rlen,uint8_t *rbuf);
- /*
- * @brief:read flash id
- * @return: flash id
- */
- uint32_t qspi_flash_ManufactureID(void);
- uint8_t QSPI_ReadFlashData(uint32_t flash_addr,uint32_t rlen,uint8_t *rbuf);
- uint8_t QSPI_WriteFlashData(uint32_t flash_addr,uint32_t len,uint8_t *tbuf);
- uint8_t QSPI_SectorEraseFlash(uint32_t flash_addr);
- uint8_t QSPI_PageEraseFlash(uint32_t flash_addr);
- uint8_t QSPI_BlockEraseFlash32k(uint32_t flash_addr);
- uint8_t QSPI_BlockEraseFlash64k(uint32_t flash_addr);
- #endif
-
|