RTEMS 6.1-rc6
Loading...
Searching...
No Matches
disp_hcms29xx.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Display driver for HCMS29xx
5 *
6 * This file declares the SPI based driver for a HCMS29xx 4 digit
7 * alphanumeric LED display
8 */
9
10/*
11 * Copyright (c) 2008 embedded brains GmbH & Co. KG
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _DISP_HCMS29XX_H
36#define _DISP_HCMS29XX_H
37#include <rtems.h>
38#include <time.h>
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43#define DISP_HCMS29XX_TEXT_CNT (128)
44
45 typedef struct {
46 rtems_device_minor_number minor; /* minor device number */
47 /*
48 * in the disp_buffer, the string to be displayed is placed
49 */
50 char disp_buffer[DISP_HCMS29XX_TEXT_CNT];
51 int disp_buf_cnt; /* number of valid chars in disp_buffer */
52 /*
53 * in the trns buffer the string is transfered to display task
54 */
55 char trns_buffer[DISP_HCMS29XX_TEXT_CNT];
56 /*
57 * in the dev_buffer, characters will be accumulated before display...
58 */
59 char dev_buffer[DISP_HCMS29XX_TEXT_CNT];
60 int dev_buf_cnt; /* number of valid chars in dev_buffer */
61
62 rtems_id trns_sema_id; /* ID of disp trns buffer sema */
63 rtems_id task_id; /* ID of disp task */
64 bool rotate; /* FLAG: display is upside down */
66
67 typedef struct {
68 rtems_libi2c_drv_t libi2c_drv_entry;
71 /*
72 * pass this descriptor pointer to rtems_libi2c_register_drv
73 */
74 extern rtems_libi2c_drv_t *disp_hcms29xx_driver_descriptor;
75
76/*=========================================================================*\
77| Function: |
78\*-------------------------------------------------------------------------*/
79rtems_device_driver disp_hcms29xx_dev_initialize
80 (
81/*-------------------------------------------------------------------------*\
82| Purpose: |
83| prepare the display device driver to accept write calls |
84| register device with its name |
85+---------------------------------------------------------------------------+
86| Input Parameters: |
87\*-------------------------------------------------------------------------*/
90 void *arg
91 );
92/*-------------------------------------------------------------------------*\
93| Return Value: |
94| rtems_status_code |
95\*=========================================================================*/
96
97/*=========================================================================*\
98| Function: |
99\*-------------------------------------------------------------------------*/
100rtems_device_driver disp_hcms29xx_dev_open
101(
102/*-------------------------------------------------------------------------*\
103| Purpose: |
104| open the display device |
105+---------------------------------------------------------------------------+
106| Input Parameters: |
107\*-------------------------------------------------------------------------*/
110 void *arg
111 );
112/*-------------------------------------------------------------------------*\
113| Return Value: |
114| rtems_status_code |
115\*=========================================================================*/
116
117/*=========================================================================*\
118| Function: |
119\*-------------------------------------------------------------------------*/
120rtems_device_driver disp_hcms29xx_dev_write
121(
122/*-------------------------------------------------------------------------*\
123| Purpose: |
124| write to display device |
125+---------------------------------------------------------------------------+
126| Input Parameters: |
127\*-------------------------------------------------------------------------*/
130 void *arg
131 );
132/*-------------------------------------------------------------------------*\
133| Return Value: |
134| rtems_status_code |
135\*=========================================================================*/
136
137/*=========================================================================*\
138| Function: |
139\*-------------------------------------------------------------------------*/
140rtems_device_driver disp_hcms29xx_dev_close
141(
142/*-------------------------------------------------------------------------*\
143| Purpose: |
144| close the display device |
145+---------------------------------------------------------------------------+
146| Input Parameters: |
147\*-------------------------------------------------------------------------*/
150 void *arg
151 );
152/*-------------------------------------------------------------------------*\
153| Return Value: |
154| rtems_status_code |
155\*=========================================================================*/
156
157#define DISP_HCMS29XX_DRIVER { \
158 disp_hcms29xx_dev_initialize, \
159 disp_hcms29xx_dev_open, \
160 NULL, \
161 disp_hcms29xx_dev_write, \
162 NULL, \
163 disp_hcms29xx_dev_close}
164
165
166#ifdef __cplusplus
167}
168#endif
169
170#endif /* _DISP_HCMS29XX_H */
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition: io.h:103
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:115
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
This header file defines the RTEMS Classic API.
Definition: disp_hcms29xx.h:67
Definition: libi2c.h:297
Definition: disp_hcms29xx.h:45