hal_gouda.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _HAL_GOUDA_H_
  13. #define _HAL_GOUDA_H_
  14. /// @defgroup gouda HAL GOUDA Driver
  15. /// This document describes the characteristics of the GOUDA module and how
  16. /// to use them via its Hardware Abstraction Layer API.
  17. ///
  18. /// The GOUDA is a dedicated controller that is capable of driving
  19. /// a parallel LCD module with a multi layer engine.
  20. ///
  21. // =============================================================================
  22. // MACROS
  23. // =============================================================================
  24. /// Number of different set of timings available for the GOUDA LCD
  25. /// configuration. This number should be equal to the number
  26. /// of different system frequencies, so that the GOUDA LCD interface
  27. /// can be configured optimaly for every system frequency.
  28. #define HAL_GOUDA_LCD_TIMINGS_QTY 12
  29. #define ENABLE_FMARK_LCD 1 // now ,only support two data line mode lcd.
  30. #define DISABLE_FMARK_LCD 0
  31. // =============================================================================
  32. // TYPES
  33. // =============================================================================
  34. // =============================================================================
  35. // HAL_GOUDA_IRQ_HANDLER_T
  36. // -----------------------------------------------------------------------------
  37. /// Type of the user handler function called when a GOUDA related interrupt
  38. /// is triggered.
  39. // =============================================================================
  40. typedef void (*HAL_GOUDA_IRQ_HANDLER_T)(void);
  41. typedef uint32_t (*HAL_SYS_FREQ_CHANGE_HANDLER_T)(uint32_t sysFreq);
  42. typedef enum
  43. {
  44. /// No error occured
  45. HAL_ERR_NO,
  46. /// A resource reset is required
  47. HAL_ERR_RESOURCE_RESET,
  48. /// An attempt to access a busy resource failed
  49. HAL_ERR_RESOURCE_BUSY,
  50. /// Timeout while trying to access the resource
  51. HAL_ERR_RESOURCE_TIMEOUT,
  52. /// An attempt to access a resource that is not enabled
  53. HAL_ERR_RESOURCE_NOT_ENABLED,
  54. /// Invalid parameter
  55. HAL_ERR_BAD_PARAMETER,
  56. /// Uart RX FIFO overflowed
  57. HAL_ERR_UART_RX_OVERFLOW,
  58. /// Uart TX FIFO overflowed
  59. HAL_ERR_UART_TX_OVERFLOW,
  60. HAL_ERR_UART_PARITY,
  61. HAL_ERR_UART_FRAMING,
  62. HAL_ERR_UART_BREAK_INT,
  63. HAL_ERR_TIM_RTC_NOT_VALID,
  64. HAL_ERR_TIM_RTC_ALARM_NOT_ENABLED,
  65. HAL_ERR_TIM_RTC_ALARM_NOT_DISABLED,
  66. /// Communication failure
  67. HAL_ERR_COMMUNICATION_FAILED,
  68. HAL_ERR_QTY
  69. } HAL_ERR_T;
  70. // =============================================================================
  71. // HAL_GOUDA_SPI_LINE_T
  72. // -----------------------------------------------------------------------------
  73. /// Define the type of the SLCD SPI line.
  74. // =============================================================================
  75. typedef enum
  76. {
  77. HAL_GOUDA_SPI_LINE_4 = 0,
  78. HAL_GOUDA_SPI_LINE_3 = 1,
  79. HAL_GOUDA_SPI_LINE_4_START_BYTE = 2,
  80. HAL_GOUDA_SPI_LINE_3_2_LANE = 3,
  81. } HAL_GOUDA_SPI_LINE_T;
  82. // =============================================================================
  83. // HAL_GOUDA_LCD_TIMINGS_T
  84. // -----------------------------------------------------------------------------
  85. /// This types describes the timing used by the GOUDA LCD interface.
  86. /// An array os those will be needed to describe the GOUDA LCD
  87. /// timings for each system frequency.
  88. // =============================================================================
  89. typedef union {
  90. struct
  91. {
  92. /// Address setup time (RS to WR, RS to RD) in clock number
  93. uint32_t tas : 3;
  94. uint32_t : 1;
  95. /// Adress hold time in clock number
  96. uint32_t tah : 3;
  97. uint32_t : 1;
  98. /// Control pulse width low, in clock number
  99. uint32_t pwl : 6;
  100. uint32_t : 2;
  101. /// Control pulse width high, in clock number
  102. uint32_t pwh : 6;
  103. uint32_t : 10;
  104. };
  105. /// Use this 'reg' field of the union
  106. /// to access this timing configuration as
  107. /// a 32 bits value than can be written to
  108. /// a register.
  109. uint32_t reg;
  110. } HAL_GOUDA_LCD_TIMINGS_T;
  111. // =============================================================================
  112. // HAL_GOUDA_LCD_CS_T
  113. // -----------------------------------------------------------------------------
  114. /// Defines the Chip Select use to select the LCD screen connected to the
  115. /// GOUDA_LCD controller.
  116. // =============================================================================
  117. typedef enum
  118. {
  119. HAL_GOUDA_LCD_CS_0 = 0,
  120. HAL_GOUDA_LCD_CS_1 = 1,
  121. HAL_GOUDA_LCD_CS_QTY,
  122. HAL_GOUDA_LCD_MEMORY_IF = 2,
  123. HAL_GOUDA_LCD_IN_RAM = 3
  124. } HAL_GOUDA_LCD_CS_T;
  125. // =============================================================================
  126. // HAL_GOUDA_LCD_OUTPUT_FORMAT_T
  127. // -----------------------------------------------------------------------------
  128. /// Describes the Output format of the LCD bus.
  129. /// The MSB select also the AHB access size (8-bit or 16-bit) when Memory destination is selected.
  130. /// Must set to RGB565 when RAM type destination selected
  131. // =============================================================================
  132. typedef enum
  133. {
  134. /// 8-bit - RGB3:3:2 - 1cycle/1pixel - RRRGGGBB
  135. HAL_GOUDA_LCD_OUTPUT_FORMAT_8_BIT_RGB332 = 0,
  136. /// 8-bit - RGB4:4:4 - 3cycle/2pixel - RRRRGGGG/BBBBRRRR/GGGGBBBB
  137. HAL_GOUDA_LCD_OUTPUT_FORMAT_8_bit_RGB444 = 1,
  138. /// 8-bit - RGB5:6:5 - 2cycle/1pixel - RRRRRGGG/GGGBBBBB
  139. HAL_GOUDA_LCD_OUTPUT_FORMAT_8_bit_RGB565 = 2,
  140. /// 16-bit - RGB3:3:2 - 1cycle/2pixel - RRRGGGBBRRRGGGBB
  141. HAL_GOUDA_LCD_OUTPUT_FORMAT_16_bit_RGB332 = 4,
  142. /// 16-bit - RGB4:4:4 - 1cycle/1pixel - XXXXRRRRGGGGBBBB
  143. HAL_GOUDA_LCD_OUTPUT_FORMAT_16_bit_RGB444 = 5,
  144. /// 16-bit - RGB5:6:5 - 1cycle/1pixel - RRRRRGGGGGGBBBBB
  145. HAL_GOUDA_LCD_OUTPUT_FORMAT_16_bit_RGB565 = 6
  146. } HAL_GOUDA_LCD_OUTPUT_FORMAT_T;
  147. // =============================================================================
  148. // HAL_GOUDA_LCD_CONFIG_T
  149. // -----------------------------------------------------------------------------
  150. /// Describes the configuration of the GOUDA LCD interface.
  151. // =============================================================================
  152. typedef union {
  153. struct
  154. {
  155. HAL_GOUDA_LCD_CS_T cs : 2;
  156. uint32_t : 2;
  157. HAL_GOUDA_LCD_OUTPUT_FORMAT_T outputFormat : 3;
  158. bool highByte : 1;
  159. /// \c FALSE is active low, \c TRUE is active high.
  160. bool cs0Polarity : 1;
  161. /// \c FALSE is active low, \c TRUE is active high.
  162. bool cs1Polarity : 1;
  163. /// \c FALSE is active low, \c TRUE is active high.
  164. bool rsPolarity : 1;
  165. /// \c FALSE is active low, \c TRUE is active high.
  166. bool wrPolarity : 1;
  167. /// \c FALSE is active low, \c TRUE is active high.
  168. bool rdPolarity : 1;
  169. uint32_t : 3;
  170. /// Number of command to be send to the LCD command (up to 31)
  171. uint32_t nbCmd : 5;
  172. uint32_t : 3;
  173. /// Start command transfer only. Autoreset
  174. bool startCmdOnly : 1;
  175. bool resetb : 1;
  176. uint32_t : 6;
  177. } b;
  178. /// Use this 'reg' field of the union
  179. /// to access this timing configuration as
  180. /// a 32 bits value than can be written to
  181. /// a register.
  182. uint32_t reg;
  183. } HAL_GOUDA_LCD_CONFIG_T;
  184. // =============================================================================
  185. // HAL_GOUDA_SERIAL_LCD_CONFIG_T
  186. // -----------------------------------------------------------------------------
  187. /// Describes the configuration of the GOUDA serial LCD interface.
  188. // =============================================================================
  189. typedef union {
  190. struct
  191. {
  192. bool isSlcd : 1;
  193. uint32_t deviceId : 6;
  194. uint32_t clkDivider : 8;
  195. uint32_t dummyCycle : 3;
  196. uint32_t lineType : 2;
  197. uint32_t rxByte : 3;
  198. bool isRead : 1;
  199. } b;
  200. uint32_t reg;
  201. } HAL_GOUDA_SERIAL_LCD_CONFIG_T;
  202. // =============================================================================
  203. // HAL_GOUDA_LCD_CMD_T
  204. // -----------------------------------------------------------------------------
  205. /// Describes a command send to LCD
  206. // =============================================================================
  207. typedef struct
  208. {
  209. /// \FALSE for a command, \TRUE for a data
  210. bool isData;
  211. /// value of data or command
  212. uint16_t value;
  213. } HAL_GOUDA_LCD_CMD_T;
  214. // =============================================================================
  215. // HAL_GOUDA_WINDOW_T
  216. // -----------------------------------------------------------------------------
  217. /// Describes a window by a top left point
  218. /// and a bottom right point
  219. // =============================================================================
  220. typedef struct
  221. {
  222. /// top left point
  223. uint16_t tlPX;
  224. uint16_t tlPY;
  225. /// bottom right point
  226. uint16_t brPX;
  227. uint16_t brPY;
  228. } HAL_GOUDA_WINDOW_T;
  229. // =============================================================================
  230. // HAL_GOUDA_IMG_FORMAT_T
  231. // -----------------------------------------------------------------------------
  232. /// Describes the image input format
  233. // =============================================================================
  234. typedef enum
  235. {
  236. HAL_GOUDA_IMG_FORMAT_RGB565,
  237. HAL_GOUDA_IMG_FORMAT_UYVY,
  238. HAL_GOUDA_IMG_FORMAT_YUYV,
  239. HAL_GOUDA_IMG_FORMAT_IYUV
  240. } HAL_GOUDA_IMG_FORMAT_T;
  241. // =============================================================================
  242. // HAL_GOUDA_CKEY_MASK_T
  243. // -----------------------------------------------------------------------------
  244. /// Describes the color mask for Chroma Keying.
  245. /// This allows a range of color as transparent.
  246. // =============================================================================
  247. typedef enum
  248. {
  249. /// exact color match
  250. HAL_GOUDA_CKEY_MASK_OFF = 0,
  251. /// disregard 1 LSBit of each color component for matching
  252. HAL_GOUDA_CKEY_MASK_1LSB = 1,
  253. /// disregard 2 LSBit of each color component for matching
  254. HAL_GOUDA_CKEY_MASK_2LSB = 3,
  255. /// disregard 3 LSBit of each color component for matching
  256. HAL_GOUDA_CKEY_MASK_3LSB = 7
  257. } HAL_GOUDA_CKEY_MASK_T;
  258. // =============================================================================
  259. // HAL_GOUDA_OVL_LAYER_ID_T
  260. // -----------------------------------------------------------------------------
  261. /// Describes the overlay layers Ids.
  262. // =============================================================================
  263. typedef enum
  264. {
  265. HAL_GOUDA_OVL_LAYER_ID0,
  266. HAL_GOUDA_OVL_LAYER_ID1,
  267. HAL_GOUDA_OVL_LAYER_ID2,
  268. HAL_GOUDA_OVL_LAYER_ID_QTY
  269. } HAL_GOUDA_OVL_LAYER_ID_T;
  270. // =============================================================================
  271. // HAL_GOUDA_OVL_LAYER_DEF_T
  272. // -----------------------------------------------------------------------------
  273. /// Describes the configuration of an overlay layer.
  274. // =============================================================================
  275. typedef struct
  276. {
  277. ///@todo check with uint16_t* (?)
  278. uint32_t *addr;
  279. HAL_GOUDA_IMG_FORMAT_T fmt;
  280. /// buffer width in bytes including optional padding, when 0 will be calculated
  281. uint16_t stride;
  282. HAL_GOUDA_WINDOW_T pos;
  283. uint8_t alpha;
  284. bool cKeyEn;
  285. uint16_t cKeyColor;
  286. HAL_GOUDA_CKEY_MASK_T cKeyMask;
  287. } HAL_GOUDA_OVL_LAYER_DEF_T;
  288. // =============================================================================
  289. // HAL_GOUDA_VID_LAYER_DEPTH_T
  290. // -----------------------------------------------------------------------------
  291. /// Describes the video layer depth
  292. // =============================================================================
  293. typedef enum
  294. {
  295. /// Video layer behind all Overlay layers
  296. HAL_GOUDA_VID_LAYER_BEHIND_ALL = 0,
  297. /// Video layer between Overlay layers 1 and 0
  298. HAL_GOUDA_VID_LAYER_BETWEEN_1_0,
  299. /// Video layer between Overlay layers 2 and 1
  300. HAL_GOUDA_VID_LAYER_BETWEEN_2_1,
  301. /// Video layer on top of all Overlay layers
  302. HAL_GOUDA_VID_LAYER_OVER_ALL
  303. } HAL_GOUDA_VID_LAYER_DEPTH_T;
  304. // =============================================================================
  305. // HAL_GOUDA_VID_LAYER_DEF_T
  306. // -----------------------------------------------------------------------------
  307. /// Describes the configuration of the video layer.
  308. // =============================================================================
  309. typedef struct
  310. {
  311. uint32_t *addrY;
  312. uint32_t *addrU;
  313. uint32_t *addrV;
  314. HAL_GOUDA_IMG_FORMAT_T fmt;
  315. uint16_t height;
  316. uint16_t width;
  317. uint16_t stride;
  318. HAL_GOUDA_WINDOW_T pos;
  319. uint8_t alpha;
  320. bool cKeyEn;
  321. uint16_t cKeyColor;
  322. HAL_GOUDA_CKEY_MASK_T cKeyMask;
  323. HAL_GOUDA_VID_LAYER_DEPTH_T depth;
  324. uint8_t rotation;
  325. } HAL_GOUDA_VID_LAYER_DEF_T;
  326. #ifdef CONFIG_QUEC_PROJECT_FEATURE_LCD
  327. extern bool ql_lcd_is_reset;
  328. typedef struct __gouda_context
  329. {
  330. bool goudaOpened;
  331. bool fmarkBusy;
  332. HAL_GOUDA_IRQ_HANDLER_T userIrqHandler;
  333. } goudaContext_t;
  334. extern goudaContext_t g_gouda_ctx;
  335. #endif
  336. // =============================================================================
  337. // FUNCTIONS
  338. // =============================================================================
  339. // =============================================================================
  340. // halGoudaOpen
  341. // -----------------------------------------------------------------------------
  342. /// Open the LCD controller of Gouda
  343. /// Parameters are used to describe the screen connexion configuration and
  344. /// the controller timings to use depending on the system clock frequency.
  345. /// @param config Pointer to the controller configuration.
  346. /// @param timings Controller timing array (must be provided and valid,
  347. /// even if unused in case of #HAL_GOUDA_LCD_MEMORY_IF)
  348. /// @param ebcCsAddr address of ebc CS for #HAL_GOUDA_LCD_MEMORY_IF,
  349. /// can be 0 for gouda CS.
  350. // =============================================================================
  351. void halGoudaOpen(const HAL_GOUDA_LCD_CONFIG_T *config, const HAL_GOUDA_LCD_TIMINGS_T *timings, uint32_t ebcCsAddr);
  352. // =============================================================================
  353. // hal_GoudaSerialOpen
  354. // -----------------------------------------------------------------------------
  355. /// Open the serial LCD controller of Gouda
  356. /// Parameters are used to describe the screen connexion configuration and
  357. /// the controller timings to use depending on the system clock frequency.
  358. /// @param spiLineType The SPI line type of the serial LCD.
  359. /// @param spiFreq The SPI frequency of the serial LCD.
  360. /// @param config Pointer to the controller configuration.
  361. /// @param ebcCsAddr address of ebc CS for #HAL_GOUDA_LCD_MEMORY_IF,
  362. /// can be 0 for gouda CS.
  363. // =============================================================================
  364. void halGoudaSerialOpen(HAL_GOUDA_SPI_LINE_T spiLineType, uint32_t spiFreq, const HAL_GOUDA_LCD_CONFIG_T *config, uint32_t ebcCsAddr);
  365. void halGoudaSerialMode(HAL_GOUDA_SPI_LINE_T spiLineType);
  366. // =============================================================================
  367. // hal_GoudaClose
  368. // -----------------------------------------------------------------------------
  369. /// Close Gouda.
  370. // =============================================================================
  371. void halGoudaClose(void);
  372. // =============================================================================
  373. // hal_GoudaWriteReg
  374. // -----------------------------------------------------------------------------
  375. /// Write a command and then a data to the LCD screen (Or a value at a register
  376. /// address, depending on the point of view).
  377. ///
  378. /// @param addr Address of the register to write, or command to send
  379. /// to the LCD screen
  380. /// @param data Corresponding data to write to the LCD.
  381. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  382. /// the GOUDA LCD controller is busy with another command.
  383. // =============================================================================
  384. HAL_ERR_T halGoudaWriteReg(uint16_t addr, uint16_t data);
  385. // =============================================================================
  386. // halGoudaReadData
  387. // -----------------------------------------------------------------------------
  388. /// Read a data from the LCD screen (Or a value at a register
  389. /// address, depending on the point of view).
  390. ///
  391. /// @param addr Address of the register to read
  392. /// @param pData Pointer of the corresponding data to read from the LCD.
  393. /// @param len Data length to read from the LCD.
  394. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  395. /// the GOUDA LCD controller is busy with another command.
  396. // =============================================================================
  397. HAL_ERR_T halGoudaReadData(uint16_t addr, uint8_t *pData, uint32_t len);
  398. // =============================================================================
  399. // halGoudaReadReg
  400. // -----------------------------------------------------------------------------
  401. /// Read a data from the LCD screen (Or a value at a register
  402. /// address, depending on the point of view).
  403. ///
  404. /// @param addr Address of the register to read
  405. /// @param pData Pointer of the corresponding data to read from the LCD.
  406. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  407. /// the GOUDA LCD controller is busy with another command.
  408. // =============================================================================
  409. HAL_ERR_T halGoudaReadReg(uint16_t addr, uint16_t *pData);
  410. // =============================================================================
  411. // halGoudaWriteCmd
  412. // -----------------------------------------------------------------------------
  413. /// Write a command to the LCD.
  414. ///
  415. /// @param addr Command to write.
  416. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  417. /// the LCDC controller is busy with another command.
  418. // =============================================================================
  419. HAL_ERR_T halGoudaWriteCmd(uint16_t addr);
  420. // =============================================================================
  421. // halGoudaWriteData
  422. // -----------------------------------------------------------------------------
  423. /// Write a data to the LCD screen.
  424. ///
  425. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  426. /// the LCDC controller is busy with another command.
  427. // =============================================================================
  428. HAL_ERR_T halGoudaWriteData(uint16_t data);
  429. // =============================================================================
  430. // hal_GoudaBlitRoi
  431. // -----------------------------------------------------------------------------
  432. /// Send a block of pixel data to the LCD screen.
  433. ///
  434. /// @param pRoi Pointer to the roi description to send to the screen.
  435. /// @param nbCmd number of commands to send to LCD before pixel data
  436. /// @param pCmds commands to send to LCD before pixel data can be \c NULL if \p nbCmd is 0
  437. /// @param handler If not NULL, user function that is called when the transfer
  438. /// is finished.
  439. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  440. /// the LCDC controller is busy with another command.
  441. // =============================================================================
  442. HAL_ERR_T halGoudaBlitRoi(const HAL_GOUDA_WINDOW_T *pRoi, const uint32_t nbCmd, const HAL_GOUDA_LCD_CMD_T *pCmds, HAL_GOUDA_IRQ_HANDLER_T handler);
  443. // =============================================================================
  444. // hal_GoudaBlitRoi2Ram
  445. // -----------------------------------------------------------------------------
  446. /// Send a block of pixel data to a flat ram buffer in RGB565 format
  447. /// WARNING: only even pixel number are supported, that is to say size must
  448. /// be a multiple of 4 bytes.
  449. ///
  450. /// @param pBuffer Pointer to the ram buffer
  451. /// @param width Buffer width in pixel, if 0 the buffer is considered to have
  452. /// the same width as the roi.
  453. /// @param pRoi Pointer to the roi description to send to the screen.
  454. /// @param handler If not NULL, user function that is called when the transfer
  455. /// is finished.
  456. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  457. /// the LCDC controller is busy with another command.
  458. // =============================================================================
  459. HAL_ERR_T halGoudaBlitRoi2Ram(uint32_t *pBuffer, const uint16_t width, const HAL_GOUDA_WINDOW_T *pRoi, HAL_GOUDA_IRQ_HANDLER_T handler);
  460. // =============================================================================
  461. // hal_GoudaIsActive
  462. // -----------------------------------------------------------------------------
  463. /// Get the activity status
  464. /// @return \c TRUE when active
  465. // =============================================================================
  466. bool halGoudaIsActive(void);
  467. // =============================================================================
  468. // halGoudaSetBgColor
  469. // -----------------------------------------------------------------------------
  470. /// Set the background color
  471. /// @param color in RGB565 format
  472. // =============================================================================
  473. void halGoudaSetBgColor(uint16_t color);
  474. // =============================================================================
  475. // halGoudaGetBgColor
  476. // -----------------------------------------------------------------------------
  477. /// Get the background color
  478. /// @param color in RGB565 format
  479. // =============================================================================
  480. uint16_t halGoudaGetBgColor(void);
  481. // =============================================================================
  482. // halGoudaOvlLayerOpen
  483. // -----------------------------------------------------------------------------
  484. /// Open and configure an overlay layer.
  485. ///
  486. /// @param id the layer Id
  487. /// @param def the configuration
  488. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  489. /// the layer is already enabled.
  490. // =============================================================================
  491. HAL_ERR_T halGoudaOvlLayerOpen(HAL_GOUDA_OVL_LAYER_ID_T id, HAL_GOUDA_OVL_LAYER_DEF_T *def);
  492. // =============================================================================
  493. // halGoudaOvlLayerClose
  494. // -----------------------------------------------------------------------------
  495. /// Close an overlay layer.
  496. // =============================================================================
  497. void halGoudaOvlLayerClose(HAL_GOUDA_OVL_LAYER_ID_T id);
  498. // =============================================================================
  499. // halGoudaVidLayerOpen
  500. // -----------------------------------------------------------------------------
  501. /// Open and configure the video layer.
  502. ///
  503. /// @param def the configuration
  504. /// @return #HAL_ERR_NO when everything is fine, #HAL_ERR_RESOURCE_BUSY when
  505. /// the layer is already enabled.
  506. // =============================================================================
  507. HAL_ERR_T halGoudaVidLayerOpen(HAL_GOUDA_VID_LAYER_DEF_T *def);
  508. // =============================================================================
  509. // halGoudaVidLayerClose
  510. // -----------------------------------------------------------------------------
  511. /// Close the video layer.
  512. // =============================================================================
  513. void halGoudaVidLayerClose(void);
  514. // =============================================================================
  515. // halGoudaVidLayerState
  516. // -----------------------------------------------------------------------------
  517. /// Get an video layer state.
  518. // =============================================================================
  519. uint32_t halGoudaVidLayerState(void);
  520. // =============================================================================
  521. // halGoudaInitResetPin
  522. // -----------------------------------------------------------------------------
  523. /// Initialize the status of LCD reset pin.
  524. // =============================================================================
  525. void hal_GoudaInitResetPin(void);
  526. // =============================================================================
  527. // halGoudaGetTiming
  528. // -----------------------------------------------------------------------------
  529. /// Get lcd timing.
  530. // =============================================================================
  531. uint32_t halGoudaGetTiming(void);
  532. // =============================================================================
  533. // halGoudaSetTiming
  534. // -----------------------------------------------------------------------------
  535. /// Set lcd timing.
  536. // =============================================================================
  537. void halGoudaSetTiming(uint32_t lcd_timing);
  538. void halGoudatResetLcdPin(void);
  539. // =============================================================================
  540. // hal_GoudaSetBlock
  541. // -----------------------------------------------------------------------------
  542. /// Indicate whether to wait until gouda blit operations finish.
  543. /// @param block The block flag, with a non-zero value to wait, 0 otherwise.
  544. // =============================================================================
  545. void halGoudaSetBlock(uint32_t block);
  546. void halGoudaInit(HAL_GOUDA_LCD_CONFIG_T cfg, uint32_t clk);
  547. void halGoudaReadConfig(uint16_t two_dataLine, bool fmark, uint32_t fmark_delay);
  548. // =============================================================================
  549. // hal_GoudaSetSpiFreq
  550. // -----------------------------------------------------------------------------
  551. /// Set SPI Frequency timing.
  552. // =============================================================================
  553. void hal_GoudaSetSpiFreq(uint32_t spiFreq);
  554. extern void halGoudaSetFmarkBusy(bool busy);
  555. void halGoudaClkDisable(void);
  556. void halGoudaClkEnable(void);
  557. /// @} end of group
  558. #endif // _HAL_GOUDA_H_