From 933cec7399d487c4a50ff602ab6c639e09f75018 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 18 Apr 2010 23:39:55 +0000 Subject: [PATCH] Add HX834x register access routines git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2617 42af7a65-404d-4744-a932-0658087f49c3 --- configs/sam3u-ek/src/up_lcd.c | 39 ++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/configs/sam3u-ek/src/up_lcd.c b/configs/sam3u-ek/src/up_lcd.c index 9ead815b96..b201e33e8c 100755 --- a/configs/sam3u-ek/src/up_lcd.c +++ b/configs/sam3u-ek/src/up_lcd.c @@ -138,10 +138,19 @@ #define SAM3UEK_BPP 16 #define SAM3UEK_RGBFMT FB_FMT_RGB16_565 +/* HX834x register select */ + +#define HX843X_LCD_RS (1 << 1) + /************************************************************************************** * Private Function Protototypes **************************************************************************************/ +/* Low-level HX834x Register access */ + +static void sam3u_putreg(uint16_t reg, uint16_t data); +static uint16_t sam3u_getreg(uint16_t reg); + /* LCD Data Transfer Methods */ static int sam3u_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, @@ -176,7 +185,7 @@ static int sam3u_getcontrast(struct lcd_dev_s *dev); static int sam3u_setcontrast(struct lcd_dev_s *dev, unsigned int contrast); /************************************************************************************** - * Private Function Protototypes + * Private Data **************************************************************************************/ /* This is working memory allocated by the LCD driver for each LCD device @@ -236,6 +245,34 @@ static struct lcd_dev_s g_lcddev_s = * Private Functions **************************************************************************************/ +/************************************************************************************** + * Name: sam3u_putreg + * + * Description: + * Write to a HX834x register + * + **************************************************************************************/ + +static void sam3u_putreg(uint16_t reg, uint16_t data) +{ + putreg16(reg, LCD_BASE); + putreg16(data, LCD_BASE + HX843X_LCD_RS); +} + +/************************************************************************************** + * Name: sam3u_getreg + * + * Description: + * Read from a HX834x register + * + **************************************************************************************/ + +static uint16_t sam3u_getreg(uint16_t reg) +{ + putreg16(reg, LCD_BASE); + return getreg16(LCD_BASE + HX843X_LCD_RS); +} + /************************************************************************************** * Name: sam3u_putrun *