SAMA5: LCDC driver incorporated into the build system.

This commit is contained in:
Gregory Nutt 2013-10-08 15:30:38 -06:00
parent 1807a662a8
commit f8397f8238
7 changed files with 906 additions and 274 deletions

View File

@ -5722,6 +5722,6 @@
free connections available. From Max Holtzberg (2013-10-6).
* net/net_close.c and other: Update of change of 2013-10-6 from
Max Holtzberg (2013-10-8).
* arch/arm/src/sama5/sam_lcd.c: LCDC driver is code complete but still
untested (2013-10-8).
* arch/arm/src/sama5/sam_lcd.c: LCDC driver is code complete and
incorporated into the build system (but still untested (2013-10-8).

View File

@ -15,16 +15,19 @@ config ARCH_CHIP_ATSAMA5D31
bool "Atmel ATSAMA5D31"
select ARCH_CHIP_SAMA5D3
select SAMA5_HAVE_EMAC
select SAMA5_HAVE_LCDC
config ARCH_CHIP_ATSAMA5D33
bool "Atmel ATSAMA5D33"
select ARCH_CHIP_SAMA5D3
select SAMA5_HAVE_GMAC
select SAMA5_HAVE_LCDC
config ARCH_CHIP_ATSAMA5D34
bool "Atmel ATSAMA5D34"
select ARCH_CHIP_SAMA5D3
select SAMA5_HAVE_GMAC
select SAMA5_HAVE_LCDC
config ARCH_CHIP_ATSAMA5D35
bool "Atmel ATSAMA5D35"
@ -173,6 +176,7 @@ config SAMA5_EMAC
config SAMA5_LCDC
bool "LCD Controller (LCDC)"
default n
depends on SAMA5_HAVE_LCDC
config SAMA5_ISI
bool "Image Sensor Interface (ISI)"
@ -253,6 +257,485 @@ config SAMA5_PIOE_IRQ
endif # PIO_IRQ
config SAMA5_HAVE_LCDC
bool
if SAMA5_LCDC
menu "LCDC Configuration"
config SAMA5_LCDC_BACKLIGHT
bool "Backlight support"
default y
config SAMA5_LCDC_DEFBACKLIGHT
hex "Default backlight level"
default 0xf0
config SAMA5_LCDC_BACKCOLOR
hex "Background color"
default 0x0
choice
prompt "Frame buffer allocation strategy"
default SAMA5_LCDC_FBALLOCATED
config SAMA5_LCDC_FBALLOCATED
bool "Allocate from heap"
config SAMA5_LCDC_FBFIXED
bool "Fixed allocation outside the heap"
config SAMA5_LCDC_FBPREALLOCATED
bool "Pre-allocated in .bss"
endchoice # Frame buffer allocatin strategy
if SAMA5_LCDC_FBFIXED
config SAMA5_LCDC_FBFIXED_BASE
hex "Framebuffer memory start address"
config SAMA5_LCDC_FBFIXED_SIZE
int "Framebuffer memory size"
default 0
endif # SAMA5_LCDC_FBFIXED
comment "Base layer configuration"
config SAMA5_LCDC_BASE_HEIGHT
int "Layer height (rows)"
default 480
config SAMA5_LCDC_BASE_WIDTH
int "Layer width (pixels)"
default 800
choice
prompt "Base layer rotation"
default SAMA5_LCDC_BASE_ROT0
config SAMA5_LCDC_BASE_ROT0
bool "No rotation"
config SAMA5_LCDC_BASE_ROT90
bool "90 degrees"
config SAMA5_LCDC_BASE_ROT180
bool "180 degrees"
config SAMA5_LCDC_BASE_ROT270
bool "270 degrees"
endchoice # Base layer rotation
choice
prompt "Base layer color format"
default SAMA5_LCDC_BASE_RGB888P
config SAMA5_LCDC_BASE_RGB444
bool "12 bpp RGB 444"
config SAMA5_LCDC_BASE_ARGB4444
bool "16 bpp ARGB 4444"
config SAMA5_LCDC_BASE_RGBA4444
bool "16 bpp RGBA 4444"
config SAMA5_LCDC_BASE_RGB565
bool "16 bpp RGB 565"
config SAMA5_LCDC_BASE_TRGB1555
bool "16 bpp TRGB 1555"
config SAMA5_LCDC_BASE_RGB666
bool "18 bpp RGB 666"
config SAMA5_LCDC_BASE_RGB666P
bool "18 bpp RGB 666 packed"
config SAMA5_LCDC_BASE_TRGB1666
bool "19 bpp TRGB 1666"
config SAMA5_LCDC_BASE_TRGBP
bool "19 bpp TRGB 1666 packed"
config SAMA5_LCDC_BASE_RGB888
bool "24 bpp RGB 888"
config SAMA5_LCDC_BASE_RGB888P
bool "24 bpp RGB 888 packed"
config SAMA5_LCDC_BASE_TRGB1888
bool "25 bpp TRGB 1888"
config SAMA5_LCDC_BASE_ARGB8888
bool "32 bpp ARGB 8888"
config SAMA5_LCDC_BASE_RGBA8888
bool "32 bpp RGBA 8888"
endchoice # Base layer color format
menuconfig SAMA5_LCDC_OVR1
bool "Enable overlay 1 window"
default n
depends on EXPERIMENTAL
if SAMA5_LCDC_OVR1
config SAMA5_LCDC_OVR1_MAXHEIGHT
int "Overlay 1 height (rows)"
default 480
config SAMA5_LCDC_OVR1_MAXWIDTH
int "Overlay 1 width (pixels)"
default 800
config SAMA5_LCDC_OVR1_BOTTOMUP
bool "Raster bottom-up"
default n
config SAMA5_LCDC_OVR1_RIGHTLEFT
bool "Raster right-to-left"
default n
choice
prompt "Overlay 1 rotation"
default SAMA5_LCDC_OVR1_ROT0
config SAMA5_LCDC_OVR1_ROT0
bool "No rotation"
config SAMA5_LCDC_OVR1_ROT90
bool "90 degrees"
config SAMA5_LCDC_OVR1_ROT180
bool "180 degrees"
config SAMA5_LCDC_OVR1_ROT270
bool "270 degrees"
endchoice # Overlay 1 rotation
choice
prompt "Overlay 1 color format"
default SAMA5_LCDC_OVR1_RGB888P
config SAMA5_LCDC_OVR1_RGB444
bool "12 bpp RGB 444"
config SAMA5_LCDC_OVR1_ARGB4444
bool "16 bpp ARGB 4444"
config SAMA5_LCDC_OVR1_RGBA4444
bool "16 bpp RGBA 4444"
config SAMA5_LCDC_OVR1_RGB565
bool "16 bpp RGB 565"
config SAMA5_LCDC_OVR1_TRGB1555
bool "16 bpp TRGB 1555"
config SAMA5_LCDC_OVR1_RGB666
bool "18 bpp RGB 666"
config SAMA5_LCDC_OVR1_RGB666P
bool "18 bpp RGB 666 packed"
config SAMA5_LCDC_OVR1_TRGB1666
bool "19 bpp TRGB 1666"
config SAMA5_LCDC_OVR1_TRGBP
bool "19 bpp TRGB 1666 packed"
config SAMA5_LCDC_OVR1_RGB888
bool "24 bpp RGB 888"
config SAMA5_LCDC_OVR1_RGB888P
bool "24 bpp RGB 888 packed"
config SAMA5_LCDC_OVR1_TRGB1888
bool "25 bpp TRGB 1888"
config SAMA5_LCDC_OVR1_ARGB8888
bool "32 bpp ARGB 8888"
config SAMA5_LCDC_OVR1_RGBA8888
bool "32 bpp RGBA 8888"
endchoice # Base layer color format
endif # SAMA5_LCDC_OVR1
menuconfig SAMA5_LCDC_OVR2
bool "Enable overlay 2 window"
default n
depends on EXPERIMENTAL
if SAMA5_LCDC_OVR2
config SAMA5_LCDC_OVR2_MAXHEIGHT
int "Overlay 2 height (rows)"
default 480
config SAMA5_LCDC_OVR2_MAXWIDTH
int "Overlay 2 width (pixels)"
default 800
config SAMA5_LCDC_OVR2_BOTTOMUP
bool "Raster bottom-up"
default n
config SAMA5_LCDC_OVR2_RIGHTLEFT
bool "Raster right-to-left"
default n
choice
prompt "Overlay 2 rotation"
default SAMA5_LCDC_OVR2_ROT0
config SAMA5_LCDC_OVR2_ROT0
bool "No rotation"
config SAMA5_LCDC_OVR2_ROT90
bool "90 degrees"
config SAMA5_LCDC_OVR2_ROT180
bool "180 degrees"
config SAMA5_LCDC_OVR2_ROT270
bool "270 degrees"
endchoice # Overlay 2 rotation
choice
prompt "Overlay 2 layer color format"
default SAMA5_LCDC_OVR2_RGB888P
config SAMA5_LCDC_OVR2_RGB444
bool "12 bpp RGB 444"
config SAMA5_LCDC_OVR2_ARGB4444
bool "16 bpp ARGB 4444"
config SAMA5_LCDC_OVR2_RGBA4444
bool "16 bpp RGBA 4444"
config SAMA5_LCDC_OVR2_RGB565
bool "16 bpp RGB 565"
config SAMA5_LCDC_OVR2_TRGB1555
bool "16 bpp TRGB 1555"
config SAMA5_LCDC_OVR2_RGB666
bool "18 bpp RGB 666"
config SAMA5_LCDC_OVR2_RGB666P
bool "18 bpp RGB 666 packed"
config SAMA5_LCDC_OVR2_TRGB1666
bool "19 bpp TRGB 1666"
config SAMA5_LCDC_OVR2_TRGBP
bool "19 bpp TRGB 1666 packed"
config SAMA5_LCDC_OVR2_RGB888
bool "24 bpp RGB 888"
config SAMA5_LCDC_OVR2_RGB888P
bool "24 bpp RGB 888 packed"
config SAMA5_LCDC_OVR2_TRGB1888
bool "25 bpp TRGB 1888"
config SAMA5_LCDC_OVR2_ARGB8888
bool "32 bpp ARGB 8888"
config SAMA5_LCDC_OVR2_RGBA8888
bool "32 bpp RGBA 8888"
endchoice # Base layer color format
endif # SAMA5 LCDC_OVR2
config SAMA5_LCDC_HEO
bool "High end overlay (HEO) window"
default n
depends on EXPERIMENTAL
if SAMA5_LCDC_HEO
config SAMA5_LCDC_HEO_MAXHEIGHT
int "HEO layer height (rows)"
default 480
config SAMA5_LCDC_HEO_MAXWIDTH
int "HEO layer width (pixels)"
default 800
config SAMA5_LCDC_HEO_BOTTOMUP
bool "Raster bottom-up"
default n
config SAMA5_LCDC_HEO_RIGHTLEFT
bool "Raster right-to-left"
default n
choice
prompt "HEO layer rotation"
default SAMA5_LCDC_HEO_ROT0
config SAMA5_LCDC_HEO_ROT0
bool "No rotation"
config SAMA5_LCDC_HEO_ROT90
bool "90 degrees"
config SAMA5_LCDC_HEO_ROT180
bool "180 degrees"
config SAMA5_LCDC_HEO_ROT270
bool "270 degrees"
endchoice # HEO layer rotation
choice
prompt "HEO layer color format"
default SAMA5_LCDC_HEO_RGB888P
config SAMA5_LCDC_HEO_RGB444
bool "12 bpp RGB 444"
config SAMA5_LCDC_HEO_ARGB4444
bool "16 bpp ARGB 4444"
config SAMA5_LCDC_HEO_RGBA4444
bool "16 bpp RGBA 4444"
config SAMA5_LCDC_HEO_RGB565
bool "16 bpp RGB 565"
config SAMA5_LCDC_HEO_TRGB1555
bool "16 bpp TRGB 1555"
config SAMA5_LCDC_HEO_RGB666
bool "18 bpp RGB 666"
config SAMA5_LCDC_HEO_RGB666P
bool "18 bpp RGB 666 packed"
config SAMA5_LCDC_HEO_TRGB1666
bool "19 bpp TRGB 1666"
config SAMA5_LCDC_HEO_TRGBP
bool "19 bpp TRGB 1666 packed"
config SAMA5_LCDC_HEO_RGB888
bool "24 bpp RGB 888"
config SAMA5_LCDC_HEO_RGB888P
bool "24 bpp RGB 888 packed"
config SAMA5_LCDC_HEO_TRGB1888
bool "25 bpp TRGB 1888"
config SAMA5_LCDC_HEO_ARGB8888
bool "32 bpp ARGB 8888"
config SAMA5_LCDC_HEO_RGBA8888
bool "32 bpp RGBA 8888"
endchoice # Base layer color format
endif # SAMA5_LCDC_HEO
config SAMA5_LCDC_HCR
bool "Enable hardware cursor (HCR)"
default n
depends on EXPERIMENTAL
if SAMA5_LCDC_HCR
config SAMA5_LCDC_HCR_MAXHEIGHT
int "Hardware cursor height (rows)"
default 32
config SAMA5_LCDC_HCR_MAXWIDTH
int "Hardware cursor width (pixels)"
default 32
choice
prompt "Hardware cursor rotation"
default SAMA5_LCDC_HCR_ROT0
config SAMA5_LCDC_HCR_ROT0
bool "No rotation"
config SAMA5_LCDC_HCR_ROT90
bool "90 degrees"
config SAMA5_LCDC_HCR_ROT180
bool "180 degrees"
config SAMA5_LCDC_HCR_ROT270
bool "270 degrees"
endchoice # Hardware cursor rotation
choice
prompt "Hardware cursor layer color format"
default SAMA5_LCDC_HCR_RGB888P
config SAMA5_LCDC_HCR_RGB444
bool "12 bpp RGB 444"
config SAMA5_LCDC_HCR_ARGB4444
bool "16 bpp ARGB 4444"
config SAMA5_LCDC_HCR_RGBA4444
bool "16 bpp RGBA 4444"
config SAMA5_LCDC_HCR_RGB565
bool "16 bpp RGB 565"
config SAMA5_LCDC_HCR_TRGB1555
bool "16 bpp TRGB 1555"
config SAMA5_LCDC_HCR_RGB666
bool "18 bpp RGB 666"
config SAMA5_LCDC_HCR_RGB666P
bool "18 bpp RGB 666 packed"
config SAMA5_LCDC_HCR_TRGB1666
bool "19 bpp TRGB 1666"
config SAMA5_LCDC_HCR_TRGBP
bool "19 bpp TRGB 1666 packed"
config SAMA5_LCDC_HCR_RGB888
bool "24 bpp RGB 888"
config SAMA5_LCDC_HCR_RGB888P
bool "24 bpp RGB 888 packed"
config SAMA5_LCDC_HCR_TRGB1888
bool "25 bpp TRGB 1888"
config SAMA5_LCDC_HCR_ARGB8888
bool "32 bpp ARGB 8888"
config SAMA5_LCDC_HCR_RGBA8888
bool "32 bpp RGBA 8888"
endchoice # Base layer color format
endif # SAMA5_LCDC_HCR
config SAMA5_LCDC_REGDEBUG
bool "Low level register debug"
depends on DEBUG
endmenu # LCDC configuration
endif # SAMA5_LCDC
config SAMA5_HAVE_GMAC
bool
default n

View File

@ -119,6 +119,10 @@ else
endif
endif
ifeq ($(CONFIG_SAMA5_LCDC),y)
CHIP_CSRCS += sam_lcd.c
endif
ifeq ($(CONFIG_SAMA5_UHPHS),y)
ifeq ($(CONFIG_SAMA5_OHCI),y)
CHIP_CSRCS += sam_ohci.c

View File

@ -540,7 +540,7 @@
# define LCDC_LCDCFG6_PWMPS_DIV8 (3 << LCDC_LCDCFG6_PWMPS_SHIFT) /* Fcounter = Fpwm_selected_clock/8 */
# define LCDC_LCDCFG6_PWMPS_DIV (4 << LCDC_LCDCFG6_PWMPS_SHIFT) /* Fcounter = Fpwm_selected_clock/16 */
# define LCDC_LCDCFG6_PWMPS_DIV32 (5 << LCDC_LCDCFG6_PWMPS_SHIFT) /* Fcounter = Fpwm_selected_clock/32 */
# define LCDC_LCDCFG6_PWMPS _DIV64 (6 << LCDC_LCDCFG6_PWMPS_SHIFT) /* Fcounter = Fpwm_selected_clock/64 */
# define LCDC_LCDCFG6_PWMPS_DIV64 (6 << LCDC_LCDCFG6_PWMPS_SHIFT) /* Fcounter = Fpwm_selected_clock/64 */
#define LCDC_LCDCFG6_PWMPOL (1 << 4) /* Bit 4: LCD Controller PWM Signal Polarity */
#define LCDC_LCDCFG6_PWMCVAL_SHIFT (8) /* Bits 8-15: LCD Controller PWM Compare Value */
#define LCDC_LCDCFG6_PWMCVAL_MASK (0xff << LCDC_LCDCFG6_PWMCVAL_SHIFT)
@ -686,7 +686,7 @@
#define LCDC_BASECFG4_DMA (1 << 8) /* Bit 8: Use DMA Data Path */
#define LCDC_BASECFG4_REP (1 << 9) /* Bit 9: Use Replication logic to expand RGB */
#define LCDC_BASECFG4_DISCEN (1 << 11) /* Bit 11: Discard Area Enable
#define LCDC_BASECFG4_DISCEN (1 << 11) /* Bit 11: Discard Area Enable */
/* Base Configuration register 5 */
@ -1568,7 +1568,7 @@
#define LCDC_HCRCHSR_A2Q (1 << 2) /* Bit 2: Add To Queue Pending */
/* Hardware Cursor Interrupt Enable Register, Hardware Cursor Interrupt Disable Register,
/* Hardware Cursor Interrupt Mask Register, and Hardware Cursor Interrupt Status Register
* Hardware Cursor Interrupt Mask Register, and Hardware Cursor Interrupt Status Register
*/
#define LCDC_HCRINT_DMA (1 << 2) /* Bit 2: End of DMA Transfer */

File diff suppressed because it is too large Load Diff

View File

@ -51,105 +51,6 @@
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Configuration */
/* Base address of the video RAM frame buffer */
#ifndef CONFIG_SAM_LCD_VRAMBASE
# define CONFIG_SAM_LCD_VRAMBASE ((uint32_t)SAM_EXTDRAM_CS0 + 0x00010000)
#endif
/* LCD refresh rate */
#ifndef CONFIG_SAM_LCD_REFRESH_FREQ
# define CONFIG_SAM_LCD_REFRESH_FREQ (50) /* Hz */
#endif
/* Bits per pixel / color format */
#undef SAM_COLOR_FMT
#if defined(CONFIG_SAM_LCD_BPP1)
# define SAM_BPP 1
# define SAM_COLOR_FMT FB_FMT_Y1
#elif defined(CONFIG_SAM_LCD_BPP2)
# define SAM_BPP 2
# define SAM_COLOR_FMT FB_FMT_Y2
#elif defined(CONFIG_SAM_LCD_BPP4)
# define SAM_BPP 4
# define SAM_COLOR_FMT FB_FMT_Y4
#elif defined(CONFIG_SAM_LCD_BPP8)
# define SAM_BPP 8
# define SAM_COLOR_FMT FB_FMT_Y8
#elif defined(CONFIG_SAM_LCD_BPP16)
# define SAM_BPP 16
# define SAM_COLOR_FMT FB_FMT_Y16
#elif defined(CONFIG_SAM_LCD_BPP24)
# define SAM_BPP 32 /* Only 24 of 32 bits used for RGB */
# define SAM_COLOR_FMT FB_FMT_RGB24
# ifndef CONFIG_SAM_LCD_TFTPANEL
# error "24 BPP is only available for a TFT panel"
# endif
#elif defined(CONFIG_SAM_LCD_BPP16_565)
# define SAM_BPP 16
# define SAM_COLOR_FMT FB_FMT_RGB16_565
#elif defined(CONFIG_SAM_LCD_BPP12_444)
# define SAM_BPP 1 2
# define SAM_COLOR_FMT FB_FMT_RGB12_444
#else
# ifndef CONFIG_SAM_LCD_TFTPANEL
# warning "Assuming 24 BPP"
# define SAM_BPP 24
# define CONFIG_SAM_LCD_BPP24 1
# define SAM_COLOR_FMT FB_FMT_RGB24
# else
# warning "Assuming 16 BPP 5:6:5"
# define SAM_BPP 16
# define CONFIG_SAM_LCD_BPP16_565 1
# define SAM_COLOR_FMT FB_FMT_RGB16_565
# endif
#endif
/* Background color */
#ifndef CONFIG_SAM_LCD_BACKCOLOR
# define CONFIG_SAM_LCD_BACKCOLOR 0 /* Initial background color */
#endif
/* Horizontal video characteristics */
#ifndef CONFIG_SAM_LCD_HWIDTH
# define CONFIG_SAM_LCD_HWIDTH 480 /* Width in pixels */
#endif
#ifndef CONFIG_SAM_LCD_HPULSE
# define CONFIG_SAM_LCD_HPULSE 2
#endif
#ifndef CONFIG_SAM_LCD_HFRONTPORCH
# define CONFIG_SAM_LCD_HFRONTPORCH 5
#endif
#ifndef CONFIG_SAM_LCD_HBACKPORCH
# define CONFIG_SAM_LCD_HBACKPORCH 40
#endif
/* Vertical video characteristics */
#ifndef CONFIG_SAM_LCD_VHEIGHT
# define CONFIG_SAM_LCD_VHEIGHT 272 /* Height in rows */
#endif
#ifndef CONFIG_SAM_LCD_VPULSE
# define CONFIG_SAM_LCD_VPULSE 2
#endif
#ifndef CONFIG_SAM_LCD_VFRONTPORCH
# define CONFIG_SAM_LCD_VFRONTPORCH 8
#endif
#ifndef CONFIG_SAM_LCD_VBACKPORCH
# define CONFIG_SAM_LCD_VBACKPORCH 8
#endif
/************************************************************************************
* Public Types

View File

@ -71,6 +71,33 @@
#endif
/* LCD Geometry and Timing */
#define BOARD_LCD_WIDTH 800 /* Display width (pixels) */
#define BOARD_LCD_HEIGHT 480 /* Display height (pixels) */
#define BOARD_LCD_IFWIDTH 24 /* Display interface width (bits) */
#define BOARD_LCD_TIMING_VFP 22 /* Vertical front porch (lines) */
#define BOARD_LCD_TIMING_VBP 21 /* Vertical back porch (lines) */
#define BOARD_LCD_TIMING_VPW 2 /* Vertical pulse width (lines) */
#define BOARD_LCD_TIMING_HFP 64 /* Horizontal front porch (LCDDOTCLK cycles) */
#define BOARD_LCD_TIMING_HBP 64 /* Horizontal back porch (LCDDOTCLK cycles) */
#define BOARD_LCD_TIMING_HPW 128 /* Horizontal pulse width (LCDDOTCLK cycles) */
#define BOARD_LCD_FRAMERATE 40 /* Frame rate (Hz) */
/* Frame size (words) (height * width * bpp / 32) */
#define BOARD_LCD_FRAMESIZE \
(BOARD_LCD_WIDTH * BOARD_LCD_HEIGHT * BOARD_LCD_IFWIDTH / 32)
/* Pixel clock rate (Hz )(HS period * VS period * BOARD_LCD_FRAMERATE). */
#define BOARD_LCD_HSPERIOD \
(BOARD_LCD_TIMING_HPW + BOARD_LCD_TIMING_HBP + BOARD_LCD_WIDTH + BOARD_LCD_TIMING_HFP)
#define BOARD_LCD_VSPERIOD \
(BOARD_LCD_TIMING_VPW + BOARD_LCD_TIMING_VBP + BOARD_LCD_HEIGHT + BOARD_LCD_TIMING_VFP)
#define BOARD_LCD_PIXELCLOCK \
(BOARD_LCD_HSPERIOD * BOARD_LCD_VSPERIOD * BOARD_LCD_FRAMERATE)
/* LED definitions ******************************************************************/
/* There are two LEDs on the SAMA5D3 series-CM board that can be controlled
* by software. A blue LED is controlled via PIO pins. A red LED normally