Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_StdPeriph_Driver / inc / stm32f4xx_fmc.h
bloba99c194f5f135ae20d27234309d0a3bd8eee7b03
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_fmc.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 20-May-2016
7 * @brief This file contains all the functions prototypes for the FMC firmware
8 * library.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4xx_FMC_H
31 #define __STM32F4xx_FMC_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41 * @{
44 /** @addtogroup FMC
45 * @{
48 /* Exported types ------------------------------------------------------------*/
50 /**
51 * @brief Timing parameters For NOR/SRAM Banks
53 typedef struct
55 uint32_t FMC_AddressSetupTime; /*!< Defines the number of HCLK cycles to configure
56 the duration of the address setup time.
57 This parameter can be a value between 0 and 15.
58 @note This parameter is not used with synchronous NOR Flash memories. */
60 uint32_t FMC_AddressHoldTime; /*!< Defines the number of HCLK cycles to configure
61 the duration of the address hold time.
62 This parameter can be a value between 1 and 15.
63 @note This parameter is not used with synchronous NOR Flash memories.*/
65 uint32_t FMC_DataSetupTime; /*!< Defines the number of HCLK cycles to configure
66 the duration of the data setup time.
67 This parameter can be a value between 1 and 255.
68 @note This parameter is used for SRAMs, ROMs and asynchronous multiplexed NOR Flash memories. */
70 uint32_t FMC_BusTurnAroundDuration; /*!< Defines the number of HCLK cycles to configure
71 the duration of the bus turnaround.
72 This parameter can be a value between 0 and 15.
73 @note This parameter is only used for multiplexed NOR Flash memories. */
75 uint32_t FMC_CLKDivision; /*!< Defines the period of CLK clock output signal, expressed in number of HCLK cycles.
76 This parameter can be a value between 1 and 15.
77 @note This parameter is not used for asynchronous NOR Flash, SRAM or ROM accesses. */
79 uint32_t FMC_DataLatency; /*!< Defines the number of memory clock cycles to issue
80 to the memory before getting the first data.
81 The parameter value depends on the memory type as shown below:
82 - It must be set to 0 in case of a CRAM
83 - It is don't care in asynchronous NOR, SRAM or ROM accesses
84 - It may assume a value between 0 and 15 in NOR Flash memories
85 with synchronous burst mode enable */
87 uint32_t FMC_AccessMode; /*!< Specifies the asynchronous access mode.
88 This parameter can be a value of @ref FMC_Access_Mode */
89 }FMC_NORSRAMTimingInitTypeDef;
91 /**
92 * @brief FMC NOR/SRAM Init structure definition
94 typedef struct
96 uint32_t FMC_Bank; /*!< Specifies the NOR/SRAM memory bank that will be used.
97 This parameter can be a value of @ref FMC_NORSRAM_Bank */
99 uint32_t FMC_DataAddressMux; /*!< Specifies whether the address and data values are
100 multiplexed on the databus or not.
101 This parameter can be a value of @ref FMC_Data_Address_Bus_Multiplexing */
103 uint32_t FMC_MemoryType; /*!< Specifies the type of external memory attached to
104 the corresponding memory bank.
105 This parameter can be a value of @ref FMC_Memory_Type */
107 uint32_t FMC_MemoryDataWidth; /*!< Specifies the external memory device width.
108 This parameter can be a value of @ref FMC_NORSRAM_Data_Width */
110 uint32_t FMC_BurstAccessMode; /*!< Enables or disables the burst access mode for Flash memory,
111 valid only with synchronous burst Flash memories.
112 This parameter can be a value of @ref FMC_Burst_Access_Mode */
114 uint32_t FMC_WaitSignalPolarity; /*!< Specifies the wait signal polarity, valid only when accessing
115 the Flash memory in burst mode.
116 This parameter can be a value of @ref FMC_Wait_Signal_Polarity */
118 uint32_t FMC_WrapMode; /*!< Enables or disables the Wrapped burst access mode for Flash
119 memory, valid only when accessing Flash memories in burst mode.
120 This parameter can be a value of @ref FMC_Wrap_Mode */
122 uint32_t FMC_WaitSignalActive; /*!< Specifies if the wait signal is asserted by the memory one
123 clock cycle before the wait state or during the wait state,
124 valid only when accessing memories in burst mode.
125 This parameter can be a value of @ref FMC_Wait_Timing */
127 uint32_t FMC_WriteOperation; /*!< Enables or disables the write operation in the selected bank by the FMC.
128 This parameter can be a value of @ref FMC_Write_Operation */
130 uint32_t FMC_WaitSignal; /*!< Enables or disables the wait state insertion via wait
131 signal, valid for Flash memory access in burst mode.
132 This parameter can be a value of @ref FMC_Wait_Signal */
134 uint32_t FMC_ExtendedMode; /*!< Enables or disables the extended mode.
135 This parameter can be a value of @ref FMC_Extended_Mode */
137 uint32_t FMC_AsynchronousWait; /*!< Enables or disables wait signal during asynchronous transfers,
138 valid only with asynchronous Flash memories.
139 This parameter can be a value of @ref FMC_AsynchronousWait */
141 uint32_t FMC_WriteBurst; /*!< Enables or disables the write burst operation.
142 This parameter can be a value of @ref FMC_Write_Burst */
144 uint32_t FMC_ContinousClock; /*!< Enables or disables the FMC clock output to external memory devices.
145 This parameter is only enabled through the FMC_BCR1 register, and don't care
146 through FMC_BCR2..4 registers.
147 This parameter can be a value of @ref FMC_Continous_Clock */
150 FMC_NORSRAMTimingInitTypeDef* FMC_ReadWriteTimingStruct; /*!< Timing Parameters for write and read access if the Extended Mode is not used*/
152 FMC_NORSRAMTimingInitTypeDef* FMC_WriteTimingStruct; /*!< Timing Parameters for write access if the Extended Mode is used*/
153 }FMC_NORSRAMInitTypeDef;
155 /**
156 * @brief Timing parameters For FMC NAND and PCCARD Banks
158 typedef struct
160 uint32_t FMC_SetupTime; /*!< Defines the number of HCLK cycles to setup address before
161 the command assertion for NAND-Flash read or write access
162 to common/Attribute or I/O memory space (depending on
163 the memory space timing to be configured).
164 This parameter can be a value between 0 and 255.*/
166 uint32_t FMC_WaitSetupTime; /*!< Defines the minimum number of HCLK cycles to assert the
167 command for NAND-Flash read or write access to
168 common/Attribute or I/O memory space (depending on the
169 memory space timing to be configured).
170 This parameter can be a number between 0 and 255 */
172 uint32_t FMC_HoldSetupTime; /*!< Defines the number of HCLK clock cycles to hold address
173 (and data for write access) after the command de-assertion
174 for NAND-Flash read or write access to common/Attribute
175 or I/O memory space (depending on the memory space timing
176 to be configured).
177 This parameter can be a number between 0 and 255 */
179 uint32_t FMC_HiZSetupTime; /*!< Defines the number of HCLK clock cycles during which the
180 databus is kept in HiZ after the start of a NAND-Flash
181 write access to common/Attribute or I/O memory space (depending
182 on the memory space timing to be configured).
183 This parameter can be a number between 0 and 255 */
184 }FMC_NAND_PCCARDTimingInitTypeDef;
186 /**
187 * @brief FMC NAND Init structure definition
189 typedef struct
191 uint32_t FMC_Bank; /*!< Specifies the NAND memory bank that will be used.
192 This parameter can be a value of @ref FMC_NAND_Bank */
194 uint32_t FMC_Waitfeature; /*!< Enables or disables the Wait feature for the NAND Memory Bank.
195 This parameter can be any value of @ref FMC_Wait_feature */
197 uint32_t FMC_MemoryDataWidth; /*!< Specifies the external memory device width.
198 This parameter can be any value of @ref FMC_NAND_Data_Width */
200 uint32_t FMC_ECC; /*!< Enables or disables the ECC computation.
201 This parameter can be any value of @ref FMC_ECC */
203 uint32_t FMC_ECCPageSize; /*!< Defines the page size for the extended ECC.
204 This parameter can be any value of @ref FMC_ECC_Page_Size */
206 uint32_t FMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
207 delay between CLE low and RE low.
208 This parameter can be a value between 0 and 255. */
210 uint32_t FMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
211 delay between ALE low and RE low.
212 This parameter can be a number between 0 and 255 */
214 FMC_NAND_PCCARDTimingInitTypeDef* FMC_CommonSpaceTimingStruct; /*!< FMC Common Space Timing */
216 FMC_NAND_PCCARDTimingInitTypeDef* FMC_AttributeSpaceTimingStruct; /*!< FMC Attribute Space Timing */
217 }FMC_NANDInitTypeDef;
219 /**
220 * @brief FMC PCCARD Init structure definition
223 typedef struct
225 uint32_t FMC_Waitfeature; /*!< Enables or disables the Wait feature for the Memory Bank.
226 This parameter can be any value of @ref FMC_Wait_feature */
228 uint32_t FMC_TCLRSetupTime; /*!< Defines the number of HCLK cycles to configure the
229 delay between CLE low and RE low.
230 This parameter can be a value between 0 and 255. */
232 uint32_t FMC_TARSetupTime; /*!< Defines the number of HCLK cycles to configure the
233 delay between ALE low and RE low.
234 This parameter can be a number between 0 and 255 */
237 FMC_NAND_PCCARDTimingInitTypeDef* FMC_CommonSpaceTimingStruct; /*!< FMC Common Space Timing */
239 FMC_NAND_PCCARDTimingInitTypeDef* FMC_AttributeSpaceTimingStruct; /*!< FMC Attribute Space Timing */
241 FMC_NAND_PCCARDTimingInitTypeDef* FMC_IOSpaceTimingStruct; /*!< FMC IO Space Timing */
242 }FMC_PCCARDInitTypeDef;
244 /**
245 * @brief Timing parameters for FMC SDRAM Banks
248 typedef struct
250 uint32_t FMC_LoadToActiveDelay; /*!< Defines the delay between a Load Mode Register command and
251 an active or Refresh command in number of memory clock cycles.
252 This parameter can be a value between 1 and 16. */
254 uint32_t FMC_ExitSelfRefreshDelay; /*!< Defines the delay from releasing the self refresh command to
255 issuing the Activate command in number of memory clock cycles.
256 This parameter can be a value between 1 and 16. */
258 uint32_t FMC_SelfRefreshTime; /*!< Defines the minimum Self Refresh period in number of memory clock
259 cycles.
260 This parameter can be a value between 1 and 16. */
262 uint32_t FMC_RowCycleDelay; /*!< Defines the delay between the Refresh command and the Activate command
263 and the delay between two consecutive Refresh commands in number of
264 memory clock cycles.
265 This parameter can be a value between 1 and 16. */
267 uint32_t FMC_WriteRecoveryTime; /*!< Defines the Write recovery Time in number of memory clock cycles.
268 This parameter can be a value between 1 and 16. */
270 uint32_t FMC_RPDelay; /*!< Defines the delay between a Precharge Command and an other command
271 in number of memory clock cycles.
272 This parameter can be a value between 1 and 16. */
274 uint32_t FMC_RCDDelay; /*!< Defines the delay between the Activate Command and a Read/Write command
275 in number of memory clock cycles.
276 This parameter can be a value between 1 and 16. */
278 }FMC_SDRAMTimingInitTypeDef;
280 /**
281 * @brief Command parameters for FMC SDRAM Banks
285 typedef struct
287 uint32_t FMC_CommandMode; /*!< Defines the command issued to the SDRAM device.
288 This parameter can be a value of @ref FMC_Command_Mode. */
290 uint32_t FMC_CommandTarget; /*!< Defines which bank (1 or 2) the command will be issued to.
291 This parameter can be a value of @ref FMC_Command_Target. */
293 uint32_t FMC_AutoRefreshNumber; /*!< Defines the number of consecutive auto refresh command issued
294 in auto refresh mode.
295 This parameter can be a value between 1 and 16. */
297 uint32_t FMC_ModeRegisterDefinition; /*!< Defines the SDRAM Mode register content */
299 }FMC_SDRAMCommandTypeDef;
301 /**
302 * @brief FMC SDRAM Init structure definition
305 typedef struct
307 uint32_t FMC_Bank; /*!< Specifies the SDRAM memory bank that will be used.
308 This parameter can be a value of @ref FMC_SDRAM_Bank */
310 uint32_t FMC_ColumnBitsNumber; /*!< Defines the number of bits of column address.
311 This parameter can be a value of @ref FMC_ColumnBits_Number. */
313 uint32_t FMC_RowBitsNumber; /*!< Defines the number of bits of column address..
314 This parameter can be a value of @ref FMC_RowBits_Number. */
316 uint32_t FMC_SDMemoryDataWidth; /*!< Defines the memory device width.
317 This parameter can be a value of @ref FMC_SDMemory_Data_Width. */
319 uint32_t FMC_InternalBankNumber; /*!< Defines the number of bits of column address.
320 This parameter can be of @ref FMC_InternalBank_Number. */
322 uint32_t FMC_CASLatency; /*!< Defines the SDRAM CAS latency in number of memory clock cycles.
323 This parameter can be a value of @ref FMC_CAS_Latency. */
325 uint32_t FMC_WriteProtection; /*!< Enables the SDRAM bank to be accessed in write mode.
326 This parameter can be a value of @ref FMC_Write_Protection. */
328 uint32_t FMC_SDClockPeriod; /*!< Define the SDRAM Clock Period for both SDRAM Banks and they allow to disable
329 the clock before changing frequency.
330 This parameter can be a value of @ref FMC_SDClock_Period. */
332 uint32_t FMC_ReadBurst; /*!< This bit enable the SDRAM controller to anticipate the next read commands
333 during the CAS latency and stores data in the Read FIFO.
334 This parameter can be a value of @ref FMC_Read_Burst. */
336 uint32_t FMC_ReadPipeDelay; /*!< Define the delay in system clock cycles on read data path.
337 This parameter can be a value of @ref FMC_ReadPipe_Delay. */
339 FMC_SDRAMTimingInitTypeDef* FMC_SDRAMTimingStruct; /*!< Timing Parameters for write and read access*/
341 }FMC_SDRAMInitTypeDef;
344 /* Exported constants --------------------------------------------------------*/
346 /** @defgroup FMC_Exported_Constants
347 * @{
350 /** @defgroup FMC_NORSRAM_Bank
351 * @{
353 #define FMC_Bank1_NORSRAM1 ((uint32_t)0x00000000)
354 #define FMC_Bank1_NORSRAM2 ((uint32_t)0x00000002)
355 #define FMC_Bank1_NORSRAM3 ((uint32_t)0x00000004)
356 #define FMC_Bank1_NORSRAM4 ((uint32_t)0x00000006)
358 #define IS_FMC_NORSRAM_BANK(BANK) (((BANK) == FMC_Bank1_NORSRAM1) || \
359 ((BANK) == FMC_Bank1_NORSRAM2) || \
360 ((BANK) == FMC_Bank1_NORSRAM3) || \
361 ((BANK) == FMC_Bank1_NORSRAM4))
363 * @}
366 /** @defgroup FMC_NAND_Bank
367 * @{
369 #define FMC_Bank2_NAND ((uint32_t)0x00000010)
370 #define FMC_Bank3_NAND ((uint32_t)0x00000100)
372 #define IS_FMC_NAND_BANK(BANK) (((BANK) == FMC_Bank2_NAND) || \
373 ((BANK) == FMC_Bank3_NAND))
375 * @}
378 /** @defgroup FMC_PCCARD_Bank
379 * @{
381 #define FMC_Bank4_PCCARD ((uint32_t)0x00001000)
383 * @}
386 /** @defgroup FMC_SDRAM_Bank
387 * @{
389 #define FMC_Bank1_SDRAM ((uint32_t)0x00000000)
390 #define FMC_Bank2_SDRAM ((uint32_t)0x00000001)
392 #define IS_FMC_SDRAM_BANK(BANK) (((BANK) == FMC_Bank1_SDRAM) || \
393 ((BANK) == FMC_Bank2_SDRAM))
396 * @}
400 /** @defgroup FMC_NOR_SRAM_Controller
401 * @{
404 /** @defgroup FMC_Data_Address_Bus_Multiplexing
405 * @{
408 #define FMC_DataAddressMux_Disable ((uint32_t)0x00000000)
409 #define FMC_DataAddressMux_Enable ((uint32_t)0x00000002)
411 #define IS_FMC_MUX(MUX) (((MUX) == FMC_DataAddressMux_Disable) || \
412 ((MUX) == FMC_DataAddressMux_Enable))
414 * @}
417 /** @defgroup FMC_Memory_Type
418 * @{
421 #define FMC_MemoryType_SRAM ((uint32_t)0x00000000)
422 #define FMC_MemoryType_PSRAM ((uint32_t)0x00000004)
423 #define FMC_MemoryType_NOR ((uint32_t)0x00000008)
425 #define IS_FMC_MEMORY(MEMORY) (((MEMORY) == FMC_MemoryType_SRAM) || \
426 ((MEMORY) == FMC_MemoryType_PSRAM)|| \
427 ((MEMORY) == FMC_MemoryType_NOR))
429 * @}
432 /** @defgroup FMC_NORSRAM_Data_Width
433 * @{
436 #define FMC_NORSRAM_MemoryDataWidth_8b ((uint32_t)0x00000000)
437 #define FMC_NORSRAM_MemoryDataWidth_16b ((uint32_t)0x00000010)
438 #define FMC_NORSRAM_MemoryDataWidth_32b ((uint32_t)0x00000020)
440 #define IS_FMC_NORSRAM_MEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_NORSRAM_MemoryDataWidth_8b) || \
441 ((WIDTH) == FMC_NORSRAM_MemoryDataWidth_16b) || \
442 ((WIDTH) == FMC_NORSRAM_MemoryDataWidth_32b))
444 * @}
447 /** @defgroup FMC_Burst_Access_Mode
448 * @{
451 #define FMC_BurstAccessMode_Disable ((uint32_t)0x00000000)
452 #define FMC_BurstAccessMode_Enable ((uint32_t)0x00000100)
454 #define IS_FMC_BURSTMODE(STATE) (((STATE) == FMC_BurstAccessMode_Disable) || \
455 ((STATE) == FMC_BurstAccessMode_Enable))
457 * @}
460 /** @defgroup FMC_AsynchronousWait
461 * @{
463 #define FMC_AsynchronousWait_Disable ((uint32_t)0x00000000)
464 #define FMC_AsynchronousWait_Enable ((uint32_t)0x00008000)
466 #define IS_FMC_ASYNWAIT(STATE) (((STATE) == FMC_AsynchronousWait_Disable) || \
467 ((STATE) == FMC_AsynchronousWait_Enable))
469 * @}
472 /** @defgroup FMC_Wait_Signal_Polarity
473 * @{
475 #define FMC_WaitSignalPolarity_Low ((uint32_t)0x00000000)
476 #define FMC_WaitSignalPolarity_High ((uint32_t)0x00000200)
478 #define IS_FMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FMC_WaitSignalPolarity_Low) || \
479 ((POLARITY) == FMC_WaitSignalPolarity_High))
481 * @}
484 /** @defgroup FMC_Wrap_Mode
485 * @{
487 #define FMC_WrapMode_Disable ((uint32_t)0x00000000)
488 #define FMC_WrapMode_Enable ((uint32_t)0x00000400)
490 #define IS_FMC_WRAP_MODE(MODE) (((MODE) == FMC_WrapMode_Disable) || \
491 ((MODE) == FMC_WrapMode_Enable))
493 * @}
496 /** @defgroup FMC_Wait_Timing
497 * @{
499 #define FMC_WaitSignalActive_BeforeWaitState ((uint32_t)0x00000000)
500 #define FMC_WaitSignalActive_DuringWaitState ((uint32_t)0x00000800)
502 #define IS_FMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FMC_WaitSignalActive_BeforeWaitState) || \
503 ((ACTIVE) == FMC_WaitSignalActive_DuringWaitState))
505 * @}
508 /** @defgroup FMC_Write_Operation
509 * @{
511 #define FMC_WriteOperation_Disable ((uint32_t)0x00000000)
512 #define FMC_WriteOperation_Enable ((uint32_t)0x00001000)
514 #define IS_FMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FMC_WriteOperation_Disable) || \
515 ((OPERATION) == FMC_WriteOperation_Enable))
517 * @}
520 /** @defgroup FMC_Wait_Signal
521 * @{
523 #define FMC_WaitSignal_Disable ((uint32_t)0x00000000)
524 #define FMC_WaitSignal_Enable ((uint32_t)0x00002000)
526 #define IS_FMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FMC_WaitSignal_Disable) || \
527 ((SIGNAL) == FMC_WaitSignal_Enable))
529 * @}
532 /** @defgroup FMC_Extended_Mode
533 * @{
535 #define FMC_ExtendedMode_Disable ((uint32_t)0x00000000)
536 #define FMC_ExtendedMode_Enable ((uint32_t)0x00004000)
538 #define IS_FMC_EXTENDED_MODE(MODE) (((MODE) == FMC_ExtendedMode_Disable) || \
539 ((MODE) == FMC_ExtendedMode_Enable))
541 * @}
544 /** @defgroup FMC_Write_Burst
545 * @{
548 #define FMC_WriteBurst_Disable ((uint32_t)0x00000000)
549 #define FMC_WriteBurst_Enable ((uint32_t)0x00080000)
551 #define IS_FMC_WRITE_BURST(BURST) (((BURST) == FMC_WriteBurst_Disable) || \
552 ((BURST) == FMC_WriteBurst_Enable))
554 * @}
557 /** @defgroup FMC_Continous_Clock
558 * @{
561 #define FMC_CClock_SyncOnly ((uint32_t)0x00000000)
562 #define FMC_CClock_SyncAsync ((uint32_t)0x00100000)
564 #define IS_FMC_CONTINOUS_CLOCK(CCLOCK) (((CCLOCK) == FMC_CClock_SyncOnly) || \
565 ((CCLOCK) == FMC_CClock_SyncAsync))
567 * @}
570 /** @defgroup FMC_Address_Setup_Time
571 * @{
573 #define IS_FMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 15)
575 * @}
578 /** @defgroup FMC_Address_Hold_Time
579 * @{
581 #define IS_FMC_ADDRESS_HOLD_TIME(TIME) (((TIME) > 0) && ((TIME) <= 15))
583 * @}
586 /** @defgroup FMC_Data_Setup_Time
587 * @{
589 #define IS_FMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 255))
591 * @}
594 /** @defgroup FMC_Bus_Turn_around_Duration
595 * @{
597 #define IS_FMC_TURNAROUND_TIME(TIME) ((TIME) <= 15)
599 * @}
602 /** @defgroup FMC_CLK_Division
603 * @{
605 #define IS_FMC_CLK_DIV(DIV) (((DIV) > 0) && ((DIV) <= 15))
607 * @}
610 /** @defgroup FMC_Data_Latency
611 * @{
613 #define IS_FMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 15)
615 * @}
618 /** @defgroup FMC_Access_Mode
619 * @{
621 #define FMC_AccessMode_A ((uint32_t)0x00000000)
622 #define FMC_AccessMode_B ((uint32_t)0x10000000)
623 #define FMC_AccessMode_C ((uint32_t)0x20000000)
624 #define FMC_AccessMode_D ((uint32_t)0x30000000)
626 #define IS_FMC_ACCESS_MODE(MODE) (((MODE) == FMC_AccessMode_A) || \
627 ((MODE) == FMC_AccessMode_B) || \
628 ((MODE) == FMC_AccessMode_C) || \
629 ((MODE) == FMC_AccessMode_D))
631 * @}
635 * @}
638 /** @defgroup FMC_NAND_PCCARD_Controller
639 * @{
642 /** @defgroup FMC_Wait_feature
643 * @{
645 #define FMC_Waitfeature_Disable ((uint32_t)0x00000000)
646 #define FMC_Waitfeature_Enable ((uint32_t)0x00000002)
648 #define IS_FMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FMC_Waitfeature_Disable) || \
649 ((FEATURE) == FMC_Waitfeature_Enable))
651 * @}
654 /** @defgroup FMC_NAND_Data_Width
655 * @{
657 #define FMC_NAND_MemoryDataWidth_8b ((uint32_t)0x00000000)
658 #define FMC_NAND_MemoryDataWidth_16b ((uint32_t)0x00000010)
660 #define IS_FMC_NAND_MEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_NAND_MemoryDataWidth_8b) || \
661 ((WIDTH) == FMC_NAND_MemoryDataWidth_16b))
663 * @}
666 /** @defgroup FMC_ECC
667 * @{
669 #define FMC_ECC_Disable ((uint32_t)0x00000000)
670 #define FMC_ECC_Enable ((uint32_t)0x00000040)
672 #define IS_FMC_ECC_STATE(STATE) (((STATE) == FMC_ECC_Disable) || \
673 ((STATE) == FMC_ECC_Enable))
675 * @}
678 /** @defgroup FMC_ECC_Page_Size
679 * @{
681 #define FMC_ECCPageSize_256Bytes ((uint32_t)0x00000000)
682 #define FMC_ECCPageSize_512Bytes ((uint32_t)0x00020000)
683 #define FMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000)
684 #define FMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000)
685 #define FMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000)
686 #define FMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000)
688 #define IS_FMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FMC_ECCPageSize_256Bytes) || \
689 ((SIZE) == FMC_ECCPageSize_512Bytes) || \
690 ((SIZE) == FMC_ECCPageSize_1024Bytes) || \
691 ((SIZE) == FMC_ECCPageSize_2048Bytes) || \
692 ((SIZE) == FMC_ECCPageSize_4096Bytes) || \
693 ((SIZE) == FMC_ECCPageSize_8192Bytes))
695 * @}
698 /** @defgroup FMC_TCLR_Setup_Time
699 * @{
701 #define IS_FMC_TCLR_TIME(TIME) ((TIME) <= 255)
703 * @}
706 /** @defgroup FMC_TAR_Setup_Time
707 * @{
709 #define IS_FMC_TAR_TIME(TIME) ((TIME) <= 255)
711 * @}
714 /** @defgroup FMC_Setup_Time
715 * @{
717 #define IS_FMC_SETUP_TIME(TIME) ((TIME) <= 255)
719 * @}
722 /** @defgroup FMC_Wait_Setup_Time
723 * @{
725 #define IS_FMC_WAIT_TIME(TIME) ((TIME) <= 255)
727 * @}
730 /** @defgroup FMC_Hold_Setup_Time
731 * @{
733 #define IS_FMC_HOLD_TIME(TIME) ((TIME) <= 255)
735 * @}
738 /** @defgroup FMC_HiZ_Setup_Time
739 * @{
741 #define IS_FMC_HIZ_TIME(TIME) ((TIME) <= 255)
743 * @}
747 * @}
751 /** @defgroup FMC_NOR_SRAM_Controller
752 * @{
755 /** @defgroup FMC_ColumnBits_Number
756 * @{
758 #define FMC_ColumnBits_Number_8b ((uint32_t)0x00000000)
759 #define FMC_ColumnBits_Number_9b ((uint32_t)0x00000001)
760 #define FMC_ColumnBits_Number_10b ((uint32_t)0x00000002)
761 #define FMC_ColumnBits_Number_11b ((uint32_t)0x00000003)
763 #define IS_FMC_COLUMNBITS_NUMBER(COLUMN) (((COLUMN) == FMC_ColumnBits_Number_8b) || \
764 ((COLUMN) == FMC_ColumnBits_Number_9b) || \
765 ((COLUMN) == FMC_ColumnBits_Number_10b) || \
766 ((COLUMN) == FMC_ColumnBits_Number_11b))
769 * @}
772 /** @defgroup FMC_RowBits_Number
773 * @{
775 #define FMC_RowBits_Number_11b ((uint32_t)0x00000000)
776 #define FMC_RowBits_Number_12b ((uint32_t)0x00000004)
777 #define FMC_RowBits_Number_13b ((uint32_t)0x00000008)
779 #define IS_FMC_ROWBITS_NUMBER(ROW) (((ROW) == FMC_RowBits_Number_11b) || \
780 ((ROW) == FMC_RowBits_Number_12b) || \
781 ((ROW) == FMC_RowBits_Number_13b))
784 * @}
787 /** @defgroup FMC_SDMemory_Data_Width
788 * @{
790 #define FMC_SDMemory_Width_8b ((uint32_t)0x00000000)
791 #define FMC_SDMemory_Width_16b ((uint32_t)0x00000010)
792 #define FMC_SDMemory_Width_32b ((uint32_t)0x00000020)
794 #define IS_FMC_SDMEMORY_WIDTH(WIDTH) (((WIDTH) == FMC_SDMemory_Width_8b) || \
795 ((WIDTH) == FMC_SDMemory_Width_16b) || \
796 ((WIDTH) == FMC_SDMemory_Width_32b))
799 * @}
802 /** @defgroup FMC_InternalBank_Number
803 * @{
805 #define FMC_InternalBank_Number_2 ((uint32_t)0x00000000)
806 #define FMC_InternalBank_Number_4 ((uint32_t)0x00000040)
808 #define IS_FMC_INTERNALBANK_NUMBER(NUMBER) (((NUMBER) == FMC_InternalBank_Number_2) || \
809 ((NUMBER) == FMC_InternalBank_Number_4))
812 * @}
816 /** @defgroup FMC_CAS_Latency
817 * @{
819 #define FMC_CAS_Latency_1 ((uint32_t)0x00000080)
820 #define FMC_CAS_Latency_2 ((uint32_t)0x00000100)
821 #define FMC_CAS_Latency_3 ((uint32_t)0x00000180)
823 #define IS_FMC_CAS_LATENCY(LATENCY) (((LATENCY) == FMC_CAS_Latency_1) || \
824 ((LATENCY) == FMC_CAS_Latency_2) || \
825 ((LATENCY) == FMC_CAS_Latency_3))
828 * @}
831 /** @defgroup FMC_Write_Protection
832 * @{
834 #define FMC_Write_Protection_Disable ((uint32_t)0x00000000)
835 #define FMC_Write_Protection_Enable ((uint32_t)0x00000200)
837 #define IS_FMC_WRITE_PROTECTION(WRITE) (((WRITE) == FMC_Write_Protection_Disable) || \
838 ((WRITE) == FMC_Write_Protection_Enable))
841 * @}
845 /** @defgroup FMC_SDClock_Period
846 * @{
848 #define FMC_SDClock_Disable ((uint32_t)0x00000000)
849 #define FMC_SDClock_Period_2 ((uint32_t)0x00000800)
850 #define FMC_SDClock_Period_3 ((uint32_t)0x00000C00)
852 #define IS_FMC_SDCLOCK_PERIOD(PERIOD) (((PERIOD) == FMC_SDClock_Disable) || \
853 ((PERIOD) == FMC_SDClock_Period_2) || \
854 ((PERIOD) == FMC_SDClock_Period_3))
857 * @}
860 /** @defgroup FMC_Read_Burst
861 * @{
863 #define FMC_Read_Burst_Disable ((uint32_t)0x00000000)
864 #define FMC_Read_Burst_Enable ((uint32_t)0x00001000)
866 #define IS_FMC_READ_BURST(RBURST) (((RBURST) == FMC_Read_Burst_Disable) || \
867 ((RBURST) == FMC_Read_Burst_Enable))
870 * @}
873 /** @defgroup FMC_ReadPipe_Delay
874 * @{
876 #define FMC_ReadPipe_Delay_0 ((uint32_t)0x00000000)
877 #define FMC_ReadPipe_Delay_1 ((uint32_t)0x00002000)
878 #define FMC_ReadPipe_Delay_2 ((uint32_t)0x00004000)
880 #define IS_FMC_READPIPE_DELAY(DELAY) (((DELAY) == FMC_ReadPipe_Delay_0) || \
881 ((DELAY) == FMC_ReadPipe_Delay_1) || \
882 ((DELAY) == FMC_ReadPipe_Delay_2))
885 * @}
888 /** @defgroup FMC_LoadToActive_Delay
889 * @{
891 #define IS_FMC_LOADTOACTIVE_DELAY(DELAY) (((DELAY) > 0) && ((DELAY) <= 16))
893 * @}
896 /** @defgroup FMC_ExitSelfRefresh_Delay
897 * @{
899 #define IS_FMC_EXITSELFREFRESH_DELAY(DELAY) (((DELAY) > 0) && ((DELAY) <= 16))
901 * @}
904 /** @defgroup FMC_SelfRefresh_Time
905 * @{
907 #define IS_FMC_SELFREFRESH_TIME(TIME) (((TIME) > 0) && ((TIME) <= 16))
909 * @}
912 /** @defgroup FMC_RowCycle_Delay
913 * @{
915 #define IS_FMC_ROWCYCLE_DELAY(DELAY) (((DELAY) > 0) && ((DELAY) <= 16))
917 * @}
920 /** @defgroup FMC_Write_Recovery_Time
921 * @{
923 #define IS_FMC_WRITE_RECOVERY_TIME(TIME) (((TIME) > 0) && ((TIME) <= 16))
925 * @}
928 /** @defgroup FMC_RP_Delay
929 * @{
931 #define IS_FMC_RP_DELAY(DELAY) (((DELAY) > 0) && ((DELAY) <= 16))
933 * @}
936 /** @defgroup FMC_RCD_Delay
937 * @{
939 #define IS_FMC_RCD_DELAY(DELAY) (((DELAY) > 0) && ((DELAY) <= 16))
942 * @}
945 /** @defgroup FMC_Command_Mode
946 * @{
948 #define FMC_Command_Mode_normal ((uint32_t)0x00000000)
949 #define FMC_Command_Mode_CLK_Enabled ((uint32_t)0x00000001)
950 #define FMC_Command_Mode_PALL ((uint32_t)0x00000002)
951 #define FMC_Command_Mode_AutoRefresh ((uint32_t)0x00000003)
952 #define FMC_Command_Mode_LoadMode ((uint32_t)0x00000004)
953 #define FMC_Command_Mode_Selfrefresh ((uint32_t)0x00000005)
954 #define FMC_Command_Mode_PowerDown ((uint32_t)0x00000006)
956 #define IS_FMC_COMMAND_MODE(COMMAND) (((COMMAND) == FMC_Command_Mode_normal) || \
957 ((COMMAND) == FMC_Command_Mode_CLK_Enabled) || \
958 ((COMMAND) == FMC_Command_Mode_PALL) || \
959 ((COMMAND) == FMC_Command_Mode_AutoRefresh) || \
960 ((COMMAND) == FMC_Command_Mode_LoadMode) || \
961 ((COMMAND) == FMC_Command_Mode_Selfrefresh) || \
962 ((COMMAND) == FMC_Command_Mode_PowerDown))
965 * @}
968 /** @defgroup FMC_Command_Target
969 * @{
971 #define FMC_Command_Target_bank2 ((uint32_t)0x00000008)
972 #define FMC_Command_Target_bank1 ((uint32_t)0x00000010)
973 #define FMC_Command_Target_bank1_2 ((uint32_t)0x00000018)
975 #define IS_FMC_COMMAND_TARGET(TARGET) (((TARGET) == FMC_Command_Target_bank1) || \
976 ((TARGET) == FMC_Command_Target_bank2) || \
977 ((TARGET) == FMC_Command_Target_bank1_2))
980 * @}
983 /** @defgroup FMC_AutoRefresh_Number
984 * @{
986 #define IS_FMC_AUTOREFRESH_NUMBER(NUMBER) (((NUMBER) > 0) && ((NUMBER) <= 16))
989 * @}
992 /** @defgroup FMC_ModeRegister_Definition
993 * @{
995 #define IS_FMC_MODE_REGISTER(CONTENT) ((CONTENT) <= 8191)
998 * @}
1002 /** @defgroup FMC_Mode_Status
1003 * @{
1005 #define FMC_NormalMode_Status ((uint32_t)0x00000000)
1006 #define FMC_SelfRefreshMode_Status FMC_SDSR_MODES1_0
1007 #define FMC_PowerDownMode_Status FMC_SDSR_MODES1_1
1009 #define IS_FMC_MODE_STATUS(STATUS) (((STATUS) == FMC_NormalMode_Status) || \
1010 ((STATUS) == FMC_SelfRefreshMode_Status) || \
1011 ((STATUS) == FMC_PowerDownMode_Status))
1015 * @}
1019 * @}
1022 /** @defgroup FMC_Interrupt_sources
1023 * @{
1025 #define FMC_IT_RisingEdge ((uint32_t)0x00000008)
1026 #define FMC_IT_Level ((uint32_t)0x00000010)
1027 #define FMC_IT_FallingEdge ((uint32_t)0x00000020)
1028 #define FMC_IT_Refresh ((uint32_t)0x00004000)
1030 #define IS_FMC_IT(IT) ((((IT) & (uint32_t)0xFFFFBFC7) == 0x00000000) && ((IT) != 0x00000000))
1031 #define IS_FMC_GET_IT(IT) (((IT) == FMC_IT_RisingEdge) || \
1032 ((IT) == FMC_IT_Level) || \
1033 ((IT) == FMC_IT_FallingEdge) || \
1034 ((IT) == FMC_IT_Refresh))
1036 #define IS_FMC_IT_BANK(BANK) (((BANK) == FMC_Bank2_NAND) || \
1037 ((BANK) == FMC_Bank3_NAND) || \
1038 ((BANK) == FMC_Bank4_PCCARD) || \
1039 ((BANK) == FMC_Bank1_SDRAM) || \
1040 ((BANK) == FMC_Bank2_SDRAM))
1042 * @}
1045 /** @defgroup FMC_Flags
1046 * @{
1048 #define FMC_FLAG_RisingEdge ((uint32_t)0x00000001)
1049 #define FMC_FLAG_Level ((uint32_t)0x00000002)
1050 #define FMC_FLAG_FallingEdge ((uint32_t)0x00000004)
1051 #define FMC_FLAG_FEMPT ((uint32_t)0x00000040)
1052 #define FMC_FLAG_Refresh FMC_SDSR_RE
1053 #define FMC_FLAG_Busy FMC_SDSR_BUSY
1055 #define IS_FMC_GET_FLAG(FLAG) (((FLAG) == FMC_FLAG_RisingEdge) || \
1056 ((FLAG) == FMC_FLAG_Level) || \
1057 ((FLAG) == FMC_FLAG_FallingEdge) || \
1058 ((FLAG) == FMC_FLAG_FEMPT) || \
1059 ((FLAG) == FMC_FLAG_Refresh) || \
1060 ((FLAG) == FMC_SDSR_BUSY))
1062 #define IS_FMC_GETFLAG_BANK(BANK) (((BANK) == FMC_Bank2_NAND) || \
1063 ((BANK) == FMC_Bank3_NAND) || \
1064 ((BANK) == FMC_Bank4_PCCARD) || \
1065 ((BANK) == FMC_Bank1_SDRAM) || \
1066 ((BANK) == FMC_Bank2_SDRAM) || \
1067 ((BANK) == (FMC_Bank1_SDRAM | FMC_Bank2_SDRAM)))
1069 #define IS_FMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
1073 * @}
1076 /** @defgroup FMC_Refresh_count
1077 * @{
1079 #define IS_FMC_REFRESH_COUNT(COUNT) ((COUNT) <= 8191)
1082 * @}
1086 * @}
1090 /* Exported macro ------------------------------------------------------------*/
1091 /* Exported functions --------------------------------------------------------*/
1093 /* NOR/SRAM Controller functions **********************************************/
1094 void FMC_NORSRAMDeInit(uint32_t FMC_Bank);
1095 void FMC_NORSRAMInit(FMC_NORSRAMInitTypeDef* FMC_NORSRAMInitStruct);
1096 void FMC_NORSRAMStructInit(FMC_NORSRAMInitTypeDef* FMC_NORSRAMInitStruct);
1097 void FMC_NORSRAMCmd(uint32_t FMC_Bank, FunctionalState NewState);
1099 /* NAND Controller functions **************************************************/
1100 void FMC_NANDDeInit(uint32_t FMC_Bank);
1101 void FMC_NANDInit(FMC_NANDInitTypeDef* FMC_NANDInitStruct);
1102 void FMC_NANDStructInit(FMC_NANDInitTypeDef* FMC_NANDInitStruct);
1103 void FMC_NANDCmd(uint32_t FMC_Bank, FunctionalState NewState);
1104 void FMC_NANDECCCmd(uint32_t FMC_Bank, FunctionalState NewState);
1105 uint32_t FMC_GetECC(uint32_t FMC_Bank);
1107 /* PCCARD Controller functions ************************************************/
1108 void FMC_PCCARDDeInit(void);
1109 void FMC_PCCARDInit(FMC_PCCARDInitTypeDef* FMC_PCCARDInitStruct);
1110 void FMC_PCCARDStructInit(FMC_PCCARDInitTypeDef* FMC_PCCARDInitStruct);
1111 void FMC_PCCARDCmd(FunctionalState NewState);
1113 /* SDRAM Controller functions ************************************************/
1114 void FMC_SDRAMDeInit(uint32_t FMC_Bank);
1115 void FMC_SDRAMInit(FMC_SDRAMInitTypeDef* FMC_SDRAMInitStruct);
1116 void FMC_SDRAMStructInit(FMC_SDRAMInitTypeDef* FMC_SDRAMInitStruct);
1117 void FMC_SDRAMCmdConfig(FMC_SDRAMCommandTypeDef* FMC_SDRAMCommandStruct);
1118 uint32_t FMC_GetModeStatus(uint32_t SDRAM_Bank);
1119 void FMC_SetRefreshCount(uint32_t FMC_Count);
1120 void FMC_SetAutoRefresh_Number(uint32_t FMC_Number);
1121 void FMC_SDRAMWriteProtectionConfig(uint32_t SDRAM_Bank, FunctionalState NewState);
1123 /* Interrupts and flags management functions **********************************/
1124 void FMC_ITConfig(uint32_t FMC_Bank, uint32_t FMC_IT, FunctionalState NewState);
1125 FlagStatus FMC_GetFlagStatus(uint32_t FMC_Bank, uint32_t FMC_FLAG);
1126 void FMC_ClearFlag(uint32_t FMC_Bank, uint32_t FMC_FLAG);
1127 ITStatus FMC_GetITStatus(uint32_t FMC_Bank, uint32_t FMC_IT);
1128 void FMC_ClearITPendingBit(uint32_t FMC_Bank, uint32_t FMC_IT);
1130 #ifdef __cplusplus
1132 #endif
1134 #endif /*__STM32F4xx_FMC_H */
1136 * @}
1140 * @}
1143 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/