From: arighi Date: Tue, 13 Apr 2010 13:39:51 +0000 (+0000) Subject: rit128x96: add distinct configuration and hardware definition files. X-Git-Tag: 2.5.0~481 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=7ded58114194b75f629e0ddfafafc44083cad17c;p=bertos.git rit128x96: add distinct configuration and hardware definition files. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3427 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/drv/lcd_rit128x96.c b/bertos/drv/lcd_rit128x96.c index 7e538327..dc98055a 100644 --- a/bertos/drv/lcd_rit128x96.c +++ b/bertos/drv/lcd_rit128x96.c @@ -107,16 +107,9 @@ static void lcd_dataWrite(const uint8_t *buf, size_t count) { while (count--) { -#if !CONFIG_LCD_4BIT LCD_WRITE(*buf++); /* Dummy read to drain the FIFO */ (void)LCD_READ; -#else - LCD_WRITE_H(*buf); - LCD_WRITE_L(*buf++); - (void)LCD_READ_H; - (void)LCD_READ_L; -#endif } } diff --git a/bertos/drv/lcd_rit128x96.h b/bertos/drv/lcd_rit128x96.h index 7f607473..3aa8e760 100644 --- a/bertos/drv/lcd_rit128x96.h +++ b/bertos/drv/lcd_rit128x96.h @@ -37,7 +37,7 @@ #define LCD_LM3S_H #include /* Bitmap */ -#include +#include "hw/hw_rit128x96.h" #define LCD_WIDTH 128 #define LCD_HEIGHT 96 diff --git a/bertos/hw/hw_rit128x96.h b/bertos/hw/hw_rit128x96.h new file mode 100644 index 00000000..d1435f62 --- /dev/null +++ b/bertos/hw/hw_rit128x96.h @@ -0,0 +1,81 @@ +/** + * \file + * + * + * \brief LM3S1986: OLED-RIT-128x96 (P14201) low-level hardware macros + * + * \author Andrea Righi + */ + +#ifndef HW_RIT128x96_H +#define HW_RIT128x96_H + +#include "cfg/macros.h" /* BV() */ +#include "cfg/debug.h" + +#include +#include +#include + +/** + * \name LCD I/O pins/ports + * @{ + */ +/* OLED Data/Command control pin */ +#define GPIO_OLEDDC_PIN 0 /* Implement me! */ + +/* OLED enable pin */ +#define GPIO_OLEDEN_PIN 0 /* Implement me! */ +/*@}*/ + +/** + * \name LCD bus control macros + * @{ + */ +/* Enter command mode */ +#define LCD_SET_COMMAND() /* Implement me! */ + +/* Enter data mode */ +#define LCD_SET_DATA() /* Implement me! */ + +/* Send data to the display */ +#define LCD_WRITE(x) ((void)x)/* Implement me! */ + +/* Read data from the display */ +#define LCD_READ (0 /* Implement me! */ ) +/*@}*/ + +INLINE void lcd_bus_init(void) +{ + /* Implement me! */ +} + +#endif /* HW_RIT128x96_H */ diff --git a/examples/lm3s1968/hw/hw_lcd.h b/examples/lm3s1968/hw/hw_lcd.h deleted file mode 100644 index ed2ede9e..00000000 --- a/examples/lm3s1968/hw/hw_lcd.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * \file - * - * - * \brief LM3S1986: OLED-RIT-128x96 (P14201) low-level hardware macros - * - * \author Andrea Righi - */ - -#ifndef HW_LCD_H -#define HW_LCD_H - -#include "cfg/macros.h" /* BV() */ -#include "cfg/debug.h" -#include "cfg/cfg_lcd.h" /* CONFIG_LCD_4BIT */ - -#include -#include -#include - -#include -#include -#include - -#include - -/** - * \name LCD I/O pins/ports - * @{ - */ -/* OLED Data/Command control pin */ -#define GPIO_OLEDDC_PIN BV(2) - -/* OLED enable pin */ -#define GPIO_OLEDEN_PIN BV(3) -/*@}*/ - -/** - * \name LCD bus control macros - * @{ - */ -/* Enter command mode */ -#define LCD_SET_COMMAND() \ - lm3s_gpioPinWrite(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN, 0) - -/* Enter data mode */ -#define LCD_SET_DATA() \ - lm3s_gpioPinWrite(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN, GPIO_OLEDDC_PIN) - -/* Send data to the display */ -#define LCD_WRITE(x) lm3s_ssiWriteFrame(SSI0_BASE, x) - -/* Read data from the display */ -#define LCD_READ \ - ({ \ - uint32_t frame; \ - lm3s_ssiReadFrame(SSI0_BASE, &frame); \ - frame; \ - }) -/*@}*/ - -INLINE void lcd_bus_init(void) -{ - cpu_flags_t flags; - uint32_t dummy; - - IRQ_SAVE_DISABLE(flags); - - /* Enable the peripheral clock */ - SYSCTL_RCGC1_R |= SYSCTL_RCGC1_SSI0; - SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOA; - SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOH; - lm3s_busyWait(512); - - /* Configure the SSI0CLK and SSIOTX pins for SSI operation. */ - lm3s_gpioPinConfig(GPIO_PORTA_BASE, BV(2) | BV(3) | BV(5), - GPIO_DIR_MODE_HW, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU); - /* - * Configure the GPIO port pin used as a D/C# signal (data/command - * control) for OLED device, and the port pin used to enable power to - * the OLED panel. - */ - lm3s_gpioPinConfig(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN, - GPIO_DIR_MODE_OUT, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); - lm3s_gpioPinWrite(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN, - GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN); - - /* Configure the SSI0 port for master mode */ - lm3s_ssiOpen(SSI0_BASE, SSI_FRF_MOTO_MODE_2, - SSI_MODE_MASTER, CPU_FREQ / 2, 8); - /* - * Configure the GPIO port pin used as a D/Cn signal for OLED device, - * and the port pin used to enable power to the OLED panel. - */ - lm3s_gpioPinConfig(GPIO_PORTA_BASE, GPIO_OLEDEN_PIN, - GPIO_DIR_MODE_HW, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU); - - /* Drain the SSI RX FIFO */ - while (lm3s_ssiReadFrameNonBlocking(SSI0_BASE, &dummy)); - - IRQ_RESTORE(flags); -} - -#endif /* HW_LCD_H */ diff --git a/examples/lm3s1968/hw/hw_rit128x96.h b/examples/lm3s1968/hw/hw_rit128x96.h new file mode 100644 index 00000000..495c2e56 --- /dev/null +++ b/examples/lm3s1968/hw/hw_rit128x96.h @@ -0,0 +1,129 @@ +/** + * \file + * + * + * \brief LM3S1986: OLED-RIT-128x96 (P14201) low-level hardware macros + * + * \author Andrea Righi + */ + +#ifndef HW_RIT128x96_H +#define HW_RIT128x96_H + +#include "cfg/macros.h" /* BV() */ +#include "cfg/debug.h" + +#include +#include +#include + +#include +#include +#include + +/** + * \name LCD I/O pins/ports + * @{ + */ +/* OLED Data/Command control pin */ +#define GPIO_OLEDDC_PIN BV(2) + +/* OLED enable pin */ +#define GPIO_OLEDEN_PIN BV(3) +/*@}*/ + +/** + * \name LCD bus control macros + * @{ + */ +/* Enter command mode */ +#define LCD_SET_COMMAND() \ + lm3s_gpioPinWrite(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN, 0) + +/* Enter data mode */ +#define LCD_SET_DATA() \ + lm3s_gpioPinWrite(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN, GPIO_OLEDDC_PIN) + +/* Send data to the display */ +#define LCD_WRITE(x) lm3s_ssiWriteFrame(SSI0_BASE, x) + +/* Read data from the display */ +#define LCD_READ \ + ({ \ + uint32_t frame; \ + lm3s_ssiReadFrame(SSI0_BASE, &frame); \ + frame; \ + }) +/*@}*/ + +INLINE void lcd_bus_init(void) +{ + cpu_flags_t flags; + uint32_t dummy; + + IRQ_SAVE_DISABLE(flags); + + /* Enable the peripheral clock */ + SYSCTL_RCGC1_R |= SYSCTL_RCGC1_SSI0; + SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOA; + SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOH; + lm3s_busyWait(512); + + /* Configure the SSI0CLK and SSIOTX pins for SSI operation. */ + lm3s_gpioPinConfig(GPIO_PORTA_BASE, BV(2) | BV(3) | BV(5), + GPIO_DIR_MODE_HW, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU); + /* + * Configure the GPIO port pin used as a D/C# signal (data/command + * control) for OLED device, and the port pin used to enable power to + * the OLED panel. + */ + lm3s_gpioPinConfig(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN, + GPIO_DIR_MODE_OUT, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); + lm3s_gpioPinWrite(GPIO_PORTH_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN, + GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN); + + /* Configure the SSI0 port for master mode */ + lm3s_ssiOpen(SSI0_BASE, SSI_FRF_MOTO_MODE_2, + SSI_MODE_MASTER, CPU_FREQ / 2, 8); + /* + * Configure the GPIO port pin used as a D/Cn signal for OLED device, + * and the port pin used to enable power to the OLED panel. + */ + lm3s_gpioPinConfig(GPIO_PORTA_BASE, GPIO_OLEDEN_PIN, + GPIO_DIR_MODE_HW, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU); + + /* Drain the SSI RX FIFO */ + while (lm3s_ssiReadFrameNonBlocking(SSI0_BASE, &dummy)); + + IRQ_RESTORE(flags); +} + +#endif /* HW_RIT128x96_H */ diff --git a/examples/lm3s1968/lm3s1968.c b/examples/lm3s1968/lm3s1968.c index a9e995e3..7aac4912 100644 --- a/examples/lm3s1968/lm3s1968.c +++ b/examples/lm3s1968/lm3s1968.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -47,7 +48,7 @@ #include "cfg/compiler.h" #include "cfg/cfg_gfx.h" -#include "hw/hw_lcd.h" +#include "hw/hw_rit128x96.h" #define PROC_STACK_SIZE KERN_MINSTACKSIZE