diff options
| author | onelife.real <[email protected]> | 2011-05-12 07:19:37 +0000 |
|---|---|---|
| committer | onelife.real <[email protected]> | 2011-05-12 07:19:37 +0000 |
| commit | 169c31fc4f22c12f1b74b17aec9d44ed65a752b9 (patch) | |
| tree | 07e278a5c05e5c3e6c5ec69dd5ee5a6c9cf168ac /bsp/efm32/dev_sflash.h | |
| parent | 43a6a907da0ee6047030ecb737109642dcdc1c5c (diff) | |
*** EFM32 branch ***
1. Add EFM32 development kit support
2. Add USART sync mode (SPI) support
3. Add SPI Flash device (ST M25PX16) driver and demo application
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1401 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/efm32/dev_sflash.h')
| -rw-r--r-- | bsp/efm32/dev_sflash.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/bsp/efm32/dev_sflash.h b/bsp/efm32/dev_sflash.h new file mode 100644 index 0000000000..1a10999331 --- /dev/null +++ b/bsp/efm32/dev_sflash.h @@ -0,0 +1,102 @@ +/******************************************************************//**
+ * @file dev_sflash.h
+ * @brief SPI Flash driver of RT-Thread RTOS for using EFM32 USART module
+ * This driver is tested by using the M25PX16 device on the EFM32 development kit.
+ * COPYRIGHT (C) 2011, RT-Thread Development Team
+ * @author onelife
+ * @version 0.4 beta
+ **********************************************************************
+ * @section License
+ * The license and distribution terms for this file may be found in the file LICENSE in this
+ * distribution or at http://www.rt-thread.org/license/LICENSE
+ **********************************************************************
+ * @section Change Logs
+ * Date Author Notes
+ * 2010-05-06 onelife Initial creation for using EFM32 USART module
+ *********************************************************************/
+#ifndef __DEV_SFLASH_H__
+#define __DEV_SFLASH_H__
+
+/* Includes -------------------------------------------------------------------*/
+/* Exported types -------------------------------------------------------------*/
+enum sflash_inst_type_t
+{
+ /* Instruction only */
+ sflash_inst_wren = 0x00,
+ sflash_inst_wrdi,
+ sflash_inst_rdid_l,
+ sflash_inst_rdid_s,
+ sflash_inst_rdsr,
+ sflash_inst_wrsr,
+ sflash_inst_be,
+ sflash_inst_dp,
+ sflash_inst_rdp,
+ /* Instruction and address */
+ sflash_inst_wrlr,
+ sflash_inst_rdlr,
+ sflash_inst_read,
+ sflash_inst_potp,
+ sflash_inst_pp,
+ sflash_inst_difp,
+ sflash_inst_sse,
+ sflash_inst_se,
+ /* Instruction, address and dummy read */
+ sflash_inst_read_f,
+ sflash_inst_dofr,
+ sflash_inst_rotp
+};
+
+/* Exported constants ---------------------------------------------------------*/
+/* Exported macro -------------------------------------------------------------*/
+#define SFLASH_INST_CODE_WREN (0x06)
+#define SFLASH_INST_CODE_WRDI (0x04)
+#define SFLASH_INST_CODE_RDID_L (0x9F)
+#define SFLASH_INST_CODE_RDID_S (0x9E)
+#define SFLASH_INST_CODE_RDSR (0x05)
+#define SFLASH_INST_CODE_WRSR (0x01)
+#define SFLASH_INST_CODE_WRLR (0xE5)
+#define SFLASH_INST_CODE_RDLR (0xE8)
+#define SFLASH_INST_CODE_READ (0x03)
+#define SFLASH_INST_CODE_READ_F (0x0B)
+#define SFLASH_INST_CODE_DOFR (0x3B)
+#define SFLASH_INST_CODE_ROTP (0x4B)
+#define SFLASH_INST_CODE_POTP (0x42)
+#define SFLASH_INST_CODE_PP (0x02)
+#define SFLASH_INST_CODE_DIFP (0xA2)
+#define SFLASH_INST_CODE_SSE (0x20)
+#define SFLASH_INST_CODE_SE (0xD8)
+#define SFLASH_INST_CODE_BE (0xC7)
+#define SFLASH_INST_CODE_DP (0xB9)
+#define SFLASH_INST_CODE_RDP (0xAB)
+
+#define SFLASH_REPLY_LEN_WREN (0)
+#define SFLASH_REPLY_LEN_WRDI (0)
+#define SFLASH_REPLY_LEN_RDID_L (20)
+#define SFLASH_REPLY_LEN_RDID_S (3)
+#define SFLASH_REPLY_LEN_RDSR (1)
+#define SFLASH_REPLY_LEN_WRSR (1)
+#define SFLASH_REPLY_LEN_WRLR (1)
+#define SFLASH_REPLY_LEN_RDLR (1)
+#define SFLASH_REPLY_LEN_READ (-1)
+#define SFLASH_REPLY_LEN_READ_F (-1)
+#define SFLASH_REPLY_LEN_DOFR (-1)
+#define SFLASH_REPLY_LEN_ROTP (65)
+#define SFLASH_REPLY_LEN_POTP (65)
+#define SFLASH_REPLY_LEN_PP (256)
+#define SFLASH_REPLY_LEN_DIFP (256)
+#define SFLASH_REPLY_LEN_SSE (0)
+#define SFLASH_REPLY_LEN_SE (0)
+#define SFLASH_REPLY_LEN_BE (0)
+#define SFLASH_REPLY_LEN_DP (0)
+#define SFLASH_REPLY_LEN_RDP (0)
+
+/* Exported functions --------------------------------------------------------- */
+rt_err_t efm_spiFash_init(void);
+rt_err_t efm_spiFash_deinit(void);
+rt_uint32_t efm_spiFash_cmd(
+ enum sflash_inst_type_t command,
+ rt_uint32_t address,
+ rt_uint8_t *buffer,
+ rt_uint32_t size);
+
+#endif /* __DEV_SFLASH_H__ */
|
