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