From cb115418b1e89b1fb9ea847b696ada7237a0ee87 Mon Sep 17 00:00:00 2001 From: asterix Date: Thu, 20 May 2010 14:19:57 +0000 Subject: [PATCH] Update hw files. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3748 38d2e660-2303-0410-9eaa-f027e97ec537 --- examples/avr-kern/hw/hw_lcd_32122a.h | 155 ++++++++++++++++++ .../hw/hw_lcd.h => avr-kern/hw/hw_lcd_hd44.h} | 19 +-- examples/develgps/hw/hw_lcd_32122a.h | 155 ++++++++++++++++++ .../hw/hw_lcd.h => develgps/hw/hw_lcd_hd44.h} | 25 +-- examples/develgps/hw/hw_rit128x96.h | 2 +- examples/lpc2378/hw/hw_lcd_32122a.h | 155 ++++++++++++++++++ .../lpc2378/hw/{hw_lcd.h => hw_lcd_hd44.h} | 25 +-- 7 files changed, 499 insertions(+), 37 deletions(-) create mode 100644 examples/avr-kern/hw/hw_lcd_32122a.h rename examples/{develgps/hw/hw_lcd.h => avr-kern/hw/hw_lcd_hd44.h} (94%) create mode 100644 examples/develgps/hw/hw_lcd_32122a.h rename examples/{avr-kern/hw/hw_lcd.h => develgps/hw/hw_lcd_hd44.h} (92%) create mode 100644 examples/lpc2378/hw/hw_lcd_32122a.h rename examples/lpc2378/hw/{hw_lcd.h => hw_lcd_hd44.h} (92%) diff --git a/examples/avr-kern/hw/hw_lcd_32122a.h b/examples/avr-kern/hw/hw_lcd_32122a.h new file mode 100644 index 00000000..6ec29c5c --- /dev/null +++ b/examples/avr-kern/hw/hw_lcd_32122a.h @@ -0,0 +1,155 @@ +/** + * \file + * + * + * \brief Displaytech 32122A LCD driver + * + * \author Bernie Innocenti + * \author Stefano Fedrigo + * + */ + +#ifndef HW_LCD_32122A_H +#define HW_LCD_32122A_H + +#include +#include + +#warning TODO:This is an example implementation, you must implement it! + +/** + * Predefined LCD PWM contrast values + */ +#define LCD_DEF_PWM 145 +#define LCD_MAX_PWM 505 +#define LCD_MIN_PWM 130 +#define LCD_PWM_CH 0 + + +/** + * \name LCD I/O pins/ports + * @{ + */ +#define LCD_RS /* Implement me! */ +#define LCD_RW /* Implement me! */ +#define LCD_PE_E1 /* Implement me! */ +#define LCD_PE_E2 /* Implement me! */ +#define LCD_DB0 /* Implement me! */ +#define LCD_DB1 /* Implement me! */ +#define LCD_DB2 /* Implement me! */ +#define LCD_DB3 /* Implement me! */ +#define LCD_DB4 /* Implement me! */ +#define LCD_DB5 /* Implement me! */ +#define LCD_DB6 /* Implement me! */ +#define LCD_DB7 /* Implement me! */ +#define LCD_PF_DB0 /* Implment me! */ +/*@}*/ + +/** + * \name LCD bus control macros + * @{ + */ +#define LCD_CLR_A0 do { /* Implement me! */ } while (0) +#define LCD_SET_A0 do { /* Implement me! */ } while (0) +#define LCD_CLR_RD do { /* Implement me! */ } while (0) +#define LCD_SET_RD do { /* Implement me! */ } while (0) +#define LCD_CLR_E1 do { /* Implement me! */ } while (0) +#define LCD_SET_E1 do { /* Implement me! */ } while (0) +#define LCD_CLR_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E(x) do { (void)x; /* Implement me! */ } while (0) +#define LCD_CLR_E(x) do { (void)x; /* Implement me! */ } while (0) +/*@}*/ + +/** + * \name Chip select bits for LCD_SET_E() + * @{ + */ +#define LCDF_E1 ( 0/* Implement me! */) +#define LCDF_E2 ( 0/* Implement me! */) +/*@}*/ +/** Read from the LCD data bus (DB[0-7]) */ +#define LCD_WRITE(x) ((void)x)/* Implement me! */ +/** Write to the LCD data bus (DB[0-7]) */ +#define LCD_READ (0 /* Implement me! */ ) + +/** Set data bus direction to output (write to display) */ +#define LCD_DB_OUT /* Implement me! */ + +/** Set data bus direction to input (read from display) */ +#define LCD_DB_IN /* Implement me! */ + +/** Delay for write (Enable pulse width, 220ns) */ +#define LCD_DELAY_WRITE \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + +/** Delay for read (Data ouput delay time, 120ns) */ +#define LCD_DELAY_READ \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + + +#define LCD_32122_RESET() do { /* Implement me! */ } while (0) + +INLINE void lcd_32122a_hw_bus_init(void) +{ + cpu_flags_t flags; + IRQ_SAVE_DISABLE(flags); + + /* + * Here set bus pin! + * to init a lcd device. + * + */ + + /* + * Data bus is in output state most of the time: + * LCD r/w functions assume it is left in output state + */ + LCD_DB_OUT; + + + IRQ_RESTORE(flags); +} + +#endif /* HW_LCD_32122A_H */ + diff --git a/examples/develgps/hw/hw_lcd.h b/examples/avr-kern/hw/hw_lcd_hd44.h similarity index 94% rename from examples/develgps/hw/hw_lcd.h rename to examples/avr-kern/hw/hw_lcd_hd44.h index 21b64d4e..dfebbcab 100644 --- a/examples/develgps/hw/hw_lcd.h +++ b/examples/avr-kern/hw/hw_lcd_hd44.h @@ -33,23 +33,18 @@ * * \brief LCD low-level hardware macros * - * \version $Id$ - * * \author Bernie Innocenti * \author Stefano Fedrigo * */ -#ifndef HW_LCD_H -#define HW_LCD_H +#ifndef HW_LCD_HD44_H +#define HW_LCD_HD44_H -#include "cfg/cfg_lcd.h" /* CONFIG_LCD_4BIT */ -#include /* BV() */ -#include +#include "cfg/cfg_lcd_hd44.h" /* CONFIG_LCD_4BIT */ -#include -#include #include +#include #warning TODO:This is an example implementation, you must implement it! @@ -117,7 +112,6 @@ /** Set data bus direction to input (read from display) */ #define LCD_DB_IN /* Implement me! */ - /** Delay for write (Enable pulse width, 220ns) */ #define LCD_DELAY_WRITE \ do { \ @@ -138,7 +132,8 @@ } while (0) -INLINE void lcd_bus_init(void) + +INLINE void lcd_hd44_hw_bus_init(void) { cpu_flags_t flags; IRQ_SAVE_DISABLE(flags); @@ -159,4 +154,4 @@ INLINE void lcd_bus_init(void) IRQ_RESTORE(flags); } -#endif /* HW_LCD_H */ +#endif /* HW_LCD_HD44_H */ diff --git a/examples/develgps/hw/hw_lcd_32122a.h b/examples/develgps/hw/hw_lcd_32122a.h new file mode 100644 index 00000000..6ec29c5c --- /dev/null +++ b/examples/develgps/hw/hw_lcd_32122a.h @@ -0,0 +1,155 @@ +/** + * \file + * + * + * \brief Displaytech 32122A LCD driver + * + * \author Bernie Innocenti + * \author Stefano Fedrigo + * + */ + +#ifndef HW_LCD_32122A_H +#define HW_LCD_32122A_H + +#include +#include + +#warning TODO:This is an example implementation, you must implement it! + +/** + * Predefined LCD PWM contrast values + */ +#define LCD_DEF_PWM 145 +#define LCD_MAX_PWM 505 +#define LCD_MIN_PWM 130 +#define LCD_PWM_CH 0 + + +/** + * \name LCD I/O pins/ports + * @{ + */ +#define LCD_RS /* Implement me! */ +#define LCD_RW /* Implement me! */ +#define LCD_PE_E1 /* Implement me! */ +#define LCD_PE_E2 /* Implement me! */ +#define LCD_DB0 /* Implement me! */ +#define LCD_DB1 /* Implement me! */ +#define LCD_DB2 /* Implement me! */ +#define LCD_DB3 /* Implement me! */ +#define LCD_DB4 /* Implement me! */ +#define LCD_DB5 /* Implement me! */ +#define LCD_DB6 /* Implement me! */ +#define LCD_DB7 /* Implement me! */ +#define LCD_PF_DB0 /* Implment me! */ +/*@}*/ + +/** + * \name LCD bus control macros + * @{ + */ +#define LCD_CLR_A0 do { /* Implement me! */ } while (0) +#define LCD_SET_A0 do { /* Implement me! */ } while (0) +#define LCD_CLR_RD do { /* Implement me! */ } while (0) +#define LCD_SET_RD do { /* Implement me! */ } while (0) +#define LCD_CLR_E1 do { /* Implement me! */ } while (0) +#define LCD_SET_E1 do { /* Implement me! */ } while (0) +#define LCD_CLR_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E(x) do { (void)x; /* Implement me! */ } while (0) +#define LCD_CLR_E(x) do { (void)x; /* Implement me! */ } while (0) +/*@}*/ + +/** + * \name Chip select bits for LCD_SET_E() + * @{ + */ +#define LCDF_E1 ( 0/* Implement me! */) +#define LCDF_E2 ( 0/* Implement me! */) +/*@}*/ +/** Read from the LCD data bus (DB[0-7]) */ +#define LCD_WRITE(x) ((void)x)/* Implement me! */ +/** Write to the LCD data bus (DB[0-7]) */ +#define LCD_READ (0 /* Implement me! */ ) + +/** Set data bus direction to output (write to display) */ +#define LCD_DB_OUT /* Implement me! */ + +/** Set data bus direction to input (read from display) */ +#define LCD_DB_IN /* Implement me! */ + +/** Delay for write (Enable pulse width, 220ns) */ +#define LCD_DELAY_WRITE \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + +/** Delay for read (Data ouput delay time, 120ns) */ +#define LCD_DELAY_READ \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + + +#define LCD_32122_RESET() do { /* Implement me! */ } while (0) + +INLINE void lcd_32122a_hw_bus_init(void) +{ + cpu_flags_t flags; + IRQ_SAVE_DISABLE(flags); + + /* + * Here set bus pin! + * to init a lcd device. + * + */ + + /* + * Data bus is in output state most of the time: + * LCD r/w functions assume it is left in output state + */ + LCD_DB_OUT; + + + IRQ_RESTORE(flags); +} + +#endif /* HW_LCD_32122A_H */ + diff --git a/examples/avr-kern/hw/hw_lcd.h b/examples/develgps/hw/hw_lcd_hd44.h similarity index 92% rename from examples/avr-kern/hw/hw_lcd.h rename to examples/develgps/hw/hw_lcd_hd44.h index 3a206a0f..dfebbcab 100644 --- a/examples/avr-kern/hw/hw_lcd.h +++ b/examples/develgps/hw/hw_lcd_hd44.h @@ -33,23 +33,18 @@ * * \brief LCD low-level hardware macros * - * \version $Id$ - * * \author Bernie Innocenti * \author Stefano Fedrigo * */ -#ifndef HW_LCD_H -#define HW_LCD_H +#ifndef HW_LCD_HD44_H +#define HW_LCD_HD44_H -#include "cfg/cfg_lcd.h" /* CONFIG_LCD_4BIT */ -#include /* BV() */ -#include +#include "cfg/cfg_lcd_hd44.h" /* CONFIG_LCD_4BIT */ -#include -#include #include +#include #warning TODO:This is an example implementation, you must implement it! @@ -95,6 +90,12 @@ #define LCD_CLR_E /* Implement me! */ #define LCD_SET_E /* Implement me! */ +/* Enter command mode */ +#define LCD_SET_COMMAND() /* Implement me! */ + +/* Enter data mode */ +#define LCD_SET_DATA() /* Implement me! */ + #if CONFIG_LCD_4BIT #define LCD_WRITE_H(x) ((void)x)/* Implement me! */ #define LCD_WRITE_L(x) ((void)x)/* Implement me! */ @@ -111,7 +112,6 @@ /** Set data bus direction to input (read from display) */ #define LCD_DB_IN /* Implement me! */ - /** Delay for write (Enable pulse width, 220ns) */ #define LCD_DELAY_WRITE \ do { \ @@ -132,7 +132,8 @@ } while (0) -INLINE void lcd_bus_init(void) + +INLINE void lcd_hd44_hw_bus_init(void) { cpu_flags_t flags; IRQ_SAVE_DISABLE(flags); @@ -153,4 +154,4 @@ INLINE void lcd_bus_init(void) IRQ_RESTORE(flags); } -#endif /* HW_LCD_H */ +#endif /* HW_LCD_HD44_H */ diff --git a/examples/develgps/hw/hw_rit128x96.h b/examples/develgps/hw/hw_rit128x96.h index 7ccdeb1d..ae930b97 100644 --- a/examples/develgps/hw/hw_rit128x96.h +++ b/examples/develgps/hw/hw_rit128x96.h @@ -82,7 +82,7 @@ } /*@}*/ -INLINE void lcd_bus_init(void) +INLINE void lcd_rit128x96_hw_bus_init(void) { uint32_t dummy; diff --git a/examples/lpc2378/hw/hw_lcd_32122a.h b/examples/lpc2378/hw/hw_lcd_32122a.h new file mode 100644 index 00000000..6ec29c5c --- /dev/null +++ b/examples/lpc2378/hw/hw_lcd_32122a.h @@ -0,0 +1,155 @@ +/** + * \file + * + * + * \brief Displaytech 32122A LCD driver + * + * \author Bernie Innocenti + * \author Stefano Fedrigo + * + */ + +#ifndef HW_LCD_32122A_H +#define HW_LCD_32122A_H + +#include +#include + +#warning TODO:This is an example implementation, you must implement it! + +/** + * Predefined LCD PWM contrast values + */ +#define LCD_DEF_PWM 145 +#define LCD_MAX_PWM 505 +#define LCD_MIN_PWM 130 +#define LCD_PWM_CH 0 + + +/** + * \name LCD I/O pins/ports + * @{ + */ +#define LCD_RS /* Implement me! */ +#define LCD_RW /* Implement me! */ +#define LCD_PE_E1 /* Implement me! */ +#define LCD_PE_E2 /* Implement me! */ +#define LCD_DB0 /* Implement me! */ +#define LCD_DB1 /* Implement me! */ +#define LCD_DB2 /* Implement me! */ +#define LCD_DB3 /* Implement me! */ +#define LCD_DB4 /* Implement me! */ +#define LCD_DB5 /* Implement me! */ +#define LCD_DB6 /* Implement me! */ +#define LCD_DB7 /* Implement me! */ +#define LCD_PF_DB0 /* Implment me! */ +/*@}*/ + +/** + * \name LCD bus control macros + * @{ + */ +#define LCD_CLR_A0 do { /* Implement me! */ } while (0) +#define LCD_SET_A0 do { /* Implement me! */ } while (0) +#define LCD_CLR_RD do { /* Implement me! */ } while (0) +#define LCD_SET_RD do { /* Implement me! */ } while (0) +#define LCD_CLR_E1 do { /* Implement me! */ } while (0) +#define LCD_SET_E1 do { /* Implement me! */ } while (0) +#define LCD_CLR_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E(x) do { (void)x; /* Implement me! */ } while (0) +#define LCD_CLR_E(x) do { (void)x; /* Implement me! */ } while (0) +/*@}*/ + +/** + * \name Chip select bits for LCD_SET_E() + * @{ + */ +#define LCDF_E1 ( 0/* Implement me! */) +#define LCDF_E2 ( 0/* Implement me! */) +/*@}*/ +/** Read from the LCD data bus (DB[0-7]) */ +#define LCD_WRITE(x) ((void)x)/* Implement me! */ +/** Write to the LCD data bus (DB[0-7]) */ +#define LCD_READ (0 /* Implement me! */ ) + +/** Set data bus direction to output (write to display) */ +#define LCD_DB_OUT /* Implement me! */ + +/** Set data bus direction to input (read from display) */ +#define LCD_DB_IN /* Implement me! */ + +/** Delay for write (Enable pulse width, 220ns) */ +#define LCD_DELAY_WRITE \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + +/** Delay for read (Data ouput delay time, 120ns) */ +#define LCD_DELAY_READ \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + + +#define LCD_32122_RESET() do { /* Implement me! */ } while (0) + +INLINE void lcd_32122a_hw_bus_init(void) +{ + cpu_flags_t flags; + IRQ_SAVE_DISABLE(flags); + + /* + * Here set bus pin! + * to init a lcd device. + * + */ + + /* + * Data bus is in output state most of the time: + * LCD r/w functions assume it is left in output state + */ + LCD_DB_OUT; + + + IRQ_RESTORE(flags); +} + +#endif /* HW_LCD_32122A_H */ + diff --git a/examples/lpc2378/hw/hw_lcd.h b/examples/lpc2378/hw/hw_lcd_hd44.h similarity index 92% rename from examples/lpc2378/hw/hw_lcd.h rename to examples/lpc2378/hw/hw_lcd_hd44.h index a760b7cf..dfebbcab 100644 --- a/examples/lpc2378/hw/hw_lcd.h +++ b/examples/lpc2378/hw/hw_lcd_hd44.h @@ -33,23 +33,18 @@ * * \brief LCD low-level hardware macros * - * \version $Id: hw_lcd.h 2506 2009-04-15 08:29:07Z duplo $ - * * \author Bernie Innocenti * \author Stefano Fedrigo * */ -#ifndef HW_LCD_H -#define HW_LCD_H +#ifndef HW_LCD_HD44_H +#define HW_LCD_HD44_H -#include "cfg/cfg_lcd.h" /* CONFIG_LCD_4BIT */ -#include /* BV() */ -#include +#include "cfg/cfg_lcd_hd44.h" /* CONFIG_LCD_4BIT */ -#include -#include #include +#include #warning TODO:This is an example implementation, you must implement it! @@ -95,6 +90,12 @@ #define LCD_CLR_E /* Implement me! */ #define LCD_SET_E /* Implement me! */ +/* Enter command mode */ +#define LCD_SET_COMMAND() /* Implement me! */ + +/* Enter data mode */ +#define LCD_SET_DATA() /* Implement me! */ + #if CONFIG_LCD_4BIT #define LCD_WRITE_H(x) ((void)x)/* Implement me! */ #define LCD_WRITE_L(x) ((void)x)/* Implement me! */ @@ -111,7 +112,6 @@ /** Set data bus direction to input (read from display) */ #define LCD_DB_IN /* Implement me! */ - /** Delay for write (Enable pulse width, 220ns) */ #define LCD_DELAY_WRITE \ do { \ @@ -132,7 +132,8 @@ } while (0) -INLINE void lcd_bus_init(void) + +INLINE void lcd_hd44_hw_bus_init(void) { cpu_flags_t flags; IRQ_SAVE_DISABLE(flags); @@ -153,4 +154,4 @@ INLINE void lcd_bus_init(void) IRQ_RESTORE(flags); } -#endif /* HW_LCD_H */ +#endif /* HW_LCD_HD44_H */ -- 2.25.1