Initial commit (autogenerated files)
[rmslog.git] / rmslog / hw / hw_lcd_32122a.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2003, 2004, 2005, 2006, 2010 Develer S.r.l. (http://www.develer.com/)
30  * Copyright 2001 Bernie Innocenti <bernie@codewiz.org>
31  *
32  * -->
33  *
34  * \brief Displaytech 32122A LCD driver
35  *
36  * \author Bernie Innocenti <bernie@codewiz.org>
37  * \author Stefano Fedrigo <aleph@develer.com>
38  *
39  */
40
41 #ifndef HW_LCD_32122A_H
42 #define HW_LCD_32122A_H
43
44 #include <cpu/types.h>
45 #include <cpu/irq.h>
46
47 #warning TODO:This is an example implementation, you must implement it!
48
49 /**
50  * Predefined LCD PWM contrast values
51  */
52 #define LCD_DEF_PWM 145
53 #define LCD_MAX_PWM 505
54 #define LCD_MIN_PWM 130
55 #define LCD_PWM_CH    0
56
57
58 /**
59  * \name LCD I/O pins/ports
60  * @{
61  */
62 #define LCD_RS    /* Implement me! */
63 #define LCD_RW    /* Implement me! */
64 #define LCD_PE_E1    /* Implement me! */
65 #define LCD_PE_E2    /* Implement me! */
66 #define LCD_DB0   /* Implement me! */
67 #define LCD_DB1   /* Implement me! */
68 #define LCD_DB2   /* Implement me! */
69 #define LCD_DB3   /* Implement me! */
70 #define LCD_DB4   /* Implement me! */
71 #define LCD_DB5   /* Implement me! */
72 #define LCD_DB6   /* Implement me! */
73 #define LCD_DB7   /* Implement me! */
74 #define LCD_PF_DB0   /* Implment me! */
75 /*@}*/
76
77 /**
78  * \name LCD bus control macros
79  * @{
80  */
81 #define LCD_CLR_A0                do { /* Implement me! */ } while (0)
82 #define LCD_SET_A0                do { /* Implement me! */ } while (0)
83 #define LCD_CLR_RD                do { /* Implement me! */ } while (0)
84 #define LCD_SET_RD                do { /* Implement me! */ } while (0)
85 #define LCD_CLR_E1                do { /* Implement me! */ } while (0)
86 #define LCD_SET_E1                do { /* Implement me! */ } while (0)
87 #define LCD_CLR_E2                do { /* Implement me! */ } while (0)
88 #define LCD_SET_E2                do { /* Implement me! */ } while (0)
89 #define LCD_SET_E(x)              do { (void)x; /* Implement me! */ } while (0)
90 #define LCD_CLR_E(x)              do { (void)x; /* Implement me! */ } while (0)
91 /*@}*/
92
93 /**
94  * \name Chip select bits for LCD_SET_E()
95  * @{
96  */
97 #define LCDF_E1                   ( 0/* Implement me! */)
98 #define LCDF_E2                   ( 0/* Implement me! */)
99 /*@}*/
100 /** Read from the LCD data bus (DB[0-7]) */
101 #define LCD_WRITE(x)    ((void)x)/* Implement me! */
102 /** Write to the LCD data bus (DB[0-7]) */
103 #define LCD_READ        (0 /* Implement me! */ )
104
105 /** Set data bus direction to output (write to display) */
106 #define LCD_DB_OUT          /* Implement me! */
107
108 /** Set data bus direction to input (read from display) */
109 #define LCD_DB_IN           /* Implement me! */
110
111 /** Delay for write (Enable pulse width, 220ns) */
112 #define LCD_DELAY_WRITE \
113         do { \
114                 NOP; \
115                 NOP; \
116                 NOP; \
117                 NOP; \
118                 NOP; \
119         } while (0)
120
121 /** Delay for read (Data ouput delay time, 120ns) */
122 #define LCD_DELAY_READ \
123         do { \
124                 NOP; \
125                 NOP; \
126                 NOP; \
127                 NOP; \
128         } while (0)
129
130
131 #define LCD_32122_RESET()         do { /* Implement me! */ } while (0)
132
133 INLINE void lcd_32122a_hw_bus_init(void)
134 {
135         cpu_flags_t flags;
136         IRQ_SAVE_DISABLE(flags);
137
138         /*
139          * Here set bus pin!
140          * to init a lcd device.
141          *
142          */
143
144         /*
145          * Data bus is in output state most of the time:
146          * LCD r/w functions assume it is left in output state
147          */
148         LCD_DB_OUT;
149
150
151         IRQ_RESTORE(flags);
152 }
153
154 #endif /* HW_LCD_32122A_H */
155