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:
Tue Feb 14 11:24:20 2017 +0000
Revision:
136:ef9c61f8c49f
Parent:
128:9bcdf88f62b0
Child:
139:856d2700e60b
Release 136 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723

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