mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 22:54:14 +08:00
tqm8xx BSP fixes
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2010-01-18 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||
|
||||
* configure.ac, console/console.c, include/bsp.h, irq/irq.c,
|
||||
spi/spi.c: various fixes
|
||||
|
||||
2009-12-16 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||
|
||||
* console/console.c: adapted to new prototype for *_write
|
||||
|
||||
@@ -51,7 +51,7 @@ RTEMS_BSPOPTS_HELP([PRINTK_CHN],
|
||||
each other.])
|
||||
|
||||
RTEMS_BSPOPTS_SET([CONS_SMC1_MODE],[tqm8xx_stk8xx],[CONS_MODE_POLLED])
|
||||
RTEMS_BSPOPTS_SET([CONS_SMC1_MODE],[pghplus],[CONS_MODE_POLLED])
|
||||
RTEMS_BSPOPTS_SET([CONS_SMC1_MODE],[pghplus],[CONS_MODE_IRQ])
|
||||
RTEMS_BSPOPTS_SET([CONS_SMC1_MODE],[*],[CONS_MODE_UNUSED])
|
||||
RTEMS_BSPOPTS_HELP([CONS_SMC1_MODE],
|
||||
[(BSP--SMC1 UART IF mode) Must be defined if SMC1 is used as a tty (UART)
|
||||
@@ -89,6 +89,24 @@ RTEMS_BSPOPTS_HELP([CONS_SCC4_MODE],
|
||||
channel. Set it to CONS_MODE_POLLED for polled operation, CONS_MODE_IRQ for
|
||||
interrupt driven (spooled) operation. Set it to CONS_MODE_UNUSED, if not used])
|
||||
|
||||
RTEMS_BSPOPTS_SET([SPI_BOARD_INIT_FNC],[pghplus],[bsp_pghplus_spi_init])
|
||||
RTEMS_BSPOPTS_SET([SPI_BOARD_INIT_FNC],[*],[bsp_dummy_spi_init])
|
||||
RTEMS_BSPOPTS_HELP([SPI_BOARD_INIT_FNC],
|
||||
[(BSP--SPI board init function) Specify the function that inits the board
|
||||
port lines and further devices.])
|
||||
|
||||
RTEMS_BSPOPTS_SET([SPI_SEND_STOP_FNC],[pghplus],[bsp_pghplus_spi_send_stop])
|
||||
RTEMS_BSPOPTS_SET([SPI_SEND_STOP_FNC],[*],[bsp_dummy_spi_send_stop])
|
||||
RTEMS_BSPOPTS_HELP([SPI_SEND_STOP_FNC],
|
||||
[(BSP--SPI send stop function) Specify the function that deaddresses SPI
|
||||
devices. Set to bsp_dummy_spi_send_stop for dummy implementation])
|
||||
|
||||
RTEMS_BSPOPTS_SET([SPI_SEND_ADDR_FNC],[pghplus],[bsp_pghplus_spi_sel_addr])
|
||||
RTEMS_BSPOPTS_SET([SPI_SEND_ADDR_FNC],[*],[bsp_dummy_spi_sel_addr])
|
||||
RTEMS_BSPOPTS_HELP([SPI_SEND_ADDR_FNC],
|
||||
[(BSP--SPI send address function) Specify the function that addresses SPI
|
||||
devices. Set to bsp_dummy_spi_sel_addr for dummy implementation])
|
||||
|
||||
# add selection of primary network interface
|
||||
RTEMS_BSPOPTS_SET([BSP_USE_NETWORK_FEC],[pghplus],[1])
|
||||
RTEMS_BSPOPTS_SET([BSP_USE_NETWORK_FEC],[*],[0])
|
||||
|
||||
@@ -499,19 +499,21 @@ sccInterruptHandler (void *arg)
|
||||
static void
|
||||
mpc8xx_console_irq_on(const rtems_irq_connect_data *irq)
|
||||
{
|
||||
CHN_MASK_SET(irq->name,3); /* Enable TX and RX interrupts */
|
||||
CHN_MASK_SET(irq->name - BSP_CPM_IRQ_LOWEST_OFFSET,
|
||||
3); /* Enable TX and RX interrupts */
|
||||
}
|
||||
|
||||
static void
|
||||
mpc8xx_console_irq_off(const rtems_irq_connect_data *irq)
|
||||
{
|
||||
CHN_MASK_SET(irq->name,0); /* Disable TX and RX interrupts */
|
||||
CHN_MASK_SET(irq->name - BSP_CPM_IRQ_LOWEST_OFFSET,
|
||||
0); /* Disable TX and RX interrupts */
|
||||
}
|
||||
|
||||
static int
|
||||
mpc8xx_console_irq_isOn(const rtems_irq_connect_data *irq)
|
||||
{
|
||||
return (0 != CHN_MASK_GET(irq->name)); /* Check TX and RX interrupts */
|
||||
return (0 != CHN_MASK_GET(irq->name - BSP_CPM_IRQ_LOWEST_OFFSET)); /* Check TX and RX interrupts */
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -131,6 +131,21 @@ extern int rtems_scc_enet_driver_attach (struct rtems_bsdnet_ifconfig *config,
|
||||
*/
|
||||
#undef RTEMS_BSP_HAS_IDE_DRIVER
|
||||
|
||||
/*
|
||||
* SPI driver configuration
|
||||
*/
|
||||
|
||||
/* select values for SPI addressing */
|
||||
#define PGHPLUS_SPI_ADDR_EEPROM 0
|
||||
#define PGHPLUS_SPI_ADDR_DISP4 1
|
||||
/* NOTE: DISP4 occupies two consecutive addresses for data and control port */
|
||||
#define PGHPLUS_SPI_ADDR_DISP4_DATA (PGHPLUS_SPI_ADDR_DISP4)
|
||||
#define PGHPLUS_SPI_ADDR_DISP4_CTRL (PGHPLUS_SPI_ADDR_DISP4_DATA+1)
|
||||
|
||||
/* bit masks for Port B lines */
|
||||
#define PGHPLUS_PB_SPI_EEP_CE_MSK (1<< 0)
|
||||
#define PGHPLUS_PB_SPI_DISP4_RS_MSK (1<<15)
|
||||
#define PGHPLUS_PB_SPI_DISP4_CE_MSK (1<<14)
|
||||
/*
|
||||
* our (internal) bus frequency
|
||||
*/
|
||||
|
||||
@@ -52,14 +52,14 @@ rtems_status_code bsp_irq_enable_at_SIU(rtems_vector_number irqnum)
|
||||
rtems_status_code bsp_irq_disable_at_CPM(rtems_vector_number irqnum)
|
||||
{
|
||||
rtems_vector_number vecnum = irqnum - BSP_CPM_IRQ_LOWEST_OFFSET;
|
||||
m8xx.cimr &= ~(1 << (31 - vecnum));
|
||||
m8xx.cimr &= ~(1 << (vecnum));
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_irq_enable_at_CPM(rtems_vector_number irqnum)
|
||||
{
|
||||
rtems_vector_number vecnum = irqnum - BSP_CPM_IRQ_LOWEST_OFFSET;
|
||||
m8xx.cimr |= (1 << (31 - vecnum));
|
||||
m8xx.cimr |= (1 << (vecnum));
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -193,10 +193,12 @@ rtems_status_code mpc8xx_cpic_initialize( void)
|
||||
/*
|
||||
* make sure CPIC request proper level at SIU interrupt controller
|
||||
*/
|
||||
m8xx.cicr = (0x00e41f00 |
|
||||
m8xx.cicr = (0x00e41f80 |
|
||||
((BSP_CPM_INTERRUPT/2) << 13));
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
/*
|
||||
* enable CPIC interrupt in SIU interrupt controller
|
||||
*/
|
||||
return bsp_irq_enable_at_SIU(BSP_CPM_INTERRUPT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <bsp.h>
|
||||
#include <mpc8xx.h>
|
||||
#include "spi.h"
|
||||
#include <bsp/spi.h>
|
||||
#include <libchip/disp_hcms29xx.h>
|
||||
#include <rtems/error.h>
|
||||
#include <rtems/bspIo.h>
|
||||
#include <errno.h>
|
||||
@@ -625,7 +626,7 @@ int m8xx_spi_ioctl
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_spi_sel_addr
|
||||
static rtems_status_code bsp_dummy_spi_sel_addr
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
@@ -639,44 +640,16 @@ static rtems_status_code bsp_spi_sel_addr
|
||||
)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Return Value: |
|
||||
| o = ok or error code |
|
||||
| rtems_status_code |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
#if defined(PGH360)
|
||||
/*
|
||||
* select given device
|
||||
*/
|
||||
/*
|
||||
* GPIO1[24] is SPI_A0
|
||||
* GPIO1[25] is SPI_A1
|
||||
* GPIO1[26] is SPI_A2
|
||||
* set pins to address
|
||||
*/
|
||||
switch(addr) {
|
||||
case PGH360_SPI_ADDR_EEPROM:
|
||||
m8xx.pbdat &= ~PGH360_PB_SPI_EEP_CE_MSK;
|
||||
break;
|
||||
case PGH360_SPI_ADDR_DISP4_DATA:
|
||||
m8xx.pbdat = (m8xx.pbdat
|
||||
& ~(PGH360_PB_SPI_DISP4_CE_MSK |
|
||||
PGH360_PB_SPI_DISP4_RS_MSK));
|
||||
break;
|
||||
case PGH360_SPI_ADDR_DISP4_CTRL:
|
||||
m8xx.pbdat = (m8xx.pbdat
|
||||
& ~(PGH360_PB_SPI_DISP4_CE_MSK)
|
||||
| PGH360_PB_SPI_DISP4_RS_MSK);
|
||||
break;
|
||||
default:
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
}
|
||||
#endif /* PGH360 */
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_spi_send_start_dummy
|
||||
static rtems_status_code bsp_dummy_spi_send_start
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
@@ -691,13 +664,83 @@ static rtems_status_code bsp_spi_send_start_dummy
|
||||
| o = ok or error code |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
return 0;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_spi_send_stop
|
||||
static rtems_status_code bsp_dummy_spi_send_stop
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
| deselect SPI |
|
||||
+---------------------------------------------------------------------------+
|
||||
| Input Parameters: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
rtems_libi2c_bus_t *bh /* bus specifier structure */
|
||||
)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Return Value: |
|
||||
| o = ok or error code |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_pghplus_spi_sel_addr
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
| address a slave device on the bus |
|
||||
+---------------------------------------------------------------------------+
|
||||
| Input Parameters: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
rtems_libi2c_bus_t *bh, /* bus specifier structure */
|
||||
uint32_t addr, /* address to send on bus */
|
||||
int rw /* 0=write,1=read */
|
||||
)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Return Value: |
|
||||
| rtems_status_code |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
#if defined(PGHPLUS)
|
||||
pbdat_val = m8xx.pbdat | (PGHPLUS_SPI_PB_DISP4_RS_MSK |
|
||||
PGHPLUS_SPI_PB_DISP4_CE_MSK |
|
||||
PGHPLUS_SPI_PB_EEP_CE_MSK);
|
||||
/*
|
||||
* select given device
|
||||
*/
|
||||
switch(addr) {
|
||||
case PGHPLUS_SPI_ADDR_EEPROM:
|
||||
pbdat_val &= ~PGHPLUS_SPI_PB_EEP_CE_MSK;
|
||||
break;
|
||||
case PGHPLUS_SPI_ADDR_DISP4_DATA:
|
||||
pbdat_val = (m8xx.pbdat
|
||||
& ~(PGHPLUS_PB_SPI_DISP4_CE_MSK |
|
||||
PGHPLUS_PB_SPI_DISP4_RS_MSK));
|
||||
break;
|
||||
case PGHPLUS_SPI_ADDR_DISP4_CTRL:
|
||||
pbdat_val = (m8xx.pbdat
|
||||
& ~(PGHPLUS_PB_SPI_DISP4_CE_MSK)
|
||||
| PGHPLUS_PB_SPI_DISP4_RS_MSK);
|
||||
break;
|
||||
default:
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
}
|
||||
m8xx_pbdat = pbdat_val
|
||||
#endif /* PGHPLUS */
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_pghplus_spi_send_stop
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
@@ -713,17 +756,120 @@ static rtems_status_code bsp_spi_send_stop
|
||||
\*=========================================================================*/
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
printk("bsp_spi_send_stop called... ");
|
||||
printk("bsp_pghplus_spi_send_stop called... ");
|
||||
#endif
|
||||
#if defined(PGH360)
|
||||
m8xx.pbdat = (m8xx.pbdat
|
||||
| PGH360_PB_SPI_DISP4_CE_MSK
|
||||
| PGH360_PB_SPI_EEP_CE_MSK);
|
||||
#endif
|
||||
| PGHPLUS_PB_SPI_DISP4_CE_MSK
|
||||
| PGHPLUS_PB_SPI_EEP_CE_MSK);
|
||||
#if defined(DEBUG)
|
||||
printk("... exit OK\r\n");
|
||||
#endif
|
||||
return 0;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_pghplus_spi_init
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
| do board specific init: |
|
||||
| - initialize pins for addressing |
|
||||
| - register further drivers |
|
||||
+---------------------------------------------------------------------------+
|
||||
| Input Parameters: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
int spi_busno
|
||||
)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Return Value: |
|
||||
| o = ok or error code |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
int ret_code;
|
||||
|
||||
#if defined(DEBUG)
|
||||
printk("bsp_pghplus_spi_init called... ");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* init port pins used to address/select SPI devices
|
||||
*/
|
||||
|
||||
/*
|
||||
* set up ports
|
||||
* LINE PAR DIR DAT
|
||||
* -----------------------
|
||||
* EEP_CE 0 1 act-high
|
||||
* DISP4_CS 0 1 act-high
|
||||
* DISP4_RS 0 1 active
|
||||
*/
|
||||
|
||||
/* set Port B Pin Assignment Register... */
|
||||
m8xx.pbpar =
|
||||
(m8xx.pbpar
|
||||
& ~(PGHPLUS_PB_SPI_EEP_CE_MSK
|
||||
| PGHPLUS_PB_SPI_DISP4_CE_MSK
|
||||
| PGHPLUS_PB_SPI_DISP4_RS_MSK));
|
||||
|
||||
/* set Port B Data Direction Register... */
|
||||
m8xx.pbdir =
|
||||
m8xx.pbdir
|
||||
| PGHPLUS_PB_SPI_EEP_CE_MSK
|
||||
| PGHPLUS_PB_SPI_DISP4_CE_MSK
|
||||
| PGHPLUS_PB_SPI_DISP4_RS_MSK;
|
||||
|
||||
/* set Port B Data Register to inactive CE state */
|
||||
m8xx.pbdat =
|
||||
m8xx.pbdat
|
||||
| PGHPLUS_PB_SPI_DISP4_CE_MSK
|
||||
| PGHPLUS_PB_SPI_DISP4_RS_MSK;
|
||||
|
||||
/*
|
||||
* register devices
|
||||
*/
|
||||
ret_code = rtems_libi2c_register_drv("disp",
|
||||
disp_hcms29xx_driver_descriptor,
|
||||
spi_busno,PGHPLUS_SPI_ADDR_DISP4);
|
||||
if (ret_code < 0) {
|
||||
return -ret_code;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
printk("... exit OK\r\n");
|
||||
#endif
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
| Function: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static rtems_status_code bsp_dummy_spi_init
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
| do board specific init: |
|
||||
| - initialize pins for addressing |
|
||||
| - register further drivers |
|
||||
+---------------------------------------------------------------------------+
|
||||
| Input Parameters: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
int spi_busno
|
||||
)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Return Value: |
|
||||
| o = ok or error code |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
printk("bsp_dummy_spi_init called... ");
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
printk("... exit OK\r\n");
|
||||
#endif
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
@@ -732,9 +878,9 @@ static rtems_status_code bsp_spi_send_stop
|
||||
|
||||
rtems_libi2c_bus_ops_t bsp_spi_ops = {
|
||||
init: m8xx_spi_init,
|
||||
send_start: bsp_spi_send_start_dummy,
|
||||
send_stop: bsp_spi_send_stop,
|
||||
send_addr: bsp_spi_sel_addr,
|
||||
send_start: bsp_dummy_spi_send_start,
|
||||
send_stop: SPI_SEND_STOP_FNC,
|
||||
send_addr: SPI_SEND_ADDR_FNC,
|
||||
read_bytes: m8xx_spi_read_bytes,
|
||||
write_bytes: m8xx_spi_write_bytes,
|
||||
ioctl: m8xx_spi_ioctl
|
||||
@@ -780,41 +926,6 @@ rtems_status_code bsp_register_spi
|
||||
*/
|
||||
rtems_libi2c_initialize ();
|
||||
|
||||
/*
|
||||
* init port pins used to address/select SPI devices
|
||||
*/
|
||||
|
||||
#if defined(PGH360)
|
||||
|
||||
/*
|
||||
* set up ports
|
||||
* LINE PAR DIR DAT
|
||||
* -----------------------
|
||||
* EEP_CE 0 1 act-high
|
||||
* DISP4_CS 0 1 act-high
|
||||
* DISP4_RS 0 1 active
|
||||
*/
|
||||
|
||||
/* set Port B Pin Assignment Register... */
|
||||
m8xx.pbpar =
|
||||
(m8xx.pbpar
|
||||
& ~(PGH360_PB_SPI_EEP_CE_MSK
|
||||
| PGH360_PB_SPI_DISP4_CE_MSK
|
||||
| PGH360_PB_SPI_DISP4_RS_MSK));
|
||||
|
||||
/* set Port B Data Direction Register... */
|
||||
m8xx.pbdir =
|
||||
m8xx.pbdir
|
||||
| PGH360_PB_SPI_EEP_CE_MSK
|
||||
| PGH360_PB_SPI_DISP4_CE_MSK
|
||||
| PGH360_PB_SPI_DISP4_RS_MSK;
|
||||
|
||||
/* set Port B Data Register to inactive CE state */
|
||||
m8xx.pbdat =
|
||||
m8xx.pbdat
|
||||
| PGH360_PB_SPI_DISP4_CE_MSK
|
||||
| PGH360_PB_SPI_DISP4_RS_MSK;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* register SPI bus
|
||||
@@ -825,23 +936,12 @@ rtems_status_code bsp_register_spi
|
||||
return -ret_code;
|
||||
}
|
||||
spi_busno = ret_code;
|
||||
#if defined(PGH360)
|
||||
/*
|
||||
* register devices
|
||||
*/
|
||||
#if 0
|
||||
ret_code = rtems_libi2c_register_drv(RTEMS_BSP_SPI_FLASH_DEVICE_NAME,
|
||||
spi_flash_m25p40_rw_driver_descriptor,
|
||||
spi_busno,0x00);
|
||||
if (ret_code < 0) {
|
||||
return -ret_code;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(PGH360) */
|
||||
|
||||
SPI_BOARD_INIT_FNC(spi_busno);
|
||||
/*
|
||||
* FIXME: further drivers, when available
|
||||
*/
|
||||
return 0;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern disp_font_t font_hcms29xx;
|
||||
|
||||
extern struct disp_font_base font_hcms29xx_base;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user