1 | /*===============================================================*\ |
---|
2 | | Project: display driver for HCMS29xx | |
---|
3 | +-----------------------------------------------------------------+ |
---|
4 | | File: disp_hcms29xx.h | |
---|
5 | +-----------------------------------------------------------------+ |
---|
6 | | Copyright (c) 2008 | |
---|
7 | | Embedded Brains GmbH | |
---|
8 | | Obere Lagerstr. 30 | |
---|
9 | | D-82178 Puchheim | |
---|
10 | | Germany | |
---|
11 | | rtems@embedded-brains.de | |
---|
12 | +-----------------------------------------------------------------+ |
---|
13 | | The license and distribution terms for this file may be | |
---|
14 | | found in the file LICENSE in this distribution or at | |
---|
15 | | http://www.rtems.com/license/LICENSE. | |
---|
16 | +-----------------------------------------------------------------+ |
---|
17 | | this file declares the SPI based driver for a HCMS29xx 4 digit | |
---|
18 | | alphanumeric LED display | |
---|
19 | \*===============================================================*/ |
---|
20 | |
---|
21 | #ifndef _DISP_HCMS29XX_H |
---|
22 | #define _DISP_HCMS29XX_H |
---|
23 | #include <rtems.h> |
---|
24 | #include <time.h> |
---|
25 | |
---|
26 | #ifdef __cplusplus |
---|
27 | extern "C" { |
---|
28 | #endif |
---|
29 | #define DISP_HCMS29XX_TEXT_CNT (128) |
---|
30 | |
---|
31 | typedef struct { |
---|
32 | rtems_device_minor_number minor; /* minor device number */ |
---|
33 | /* |
---|
34 | * in the disp_buffer, the string to be displayed is placed |
---|
35 | */ |
---|
36 | char disp_buffer[DISP_HCMS29XX_TEXT_CNT]; |
---|
37 | int disp_buf_cnt; /* number of valid chars in disp_buffer */ |
---|
38 | /* |
---|
39 | * in the trns buffer the string is transfered to display task |
---|
40 | */ |
---|
41 | char trns_buffer[DISP_HCMS29XX_TEXT_CNT]; |
---|
42 | /* |
---|
43 | * in the dev_buffer, characters will be accumulated before display... |
---|
44 | */ |
---|
45 | char dev_buffer[DISP_HCMS29XX_TEXT_CNT]; |
---|
46 | int dev_buf_cnt; /* number of valid chars in dev_buffer */ |
---|
47 | |
---|
48 | rtems_id trns_sema_id; /* ID of disp trns buffer sema */ |
---|
49 | rtems_id task_id; /* ID of disp task */ |
---|
50 | bool rotate; /* FLAG: display is upside down */ |
---|
51 | } spi_disp_hcms29xx_param_t; |
---|
52 | |
---|
53 | typedef struct { |
---|
54 | rtems_libi2c_drv_t libi2c_drv_entry; |
---|
55 | spi_disp_hcms29xx_param_t disp_param; |
---|
56 | } disp_hcms29xx_drv_t; |
---|
57 | /* |
---|
58 | * pass this descriptor pointer to rtems_libi2c_register_drv |
---|
59 | */ |
---|
60 | extern rtems_libi2c_drv_t *disp_hcms29xx_driver_descriptor; |
---|
61 | |
---|
62 | /*=========================================================================*\ |
---|
63 | | Function: | |
---|
64 | \*-------------------------------------------------------------------------*/ |
---|
65 | rtems_device_driver disp_hcms29xx_dev_initialize |
---|
66 | ( |
---|
67 | /*-------------------------------------------------------------------------*\ |
---|
68 | | Purpose: | |
---|
69 | | prepare the display device driver to accept write calls | |
---|
70 | | register device with its name | |
---|
71 | +---------------------------------------------------------------------------+ |
---|
72 | | Input Parameters: | |
---|
73 | \*-------------------------------------------------------------------------*/ |
---|
74 | rtems_device_major_number major, |
---|
75 | rtems_device_minor_number minor, |
---|
76 | void *arg |
---|
77 | ); |
---|
78 | /*-------------------------------------------------------------------------*\ |
---|
79 | | Return Value: | |
---|
80 | | rtems_status_code | |
---|
81 | \*=========================================================================*/ |
---|
82 | |
---|
83 | /*=========================================================================*\ |
---|
84 | | Function: | |
---|
85 | \*-------------------------------------------------------------------------*/ |
---|
86 | rtems_device_driver disp_hcms29xx_dev_open |
---|
87 | ( |
---|
88 | /*-------------------------------------------------------------------------*\ |
---|
89 | | Purpose: | |
---|
90 | | open the display device | |
---|
91 | +---------------------------------------------------------------------------+ |
---|
92 | | Input Parameters: | |
---|
93 | \*-------------------------------------------------------------------------*/ |
---|
94 | rtems_device_major_number major, |
---|
95 | rtems_device_minor_number minor, |
---|
96 | void *arg |
---|
97 | ); |
---|
98 | /*-------------------------------------------------------------------------*\ |
---|
99 | | Return Value: | |
---|
100 | | rtems_status_code | |
---|
101 | \*=========================================================================*/ |
---|
102 | |
---|
103 | /*=========================================================================*\ |
---|
104 | | Function: | |
---|
105 | \*-------------------------------------------------------------------------*/ |
---|
106 | rtems_device_driver disp_hcms29xx_dev_write |
---|
107 | ( |
---|
108 | /*-------------------------------------------------------------------------*\ |
---|
109 | | Purpose: | |
---|
110 | | write to display device | |
---|
111 | +---------------------------------------------------------------------------+ |
---|
112 | | Input Parameters: | |
---|
113 | \*-------------------------------------------------------------------------*/ |
---|
114 | rtems_device_major_number major, |
---|
115 | rtems_device_minor_number minor, |
---|
116 | void *arg |
---|
117 | ); |
---|
118 | /*-------------------------------------------------------------------------*\ |
---|
119 | | Return Value: | |
---|
120 | | rtems_status_code | |
---|
121 | \*=========================================================================*/ |
---|
122 | |
---|
123 | /*=========================================================================*\ |
---|
124 | | Function: | |
---|
125 | \*-------------------------------------------------------------------------*/ |
---|
126 | rtems_device_driver disp_hcms29xx_dev_close |
---|
127 | ( |
---|
128 | /*-------------------------------------------------------------------------*\ |
---|
129 | | Purpose: | |
---|
130 | | close the display device | |
---|
131 | +---------------------------------------------------------------------------+ |
---|
132 | | Input Parameters: | |
---|
133 | \*-------------------------------------------------------------------------*/ |
---|
134 | rtems_device_major_number major, |
---|
135 | rtems_device_minor_number minor, |
---|
136 | void *arg |
---|
137 | ); |
---|
138 | /*-------------------------------------------------------------------------*\ |
---|
139 | | Return Value: | |
---|
140 | | rtems_status_code | |
---|
141 | \*=========================================================================*/ |
---|
142 | |
---|
143 | #define DISP_HCMS29XX_DRIVER { \ |
---|
144 | disp_hcms29xx_dev_initialize, \ |
---|
145 | disp_hcms29xx_dev_open, \ |
---|
146 | NULL, \ |
---|
147 | disp_hcms29xx_dev_write, \ |
---|
148 | NULL, \ |
---|
149 | disp_hcms29xx_dev_close} |
---|
150 | |
---|
151 | |
---|
152 | #ifdef __cplusplus |
---|
153 | } |
---|
154 | #endif |
---|
155 | |
---|
156 | #endif /* _DISP_HCMS29XX_H */ |
---|