Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Utilities/STM32_EVAL/Common/stm32_eval_spi_flash.h @ 0:c59513fd84fb
Initial commit of STM32 test code.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 03 Oct 2011 21:19:15 +1030 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c59513fd84fb |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32_eval_spi_flash.h | |
4 * @author MCD Application Team | |
5 * @version V4.5.0 | |
6 * @date 07-March-2011 | |
7 * @brief This file contains all the functions prototypes for the stm32_eval_spi_flash | |
8 * firmware driver. | |
9 ****************************************************************************** | |
10 * @attention | |
11 * | |
12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS | |
13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE | |
14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY | |
15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING | |
16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE | |
17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. | |
18 * | |
19 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> | |
20 ****************************************************************************** | |
21 */ | |
22 | |
23 /* Define to prevent recursive inclusion -------------------------------------*/ | |
24 #ifndef __STM32_EVAL_SPI_FLASH_H | |
25 #define __STM32_EVAL_SPI_FLASH_H | |
26 | |
27 #ifdef __cplusplus | |
28 extern "C" { | |
29 #endif | |
30 | |
31 /* Includes ------------------------------------------------------------------*/ | |
32 #include "stm32_eval.h" | |
33 | |
34 /** @addtogroup Utilities | |
35 * @{ | |
36 */ | |
37 | |
38 /** @addtogroup STM32_EVAL | |
39 * @{ | |
40 */ | |
41 | |
42 /** @addtogroup Common | |
43 * @{ | |
44 */ | |
45 | |
46 /** @addtogroup STM32_EVAL_SPI_FLASH | |
47 * @{ | |
48 */ | |
49 | |
50 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Types | |
51 * @{ | |
52 */ | |
53 /** | |
54 * @} | |
55 */ | |
56 | |
57 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Constants | |
58 * @{ | |
59 */ | |
60 /** | |
61 * @brief M25P SPI Flash supported commands | |
62 */ | |
63 #define sFLASH_CMD_WRITE 0x02 /*!< Write to Memory instruction */ | |
64 #define sFLASH_CMD_WRSR 0x01 /*!< Write Status Register instruction */ | |
65 #define sFLASH_CMD_WREN 0x06 /*!< Write enable instruction */ | |
66 #define sFLASH_CMD_READ 0x03 /*!< Read from Memory instruction */ | |
67 #define sFLASH_CMD_RDSR 0x05 /*!< Read Status Register instruction */ | |
68 #define sFLASH_CMD_RDID 0x9F /*!< Read identification */ | |
69 #define sFLASH_CMD_SE 0xD8 /*!< Sector Erase instruction */ | |
70 #define sFLASH_CMD_BE 0xC7 /*!< Bulk Erase instruction */ | |
71 | |
72 #define sFLASH_WIP_FLAG 0x01 /*!< Write In Progress (WIP) flag */ | |
73 | |
74 #define sFLASH_DUMMY_BYTE 0xA5 | |
75 #define sFLASH_SPI_PAGESIZE 0x100 | |
76 | |
77 #define sFLASH_M25P128_ID 0x202018 | |
78 #define sFLASH_M25P64_ID 0x202017 | |
79 | |
80 /** | |
81 * @} | |
82 */ | |
83 | |
84 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Macros | |
85 * @{ | |
86 */ | |
87 /** | |
88 * @brief Select sFLASH: Chip Select pin low | |
89 */ | |
90 #define sFLASH_CS_LOW() GPIO_ResetBits(sFLASH_CS_GPIO_PORT, sFLASH_CS_PIN) | |
91 /** | |
92 * @brief Deselect sFLASH: Chip Select pin high | |
93 */ | |
94 #define sFLASH_CS_HIGH() GPIO_SetBits(sFLASH_CS_GPIO_PORT, sFLASH_CS_PIN) | |
95 /** | |
96 * @} | |
97 */ | |
98 | |
99 | |
100 | |
101 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Functions | |
102 * @{ | |
103 */ | |
104 /** | |
105 * @brief High layer functions | |
106 */ | |
107 void sFLASH_DeInit(void); | |
108 void sFLASH_Init(void); | |
109 void sFLASH_EraseSector(uint32_t SectorAddr); | |
110 void sFLASH_EraseBulk(void); | |
111 void sFLASH_WritePage(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite); | |
112 void sFLASH_WriteBuffer(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite); | |
113 void sFLASH_ReadBuffer(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead); | |
114 uint32_t sFLASH_ReadID(void); | |
115 void sFLASH_StartReadSequence(uint32_t ReadAddr); | |
116 | |
117 /** | |
118 * @brief Low layer functions | |
119 */ | |
120 uint8_t sFLASH_ReadByte(void); | |
121 uint8_t sFLASH_SendByte(uint8_t byte); | |
122 uint16_t sFLASH_SendHalfWord(uint16_t HalfWord); | |
123 void sFLASH_WriteEnable(void); | |
124 void sFLASH_WaitForWriteEnd(void); | |
125 | |
126 #ifdef __cplusplus | |
127 } | |
128 #endif | |
129 | |
130 #endif /* __STM32_EVAL_SPI_FLASH_H */ | |
131 /** | |
132 * @} | |
133 */ | |
134 | |
135 /** | |
136 * @} | |
137 */ | |
138 | |
139 /** | |
140 * @} | |
141 */ | |
142 | |
143 /** | |
144 * @} | |
145 */ | |
146 | |
147 /** | |
148 * @} | |
149 */ | |
150 | |
151 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |