The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Wed Apr 29 10:16:23 2015 +0100
Revision:
98:8ab26030e058
Child:
113:f141b2784e32
Release 98 of the mbed library

Changes:
- Silabs new targets (Giant, Zero, Happy, Leopard, Wonder Geckos)
- Asynchronous SPI, I2C, Serial
- LowPower classes
- Nordic - nordic SDK v8.0 update
- Teensy - gcc arm fix for startup
- Nucleo F411 - usb freq fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 98:8ab26030e058 1 /***************************************************************************//**
Kojto 98:8ab26030e058 2 * @file em_ebi.h
Kojto 98:8ab26030e058 3 * @brief External Bus Iterface (EBI) peripheral API
Kojto 98:8ab26030e058 4 * @version 3.20.12
Kojto 98:8ab26030e058 5 *******************************************************************************
Kojto 98:8ab26030e058 6 * @section License
Kojto 98:8ab26030e058 7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
Kojto 98:8ab26030e058 8 *******************************************************************************
Kojto 98:8ab26030e058 9 *
Kojto 98:8ab26030e058 10 * Permission is granted to anyone to use this software for any purpose,
Kojto 98:8ab26030e058 11 * including commercial applications, and to alter it and redistribute it
Kojto 98:8ab26030e058 12 * freely, subject to the following restrictions:
Kojto 98:8ab26030e058 13 *
Kojto 98:8ab26030e058 14 * 1. The origin of this software must not be misrepresented; you must not
Kojto 98:8ab26030e058 15 * claim that you wrote the original software.
Kojto 98:8ab26030e058 16 * 2. Altered source versions must be plainly marked as such, and must not be
Kojto 98:8ab26030e058 17 * misrepresented as being the original software.
Kojto 98:8ab26030e058 18 * 3. This notice may not be removed or altered from any source distribution.
Kojto 98:8ab26030e058 19 *
Kojto 98:8ab26030e058 20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
Kojto 98:8ab26030e058 21 * obligation to support this Software. Silicon Labs is providing the
Kojto 98:8ab26030e058 22 * Software "AS IS", with no express or implied warranties of any kind,
Kojto 98:8ab26030e058 23 * including, but not limited to, any implied warranties of merchantability
Kojto 98:8ab26030e058 24 * or fitness for any particular purpose or warranties against infringement
Kojto 98:8ab26030e058 25 * of any proprietary rights of a third party.
Kojto 98:8ab26030e058 26 *
Kojto 98:8ab26030e058 27 * Silicon Labs will not be liable for any consequential, incidental, or
Kojto 98:8ab26030e058 28 * special damages, or any other relief, or for any claim by any third party,
Kojto 98:8ab26030e058 29 * arising from your use of this Software.
Kojto 98:8ab26030e058 30 *
Kojto 98:8ab26030e058 31 ******************************************************************************/
Kojto 98:8ab26030e058 32
Kojto 98:8ab26030e058 33
Kojto 98:8ab26030e058 34 #ifndef __SILICON_LABS_EM_EBI_H_
Kojto 98:8ab26030e058 35 #define __SILICON_LABS_EM_EBI_H_
Kojto 98:8ab26030e058 36
Kojto 98:8ab26030e058 37 #include "em_device.h"
Kojto 98:8ab26030e058 38
Kojto 98:8ab26030e058 39 #if defined(EBI_COUNT) && (EBI_COUNT > 0)
Kojto 98:8ab26030e058 40 #include "em_assert.h"
Kojto 98:8ab26030e058 41
Kojto 98:8ab26030e058 42 #include <stdint.h>
Kojto 98:8ab26030e058 43 #include <stdbool.h>
Kojto 98:8ab26030e058 44
Kojto 98:8ab26030e058 45 #ifdef __cplusplus
Kojto 98:8ab26030e058 46 extern "C" {
Kojto 98:8ab26030e058 47 #endif
Kojto 98:8ab26030e058 48
Kojto 98:8ab26030e058 49 /***************************************************************************//**
Kojto 98:8ab26030e058 50 * @addtogroup EM_Library
Kojto 98:8ab26030e058 51 * @{
Kojto 98:8ab26030e058 52 ******************************************************************************/
Kojto 98:8ab26030e058 53
Kojto 98:8ab26030e058 54 /***************************************************************************//**
Kojto 98:8ab26030e058 55 * @addtogroup EBI
Kojto 98:8ab26030e058 56 * @{
Kojto 98:8ab26030e058 57 ******************************************************************************/
Kojto 98:8ab26030e058 58
Kojto 98:8ab26030e058 59 /***************************************************************************//**
Kojto 98:8ab26030e058 60 * @verbatim
Kojto 98:8ab26030e058 61 *
Kojto 98:8ab26030e058 62 * --------- ---------
Kojto 98:8ab26030e058 63 * | EBI | /| |\ | Ext. |
Kojto 98:8ab26030e058 64 * | | / --------- \ | Async |
Kojto 98:8ab26030e058 65 * |(EFM32)| \ --------- / | Device|
Kojto 98:8ab26030e058 66 * | | \| |/ | |
Kojto 98:8ab26030e058 67 * --------- ---------
Kojto 98:8ab26030e058 68 * Parallel interface
Kojto 98:8ab26030e058 69 *
Kojto 98:8ab26030e058 70 * @endverbatim
Kojto 98:8ab26030e058 71 ******************************************************************************/
Kojto 98:8ab26030e058 72
Kojto 98:8ab26030e058 73 /*******************************************************************************
Kojto 98:8ab26030e058 74 ******************************* DEFINES ***********************************
Kojto 98:8ab26030e058 75 ******************************************************************************/
Kojto 98:8ab26030e058 76
Kojto 98:8ab26030e058 77 #define EBI_BANK0 (uint32_t)(1 << 1) /**< EBI address bank 0 */
Kojto 98:8ab26030e058 78 #define EBI_BANK1 (uint32_t)(1 << 2) /**< EBI address bank 1 */
Kojto 98:8ab26030e058 79 #define EBI_BANK2 (uint32_t)(1 << 3) /**< EBI address bank 2 */
Kojto 98:8ab26030e058 80 #define EBI_BANK3 (uint32_t)(1 << 4) /**< EBI address bank 3 */
Kojto 98:8ab26030e058 81
Kojto 98:8ab26030e058 82 #define EBI_CS0 (uint32_t)(1 << 1) /**< EBI chip select line 0 */
Kojto 98:8ab26030e058 83 #define EBI_CS1 (uint32_t)(1 << 2) /**< EBI chip select line 1 */
Kojto 98:8ab26030e058 84 #define EBI_CS2 (uint32_t)(1 << 3) /**< EBI chip select line 2 */
Kojto 98:8ab26030e058 85 #define EBI_CS3 (uint32_t)(1 << 4) /**< EBI chip select line 3 */
Kojto 98:8ab26030e058 86
Kojto 98:8ab26030e058 87 /*******************************************************************************
Kojto 98:8ab26030e058 88 ******************************** ENUMS ************************************
Kojto 98:8ab26030e058 89 ******************************************************************************/
Kojto 98:8ab26030e058 90
Kojto 98:8ab26030e058 91 /** EBI Mode of operation */
Kojto 98:8ab26030e058 92 typedef enum
Kojto 98:8ab26030e058 93 {
Kojto 98:8ab26030e058 94 /** 8 data bits, 8 address bits */
Kojto 98:8ab26030e058 95 ebiModeD8A8 = EBI_CTRL_MODE_D8A8,
Kojto 98:8ab26030e058 96 /** 16 data bits, 16 address bits, using address latch enable */
Kojto 98:8ab26030e058 97 ebiModeD16A16ALE = EBI_CTRL_MODE_D16A16ALE,
Kojto 98:8ab26030e058 98 /** 8 data bits, 24 address bits, using address latch enable */
Kojto 98:8ab26030e058 99 ebiModeD8A24ALE = EBI_CTRL_MODE_D8A24ALE,
Kojto 98:8ab26030e058 100 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 101 /** Mode D16 */
Kojto 98:8ab26030e058 102 ebiModeD16 = EBI_CTRL_MODE_D16,
Kojto 98:8ab26030e058 103 #endif
Kojto 98:8ab26030e058 104 } EBI_Mode_TypeDef;
Kojto 98:8ab26030e058 105
Kojto 98:8ab26030e058 106 /** EBI Polarity configuration */
Kojto 98:8ab26030e058 107 typedef enum
Kojto 98:8ab26030e058 108 {
Kojto 98:8ab26030e058 109 /** Active Low */
Kojto 98:8ab26030e058 110 ebiActiveLow = 0,
Kojto 98:8ab26030e058 111 /** Active High */
Kojto 98:8ab26030e058 112 ebiActiveHigh = 1
Kojto 98:8ab26030e058 113 } EBI_Polarity_TypeDef;
Kojto 98:8ab26030e058 114
Kojto 98:8ab26030e058 115 /** EBI Pin Line types */
Kojto 98:8ab26030e058 116 typedef enum
Kojto 98:8ab26030e058 117 {
Kojto 98:8ab26030e058 118 /** Address Ready line */
Kojto 98:8ab26030e058 119 ebiLineARDY,
Kojto 98:8ab26030e058 120 /** Address Latch Enable line */
Kojto 98:8ab26030e058 121 ebiLineALE,
Kojto 98:8ab26030e058 122 /** Write Enable line */
Kojto 98:8ab26030e058 123 ebiLineWE,
Kojto 98:8ab26030e058 124 /** Read Enable line */
Kojto 98:8ab26030e058 125 ebiLineRE,
Kojto 98:8ab26030e058 126 /** Chip Select line */
Kojto 98:8ab26030e058 127 ebiLineCS,
Kojto 98:8ab26030e058 128 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 129 /** BL line */
Kojto 98:8ab26030e058 130 ebiLineBL,
Kojto 98:8ab26030e058 131 #endif
Kojto 98:8ab26030e058 132 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 133 /** TFT VSYNC line */
Kojto 98:8ab26030e058 134 ebiLineTFTVSync,
Kojto 98:8ab26030e058 135 /** TFT HSYNC line */
Kojto 98:8ab26030e058 136 ebiLineTFTHSync,
Kojto 98:8ab26030e058 137 /** TFT Data enable line */
Kojto 98:8ab26030e058 138 ebiLineTFTDataEn,
Kojto 98:8ab26030e058 139 /** TFT DCLK line */
Kojto 98:8ab26030e058 140 ebiLineTFTDClk,
Kojto 98:8ab26030e058 141 /** TFT Chip select line */
Kojto 98:8ab26030e058 142 ebiLineTFTCS,
Kojto 98:8ab26030e058 143 #endif
Kojto 98:8ab26030e058 144 } EBI_Line_TypeDef;
Kojto 98:8ab26030e058 145
Kojto 98:8ab26030e058 146 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 147 /** Address Pin Enable, lower limit - lower range of pins to enable */
Kojto 98:8ab26030e058 148 typedef enum
Kojto 98:8ab26030e058 149 {
Kojto 98:8ab26030e058 150 /** Adress lines EBI_A[0] and upwards are enabled by APEN */
Kojto 98:8ab26030e058 151 ebiALowA0 = EBI_ROUTE_ALB_A0,
Kojto 98:8ab26030e058 152 /** Adress lines EBI_A[8] and upwards are enabled by APEN */
Kojto 98:8ab26030e058 153 ebiALowA8 = EBI_ROUTE_ALB_A8,
Kojto 98:8ab26030e058 154 /** Adress lines EBI_A[16] and upwards are enabled by APEN */
Kojto 98:8ab26030e058 155 ebiALowA16 = EBI_ROUTE_ALB_A16,
Kojto 98:8ab26030e058 156 /** Adress lines EBI_A[24] and upwards are enabled by APEN */
Kojto 98:8ab26030e058 157 ebiALowA24 = EBI_ROUTE_ALB_A24,
Kojto 98:8ab26030e058 158 } EBI_ALow_TypeDef;
Kojto 98:8ab26030e058 159
Kojto 98:8ab26030e058 160 /** Adress Pin Enable, high limit - higher limit of pins to enable */
Kojto 98:8ab26030e058 161 typedef enum
Kojto 98:8ab26030e058 162 {
Kojto 98:8ab26030e058 163 /** All EBI_A pins are disabled */
Kojto 98:8ab26030e058 164 ebiAHighA0 = EBI_ROUTE_APEN_A0,
Kojto 98:8ab26030e058 165 /** All EBI_A[4:ALow] are enabled */
Kojto 98:8ab26030e058 166 ebiAHighA5 = EBI_ROUTE_APEN_A5,
Kojto 98:8ab26030e058 167 /** All EBI_A[5:ALow] are enabled */
Kojto 98:8ab26030e058 168 ebiAHighA6 = EBI_ROUTE_APEN_A6,
Kojto 98:8ab26030e058 169 /** All EBI_A[6:ALow] are enabled */
Kojto 98:8ab26030e058 170 ebiAHighA7 = EBI_ROUTE_APEN_A7,
Kojto 98:8ab26030e058 171 /** All EBI_A[7:ALow] are enabled */
Kojto 98:8ab26030e058 172 ebiAHighA8 = EBI_ROUTE_APEN_A8,
Kojto 98:8ab26030e058 173 /** All EBI_A[8:ALow] are enabled */
Kojto 98:8ab26030e058 174 ebiAHighA9 = EBI_ROUTE_APEN_A9,
Kojto 98:8ab26030e058 175 /** All EBI_A[9:ALow] are enabled */
Kojto 98:8ab26030e058 176 ebiAHighA10 = EBI_ROUTE_APEN_A10,
Kojto 98:8ab26030e058 177 /** All EBI_A[10:ALow] are enabled */
Kojto 98:8ab26030e058 178 ebiAHighA11 = EBI_ROUTE_APEN_A11,
Kojto 98:8ab26030e058 179 /** All EBI_A[11:ALow] are enabled */
Kojto 98:8ab26030e058 180 ebiAHighA12 = EBI_ROUTE_APEN_A12,
Kojto 98:8ab26030e058 181 /** All EBI_A[12:ALow] are enabled */
Kojto 98:8ab26030e058 182 ebiAHighA13 = EBI_ROUTE_APEN_A13,
Kojto 98:8ab26030e058 183 /** All EBI_A[13:ALow] are enabled */
Kojto 98:8ab26030e058 184 ebiAHighA14 = EBI_ROUTE_APEN_A14,
Kojto 98:8ab26030e058 185 /** All EBI_A[14:ALow] are enabled */
Kojto 98:8ab26030e058 186 ebiAHighA15 = EBI_ROUTE_APEN_A15,
Kojto 98:8ab26030e058 187 /** All EBI_A[15:ALow] are enabled */
Kojto 98:8ab26030e058 188 ebiAHighA16 = EBI_ROUTE_APEN_A16,
Kojto 98:8ab26030e058 189 /** All EBI_A[16:ALow] are enabled */
Kojto 98:8ab26030e058 190 ebiAHighA17 = EBI_ROUTE_APEN_A17,
Kojto 98:8ab26030e058 191 /** All EBI_A[17:ALow] are enabled */
Kojto 98:8ab26030e058 192 ebiAHighA18 = EBI_ROUTE_APEN_A18,
Kojto 98:8ab26030e058 193 /** All EBI_A[18:ALow] are enabled */
Kojto 98:8ab26030e058 194 ebiAHighA19 = EBI_ROUTE_APEN_A19,
Kojto 98:8ab26030e058 195 /** All EBI_A[19:ALow] are enabled */
Kojto 98:8ab26030e058 196 ebiAHighA20 = EBI_ROUTE_APEN_A20,
Kojto 98:8ab26030e058 197 /** All EBI_A[20:ALow] are enabled */
Kojto 98:8ab26030e058 198 ebiAHighA21 = EBI_ROUTE_APEN_A21,
Kojto 98:8ab26030e058 199 /** All EBI_A[21:ALow] are enabled */
Kojto 98:8ab26030e058 200 ebiAHighA22 = EBI_ROUTE_APEN_A22,
Kojto 98:8ab26030e058 201 /** All EBI_A[22:ALow] are enabled */
Kojto 98:8ab26030e058 202 ebiAHighA23 = EBI_ROUTE_APEN_A23,
Kojto 98:8ab26030e058 203 /** All EBI_A[23:ALow] are enabled */
Kojto 98:8ab26030e058 204 ebiAHighA24 = EBI_ROUTE_APEN_A24,
Kojto 98:8ab26030e058 205 /** All EBI_A[24:ALow] are enabled */
Kojto 98:8ab26030e058 206 ebiAHighA25 = EBI_ROUTE_APEN_A25,
Kojto 98:8ab26030e058 207 /** All EBI_A[25:ALow] are enabled */
Kojto 98:8ab26030e058 208 ebiAHighA26 = EBI_ROUTE_APEN_A26,
Kojto 98:8ab26030e058 209 /** All EBI_A[26:ALow] are enabled */
Kojto 98:8ab26030e058 210 ebiAHighA27 = EBI_ROUTE_APEN_A27,
Kojto 98:8ab26030e058 211 /** All EBI_A[27:ALow] are enabled */
Kojto 98:8ab26030e058 212 ebiAHighA28 = EBI_ROUTE_APEN_A28,
Kojto 98:8ab26030e058 213 } EBI_AHigh_TypeDef;
Kojto 98:8ab26030e058 214
Kojto 98:8ab26030e058 215 /** EBI I/O Alternate Pin Location */
Kojto 98:8ab26030e058 216 typedef enum {
Kojto 98:8ab26030e058 217 /** EBI PIN I/O Location 0 */
Kojto 98:8ab26030e058 218 ebiLocation0 = EBI_ROUTE_LOCATION_LOC0,
Kojto 98:8ab26030e058 219 /** EBI PIN I/O Location 1 */
Kojto 98:8ab26030e058 220 ebiLocation1 = EBI_ROUTE_LOCATION_LOC1,
Kojto 98:8ab26030e058 221 /** EBI PIN I/O Location 2 */
Kojto 98:8ab26030e058 222 ebiLocation2 = EBI_ROUTE_LOCATION_LOC2
Kojto 98:8ab26030e058 223 } EBI_Location_TypeDef;
Kojto 98:8ab26030e058 224 #endif
Kojto 98:8ab26030e058 225
Kojto 98:8ab26030e058 226 /* TFT support */
Kojto 98:8ab26030e058 227 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 228 /** EBI TFT Graphics Bank Select */
Kojto 98:8ab26030e058 229 typedef enum
Kojto 98:8ab26030e058 230 {
Kojto 98:8ab26030e058 231 /** Memory BANK0 contains frame buffer */
Kojto 98:8ab26030e058 232 ebiTFTBank0 = EBI_TFTCTRL_BANKSEL_BANK0,
Kojto 98:8ab26030e058 233 /** Memory BANK1 contains frame buffer */
Kojto 98:8ab26030e058 234 ebiTFTBank1 = EBI_TFTCTRL_BANKSEL_BANK1,
Kojto 98:8ab26030e058 235 /** Memory BANK2 contains frame buffer */
Kojto 98:8ab26030e058 236 ebiTFTBank2 = EBI_TFTCTRL_BANKSEL_BANK2,
Kojto 98:8ab26030e058 237 /** Memory BANK3 contains frame buffer */
Kojto 98:8ab26030e058 238 ebiTFTBank3 = EBI_TFTCTRL_BANKSEL_BANK3
Kojto 98:8ab26030e058 239 } EBI_TFTBank_TypeDef;
Kojto 98:8ab26030e058 240
Kojto 98:8ab26030e058 241 /** Masking and Alpha blending source color*/
Kojto 98:8ab26030e058 242 typedef enum
Kojto 98:8ab26030e058 243 {
Kojto 98:8ab26030e058 244 /** Use memory as source color for masking/alpha blending */
Kojto 98:8ab26030e058 245 ebiTFTColorSrcMem = EBI_TFTCTRL_COLOR1SRC_MEM,
Kojto 98:8ab26030e058 246 /** Use PIXEL1 register as source color for masking/alpha blending */
Kojto 98:8ab26030e058 247 ebiTFTColorSrcPixel1 = EBI_TFTCTRL_COLOR1SRC_PIXEL1,
Kojto 98:8ab26030e058 248 } EBI_TFTColorSrc_TypeDef;
Kojto 98:8ab26030e058 249
Kojto 98:8ab26030e058 250 /** Bus Data Interleave Mode */
Kojto 98:8ab26030e058 251 typedef enum
Kojto 98:8ab26030e058 252 {
Kojto 98:8ab26030e058 253 /** Unlimited interleaved accesses per EBI_DCLK period. Can cause jitter */
Kojto 98:8ab26030e058 254 ebiTFTInterleaveUnlimited = EBI_TFTCTRL_INTERLEAVE_UNLIMITED,
Kojto 98:8ab26030e058 255 /** Allow 1 interleaved access per EBI_DCLK period */
Kojto 98:8ab26030e058 256 ebiTFTInterleaveOnePerDClk = EBI_TFTCTRL_INTERLEAVE_ONEPERDCLK,
Kojto 98:8ab26030e058 257 /** Only allow accesses during porch periods */
Kojto 98:8ab26030e058 258 ebiTFTInterleavePorch = EBI_TFTCTRL_INTERLEAVE_PORCH,
Kojto 98:8ab26030e058 259 } EBI_TFTInterleave_TypeDef;
Kojto 98:8ab26030e058 260
Kojto 98:8ab26030e058 261 /** Control frame base pointer copy */
Kojto 98:8ab26030e058 262 typedef enum
Kojto 98:8ab26030e058 263 {
Kojto 98:8ab26030e058 264 /** Trigger update of frame buffer pointer on vertical sync */
Kojto 98:8ab26030e058 265 ebiTFTFrameBufTriggerVSync = EBI_TFTCTRL_FBCTRIG_VSYNC,
Kojto 98:8ab26030e058 266 /** Trigger update of frame buffer pointer on horizontal sync */
Kojto 98:8ab26030e058 267 ebiTFTFrameBufTriggerHSync = EBI_TFTCTRL_FBCTRIG_HSYNC,
Kojto 98:8ab26030e058 268 } EBI_TFTFrameBufTrigger_TypeDef;
Kojto 98:8ab26030e058 269
Kojto 98:8ab26030e058 270 /** Control of mask and alpha blending mode */
Kojto 98:8ab26030e058 271 typedef enum
Kojto 98:8ab26030e058 272 {
Kojto 98:8ab26030e058 273 /** Masking and blending are disabled */
Kojto 98:8ab26030e058 274 ebiTFTMBDisabled = EBI_TFTCTRL_MASKBLEND_DISABLED,
Kojto 98:8ab26030e058 275 /** Internal masking */
Kojto 98:8ab26030e058 276 ebiTFTMBIMask = EBI_TFTCTRL_MASKBLEND_IMASK,
Kojto 98:8ab26030e058 277 /** Internal alpha blending */
Kojto 98:8ab26030e058 278 ebiTFTMBIAlpha = EBI_TFTCTRL_MASKBLEND_IALPHA,
Kojto 98:8ab26030e058 279 /** Internal masking and alpha blending are enabled */
Kojto 98:8ab26030e058 280 ebiTFTMBIMaskAlpha = EBI_TFTCTRL_MASKBLEND_IMASKIALPHA,
Kojto 98:8ab26030e058 281 /** External masking */
Kojto 98:8ab26030e058 282 ebiTFTMBEMask = EBI_TFTCTRL_MASKBLEND_EMASK,
Kojto 98:8ab26030e058 283 /** External alpha blending */
Kojto 98:8ab26030e058 284 ebiTFTMBEAlpha = EBI_TFTCTRL_MASKBLEND_EALPHA,
Kojto 98:8ab26030e058 285 /** External masking and alpha blending */
Kojto 98:8ab26030e058 286 ebiTFTMBEMaskAlpha = EBI_TFTCTRL_MASKBLEND_EMASKEALPHA,
Kojto 98:8ab26030e058 287 } EBI_TFTMaskBlend_TypeDef;
Kojto 98:8ab26030e058 288
Kojto 98:8ab26030e058 289 /** TFT Direct Drive mode */
Kojto 98:8ab26030e058 290 typedef enum
Kojto 98:8ab26030e058 291 {
Kojto 98:8ab26030e058 292 /** Disabled */
Kojto 98:8ab26030e058 293 ebiTFTDDModeDisabled = EBI_TFTCTRL_DD_DISABLED,
Kojto 98:8ab26030e058 294 /** Direct Drive from internal memory */
Kojto 98:8ab26030e058 295 ebiTFTDDModeInternal = EBI_TFTCTRL_DD_INTERNAL,
Kojto 98:8ab26030e058 296 /** Direct Drive from external memory */
Kojto 98:8ab26030e058 297 ebiTFTDDModeExternal = EBI_TFTCTRL_DD_EXTERNAL,
Kojto 98:8ab26030e058 298 } EBI_TFTDDMode_TypeDef;
Kojto 98:8ab26030e058 299
Kojto 98:8ab26030e058 300 /** TFT Data Increment Width */
Kojto 98:8ab26030e058 301 typedef enum
Kojto 98:8ab26030e058 302 {
Kojto 98:8ab26030e058 303 /** Pixel increments are 1 byte at a time */
Kojto 98:8ab26030e058 304 ebiTFTWidthByte = EBI_TFTCTRL_WIDTH_BYTE,
Kojto 98:8ab26030e058 305 /** Pixel increments are 2 bytes (half word) */
Kojto 98:8ab26030e058 306 ebiTFTWidthHalfWord = EBI_TFTCTRL_WIDTH_HALFWORD,
Kojto 98:8ab26030e058 307 } EBI_TFTWidth_TypeDef;
Kojto 98:8ab26030e058 308
Kojto 98:8ab26030e058 309 #endif
Kojto 98:8ab26030e058 310
Kojto 98:8ab26030e058 311 /*******************************************************************************
Kojto 98:8ab26030e058 312 ******************************* STRUCTS ***********************************
Kojto 98:8ab26030e058 313 ******************************************************************************/
Kojto 98:8ab26030e058 314
Kojto 98:8ab26030e058 315 /** EBI Initialization structure */
Kojto 98:8ab26030e058 316 typedef struct
Kojto 98:8ab26030e058 317 {
Kojto 98:8ab26030e058 318 /** EBI operation mode, data and address limits */
Kojto 98:8ab26030e058 319 EBI_Mode_TypeDef mode;
Kojto 98:8ab26030e058 320 /** Address Ready pin polarity, active high or low */
Kojto 98:8ab26030e058 321 EBI_Polarity_TypeDef ardyPolarity;
Kojto 98:8ab26030e058 322 /** Address Latch Enable pin polarity, active high or low */
Kojto 98:8ab26030e058 323 EBI_Polarity_TypeDef alePolarity;
Kojto 98:8ab26030e058 324 /** Write Enable pin polarity, active high or low */
Kojto 98:8ab26030e058 325 EBI_Polarity_TypeDef wePolarity;
Kojto 98:8ab26030e058 326 /** Read Enable pin polarity, active high or low */
Kojto 98:8ab26030e058 327 EBI_Polarity_TypeDef rePolarity;
Kojto 98:8ab26030e058 328 /** Chip Select pin polarity, active high or low */
Kojto 98:8ab26030e058 329 EBI_Polarity_TypeDef csPolarity;
Kojto 98:8ab26030e058 330 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 331 /** Byte Lane pin polaritym, active high or low */
Kojto 98:8ab26030e058 332 EBI_Polarity_TypeDef blPolarity;
Kojto 98:8ab26030e058 333 /** Flag to enable or disable Byte Lane support */
Kojto 98:8ab26030e058 334 bool blEnable;
Kojto 98:8ab26030e058 335 /** Flag to enable or disable idle state insertion between transfers */
Kojto 98:8ab26030e058 336 bool noIdle;
Kojto 98:8ab26030e058 337 #endif
Kojto 98:8ab26030e058 338 /** Flag to enable or disable Address Ready support */
Kojto 98:8ab26030e058 339 bool ardyEnable;
Kojto 98:8ab26030e058 340 /** Set to turn off 32 cycle timeout ability */
Kojto 98:8ab26030e058 341 bool ardyDisableTimeout;
Kojto 98:8ab26030e058 342 /** Mask of flags which selects address banks to configure EBI_BANK<0-3> */
Kojto 98:8ab26030e058 343 uint32_t banks;
Kojto 98:8ab26030e058 344 /** Mask of flags which selects chip select lines to configure EBI_CS<0-3> */
Kojto 98:8ab26030e058 345 uint32_t csLines;
Kojto 98:8ab26030e058 346 /** Number of cycles address is held after Adress Latch Enable is asserted */
Kojto 98:8ab26030e058 347 int addrSetupCycles;
Kojto 98:8ab26030e058 348 /** Number of cycles address is driven onto the ADDRDAT bus before ALE is asserted */
Kojto 98:8ab26030e058 349 int addrHoldCycles;
Kojto 98:8ab26030e058 350 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 351 /** Enable or disables half cycle duration of the ALE strobe in the last address setup cycle */
Kojto 98:8ab26030e058 352 bool addrHalfALE;
Kojto 98:8ab26030e058 353 #endif
Kojto 98:8ab26030e058 354 /** Number of cycles for address setup before REn is asserted */
Kojto 98:8ab26030e058 355 int readSetupCycles;
Kojto 98:8ab26030e058 356 /** Number of cycles REn is held active */
Kojto 98:8ab26030e058 357 int readStrobeCycles;
Kojto 98:8ab26030e058 358 /** Number of cycles CSn is held active after REn is deasserted */
Kojto 98:8ab26030e058 359 int readHoldCycles;
Kojto 98:8ab26030e058 360 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 361 /** Enable or disable page mode reads */
Kojto 98:8ab26030e058 362 bool readPageMode;
Kojto 98:8ab26030e058 363 /** Enables or disable prefetching from sequential addresses */
Kojto 98:8ab26030e058 364 bool readPrefetch;
Kojto 98:8ab26030e058 365 /** Enabled or disables half cycle duration of the REn signal in the last strobe cycle */
Kojto 98:8ab26030e058 366 bool readHalfRE;
Kojto 98:8ab26030e058 367 #endif
Kojto 98:8ab26030e058 368 /** Number of cycles for address setup before WEn is asserted */
Kojto 98:8ab26030e058 369 int writeSetupCycles;
Kojto 98:8ab26030e058 370 /** Number of cycles WEn is held active */
Kojto 98:8ab26030e058 371 int writeStrobeCycles;
Kojto 98:8ab26030e058 372 /** Number of cycles CSn is held active after WEn is deasserted */
Kojto 98:8ab26030e058 373 int writeHoldCycles;
Kojto 98:8ab26030e058 374 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 375 /** Enable or disable the write buffer */
Kojto 98:8ab26030e058 376 bool writeBufferDisable;
Kojto 98:8ab26030e058 377 /** Enables or disables half cycle duration of the WEn signal in the last strobe cycle */
Kojto 98:8ab26030e058 378 bool writeHalfWE;
Kojto 98:8ab26030e058 379 /** Lower address pin limit to enable */
Kojto 98:8ab26030e058 380 EBI_ALow_TypeDef aLow;
Kojto 98:8ab26030e058 381 /** High address pin limit to enable */
Kojto 98:8ab26030e058 382 EBI_AHigh_TypeDef aHigh;
Kojto 98:8ab26030e058 383 /** Pin Location */
Kojto 98:8ab26030e058 384 EBI_Location_TypeDef location;
Kojto 98:8ab26030e058 385 #endif
Kojto 98:8ab26030e058 386 /** Flag, if EBI should be enabled after configuration */
Kojto 98:8ab26030e058 387 bool enable;
Kojto 98:8ab26030e058 388 } EBI_Init_TypeDef;
Kojto 98:8ab26030e058 389
Kojto 98:8ab26030e058 390 /** Default config for EBI init structures */
Kojto 98:8ab26030e058 391 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 392 #define EBI_INIT_DEFAULT \
Kojto 98:8ab26030e058 393 { ebiModeD8A8, /* 8 bit address, 8 bit data */ \
Kojto 98:8ab26030e058 394 ebiActiveLow, /* ARDY polarity */ \
Kojto 98:8ab26030e058 395 ebiActiveLow, /* ALE polarity */ \
Kojto 98:8ab26030e058 396 ebiActiveLow, /* WE polarity */ \
Kojto 98:8ab26030e058 397 ebiActiveLow, /* RE polarity */ \
Kojto 98:8ab26030e058 398 ebiActiveLow, /* CS polarity */ \
Kojto 98:8ab26030e058 399 ebiActiveLow, /* BL polarity */ \
Kojto 98:8ab26030e058 400 false, /* enable BL */ \
Kojto 98:8ab26030e058 401 false, /* enable NOIDLE */ \
Kojto 98:8ab26030e058 402 false, /* enable ARDY */ \
Kojto 98:8ab26030e058 403 false, /* don't disable ARDY timeout */ \
Kojto 98:8ab26030e058 404 EBI_BANK0, /* enable bank 0 */ \
Kojto 98:8ab26030e058 405 EBI_CS0, /* enable chip select 0 */ \
Kojto 98:8ab26030e058 406 0, /* addr setup cycles */ \
Kojto 98:8ab26030e058 407 1, /* addr hold cycles */ \
Kojto 98:8ab26030e058 408 false, /* do not enable half cycle ALE strobe */ \
Kojto 98:8ab26030e058 409 0, /* read setup cycles */ \
Kojto 98:8ab26030e058 410 0, /* read strobe cycles */ \
Kojto 98:8ab26030e058 411 0, /* read hold cycles */ \
Kojto 98:8ab26030e058 412 false, /* disable page mode */ \
Kojto 98:8ab26030e058 413 false, /* disable prefetch */ \
Kojto 98:8ab26030e058 414 false, /* do not enable half cycle REn strobe */ \
Kojto 98:8ab26030e058 415 0, /* write setup cycles */ \
Kojto 98:8ab26030e058 416 0, /* write strobe cycles */ \
Kojto 98:8ab26030e058 417 1, /* write hold cycles */ \
Kojto 98:8ab26030e058 418 false, /* do not disable the write buffer */ \
Kojto 98:8ab26030e058 419 false, /* do not enable halc cycle WEn strobe */ \
Kojto 98:8ab26030e058 420 ebiALowA0, /* ALB - Low bound, address lines */ \
Kojto 98:8ab26030e058 421 ebiAHighA0, /* APEN - High bound, address lines */ \
Kojto 98:8ab26030e058 422 ebiLocation0, /* Use Location 0 */ \
Kojto 98:8ab26030e058 423 true, /* enable EBI */ \
Kojto 98:8ab26030e058 424 }
Kojto 98:8ab26030e058 425 #else
Kojto 98:8ab26030e058 426 #define EBI_INIT_DEFAULT \
Kojto 98:8ab26030e058 427 { ebiModeD8A8, /* 8 bit address, 8 bit data */ \
Kojto 98:8ab26030e058 428 ebiActiveLow, /* ARDY polarity */ \
Kojto 98:8ab26030e058 429 ebiActiveLow, /* ALE polarity */ \
Kojto 98:8ab26030e058 430 ebiActiveLow, /* WE polarity */ \
Kojto 98:8ab26030e058 431 ebiActiveLow, /* RE polarity */ \
Kojto 98:8ab26030e058 432 ebiActiveLow, /* CS polarity */ \
Kojto 98:8ab26030e058 433 false, /* enable ARDY */ \
Kojto 98:8ab26030e058 434 false, /* don't disable ARDY timeout */ \
Kojto 98:8ab26030e058 435 EBI_BANK0, /* enable bank 0 */ \
Kojto 98:8ab26030e058 436 EBI_CS0, /* enable chip select 0 */ \
Kojto 98:8ab26030e058 437 0, /* addr setup cycles */ \
Kojto 98:8ab26030e058 438 1, /* addr hold cycles */ \
Kojto 98:8ab26030e058 439 0, /* read setup cycles */ \
Kojto 98:8ab26030e058 440 0, /* read strobe cycles */ \
Kojto 98:8ab26030e058 441 0, /* read hold cycles */ \
Kojto 98:8ab26030e058 442 0, /* write setup cycles */ \
Kojto 98:8ab26030e058 443 0, /* write strobe cycles */ \
Kojto 98:8ab26030e058 444 1, /* write hold cycles */ \
Kojto 98:8ab26030e058 445 true, /* enable EBI */ \
Kojto 98:8ab26030e058 446 }
Kojto 98:8ab26030e058 447 #endif
Kojto 98:8ab26030e058 448
Kojto 98:8ab26030e058 449 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 450
Kojto 98:8ab26030e058 451 /** TFT Initialization structure */
Kojto 98:8ab26030e058 452 typedef struct
Kojto 98:8ab26030e058 453 {
Kojto 98:8ab26030e058 454 /** External memory bank for driving display */
Kojto 98:8ab26030e058 455 EBI_TFTBank_TypeDef bank;
Kojto 98:8ab26030e058 456 /** Width */
Kojto 98:8ab26030e058 457 EBI_TFTWidth_TypeDef width;
Kojto 98:8ab26030e058 458 /** Color source for masking and alpha blending */
Kojto 98:8ab26030e058 459 EBI_TFTColorSrc_TypeDef colSrc;
Kojto 98:8ab26030e058 460 /** Bus Interleave mode */
Kojto 98:8ab26030e058 461 EBI_TFTInterleave_TypeDef interleave;
Kojto 98:8ab26030e058 462 /** Trigger for updating frame buffer pointer */
Kojto 98:8ab26030e058 463 EBI_TFTFrameBufTrigger_TypeDef fbTrigger;
Kojto 98:8ab26030e058 464 /** Drive DCLK from negative clock edge of internal clock */
Kojto 98:8ab26030e058 465 bool shiftDClk;
Kojto 98:8ab26030e058 466 /** Masking and alpha blending mode */
Kojto 98:8ab26030e058 467 EBI_TFTMaskBlend_TypeDef maskBlend;
Kojto 98:8ab26030e058 468 /** TFT Direct Drive mode */
Kojto 98:8ab26030e058 469 EBI_TFTDDMode_TypeDef driveMode;
Kojto 98:8ab26030e058 470 /** TFT Polarity for Chip Select (CS) Line */
Kojto 98:8ab26030e058 471 EBI_Polarity_TypeDef csPolarity;
Kojto 98:8ab26030e058 472 /** TFT Polarity for Data Clock (DCLK) Line */
Kojto 98:8ab26030e058 473 EBI_Polarity_TypeDef dclkPolarity;
Kojto 98:8ab26030e058 474 /** TFT Polarity for Data Enable (DATAEN) Line */
Kojto 98:8ab26030e058 475 EBI_Polarity_TypeDef dataenPolarity;
Kojto 98:8ab26030e058 476 /** TFT Polarity for Horizontal Sync (HSYNC) Line */
Kojto 98:8ab26030e058 477 EBI_Polarity_TypeDef hsyncPolarity;
Kojto 98:8ab26030e058 478 /** TFT Polarity for Vertical Sync (VSYNC) Line */
Kojto 98:8ab26030e058 479 EBI_Polarity_TypeDef vsyncPolarity;
Kojto 98:8ab26030e058 480 /** Horizontal size in pixels */
Kojto 98:8ab26030e058 481 int hsize;
Kojto 98:8ab26030e058 482 /** Horizontal Front Porch Size */
Kojto 98:8ab26030e058 483 int hPorchFront;
Kojto 98:8ab26030e058 484 /** Horizontal Back Porch Size */
Kojto 98:8ab26030e058 485 int hPorchBack;
Kojto 98:8ab26030e058 486 /** Horizontal Synchronization Pulse Width */
Kojto 98:8ab26030e058 487 int hPulseWidth;
Kojto 98:8ab26030e058 488 /** Vertical size in pixels */
Kojto 98:8ab26030e058 489 int vsize;
Kojto 98:8ab26030e058 490 /** Vertical Front Porch Size */
Kojto 98:8ab26030e058 491 int vPorchFront;
Kojto 98:8ab26030e058 492 /** Vertical Back Porch Size */
Kojto 98:8ab26030e058 493 int vPorchBack;
Kojto 98:8ab26030e058 494 /** Vertical Synchronization Pulse Width */
Kojto 98:8ab26030e058 495 int vPulseWidth;
Kojto 98:8ab26030e058 496 /** TFT Frame Buffer address, offset to EBI bank base address */
Kojto 98:8ab26030e058 497 uint32_t addressOffset;
Kojto 98:8ab26030e058 498 /** TFT DCLK period in internal cycles */
Kojto 98:8ab26030e058 499 int dclkPeriod;
Kojto 98:8ab26030e058 500 /** Starting position of External Direct Drive relative to DCLK inactive edge */
Kojto 98:8ab26030e058 501 int startPosition;
Kojto 98:8ab26030e058 502 /** Number of cycles RGB data is driven before active edge of DCLK */
Kojto 98:8ab26030e058 503 int setupCycles;
Kojto 98:8ab26030e058 504 /** Number of cycles RGB data is held after active edge of DCLK */
Kojto 98:8ab26030e058 505 int holdCycles;
Kojto 98:8ab26030e058 506 } EBI_TFTInit_TypeDef;
Kojto 98:8ab26030e058 507
Kojto 98:8ab26030e058 508 /** Default configuration for EBI TFT init structure */
Kojto 98:8ab26030e058 509 #define EBI_TFTINIT_DEFAULT \
Kojto 98:8ab26030e058 510 { ebiTFTBank0, /* Select EBI Bank 0 */ \
Kojto 98:8ab26030e058 511 ebiTFTWidthHalfWord, /* Select 2-byte increments */ \
Kojto 98:8ab26030e058 512 ebiTFTColorSrcMem, /* Use memory as source for mask/blending */ \
Kojto 98:8ab26030e058 513 ebiTFTInterleaveUnlimited, /* Unlimited interleaved accesses */ \
Kojto 98:8ab26030e058 514 ebiTFTFrameBufTriggerVSync, /* VSYNC as frame buffer update trigger */ \
Kojto 98:8ab26030e058 515 false, /* Drive DCLK from negative edge of internal clock */ \
Kojto 98:8ab26030e058 516 ebiTFTMBDisabled, /* No masking and alpha blending enabled */ \
Kojto 98:8ab26030e058 517 ebiTFTDDModeExternal, /* Drive from external memory */ \
Kojto 98:8ab26030e058 518 ebiActiveLow, /* CS Active Low polarity */ \
Kojto 98:8ab26030e058 519 ebiActiveLow, /* DCLK Active Low polarity */ \
Kojto 98:8ab26030e058 520 ebiActiveLow, /* DATAEN Active Low polarity */ \
Kojto 98:8ab26030e058 521 ebiActiveLow, /* HSYNC Active Low polarity */ \
Kojto 98:8ab26030e058 522 ebiActiveLow, /* VSYNC Active Low polarity */ \
Kojto 98:8ab26030e058 523 320, /* Horizontal size in pixels */ \
Kojto 98:8ab26030e058 524 1, /* Horizontal Front Porch */ \
Kojto 98:8ab26030e058 525 29, /* Horizontal Back Porch */ \
Kojto 98:8ab26030e058 526 2, /* Horizontal Synchronization Pulse Width */ \
Kojto 98:8ab26030e058 527 240, /* Vertical size in pixels */ \
Kojto 98:8ab26030e058 528 1, /* Vertical Front Porch */ \
Kojto 98:8ab26030e058 529 4, /* Vertical Back Porch */ \
Kojto 98:8ab26030e058 530 2, /* Vertical Synchronization Pulse Width */ \
Kojto 98:8ab26030e058 531 0x0000, /* Address offset to EBI memory base */ \
Kojto 98:8ab26030e058 532 5, /* DCLK Period */ \
Kojto 98:8ab26030e058 533 2, /* DCLK Start */ \
Kojto 98:8ab26030e058 534 1, /* DCLK Setup cycles */ \
Kojto 98:8ab26030e058 535 1, /* DCLK Hold cycles */ \
Kojto 98:8ab26030e058 536 }
Kojto 98:8ab26030e058 537
Kojto 98:8ab26030e058 538 #endif
Kojto 98:8ab26030e058 539 /*******************************************************************************
Kojto 98:8ab26030e058 540 ***************************** PROTOTYPES **********************************
Kojto 98:8ab26030e058 541 ******************************************************************************/
Kojto 98:8ab26030e058 542
Kojto 98:8ab26030e058 543 void EBI_Init(const EBI_Init_TypeDef *ebiInit);
Kojto 98:8ab26030e058 544 void EBI_Disable(void);
Kojto 98:8ab26030e058 545 uint32_t EBI_BankAddress(uint32_t bank);
Kojto 98:8ab26030e058 546 void EBI_BankEnable(uint32_t banks, bool enable);
Kojto 98:8ab26030e058 547
Kojto 98:8ab26030e058 548 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 549 void EBI_TFTInit(const EBI_TFTInit_TypeDef *ebiTFTInit);
Kojto 98:8ab26030e058 550 void EBI_TFTSizeSet(uint32_t horizontal, uint32_t vertical);
Kojto 98:8ab26030e058 551 void EBI_TFTHPorchSet(int front, int back, int pulseWidth);
Kojto 98:8ab26030e058 552 void EBI_TFTVPorchSet(int front, int back, int pulseWidth);
Kojto 98:8ab26030e058 553 void EBI_TFTTimingSet(int dclkPeriod, int start, int setup, int hold);
Kojto 98:8ab26030e058 554 #endif
Kojto 98:8ab26030e058 555
Kojto 98:8ab26030e058 556 #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_WONDER_FAMILY)
Kojto 98:8ab26030e058 557 /* This functionality is only available on devices with independent timing support */
Kojto 98:8ab26030e058 558 void EBI_BankReadTimingSet(uint32_t bank, int setupCycles, int strobeCycles, int holdCycles);
Kojto 98:8ab26030e058 559 void EBI_BankReadTimingConfig(uint32_t bank, bool pageMode, bool prefetch, bool halfRE);
Kojto 98:8ab26030e058 560
Kojto 98:8ab26030e058 561 void EBI_BankWriteTimingSet(uint32_t bank, int setupCycles, int strobeCycles, int holdCycles);
Kojto 98:8ab26030e058 562 void EBI_BankWriteTimingConfig(uint32_t bank, bool writeBufDisable, bool halfWE);
Kojto 98:8ab26030e058 563
Kojto 98:8ab26030e058 564 void EBI_BankAddressTimingSet(uint32_t bank, int setupCycles, int holdCycles);
Kojto 98:8ab26030e058 565 void EBI_BankAddressTimingConfig(uint32_t bank, bool halfALE);
Kojto 98:8ab26030e058 566
Kojto 98:8ab26030e058 567 void EBI_BankPolaritySet(uint32_t bank, EBI_Line_TypeDef line, EBI_Polarity_TypeDef polarity);
Kojto 98:8ab26030e058 568 void EBI_BankByteLaneEnable(uint32_t bank, bool enable);
Kojto 98:8ab26030e058 569 void EBI_AltMapEnable(bool enable);
Kojto 98:8ab26030e058 570
Kojto 98:8ab26030e058 571 /***************************************************************************//**
Kojto 98:8ab26030e058 572 * @brief
Kojto 98:8ab26030e058 573 * Enable or disable TFT Direct Drive
Kojto 98:8ab26030e058 574 *
Kojto 98:8ab26030e058 575 * @param[in] mode
Kojto 98:8ab26030e058 576 * Drive from Internal or External memory, or Disable Direct Drive
Kojto 98:8ab26030e058 577 ******************************************************************************/
Kojto 98:8ab26030e058 578 __STATIC_INLINE void EBI_TFTEnable(EBI_TFTDDMode_TypeDef mode)
Kojto 98:8ab26030e058 579 {
Kojto 98:8ab26030e058 580 EBI->TFTCTRL = (EBI->TFTCTRL & ~(_EBI_TFTCTRL_DD_MASK)) | (uint32_t) mode;
Kojto 98:8ab26030e058 581 }
Kojto 98:8ab26030e058 582
Kojto 98:8ab26030e058 583
Kojto 98:8ab26030e058 584 /***************************************************************************//**
Kojto 98:8ab26030e058 585 * @brief
Kojto 98:8ab26030e058 586 * Configure frame buffer pointer
Kojto 98:8ab26030e058 587 *
Kojto 98:8ab26030e058 588 * @param[in] address
Kojto 98:8ab26030e058 589 * Frame pointer address, as offset by EBI base address
Kojto 98:8ab26030e058 590 ******************************************************************************/
Kojto 98:8ab26030e058 591 __STATIC_INLINE void EBI_TFTFrameBaseSet(uint32_t address)
Kojto 98:8ab26030e058 592 {
Kojto 98:8ab26030e058 593 EBI->TFTFRAMEBASE = (uint32_t) address;
Kojto 98:8ab26030e058 594 }
Kojto 98:8ab26030e058 595
Kojto 98:8ab26030e058 596
Kojto 98:8ab26030e058 597 /***************************************************************************//**
Kojto 98:8ab26030e058 598 * @brief Set TFT Pixel Color 0 or 1
Kojto 98:8ab26030e058 599 *
Kojto 98:8ab26030e058 600 * @param[in] pixel
Kojto 98:8ab26030e058 601 * Which pixel instance to set
Kojto 98:8ab26030e058 602 * @param[in] color
Kojto 98:8ab26030e058 603 * Color of pixel, 16-bit value
Kojto 98:8ab26030e058 604 ******************************************************************************/
Kojto 98:8ab26030e058 605 __STATIC_INLINE void EBI_TFTPixelSet(int pixel, uint32_t color)
Kojto 98:8ab26030e058 606 {
Kojto 98:8ab26030e058 607 EFM_ASSERT(pixel == 0 || pixel == 1);
Kojto 98:8ab26030e058 608
Kojto 98:8ab26030e058 609 if (pixel == 0)
Kojto 98:8ab26030e058 610 {
Kojto 98:8ab26030e058 611 EBI->TFTPIXEL0 = color;
Kojto 98:8ab26030e058 612 }
Kojto 98:8ab26030e058 613 if (pixel == 1)
Kojto 98:8ab26030e058 614 {
Kojto 98:8ab26030e058 615 EBI->TFTPIXEL1 = color;
Kojto 98:8ab26030e058 616 }
Kojto 98:8ab26030e058 617 }
Kojto 98:8ab26030e058 618
Kojto 98:8ab26030e058 619
Kojto 98:8ab26030e058 620 /***************************************************************************//**
Kojto 98:8ab26030e058 621 * @brief Masking and Blending Mode Set
Kojto 98:8ab26030e058 622 *
Kojto 98:8ab26030e058 623 * @param[in] maskBlend
Kojto 98:8ab26030e058 624 * Masking and alpha blending mode
Kojto 98:8ab26030e058 625 ******************************************************************************/
Kojto 98:8ab26030e058 626 __STATIC_INLINE void EBI_TFTMaskBlendMode(EBI_TFTMaskBlend_TypeDef maskBlend)
Kojto 98:8ab26030e058 627 {
Kojto 98:8ab26030e058 628 EBI->TFTCTRL = (EBI->TFTCTRL & (~_EBI_TFTCTRL_MASKBLEND_MASK))|maskBlend;
Kojto 98:8ab26030e058 629 }
Kojto 98:8ab26030e058 630
Kojto 98:8ab26030e058 631
Kojto 98:8ab26030e058 632 /***************************************************************************//**
Kojto 98:8ab26030e058 633 * @brief Set TFT Alpha Blending Factor
Kojto 98:8ab26030e058 634 *
Kojto 98:8ab26030e058 635 * @param[in] alpha
Kojto 98:8ab26030e058 636 * 8-bit value indicating blending factor
Kojto 98:8ab26030e058 637 ******************************************************************************/
Kojto 98:8ab26030e058 638 __STATIC_INLINE void EBI_TFTAlphaBlendSet(uint8_t alpha)
Kojto 98:8ab26030e058 639 {
Kojto 98:8ab26030e058 640 EBI->TFTALPHA = alpha;
Kojto 98:8ab26030e058 641 }
Kojto 98:8ab26030e058 642
Kojto 98:8ab26030e058 643
Kojto 98:8ab26030e058 644 /***************************************************************************//**
Kojto 98:8ab26030e058 645 * @brief Set TFT mask value
Kojto 98:8ab26030e058 646 * Data accesses that matches this value are suppressed
Kojto 98:8ab26030e058 647 * @param[in] mask
Kojto 98:8ab26030e058 648 ******************************************************************************/
Kojto 98:8ab26030e058 649 __STATIC_INLINE void EBI_TFTMaskSet(uint32_t mask)
Kojto 98:8ab26030e058 650 {
Kojto 98:8ab26030e058 651 EBI->TFTMASK = mask;
Kojto 98:8ab26030e058 652 }
Kojto 98:8ab26030e058 653
Kojto 98:8ab26030e058 654
Kojto 98:8ab26030e058 655 /***************************************************************************//**
Kojto 98:8ab26030e058 656 * @brief Get current vertical position counter
Kojto 98:8ab26030e058 657 * @return
Kojto 98:8ab26030e058 658 * Returns the current line position for the visible part of a frame
Kojto 98:8ab26030e058 659 ******************************************************************************/
Kojto 98:8ab26030e058 660 __STATIC_INLINE uint32_t EBI_TFTVCount(void)
Kojto 98:8ab26030e058 661 {
Kojto 98:8ab26030e058 662 return((EBI->TFTSTATUS & _EBI_TFTSTATUS_VCNT_MASK) >> _EBI_TFTSTATUS_VCNT_SHIFT);
Kojto 98:8ab26030e058 663 }
Kojto 98:8ab26030e058 664
Kojto 98:8ab26030e058 665
Kojto 98:8ab26030e058 666 /***************************************************************************//**
Kojto 98:8ab26030e058 667 * @brief Get current horizontal position counter
Kojto 98:8ab26030e058 668 * @return
Kojto 98:8ab26030e058 669 * Returns the current horizontal pixel position within a visible line
Kojto 98:8ab26030e058 670 ******************************************************************************/
Kojto 98:8ab26030e058 671 __STATIC_INLINE uint32_t EBI_TFTHCount(void)
Kojto 98:8ab26030e058 672 {
Kojto 98:8ab26030e058 673 return((EBI->TFTSTATUS & _EBI_TFTSTATUS_HCNT_MASK) >> _EBI_TFTSTATUS_HCNT_SHIFT);
Kojto 98:8ab26030e058 674 }
Kojto 98:8ab26030e058 675
Kojto 98:8ab26030e058 676
Kojto 98:8ab26030e058 677 /***************************************************************************//**
Kojto 98:8ab26030e058 678 * @brief Set Frame Buffer Trigger
Kojto 98:8ab26030e058 679 *
Kojto 98:8ab26030e058 680 * @details
Kojto 98:8ab26030e058 681 * Frame buffer pointer will be updated either on each horizontal line (hsync)
Kojto 98:8ab26030e058 682 * or vertical update (vsync).
Kojto 98:8ab26030e058 683 *
Kojto 98:8ab26030e058 684 * @param[in] sync
Kojto 98:8ab26030e058 685 * Trigger update of frame buffer pointer on vertical or horisontal sync.
Kojto 98:8ab26030e058 686 ******************************************************************************/
Kojto 98:8ab26030e058 687 __STATIC_INLINE void EBI_TFTFBTriggerSet(EBI_TFTFrameBufTrigger_TypeDef sync)
Kojto 98:8ab26030e058 688 {
Kojto 98:8ab26030e058 689 EBI->TFTCTRL = ((EBI->TFTCTRL & ~_EBI_TFTCTRL_FBCTRIG_MASK)|sync);
Kojto 98:8ab26030e058 690 }
Kojto 98:8ab26030e058 691
Kojto 98:8ab26030e058 692
Kojto 98:8ab26030e058 693 /***************************************************************************//**
Kojto 98:8ab26030e058 694 * @brief Set horizontal TFT stride value in number of bytes
Kojto 98:8ab26030e058 695 *
Kojto 98:8ab26030e058 696 * @param[in] nbytes
Kojto 98:8ab26030e058 697 * Number of bytes to add to frame buffer pointer after each horizontal line
Kojto 98:8ab26030e058 698 * update
Kojto 98:8ab26030e058 699 ******************************************************************************/
Kojto 98:8ab26030e058 700 __STATIC_INLINE void EBI_TFTHStrideSet(uint32_t nbytes)
Kojto 98:8ab26030e058 701 {
Kojto 98:8ab26030e058 702 EFM_ASSERT(nbytes < 0x1000);
Kojto 98:8ab26030e058 703
Kojto 98:8ab26030e058 704 EBI->TFTSTRIDE = (EBI->TFTSTRIDE & ~(_EBI_TFTSTRIDE_HSTRIDE_MASK))|
Kojto 98:8ab26030e058 705 (nbytes<<_EBI_TFTSTRIDE_HSTRIDE_SHIFT);
Kojto 98:8ab26030e058 706 }
Kojto 98:8ab26030e058 707
Kojto 98:8ab26030e058 708
Kojto 98:8ab26030e058 709 /***************************************************************************//**
Kojto 98:8ab26030e058 710 * @brief
Kojto 98:8ab26030e058 711 * Clear one or more pending EBI interrupts.
Kojto 98:8ab26030e058 712 * @param[in] flags
Kojto 98:8ab26030e058 713 * Pending EBI interrupt source to clear. Use a logical OR combination
Kojto 98:8ab26030e058 714 * of valid interrupt flags for the EBI module (EBI_IF_nnn).
Kojto 98:8ab26030e058 715 ******************************************************************************/
Kojto 98:8ab26030e058 716 __STATIC_INLINE void EBI_IntClear(uint32_t flags)
Kojto 98:8ab26030e058 717 {
Kojto 98:8ab26030e058 718 EBI->IFC = flags;
Kojto 98:8ab26030e058 719 }
Kojto 98:8ab26030e058 720
Kojto 98:8ab26030e058 721
Kojto 98:8ab26030e058 722 /***************************************************************************//**
Kojto 98:8ab26030e058 723 * @brief
Kojto 98:8ab26030e058 724 * Set one or more pending EBI interrupts from SW.
Kojto 98:8ab26030e058 725 *
Kojto 98:8ab26030e058 726 * @param[in] flags
Kojto 98:8ab26030e058 727 * EBI interrupt sources to set to pending. Use a logical OR combination of
Kojto 98:8ab26030e058 728 * valid interrupt flags for the EBI module (EBI_IF_nnn).
Kojto 98:8ab26030e058 729 ******************************************************************************/
Kojto 98:8ab26030e058 730 __STATIC_INLINE void EBI_IntSet(uint32_t flags)
Kojto 98:8ab26030e058 731 {
Kojto 98:8ab26030e058 732 EBI->IFS = flags;
Kojto 98:8ab26030e058 733 }
Kojto 98:8ab26030e058 734
Kojto 98:8ab26030e058 735
Kojto 98:8ab26030e058 736 /***************************************************************************//**
Kojto 98:8ab26030e058 737 * @brief
Kojto 98:8ab26030e058 738 * Disable one or more EBI interrupts
Kojto 98:8ab26030e058 739 *
Kojto 98:8ab26030e058 740 * @param[in] flags
Kojto 98:8ab26030e058 741 * EBI interrupt sources to disable. Use logical OR combination of valid
Kojto 98:8ab26030e058 742 * interrupt flags for the EBI module (EBI_IF_nnn)
Kojto 98:8ab26030e058 743 ******************************************************************************/
Kojto 98:8ab26030e058 744 __STATIC_INLINE void EBI_IntDisable(uint32_t flags)
Kojto 98:8ab26030e058 745 {
Kojto 98:8ab26030e058 746 EBI->IEN &= ~(flags);
Kojto 98:8ab26030e058 747 }
Kojto 98:8ab26030e058 748
Kojto 98:8ab26030e058 749
Kojto 98:8ab26030e058 750 /***************************************************************************//**
Kojto 98:8ab26030e058 751 * @brief
Kojto 98:8ab26030e058 752 * Enable one or more EBI interrupts
Kojto 98:8ab26030e058 753 *
Kojto 98:8ab26030e058 754 * @param[in] flags
Kojto 98:8ab26030e058 755 * EBI interrupt sources to enable. Use logical OR combination of valid
Kojto 98:8ab26030e058 756 * interrupt flags for the EBI module (EBI_IF_nnn)
Kojto 98:8ab26030e058 757 ******************************************************************************/
Kojto 98:8ab26030e058 758 __STATIC_INLINE void EBI_IntEnable(uint32_t flags)
Kojto 98:8ab26030e058 759 {
Kojto 98:8ab26030e058 760 EBI->IEN |= flags;
Kojto 98:8ab26030e058 761 }
Kojto 98:8ab26030e058 762
Kojto 98:8ab26030e058 763
Kojto 98:8ab26030e058 764 /***************************************************************************//**
Kojto 98:8ab26030e058 765 * @brief
Kojto 98:8ab26030e058 766 * Get pending EBI interrupt flags
Kojto 98:8ab26030e058 767 *
Kojto 98:8ab26030e058 768 * @note
Kojto 98:8ab26030e058 769 * The event bits are not cleared by the use of this function
Kojto 98:8ab26030e058 770 *
Kojto 98:8ab26030e058 771 * @return
Kojto 98:8ab26030e058 772 * EBI interrupt sources pending, a logical combination of valid EBI
Kojto 98:8ab26030e058 773 * interrupt flags, EBI_IF_nnn
Kojto 98:8ab26030e058 774 ******************************************************************************/
Kojto 98:8ab26030e058 775 __STATIC_INLINE uint32_t EBI_IntGet(void)
Kojto 98:8ab26030e058 776 {
Kojto 98:8ab26030e058 777 return(EBI->IF);
Kojto 98:8ab26030e058 778 }
Kojto 98:8ab26030e058 779
Kojto 98:8ab26030e058 780
Kojto 98:8ab26030e058 781 /***************************************************************************//**
Kojto 98:8ab26030e058 782 * @brief
Kojto 98:8ab26030e058 783 * Start ECC generator on NAND flash transfers.
Kojto 98:8ab26030e058 784 ******************************************************************************/
Kojto 98:8ab26030e058 785 __STATIC_INLINE void EBI_StartNandEccGen(void)
Kojto 98:8ab26030e058 786 {
Kojto 98:8ab26030e058 787 EBI->CMD = EBI_CMD_ECCSTART | EBI_CMD_ECCCLEAR;
Kojto 98:8ab26030e058 788 }
Kojto 98:8ab26030e058 789
Kojto 98:8ab26030e058 790
Kojto 98:8ab26030e058 791 /***************************************************************************//**
Kojto 98:8ab26030e058 792 * @brief
Kojto 98:8ab26030e058 793 * Stop NAND flash ECC generator and return generated ECC.
Kojto 98:8ab26030e058 794 *
Kojto 98:8ab26030e058 795 * @return
Kojto 98:8ab26030e058 796 * The generated ECC.
Kojto 98:8ab26030e058 797 ******************************************************************************/
Kojto 98:8ab26030e058 798 __STATIC_INLINE uint32_t EBI_StopNandEccGen( void )
Kojto 98:8ab26030e058 799 {
Kojto 98:8ab26030e058 800 EBI->CMD = EBI_CMD_ECCSTOP;
Kojto 98:8ab26030e058 801 return EBI->ECCPARITY;
Kojto 98:8ab26030e058 802 }
Kojto 98:8ab26030e058 803 #endif
Kojto 98:8ab26030e058 804
Kojto 98:8ab26030e058 805 void EBI_ChipSelectEnable(uint32_t banks, bool enable);
Kojto 98:8ab26030e058 806 void EBI_ReadTimingSet(int setupCycles, int strobeCycles, int holdCycles);
Kojto 98:8ab26030e058 807 void EBI_WriteTimingSet(int setupCycles, int strobeCycles, int holdCycles);
Kojto 98:8ab26030e058 808 void EBI_AddressTimingSet(int setupCycles, int holdCycles);
Kojto 98:8ab26030e058 809 void EBI_PolaritySet(EBI_Line_TypeDef line, EBI_Polarity_TypeDef polarity);
Kojto 98:8ab26030e058 810
Kojto 98:8ab26030e058 811 /** @} (end addtogroup EBI) */
Kojto 98:8ab26030e058 812 /** @} (end addtogroup EM_Library) */
Kojto 98:8ab26030e058 813
Kojto 98:8ab26030e058 814 #ifdef __cplusplus
Kojto 98:8ab26030e058 815 }
Kojto 98:8ab26030e058 816 #endif
Kojto 98:8ab26030e058 817
Kojto 98:8ab26030e058 818 #endif /* defined(EBI_COUNT) && (EBI_COUNT > 0) */
Kojto 98:8ab26030e058 819
Kojto 98:8ab26030e058 820 #endif /* __SILICON_LABS_EM_EBI_H_ */