stm32f4xx_dsi.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_dsi.h
  4. * @author MCD Application Team
  5. * @version V1.8.0
  6. * @date 04-November-2016
  7. * @brief Header file of DSI module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
  12. *
  13. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  14. * You may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at:
  16. *
  17. * http://www.st.com/software_license_agreement_liberty_v2
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. *
  25. ******************************************************************************
  26. */
  27. /* Define to prevent recursive inclusion -------------------------------------*/
  28. #ifndef __STM32F4xx_DSI_H
  29. #define __STM32F4xx_DSI_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* Includes ------------------------------------------------------------------*/
  34. #include "stm32f4xx.h"
  35. /** @addtogroup STM32F4xx_StdPeriph_Driver
  36. * @{
  37. */
  38. /** @defgroup DSI
  39. * @{
  40. */
  41. #if defined(STM32F469_479xx)
  42. /* Exported types ------------------------------------------------------------*/
  43. /**
  44. * @brief DSI Init Structure definition
  45. */
  46. typedef struct
  47. {
  48. uint32_t AutomaticClockLaneControl; /*!< Automatic clock lane control
  49. This parameter can be any value of @ref DSI_Automatic_Clk_Lane_Control */
  50. uint32_t TXEscapeCkdiv; /*!< TX Escape clock division
  51. The values 0 and 1 stop the TX_ESC clock generation */
  52. uint32_t NumberOfLanes; /*!< Number of lanes
  53. This parameter can be any value of @ref DSI_Number_Of_Lanes */
  54. }DSI_InitTypeDef;
  55. /**
  56. * @brief DSI PLL Clock structure definition
  57. */
  58. typedef struct
  59. {
  60. uint32_t PLLNDIV; /*!< PLL Loop Division Factor
  61. This parameter must be a value between 10 and 125 */
  62. uint32_t PLLIDF; /*!< PLL Input Division Factor
  63. This parameter can be any value of @ref DSI_PLL_IDF */
  64. uint32_t PLLODF; /*!< PLL Output Division Factor
  65. This parameter can be any value of @ref DSI_PLL_ODF */
  66. }DSI_PLLInitTypeDef;
  67. /**
  68. * @brief DSI Video mode configuration
  69. */
  70. typedef struct
  71. {
  72. uint32_t VirtualChannelID; /*!< Virtual channel ID */
  73. uint32_t ColorCoding; /*!< Color coding for LTDC interface
  74. This parameter can be any value of @ref DSI_Color_Coding */
  75. uint32_t LooselyPacked; /*!< Enable or disable loosely packed stream (needed only when using
  76. 18-bit configuration).
  77. This parameter can be any value of @ref DSI_LooselyPacked */
  78. uint32_t Mode; /*!< Video mode type
  79. This parameter can be any value of @ref DSI_Video_Mode_Type */
  80. uint32_t PacketSize; /*!< Video packet size */
  81. uint32_t NumberOfChunks; /*!< Number of chunks */
  82. uint32_t NullPacketSize; /*!< Null packet size */
  83. uint32_t HSPolarity; /*!< HSYNC pin polarity
  84. This parameter can be any value of @ref DSI_HSYNC_Polarity */
  85. uint32_t VSPolarity; /*!< VSYNC pin polarity
  86. This parameter can be any value of @ref DSI_VSYNC_Polarity */
  87. uint32_t DEPolarity; /*!< Data Enable pin polarity
  88. This parameter can be any value of @ref DSI_DATA_ENABLE_Polarity */
  89. uint32_t HorizontalSyncActive; /*!< Horizontal synchronism active duration (in lane byte clock cycles) */
  90. uint32_t HorizontalBackPorch; /*!< Horizontal back-porch duration (in lane byte clock cycles) */
  91. uint32_t HorizontalLine; /*!< Horizontal line duration (in lane byte clock cycles) */
  92. uint32_t VerticalSyncActive; /*!< Vertical synchronism active duration */
  93. uint32_t VerticalBackPorch; /*!< Vertical back-porch duration */
  94. uint32_t VerticalFrontPorch; /*!< Vertical front-porch duration */
  95. uint32_t VerticalActive; /*!< Vertical active duration */
  96. uint32_t LPCommandEnable; /*!< Low-power command enable
  97. This parameter can be any value of @ref DSI_LP_Command */
  98. uint32_t LPLargestPacketSize; /*!< The size, in bytes, of the low power largest packet that
  99. can fit in a line during VSA, VBP and VFP regions */
  100. uint32_t LPVACTLargestPacketSize; /*!< The size, in bytes, of the low power largest packet that
  101. can fit in a line during VACT region */
  102. uint32_t LPHorizontalFrontPorchEnable; /*!< Low-power horizontal front-porch enable
  103. This parameter can be any value of @ref DSI_LP_HFP */
  104. uint32_t LPHorizontalBackPorchEnable; /*!< Low-power horizontal back-porch enable
  105. This parameter can be any value of @ref DSI_LP_HBP */
  106. uint32_t LPVerticalActiveEnable; /*!< Low-power vertical active enable
  107. This parameter can be any value of @ref DSI_LP_VACT */
  108. uint32_t LPVerticalFrontPorchEnable; /*!< Low-power vertical front-porch enable
  109. This parameter can be any value of @ref DSI_LP_VFP */
  110. uint32_t LPVerticalBackPorchEnable; /*!< Low-power vertical back-porch enable
  111. This parameter can be any value of @ref DSI_LP_VBP */
  112. uint32_t LPVerticalSyncActiveEnable; /*!< Low-power vertical sync active enable
  113. This parameter can be any value of @ref DSI_LP_VSYNC */
  114. uint32_t FrameBTAAcknowledgeEnable; /*!< Frame bus-turn-around acknowledge enable
  115. This parameter can be any value of @ref DSI_FBTA_acknowledge */
  116. }DSI_VidCfgTypeDef;
  117. /**
  118. * @brief DSI Adapted command mode configuration
  119. */
  120. typedef struct
  121. {
  122. uint32_t VirtualChannelID; /*!< Virtual channel ID */
  123. uint32_t ColorCoding; /*!< Color coding for LTDC interface
  124. This parameter can be any value of @ref DSI_Color_Coding */
  125. uint32_t CommandSize; /*!< Maximum allowed size for an LTDC write memory command, measured in
  126. pixels. This parameter can be any value between 0x00 and 0xFFFF */
  127. uint32_t TearingEffectSource; /*!< Tearing effect source
  128. This parameter can be any value of @ref DSI_TearingEffectSource */
  129. uint32_t TearingEffectPolarity; /*!< Tearing effect pin polarity
  130. This parameter can be any value of @ref DSI_TearingEffectPolarity */
  131. uint32_t HSPolarity; /*!< HSYNC pin polarity
  132. This parameter can be any value of @ref DSI_HSYNC_Polarity */
  133. uint32_t VSPolarity; /*!< VSYNC pin polarity
  134. This parameter can be any value of @ref DSI_VSYNC_Polarity */
  135. uint32_t DEPolarity; /*!< Data Enable pin polarity
  136. This parameter can be any value of @ref DSI_DATA_ENABLE_Polarity */
  137. uint32_t VSyncPol; /*!< VSync edge on which the LTDC is halted
  138. This parameter can be any value of @ref DSI_Vsync_Polarity */
  139. uint32_t AutomaticRefresh; /*!< Automatic refresh mode
  140. This parameter can be any value of @ref DSI_AutomaticRefresh */
  141. uint32_t TEAcknowledgeRequest; /*!< Tearing Effect Acknowledge Request Enable
  142. This parameter can be any value of @ref DSI_TE_AcknowledgeRequest */
  143. }DSI_CmdCfgTypeDef;
  144. /**
  145. * @brief DSI command transmission mode configuration
  146. */
  147. typedef struct
  148. {
  149. uint32_t LPGenShortWriteNoP; /*!< Generic Short Write Zero parameters Transmission
  150. This parameter can be any value of @ref DSI_LP_LPGenShortWriteNoP */
  151. uint32_t LPGenShortWriteOneP; /*!< Generic Short Write One parameter Transmission
  152. This parameter can be any value of @ref DSI_LP_LPGenShortWriteOneP */
  153. uint32_t LPGenShortWriteTwoP; /*!< Generic Short Write Two parameters Transmission
  154. This parameter can be any value of @ref DSI_LP_LPGenShortWriteTwoP */
  155. uint32_t LPGenShortReadNoP; /*!< Generic Short Read Zero parameters Transmission
  156. This parameter can be any value of @ref DSI_LP_LPGenShortReadNoP */
  157. uint32_t LPGenShortReadOneP; /*!< Generic Short Read One parameter Transmission
  158. This parameter can be any value of @ref DSI_LP_LPGenShortReadOneP */
  159. uint32_t LPGenShortReadTwoP; /*!< Generic Short Read Two parameters Transmission
  160. This parameter can be any value of @ref DSI_LP_LPGenShortReadTwoP */
  161. uint32_t LPGenLongWrite; /*!< Generic Long Write Transmission
  162. This parameter can be any value of @ref DSI_LP_LPGenLongWrite */
  163. uint32_t LPDcsShortWriteNoP; /*!< DCS Short Write Zero parameters Transmission
  164. This parameter can be any value of @ref DSI_LP_LPDcsShortWriteNoP */
  165. uint32_t LPDcsShortWriteOneP; /*!< DCS Short Write One parameter Transmission
  166. This parameter can be any value of @ref DSI_LP_LPDcsShortWriteOneP */
  167. uint32_t LPDcsShortReadNoP; /*!< DCS Short Read Zero parameters Transmission
  168. This parameter can be any value of @ref DSI_LP_LPDcsShortReadNoP */
  169. uint32_t LPDcsLongWrite; /*!< DCS Long Write Transmission
  170. This parameter can be any value of @ref DSI_LP_LPDcsLongWrite */
  171. uint32_t LPMaxReadPacket; /*!< Maximum Read Packet Size Transmission
  172. This parameter can be any value of @ref DSI_LP_LPMaxReadPacket */
  173. uint32_t AcknowledgeRequest; /*!< Acknowledge Request Enable
  174. This parameter can be any value of @ref DSI_AcknowledgeRequest */
  175. }DSI_LPCmdTypeDef;
  176. /**
  177. * @brief DSI PHY Timings definition
  178. */
  179. typedef struct
  180. {
  181. uint32_t ClockLaneHS2LPTime; /*!< The maximum time that the D-PHY clock lane takes to go from high-speed
  182. to low-power transmission */
  183. uint32_t ClockLaneLP2HSTime; /*!< The maximum time that the D-PHY clock lane takes to go from low-power
  184. to high-speed transmission */
  185. uint32_t DataLaneHS2LPTime; /*!< The maximum time that the D-PHY data lanes takes to go from high-speed
  186. to low-power transmission */
  187. uint32_t DataLaneLP2HSTime; /*!< The maximum time that the D-PHY data lanes takes to go from low-power
  188. to high-speed transmission */
  189. uint32_t DataLaneMaxReadTime; /*!< The maximum time required to perform a read command */
  190. uint32_t StopWaitTime; /*!< The minimum wait period to request a High-Speed transmission after the
  191. Stop state */
  192. }DSI_PHY_TimerTypeDef;
  193. /**
  194. * @brief DSI HOST Timeouts definition
  195. */
  196. typedef struct
  197. {
  198. uint32_t TimeoutCkdiv; /*!< Time-out clock division */
  199. uint32_t HighSpeedTransmissionTimeout; /*!< High-speed transmission time-out */
  200. uint32_t LowPowerReceptionTimeout; /*!< Low-power reception time-out */
  201. uint32_t HighSpeedReadTimeout; /*!< High-speed read time-out */
  202. uint32_t LowPowerReadTimeout; /*!< Low-power read time-out */
  203. uint32_t HighSpeedWriteTimeout; /*!< High-speed write time-out */
  204. uint32_t HighSpeedWritePrespMode; /*!< High-speed write presp mode
  205. This parameter can be any value of @ref DSI_HS_PrespMode */
  206. uint32_t LowPowerWriteTimeout; /*!< Low-speed write time-out */
  207. uint32_t BTATimeout; /*!< BTA time-out */
  208. }DSI_HOST_TimeoutTypeDef;
  209. /* Exported constants --------------------------------------------------------*/
  210. /** @defgroup DSI_DCS_Command
  211. * @{
  212. */
  213. #define DSI_ENTER_IDLE_MODE 0x39
  214. #define DSI_ENTER_INVERT_MODE 0x21
  215. #define DSI_ENTER_NORMAL_MODE 0x13
  216. #define DSI_ENTER_PARTIAL_MODE 0x12
  217. #define DSI_ENTER_SLEEP_MODE 0x10
  218. #define DSI_EXIT_IDLE_MODE 0x38
  219. #define DSI_EXIT_INVERT_MODE 0x20
  220. #define DSI_EXIT_SLEEP_MODE 0x11
  221. #define DSI_GET_3D_CONTROL 0x3F
  222. #define DSI_GET_ADDRESS_MODE 0x0B
  223. #define DSI_GET_BLUE_CHANNEL 0x08
  224. #define DSI_GET_DIAGNOSTIC_RESULT 0x0F
  225. #define DSI_GET_DISPLAY_MODE 0x0D
  226. #define DSI_GET_GREEN_CHANNEL 0x07
  227. #define DSI_GET_PIXEL_FORMAT 0x0C
  228. #define DSI_GET_POWER_MODE 0x0A
  229. #define DSI_GET_RED_CHANNEL 0x06
  230. #define DSI_GET_SCANLINE 0x45
  231. #define DSI_GET_SIGNAL_MODE 0x0E
  232. #define DSI_NOP 0x00
  233. #define DSI_READ_DDB_CONTINUE 0xA8
  234. #define DSI_READ_DDB_START 0xA1
  235. #define DSI_READ_MEMORY_CONTINUE 0x3E
  236. #define DSI_READ_MEMORY_START 0x2E
  237. #define DSI_SET_3D_CONTROL 0x3D
  238. #define DSI_SET_ADDRESS_MODE 0x36
  239. #define DSI_SET_COLUMN_ADDRESS 0x2A
  240. #define DSI_SET_DISPLAY_OFF 0x28
  241. #define DSI_SET_DISPLAY_ON 0x29
  242. #define DSI_SET_GAMMA_CURVE 0x26
  243. #define DSI_SET_PAGE_ADDRESS 0x2B
  244. #define DSI_SET_PARTIAL_COLUMNS 0x31
  245. #define DSI_SET_PARTIAL_ROWS 0x30
  246. #define DSI_SET_PIXEL_FORMAT 0x3A
  247. #define DSI_SET_SCROLL_AREA 0x33
  248. #define DSI_SET_SCROLL_START 0x37
  249. #define DSI_SET_TEAR_OFF 0x34
  250. #define DSI_SET_TEAR_ON 0x35
  251. #define DSI_SET_TEAR_SCANLINE 0x44
  252. #define DSI_SET_VSYNC_TIMING 0x40
  253. #define DSI_SOFT_RESET 0x01
  254. #define DSI_WRITE_LUT 0x2D
  255. #define DSI_WRITE_MEMORY_CONTINUE 0x3C
  256. #define DSI_WRITE_MEMORY_START 0x2C
  257. /**
  258. * @}
  259. */
  260. /** @defgroup DSI_Video_Mode_Type
  261. * @{
  262. */
  263. #define DSI_VID_MODE_NB_PULSES 0
  264. #define DSI_VID_MODE_NB_EVENTS 1
  265. #define DSI_VID_MODE_BURST 2
  266. #define IS_DSI_VIDEO_MODE_TYPE(VideoModeType) (((VideoModeType) == DSI_VID_MODE_NB_PULSES) || \
  267. ((VideoModeType) == DSI_VID_MODE_NB_EVENTS) || \
  268. ((VideoModeType) == DSI_VID_MODE_BURST))
  269. /**
  270. * @}
  271. */
  272. /** @defgroup DSI_Color_Mode
  273. * @{
  274. */
  275. #define DSI_COLOR_MODE_FULL 0
  276. #define DSI_COLOR_MODE_EIGHT DSI_WCR_COLM
  277. #define IS_DSI_COLOR_MODE(ColorMode) (((ColorMode) == DSI_COLOR_MODE_FULL) || ((ColorMode) == DSI_COLOR_MODE_EIGHT))
  278. /**
  279. * @}
  280. */
  281. /** @defgroup DSI_ShutDown
  282. * @{
  283. */
  284. #define DSI_DISPLAY_ON 0
  285. #define DSI_DISPLAY_OFF DSI_WCR_SHTDN
  286. #define IS_DSI_SHUT_DOWN(ShutDown) (((ShutDown) == DSI_DISPLAY_ON) || ((ShutDown) == DSI_DISPLAY_OFF))
  287. /**
  288. * @}
  289. */
  290. /** @defgroup DSI_LP_Command
  291. * @{
  292. */
  293. #define DSI_LP_COMMAND_DISABLE 0
  294. #define DSI_LP_COMMAND_ENABLE DSI_VMCR_LPCE
  295. #define IS_DSI_LP_COMMAND(LPCommand) (((LPCommand) == DSI_LP_COMMAND_DISABLE) || ((LPCommand) == DSI_LP_COMMAND_ENABLE))
  296. /**
  297. * @}
  298. */
  299. /** @defgroup DSI_LP_HFP
  300. * @{
  301. */
  302. #define DSI_LP_HFP_DISABLE 0
  303. #define DSI_LP_HFP_ENABLE DSI_VMCR_LPHFPE
  304. #define IS_DSI_LP_HFP(LPHFP) (((LPHFP) == DSI_LP_HFP_DISABLE) || ((LPHFP) == DSI_LP_HFP_ENABLE))
  305. /**
  306. * @}
  307. */
  308. /** @defgroup DSI_LP_HBP
  309. * @{
  310. */
  311. #define DSI_LP_HBP_DISABLE 0
  312. #define DSI_LP_HBP_ENABLE DSI_VMCR_LPHBPE
  313. #define IS_DSI_LP_HBP(LPHBP) (((LPHBP) == DSI_LP_HBP_DISABLE) || ((LPHBP) == DSI_LP_HBP_ENABLE))
  314. /**
  315. * @}
  316. */
  317. /** @defgroup DSI_LP_VACT
  318. * @{
  319. */
  320. #define DSI_LP_VACT_DISABLE 0
  321. #define DSI_LP_VACT_ENABLE DSI_VMCR_LPVAE
  322. #define IS_DSI_LP_VACTIVE(LPVActive) (((LPVActive) == DSI_LP_VACT_DISABLE) || ((LPVActive) == DSI_LP_VACT_ENABLE))
  323. /**
  324. * @}
  325. */
  326. /** @defgroup DSI_LP_VFP
  327. * @{
  328. */
  329. #define DSI_LP_VFP_DISABLE 0
  330. #define DSI_LP_VFP_ENABLE DSI_VMCR_LPVFPE
  331. #define IS_DSI_LP_VFP(LPVFP) (((LPVFP) == DSI_LP_VFP_DISABLE) || ((LPVFP) == DSI_LP_VFP_ENABLE))
  332. /**
  333. * @}
  334. */
  335. /** @defgroup DSI_LP_VBP
  336. * @{
  337. */
  338. #define DSI_LP_VBP_DISABLE 0
  339. #define DSI_LP_VBP_ENABLE DSI_VMCR_LPVBPE
  340. #define IS_DSI_LP_VBP(LPVBP) (((LPVBP) == DSI_LP_VBP_DISABLE) || ((LPVBP) == DSI_LP_VBP_ENABLE))
  341. /**
  342. * @}
  343. */
  344. /** @defgroup DSI_LP_VSYNC
  345. * @{
  346. */
  347. #define DSI_LP_VSYNC_DISABLE 0
  348. #define DSI_LP_VSYNC_ENABLE DSI_VMCR_LPVSAE
  349. #define IS_DSI_LP_VSYNC(LPVSYNC) (((LPVSYNC) == DSI_LP_VSYNC_DISABLE) || ((LPVSYNC) == DSI_LP_VSYNC_ENABLE))
  350. /**
  351. * @}
  352. */
  353. /** @defgroup DSI_FBTA_acknowledge
  354. * @{
  355. */
  356. #define DSI_FBTAA_DISABLE 0
  357. #define DSI_FBTAA_ENABLE DSI_VMCR_FBTAAE
  358. #define IS_DSI_FBTAA(FrameBTAAcknowledge) (((FrameBTAAcknowledge) == DSI_FBTAA_DISABLE) || ((FrameBTAAcknowledge) == DSI_FBTAA_ENABLE))
  359. /**
  360. * @}
  361. */
  362. /** @defgroup DSI_TearingEffectSource
  363. * @{
  364. */
  365. #define DSI_TE_DSILINK 0
  366. #define DSI_TE_EXTERNAL DSI_WCFGR_TESRC
  367. #define IS_DSI_TE_SOURCE(TESource) (((TESource) == DSI_TE_DSILINK) || ((TESource) == DSI_TE_EXTERNAL))
  368. /**
  369. * @}
  370. */
  371. /** @defgroup DSI_TearingEffectPolarity
  372. * @{
  373. */
  374. #define DSI_TE_RISING_EDGE 0
  375. #define DSI_TE_FALLING_EDGE DSI_WCFGR_TEPOL
  376. #define IS_DSI_TE_POLARITY(TEPolarity) (((TEPolarity) == DSI_TE_RISING_EDGE) || ((TEPolarity) == DSI_TE_FALLING_EDGE))
  377. /**
  378. * @}
  379. */
  380. /** @defgroup DSI_Vsync_Polarity
  381. * @{
  382. */
  383. #define DSI_VSYNC_FALLING 0
  384. #define DSI_VSYNC_RISING DSI_WCFGR_VSPOL
  385. #define IS_DSI_VS_POLARITY(VSPolarity) (((VSPolarity) == DSI_VSYNC_FALLING) || ((VSPolarity) == DSI_VSYNC_RISING))
  386. /**
  387. * @}
  388. */
  389. /** @defgroup DSI_AutomaticRefresh
  390. * @{
  391. */
  392. #define DSI_AR_DISABLE 0
  393. #define DSI_AR_ENABLE DSI_WCFGR_AR
  394. #define IS_DSI_AUTOMATIC_REFRESH(AutomaticRefresh) (((AutomaticRefresh) == DSI_AR_DISABLE) || ((AutomaticRefresh) == DSI_AR_ENABLE))
  395. /**
  396. * @}
  397. */
  398. /** @defgroup DSI_TE_AcknowledgeRequest
  399. * @{
  400. */
  401. #define DSI_TE_ACKNOWLEDGE_DISABLE 0
  402. #define DSI_TE_ACKNOWLEDGE_ENABLE DSI_CMCR_TEARE
  403. #define IS_DSI_TE_ACK_REQUEST(TEAcknowledgeRequest) (((TEAcknowledgeRequest) == DSI_TE_ACKNOWLEDGE_DISABLE) || ((TEAcknowledgeRequest) == DSI_TE_ACKNOWLEDGE_ENABLE))
  404. /**
  405. * @}
  406. */
  407. /** @defgroup DSI_AcknowledgeRequest
  408. * @{
  409. */
  410. #define DSI_ACKNOWLEDGE_DISABLE 0
  411. #define DSI_ACKNOWLEDGE_ENABLE DSI_CMCR_ARE
  412. #define IS_DSI_ACK_REQUEST(AcknowledgeRequest) (((AcknowledgeRequest) == DSI_ACKNOWLEDGE_DISABLE) || ((AcknowledgeRequest) == DSI_ACKNOWLEDGE_ENABLE))
  413. /**
  414. * @}
  415. */
  416. /** @defgroup DSI_LP_LPGenShortWriteNoP
  417. * @{
  418. */
  419. #define DSI_LP_GSW0P_DISABLE 0
  420. #define DSI_LP_GSW0P_ENABLE DSI_CMCR_GSW0TX
  421. #define IS_DSI_LP_GSW0P(LP_GSW0P) (((LP_GSW0P) == DSI_LP_GSW0P_DISABLE) || ((LP_GSW0P) == DSI_LP_GSW0P_ENABLE))
  422. /**
  423. * @}
  424. */
  425. /** @defgroup DSI_LP_LPGenShortWriteOneP
  426. * @{
  427. */
  428. #define DSI_LP_GSW1P_DISABLE 0
  429. #define DSI_LP_GSW1P_ENABLE DSI_CMCR_GSW1TX
  430. #define IS_DSI_LP_GSW1P(LP_GSW1P) (((LP_GSW1P) == DSI_LP_GSW1P_DISABLE) || ((LP_GSW1P) == DSI_LP_GSW1P_ENABLE))
  431. /**
  432. * @}
  433. */
  434. /** @defgroup DSI_LP_LPGenShortWriteTwoP
  435. * @{
  436. */
  437. #define DSI_LP_GSW2P_DISABLE 0
  438. #define DSI_LP_GSW2P_ENABLE DSI_CMCR_GSW2TX
  439. #define IS_DSI_LP_GSW2P(LP_GSW2P) (((LP_GSW2P) == DSI_LP_GSW2P_DISABLE) || ((LP_GSW2P) == DSI_LP_GSW2P_ENABLE))
  440. /**
  441. * @}
  442. */
  443. /** @defgroup DSI_LP_LPGenShortReadNoP
  444. * @{
  445. */
  446. #define DSI_LP_GSR0P_DISABLE 0
  447. #define DSI_LP_GSR0P_ENABLE DSI_CMCR_GSR0TX
  448. #define IS_DSI_LP_GSR0P(LP_GSR0P) (((LP_GSR0P) == DSI_LP_GSR0P_DISABLE) || ((LP_GSR0P) == DSI_LP_GSR0P_ENABLE))
  449. /**
  450. * @}
  451. */
  452. /** @defgroup DSI_LP_LPGenShortReadOneP
  453. * @{
  454. */
  455. #define DSI_LP_GSR1P_DISABLE 0
  456. #define DSI_LP_GSR1P_ENABLE DSI_CMCR_GSR1TX
  457. #define IS_DSI_LP_GSR1P(LP_GSR1P) (((LP_GSR1P) == DSI_LP_GSR1P_DISABLE) || ((LP_GSR1P) == DSI_LP_GSR1P_ENABLE))
  458. /**
  459. * @}
  460. */
  461. /** @defgroup DSI_LP_LPGenShortReadTwoP
  462. * @{
  463. */
  464. #define DSI_LP_GSR2P_DISABLE 0
  465. #define DSI_LP_GSR2P_ENABLE DSI_CMCR_GSR2TX
  466. #define IS_DSI_LP_GSR2P(LP_GSR2P) (((LP_GSR2P) == DSI_LP_GSR2P_DISABLE) || ((LP_GSR2P) == DSI_LP_GSR2P_ENABLE))
  467. /**
  468. * @}
  469. */
  470. /** @defgroup DSI_LP_LPGenLongWrite
  471. * @{
  472. */
  473. #define DSI_LP_GLW_DISABLE 0
  474. #define DSI_LP_GLW_ENABLE DSI_CMCR_GLWTX
  475. #define IS_DSI_LP_GLW(LP_GLW) (((LP_GLW) == DSI_LP_GLW_DISABLE) || ((LP_GLW) == DSI_LP_GLW_ENABLE))
  476. /**
  477. * @}
  478. */
  479. /** @defgroup DSI_LP_LPDcsShortWriteNoP
  480. * @{
  481. */
  482. #define DSI_LP_DSW0P_DISABLE 0
  483. #define DSI_LP_DSW0P_ENABLE DSI_CMCR_DSW0TX
  484. #define IS_DSI_LP_DSW0P(LP_DSW0P) (((LP_DSW0P) == DSI_LP_DSW0P_DISABLE) || ((LP_DSW0P) == DSI_LP_DSW0P_ENABLE))
  485. /**
  486. * @}
  487. */
  488. /** @defgroup DSI_LP_LPDcsShortWriteOneP
  489. * @{
  490. */
  491. #define DSI_LP_DSW1P_DISABLE 0
  492. #define DSI_LP_DSW1P_ENABLE DSI_CMCR_DSW1TX
  493. #define IS_DSI_LP_DSW1P(LP_DSW1P) (((LP_DSW1P) == DSI_LP_DSW1P_DISABLE) || ((LP_DSW1P) == DSI_LP_DSW1P_ENABLE))
  494. /**
  495. * @}
  496. */
  497. /** @defgroup DSI_LP_LPDcsShortReadNoP
  498. * @{
  499. */
  500. #define DSI_LP_DSR0P_DISABLE 0
  501. #define DSI_LP_DSR0P_ENABLE DSI_CMCR_DSR0TX
  502. #define IS_DSI_LP_DSR0P(LP_DSR0P) (((LP_DSR0P) == DSI_LP_DSR0P_DISABLE) || ((LP_DSR0P) == DSI_LP_DSR0P_ENABLE))
  503. /**
  504. * @}
  505. */
  506. /** @defgroup DSI_LP_LPDcsLongWrite
  507. * @{
  508. */
  509. #define DSI_LP_DLW_DISABLE 0
  510. #define DSI_LP_DLW_ENABLE DSI_CMCR_DLWTX
  511. #define IS_DSI_LP_DLW(LP_DLW) (((LP_DLW) == DSI_LP_DLW_DISABLE) || ((LP_DLW) == DSI_LP_DLW_ENABLE))
  512. /**
  513. * @}
  514. */
  515. /** @defgroup DSI_LP_LPMaxReadPacket
  516. * @{
  517. */
  518. #define DSI_LP_MRDP_DISABLE 0
  519. #define DSI_LP_MRDP_ENABLE DSI_CMCR_MRDPS
  520. #define IS_DSI_LP_MRDP(LP_MRDP) (((LP_MRDP) == DSI_LP_MRDP_DISABLE) || ((LP_MRDP) == DSI_LP_MRDP_ENABLE))
  521. /**
  522. * @}
  523. */
  524. /** @defgroup DSI_HS_PrespMode
  525. * @{
  526. */
  527. #define DSI_HS_PM_DISABLE 0
  528. #define DSI_HS_PM_ENABLE DSI_TCCR3_PM
  529. /**
  530. * @}
  531. */
  532. /** @defgroup DSI_Automatic_Clk_Lane_Control
  533. * @{
  534. */
  535. #define DSI_AUTO_CLK_LANE_CTRL_DISABLE 0
  536. #define DSI_AUTO_CLK_LANE_CTRL_ENABLE DSI_CLCR_ACR
  537. #define IS_DSI_AUTO_CLKLANE_CONTROL(AutoClkLane) (((AutoClkLane) == DSI_AUTO_CLK_LANE_CTRL_DISABLE) || ((AutoClkLane) == DSI_AUTO_CLK_LANE_CTRL_ENABLE))
  538. /**
  539. * @}
  540. */
  541. /** @defgroup DSI_Number_Of_Lanes
  542. * @{
  543. */
  544. #define DSI_ONE_DATA_LANE 0
  545. #define DSI_TWO_DATA_LANES 1
  546. #define IS_DSI_NUMBER_OF_LANES(NumberOfLanes) (((NumberOfLanes) == DSI_ONE_DATA_LANE) || ((NumberOfLanes) == DSI_TWO_DATA_LANES))
  547. /**
  548. * @}
  549. */
  550. /** @defgroup DSI_FlowControl
  551. * @{
  552. */
  553. #define DSI_FLOW_CONTROL_CRC_RX DSI_PCR_CRCRXE
  554. #define DSI_FLOW_CONTROL_ECC_RX DSI_PCR_ECCRXE
  555. #define DSI_FLOW_CONTROL_BTA DSI_PCR_BTAE
  556. #define DSI_FLOW_CONTROL_EOTP_RX DSI_PCR_ETRXE
  557. #define DSI_FLOW_CONTROL_EOTP_TX DSI_PCR_ETTXE
  558. #define DSI_FLOW_CONTROL_ALL (DSI_FLOW_CONTROL_CRC_RX | DSI_FLOW_CONTROL_ECC_RX | \
  559. DSI_FLOW_CONTROL_BTA | DSI_FLOW_CONTROL_EOTP_RX | \
  560. DSI_FLOW_CONTROL_EOTP_TX)
  561. #define IS_DSI_FLOW_CONTROL(FlowControl) (((FlowControl) | DSI_FLOW_CONTROL_ALL) == DSI_FLOW_CONTROL_ALL)
  562. /**
  563. * @}
  564. */
  565. /** @defgroup DSI_Color_Coding
  566. * @{
  567. */
  568. #define DSI_RGB565 ((uint32_t)0x00000000) /*!< The values 0x00000001 and 0x00000002 can also be used for the RGB565 color mode configuration */
  569. #define DSI_RGB666 ((uint32_t)0x00000003) /*!< The value 0x00000004 can also be used for the RGB666 color mode configuration */
  570. #define DSI_RGB888 ((uint32_t)0x00000005)
  571. #define IS_DSI_COLOR_CODING(ColorCoding) ((ColorCoding) <= 5)
  572. /**
  573. * @}
  574. */
  575. /** @defgroup DSI_LooselyPacked
  576. * @{
  577. */
  578. #define DSI_LOOSELY_PACKED_ENABLE DSI_LCOLCR_LPE
  579. #define DSI_LOOSELY_PACKED_DISABLE 0
  580. #define IS_DSI_LOOSELY_PACKED(LooselyPacked) (((LooselyPacked) == DSI_LOOSELY_PACKED_ENABLE) || ((LooselyPacked) == DSI_LOOSELY_PACKED_DISABLE))
  581. /**
  582. * @}
  583. */
  584. /** @defgroup DSI_HSYNC_Polarity
  585. * @{
  586. */
  587. #define DSI_HSYNC_ACTIVE_HIGH 0
  588. #define DSI_HSYNC_ACTIVE_LOW DSI_LPCR_HSP
  589. #define IS_DSI_HSYNC_POLARITY(HSYNC) (((HSYNC) == DSI_HSYNC_ACTIVE_HIGH) || ((HSYNC) == DSI_HSYNC_ACTIVE_LOW))
  590. /**
  591. * @}
  592. */
  593. /** @defgroup DSI_VSYNC_Polarity
  594. * @{
  595. */
  596. #define DSI_VSYNC_ACTIVE_HIGH 0
  597. #define DSI_VSYNC_ACTIVE_LOW DSI_LPCR_VSP
  598. #define IS_DSI_VSYNC_POLARITY(VSYNC) (((VSYNC) == DSI_VSYNC_ACTIVE_HIGH) || ((VSYNC) == DSI_VSYNC_ACTIVE_LOW))
  599. /**
  600. * @}
  601. */
  602. /** @defgroup DSI_DATA_ENABLE_Polarity
  603. * @{
  604. */
  605. #define DSI_DATA_ENABLE_ACTIVE_HIGH 0
  606. #define DSI_DATA_ENABLE_ACTIVE_LOW DSI_LPCR_DEP
  607. #define IS_DSI_DE_POLARITY(DataEnable) (((DataEnable) == DSI_DATA_ENABLE_ACTIVE_HIGH) || ((DataEnable) == DSI_DATA_ENABLE_ACTIVE_LOW))
  608. /**
  609. * @}
  610. */
  611. /** @defgroup DSI_PLL_IDF
  612. * @{
  613. */
  614. #define DSI_PLL_IN_DIV1 ((uint32_t)0x00000001)
  615. #define DSI_PLL_IN_DIV2 ((uint32_t)0x00000002)
  616. #define DSI_PLL_IN_DIV3 ((uint32_t)0x00000003)
  617. #define DSI_PLL_IN_DIV4 ((uint32_t)0x00000004)
  618. #define DSI_PLL_IN_DIV5 ((uint32_t)0x00000005)
  619. #define DSI_PLL_IN_DIV6 ((uint32_t)0x00000006)
  620. #define DSI_PLL_IN_DIV7 ((uint32_t)0x00000007)
  621. #define IS_DSI_PLL_IDF(IDF) (((IDF) == DSI_PLL_IN_DIV1) || \
  622. ((IDF) == DSI_PLL_IN_DIV2) || \
  623. ((IDF) == DSI_PLL_IN_DIV3) || \
  624. ((IDF) == DSI_PLL_IN_DIV4) || \
  625. ((IDF) == DSI_PLL_IN_DIV5) || \
  626. ((IDF) == DSI_PLL_IN_DIV6) || \
  627. ((IDF) == DSI_PLL_IN_DIV7))
  628. /**
  629. * @}
  630. */
  631. /** @defgroup DSI_PLL_ODF
  632. * @{
  633. */
  634. #define DSI_PLL_OUT_DIV1 ((uint32_t)0x00000000)
  635. #define DSI_PLL_OUT_DIV2 ((uint32_t)0x00000001)
  636. #define DSI_PLL_OUT_DIV4 ((uint32_t)0x00000002)
  637. #define DSI_PLL_OUT_DIV8 ((uint32_t)0x00000003)
  638. #define IS_DSI_PLL_ODF(ODF) (((ODF) == DSI_PLL_OUT_DIV1) || \
  639. ((ODF) == DSI_PLL_OUT_DIV2) || \
  640. ((ODF) == DSI_PLL_OUT_DIV4) || \
  641. ((ODF) == DSI_PLL_OUT_DIV8))
  642. #define IS_DSI_PLL_NDIV(NDIV) ((10 <= (NDIV)) && ((NDIV) <= 125))
  643. /**
  644. * @}
  645. */
  646. /** @defgroup DSI_Flags
  647. * @{
  648. */
  649. #define DSI_FLAG_TE DSI_WISR_TEIF
  650. #define DSI_FLAG_ER DSI_WISR_ERIF
  651. #define DSI_FLAG_BUSY DSI_WISR_BUSY
  652. #define DSI_FLAG_PLLLS DSI_WISR_PLLLS
  653. #define DSI_FLAG_PLLL DSI_WISR_PLLLIF
  654. #define DSI_FLAG_PLLU DSI_WISR_PLLUIF
  655. #define DSI_FLAG_RRS DSI_WISR_RRS
  656. #define DSI_FLAG_RR DSI_WISR_RRIF
  657. #define IS_DSI_CLEAR_FLAG(FLAG) (((FLAG) == DSI_FLAG_TE) || ((FLAG) == DSI_FLAG_ER) || \
  658. ((FLAG) == DSI_FLAG_PLLL) || ((FLAG) == DSI_FLAG_PLLU) || \
  659. ((FLAG) == DSI_FLAG_RR))
  660. #define IS_DSI_GET_FLAG(FLAG) (((FLAG) == DSI_FLAG_TE) || ((FLAG) == DSI_FLAG_ER) || \
  661. ((FLAG) == DSI_FLAG_BUSY) || ((FLAG) == DSI_FLAG_PLLLS) || \
  662. ((FLAG) == DSI_FLAG_PLLL) || ((FLAG) == DSI_FLAG_PLLU) || \
  663. ((FLAG) == DSI_FLAG_RRS) || ((FLAG) == DSI_FLAG_RR))
  664. /**
  665. * @}
  666. */
  667. /** @defgroup DSI_Interrupts
  668. * @{
  669. */
  670. #define DSI_IT_TE DSI_WIER_TEIE
  671. #define DSI_IT_ER DSI_WIER_ERIE
  672. #define DSI_IT_PLLL DSI_WIER_PLLLIE
  673. #define DSI_IT_PLLU DSI_WIER_PLLUIE
  674. #define DSI_IT_RR DSI_WIER_RRIE
  675. #define IS_DSI_IT(IT) (((IT) == DSI_IT_TE) || ((IT) == DSI_IT_ER) || \
  676. ((IT) == DSI_IT_PLLL) || ((IT) == DSI_IT_PLLU) || \
  677. ((IT) == DSI_IT_RR))
  678. /**
  679. * @}
  680. */
  681. /** @defgroup DSI_SHORT_WRITE_PKT_Data_Type
  682. * @{
  683. */
  684. #define DSI_DCS_SHORT_PKT_WRITE_P0 ((uint32_t)0x00000005) /*!< DCS short write, no parameters */
  685. #define DSI_DCS_SHORT_PKT_WRITE_P1 ((uint32_t)0x00000015) /*!< DCS short write, one parameter */
  686. #define DSI_GEN_SHORT_PKT_WRITE_P0 ((uint32_t)0x00000003) /*!< Generic short write, no parameters */
  687. #define DSI_GEN_SHORT_PKT_WRITE_P1 ((uint32_t)0x00000013) /*!< Generic short write, one parameter */
  688. #define DSI_GEN_SHORT_PKT_WRITE_P2 ((uint32_t)0x00000023) /*!< Generic short write, two parameters */
  689. #define IS_DSI_SHORT_WRITE_PACKET_TYPE(MODE) (((MODE) == DSI_DCS_SHORT_PKT_WRITE_P0) || \
  690. ((MODE) == DSI_DCS_SHORT_PKT_WRITE_P1) || \
  691. ((MODE) == DSI_GEN_SHORT_PKT_WRITE_P0) || \
  692. ((MODE) == DSI_GEN_SHORT_PKT_WRITE_P1) || \
  693. ((MODE) == DSI_GEN_SHORT_PKT_WRITE_P2))
  694. /**
  695. * @}
  696. */
  697. /** @defgroup DSI_LONG_WRITE_PKT_Data_Type
  698. * @{
  699. */
  700. #define DSI_DCS_LONG_PKT_WRITE ((uint32_t)0x00000039) /*!< DCS long write */
  701. #define DSI_GEN_LONG_PKT_WRITE ((uint32_t)0x00000029) /*!< Generic long write */
  702. #define IS_DSI_LONG_WRITE_PACKET_TYPE(MODE) (((MODE) == DSI_DCS_LONG_PKT_WRITE) || \
  703. ((MODE) == DSI_GEN_LONG_PKT_WRITE))
  704. /**
  705. * @}
  706. */
  707. /** @defgroup DSI_SHORT_READ_PKT_Data_Type
  708. * @{
  709. */
  710. #define DSI_DCS_SHORT_PKT_READ ((uint32_t)0x00000006) /*!< DCS short read */
  711. #define DSI_GEN_SHORT_PKT_READ_P0 ((uint32_t)0x00000004) /*!< Generic short read, no parameters */
  712. #define DSI_GEN_SHORT_PKT_READ_P1 ((uint32_t)0x00000014) /*!< Generic short read, one parameter */
  713. #define DSI_GEN_SHORT_PKT_READ_P2 ((uint32_t)0x00000024) /*!< Generic short read, two parameters */
  714. #define IS_DSI_READ_PACKET_TYPE(MODE) (((MODE) == DSI_DCS_SHORT_PKT_READ) || \
  715. ((MODE) == DSI_GEN_SHORT_PKT_READ_P0) || \
  716. ((MODE) == DSI_GEN_SHORT_PKT_READ_P1) || \
  717. ((MODE) == DSI_GEN_SHORT_PKT_READ_P2))
  718. /**
  719. * @}
  720. */
  721. /** @defgroup DSI_Error_Data_Type
  722. * @{
  723. */
  724. #define DSI_ERROR_NONE 0
  725. #define DSI_ERROR_ACK ((uint32_t)0x00000001) /*!< acknowledge errors */
  726. #define DSI_ERROR_PHY ((uint32_t)0x00000002) /*!< PHY related errors */
  727. #define DSI_ERROR_TX ((uint32_t)0x00000004) /*!< transmission error */
  728. #define DSI_ERROR_RX ((uint32_t)0x00000008) /*!< reception error */
  729. #define DSI_ERROR_ECC ((uint32_t)0x00000010) /*!< ECC errors */
  730. #define DSI_ERROR_CRC ((uint32_t)0x00000020) /*!< CRC error */
  731. #define DSI_ERROR_PSE ((uint32_t)0x00000040) /*!< Packet Size error */
  732. #define DSI_ERROR_EOT ((uint32_t)0x00000080) /*!< End Of Transmission error */
  733. #define DSI_ERROR_OVF ((uint32_t)0x00000100) /*!< FIFO overflow error */
  734. #define DSI_ERROR_GEN ((uint32_t)0x00000200) /*!< Generic FIFO related errors */
  735. /**
  736. * @}
  737. */
  738. /** @defgroup DSI_Lane_Group
  739. * @{
  740. */
  741. #define DSI_CLOCK_LANE ((uint32_t)0x00000000)
  742. #define DSI_DATA_LANES ((uint32_t)0x00000001)
  743. #define IS_DSI_LANE_GROUP(Lane) (((Lane) == DSI_CLOCK_LANE) || ((Lane) == DSI_DATA_LANES))
  744. /**
  745. * @}
  746. */
  747. /** @defgroup DSI_Communication_Delay
  748. * @{
  749. */
  750. #define DSI_SLEW_RATE_HSTX ((uint32_t)0x00000000)
  751. #define DSI_SLEW_RATE_LPTX ((uint32_t)0x00000001)
  752. #define DSI_HS_DELAY ((uint32_t)0x00000002)
  753. #define IS_DSI_COMMUNICATION_DELAY(CommDelay) (((CommDelay) == DSI_SLEW_RATE_HSTX) || ((CommDelay) == DSI_SLEW_RATE_LPTX) || ((CommDelay) == DSI_HS_DELAY))
  754. /**
  755. * @}
  756. */
  757. /** @defgroup DSI_CustomLane
  758. * @{
  759. */
  760. #define DSI_SWAP_LANE_PINS ((uint32_t)0x00000000)
  761. #define DSI_INVERT_HS_SIGNAL ((uint32_t)0x00000001)
  762. #define IS_DSI_CUSTOM_LANE(CustomLane) (((CustomLane) == DSI_SWAP_LANE_PINS) || ((CustomLane) == DSI_INVERT_HS_SIGNAL))
  763. /**
  764. * @}
  765. */
  766. /** @defgroup DSI_Lane_Select
  767. * @{
  768. */
  769. #define DSI_CLOCK_LANE ((uint32_t)0x00000000)
  770. #define DSI_DATA_LANE0 ((uint32_t)0x00000001)
  771. #define DSI_DATA_LANE1 ((uint32_t)0x00000002)
  772. #define IS_DSI_LANE(Lane) (((Lane) == DSI_CLOCK_LANE) || ((Lane) == DSI_DATA_LANE0) || ((Lane) == DSI_DATA_LANE1))
  773. /**
  774. * @}
  775. */
  776. /** @defgroup DSI_PHY_Timing
  777. * @{
  778. */
  779. #define DSI_TCLK_POST ((uint32_t)0x00000000)
  780. #define DSI_TLPX_CLK ((uint32_t)0x00000001)
  781. #define DSI_THS_EXIT ((uint32_t)0x00000002)
  782. #define DSI_TLPX_DATA ((uint32_t)0x00000003)
  783. #define DSI_THS_ZERO ((uint32_t)0x00000004)
  784. #define DSI_THS_TRAIL ((uint32_t)0x00000005)
  785. #define DSI_THS_PREPARE ((uint32_t)0x00000006)
  786. #define DSI_TCLK_ZERO ((uint32_t)0x00000007)
  787. #define DSI_TCLK_PREPARE ((uint32_t)0x00000008)
  788. #define IS_DSI_PHY_TIMING(Timing) (((Timing) == DSI_TCLK_POST ) || \
  789. ((Timing) == DSI_TLPX_CLK ) || \
  790. ((Timing) == DSI_THS_EXIT ) || \
  791. ((Timing) == DSI_TLPX_DATA ) || \
  792. ((Timing) == DSI_THS_ZERO ) || \
  793. ((Timing) == DSI_THS_TRAIL ) || \
  794. ((Timing) == DSI_THS_PREPARE ) || \
  795. ((Timing) == DSI_TCLK_ZERO ) || \
  796. ((Timing) == DSI_TCLK_PREPARE))
  797. /**
  798. * @}
  799. */
  800. #define IS_DSI_ALL_PERIPH(PERIPH) ((PERIPH) == DSI)
  801. /* Exported macros -----------------------------------------------------------*/
  802. /* Exported functions --------------------------------------------------------*/
  803. /* Initialization and Configuration functions *********************************/
  804. void DSI_DeInit(DSI_TypeDef *DSIx);
  805. void DSI_Init(DSI_TypeDef *DSIx,DSI_InitTypeDef* DSI_InitStruct, DSI_PLLInitTypeDef *PLLInit);
  806. void DSI_StructInit(DSI_InitTypeDef* DSI_InitStruct, DSI_HOST_TimeoutTypeDef* DSI_HOST_TimeoutInitStruct);
  807. void DSI_SetGenericVCID(DSI_TypeDef *DSIx, uint32_t VirtualChannelID);
  808. void DSI_ConfigVideoMode(DSI_TypeDef *DSIx, DSI_VidCfgTypeDef *VidCfg);
  809. void DSI_ConfigAdaptedCommandMode(DSI_TypeDef *DSIx, DSI_CmdCfgTypeDef *CmdCfg);
  810. void DSI_ConfigCommand(DSI_TypeDef *DSIx, DSI_LPCmdTypeDef *LPCmd);
  811. void DSI_ConfigFlowControl(DSI_TypeDef *DSIx, uint32_t FlowControl);
  812. void DSI_ConfigPhyTimer(DSI_TypeDef *DSIx, DSI_PHY_TimerTypeDef *PhyTimers);
  813. void DSI_ConfigHostTimeouts(DSI_TypeDef *DSIx, DSI_HOST_TimeoutTypeDef *HostTimeouts);
  814. void DSI_PatternGeneratorStart(DSI_TypeDef *DSIx, uint32_t Mode, uint32_t Orientation);
  815. void DSI_PatternGeneratorStop(DSI_TypeDef *DSIx);
  816. void DSI_Start(DSI_TypeDef *DSIx);
  817. void DSI_Stop(DSI_TypeDef *DSIx);
  818. void DSI_Refresh(DSI_TypeDef *DSIx);
  819. void DSI_ColorMode(DSI_TypeDef *DSIx, uint32_t ColorMode);
  820. void DSI_Shutdown(DSI_TypeDef *DSIx, uint32_t Shutdown);
  821. /* Alias for compatibility with STM32F4XX Standard Peripherals Library version number V1.6.0 */
  822. #define DSI_ConfigLowPowerCommand DSI_ConfigCommand
  823. /* Data transfers management functions ****************************************/
  824. void DSI_ShortWrite(DSI_TypeDef *DSIx, uint32_t ChannelID, uint32_t Mode, uint32_t Param1, uint32_t Param2);
  825. void DSI_LongWrite(DSI_TypeDef *DSIx, uint32_t ChannelID, uint32_t Mode, uint32_t NbParams, uint32_t Param1, uint8_t* ParametersTable);
  826. void DSI_Read(DSI_TypeDef *DSIx, uint32_t ChannelNbr, uint8_t* Array, uint32_t Size, uint32_t Mode, uint32_t DCSCmd, uint8_t* ParametersTable);
  827. /* Low Power functions ********************************************************/
  828. void DSI_EnterULPMData(DSI_TypeDef *DSIx);
  829. void DSI_ExitULPMData(DSI_TypeDef *DSIx);
  830. void DSI_EnterULPM(DSI_TypeDef *DSIx);
  831. void DSI_ExitULPM(DSI_TypeDef *DSIx);
  832. void DSI_SetSlewRateAndDelayTuning(DSI_TypeDef *DSIx, uint32_t CommDelay, uint32_t Lane, uint32_t Value);
  833. void DSI_SetLowPowerRXFilter(DSI_TypeDef *DSIx, uint32_t Frequency);
  834. void DSI_SetSDD(DSI_TypeDef *DSIx, FunctionalState State);
  835. void DSI_SetLanePinsConfiguration(DSI_TypeDef *DSIx, uint32_t CustomLane, uint32_t Lane, FunctionalState State);
  836. void DSI_SetPHYTimings(DSI_TypeDef *DSIx, uint32_t Timing, FunctionalState State, uint32_t Value);
  837. void DSI_ForceTXStopMode(DSI_TypeDef *DSIx, uint32_t Lane, FunctionalState State);
  838. void DSI_ForceRXLowPower(DSI_TypeDef *DSIx, FunctionalState State);
  839. void DSI_ForceDataLanesInRX(DSI_TypeDef *DSIx, FunctionalState State);
  840. void DSI_SetPullDown(DSI_TypeDef *DSIx, FunctionalState State);
  841. void DSI_SetContentionDetectionOff(DSI_TypeDef *DSIx, FunctionalState State);
  842. /* Interrupts and flags management functions **********************************/
  843. void DSI_ITConfig(DSI_TypeDef* DSIx, uint32_t DSI_IT, FunctionalState NewState);
  844. FlagStatus DSI_GetFlagStatus(DSI_TypeDef* DSIx, uint16_t DSI_FLAG);
  845. void DSI_ClearFlag(DSI_TypeDef* DSIx, uint16_t DSI_FLAG);
  846. ITStatus DSI_GetITStatus(DSI_TypeDef* DSIx, uint32_t DSI_IT);
  847. void DSI_ClearITPendingBit(DSI_TypeDef* DSIx, uint32_t DSI_IT);
  848. void DSI_ConfigErrorMonitor(DSI_TypeDef *DSIx, uint32_t ActiveErrors);
  849. #endif /* STM32F469_479xx */
  850. /**
  851. * @}
  852. */
  853. /**
  854. * @}
  855. */
  856. #ifdef __cplusplus
  857. }
  858. #endif
  859. #endif /* __STM32F4xx_DSI_H */
  860. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/