STM32F429 LTDC header files and framebuffer driver framework from Ken Pettit
This commit is contained in:
parent
60950c760f
commit
5032829f9a
@ -357,9 +357,9 @@ config ARCH_CHIP_STM32F207IG
|
||||
select STM32_STM32F20XX
|
||||
|
||||
config ARCH_CHIP_STM32F207ZE
|
||||
bool "STM32F207ZE"
|
||||
select ARCH_CORTEXM3
|
||||
select STM32_STM32F20XX
|
||||
bool "STM32F207ZE"
|
||||
select ARCH_CORTEXM3
|
||||
select STM32_STM32F20XX
|
||||
|
||||
config ARCH_CHIP_STM32F302CB
|
||||
bool "STM32F302CB"
|
||||
@ -742,6 +742,16 @@ config STM32_I2C3
|
||||
depends on STM32_STM32F20XX || STM32_STM32F40XX
|
||||
select STM32_I2C
|
||||
|
||||
config STM32_LTDC
|
||||
bool "LTDC"
|
||||
default n
|
||||
depends on STM32_STM32F429
|
||||
---help---
|
||||
The STM32 LTDC is an LCD-TFT Display Controller available on
|
||||
the STM32F429 and STM32F439 devices. It is a standard parallel
|
||||
video interface (HSYNC, VSYNC, etc.) for controlling TFT
|
||||
LCD displays.
|
||||
|
||||
config STM32_OTGFS
|
||||
bool "OTG FS"
|
||||
default n
|
||||
@ -3008,18 +3018,120 @@ menu "CAN driver configuration"
|
||||
depends on STM32_CAN1 || STM32_CAN2
|
||||
|
||||
config CAN1_BAUD
|
||||
int "CAN1 BAUD"
|
||||
default 250000
|
||||
depends on STM32_CAN1
|
||||
---help---
|
||||
CAN1 BAUD rate. Required if STM32_CAN1 is defined.
|
||||
int "CAN1 BAUD"
|
||||
default 250000
|
||||
depends on STM32_CAN1
|
||||
---help---
|
||||
CAN1 BAUD rate. Required if STM32_CAN1 is defined.
|
||||
|
||||
config CAN2_BAUD
|
||||
int "CAN2 BAUD"
|
||||
default 250000
|
||||
depends on STM32_CAN2
|
||||
---help---
|
||||
CAN2 BAUD rate. Required if STM32_CAN2 is defined.
|
||||
int "CAN2 BAUD"
|
||||
default 250000
|
||||
depends on STM32_CAN2
|
||||
---help---
|
||||
CAN2 BAUD rate. Required if STM32_CAN2 is defined.
|
||||
|
||||
endmenu
|
||||
|
||||
if STM32_LTDC
|
||||
|
||||
menu "LTDC Configuration"
|
||||
|
||||
config STM32_LTDC_BACKLIGHT
|
||||
bool "Backlight support"
|
||||
default y
|
||||
|
||||
config STM32_LTDC_DEFBACKLIGHT
|
||||
hex "Default backlight level"
|
||||
default 0xf0
|
||||
|
||||
config STM32_LTDC_BACKCOLOR
|
||||
hex "Background color"
|
||||
default 0x0
|
||||
---help---
|
||||
This is the background color that will be used as the LTDC
|
||||
background layer color. It is an RGB888 format value.
|
||||
|
||||
config STM32_LTDC_FB_BASE
|
||||
hex "Framebuffer memory start address"
|
||||
---help---
|
||||
If you are using the the LTDC, then you must provide the address
|
||||
of the start of the framebuffer. This address will typically
|
||||
be in the SRAM or SDRAM memory region of the FSMC.
|
||||
|
||||
config STM32_LTDC_FB_SIZE
|
||||
int "Framebuffer memory size (bytes)"
|
||||
default 0
|
||||
|
||||
choice
|
||||
prompt "Layer 1 color format"
|
||||
default STM32_LTDC_L1_RGB565
|
||||
|
||||
config STM32_LTDC_L1_L8
|
||||
bool "8 bpp L8 (8-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L1_AL44
|
||||
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L1_AL88
|
||||
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L1_RGB565
|
||||
bool "16 bpp RGB 565"
|
||||
|
||||
config STM32_LTDC_L1_ARGB4444
|
||||
bool "16 bpp ARGB 4444"
|
||||
|
||||
config STM32_LTDC_L1_ARGB1555
|
||||
bool "16 bpp ARGB 1555"
|
||||
|
||||
config STM32_LTDC_L1_RGB888
|
||||
bool "24 bpp RGB 888"
|
||||
|
||||
config STM32_LTDC_L1_ARGB8888
|
||||
bool "32 bpp ARGB 8888"
|
||||
|
||||
endchoice # Layer 1 color format
|
||||
|
||||
config STM32_LTDC_L2
|
||||
bool "Enable Layer 2 support"
|
||||
default y
|
||||
|
||||
if STM32_LTDC_L2
|
||||
|
||||
choice
|
||||
prompt "Layer 2 (top layer) color format"
|
||||
default STM32_LTDC_L2_RGB565
|
||||
|
||||
config STM32_LTDC_L2_L8
|
||||
bool "8 bpp L8 (8-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L2_AL44
|
||||
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L2_AL88
|
||||
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L2_RGB565
|
||||
bool "16 bpp RGB 565"
|
||||
|
||||
config STM32_LTDC_L2_ARGB4444
|
||||
bool "16 bpp ARGB 4444"
|
||||
|
||||
config STM32_LTDC_L2_ARGB1555
|
||||
bool "16 bpp ARGB 1555"
|
||||
|
||||
config STM32_LTDC_L2_RGB888
|
||||
bool "24 bpp RGB 888"
|
||||
|
||||
config STM32_LTDC_L2_ARGB8888
|
||||
bool "32 bpp ARGB 8888"
|
||||
|
||||
endchoice # Layer 2 color format
|
||||
|
||||
endif # STM32_LTDC_L2
|
||||
|
||||
endmenu
|
||||
|
||||
endif # STM32_LTDC
|
||||
|
||||
|
@ -169,6 +169,10 @@ ifeq ($(CONFIG_DEV_RANDOM),y)
|
||||
CHIP_CSRCS += stm32_rng.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_LTDC),y)
|
||||
CHIP_CSRCS += stm32_ltdc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CHIP_CSRCS += stm32_pwm.c
|
||||
endif
|
||||
|
379
arch/arm/src/stm32/chip/stm32_ltdc.h
Normal file
379
arch/arm/src/stm32/chip/stm32_ltdc.h
Normal file
@ -0,0 +1,379 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/chip/stm32_ltdc.h
|
||||
*
|
||||
* Copyright (C) 2013 Ken Pettit. All rights reserved.
|
||||
* Author: Ken Pettit <pettitkd@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_STM32_CHIP_STM32_LTDC_H
|
||||
#define __ARCH_ARM_SRC_STM32_CHIP_STM32_LTDC_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include "chip/stm32_memorymap.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#define STM32_LTDC_NCLUT 256 /* Number of entries in the CLUTs */
|
||||
|
||||
/* LCDC Register Offsets ************************************************************/
|
||||
|
||||
#define STM32_LTDC_SSCR_OFFSET 0x0008 /* LTDC Synchronization Size Config Register */
|
||||
#define STM32_LTDC_BPCR_OFFSET 0x000c /* LTDC Back Porch Configuration Register */
|
||||
#define STM32_LTDC_AWCR_OFFSET 0x0010 /* LTDC Active Width Configuration Register */
|
||||
#define STM32_LTDC_TWCR_OFFSET 0x0014 /* LTDC Total Width Configuration Register */
|
||||
#define STM32_LTDC_GCR_OFFSET 0x0018 /* LTDC Global Control Register */
|
||||
/* 0x0020 Reserved */
|
||||
#define STM32_LTDC_SRCR_OFFSET 0x0024 /* LTDC Shadow Reload Configuration Register */
|
||||
/* 0x0028 Reserved */
|
||||
#define STM32_LTDC_BCCR_OFFSET 0x002C /* LTDC Background Color Configuration Register */
|
||||
/* 0x0030 Reserved */
|
||||
#define STM32_LTDC_IER_OFFSET 0x0034 /* LTDC Interrupt Enable Register */
|
||||
#define STM32_LTDC_ISR_OFFSET 0x0038 /* LTDC Interrupt Status Register */
|
||||
#define STM32_LTDC_ICR_OFFSET 0x003C /* LTDC Interrupt Clear Register */
|
||||
#define STM32_LTDC_LIPCR_OFFSET 0x0040 /* LTDC Line Interrupt Position Config Register */
|
||||
#define STM32_LTDC_CPSR_OFFSET 0x0044 /* LTDC Current Position Status Register */
|
||||
#define STM32_LTDC_CDSR_OFFSET 0x0048 /* LTDC Current Display Status Register */
|
||||
/* 0x004c-0x0080 Reserved */
|
||||
|
||||
#define STM32_LTDC_L1CR_OFFSET 0x0084 /* LTDC Layer 1 Control Register */
|
||||
#define STM32_LTDC_L1WHPCR_OFFSET 0x0088 /* LTDC Layer 1 Window Horiz Pos Config Register */
|
||||
#define STM32_LTDC_L1WVPCR_OFFSET 0x008C /* LTDC Layer 1 Window Vert Pos Config Register */
|
||||
#define STM32_LTDC_L1CKCR_OFFSET 0x0090 /* LTDC Layer 1 Color Keying Config Register */
|
||||
#define STM32_LTDC_L1PFCR_OFFSET 0x0094 /* LTDC Layer 1 Pixel Format Configuration Register */
|
||||
#define STM32_LTDC_L1CACR_OFFSET 0x0098 /* LTDC Layer 1 Constant Alpha Config Register */
|
||||
#define STM32_LTDC_L1DCCR_OFFSET 0x009C /* LTDC Layer 1 Default Color Config Register */
|
||||
#define STM32_LTDC_L1BFCR_OFFSET 0x00A0 /* LTDC Layer 1 Blending Factors Config Register */
|
||||
/* 0x00A4-0x00A8 Reserved */
|
||||
#define STM32_LTDC_L1CFBAR_OFFSET 0x00AC /* LTDC Layer 1 Color Frame Buffer Address Register */
|
||||
#define STM32_LTDC_L1CFBLR_OFFSET 0x00B0 /* LTDC Layer 1 Color Frame Buffer Length Register */
|
||||
#define STM32_LTDC_L1CFBLNR_OFFSET 0x00B4 /* LTDC Layer 1 Color Frame Buffer Line Number Register */
|
||||
/* 0x00B8-0x00C0 Reserved */
|
||||
#define STM32_LTDC_L1CLUTWR_OFFSET 0x00C4 /* LTDC Layer 1 CLUT Write Register */
|
||||
/* 0x00C8-0x0100 Reserved */
|
||||
#define STM32_LTDC_L2CR_OFFSET 0x0104 /* LTDC Layer 2 Control Register */
|
||||
#define STM32_LTDC_L2WHPCR_OFFSET 0x0108 /* LTDC Layer 2 Window Horiz Pos Config Register */
|
||||
#define STM32_LTDC_L2WVPCR_OFFSET 0x010C /* LTDC Layer 2 Window Vert Pos Config Register */
|
||||
#define STM32_LTDC_L2CKCR_OFFSET 0x0110 /* LTDC Layer 2 Color Keying Config Register */
|
||||
#define STM32_LTDC_L2PFCR_OFFSET 0x0114 /* LTDC Layer 2 Pixel Format Configuration Register */
|
||||
#define STM32_LTDC_L2CACR_OFFSET 0x0118 /* LTDC Layer 2 Constant Alpha Config Register */
|
||||
#define STM32_LTDC_L2DCCR_OFFSET 0x011C /* LTDC Layer 2 Default Color Config Register */
|
||||
#define STM32_LTDC_L2BFCR_OFFSET 0x0120 /* LTDC Layer 2 Blending Factors Config Register */
|
||||
/* 0x0124-0x0128 Reserved */
|
||||
#define STM32_LTDC_L2CFBAR_OFFSET 0x012C /* LTDC Layer 2 Color Frame Buffer Address Register */
|
||||
#define STM32_LTDC_L2CFBLR_OFFSET 0x0130 /* LTDC Layer 2 Color Frame Buffer Length Register */
|
||||
#define STM32_LTDC_L2CFBLNR_OFFSET 0x0134 /* LTDC Layer 2 Color Frame Buffer Line Number Register */
|
||||
/* 0x0138-0x0130 Reserved */
|
||||
#define STM32_LTDC_L2CLUTWR_OFFSET 0x0144 /* LTDC Layer 2 CLUT Write Register */
|
||||
/* 0x0148-0x03ff Reserved */
|
||||
|
||||
/* LTDC Register Addresses *********************************************************/
|
||||
|
||||
#define STM32_LTDC_SSCR (STM32_LTDC_BASE+STM32_LTDC_SSCR_OFFSET)
|
||||
#define STM32_LTDC_BPCR (STM32_LTDC_BASE+STM32_LTDC_BPCR_OFFSET)
|
||||
#define STM32_LTDC_AWCR (STM32_LTDC_BASE+STM32_LTDC_AWCR_OFFSET)
|
||||
#define STM32_LTDC_TWCR (STM32_LTDC_BASE+STM32_LTDC_TWCR_OFFSET)
|
||||
#define STM32_LTDC_GCR (STM32_LTDC_BASE+STM32_LTDC_GCR_OFFSET)
|
||||
#define STM32_LTDC_SRCR (STM32_LTDC_BASE+STM32_LTDC_SRCR_OFFSET)
|
||||
#define STM32_LTDC_BCCR (STM32_LTDC_BASE+STM32_LTDC_BCCR_OFFSET)
|
||||
#define STM32_LTDC_IER (STM32_LTDC_BASE+STM32_LTDC_IER_OFFSET)
|
||||
#define STM32_LTDC_ISR (STM32_LTDC_BASE+STM32_LTDC_ISR_OFFSET)
|
||||
#define STM32_LTDC_ICR (STM32_LTDC_BASE+STM32_LTDC_ICR_OFFSET)
|
||||
#define STM32_LTDC_LIPCR (STM32_LTDC_BASE+STM32_LTDC_LIPCR_OFFSET)
|
||||
#define STM32_LTDC_CPSR (STM32_LTDC_BASE+STM32_LTDC_CPSR_OFFSET)
|
||||
#define STM32_LTDC_CDSR (STM32_LTDC_BASE+STM32_LTDC_CDSR_OFFSET)
|
||||
|
||||
#define STM32_LTDC_L1CR (STM32_LTDC_BASE+STM32_LTDC_L1CR_OFFSET)
|
||||
#define STM32_LTDC_L1WHPCR (STM32_LTDC_BASE+STM32_LTDC_L1WHPCR_OFFSET)
|
||||
#define STM32_LTDC_L1WVPCR (STM32_LTDC_BASE+STM32_LTDC_L1WVPCR_OFFSET)
|
||||
#define STM32_LTDC_L1CKCR (STM32_LTDC_BASE+STM32_LTDC_L1CKCR_OFFSET)
|
||||
#define STM32_LTDC_L1PFCR (STM32_LTDC_BASE+STM32_LTDC_L1PFCR_OFFSET)
|
||||
#define STM32_LTDC_L1CACR (STM32_LTDC_BASE+STM32_LTDC_L1CACR_OFFSET)
|
||||
#define STM32_LTDC_L1DCCR (STM32_LTDC_BASE+STM32_LTDC_L1DCCR_OFFSET)
|
||||
#define STM32_LTDC_L1BFCR (STM32_LTDC_BASE+STM32_LTDC_L1BFCR_OFFSET)
|
||||
#define STM32_LTDC_L1CFBAR (STM32_LTDC_BASE+STM32_LTDC_L1CFBAR_OFFSET)
|
||||
#define STM32_LTDC_L1CFBLR (STM32_LTDC_BASE+STM32_LTDC_L1CFBLR_OFFSET)
|
||||
#define STM32_LTDC_L1CFBLNR (STM32_LTDC_BASE+STM32_LTDC_L1CFBLNR_OFFSET)
|
||||
|
||||
#define STM32_LTDC_L2CR (STM32_LTDC_BASE+STM32_LTDC_L2CR_OFFSET)
|
||||
#define STM32_LTDC_L2WHPCR (STM32_LTDC_BASE+STM32_LTDC_L2WHPCR_OFFSET)
|
||||
#define STM32_LTDC_L2WVPCR (STM32_LTDC_BASE+STM32_LTDC_L2WVPCR_OFFSET)
|
||||
#define STM32_LTDC_L2CKCR (STM32_LTDC_BASE+STM32_LTDC_L2CKCR_OFFSET)
|
||||
#define STM32_LTDC_L2PFCR (STM32_LTDC_BASE+STM32_LTDC_L2PFCR_OFFSET)
|
||||
#define STM32_LTDC_L2CACR (STM32_LTDC_BASE+STM32_LTDC_L2CACR_OFFSET)
|
||||
#define STM32_LTDC_L2DCCR (STM32_LTDC_BASE+STM32_LTDC_L2DCCR_OFFSET)
|
||||
#define STM32_LTDC_L2BFCR (STM32_LTDC_BASE+STM32_LTDC_L2BFCR_OFFSET)
|
||||
#define STM32_LTDC_L2CFBAR (STM32_LTDC_BASE+STM32_LTDC_L2CFBAR_OFFSET)
|
||||
#define STM32_LTDC_L2CFBLR (STM32_LTDC_BASE+STM32_LTDC_L2CFBLR_OFFSET)
|
||||
#define STM32_LTDC_L2CFBLNR (STM32_LTDC_BASE+STM32_LTDC_L2CFBLNR_OFFSET)
|
||||
|
||||
/* LTDC Register Bit Definitions ***************************************************/
|
||||
|
||||
/* LTDC Synchronization Size Configuration Register */
|
||||
|
||||
#define LTDC_SSCR_VSH_SHIFT (0) /* Bits 0-10: Vertical Sync Height (scan lines) */
|
||||
#define LTDC_SSCR_VSH_MASK (0x7ff << LTDC_SSCR_VSH_SHIFT)
|
||||
# define LTDC_SSCR_VSH(n) ((uint32_t)(n) << LTDC_SSCR_VSH_SHIFT)
|
||||
#define LTDC_SSCR_HSW_SHIFT (16) /* Bits 16-27: Horizontal Sync Width (pixel clocks) */
|
||||
#define LTDC_SSCR_HSW_MASK (0xfff << LTDC_SSCR_HSW_SHIFT)
|
||||
# define LTDC_SSCR_HSW(n) ((uint32_t)(n) << LTDC_SSCR_HSW_SHIFT)
|
||||
|
||||
/* LTDC Back Porch Configuration Register */
|
||||
|
||||
#define LTDC_BPCR_AVBP_SHIFT (0) /* Bits 0-10: Accumulated Vertical back porch (scan lines) */
|
||||
#define LTDC_BPCR_AVBP_MASK (0x7ff << LTDC_BPCR_AVBP_SHIFT)
|
||||
# define LTDC_BPCR_AVBP(n) ((uint32_t)(n) << LTDC_BPCR_AVBP_SHIFT)
|
||||
#define LTDC_BPCR_AHBP_SHIFT (16) /* Bits 16-27: Accumulated Horizontal back porch (pixel clocks) */
|
||||
#define LTDC_BPCR_AHBP_MASK (0xfff << LTDC_BPCR_AVBP_SHIFT)
|
||||
# define LTDC_BPCR_AHBP(n) ((uint32_t)(n) << LTDC_BPCR_AHBP_SHIFT)
|
||||
|
||||
/* LTDC Active Width Configuration Register */
|
||||
|
||||
#define LTDC_AWCR_AAH_SHIFT (0) /* Bits 0-10: Accumulated Active Height (scan lines) */
|
||||
#define LTDC_AWCR_AAH_MASK (0x7ff << LTDC_AWCR_AAH_SHIFT)
|
||||
# define LTDC_AWCR_AAH(n) ((uint32_t)(n) << LTDC_AWCR_AAH_SHIFT)
|
||||
#define LTDC_AWCR_AAW_SHIFT (16) /* Bits 16-27: Accumulated Active Width (pixel clocks) */
|
||||
#define LTDC_AWCR_AAW_MASK (0xfff << LTDC_AWCR_AAW_SHIFT)
|
||||
# define LTDC_AWCR_AAW(n) ((uint32_t)(n) << LTDC_AWCR_AAW_SHIFT)
|
||||
|
||||
/* LTDC Total Width Configuration Register */
|
||||
|
||||
#define LTDC_TWCR_TOTALH_SHIFT (0) /* Bits 0-10: Total Height (scan lines) */
|
||||
#define LTDC_TWCR_TOTALH_MASK (0x7ff << LTDC_TWCR_TOTALH_SHIFT)
|
||||
# define LTDC_TWCR_TOTALH(n) ((uint32_t)(n) << LTDC_TWCR_TOTALH_SHIFT)
|
||||
#define LTDC_TWCR_TOTALW_SHIFT (16) /* Bits 16-27: Total Width (pixel clocks) */
|
||||
#define LTDC_TWCR_TOTALW_MASK (0xfff << LTDC_TWCR_TOTALW_SHIFT)
|
||||
# define LTDC_TWCR_TOTALW(n) ((uint32_t)(n) << LTDC_TWCR_TOTALW_SHIFT)
|
||||
|
||||
/* LTDC Global Control Register */
|
||||
|
||||
#define LTDC_GCR_LTDCEN (1 << 0) /* Bit 0: LCD-TFT Controller Enable Bit */
|
||||
#define LTDC_GCR_DBW_SHIFT (4) /* Bits 4-6: Dither Blue Width */
|
||||
#define LTDC_GCR_DBW_MASK (0x7 << LTDC_GCR_DBW_SHIFT)
|
||||
# define LTDC_GCR_DBW(n) ((uint32_t)(n) << LTDC_GCR_DBW_SHIFT)
|
||||
#define LTDC_GCR_DGW_SHIFT (8) /* Bits 8-10: Dither Green Width */
|
||||
#define LTDC_GCR_DGW_MASK (0x7 << LTDC_GCR_DGW_SHIFT)
|
||||
# define LTDC_GCR_DGW(n) ((uint32_t)(n) << LTDC_GCR_DGW_SHIFT)
|
||||
#define LTDC_GCR_DRW_SHIFT (12) /* Bits 12-14: Dither Red Width */
|
||||
#define LTDC_GCR_DRW_MASK (0x7 << LTDC_GCR_DRW_SHIFT)
|
||||
# define LTDC_GCR_DRW(n) ((uint32_t)(n) << LTDC_GCR_DRW_SHIFT)
|
||||
#define LTDC_GCR_DEN (1 << 16) /* Bit 16: Dither Enable */
|
||||
#define LTDC_GCR_PCPOL (1 << 28) /* Bit 28: Pixel Clock Polarity */
|
||||
#define LTDC_GCR_DEPOL (1 << 29) /* Bit 29: Data Enable Polarity */
|
||||
#define LTDC_GCR_VSPOL (1 << 30) /* Bit 30: Vertical Sync Polarity */
|
||||
#define LTDC_GCR_HSPOL (1 << 31) /* Bit 31: Horizontal Sync Polarity */
|
||||
|
||||
/* LTDC Shadow Reload Configuration Register */
|
||||
|
||||
#define LTDC_SRCR_IMR (1 << 0) /* Bit 0: Immediate Reload */
|
||||
#define LTDC_SRCR_VBR (1 << 1) /* Bit 1: Vertical Blanking Reload */
|
||||
|
||||
/* LTDC Background Color Configuration Register */
|
||||
|
||||
#define LTDC_BCCR_BCBLUE_SHIFT (0) /* Bits 0-7: Background Color Blue Value */
|
||||
#define LTDC_BCCR_BCBLUE_MASK (0xFF << LTDC_BCCR_BCBLUE_SHIFT)
|
||||
# define LTDC_BCCR_BCBLUE(n) ((uint32_t)(n) << LTDC_BCCR_BCBLUE_SHIFT)
|
||||
#define LTDC_BCCR_BCGREEN_SHIFT (8) /* Bits 8-15: Background Color Green Value */
|
||||
#define LTDC_BCCR_BCGREEN_MASK (0xFF << LTDC_BCCR_BCGREEN_SHIFT)
|
||||
# define LTDC_BCCR_BCGREEN(n) ((uint32_t)(n) << LTDC_BCCR_BCGREEN_SHIFT)
|
||||
#define LTDC_BCCR_BCRED_SHIFT (16) /* Bits 16-23: Background Color Red Value */
|
||||
#define LTDC_BCCR_BCRED_MASK (0xFF << LTDC_BCCR_BCRED_SHIFT)
|
||||
# define LTDC_BCCR_BCRED(n) ((uint32_t)(n) << LTDC_BCCR_BCRED_SHIFT)
|
||||
|
||||
/* LTDC Interrupt Enable Register */
|
||||
|
||||
#define LTDC_IER_LIE (1 << 0) /* Bit 0: Line Interrupt Enable */
|
||||
#define LTDC_IER_FUIE (1 << 1) /* Bit 1: FIFO Underrun Interrupt Enable */
|
||||
#define LTDC_IER_TERRIE (1 << 2) /* Bit 2: Transfer Error Interrupt Enable */
|
||||
#define LTDC_IER_RRIE (1 << 3) /* Bit 3: Register Reload Interrupt Enable */
|
||||
|
||||
/* LTDC Interrupt Status Register */
|
||||
|
||||
#define LTDC_ISR_LIF (1 << 0) /* Bit 0: Line Interrupt Flag */
|
||||
#define LTDC_ISR_FUIF (1 << 1) /* Bit 1: FIFO Underrun Interrupt Flag */
|
||||
#define LTDC_IER_TERRIF (1 << 2) /* Bit 2: Transfer Error Interrupt Flag */
|
||||
#define LTDC_ISR_RRIF (1 << 3) /* Bit 3: Register Reload Interrupt Flag */
|
||||
|
||||
/* LTDC Interrupt Clear Register */
|
||||
|
||||
#define LTDC_ICR_CLIF (1 << 0) /* Bit 0: Clear Line Interrupt Flag */
|
||||
#define LTDC_ICR_CFUIF (1 << 1) /* Bit 1: Clear FIFO Underrun Interrupt Flag */
|
||||
#define LTDC_ICR_CTERRIF (1 << 2) /* Bit 2: Clear Transfer Error Interrupt Flag */
|
||||
#define LTDC_ICR_CRRIF (1 << 3) /* Bit 3: Clear Register Reload Interrupt Flag */
|
||||
|
||||
/* LTDC Line Interrupt Posittion Configuration Register */
|
||||
|
||||
#define LTDC_LIPCR_LIPOS_SHIFT (0) /* Bits 0-10: Line Interrupt Position */
|
||||
#define LTDC_LIPCR_LIPOS_MASK (0x7FF << LTDC_LIPCR_LIPOS_SHIFT)
|
||||
# define LTDC_LIPCR_LIPOS(n) ((uint32_t)(n) << LTDC_LIPCR_LIPOS_SHIFT)
|
||||
|
||||
/* LTDC Current Position Status Register */
|
||||
|
||||
#define LTDC_CPSR_CYPOS_SHIFT (0) /* Bits 0-15: Current Y Position */
|
||||
#define LTDC_CPSR_CYPOS_MASK (0xFFFF << LTDC_CPSR_CYPOS_SHIFT)
|
||||
# define LTDC_CPSR_CYPOS(n) ((uint32_t)(n) << LTDC_CPSR_CYPOS_SHIFT)
|
||||
#define LTDC_CPSR_CXPOS_SHIFT (16) /* Bits 15-31: Current X Position */
|
||||
#define LTDC_CPSR_CXPOS_MASK (0xFFFF << LTDC_CPSR_CXPOS_SHIFT)
|
||||
# define LTDC_CPSR_CXPOS(n) ((uint32_t)(n) << LTDC_CPSR_CXPOS_SHIFT)
|
||||
|
||||
/* LTDC Current Display Status Register */
|
||||
|
||||
#define LTDC_CDSR_VDES (1 << 0) /* Bit 0: Vertical Data Enable display Status */
|
||||
#define LTDC_CDSR_HDES (1 << 1) /* Bit 1: Horizontal Data Enable display Status */
|
||||
#define LTDC_CDSR_VSYNCS (1 << 2) /* Bit 2: Vertical Sync display Status */
|
||||
#define LTDC_CDSR_HSYNCS (1 << 3) /* Bit 3: Horizontal Sync display Status */
|
||||
|
||||
/* LTDC Layer x Control Register */
|
||||
|
||||
#define LTDC_LxCR_LEN (1 << 0) /* Bit 0: Layer Enable */
|
||||
#define LTDC_LxCR_COLKEN (1 << 1) /* Bit 1: Color Keying Enable */
|
||||
#define LTDC_LxCR_CLUTEN (1 << 4) /* Bit 4: Color Look-Up Table Enable */
|
||||
|
||||
/* LTDC Layer x Window Horizontal Position Configuration Register */
|
||||
|
||||
#define LTDC_LxWHPCR_WHSTPOS_SHIFT (0) /* Bits 0-11: Window Horizontal Start Position */
|
||||
#define LTDC_LxWHPCR_WHSTPOS_MASK (0xFFF << LTDC_LxWHPCR_WHSTPOS_SHIFT)
|
||||
# define LTDC_LxWHPCR_WHSTPOS(n) ((uint32_t)(n) << LTDC_LxWHPCR_WHSTPOS_SHIFT)
|
||||
#define LTDC_LxWHPCR_WHSPPOS_SHIFT (16) /* Bits 16-27: Window Horizontal Stop Position */
|
||||
#define LTDC_LxWHPCR_WHSPPOS_MASK (0xFFF << LTDC_LxWHPCR_WHSPPOS_SHIFT)
|
||||
# define LTDC_LxWHPCR_WHSPPOS(n) ((uint32_t)(n) << LTDC_LxWHPCR_WHSPPOS_SHIFT)
|
||||
|
||||
/* LTDC Layer x Window Vertical Position Configuration Register */
|
||||
|
||||
#define LTDC_LxWVPCR_WVSTPOS_SHIFT (0) /* Bits 0-10: Window Vertical Start Position */
|
||||
#define LTDC_LxWVPCR_WVSTPOS_MASK (0x7FF << LTDC_LxWVPCR_WVSTPOS_SHIFT)
|
||||
# define LTDC_LxWVPCR_WVSTPOS(n) ((uint32_t)(n) << LTDC_LxWVPCR_WVSTPOS_SHIFT)
|
||||
#define LTDC_LxWVPCR_WVSPPOS_SHIFT (16) /* Bits 16-26: Window Vertical Stop Position */
|
||||
#define LTDC_LxWVPCR_WVSPPOS_MASK (0x7FF << LTDC_LxWVPCR_WVSPPOS_SHIFT)
|
||||
# define LTDC_LxWVPCR_WVSPPOS(n) ((uint32_t)(n) << LTDC_LxWVPCR_WVSPPOS_SHIFT)
|
||||
|
||||
/* LTDC Layer x Color Keying Configuration Register */
|
||||
|
||||
#define LTDC_LxCKCR_CKBLUE_SHIFT (0) /* Bits 0-7: Color Key Blue Value */
|
||||
#define LTDC_LxCKCR_CKBLUE_MASK (0xFF << LTDC_LxCKCR_CKBLUE_SHIFT)
|
||||
# define LTDC_LxCKCR_CKBLUE(n) ((uint32_t)(n) << LTDC_LxCKCR_CKBLUE_SHIFT)
|
||||
#define LTDC_LxCKCR_CKGREEN_SHIFT (8) /* Bits 8-15: Color Key Green Value */
|
||||
#define LTDC_LxCKCR_CKGREEN_MASK (0xFF << LTDC_LxCKCR_CKGREEN_SHIFT)
|
||||
# define LTDC_LxCKCR_CKGREEN(n) ((uint32_t)(n) << LTDC_LxCKCR_CKGREEN_SHIFT)
|
||||
#define LTDC_LxCKCR_CKRED_SHIFT (16) /* Bits 16-23: Color Key Red Value */
|
||||
#define LTDC_LxCKCR_CKRED_MASK (0xFF << LTDC_LxCKCR_CKRED_SHIFT)
|
||||
# define LTDC_LxCKCR_CKRED(n) ((uint32_t)(n) << LTDC_LxCKCR_CKRED_SHIFT)
|
||||
|
||||
/* LTDC Layer x Pixel Format Configuration Register */
|
||||
|
||||
#define LTDC_LxPFCR_PF_SHIFT (0) /* Bits 0-2: Pixel Format */
|
||||
#define LTDC_LxPFCR_PF_MASK (0x7 << LTDC_LxPFCR_PF_SHIFT)
|
||||
# define LTDC_LxPFCR_PF(n) ((uint32_t)(n) << LTDC_LxPFCR_PF_SHIFT)
|
||||
|
||||
#define LTDC_PF_ARGB8888 0
|
||||
#define LTDC_PF_RGB888 1
|
||||
#define LTDC_PF_RGB565 2
|
||||
#define LTDC_PF_ARGB1555 3
|
||||
#define LTDC_PF_ARGB4444 4
|
||||
#define LTDC_PF_L8 5 /* 8-bit Luninance (CLUT lookup) */
|
||||
#define LTDC_PF_AL44 6 /* 4-bit Alpha, 4-bit Luminance */
|
||||
#define LTDC_PF_AL88 7 /* 8-bit Alpha, 8-bit Luminance */
|
||||
|
||||
/* LTDC Layer x Constant Alpha Configuration Register */
|
||||
|
||||
#define LTDC_LxCACR_CONSTA_SHIFT (0) /* Bits 0-7: Constant Alpha */
|
||||
#define LTDC_LxCACR_CONSTA_MASK (0x7 << LTDC_LxCACR_CONSTA_SHIFT)
|
||||
# define LTDC_LxCACR_CONSTA(n) ((uint32_t)(n) << LTDC_LxCACR_CONSTA_SHIFT)
|
||||
|
||||
/* LTDC Layer x Default Color Configuration Register */
|
||||
|
||||
#define LTDC_LxDCCR_DCBLUE_SHIFT (0) /* Bits 0-7: Default Color Blue Value */
|
||||
#define LTDC_LxDCCR_DCBLUE_MASK (0xFF << LTDC_LxDCCR_DCBLUE_SHIFT)
|
||||
# define LTDC_LxDCCR_DCBLUE(n) ((uint32_t)(n) << LTDC_LxDCCR_DCBLUE_SHIFT)
|
||||
#define LTDC_LxDCCR_DCGREEN_SHIFT (8) /* Bits 8-15: Default Color Green Value */
|
||||
#define LTDC_LxDCCR_DCGREEN_MASK (0xFF << LTDC_LxDCCR_DCGREEN_SHIFT)
|
||||
# define LTDC_LxDCCR_DCGREEN(n) ((uint32_t)(n) << LTDC_LxDCCR_DCGREEN_SHIFT)
|
||||
#define LTDC_LxDCCR_DCRED_SHIFT (16) /* Bits 16-23: Default Color Red Value */
|
||||
#define LTDC_LxDCCR_DCRED_MASK (0xFF << LTDC_LxDCCR_DCRED_SHIFT)
|
||||
# define LTDC_LxDCCR_DCRED(n) ((uint32_t)(n) << LTDC_LxDCCR_DCRED_SHIFT)
|
||||
#define LTDC_LxDCCR_DCALPHA_SHIFT (24) /* Bits 24-31: Default Color Alpha Value */
|
||||
#define LTDC_LxDCCR_DCALPHA_MASK (0xFF << LTDC_LxDCCR_DCALPHA_SHIFT)
|
||||
# define LTDC_LxDCCR_DCALPHA(n) ((uint32_t)(n) << LTDC_LxDCCR_DCALPHA_SHIFT)
|
||||
|
||||
/* LTDC Layer x Blending Factors Configuration Register */
|
||||
|
||||
#define LTDC_LxBFCR_BF2_SHIFT (0) /* Bits 0-2: Blending Factor 2 */
|
||||
#define LTDC_LxBFCR_BF2_MASK (0x7 << LTDC_LxBFCR_BF2_SHIFT)
|
||||
# define LTDC_LxBFCR_BF2(n) ((uint32_t)(n) << LTDC_LxBFCR_BF2_SHIFT)
|
||||
#define LTDC_LxBFCR_BF1_SHIFT (8) /* Bits 8-10: Blending Factor 1 */
|
||||
#define LTDC_LxBFCR_BF1_MASK (0x7 << LTDC_LxBFCR_BF1_SHIFT)
|
||||
# define LTDC_LxBFCR_BF1(n) ((uint32_t)(n) << LTDC_LxBFCR_BF1_SHIFT)
|
||||
|
||||
#define LTDC_BF1_CONST_ALPHA 0x04 /* Constant Alpha */
|
||||
#define LTDC_BF1_PIXEL_ALPHA 0x06 /* Pixel Alpha x Constant Alpha */
|
||||
#define LTDC_BF2_CONST_ALPHA 0x05 /* Constant Alpha */
|
||||
#define LTDC_BF2_PIXEL_ALPHA 0x07 /* Pixel Alpha x Constant Alpha */
|
||||
|
||||
/* LTDC Layer x Color Frame Buffer Length Configuration Register */
|
||||
|
||||
#define LTDC_LxCFBLCR_CFBLL_SHIFT (0) /* Bits 0-12: Color Frame Buffer Line Length */
|
||||
#define LTDC_LxCFBLCR_CFBLL_MASK (0x1FFF << LTDC_LxCFBLCR_CFBLL_SHIFT)
|
||||
# define LTDC_LxCFBLCR_CFBLL(n) ((uint32_t)(n) << LTDC_LxCFBLCR_CFBLL_SHIFT)
|
||||
#define LTDC_LxCFBLCR_CFBP_SHIFT (16) /* Bits 16-28: Color Frame Buffer Pitch */
|
||||
#define LTDC_LxCFBLCR_CFBP_MASK (0x1FFF << LTDC_LxCFBLCR_CFBP_SHIFT)
|
||||
# define LTDC_LxCFBLCR_CFBP(n) ((uint32_t)(n) << LTDC_LxCFBLCR_CFBP_SHIFT)
|
||||
|
||||
/* LTDC Layer x Color Frame Buffer Line Number Register */
|
||||
|
||||
#define LTDC_LxCFBLNR_LN_SHIFT (0) /* Bits 0-10: Color Frame Buffer Line Number */
|
||||
#define LTDC_LxCFBLNR_LN_MASK (0x7FF << LTDC_LxCFBLNR_LN_SHIFT)
|
||||
# define LTDC_LxCFBLNR_LN(n) ((uint32_t)(n) << LTDC_LxCFBLNR_LN_SHIFT)
|
||||
|
||||
/* LTDC Layer x CLUT Write Register */
|
||||
|
||||
#define LTDC_LxCLUTWR_BLUE_SHIFT (0) /* Bits 0-7: Default Color Blue Value */
|
||||
#define LTDC_LxCLUTWR_BLUE_MASK (0xFF << LTDC_LxCLUTWR_BLUE_SHIFT)
|
||||
# define LTDC_LxCLUTWR_BLUE(n) ((uint32_t)(n) << LTDC_LxCLUTWR_BLUE_SHIFT)
|
||||
#define LTDC_LxCLUTWR_GREEN_SHIFT (8) /* Bits 8-15: Default Color Green Value */
|
||||
#define LTDC_LxCLUTWR_GREEN_MASK (0xFF << LTDC_LxCLUTWR_GREEN_SHIFT)
|
||||
# define LTDC_LxCLUTWR_GREEN(n) ((uint32_t)(n) << LTDC_LxCLUTWR_GREEN_SHIFT)
|
||||
#define LTDC_LxCLUTWR_RED_SHIFT (16) /* Bits 16-23: Default Color Red Value */
|
||||
#define LTDC_LxCLUTWR_RED_MASK (0xFF << LTDC_LxCLUTWR_RED_SHIFT)
|
||||
# define LTDC_LxCLUTWR_RED(n) ((uint32_t)(n) << LTDC_LxCLUTWR_RED_SHIFT)
|
||||
#define LTDC_LxCLUTWR_CLUTADD_SHIFT (24) /* Bits 24-31: CLUT Address */
|
||||
#define LTDC_LxCLUTWR_CLUTADD_MASK (0xFF << LTDC_LxCLUTWR_CLUTADD_SHIFT)
|
||||
# define LTDC_LxCLUTWR_CLUTADD(n) ((uint32_t)(n) << LTDC_LxCLUTWR_CLUTADD_SHIFT)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32_LTDC_H */
|
@ -164,6 +164,8 @@
|
||||
#define STM32_TIM11_BASE 0x40014800 /* 0x40014800-0x40014bff: TIM11 timer */
|
||||
#define STM32_SPI5_BASE 0x40015000 /* 0x40015000-0x400153ff: SPI5 */
|
||||
#define STM32_SPI6_BASE 0x40015400 /* 0x40015400-0x400157ff: SPI6 */
|
||||
#define STM32_SAI1_BASE 0x40015800 /* 0x40015800-0x40015Bff: SAI1 */
|
||||
#define STM32_LTDC_BASE 0x40016800 /* 0x40016800-0x40016Bff: LTDC (LCD-TFT) */
|
||||
|
||||
/* AHB1 Base Addresses **************************************************************/
|
||||
|
||||
@ -176,6 +178,7 @@
|
||||
#define STM32_GPIOG_BASE 0x40021800 /* 0x40021800-0x40021bff: GPIO Port G */
|
||||
#define STM32_GPIOH_BASE 0x40021C00 /* 0x40021C00-0x40021fff: GPIO Port H */
|
||||
#define STM32_GPIOI_BASE 0x40022000 /* 0x40022000-0x400223ff: GPIO Port I */
|
||||
#define STM32_GPIOK_BASE 0x40022800 /* 0x40022800-0x40022Bff: GPIO Port K */
|
||||
#define STM32_CRC_BASE 0x40023000 /* 0x40023000-0x400233ff: CRC */
|
||||
#define STM32_RCC_BASE 0x40023800 /* 0x40023800-0x40023bff: Reset and Clock control RCC */
|
||||
#define STM32_FLASHIF_BASE 0x40023c00 /* 0x40023c00-0x40023fff: Flash memory interface */
|
||||
@ -187,6 +190,7 @@
|
||||
/* 0x40028800-0x40028bff: Ethernet MAC */
|
||||
/* 0x40028c00-0x40028fff: Ethernet MAC */
|
||||
/* 0x40029000-0x400293ff: Ethernet MAC */
|
||||
#define STM32_DMA2D_BASE 0x4002B000 /* 0x4002B000-0x4002BBFF: DMA2D */
|
||||
#define STM32_OTGHS_BASE 0x40040000 /* 0x40040000-0x4007ffff: USB OTG HS */
|
||||
#define STM32_PERIPHBB_BASE 0x42000000 /* Peripheral bit-band region */
|
||||
|
||||
|
@ -66,6 +66,7 @@
|
||||
#define STM32_RCC_SSCGR_OFFSET 0x0080 /* Spread spectrum clock generation register */
|
||||
#define STM32_RCC_PLLI2SCFGR_OFFSET 0x0084 /* PLLI2S configuration register */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define STM32_RCC_PLLSAICFGR_OFFSET 0x0088 /* PLLSAI configuration register */
|
||||
# define STM32_RCC_DCKCFGR_OFFSET 0x008c /* Dedicated clocks configuration register */
|
||||
#endif
|
||||
|
||||
@ -95,6 +96,7 @@
|
||||
#define STM32_RCC_SSCGR (STM32_RCC_BASE+STM32_RCC_SSCGR_OFFSET)
|
||||
#define STM32_RCC_PLLI2SCFGR (STM32_RCC_BASE+STM32_RCC_PLLI2SCFGR_OFFSET)
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define STM32_RCC_PLLSAICFGR (STM32_RCC_BASE+STM32_RCC_PLLSAICFGR_OFFSET)
|
||||
# define STM32_RCC_DCKCFGR (STM32_RCC_BASE+STM32_RCC_DCKCFGR_OFFSET)
|
||||
#endif
|
||||
|
||||
@ -116,6 +118,8 @@
|
||||
#define RCC_CR_PLLRDY (1 << 25) /* Bit 25: PLL clock ready flag */
|
||||
#define RCC_CR_PLLI2SON (1 << 26) /* Bit 26: PLLI2S enable */
|
||||
#define RCC_CR_PLLI2SRDY (1 << 27) /* Bit 27: PLLI2S clock ready flag */
|
||||
#define RCC_CR_PLLSAION (1 << 28) /* Bit 28: PLLSAI enable */
|
||||
#define RCC_CR_PLLSAIRDY (1 << 29) /* Bit 29: PLLSAI clock ready flag */
|
||||
|
||||
/* PLL configuration register */
|
||||
|
||||
@ -227,12 +231,14 @@
|
||||
#define RCC_CIR_HSERDYIE (1 << 11) /* Bit 11: HSE Ready Interrupt Enable */
|
||||
#define RCC_CIR_PLLRDYIE (1 << 12) /* Bit 12: PLL Ready Interrupt Enable */
|
||||
#define RCC_CIR_PLLI2SRDYIE (1 << 13) /* Bit 13: PLLI2S Ready Interrupt enable */
|
||||
#define RCC_CIR_PLLSAIRDYIE (1 << 14) /* Bit 14: PLLSAI Ready Interrupt enable */
|
||||
#define RCC_CIR_LSIRDYC (1 << 16) /* Bit 16: LSI Ready Interrupt Clear */
|
||||
#define RCC_CIR_LSERDYC (1 << 17) /* Bit 17: LSE Ready Interrupt Clear */
|
||||
#define RCC_CIR_HSIRDYC (1 << 18) /* Bit 18: HSI Ready Interrupt Clear */
|
||||
#define RCC_CIR_HSERDYC (1 << 19) /* Bit 19: HSE Ready Interrupt Clear */
|
||||
#define RCC_CIR_PLLRDYC (1 << 20) /* Bit 20: PLL Ready Interrupt Clear */
|
||||
#define RCC_CIR_PLLI2SRDYC (1 << 21) /* Bit 21: PLLI2S Ready Interrupt clear */
|
||||
#define RCC_CIR_PLLSAIRDYC (1 << 22) /* Bit 22: PLLSAI Ready Interrupt clear */
|
||||
#define RCC_CIR_CSSC (1 << 23) /* Bit 23: Clock Security System Interrupt Clear */
|
||||
|
||||
/* AHB1 peripheral reset register */
|
||||
@ -245,9 +251,13 @@
|
||||
#define RCC_AHB1RSTR_GPIOFRST (1 << 5) /* Bit 5: IO port F reset */
|
||||
#define RCC_AHB1RSTR_GPIOGRST (1 << 6) /* Bit 6: IO port G reset */
|
||||
#define RCC_AHB1RSTR_GPIOHRST (1 << 7) /* Bit 7: IO port H reset */
|
||||
#define RCC_AHB1RSTR_CRCRST (1 << 12) /* Bit 12 IO port I reset */
|
||||
#define RCC_AHB1RSTR_GPIOIRST (1 << 8) /* Bit 8: IO port I reset */
|
||||
#define RCC_AHB1RSTR_GPIOJRST (1 << 9) /* Bit 9: IO port J reset */
|
||||
#define RCC_AHB1RSTR_GPIOKRST (1 << 10) /* Bit 10: IO port K reset */
|
||||
#define RCC_AHB1RSTR_CRCRST (1 << 12) /* Bit 12 CRC reset */
|
||||
#define RCC_AHB1RSTR_DMA1RST (1 << 21) /* Bit 21: DMA1 reset */
|
||||
#define RCC_AHB1RSTR_DMA2RST (1 << 22) /* Bit 22: DMA2 reset */
|
||||
#define RCC_AHB1RSTR_DMA2DRST (1 << 23) /* Bit 23: DMA2D reset */
|
||||
#define RCC_AHB1RSTR_ETHMACRST (1 << 25) /* Bit 25: Ethernet MAC reset */
|
||||
#define RCC_AHB1RSTR_OTGHSRST (1 << 29) /* Bit 29: USB OTG HS module reset */
|
||||
|
||||
@ -312,6 +322,10 @@
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2RSTR_SPI5RST (1 << 20) /* Bit 20: SPI 5 reset */
|
||||
# define RCC_APB2RSTR_SPI6RST (1 << 21) /* Bit 21: SPI 6 reset */
|
||||
# define RCC_APB2RSTR_SAI1RST (1 << 22) /* Bit 22: SAI 1 reset */
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2RSTR_LTDCRST (1 << 26) /* Bit 26: LTDC reset */
|
||||
#endif
|
||||
|
||||
/* AHB1 Peripheral Clock enable register */
|
||||
@ -331,6 +345,7 @@
|
||||
#define RCC_AHB1ENR_CCMDATARAMEN (1 << 20) /* Bit 20: CCM data RAM clock enable */
|
||||
#define RCC_AHB1ENR_DMA1EN (1 << 21) /* Bit 21: DMA1 clock enable */
|
||||
#define RCC_AHB1ENR_DMA2EN (1 << 22) /* Bit 22: DMA2 clock enable */
|
||||
#define RCC_AHB1ENR_DMA2DEN (1 << 23) /* Bit 23: DMA2D clock enable */
|
||||
#define RCC_AHB1ENR_ETHMACEN (1 << 25) /* Bit 25: Ethernet MAC clock enable */
|
||||
#define RCC_AHB1ENR_ETHMACTXEN (1 << 26) /* Bit 26: Ethernet Transmission clock enable */
|
||||
#define RCC_AHB1ENR_ETHMACRXEN (1 << 27) /* Bit 27: Ethernet Reception clock enable */
|
||||
@ -352,166 +367,175 @@
|
||||
|
||||
/* APB1 Peripheral Clock enable register */
|
||||
|
||||
#define RCC_APB1ENR_TIM2EN (1 << 0) /* Bit 0: TIM2 clock enable */
|
||||
#define RCC_APB1ENR_TIM3EN (1 << 1) /* Bit 1: TIM3 clock enable */
|
||||
#define RCC_APB1ENR_TIM4EN (1 << 2) /* Bit 2: TIM4 clock enable */
|
||||
#define RCC_APB1ENR_TIM5EN (1 << 3) /* Bit 3: TIM5 clock enable */
|
||||
#define RCC_APB1ENR_TIM6EN (1 << 4) /* Bit 4: TIM6 clock enable */
|
||||
#define RCC_APB1ENR_TIM7EN (1 << 5) /* Bit 5: TIM7 clock enable */
|
||||
#define RCC_APB1ENR_TIM12EN (1 << 6) /* Bit 6: TIM12 clock enable */
|
||||
#define RCC_APB1ENR_TIM13EN (1 << 7) /* Bit 7: TIM13 clock enable */
|
||||
#define RCC_APB1ENR_TIM14EN (1 << 8) /* Bit 8: TIM14 clock enable */
|
||||
#define RCC_APB1ENR_WWDGEN (1 << 11) /* Bit 11: Window watchdog clock enable */
|
||||
#define RCC_APB1ENR_SPI2EN (1 << 14) /* Bit 14: SPI2 clock enable */
|
||||
#define RCC_APB1ENR_SPI3EN (1 << 15) /* Bit 15: SPI3 clock enable */
|
||||
#define RCC_APB1ENR_USART2EN (1 << 17) /* Bit 17: USART 2 clock enable */
|
||||
#define RCC_APB1ENR_USART3EN (1 << 18) /* Bit 18: USART3 clock enable */
|
||||
#define RCC_APB1ENR_UART4EN (1 << 19) /* Bit 19: UART4 clock enable */
|
||||
#define RCC_APB1ENR_UART5EN (1 << 20) /* Bit 20: UART5 clock enable */
|
||||
#define RCC_APB1ENR_I2C1EN (1 << 21) /* Bit 21: I2C1 clock enable */
|
||||
#define RCC_APB1ENR_I2C2EN (1 << 22) /* Bit 22: I2C2 clock enable */
|
||||
#define RCC_APB1ENR_I2C3EN (1 << 23) /* Bit 23: I2C3 clock enable */
|
||||
#define RCC_APB1ENR_CAN1EN (1 << 25) /* Bit 25: CAN 1 clock enable */
|
||||
#define RCC_APB1ENR_CAN2EN (1 << 26) /* Bit 26: CAN 2 clock enable */
|
||||
#define RCC_APB1ENR_PWREN (1 << 28) /* Bit 28: Power interface clock enable */
|
||||
#define RCC_APB1ENR_DACEN (1 << 29) /* Bit 29: DAC interface clock enable */
|
||||
#define RCC_APB1ENR_TIM2EN (1 << 0) /* Bit 0: TIM2 clock enable */
|
||||
#define RCC_APB1ENR_TIM3EN (1 << 1) /* Bit 1: TIM3 clock enable */
|
||||
#define RCC_APB1ENR_TIM4EN (1 << 2) /* Bit 2: TIM4 clock enable */
|
||||
#define RCC_APB1ENR_TIM5EN (1 << 3) /* Bit 3: TIM5 clock enable */
|
||||
#define RCC_APB1ENR_TIM6EN (1 << 4) /* Bit 4: TIM6 clock enable */
|
||||
#define RCC_APB1ENR_TIM7EN (1 << 5) /* Bit 5: TIM7 clock enable */
|
||||
#define RCC_APB1ENR_TIM12EN (1 << 6) /* Bit 6: TIM12 clock enable */
|
||||
#define RCC_APB1ENR_TIM13EN (1 << 7) /* Bit 7: TIM13 clock enable */
|
||||
#define RCC_APB1ENR_TIM14EN (1 << 8) /* Bit 8: TIM14 clock enable */
|
||||
#define RCC_APB1ENR_WWDGEN (1 << 11) /* Bit 11: Window watchdog clock enable */
|
||||
#define RCC_APB1ENR_SPI2EN (1 << 14) /* Bit 14: SPI2 clock enable */
|
||||
#define RCC_APB1ENR_SPI3EN (1 << 15) /* Bit 15: SPI3 clock enable */
|
||||
#define RCC_APB1ENR_USART2EN (1 << 17) /* Bit 17: USART 2 clock enable */
|
||||
#define RCC_APB1ENR_USART3EN (1 << 18) /* Bit 18: USART3 clock enable */
|
||||
#define RCC_APB1ENR_UART4EN (1 << 19) /* Bit 19: UART4 clock enable */
|
||||
#define RCC_APB1ENR_UART5EN (1 << 20) /* Bit 20: UART5 clock enable */
|
||||
#define RCC_APB1ENR_I2C1EN (1 << 21) /* Bit 21: I2C1 clock enable */
|
||||
#define RCC_APB1ENR_I2C2EN (1 << 22) /* Bit 22: I2C2 clock enable */
|
||||
#define RCC_APB1ENR_I2C3EN (1 << 23) /* Bit 23: I2C3 clock enable */
|
||||
#define RCC_APB1ENR_CAN1EN (1 << 25) /* Bit 25: CAN 1 clock enable */
|
||||
#define RCC_APB1ENR_CAN2EN (1 << 26) /* Bit 26: CAN 2 clock enable */
|
||||
#define RCC_APB1ENR_PWREN (1 << 28) /* Bit 28: Power interface clock enable */
|
||||
#define RCC_APB1ENR_DACEN (1 << 29) /* Bit 29: DAC interface clock enable */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB1ENR_UART7EN (1 << 30) /* Bit 30: UART7 clock enable */
|
||||
# define RCC_APB1ENR_UART8EN (1 << 31) /* Bit 31: UART8 clock enable */
|
||||
# define RCC_APB1ENR_UART7EN (1 << 30) /* Bit 30: UART7 clock enable */
|
||||
# define RCC_APB1ENR_UART8EN (1 << 31) /* Bit 31: UART8 clock enable */
|
||||
#endif
|
||||
|
||||
/* APB2 Peripheral Clock enable register */
|
||||
|
||||
#define RCC_APB2ENR_TIM1EN (1 << 0) /* Bit 0: TIM1 clock enable */
|
||||
#define RCC_APB2ENR_TIM8EN (1 << 1) /* Bit 1: TIM8 clock enable */
|
||||
#define RCC_APB2ENR_USART1EN (1 << 4) /* Bit 4: USART1 clock enable */
|
||||
#define RCC_APB2ENR_USART6EN (1 << 5) /* Bit 5: USART6 clock enable */
|
||||
#define RCC_APB2ENR_ADC1EN (1 << 8) /* Bit 8: ADC1 clock enable */
|
||||
#define RCC_APB2ENR_ADC2EN (1 << 9) /* Bit 9: ADC2 clock enable */
|
||||
#define RCC_APB2ENR_ADC3EN (1 << 10) /* Bit 10: ADC3 clock enable */
|
||||
#define RCC_APB2ENR_SDIOEN (1 << 11) /* Bit 11: SDIO clock enable */
|
||||
#define RCC_APB2ENR_SPI1EN (1 << 12) /* Bit 12: SPI1 clock enable */
|
||||
#define RCC_APB2ENR_TIM1EN (1 << 0) /* Bit 0: TIM1 clock enable */
|
||||
#define RCC_APB2ENR_TIM8EN (1 << 1) /* Bit 1: TIM8 clock enable */
|
||||
#define RCC_APB2ENR_USART1EN (1 << 4) /* Bit 4: USART1 clock enable */
|
||||
#define RCC_APB2ENR_USART6EN (1 << 5) /* Bit 5: USART6 clock enable */
|
||||
#define RCC_APB2ENR_ADC1EN (1 << 8) /* Bit 8: ADC1 clock enable */
|
||||
#define RCC_APB2ENR_ADC2EN (1 << 9) /* Bit 9: ADC2 clock enable */
|
||||
#define RCC_APB2ENR_ADC3EN (1 << 10) /* Bit 10: ADC3 clock enable */
|
||||
#define RCC_APB2ENR_SDIOEN (1 << 11) /* Bit 11: SDIO clock enable */
|
||||
#define RCC_APB2ENR_SPI1EN (1 << 12) /* Bit 12: SPI1 clock enable */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2ENR_SPI4EN (1 << 13) /* Bit 13: SPI4 clock enable */
|
||||
# define RCC_APB2ENR_SPI4EN (1 << 13) /* Bit 13: SPI4 clock enable */
|
||||
#endif
|
||||
#define RCC_APB2ENR_SYSCFGEN (1 << 14) /* Bit 14: System configuration controller clock enable */
|
||||
#define RCC_APB2ENR_TIM9EN (1 << 16) /* Bit 16: TIM9 clock enable */
|
||||
#define RCC_APB2ENR_TIM10EN (1 << 17) /* Bit 17: TIM10 clock enable */
|
||||
#define RCC_APB2ENR_TIM11EN (1 << 18) /* Bit 18: TIM11 clock enable */
|
||||
#define RCC_APB2ENR_SYSCFGEN (1 << 14) /* Bit 14: System configuration controller clock enable */
|
||||
#define RCC_APB2ENR_TIM9EN (1 << 16) /* Bit 16: TIM9 clock enable */
|
||||
#define RCC_APB2ENR_TIM10EN (1 << 17) /* Bit 17: TIM10 clock enable */
|
||||
#define RCC_APB2ENR_TIM11EN (1 << 18) /* Bit 18: TIM11 clock enable */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2ENR_SPI5EN (1 << 20) /* Bit 20: SPI5 clock enable */
|
||||
# define RCC_APB2ENR_SPI6EN (1 << 21) /* Bit 21: SPI6 clock enable */
|
||||
# define RCC_APB2ENR_SPI5EN (1 << 20) /* Bit 20: SPI5 clock enable */
|
||||
# define RCC_APB2ENR_SPI6EN (1 << 21) /* Bit 21: SPI6 clock enable */
|
||||
# define RCC_APB2ENR_SAI1EN (1 << 22) /* Bit 22: SAI1 clock enable */
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2ENR_LTDCEN (1 << 26) /* Bit 26: LTDC clock enable */
|
||||
#endif
|
||||
|
||||
/* RCC AHB1 low power modeperipheral clock enable register */
|
||||
|
||||
#define RCC_AHB1LPENR_GPIOLPEN(n) (1 << (n))
|
||||
#define RCC_AHB1LPENR_GPIOALPEN (1 << 0) /* Bit 0: IO port A clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOBLPEN (1 << 1) /* Bit 1: IO port B clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOCLPEN (1 << 2) /* Bit 2: IO port C clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIODLPEN (1 << 3) /* Bit 3: IO port D clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOELPEN (1 << 4) /* Bit 4: IO port E clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOFLPEN (1 << 5) /* Bit 5: IO port F clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOGLPEN (1 << 6) /* Bit 6: IO port G clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOHLPEN (1 << 7) /* Bit 7: IO port H clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOILPEN (1 << 8) /* Bit 8: IO port I clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_CRCLPEN (1 << 12) /* Bit 12: CRC clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_FLITFLPEN (1 << 15) /* Bit 15: Flash interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_SRAM1LPEN (1 << 16) /* Bit 16: SRAM 1 interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_SRAM2LPEN (1 << 17) /* Bit 17: SRAM 2 interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_BKPSRAMLPEN (1 << 18) /* Bit 18: Backup SRAM interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOLPEN(n) (1 << (n))
|
||||
#define RCC_AHB1LPENR_GPIOALPEN (1 << 0) /* Bit 0: IO port A clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOBLPEN (1 << 1) /* Bit 1: IO port B clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOCLPEN (1 << 2) /* Bit 2: IO port C clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIODLPEN (1 << 3) /* Bit 3: IO port D clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOELPEN (1 << 4) /* Bit 4: IO port E clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOFLPEN (1 << 5) /* Bit 5: IO port F clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOGLPEN (1 << 6) /* Bit 6: IO port G clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOHLPEN (1 << 7) /* Bit 7: IO port H clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_GPIOILPEN (1 << 8) /* Bit 8: IO port I clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_CRCLPEN (1 << 12) /* Bit 12: CRC clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_FLITFLPEN (1 << 15) /* Bit 15: Flash interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_SRAM1LPEN (1 << 16) /* Bit 16: SRAM 1 interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_SRAM2LPEN (1 << 17) /* Bit 17: SRAM 2 interface clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_BKPSRAMLPEN (1 << 18) /* Bit 18: Backup SRAM interface clock enable during Sleep mode */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_AHB1LPENR_SRAM3LPEN (1 << 19) /* Bit 19: SRAM 3 interface clock enable during Sleep mode */
|
||||
# define RCC_AHB1LPENR_SRAM3LPEN (1 << 19) /* Bit 19: SRAM 3 interface clock enable during Sleep mode */
|
||||
#endif
|
||||
#define RCC_AHB1LPENR_CCMDATARAMLPEN (1 << 20) /* Bit 20: CCM data RAM clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_DMA1LPEN (1 << 21) /* Bit 21: DMA1 clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_DMA2LPEN (1 << 22) /* Bit 22: DMA2 clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACLPEN (1 << 25) /* Bit 25: Ethernet MAC clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACTXLPEN (1 << 26) /* Bit 26: Ethernet Transmission clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACRXLPEN (1 << 27) /* Bit 27: Ethernet Reception clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACPTPLPEN (1 << 28) /* Bit 28: Ethernet PTP clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_OTGHSLPEN (1 << 29) /* Bit 29: USB OTG HS clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_OTGHSULPILPEN (1 << 30) /* Bit 30: USB OTG HSULPI clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_DMA1LPEN (1 << 21) /* Bit 21: DMA1 clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_DMA2LPEN (1 << 22) /* Bit 22: DMA2 clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_DMA2DLPEN (1 << 23) /* Bit 23: DMA2D clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACLPEN (1 << 25) /* Bit 25: Ethernet MAC clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACTXLPEN (1 << 26) /* Bit 26: Ethernet Transmission clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACRXLPEN (1 << 27) /* Bit 27: Ethernet Reception clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_ETHMACPTPLPEN (1 << 28) /* Bit 28: Ethernet PTP clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_OTGHSLPEN (1 << 29) /* Bit 29: USB OTG HS clock enable during Sleep mode */
|
||||
#define RCC_AHB1LPENR_OTGHSULPILPEN (1 << 30) /* Bit 30: USB OTG HSULPI clock enable during Sleep mode */
|
||||
|
||||
/* RCC AHB2 low power modeperipheral clock enable register */
|
||||
|
||||
#define RCC_AHB2LPENR_DCMILPEN (1 << 0) /* Bit 0: Camera interface enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_CRYPLPEN (1 << 4) /* Bit 4: Cryptographic modules clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_HASHLPEN (1 << 5) /* Bit 5: Hash modules clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_RNGLPEN (1 << 6) /* Bit 6: Random number generator clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_OTGFLPSEN (1 << 7) /* Bit 7: USB OTG FS clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_DCMILPEN (1 << 0) /* Bit 0: Camera interface enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_CRYPLPEN (1 << 4) /* Bit 4: Cryptographic modules clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_HASHLPEN (1 << 5) /* Bit 5: Hash modules clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_RNGLPEN (1 << 6) /* Bit 6: Random number generator clock enable during Sleep mode */
|
||||
#define RCC_AHB2LPENR_OTGFLPSEN (1 << 7) /* Bit 7: USB OTG FS clock enable during Sleep mode */
|
||||
|
||||
/* RCC AHB3 low power modeperipheral clock enable register */
|
||||
|
||||
#define RCC_AHB3LPENR_FSMLPEN (1 << 0) /* Bit 0: Flexible static memory controller module clock
|
||||
#define RCC_AHB3LPENR_FSMLPEN (1 << 0) /* Bit 0: Flexible static memory controller module clock
|
||||
* enable during Sleep mode */
|
||||
|
||||
/* RCC APB1 low power modeperipheral clock enable register */
|
||||
|
||||
#define RCC_APB1LPENR_TIM2LPEN (1 << 0) /* Bit 0: TIM2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM3LPEN (1 << 1) /* Bit 1: TIM3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM4LPEN (1 << 2) /* Bit 2: TIM4 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM5LPEN (1 << 3) /* Bit 3: TIM5 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM6LPEN (1 << 4) /* Bit 4: TIM6 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM7LPEN (1 << 5) /* Bit 5: TIM7 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM12LPEN (1 << 6) /* Bit 6: TIM12 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM13LPEN (1 << 7) /* Bit 7: TIM13 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM14LPEN (1 << 8) /* Bit 8: TIM14 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_WWDGLPEN (1 << 11) /* Bit 11: Window watchdog clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_SPI2LPEN (1 << 14) /* Bit 14: SPI2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_SPI3LPEN (1 << 15) /* Bit 15: SPI3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_USART2LPEN (1 << 17) /* Bit 17: USART 2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_USART3LPEN (1 << 18) /* Bit 18: USART3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_UART4LPEN (1 << 19) /* Bit 19: UART4 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_UART5LPEN (1 << 20) /* Bit 20: UART5 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_I2C1LPEN (1 << 21) /* Bit 21: I2C1 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_I2C2LPEN (1 << 22) /* Bit 22: I2C2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_I2C3LPEN (1 << 23) /* Bit 23: I2C3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_CAN1LPEN (1 << 25) /* Bit 25: CAN 1 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_CAN2LPEN (1 << 26) /* Bit 26: CAN 2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_PWRLPEN (1 << 28) /* Bit 28: Power interface clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_DACLPEN (1 << 29) /* Bit 29: DAC interface clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM2LPEN (1 << 0) /* Bit 0: TIM2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM3LPEN (1 << 1) /* Bit 1: TIM3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM4LPEN (1 << 2) /* Bit 2: TIM4 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM5LPEN (1 << 3) /* Bit 3: TIM5 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM6LPEN (1 << 4) /* Bit 4: TIM6 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM7LPEN (1 << 5) /* Bit 5: TIM7 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM12LPEN (1 << 6) /* Bit 6: TIM12 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM13LPEN (1 << 7) /* Bit 7: TIM13 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_TIM14LPEN (1 << 8) /* Bit 8: TIM14 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_WWDGLPEN (1 << 11) /* Bit 11: Window watchdog clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_SPI2LPEN (1 << 14) /* Bit 14: SPI2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_SPI3LPEN (1 << 15) /* Bit 15: SPI3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_USART2LPEN (1 << 17) /* Bit 17: USART 2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_USART3LPEN (1 << 18) /* Bit 18: USART3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_UART4LPEN (1 << 19) /* Bit 19: UART4 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_UART5LPEN (1 << 20) /* Bit 20: UART5 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_I2C1LPEN (1 << 21) /* Bit 21: I2C1 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_I2C2LPEN (1 << 22) /* Bit 22: I2C2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_I2C3LPEN (1 << 23) /* Bit 23: I2C3 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_CAN1LPEN (1 << 25) /* Bit 25: CAN 1 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_CAN2LPEN (1 << 26) /* Bit 26: CAN 2 clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_PWRLPEN (1 << 28) /* Bit 28: Power interface clock enable during Sleep mode */
|
||||
#define RCC_APB1LPENR_DACLPEN (1 << 29) /* Bit 29: DAC interface clock enable during Sleep mode */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB1LPENR_UART7LPEN (1 << 30) /* Bit 30: UART7 clock enable during Sleep mode */
|
||||
# define RCC_APB1LPENR_UART8LPEN (1 << 31) /* Bit 31: UART8 clock enable during Sleep mode */
|
||||
# define RCC_APB1LPENR_UART7LPEN (1 << 30) /* Bit 30: UART7 clock enable during Sleep mode */
|
||||
# define RCC_APB1LPENR_UART8LPEN (1 << 31) /* Bit 31: UART8 clock enable during Sleep mode */
|
||||
#endif
|
||||
|
||||
/* RCC APB2 low power modeperipheral clock enable register */
|
||||
|
||||
#define RCC_APB2LPENR_TIM1LPEN (1 << 0) /* Bit 0: TIM1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM8LPEN (1 << 1) /* Bit 1: TIM8 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_USART1LPEN (1 << 4) /* Bit 4: USART1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_USART6LPEN (1 << 5) /* Bit 5: USART6 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_ADC1LPEN (1 << 8) /* Bit 8: ADC1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_ADC2LPEN (1 << 9) /* Bit 9: ADC2 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_ADC3LPEN (1 << 10) /* Bit 10: ADC3 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_SDIOLPEN (1 << 11) /* Bit 11: SDIO clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_SPI1LPEN (1 << 12) /* Bit 12: SPI1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM1LPEN (1 << 0) /* Bit 0: TIM1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM8LPEN (1 << 1) /* Bit 1: TIM8 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_USART1LPEN (1 << 4) /* Bit 4: USART1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_USART6LPEN (1 << 5) /* Bit 5: USART6 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_ADC1LPEN (1 << 8) /* Bit 8: ADC1 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_ADC2LPEN (1 << 9) /* Bit 9: ADC2 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_ADC3LPEN (1 << 10) /* Bit 10: ADC3 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_SDIOLPEN (1 << 11) /* Bit 11: SDIO clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_SPI1LPEN (1 << 12) /* Bit 12: SPI1 clock enable during Sleep mode */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2LPENR_SPI4LPEN (1 << 13) /* Bit 13: SPI4 clock enable during Sleep mode */
|
||||
# define RCC_APB2LPENR_SPI4LPEN (1 << 13) /* Bit 13: SPI4 clock enable during Sleep mode */
|
||||
#endif
|
||||
#define RCC_APB2LPENR_SYSCFGLPEN (1 << 14) /* Bit 14: System configuration controller clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM9LPEN (1 << 16) /* Bit 16: TIM9 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM10LPEN (1 << 17) /* Bit 17: TIM10 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM11LPEN (1 << 18) /* Bit 18: TIM11 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_SYSCFGLPEN (1 << 14) /* Bit 14: System configuration controller clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM9LPEN (1 << 16) /* Bit 16: TIM9 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM10LPEN (1 << 17) /* Bit 17: TIM10 clock enable during Sleep mode */
|
||||
#define RCC_APB2LPENR_TIM11LPEN (1 << 18) /* Bit 18: TIM11 clock enable during Sleep mode */
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2LPENR_SPI5LPEN (1 << 20) /* Bit 20: SPI5 clock enable during Sleep mode */
|
||||
# define RCC_APB2LPENR_SPI6LPEN (1 << 21) /* Bit 21: SPI6 clock enable during Sleep mode */
|
||||
# define RCC_APB2LPENR_SPI5LPEN (1 << 20) /* Bit 20: SPI5 clock enable during Sleep mode */
|
||||
# define RCC_APB2LPENR_SPI6LPEN (1 << 21) /* Bit 21: SPI6 clock enable during Sleep mode */
|
||||
# define RCC_APB2LPENR_SAI1LPEN (1 << 22) /* Bit 22: SAI1 clock enable during Sleep mode */
|
||||
#endif
|
||||
#if defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_APB2LPENR_LTDCLPEN (1 << 26) /* Bit 26: LTDC clock enable during Sleep mode */
|
||||
#endif
|
||||
|
||||
/* Backup domain control register */
|
||||
|
||||
#define RCC_BDCR_LSEON (1 << 0) /* Bit 0: External Low Speed oscillator enable */
|
||||
#define RCC_BDCR_LSERDY (1 << 1) /* Bit 1: External Low Speed oscillator Ready */
|
||||
#define RCC_BDCR_LSEBYP (1 << 2) /* Bit 2: External Low Speed oscillator Bypass */
|
||||
#define RCC_BDCR_RTCSEL_SHIFT (8) /* Bits 9:8: RTC clock source selection */
|
||||
#define RCC_BDCR_RTCSEL_MASK (3 << RCC_BDCR_RTCSEL_SHIFT)
|
||||
# define RCC_BDCR_RTCSEL_NOCLK (0 << RCC_BDCR_RTCSEL_SHIFT) /* 00: No clock */
|
||||
# define RCC_BDCR_RTCSEL_LSE (1 << RCC_BDCR_RTCSEL_SHIFT) /* 01: LSE oscillator clock used as RTC clock */
|
||||
# define RCC_BDCR_RTCSEL_LSI (2 << RCC_BDCR_RTCSEL_SHIFT) /* 10: LSI oscillator clock used as RTC clock */
|
||||
# define RCC_BDCR_RTCSEL_HSE (3 << RCC_BDCR_RTCSEL_SHIFT) /* 11: HSE oscillator clock divided by 128 used as RTC clock */
|
||||
#define RCC_BDCR_RTCEN (1 << 15) /* Bit 15: RTC clock enable */
|
||||
#define RCC_BDCR_BDRST (1 << 16) /* Bit 16: Backup domain software reset */
|
||||
#define RCC_BDCR_LSEON (1 << 0) /* Bit 0: External Low Speed oscillator enable */
|
||||
#define RCC_BDCR_LSERDY (1 << 1) /* Bit 1: External Low Speed oscillator Ready */
|
||||
#define RCC_BDCR_LSEBYP (1 << 2) /* Bit 2: External Low Speed oscillator Bypass */
|
||||
#define RCC_BDCR_RTCSEL_SHIFT (8) /* Bits 9:8: RTC clock source selection */
|
||||
#define RCC_BDCR_RTCSEL_MASK (3 << RCC_BDCR_RTCSEL_SHIFT)
|
||||
# define RCC_BDCR_RTCSEL_NOCLK (0 << RCC_BDCR_RTCSEL_SHIFT) /* 00: No clock */
|
||||
# define RCC_BDCR_RTCSEL_LSE (1 << RCC_BDCR_RTCSEL_SHIFT) /* 01: LSE oscillator clock used as RTC clock */
|
||||
# define RCC_BDCR_RTCSEL_LSI (2 << RCC_BDCR_RTCSEL_SHIFT) /* 10: LSI oscillator clock used as RTC clock */
|
||||
# define RCC_BDCR_RTCSEL_HSE (3 << RCC_BDCR_RTCSEL_SHIFT) /* 11: HSE oscillator clock divided by 128 used as RTC clock */
|
||||
#define RCC_BDCR_RTCEN (1 << 15) /* Bit 15: RTC clock enable */
|
||||
#define RCC_BDCR_BDRST (1 << 16) /* Bit 16: Backup domain software reset */
|
||||
|
||||
/* Control/status register */
|
||||
|
||||
@ -531,7 +555,7 @@
|
||||
#define RCC_SSCGR_MODPER_SHIFT (0) /* Bit 0-12: Modulation period */
|
||||
#define RCC_SSCGR_MODPER_MASK (0x1fff << RCC_SSCGR_MODPER_SHIFT)
|
||||
# define RCC_SSCGR_MODPER(n) ((n) << RCC_SSCGR_MODPER_SHIFT)
|
||||
#define RCC_SSCGR_INCSTEP_SHIFT (13) /* Bit 13-27: Incrementation step */
|
||||
#define RCC_SSCGR_INCSTEP_SHIFT (13) /* Bit 13-27: Incrementation step */
|
||||
#define RCC_SSCGR_INCSTEP_MASK (0x7fff << RCC_SSCGR_INCSTEP_SHIFT)
|
||||
# define RCC_SSCGR_INCSTEP(n) ((n) << RCC_SSCGR_INCSTEP_SHIFT)
|
||||
#define RCC_SSCGR_SPREADSEL (1 << 30) /* Bit 30: Spread Select */
|
||||
@ -541,14 +565,50 @@
|
||||
|
||||
#define RCC_PLLI2SCFGR_PLLI2SN_SHIFT (6) /* Bits 6-14: PLLI2S multiplication factor for VCO */
|
||||
#define RCC_PLLI2SCFGR_PLLI2SN_MASK (0x1ff << RCC_PLLI2SCFGR_PLLI2SN_SHIFT)
|
||||
#define RCC_PLLI2SCFGR_PLLI2SR_SHIFT (28) /* Bits 28-30: PLLI2S division factor for I2S clocks */
|
||||
#define RCC_PLLI2SCFGR_PLLI2SR_SHIFT (28) /* Bits 28-30: PLLI2S division factor for I2S clocks */
|
||||
#define RCC_PLLI2SCFGR_PLLI2SR_MASK (7 << RCC_PLLI2SCFGR_PLLI2SR_SHIFT)
|
||||
|
||||
/* PLLSAI configuration register */
|
||||
|
||||
#define RCC_PLLSAICFG_PLLSAIN_SHIFT (6) /* Bits 6-14: PLLSAI divider (N) for VCO */
|
||||
#define RCC_PLLSAICFG_PLLSAIN_MASK (0x1ff << RCC_PLLSAICFG_PLLSAIN_SHIFT)
|
||||
# define RCC_PLLSAICFG_PLLSAIN(n) ((n) << RCC_PLLSAICFG_PLLSAIN_SHIFT)
|
||||
#define RCC_PLLSAICFGR_PLLSAIQ_SHIFT (24) /* Bits 24-27: PLLSAI division factor for SAI clock */
|
||||
#define RCC_PLLSAICFGR_PLLSAIQ_MASK (0x0F << RCC_PLLSAICFGR_PLLSAIQ_SHIFT)
|
||||
# define RCC_PLLSAICFG_PLLSAIQ(n) ((n) << RCC_PLLSAICFG_PLLSAIQ_SHIFT)
|
||||
#define RCC_PLLSAICFGR_PLLSAIR_SHIFT (28) /* Bits 28-30: PLLSAI division factor for LCD clock */
|
||||
#define RCC_PLLSAICFGR_PLLSAIR_MASK (7 << RCC_PLLSAICFGR_PLLSAIR_SHIFT)
|
||||
# define RCC_PLLSAICFG_PLLSAIR(n) ((n) << RCC_PLLSAICFG_PLLSAIR_SHIFT)
|
||||
|
||||
/* Dedicated clocks configuration register */
|
||||
|
||||
#if defined(CONFIG_STM32_STM32F427) || defined(CONFIG_STM32_STM32F429)
|
||||
# define RCC_DCKCFGR_TIMPRE (1 << 24) /* Bit 24: Timer clock prescaler selection */
|
||||
# define RCC_DCKCFGR_PLLI2SDIVQ_SHIFT (0) /* Bits 0-4: PLLI2S division factor for I2S clock */
|
||||
# define RCC_DCKCFGR_PLLI2SDIVQ_MASK (0x1F << RCC_DCKCFGR_PLLI2SDIVQ_SHIFT)
|
||||
# define RCC_DCKCFGR_PLLI2SDIVQ(n) ((n) << RCC_DCKCFGR_PLLI2SDIVQ_SHIFT)
|
||||
# define RCC_DCKCFGR_PLLSAIDIVQ_SHIFT (8) /* Bits 8-12: PLLSAI division factor for SAI clock */
|
||||
# define RCC_DCKCFGR_PLLSAIDIVQ_MASK (0x1F << RCC_DCKCFGR_PLLSAIDIVQ_SHIFT)
|
||||
# define RCC_DCKCFGR_PLLSAIDIVQ(n) ((n) << RCC_DCKCFGR_PLLSAIDIVQ_SHIFT)
|
||||
# define RCC_DCKCFGR_PLLSAIDIVR_SHIFT (16) /* Bits 16-17: PLLSAI division factor for LCD_CLK clock */
|
||||
# define RCC_DCKCFGR_PLLSAIDIVR_MASK (0x3 << RCC_DCKCFGR_PLLSAIDIVR_SHIFT)
|
||||
# define RCC_DCKCFGR_PLLSAIDIVR(n) ((n) << RCC_DCKCFGR_PLLSAIDIVR_SHIFT)
|
||||
# define RCC_DCKCFGR_SAI1ASRC_SHIFT (20) /* Bits 20-21: SAI1-A clock source selection */
|
||||
# define RCC_DCKCFGR_SAI1ASRC_MASK (0x3 << RCC_DCKCFGR_SAI1ASRC_SHIFT)
|
||||
# define RCC_DCKCFGR_SAI1ASRC(n) ((n) << RCC_DCKCFGR_SAI1ASRC_SHIFT)
|
||||
# define RCC_DCKCFGR_SAI1BSRC_SHIFT (22) /* Bits 22-23: SAI1-B clock source selection */
|
||||
# define RCC_DCKCFGR_SAI1BSRC_MASK (0x3 << RCC_DCKCFGR_SAI1BSRC_SHIFT)
|
||||
# define RCC_DCKCFGR_SAI1BSRC(n) ((n) << RCC_DCKCFGR_SAI1BSRC_SHIFT)
|
||||
# define RCC_DCKCFGR_TIMPRE (1 << 24) /* Bit 24: Timer clock prescaler selection */
|
||||
#endif
|
||||
|
||||
#define RCC_SAICLKSRC_PLLSAI 0
|
||||
#define RCC_SAICLKSRC_PLLI2S 1
|
||||
#define RCC_SAICLKSRC_ALTERNATE 2
|
||||
|
||||
#define RCC_PLLSAIDIVR_DIV2 0
|
||||
#define RCC_PLLSAIDIVR_DIV4 1
|
||||
#define RCC_PLLSAIDIVR_DIV8 2
|
||||
#define RCC_PLLSAIDIVR_DIV16 3
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32F40XXX_RCC_H */
|
||||
|
||||
|
@ -81,6 +81,7 @@
|
||||
#include "stm32_fsmc.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_i2c.h"
|
||||
#include "stm32_ltdc.h"
|
||||
#include "stm32_pwr.h"
|
||||
#include "stm32_rcc.h"
|
||||
#include "stm32_rtc.h"
|
||||
|
@ -358,6 +358,8 @@
|
||||
# define GPIO_PORTG (6 << GPIO_PORT_SHIFT) /* GPIOG */
|
||||
# define GPIO_PORTH (7 << GPIO_PORT_SHIFT) /* GPIOH */
|
||||
# define GPIO_PORTI (8 << GPIO_PORT_SHIFT) /* GPIOI */
|
||||
# define GPIO_PORTJ (9 << GPIO_PORT_SHIFT) /* GPIOJ */
|
||||
# define GPIO_PORTK (10 << GPIO_PORT_SHIFT) /* GPIOK */
|
||||
|
||||
/* This identifies the bit in the port:
|
||||
*
|
||||
|
872
arch/arm/src/stm32/stm32_ltdc.c
Normal file
872
arch/arm/src/stm32/stm32_ltdc.c
Normal file
@ -0,0 +1,872 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/stm32/stm32_ltdc.c
|
||||
*
|
||||
* Copyright (C) 2013 Ken Pettit. All rights reserved.
|
||||
* Author: Ken Pettit <pettitd@gmail.com>
|
||||
*
|
||||
* References:
|
||||
* STM32F429 Technical Reference Manual and Data Sheet
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/fb.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "stm32.h"
|
||||
#include "stm32_ltdc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_STM32_LTDC_DEFBACKLIGHT
|
||||
# define CONFIG_STM32_LTDC_DEFBACKLIGHT 0xf0
|
||||
#endif
|
||||
#define STM32_LTDC_BACKLIGHT_OFF 0x00
|
||||
|
||||
/* Color/video formats */
|
||||
|
||||
/* Layer 1 format */
|
||||
|
||||
#if defined(CONFIG_STM32_LTDC_L1_L8)
|
||||
# define STM32_LTDC_L1_BPP 8
|
||||
# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB8
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_AL44)
|
||||
# define STM32_LTDC_L1_BPP 8
|
||||
# define STM32_LTDC_L1_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_AL88)
|
||||
# define STM32_LTDC_L1_BPP 16
|
||||
# define STM32_LTDC_L1_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_ARGB4444)
|
||||
# define STM32_LTDC_L1_BPP 16
|
||||
# define STM32_LTDC_L1_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_RGB565)
|
||||
# define STM32_LTDC_L1_BPP 16
|
||||
# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB16_565
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_ARGB1555)
|
||||
# define STM32_LTDC_L1_BPP 16
|
||||
# define STM32_LTDC_L1_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_RGB888)
|
||||
# define STM32_LTDC_L1_BPP 24
|
||||
# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB24
|
||||
#elif defined(CONFIG_STM32_LTDC_L1_ARGB8888)
|
||||
# define STM32_LTDC_L1_BPP 32
|
||||
# define STM32_LTDC_L1_COLOR_FMT ???
|
||||
#endif
|
||||
|
||||
/* Layer 2 format */
|
||||
|
||||
#if defined(CONFIG_STM32_LTDC_L2_L8)
|
||||
# define STM32_LTDC_L2_BPP 8
|
||||
# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB8
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_AL44)
|
||||
# define STM32_LTDC_L2_BPP 8
|
||||
# define STM32_LTDC_L2_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_AL88)
|
||||
# define STM32_LTDC_L2_BPP 16
|
||||
# define STM32_LTDC_L2_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_ARGB4444)
|
||||
# define STM32_LTDC_L2_BPP 16
|
||||
# define STM32_LTDC_L2_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_RGB565)
|
||||
# define STM32_LTDC_L2_BPP 16
|
||||
# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB16_565
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_ARGB1555)
|
||||
# define STM32_LTDC_L2_BPP 16
|
||||
# define STM32_LTDC_L2_COLOR_FMT ???
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_RGB888)
|
||||
# define STM32_LTDC_L2_BPP 24
|
||||
# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB24
|
||||
#elif defined(CONFIG_STM32_LTDC_L2_ARGB8888)
|
||||
# define STM32_LTDC_L2_BPP 32
|
||||
# define STM32_LTDC_L2_COLOR_FMT ???
|
||||
#endif
|
||||
|
||||
/* Framebuffer sizes in bytes */
|
||||
|
||||
#ifndef BOARD_LTDC_WIDTH
|
||||
# error BOARD_LTDC_WIDTH must be defined in the board.h header file
|
||||
#endif
|
||||
|
||||
#ifndef BOARD_LTDC_HEIGHT
|
||||
# error BOARD_LTDC_HEIGHT must be defined in the board.h header file
|
||||
#endif
|
||||
|
||||
#if STM32_LTDC_L1_BPP == 8
|
||||
# define STM32_L1_STRIDE (BOARD_LTDC_WIDTH)
|
||||
#elif STM32_LTDC_L1_BPP == 16
|
||||
# define STM32_L1_STRIDE ((BOARD_LTDC_WIDTH * 16 + 7) / 8)
|
||||
#elif STM32_LTDC_L1_BPP == 24
|
||||
# define STM32_L1_STRIDE ((BOARD_LTDC_WIDTH * 24 + 7) / 8)
|
||||
#elif STM32_LTDC_L1_BPP == 32
|
||||
# define STM32_L1_STRIDE ((BOARD_LTDC_WIDTH * 32 + 7) / 8)
|
||||
#else
|
||||
# error Undefined or unrecognized base resolution
|
||||
#endif
|
||||
|
||||
#define STM32_L1_FBSIZE (STM32_L1_STRIDE * BOARD_LTDC_HEIGHT)
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC_L2
|
||||
# ifndef CONFIG_STM32_LTDC_L2_WIDTH
|
||||
# define CONFIG_STM32_LTDC_L2_WIDTH BOARD_LTDC_WIDTH
|
||||
# endif
|
||||
|
||||
# if CONFIG_STM32_LTDC_L2_WIDTH > BOARD_LTDC_WIDTH
|
||||
# error Width of Layer 2 exceeds the width of the display
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_STM32_LTDC_L2_HEIGHT
|
||||
# define CONFIG_STM32_LTDC_L2_HEIGHT BOARD_LTDC_HEIGHT
|
||||
# endif
|
||||
|
||||
# if CONFIG_STM32_LTDC_L2_HEIGHT > BOARD_LTDC_HEIGHT
|
||||
# error Height of Layer 2 exceeds the height of the display
|
||||
# endif
|
||||
|
||||
# if STM32_LTDC_L2_BPP == 8
|
||||
# define STM32_L2_STRIDE (CONFIG_STM32_LTDC_L2_WIDTH)
|
||||
# elif STM32_LTDC_L2_BPP == 16
|
||||
# define STM32_L2_STRIDE ((CONFIG_STM32_LTDC_L2_WIDTH * 16 + 7) / 8)
|
||||
# elif STM32_LTDC_L2_BPP == 24
|
||||
# define STM32_L2_STRIDE ((CONFIG_STM32_LTDC_L2_WIDTH * 24 + 7) / 8)
|
||||
# elif STM32_LTDC_L2_BPP == 32
|
||||
# define STM32_L2_STRIDE ((CONFIG_STM32_LTDC_L2_WIDTH * 32 + 7) / 8)
|
||||
# else
|
||||
# error Undefined or unrecognized base resolution
|
||||
# endif
|
||||
|
||||
# define STM32_L2_FBSIZE (STM32_L2_STRIDE * CONFIG_STM32_LTDC_L2_HEIGHT)
|
||||
|
||||
#else
|
||||
# define STM32_L2_FBSIZE (0)
|
||||
#endif
|
||||
|
||||
/* Total memory used for framebuffers */
|
||||
|
||||
#define STM32_TOTAL_FBSIZE (STM32_L1_FBSIZE + STM32_L2_FBSIZE)
|
||||
|
||||
/* Debug */
|
||||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_STM32_LTDC_REGDEBUG
|
||||
#endif
|
||||
|
||||
/* Preallocated LTDC framebuffers */
|
||||
/* Maybe we need some meta-data for each layer? */
|
||||
|
||||
#define SIZEOF_STM32_LAYER_META_S 32
|
||||
#define STM32_LTDC_LAYER_META_SIZE (2*SIZEOF_STM32_LAYER_META_S)
|
||||
#define STM32_LTDC_LAYER_META_END (CONFIG_STM32_LTDC_FB_BASE+STM32_LTDC_LAYER_META_SIZE)
|
||||
|
||||
/* Position the framebuffer memory in the center of the memory set aside. We
|
||||
* will use any skirts before or after the framebuffer memory as a guard against
|
||||
* wild framebuffer writes.
|
||||
*/
|
||||
|
||||
#define STM32_LTDC_BUFFER_SIZE (CONFIG_STM32_LTDC_FB_SIZE-STM32_LTDC_LAYER_META_SIZE)
|
||||
#define STM32_LTDC_BUFFER_FREE (STM32_LTDC_BUFFER_SIZE-STM32_TOTAL_FBSIZE)
|
||||
#define STM32_LTDC_BUFFER_START (STM32_LTDC_LAYER_META_END + STM32_LTDC_BUFFER_FREE/2)
|
||||
|
||||
#if STM32_LTDC_BUFFER_FREE < 0
|
||||
# error "STM32_LTDC_BUFFER_SIZE not large enough for frame buffers"
|
||||
#endif
|
||||
|
||||
/* Layer frame buffer */
|
||||
|
||||
#define STM32_LTDC_BUFFER_L1 STM32_LTDC_BUFFER_START
|
||||
#define STM32_LTDC_ENDBUF_L1 (STM32_LTDC_BUFFER_L1 + STM32_L1_FBSIZE)
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC_L2
|
||||
# define STM32_LTDC_BUFFER_L2 STM32_LTDC_ENDBUF_L1
|
||||
# define STM32_LTDC_ENDBUF_L2 (STM32_LTDC_BUFFER_L2 + STM32_L2_FBSIZE)
|
||||
#else
|
||||
# define STM32_LTDC_ENDBUF_L2 STM32_LTDC_ENDBUF_L1
|
||||
#endif
|
||||
|
||||
/* Layer helpers */
|
||||
|
||||
#define LTDC_NLAYERS 2
|
||||
|
||||
#define LAYER(i) g_ltdc.layer[i]
|
||||
#define LAYER_L1 g_ltdc.layer[LTDC_LAYER_L1]
|
||||
#define LAYER_L2 g_ltdc.layer[LTDC_LAYER_L2]
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
/* This enumeration names each layer supported by the hardware */
|
||||
|
||||
enum stm32_layer_e
|
||||
{
|
||||
LTDC_LAYER_L1 = 0, /* LCD Layer 1*/
|
||||
LTDC_LAYER_L2, /* LCD Layer 2 */
|
||||
};
|
||||
|
||||
/* LTDC General Layer information */
|
||||
|
||||
struct stm32_layer_s
|
||||
{
|
||||
/* Descriptors and buffering */
|
||||
|
||||
uint8_t *framebuffer; /* DMA framebuffer memory */
|
||||
uint8_t lid; /* Layer ID (see enum stm32_layer_e) */
|
||||
|
||||
/* Window position information */
|
||||
|
||||
uint16_t xpos; /* Window x position */
|
||||
uint16_t width; /* Window width */
|
||||
uint16_t ypos; /* Window y position */
|
||||
uint16_t height; /* Window width */
|
||||
|
||||
/* Color information */
|
||||
|
||||
uint8_t bpp; /* Bits per pixel */
|
||||
};
|
||||
|
||||
/* This structure provides the overall state of the LTDC */
|
||||
|
||||
struct stm32_ltdc_s
|
||||
{
|
||||
/* Layer information */
|
||||
|
||||
struct stm32_layer_s layer[LTDC_NLAYERS];
|
||||
|
||||
/* Debug stuff */
|
||||
|
||||
#ifdef CONFIG_STM32_LtDC_REGDEBUG
|
||||
bool wrlast; /* True: Last access was a write */
|
||||
uintptr_t addrlast; /* Last address accessed */
|
||||
uint32_t vallast; /* Last value read or written */
|
||||
int ntimes; /* Number of consecutive accesses */
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
/* Register operations ******************************************************/
|
||||
|
||||
#if defined(CONFIG_STM32_LTDC_REGDEBUG) && defined(CONFIG_DEBUG)
|
||||
static bool stm32_checkreg(bool wr, uint32_t regval, uintptr_t address);
|
||||
static uint32_t stm32_getreg(uintptr_t addr);
|
||||
static void stm32_putreg(uintptr_t addr, uint32_t val);
|
||||
#else
|
||||
# define stm32_getreg(addr) getreg32(addr)
|
||||
# define stm32_putreg(addr,val) putreg32(val,addr)
|
||||
#endif
|
||||
static void stm32_wait_lcdstatus(uint32_t mask, uint32_t value);
|
||||
|
||||
/* Frame buffer interface ***************************************************/
|
||||
/* Get information about the video controller configuration and the
|
||||
* configuration of each color plane.
|
||||
*/
|
||||
|
||||
static int stm32_getvideoinfo(struct fb_vtable_s *vtable,
|
||||
struct fb_videoinfo_s *vinfo);
|
||||
static int stm32_getplaneinfo(struct fb_vtable_s *vtable,
|
||||
int planeno, struct fb_planeinfo_s *pinfo);
|
||||
|
||||
/* The following is provided only if the video hardware supports RGB color
|
||||
* mapping
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static int stm32_getcmap(struct fb_vtable_s *vtable,
|
||||
struct fb_cmap_s *cmap);
|
||||
static int stm32_putcmap(struct fb_vtable_s *vtable,
|
||||
const struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
/* Initialization ***********************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static int stm32_setclut(struct stm32_layer_s *layer,
|
||||
const struct fb_cmap_s *cmap);
|
||||
static int stm32_getclut(struct stm32_layer_s *layer,
|
||||
struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
static void stm32_backlight(uint32_t level);
|
||||
static void stm32_l1_disable(void);
|
||||
static void stm32_l2_disable(void);
|
||||
static void stm32_lcd_disable(void);
|
||||
static void stm32_layer_color(void);
|
||||
static void stm32_lcd_enable(void);
|
||||
static void stm32_layer_configure(void);
|
||||
static void stm32_show_layer(struct stm32_layer_s *layer,
|
||||
uint32_t dispx, uint32_t dispy, uint32_t dispw, uint32_t disph);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This structure describes the video controller */
|
||||
|
||||
static const struct fb_videoinfo_s g_videoinfo =
|
||||
{
|
||||
.fmt = STM32_LTDC_L1_COLOR_FMT,
|
||||
.xres = BOARD_LTDC_WIDTH,
|
||||
.yres = BOARD_LTDC_HEIGHT,
|
||||
.nplanes = 1,
|
||||
};
|
||||
|
||||
/* This structure provides the overall state of the LTDC */
|
||||
|
||||
static struct stm32_ltdc_s g_ltdc;
|
||||
|
||||
/* This structure provides the base layer interface */
|
||||
|
||||
static const struct fb_vtable_s g_vtable =
|
||||
{
|
||||
.getvideoinfo = stm32_getvideoinfo,
|
||||
.getplaneinfo = stm32_getplaneinfo,
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
.getcmap = stm32_getcmap,
|
||||
.putcmap = stm32_putcmap,
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_checkreg
|
||||
*
|
||||
* Description:
|
||||
* Check if the current register access is a duplicate of the preceding.
|
||||
*
|
||||
* Input Parameters:
|
||||
* regval - The value to be written
|
||||
* address - The address of the register to write to
|
||||
*
|
||||
* Returned Value:
|
||||
* true: This is the first register access of this type.
|
||||
* flase: This is the same as the preceding register access.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC_REGDEBUG
|
||||
static bool stm32_checkreg(bool wr, uint32_t regval, uintptr_t address)
|
||||
{
|
||||
if (wr == g_lcdc.wrlast && /* Same kind of access? */
|
||||
regval == g_lcdc.vallast && /* Same value? */
|
||||
address == g_lcdc.addrlast) /* Same address? */
|
||||
{
|
||||
/* Yes, then just keep a count of the number of times we did this. */
|
||||
|
||||
g_lcdc.ntimes++;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Did we do the previous operation more than once? */
|
||||
|
||||
if (g_lcdc.ntimes > 0)
|
||||
{
|
||||
/* Yes... show how many times we did it */
|
||||
|
||||
lldbg("...[Repeats %d times]...\n", g_lcdc.ntimes);
|
||||
}
|
||||
|
||||
/* Save information about the new access */
|
||||
|
||||
g_lcdc.wrlast = wr;
|
||||
g_lcdc.vallast = regval;
|
||||
g_lcdc.addrlast = address;
|
||||
g_lcdc.ntimes = 0;
|
||||
}
|
||||
|
||||
/* Return true if this is the first time that we have done this operation */
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_getreg
|
||||
*
|
||||
* Description:
|
||||
* Read any 32-bit register using an absolute
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC_REGDEBUG
|
||||
static uint32_t stm32_getreg(uintptr_t address)
|
||||
{
|
||||
uint32_t regval = getreg32(address);
|
||||
|
||||
if (stm_checkreg(false, regval, address))
|
||||
{
|
||||
lldbg("%08x->%08x\n", address, regval);
|
||||
}
|
||||
|
||||
return regval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_putreg
|
||||
*
|
||||
* Description:
|
||||
* Write to any 32-bit register using an absolute address
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC_REGDEBUG
|
||||
static void stm32_putreg(uintptr_t address, uint32_t regval)
|
||||
{
|
||||
if (stm_checkreg(true, regval, address))
|
||||
{
|
||||
lldbg("%08x<-%08x\n", address, regval);
|
||||
}
|
||||
|
||||
putreg32(regval, address);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_wait_lcdstatus
|
||||
*
|
||||
* Description:
|
||||
* Wait for the masked set of bits in the LTDC status register to take a
|
||||
* specific value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_wait_lcdstatus(uint32_t mask, uint32_t value)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_getvideoinfo
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_getvideoinfo(struct fb_vtable_s *vtable,
|
||||
struct fb_videoinfo_s *vinfo)
|
||||
{
|
||||
gvdbg("vtable=%p vinfo=%p\n", vtable, vinfo);
|
||||
if (vtable && vinfo)
|
||||
{
|
||||
memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s));
|
||||
return OK;
|
||||
}
|
||||
|
||||
gdbg("ERROR: Returning EINVAL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_getplaneinfo
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_getplaneinfo(struct fb_vtable_s *vtable, int planeno,
|
||||
struct fb_planeinfo_s *pinfo)
|
||||
{
|
||||
gvdbg("vtable=%p planeno=%d pinfo=%p\n", vtable, planeno, pinfo);
|
||||
if (vtable && planeno == 0 && pinfo)
|
||||
{
|
||||
pinfo->fbmem = (void *)LAYER_L1.framebuffer;
|
||||
pinfo->fblen = STM32_L1_FBSIZE;
|
||||
pinfo->stride = STM32_L1_STRIDE,
|
||||
pinfo->bpp = LAYER_L1.bpp;
|
||||
return OK;
|
||||
}
|
||||
|
||||
gdbg("Returning EINVAL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_base_getcmap
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static int stm32_getcmap(struct fb_vtable_s *vtable,
|
||||
struct fb_cmap_s *cmap)
|
||||
{
|
||||
return stm_getclut(&LAYER_L1, cmap);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm_base_putcmap
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static int stm32_putcmap(struct fb_vtable_s *vtable,
|
||||
const struct fb_cmap_s *cmap)
|
||||
{
|
||||
return stm32_setclut(&LAYER_L1, cmap);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_setposition
|
||||
*
|
||||
* Description:
|
||||
* Set the new position of a move-able layer (any layer except the base
|
||||
* layer).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_setposition(int lid, uint32_t x, uint32_t y)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_setclut
|
||||
*
|
||||
* Description:
|
||||
* Set a range of CLUT values for any layer
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static int stm32_setclut(struct stm32_layer_s *layer,
|
||||
const struct fb_cmap_s *cmap)
|
||||
{
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_getclut
|
||||
*
|
||||
* Description:
|
||||
* Get a range of CLUT values for any layer
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static int stm32_getclut(struct stm_layer_s *layer,
|
||||
struct fb_cmap_s *cmap)
|
||||
{
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_backlight
|
||||
*
|
||||
* Description:
|
||||
* Set the backlight level
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_backlight(uint32_t level)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_l1_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable Layer 1
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_l1_disable(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_l2_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable Layer 2
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_l2_disable(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_lcd_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable the LCD peripheral
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_lcd_disable(void)
|
||||
{
|
||||
/* Disable layers */
|
||||
|
||||
stm32_l1_disable();
|
||||
stm32_l2_disable();
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_layer_position
|
||||
*
|
||||
* Description:
|
||||
* Configure LTDC layer position
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_layer_position(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_layer_color
|
||||
*
|
||||
* Description:
|
||||
* Configure LTDC layer color mode
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_layer_color(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_lcd_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable the LCD for normal use
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_lcd_enable(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_layer_configure
|
||||
*
|
||||
* Description:
|
||||
* Configure layer layer structures and framebuffers
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_layer_configure(void)
|
||||
{
|
||||
/* Common layer initialization */
|
||||
|
||||
memset(&LAYER_L1, 0, sizeof(struct stm32_layer_s));
|
||||
LAYER_L1.lid = LTDC_LAYER_L1;
|
||||
LAYER_L1.framebuffer = (uint8_t *)STM32_LTDC_BUFFER_L1;
|
||||
|
||||
memset(&LAYER_L2, 0, sizeof(struct stm32_layer_s));
|
||||
LAYER_L2.lid = LTDC_LAYER_L2;
|
||||
#ifdef CONFIG_STM32_LTDC_L2
|
||||
LAYER_L2.framebuffer = (uint8_t *)STM32_LTDC_BUFFER_L2;
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_ltdc_periphconfig
|
||||
*
|
||||
* Description:
|
||||
* Configures the LTDC peripheral clock and SAI PLL clocks to drive the
|
||||
* LCD.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_config_lcd_clock(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
/* Configure the SAI PLL to provide the LCD_CLK */
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_show_layer
|
||||
*
|
||||
* Description:
|
||||
* Show the given layer with the specified window
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_show_layer(struct stm32_layer_s *layer,
|
||||
uint32_t dispx, uint32_t dispy,
|
||||
uint32_t dispw, uint32_t disph)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_show_l1
|
||||
*
|
||||
* Description:
|
||||
* Show Layer 1 (the "base" layer)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_show_l1(void)
|
||||
{
|
||||
stm32_show_layer(&LAYER_L1, 0, 0, BOARD_LTDC_WIDTH, BOARD_LTDC_HEIGHT);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the framebuffer video hardware
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_fbinitialize(void)
|
||||
{
|
||||
gvdbg("Entry\n");
|
||||
|
||||
/* Configure layer layer structures, DMA descriptor memory, and
|
||||
* framebuffers
|
||||
*/
|
||||
|
||||
stm32_layer_configure();
|
||||
|
||||
/* Disable the LCD */
|
||||
|
||||
stm32_lcd_disable();
|
||||
|
||||
gvdbg("Configuring the LCD controller\n");
|
||||
|
||||
/* Configure and Enable the LCD clock */
|
||||
|
||||
/* Disable LCD interrupts */
|
||||
|
||||
/* Configure layer positions */
|
||||
|
||||
stm32_layer_position();
|
||||
|
||||
/* Configure layer colors */
|
||||
|
||||
stm32_layer_color();
|
||||
|
||||
/* Clear the display memory */
|
||||
|
||||
stm32_lcdclear(CONFIG_STM32_LTDC_BACKCOLOR);
|
||||
|
||||
/* And turn the LCD on */
|
||||
|
||||
gvdbg("Enabling the display\n");
|
||||
stm32_lcd_enable();
|
||||
|
||||
/* Display layer 1 */
|
||||
|
||||
stm32_show_l1();
|
||||
|
||||
/* Enable the backlight.
|
||||
*
|
||||
* REVISIT: Backlight level could be dynamically adjustable
|
||||
*/
|
||||
|
||||
stm32_backlight(CONFIG_STM32_LTDC_DEFBACKLIGHT);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_fbgetvplane
|
||||
*
|
||||
* Description:
|
||||
* Return a a reference to the framebuffer object for the specified video
|
||||
* plane.
|
||||
*
|
||||
* Input parameters:
|
||||
* None
|
||||
*
|
||||
* Returned value:
|
||||
* Reference to the framebuffer object (NULL on failure)
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
struct fb_vtable_s *up_fbgetvplane(int vplane)
|
||||
{
|
||||
gvdbg("vplane: %d\n", vplane);
|
||||
if (vplane == 0)
|
||||
{
|
||||
return (struct fb_vtable_s *)&g_vtable;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: fb_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize the framebuffer driver. Bad things will happen if you
|
||||
* call this without first calling fb_initialize()!
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void fb_uninitialize(void)
|
||||
{
|
||||
/* Disable the LCD controller */
|
||||
|
||||
stm32_lcd_disable();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_lcdclear
|
||||
*
|
||||
* Description:
|
||||
* This is a non-standard LCD interface just for the STM32. Clearing the display
|
||||
* in the normal way by writing a sequences of runs that covers the entire display
|
||||
* can be slow. Here the display is cleared by simply setting all video memory to
|
||||
* the specified color.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_lcdclear(nxgl_mxpixel_t color)
|
||||
{
|
||||
}
|
99
arch/arm/src/stm32/stm32_ltdc.h
Normal file
99
arch/arm/src/stm32/stm32_ltdc.h
Normal file
@ -0,0 +1,99 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/stm32_ltdc.h
|
||||
*
|
||||
* Copyright (C) 2013 Ken Pettit. All rights reserved.
|
||||
* Author: Ken Pettit <pettitkd@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_STM32_STM32_LTDC_H
|
||||
#define __ARCH_ARM_SRC_STM32_STM32_LTDC_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
||||
#include "chip/stm32_ltdc.h"
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
/* The STM32 LTDC driver uses the common framebuffer interfaces declared in
|
||||
* include/nuttx/fb.h.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_lcdclear
|
||||
*
|
||||
* Description:
|
||||
* This is a non-standard LCD interface just for the STM32. Clearing the display
|
||||
* in the normal way by writing a sequences of runs that covers the entire display
|
||||
* can be slow. Here the display is cleared by simply setting all buffer memory to
|
||||
* the specified color.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_lcdclear(nxgl_mxpixel_t color);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_lcd_backlight
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_STM32_LCD_BACKLIGHT is defined, then the board-specific logic must
|
||||
* provide this interface to turn the backlight on and off.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM_LCD_BACKLIGHT
|
||||
void sam_lcd_backlight(bool blon);
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_STM32_LTDC */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_LTDC_H */
|
@ -572,6 +572,12 @@ static inline void rcc_enableapb2(void)
|
||||
regval |= RCC_APB2ENR_SPI6EN;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC
|
||||
/* LTDC clock enable */
|
||||
|
||||
regval |= RCC_APB2ENR_LTDCEN;
|
||||
#endif
|
||||
|
||||
putreg32(regval, STM32_RCC_APB2ENR); /* Enable peripherals */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user