diff options
author | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2010-01-19 09:11:34 +0000 |
---|---|---|
committer | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2010-01-19 09:11:34 +0000 |
commit | de592aa6f1a466df53a687173918f2e24a54a925 (patch) | |
tree | ad5a0d3da8d59ba0ab2a2ce34a14ac041b46e43a /c/src/libchip | |
parent | Update for block device API change. (diff) | |
download | rtems-de592aa6f1a466df53a687173918f2e24a54a925.tar.bz2 |
tqm8xx BSP fixes
Diffstat (limited to 'c/src/libchip')
-rw-r--r-- | c/src/libchip/display/disp_hcms29xx.c | 72 | ||||
-rw-r--r-- | c/src/libchip/display/disp_hcms29xx.h | 94 | ||||
-rw-r--r-- | c/src/libchip/display/font_hcms29xx.c | 2 | ||||
-rw-r--r-- | c/src/libchip/display/font_hcms29xx.h | 2 |
4 files changed, 126 insertions, 44 deletions
diff --git a/c/src/libchip/display/disp_hcms29xx.c b/c/src/libchip/display/disp_hcms29xx.c index 3cb850fb90..cd4a7aaf41 100644 --- a/c/src/libchip/display/disp_hcms29xx.c +++ b/c/src/libchip/display/disp_hcms29xx.c @@ -33,7 +33,7 @@ #include <rtems/libio.h> #include <bsp.h> #include <rtems/libi2c.h> -#include "disp_hcms29xx.h" +#include <libchip/disp_hcms29xx.h> #include "font_hcms29xx.h" #define FONT_BASE font_hcms29xx_base @@ -59,6 +59,8 @@ const rtems_libi2c_tfr_mode_t spi_disphcms29xx_tfr_mode = { .idle_char = 0 }; +static disp_hcms29xx_drv_t disp_hcms29xx_drv_tbl; + /*========================================= * font management functions */ @@ -544,7 +546,7 @@ static rtems_task disp_hcms29xx_update_task +---------------------------------------------------------------------------+ | Input Parameters: | \*-------------------------------------------------------------------------*/ - rtems_task_argument argument /* softc_ptr */ + rtems_task_argument argument ) /*-------------------------------------------------------------------------*\ | Return Value: | @@ -555,7 +557,7 @@ static rtems_task disp_hcms29xx_update_task rtems_status_code rc = RTEMS_SUCCESSFUL; int disp_offset = 0; rtems_id disp_hcms29xx_timer_id; - disp_hcms29xx_drv_t *softc_ptr = (disp_hcms29xx_drv_t *)argument; + disp_hcms29xx_drv_t *softc_ptr = &disp_hcms29xx_drv_tbl; /* * initialize display: @@ -748,11 +750,7 @@ rtems_device_driver disp_hcms29xx_dev_initialize */ { rtems_status_code rc = RTEMS_SUCCESSFUL; - static char *devname = {"/dev/disp"}; - disp_hcms29xx_drv_t *softc_ptr = NULL; - /* - * FIXME: get softc_ptr - */ + disp_hcms29xx_drv_t *softc_ptr = &disp_hcms29xx_drv_tbl; /* * initialize font management @@ -803,13 +801,7 @@ rtems_device_driver disp_hcms29xx_dev_initialize } if (rc == RTEMS_SUCCESSFUL) { rc = rtems_task_start(softc_ptr->disp_param.task_id, - disp_hcms29xx_update_task, 0 ); - } - /* - * Register the device - */ - if (rc == RTEMS_SUCCESSFUL) { - rc = rtems_io_register_name (devname, major, 0); + disp_hcms29xx_update_task,0); } return rc; } @@ -834,10 +826,7 @@ rtems_device_driver disp_hcms29xx_dev_open | rtems_status_code | \*=========================================================================*/ { - disp_hcms29xx_drv_t *softc_ptr = NULL; - /* - * FIXME: get softc_ptr - */ + disp_hcms29xx_drv_t *softc_ptr = &disp_hcms29xx_drv_tbl; /* * ensure, that disp_hcms29xx device is assumed to be empty */ @@ -868,10 +857,7 @@ rtems_device_driver disp_hcms29xx_dev_write { rtems_libio_rw_args_t *args = arg; uint32_t cnt; - disp_hcms29xx_drv_t *softc_ptr = NULL; - /* - * FIXME: get softc_ptr - */ + disp_hcms29xx_drv_t *softc_ptr = &disp_hcms29xx_drv_tbl; for (cnt = 0;cnt < args->count;cnt++) { /* @@ -924,22 +910,30 @@ rtems_device_driver disp_hcms29xx_dev_close | rtems_status_code | \*=========================================================================*/ { - disp_hcms29xx_drv_t *softc_ptr = NULL; - /* - * FIXME: get softc_ptr - */ - return RTEMS_NOT_IMPLEMENTED; - - /* flush buffer, if not empty */ - if (softc_ptr->disp_param.dev_buf_cnt > 0) { - softc_ptr->disp_param.dev_buffer[softc_ptr->disp_param.dev_buf_cnt] = - '\0'; - /* - * transfer string to display string, redisplay it... - */ - disp_hcms29xx_update(softc_ptr,softc_ptr->disp_param.dev_buffer); - softc_ptr->disp_param.dev_buf_cnt = 0; - } return RTEMS_SUCCESSFUL; } + +/* + * driver operation tables + */ +static rtems_driver_address_table disp_hcms29xx_ops = { + initialization_entry: disp_hcms29xx_dev_initialize, + open_entry: disp_hcms29xx_dev_open, + write_entry: disp_hcms29xx_dev_write, + close_entry: disp_hcms29xx_dev_close +}; + + +static disp_hcms29xx_drv_t disp_hcms29xx_drv_tbl = { + {/* public fields */ + ops: &disp_hcms29xx_ops, + size: sizeof (disp_hcms29xx_drv_t), + }, + { /* our private fields */ + } +}; + +rtems_libi2c_drv_t *disp_hcms29xx_driver_descriptor = + &disp_hcms29xx_drv_tbl.libi2c_drv_entry; + diff --git a/c/src/libchip/display/disp_hcms29xx.h b/c/src/libchip/display/disp_hcms29xx.h index 332d46562d..6898205c07 100644 --- a/c/src/libchip/display/disp_hcms29xx.h +++ b/c/src/libchip/display/disp_hcms29xx.h @@ -32,7 +32,7 @@ extern "C" { #define DISP_HCMS29XX_TEXT_CNT (128) typedef struct { - rtems_device_major_number minor; /* minor device number */ + rtems_device_minor_number minor; /* minor device number */ /* * in the disp_buffer, the string to be displayed is placed */ @@ -60,8 +60,98 @@ extern "C" { /* * pass this descriptor pointer to rtems_libi2c_register_drv */ - extern rtems_libi2c_drv_t *disp_hcms29xx__driver_descriptor; + extern rtems_libi2c_drv_t *disp_hcms29xx_driver_descriptor; +/*=========================================================================*\ +| Function: | +\*-------------------------------------------------------------------------*/ +rtems_device_driver disp_hcms29xx_dev_initialize + ( +/*-------------------------------------------------------------------------*\ +| Purpose: | +| prepare the display device driver to accept write calls | +| register device with its name | ++---------------------------------------------------------------------------+ +| Input Parameters: | +\*-------------------------------------------------------------------------*/ + rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg + ); +/*-------------------------------------------------------------------------*\ +| Return Value: | +| rtems_status_code | +\*=========================================================================*/ + +/*=========================================================================*\ +| Function: | +\*-------------------------------------------------------------------------*/ +rtems_device_driver disp_hcms29xx_dev_open +( +/*-------------------------------------------------------------------------*\ +| Purpose: | +| open the display device | ++---------------------------------------------------------------------------+ +| Input Parameters: | +\*-------------------------------------------------------------------------*/ + rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg + ); +/*-------------------------------------------------------------------------*\ +| Return Value: | +| rtems_status_code | +\*=========================================================================*/ + +/*=========================================================================*\ +| Function: | +\*-------------------------------------------------------------------------*/ +rtems_device_driver disp_hcms29xx_dev_write +( +/*-------------------------------------------------------------------------*\ +| Purpose: | +| write to display device | ++---------------------------------------------------------------------------+ +| Input Parameters: | +\*-------------------------------------------------------------------------*/ + rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg + ); +/*-------------------------------------------------------------------------*\ +| Return Value: | +| rtems_status_code | +\*=========================================================================*/ + +/*=========================================================================*\ +| Function: | +\*-------------------------------------------------------------------------*/ +rtems_device_driver disp_hcms29xx_dev_close +( +/*-------------------------------------------------------------------------*\ +| Purpose: | +| close the display device | ++---------------------------------------------------------------------------+ +| Input Parameters: | +\*-------------------------------------------------------------------------*/ + rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg + ); +/*-------------------------------------------------------------------------*\ +| Return Value: | +| rtems_status_code | +\*=========================================================================*/ + +#define DISP_HCMS29XX_DRIVER { \ + disp_hcms29xx_dev_initialize, \ + disp_hcms29xx_dev_open, \ + NULL, \ + disp_hcms29xx_dev_write, \ + NULL, \ + disp_hcms29xx_dev_close} + + #ifdef __cplusplus } #endif diff --git a/c/src/libchip/display/font_hcms29xx.c b/c/src/libchip/display/font_hcms29xx.c index 3838e1f3e2..1262af9043 100644 --- a/c/src/libchip/display/font_hcms29xx.c +++ b/c/src/libchip/display/font_hcms29xx.c @@ -1560,7 +1560,7 @@ struct disp_font_glyph glyph_hp_fixed_5_7_127 = { 5, 0, bitmap_hp_fixed_5_7_127, }; -const struct disp_font_base font_base_hp_fixed_5_7 = { +const struct disp_font_base font_hcms29xx_base = { 1, /* trans */ {5, 7, 0, -1}, /* fbb w, h, x, y */ 7, 0, /* ascent, descent */ diff --git a/c/src/libchip/display/font_hcms29xx.h b/c/src/libchip/display/font_hcms29xx.h index 486cfeaeea..d0e67bbbcb 100644 --- a/c/src/libchip/display/font_hcms29xx.h +++ b/c/src/libchip/display/font_hcms29xx.h @@ -31,8 +31,6 @@ extern "C" { #endif -extern disp_font_t font_hcms29xx; - extern struct disp_font_base font_hcms29xx_base; #ifdef __cplusplus |