1 /***************************************************************************//**
\r
3 * @brief External Bus Iterface (EBI) peripheral API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
34 #ifndef __SILICON_LABS_EM_EBI_H_
\r
35 #define __SILICON_LABS_EM_EBI_H_
\r
37 #include "em_device.h"
\r
39 #if defined(EBI_COUNT) && (EBI_COUNT > 0)
\r
40 #include "em_assert.h"
\r
43 #include <stdbool.h>
\r
49 /***************************************************************************//**
\r
50 * @addtogroup EM_Library
\r
52 ******************************************************************************/
\r
54 /***************************************************************************//**
\r
57 ******************************************************************************/
\r
59 /***************************************************************************//**
\r
62 * --------- ---------
\r
63 * | EBI | /| |\ | Ext. |
\r
64 * | | / --------- \ | Async |
\r
65 * |(EFM32)| \ --------- / | Device|
\r
67 * --------- ---------
\r
68 * Parallel interface
\r
71 ******************************************************************************/
\r
73 /*******************************************************************************
\r
74 ******************************* DEFINES ***********************************
\r
75 ******************************************************************************/
\r
77 #define EBI_BANK0 (uint32_t)(1 << 1) /**< EBI address bank 0 */
\r
78 #define EBI_BANK1 (uint32_t)(1 << 2) /**< EBI address bank 1 */
\r
79 #define EBI_BANK2 (uint32_t)(1 << 3) /**< EBI address bank 2 */
\r
80 #define EBI_BANK3 (uint32_t)(1 << 4) /**< EBI address bank 3 */
\r
82 #define EBI_CS0 (uint32_t)(1 << 1) /**< EBI chip select line 0 */
\r
83 #define EBI_CS1 (uint32_t)(1 << 2) /**< EBI chip select line 1 */
\r
84 #define EBI_CS2 (uint32_t)(1 << 3) /**< EBI chip select line 2 */
\r
85 #define EBI_CS3 (uint32_t)(1 << 4) /**< EBI chip select line 3 */
\r
87 /*******************************************************************************
\r
88 ******************************** ENUMS ************************************
\r
89 ******************************************************************************/
\r
91 /** EBI Mode of operation */
\r
94 /** 8 data bits, 8 address bits */
\r
95 ebiModeD8A8 = EBI_CTRL_MODE_D8A8,
\r
96 /** 16 data bits, 16 address bits, using address latch enable */
\r
97 ebiModeD16A16ALE = EBI_CTRL_MODE_D16A16ALE,
\r
98 /** 8 data bits, 24 address bits, using address latch enable */
\r
99 ebiModeD8A24ALE = EBI_CTRL_MODE_D8A24ALE,
\r
100 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
102 ebiModeD16 = EBI_CTRL_MODE_D16,
\r
104 } EBI_Mode_TypeDef;
\r
106 /** EBI Polarity configuration */
\r
113 } EBI_Polarity_TypeDef;
\r
115 /** EBI Pin Line types */
\r
118 /** Address Ready line */
\r
120 /** Address Latch Enable line */
\r
122 /** Write Enable line */
\r
124 /** Read Enable line */
\r
126 /** Chip Select line */
\r
128 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
132 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
133 /** TFT VSYNC line */
\r
135 /** TFT HSYNC line */
\r
137 /** TFT Data enable line */
\r
139 /** TFT DCLK line */
\r
141 /** TFT Chip select line */
\r
144 } EBI_Line_TypeDef;
\r
146 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
147 /** Address Pin Enable, lower limit - lower range of pins to enable */
\r
150 /** Adress lines EBI_A[0] and upwards are enabled by APEN */
\r
151 ebiALowA0 = EBI_ROUTE_ALB_A0,
\r
152 /** Adress lines EBI_A[8] and upwards are enabled by APEN */
\r
153 ebiALowA8 = EBI_ROUTE_ALB_A8,
\r
154 /** Adress lines EBI_A[16] and upwards are enabled by APEN */
\r
155 ebiALowA16 = EBI_ROUTE_ALB_A16,
\r
156 /** Adress lines EBI_A[24] and upwards are enabled by APEN */
\r
157 ebiALowA24 = EBI_ROUTE_ALB_A24,
\r
158 } EBI_ALow_TypeDef;
\r
160 /** Adress Pin Enable, high limit - higher limit of pins to enable */
\r
163 /** All EBI_A pins are disabled */
\r
164 ebiAHighA0 = EBI_ROUTE_APEN_A0,
\r
165 /** All EBI_A[4:ALow] are enabled */
\r
166 ebiAHighA5 = EBI_ROUTE_APEN_A5,
\r
167 /** All EBI_A[5:ALow] are enabled */
\r
168 ebiAHighA6 = EBI_ROUTE_APEN_A6,
\r
169 /** All EBI_A[6:ALow] are enabled */
\r
170 ebiAHighA7 = EBI_ROUTE_APEN_A7,
\r
171 /** All EBI_A[7:ALow] are enabled */
\r
172 ebiAHighA8 = EBI_ROUTE_APEN_A8,
\r
173 /** All EBI_A[8:ALow] are enabled */
\r
174 ebiAHighA9 = EBI_ROUTE_APEN_A9,
\r
175 /** All EBI_A[9:ALow] are enabled */
\r
176 ebiAHighA10 = EBI_ROUTE_APEN_A10,
\r
177 /** All EBI_A[10:ALow] are enabled */
\r
178 ebiAHighA11 = EBI_ROUTE_APEN_A11,
\r
179 /** All EBI_A[11:ALow] are enabled */
\r
180 ebiAHighA12 = EBI_ROUTE_APEN_A12,
\r
181 /** All EBI_A[12:ALow] are enabled */
\r
182 ebiAHighA13 = EBI_ROUTE_APEN_A13,
\r
183 /** All EBI_A[13:ALow] are enabled */
\r
184 ebiAHighA14 = EBI_ROUTE_APEN_A14,
\r
185 /** All EBI_A[14:ALow] are enabled */
\r
186 ebiAHighA15 = EBI_ROUTE_APEN_A15,
\r
187 /** All EBI_A[15:ALow] are enabled */
\r
188 ebiAHighA16 = EBI_ROUTE_APEN_A16,
\r
189 /** All EBI_A[16:ALow] are enabled */
\r
190 ebiAHighA17 = EBI_ROUTE_APEN_A17,
\r
191 /** All EBI_A[17:ALow] are enabled */
\r
192 ebiAHighA18 = EBI_ROUTE_APEN_A18,
\r
193 /** All EBI_A[18:ALow] are enabled */
\r
194 ebiAHighA19 = EBI_ROUTE_APEN_A19,
\r
195 /** All EBI_A[19:ALow] are enabled */
\r
196 ebiAHighA20 = EBI_ROUTE_APEN_A20,
\r
197 /** All EBI_A[20:ALow] are enabled */
\r
198 ebiAHighA21 = EBI_ROUTE_APEN_A21,
\r
199 /** All EBI_A[21:ALow] are enabled */
\r
200 ebiAHighA22 = EBI_ROUTE_APEN_A22,
\r
201 /** All EBI_A[22:ALow] are enabled */
\r
202 ebiAHighA23 = EBI_ROUTE_APEN_A23,
\r
203 /** All EBI_A[23:ALow] are enabled */
\r
204 ebiAHighA24 = EBI_ROUTE_APEN_A24,
\r
205 /** All EBI_A[24:ALow] are enabled */
\r
206 ebiAHighA25 = EBI_ROUTE_APEN_A25,
\r
207 /** All EBI_A[25:ALow] are enabled */
\r
208 ebiAHighA26 = EBI_ROUTE_APEN_A26,
\r
209 /** All EBI_A[26:ALow] are enabled */
\r
210 ebiAHighA27 = EBI_ROUTE_APEN_A27,
\r
211 /** All EBI_A[27:ALow] are enabled */
\r
212 ebiAHighA28 = EBI_ROUTE_APEN_A28,
\r
213 } EBI_AHigh_TypeDef;
\r
215 /** EBI I/O Alternate Pin Location */
\r
217 /** EBI PIN I/O Location 0 */
\r
218 ebiLocation0 = EBI_ROUTE_LOCATION_LOC0,
\r
219 /** EBI PIN I/O Location 1 */
\r
220 ebiLocation1 = EBI_ROUTE_LOCATION_LOC1,
\r
221 /** EBI PIN I/O Location 2 */
\r
222 ebiLocation2 = EBI_ROUTE_LOCATION_LOC2
\r
223 } EBI_Location_TypeDef;
\r
227 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
228 /** EBI TFT Graphics Bank Select */
\r
231 /** Memory BANK0 contains frame buffer */
\r
232 ebiTFTBank0 = EBI_TFTCTRL_BANKSEL_BANK0,
\r
233 /** Memory BANK1 contains frame buffer */
\r
234 ebiTFTBank1 = EBI_TFTCTRL_BANKSEL_BANK1,
\r
235 /** Memory BANK2 contains frame buffer */
\r
236 ebiTFTBank2 = EBI_TFTCTRL_BANKSEL_BANK2,
\r
237 /** Memory BANK3 contains frame buffer */
\r
238 ebiTFTBank3 = EBI_TFTCTRL_BANKSEL_BANK3
\r
239 } EBI_TFTBank_TypeDef;
\r
241 /** Masking and Alpha blending source color*/
\r
244 /** Use memory as source color for masking/alpha blending */
\r
245 ebiTFTColorSrcMem = EBI_TFTCTRL_COLOR1SRC_MEM,
\r
246 /** Use PIXEL1 register as source color for masking/alpha blending */
\r
247 ebiTFTColorSrcPixel1 = EBI_TFTCTRL_COLOR1SRC_PIXEL1,
\r
248 } EBI_TFTColorSrc_TypeDef;
\r
250 /** Bus Data Interleave Mode */
\r
253 /** Unlimited interleaved accesses per EBI_DCLK period. Can cause jitter */
\r
254 ebiTFTInterleaveUnlimited = EBI_TFTCTRL_INTERLEAVE_UNLIMITED,
\r
255 /** Allow 1 interleaved access per EBI_DCLK period */
\r
256 ebiTFTInterleaveOnePerDClk = EBI_TFTCTRL_INTERLEAVE_ONEPERDCLK,
\r
257 /** Only allow accesses during porch periods */
\r
258 ebiTFTInterleavePorch = EBI_TFTCTRL_INTERLEAVE_PORCH,
\r
259 } EBI_TFTInterleave_TypeDef;
\r
261 /** Control frame base pointer copy */
\r
264 /** Trigger update of frame buffer pointer on vertical sync */
\r
265 ebiTFTFrameBufTriggerVSync = EBI_TFTCTRL_FBCTRIG_VSYNC,
\r
266 /** Trigger update of frame buffer pointer on horizontal sync */
\r
267 ebiTFTFrameBufTriggerHSync = EBI_TFTCTRL_FBCTRIG_HSYNC,
\r
268 } EBI_TFTFrameBufTrigger_TypeDef;
\r
270 /** Control of mask and alpha blending mode */
\r
273 /** Masking and blending are disabled */
\r
274 ebiTFTMBDisabled = EBI_TFTCTRL_MASKBLEND_DISABLED,
\r
275 /** Internal masking */
\r
276 ebiTFTMBIMask = EBI_TFTCTRL_MASKBLEND_IMASK,
\r
277 /** Internal alpha blending */
\r
278 ebiTFTMBIAlpha = EBI_TFTCTRL_MASKBLEND_IALPHA,
\r
279 /** Internal masking and alpha blending are enabled */
\r
280 ebiTFTMBIMaskAlpha = EBI_TFTCTRL_MASKBLEND_IMASKIALPHA,
\r
281 /** External masking */
\r
282 ebiTFTMBEMask = EBI_TFTCTRL_MASKBLEND_EMASK,
\r
283 /** External alpha blending */
\r
284 ebiTFTMBEAlpha = EBI_TFTCTRL_MASKBLEND_EALPHA,
\r
285 /** External masking and alpha blending */
\r
286 ebiTFTMBEMaskAlpha = EBI_TFTCTRL_MASKBLEND_EMASKEALPHA,
\r
287 } EBI_TFTMaskBlend_TypeDef;
\r
289 /** TFT Direct Drive mode */
\r
293 ebiTFTDDModeDisabled = EBI_TFTCTRL_DD_DISABLED,
\r
294 /** Direct Drive from internal memory */
\r
295 ebiTFTDDModeInternal = EBI_TFTCTRL_DD_INTERNAL,
\r
296 /** Direct Drive from external memory */
\r
297 ebiTFTDDModeExternal = EBI_TFTCTRL_DD_EXTERNAL,
\r
298 } EBI_TFTDDMode_TypeDef;
\r
300 /** TFT Data Increment Width */
\r
303 /** Pixel increments are 1 byte at a time */
\r
304 ebiTFTWidthByte = EBI_TFTCTRL_WIDTH_BYTE,
\r
305 /** Pixel increments are 2 bytes (half word) */
\r
306 ebiTFTWidthHalfWord = EBI_TFTCTRL_WIDTH_HALFWORD,
\r
307 } EBI_TFTWidth_TypeDef;
\r
311 /*******************************************************************************
\r
312 ******************************* STRUCTS ***********************************
\r
313 ******************************************************************************/
\r
315 /** EBI Initialization structure */
\r
318 /** EBI operation mode, data and address limits */
\r
319 EBI_Mode_TypeDef mode;
\r
320 /** Address Ready pin polarity, active high or low */
\r
321 EBI_Polarity_TypeDef ardyPolarity;
\r
322 /** Address Latch Enable pin polarity, active high or low */
\r
323 EBI_Polarity_TypeDef alePolarity;
\r
324 /** Write Enable pin polarity, active high or low */
\r
325 EBI_Polarity_TypeDef wePolarity;
\r
326 /** Read Enable pin polarity, active high or low */
\r
327 EBI_Polarity_TypeDef rePolarity;
\r
328 /** Chip Select pin polarity, active high or low */
\r
329 EBI_Polarity_TypeDef csPolarity;
\r
330 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
331 /** Byte Lane pin polaritym, active high or low */
\r
332 EBI_Polarity_TypeDef blPolarity;
\r
333 /** Flag to enable or disable Byte Lane support */
\r
335 /** Flag to enable or disable idle state insertion between transfers */
\r
338 /** Flag to enable or disable Address Ready support */
\r
340 /** Set to turn off 32 cycle timeout ability */
\r
341 bool ardyDisableTimeout;
\r
342 /** Mask of flags which selects address banks to configure EBI_BANK<0-3> */
\r
344 /** Mask of flags which selects chip select lines to configure EBI_CS<0-3> */
\r
346 /** Number of cycles address is held after Adress Latch Enable is asserted */
\r
347 int addrSetupCycles;
\r
348 /** Number of cycles address is driven onto the ADDRDAT bus before ALE is asserted */
\r
349 int addrHoldCycles;
\r
350 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
351 /** Enable or disables half cycle duration of the ALE strobe in the last address setup cycle */
\r
354 /** Number of cycles for address setup before REn is asserted */
\r
355 int readSetupCycles;
\r
356 /** Number of cycles REn is held active */
\r
357 int readStrobeCycles;
\r
358 /** Number of cycles CSn is held active after REn is deasserted */
\r
359 int readHoldCycles;
\r
360 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
361 /** Enable or disable page mode reads */
\r
363 /** Enables or disable prefetching from sequential addresses */
\r
365 /** Enabled or disables half cycle duration of the REn signal in the last strobe cycle */
\r
368 /** Number of cycles for address setup before WEn is asserted */
\r
369 int writeSetupCycles;
\r
370 /** Number of cycles WEn is held active */
\r
371 int writeStrobeCycles;
\r
372 /** Number of cycles CSn is held active after WEn is deasserted */
\r
373 int writeHoldCycles;
\r
374 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
375 /** Enable or disable the write buffer */
\r
376 bool writeBufferDisable;
\r
377 /** Enables or disables half cycle duration of the WEn signal in the last strobe cycle */
\r
379 /** Lower address pin limit to enable */
\r
380 EBI_ALow_TypeDef aLow;
\r
381 /** High address pin limit to enable */
\r
382 EBI_AHigh_TypeDef aHigh;
\r
383 /** Pin Location */
\r
384 EBI_Location_TypeDef location;
\r
386 /** Flag, if EBI should be enabled after configuration */
\r
388 } EBI_Init_TypeDef;
\r
390 /** Default config for EBI init structures */
\r
391 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
392 #define EBI_INIT_DEFAULT \
\r
393 { ebiModeD8A8, /* 8 bit address, 8 bit data */ \
\r
394 ebiActiveLow, /* ARDY polarity */ \
\r
395 ebiActiveLow, /* ALE polarity */ \
\r
396 ebiActiveLow, /* WE polarity */ \
\r
397 ebiActiveLow, /* RE polarity */ \
\r
398 ebiActiveLow, /* CS polarity */ \
\r
399 ebiActiveLow, /* BL polarity */ \
\r
400 false, /* enable BL */ \
\r
401 false, /* enable NOIDLE */ \
\r
402 false, /* enable ARDY */ \
\r
403 false, /* don't disable ARDY timeout */ \
\r
404 EBI_BANK0, /* enable bank 0 */ \
\r
405 EBI_CS0, /* enable chip select 0 */ \
\r
406 0, /* addr setup cycles */ \
\r
407 1, /* addr hold cycles */ \
\r
408 false, /* do not enable half cycle ALE strobe */ \
\r
409 0, /* read setup cycles */ \
\r
410 0, /* read strobe cycles */ \
\r
411 0, /* read hold cycles */ \
\r
412 false, /* disable page mode */ \
\r
413 false, /* disable prefetch */ \
\r
414 false, /* do not enable half cycle REn strobe */ \
\r
415 0, /* write setup cycles */ \
\r
416 0, /* write strobe cycles */ \
\r
417 1, /* write hold cycles */ \
\r
418 false, /* do not disable the write buffer */ \
\r
419 false, /* do not enable halc cycle WEn strobe */ \
\r
420 ebiALowA0, /* ALB - Low bound, address lines */ \
\r
421 ebiAHighA0, /* APEN - High bound, address lines */ \
\r
422 ebiLocation0, /* Use Location 0 */ \
\r
423 true, /* enable EBI */ \
\r
426 #define EBI_INIT_DEFAULT \
\r
427 { ebiModeD8A8, /* 8 bit address, 8 bit data */ \
\r
428 ebiActiveLow, /* ARDY polarity */ \
\r
429 ebiActiveLow, /* ALE polarity */ \
\r
430 ebiActiveLow, /* WE polarity */ \
\r
431 ebiActiveLow, /* RE polarity */ \
\r
432 ebiActiveLow, /* CS polarity */ \
\r
433 false, /* enable ARDY */ \
\r
434 false, /* don't disable ARDY timeout */ \
\r
435 EBI_BANK0, /* enable bank 0 */ \
\r
436 EBI_CS0, /* enable chip select 0 */ \
\r
437 0, /* addr setup cycles */ \
\r
438 1, /* addr hold cycles */ \
\r
439 0, /* read setup cycles */ \
\r
440 0, /* read strobe cycles */ \
\r
441 0, /* read hold cycles */ \
\r
442 0, /* write setup cycles */ \
\r
443 0, /* write strobe cycles */ \
\r
444 1, /* write hold cycles */ \
\r
445 true, /* enable EBI */ \
\r
449 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
451 /** TFT Initialization structure */
\r
454 /** External memory bank for driving display */
\r
455 EBI_TFTBank_TypeDef bank;
\r
457 EBI_TFTWidth_TypeDef width;
\r
458 /** Color source for masking and alpha blending */
\r
459 EBI_TFTColorSrc_TypeDef colSrc;
\r
460 /** Bus Interleave mode */
\r
461 EBI_TFTInterleave_TypeDef interleave;
\r
462 /** Trigger for updating frame buffer pointer */
\r
463 EBI_TFTFrameBufTrigger_TypeDef fbTrigger;
\r
464 /** Drive DCLK from negative clock edge of internal clock */
\r
466 /** Masking and alpha blending mode */
\r
467 EBI_TFTMaskBlend_TypeDef maskBlend;
\r
468 /** TFT Direct Drive mode */
\r
469 EBI_TFTDDMode_TypeDef driveMode;
\r
470 /** TFT Polarity for Chip Select (CS) Line */
\r
471 EBI_Polarity_TypeDef csPolarity;
\r
472 /** TFT Polarity for Data Clock (DCLK) Line */
\r
473 EBI_Polarity_TypeDef dclkPolarity;
\r
474 /** TFT Polarity for Data Enable (DATAEN) Line */
\r
475 EBI_Polarity_TypeDef dataenPolarity;
\r
476 /** TFT Polarity for Horizontal Sync (HSYNC) Line */
\r
477 EBI_Polarity_TypeDef hsyncPolarity;
\r
478 /** TFT Polarity for Vertical Sync (VSYNC) Line */
\r
479 EBI_Polarity_TypeDef vsyncPolarity;
\r
480 /** Horizontal size in pixels */
\r
482 /** Horizontal Front Porch Size */
\r
484 /** Horizontal Back Porch Size */
\r
486 /** Horizontal Synchronization Pulse Width */
\r
488 /** Vertical size in pixels */
\r
490 /** Vertical Front Porch Size */
\r
492 /** Vertical Back Porch Size */
\r
494 /** Vertical Synchronization Pulse Width */
\r
496 /** TFT Frame Buffer address, offset to EBI bank base address */
\r
497 uint32_t addressOffset;
\r
498 /** TFT DCLK period in internal cycles */
\r
500 /** Starting position of External Direct Drive relative to DCLK inactive edge */
\r
502 /** Number of cycles RGB data is driven before active edge of DCLK */
\r
504 /** Number of cycles RGB data is held after active edge of DCLK */
\r
506 } EBI_TFTInit_TypeDef;
\r
508 /** Default configuration for EBI TFT init structure */
\r
509 #define EBI_TFTINIT_DEFAULT \
\r
510 { ebiTFTBank0, /* Select EBI Bank 0 */ \
\r
511 ebiTFTWidthHalfWord, /* Select 2-byte increments */ \
\r
512 ebiTFTColorSrcMem, /* Use memory as source for mask/blending */ \
\r
513 ebiTFTInterleaveUnlimited, /* Unlimited interleaved accesses */ \
\r
514 ebiTFTFrameBufTriggerVSync, /* VSYNC as frame buffer update trigger */ \
\r
515 false, /* Drive DCLK from negative edge of internal clock */ \
\r
516 ebiTFTMBDisabled, /* No masking and alpha blending enabled */ \
\r
517 ebiTFTDDModeExternal, /* Drive from external memory */ \
\r
518 ebiActiveLow, /* CS Active Low polarity */ \
\r
519 ebiActiveLow, /* DCLK Active Low polarity */ \
\r
520 ebiActiveLow, /* DATAEN Active Low polarity */ \
\r
521 ebiActiveLow, /* HSYNC Active Low polarity */ \
\r
522 ebiActiveLow, /* VSYNC Active Low polarity */ \
\r
523 320, /* Horizontal size in pixels */ \
\r
524 1, /* Horizontal Front Porch */ \
\r
525 29, /* Horizontal Back Porch */ \
\r
526 2, /* Horizontal Synchronization Pulse Width */ \
\r
527 240, /* Vertical size in pixels */ \
\r
528 1, /* Vertical Front Porch */ \
\r
529 4, /* Vertical Back Porch */ \
\r
530 2, /* Vertical Synchronization Pulse Width */ \
\r
531 0x0000, /* Address offset to EBI memory base */ \
\r
532 5, /* DCLK Period */ \
\r
533 2, /* DCLK Start */ \
\r
534 1, /* DCLK Setup cycles */ \
\r
535 1, /* DCLK Hold cycles */ \
\r
539 /*******************************************************************************
\r
540 ***************************** PROTOTYPES **********************************
\r
541 ******************************************************************************/
\r
543 void EBI_Init(const EBI_Init_TypeDef *ebiInit);
\r
544 void EBI_Disable(void);
\r
545 uint32_t EBI_BankAddress(uint32_t bank);
\r
546 void EBI_BankEnable(uint32_t banks, bool enable);
\r
548 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
549 void EBI_TFTInit(const EBI_TFTInit_TypeDef *ebiTFTInit);
\r
550 void EBI_TFTSizeSet(uint32_t horizontal, uint32_t vertical);
\r
551 void EBI_TFTHPorchSet(int front, int back, int pulseWidth);
\r
552 void EBI_TFTVPorchSet(int front, int back, int pulseWidth);
\r
553 void EBI_TFTTimingSet(int dclkPeriod, int start, int setup, int hold);
\r
556 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
\r
557 /* This functionality is only available on devices with independent timing support */
\r
558 void EBI_BankReadTimingSet(uint32_t bank, int setupCycles, int strobeCycles, int holdCycles);
\r
559 void EBI_BankReadTimingConfig(uint32_t bank, bool pageMode, bool prefetch, bool halfRE);
\r
561 void EBI_BankWriteTimingSet(uint32_t bank, int setupCycles, int strobeCycles, int holdCycles);
\r
562 void EBI_BankWriteTimingConfig(uint32_t bank, bool writeBufDisable, bool halfWE);
\r
564 void EBI_BankAddressTimingSet(uint32_t bank, int setupCycles, int holdCycles);
\r
565 void EBI_BankAddressTimingConfig(uint32_t bank, bool halfALE);
\r
567 void EBI_BankPolaritySet(uint32_t bank, EBI_Line_TypeDef line, EBI_Polarity_TypeDef polarity);
\r
568 void EBI_BankByteLaneEnable(uint32_t bank, bool enable);
\r
569 void EBI_AltMapEnable(bool enable);
\r
571 /***************************************************************************//**
\r
573 * Enable or disable TFT Direct Drive
\r
576 * Drive from Internal or External memory, or Disable Direct Drive
\r
577 ******************************************************************************/
\r
578 __STATIC_INLINE void EBI_TFTEnable(EBI_TFTDDMode_TypeDef mode)
\r
580 EBI->TFTCTRL = (EBI->TFTCTRL & ~(_EBI_TFTCTRL_DD_MASK)) | (uint32_t) mode;
\r
584 /***************************************************************************//**
\r
586 * Configure frame buffer pointer
\r
588 * @param[in] address
\r
589 * Frame pointer address, as offset by EBI base address
\r
590 ******************************************************************************/
\r
591 __STATIC_INLINE void EBI_TFTFrameBaseSet(uint32_t address)
\r
593 EBI->TFTFRAMEBASE = (uint32_t) address;
\r
597 /***************************************************************************//**
\r
598 * @brief Set TFT Pixel Color 0 or 1
\r
601 * Which pixel instance to set
\r
603 * Color of pixel, 16-bit value
\r
604 ******************************************************************************/
\r
605 __STATIC_INLINE void EBI_TFTPixelSet(int pixel, uint32_t color)
\r
607 EFM_ASSERT(pixel == 0 || pixel == 1);
\r
611 EBI->TFTPIXEL0 = color;
\r
615 EBI->TFTPIXEL1 = color;
\r
620 /***************************************************************************//**
\r
621 * @brief Masking and Blending Mode Set
\r
623 * @param[in] maskBlend
\r
624 * Masking and alpha blending mode
\r
625 ******************************************************************************/
\r
626 __STATIC_INLINE void EBI_TFTMaskBlendMode(EBI_TFTMaskBlend_TypeDef maskBlend)
\r
628 EBI->TFTCTRL = (EBI->TFTCTRL & (~_EBI_TFTCTRL_MASKBLEND_MASK))|maskBlend;
\r
632 /***************************************************************************//**
\r
633 * @brief Set TFT Alpha Blending Factor
\r
636 * 8-bit value indicating blending factor
\r
637 ******************************************************************************/
\r
638 __STATIC_INLINE void EBI_TFTAlphaBlendSet(uint8_t alpha)
\r
640 EBI->TFTALPHA = alpha;
\r
644 /***************************************************************************//**
\r
645 * @brief Set TFT mask value
\r
646 * Data accesses that matches this value are suppressed
\r
648 ******************************************************************************/
\r
649 __STATIC_INLINE void EBI_TFTMaskSet(uint32_t mask)
\r
651 EBI->TFTMASK = mask;
\r
655 /***************************************************************************//**
\r
656 * @brief Get current vertical position counter
\r
658 * Returns the current line position for the visible part of a frame
\r
659 ******************************************************************************/
\r
660 __STATIC_INLINE uint32_t EBI_TFTVCount(void)
\r
662 return((EBI->TFTSTATUS & _EBI_TFTSTATUS_VCNT_MASK) >> _EBI_TFTSTATUS_VCNT_SHIFT);
\r
666 /***************************************************************************//**
\r
667 * @brief Get current horizontal position counter
\r
669 * Returns the current horizontal pixel position within a visible line
\r
670 ******************************************************************************/
\r
671 __STATIC_INLINE uint32_t EBI_TFTHCount(void)
\r
673 return((EBI->TFTSTATUS & _EBI_TFTSTATUS_HCNT_MASK) >> _EBI_TFTSTATUS_HCNT_SHIFT);
\r
677 /***************************************************************************//**
\r
678 * @brief Set Frame Buffer Trigger
\r
681 * Frame buffer pointer will be updated either on each horizontal line (hsync)
\r
682 * or vertical update (vsync).
\r
685 * Trigger update of frame buffer pointer on vertical or horisontal sync.
\r
686 ******************************************************************************/
\r
687 __STATIC_INLINE void EBI_TFTFBTriggerSet(EBI_TFTFrameBufTrigger_TypeDef sync)
\r
689 EBI->TFTCTRL = ((EBI->TFTCTRL & ~_EBI_TFTCTRL_FBCTRIG_MASK)|sync);
\r
693 /***************************************************************************//**
\r
694 * @brief Set horizontal TFT stride value in number of bytes
\r
696 * @param[in] nbytes
\r
697 * Number of bytes to add to frame buffer pointer after each horizontal line
\r
699 ******************************************************************************/
\r
700 __STATIC_INLINE void EBI_TFTHStrideSet(uint32_t nbytes)
\r
702 EFM_ASSERT(nbytes < 0x1000);
\r
704 EBI->TFTSTRIDE = (EBI->TFTSTRIDE & ~(_EBI_TFTSTRIDE_HSTRIDE_MASK))|
\r
705 (nbytes<<_EBI_TFTSTRIDE_HSTRIDE_SHIFT);
\r
709 /***************************************************************************//**
\r
711 * Clear one or more pending EBI interrupts.
\r
713 * Pending EBI interrupt source to clear. Use a logical OR combination
\r
714 * of valid interrupt flags for the EBI module (EBI_IF_nnn).
\r
715 ******************************************************************************/
\r
716 __STATIC_INLINE void EBI_IntClear(uint32_t flags)
\r
722 /***************************************************************************//**
\r
724 * Set one or more pending EBI interrupts from SW.
\r
727 * EBI interrupt sources to set to pending. Use a logical OR combination of
\r
728 * valid interrupt flags for the EBI module (EBI_IF_nnn).
\r
729 ******************************************************************************/
\r
730 __STATIC_INLINE void EBI_IntSet(uint32_t flags)
\r
736 /***************************************************************************//**
\r
738 * Disable one or more EBI interrupts
\r
741 * EBI interrupt sources to disable. Use logical OR combination of valid
\r
742 * interrupt flags for the EBI module (EBI_IF_nnn)
\r
743 ******************************************************************************/
\r
744 __STATIC_INLINE void EBI_IntDisable(uint32_t flags)
\r
746 EBI->IEN &= ~(flags);
\r
750 /***************************************************************************//**
\r
752 * Enable one or more EBI interrupts
\r
755 * EBI interrupt sources to enable. Use logical OR combination of valid
\r
756 * interrupt flags for the EBI module (EBI_IF_nnn)
\r
757 ******************************************************************************/
\r
758 __STATIC_INLINE void EBI_IntEnable(uint32_t flags)
\r
764 /***************************************************************************//**
\r
766 * Get pending EBI interrupt flags
\r
769 * The event bits are not cleared by the use of this function
\r
772 * EBI interrupt sources pending, a logical combination of valid EBI
\r
773 * interrupt flags, EBI_IF_nnn
\r
774 ******************************************************************************/
\r
775 __STATIC_INLINE uint32_t EBI_IntGet(void)
\r
781 /***************************************************************************//**
\r
783 * Start ECC generator on NAND flash transfers.
\r
784 ******************************************************************************/
\r
785 __STATIC_INLINE void EBI_StartNandEccGen(void)
\r
787 EBI->CMD = EBI_CMD_ECCSTART | EBI_CMD_ECCCLEAR;
\r
791 /***************************************************************************//**
\r
793 * Stop NAND flash ECC generator and return generated ECC.
\r
796 * The generated ECC.
\r
797 ******************************************************************************/
\r
798 __STATIC_INLINE uint32_t EBI_StopNandEccGen( void )
\r
800 EBI->CMD = EBI_CMD_ECCSTOP;
\r
801 return EBI->ECCPARITY;
\r
805 void EBI_ChipSelectEnable(uint32_t banks, bool enable);
\r
806 void EBI_ReadTimingSet(int setupCycles, int strobeCycles, int holdCycles);
\r
807 void EBI_WriteTimingSet(int setupCycles, int strobeCycles, int holdCycles);
\r
808 void EBI_AddressTimingSet(int setupCycles, int holdCycles);
\r
809 void EBI_PolaritySet(EBI_Line_TypeDef line, EBI_Polarity_TypeDef polarity);
\r
811 /** @} (end addtogroup EBI) */
\r
812 /** @} (end addtogroup EM_Library) */
\r
818 #endif /* defined(EBI_COUNT) && (EBI_COUNT > 0) */
\r
820 #endif /* __SILICON_LABS_EM_EBI_H_ */
\r