rename the private field in device to user_data.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1135 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
5d8c15c4bb
commit
4d88d694d5
|
@ -272,7 +272,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -677,7 +677,7 @@ void rt_hw_dm9161_init()
|
|||
dm9161_device.parent.parent.read = rt_dm9161_read;
|
||||
dm9161_device.parent.parent.write = rt_dm9161_write;
|
||||
dm9161_device.parent.parent.control = rt_dm9161_control;
|
||||
dm9161_device.parent.parent.private = RT_NULL;
|
||||
dm9161_device.parent.parent.user_data = RT_NULL;
|
||||
|
||||
dm9161_device.parent.eth_rx = rt_dm9161_rx;
|
||||
dm9161_device.parent.eth_tx = rt_dm9161_tx;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
static rt_err_t rt_serial_init (rt_device_t dev)
|
||||
{
|
||||
struct serial_device* uart = (struct serial_device*) dev->private;
|
||||
struct serial_device* uart = (struct serial_device*) dev->user_data;
|
||||
|
||||
if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED))
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt
|
|||
|
||||
ptr = buffer;
|
||||
err_code = RT_EOK;
|
||||
uart = (struct serial_device*)dev->private;
|
||||
uart = (struct serial_device*)dev->user_data;
|
||||
|
||||
if (dev->flag & RT_DEVICE_FLAG_INT_RX)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf
|
|||
|
||||
err_code = RT_EOK;
|
||||
ptr = (rt_uint8_t*)buffer;
|
||||
uart = (struct serial_device*)dev->private;
|
||||
uart = (struct serial_device*)dev->user_data;
|
||||
|
||||
if (dev->flag & RT_DEVICE_FLAG_INT_TX)
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t
|
|||
device->read = rt_serial_read;
|
||||
device->write = rt_serial_write;
|
||||
device->control = rt_serial_control;
|
||||
device->private = serial;
|
||||
device->user_data = serial;
|
||||
|
||||
/* register a character device */
|
||||
return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
|
||||
|
@ -253,7 +253,7 @@ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t
|
|||
/* ISR for serial interrupt */
|
||||
void rt_hw_serial_isr(rt_device_t device)
|
||||
{
|
||||
struct serial_device* uart = (struct serial_device*) device->private;
|
||||
struct serial_device* uart = (struct serial_device*) device->user_data;
|
||||
|
||||
/* interrupt mode receive */
|
||||
RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -361,7 +361,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -770,7 +770,7 @@ void rt_hw_sdcard_init(void)
|
|||
sdcard_device.control = rt_sdcard_control;
|
||||
|
||||
/* no private */
|
||||
sdcard_device.private = RT_NULL;
|
||||
sdcard_device.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&sdcard_device, "sd0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
|
||||
|
|
|
@ -253,7 +253,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -455,7 +455,7 @@ void lpc17xx_emac_hw_init(void)
|
|||
lpc17xx_emac_device.parent.parent.read = lpc17xx_emac_read;
|
||||
lpc17xx_emac_device.parent.parent.write = lpc17xx_emac_write;
|
||||
lpc17xx_emac_device.parent.parent.control = lpc17xx_emac_control;
|
||||
lpc17xx_emac_device.parent.parent.private = RT_NULL;
|
||||
lpc17xx_emac_device.parent.parent.user_data = RT_NULL;
|
||||
|
||||
lpc17xx_emac_device.parent.eth_rx = lpc17xx_emac_rx;
|
||||
lpc17xx_emac_device.parent.eth_tx = lpc17xx_emac_tx;
|
||||
|
|
|
@ -446,7 +446,7 @@ void rt_hw_sdcard_init()
|
|||
sdcard_device.control = rt_sdcard_control;
|
||||
|
||||
/* no private */
|
||||
sdcard_device.private = &SDCfg;
|
||||
sdcard_device.user_data = &SDCfg;
|
||||
|
||||
rt_device_register(&sdcard_device, "sd0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
|
||||
|
|
|
@ -25,6 +25,7 @@ void LPC17xx_SPI_Init (void)
|
|||
|
||||
dummy = dummy; // avoid warning
|
||||
|
||||
#if 0
|
||||
/* Initialize and enable the SSP0 Interface module. */
|
||||
LPC_SC->PCONP |= (1 << 21); /* Enable power to SSPI0 block */
|
||||
|
||||
|
@ -38,6 +39,24 @@ void LPC17xx_SPI_Init (void)
|
|||
LPC_PINCON->PINSEL0 |= (2UL<<30); /* P0.15 SCK0 */
|
||||
LPC_PINCON->PINSEL1 &= ~((3<<2) | (3<<4)); /* P0.17, P0.18 cleared */
|
||||
LPC_PINCON->PINSEL1 |= ((2<<2) | (2<<4)); /* P0.17 MISO0, P0.18 MOSI0 */
|
||||
#else
|
||||
LPC_SC->PCONP |= (1 << 21); /* Enable power to SSPI0 block */
|
||||
|
||||
/* SSEL is GPIO, output set to high. */
|
||||
LPC_GPIO1->FIODIR |= (1<<21); /* P1.21 is output */
|
||||
LPC_GPIO1->FIOPIN |= (1<<21); /* set P1.21 high (SSEL inact.)*/
|
||||
LPC_PINCON->PINSEL3 &= ~(0<<10); /* P1.21 SSEL (used as GPIO) */
|
||||
|
||||
/* P3.26 is SD Card Power Supply Enable Pin */
|
||||
LPC_GPIO3->FIODIR |= (1<<26); /* P3.26 is output */
|
||||
LPC_GPIO3->FIOPIN &= ~(1<<26); /* set P3.26 low(enable power) */
|
||||
|
||||
/* SCK, MISO, MOSI are SSP pins. */
|
||||
LPC_PINCON->PINSEL3 &= ~(3UL<<8); /* P1.20 cleared */
|
||||
LPC_PINCON->PINSEL3 |= (3UL<<8); /* P1.20 SCK0 */
|
||||
LPC_PINCON->PINSEL3 &= ~((3<<14) | (3<<16)); /* P1.23, P1.24 cleared */
|
||||
LPC_PINCON->PINSEL3 |= ((3<<14) | (3<<16)); /* P1.23 MISO0, P1.24 MOSI0 */
|
||||
#endif
|
||||
|
||||
/* PCLK_SSP0=CCLK */
|
||||
LPC_SC->PCLKSEL1 &= ~(3<<10); /* PCLKSP0 = CCLK/4 (18MHz) */
|
||||
|
@ -64,9 +83,14 @@ void LPC17xx_SPI_DeInit( void )
|
|||
// disable SPI
|
||||
LPC_SSP0->CR1 = 0;
|
||||
|
||||
#if 0
|
||||
// Pins to GPIO
|
||||
LPC_PINCON->PINSEL0 &= ~(3UL<<30);
|
||||
LPC_PINCON->PINSEL1 &= ~((3<<2) | (3<<4));
|
||||
#else
|
||||
LPC_PINCON->PINSEL3 &= ~(3UL<<8); /* P1.20 cleared */
|
||||
LPC_PINCON->PINSEL3 &= ~((3<<14) | (3<<16)); /* P1.23, P1.24 cleared */
|
||||
#endif
|
||||
|
||||
// disable SSP power
|
||||
LPC_SC->PCONP &= ~(1 << 21);
|
||||
|
@ -85,13 +109,21 @@ void LPC17xx_SPI_SetSpeed (uint8_t speed)
|
|||
/* SSEL: low */
|
||||
void LPC17xx_SPI_Select ()
|
||||
{
|
||||
#if 0
|
||||
LPC_GPIO0->FIOPIN &= ~(1<<16);
|
||||
#else
|
||||
LPC_GPIO1->FIOPIN &= ~(1<<21); /* SSEL is GPIO, set to high. */
|
||||
#endif
|
||||
}
|
||||
|
||||
/* SSEL: high */
|
||||
void LPC17xx_SPI_DeSelect ()
|
||||
{
|
||||
#if 0
|
||||
LPC_GPIO0->FIOPIN |= (1<<16);
|
||||
#else
|
||||
LPC_GPIO1->FIOPIN |= (1<<21); /* SSEL is GPIO, set to high. */
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Send one byte then recv one byte of response. */
|
||||
|
@ -101,7 +133,6 @@ static uint8_t LPC17xx_SPI_SendRecvByte (uint8_t byte_s)
|
|||
|
||||
LPC_SSP0->DR = byte_s;
|
||||
while (LPC_SSP0->SR & (1 << SSPSR_BSY) /*BSY*/); /* Wait for transfer to finish */
|
||||
// while( !( LPC_SSP0->SR & ( 1 << SSPSR_RNE ) ) ); /* Wait untill the Rx FIFO is not empty */
|
||||
byte_r = LPC_SSP0->DR;
|
||||
|
||||
return byte_r; /* Return received value */
|
||||
|
|
|
@ -312,7 +312,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -147,7 +147,7 @@ void rt_hw_dm9000_init()
|
|||
dm9000_device.parent.parent.read = rt_dm9000_read;
|
||||
dm9000_device.parent.parent.write = rt_dm9000_write;
|
||||
dm9000_device.parent.parent.control = rt_dm9000_control;
|
||||
dm9000_device.parent.parent.private = RT_NULL;
|
||||
dm9000_device.parent.parent.user_data = RT_NULL;
|
||||
|
||||
dm9000_device.parent.eth_rx = rt_dm9000_rx;
|
||||
dm9000_device.parent.eth_tx = rt_dm9000_tx;
|
||||
|
|
|
@ -57,7 +57,7 @@ void rt_hw_sdcard_init()
|
|||
sd.read = rt_sdcard_read;
|
||||
sd.write = rt_sdcard_write;
|
||||
sd.control = rt_sdcard_control;
|
||||
sd.private = RT_NULL;
|
||||
sd.user_data = RT_NULL;
|
||||
|
||||
/* get the first sector to read partition table */
|
||||
sector = (rt_uint8_t*) rt_malloc (512);
|
||||
|
|
|
@ -277,7 +277,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -629,7 +629,7 @@ void rt_hw_dm9000_init()
|
|||
dm9000_device.parent.parent.read = rt_dm9000_read;
|
||||
dm9000_device.parent.parent.write = rt_dm9000_write;
|
||||
dm9000_device.parent.parent.control = rt_dm9000_control;
|
||||
dm9000_device.parent.parent.private = RT_NULL;
|
||||
dm9000_device.parent.parent.user_data = RT_NULL;
|
||||
|
||||
dm9000_device.parent.eth_rx = rt_dm9000_rx;
|
||||
dm9000_device.parent.eth_tx = rt_dm9000_tx;
|
||||
|
|
|
@ -361,7 +361,7 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
|||
static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
|
||||
{
|
||||
int i;
|
||||
struct dfs_partition *part = (struct dfs_partition *)dev->private;
|
||||
struct dfs_partition *part = (struct dfs_partition *)dev->user_data;
|
||||
|
||||
if ( dev == RT_NULL )
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_
|
|||
static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
|
||||
{
|
||||
int i;
|
||||
struct dfs_partition *part = (struct dfs_partition *)dev->private;
|
||||
struct dfs_partition *part = (struct dfs_partition *)dev->user_data;
|
||||
|
||||
if ( dev == RT_NULL )
|
||||
{
|
||||
|
@ -452,7 +452,7 @@ void rt_hw_sdcard_init()
|
|||
sdcard_device[i].read = rt_sdcard_read;
|
||||
sdcard_device[i].write = rt_sdcard_write;
|
||||
sdcard_device[i].control = rt_sdcard_control;
|
||||
sdcard_device[i].private= &part[i];
|
||||
sdcard_device[i].user_data = &part[i];
|
||||
|
||||
rt_device_register(&sdcard_device[i], dname,
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
|
||||
|
@ -474,7 +474,7 @@ void rt_hw_sdcard_init()
|
|||
sdcard_device[0].read = rt_sdcard_read;
|
||||
sdcard_device[0].write = rt_sdcard_write;
|
||||
sdcard_device[0].control = rt_sdcard_control;
|
||||
sdcard_device[0].private= &part[0];
|
||||
sdcard_device[0].user_data = &part[0];
|
||||
|
||||
rt_device_register(&sdcard_device[0], "sd0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
|
||||
|
|
|
@ -417,7 +417,7 @@ void rtgui_touch_hw_init(void)
|
|||
touch->parent.type = RT_Device_Class_Unknown;
|
||||
touch->parent.init = rtgui_touch_init;
|
||||
touch->parent.control = rtgui_touch_control;
|
||||
touch->parent.private = RT_NULL;
|
||||
touch->parent.user_data = RT_NULL;
|
||||
|
||||
/* create 1/8 second timer */
|
||||
touch->poll_timer = rt_timer_create("touch", touch_timer_fire, RT_NULL,
|
||||
|
|
|
@ -216,7 +216,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
|
@ -569,7 +569,7 @@ void rt_hw_sdcard_init()
|
|||
sd.read = rt_sdcard_read;
|
||||
sd.write = rt_sdcard_write;
|
||||
sd.control = rt_sdcard_control;
|
||||
sd.private = RT_NULL;
|
||||
sd.user_data = RT_NULL;
|
||||
|
||||
AT91C_PIOA_PER = CARD_PWR_PIN; // enable GPIO of CS-pin
|
||||
AT91C_PIOA_CODR = CARD_PWR_PIN; // set high
|
||||
|
|
|
@ -738,7 +738,7 @@ void rt_hw_dm9000_init()
|
|||
dm9000_device.parent.parent.read = rt_dm9000_read;
|
||||
dm9000_device.parent.parent.write = rt_dm9000_write;
|
||||
dm9000_device.parent.parent.control = rt_dm9000_control;
|
||||
dm9000_device.parent.parent.private = RT_NULL;
|
||||
dm9000_device.parent.parent.user_data = RT_NULL;
|
||||
|
||||
dm9000_device.parent.eth_rx = rt_dm9000_rx;
|
||||
dm9000_device.parent.eth_tx = rt_dm9000_tx;
|
||||
|
|
|
@ -896,7 +896,7 @@ void rt_hw_msd_init()
|
|||
sdcard_device.control = rt_msd_control;
|
||||
|
||||
/* no private */
|
||||
sdcard_device.private = RT_NULL;
|
||||
sdcard_device.user_data = RT_NULL;
|
||||
/* get the first sector to read partition table */
|
||||
sector = (rt_uint8_t*) rt_malloc (512);
|
||||
if (sector == RT_NULL)
|
||||
|
|
|
@ -150,7 +150,7 @@ void rt_hw_rtc_init(void)
|
|||
rtc.control = rt_rtc_control;
|
||||
|
||||
/* no private */
|
||||
rtc.private = RT_NULL;
|
||||
rtc.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR);
|
||||
|
||||
|
|
|
@ -3212,7 +3212,7 @@ void rt_hw_sdcard_init()
|
|||
sdcard_device.control = rt_sdcard_control;
|
||||
|
||||
/* no private */
|
||||
sdcard_device.private = &SDCardInfo;
|
||||
sdcard_device.user_data = &SDCardInfo;
|
||||
|
||||
rt_device_register(&sdcard_device, "sd0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);
|
||||
|
|
|
@ -3571,7 +3571,7 @@ void rt_hw_stm32_eth_init()
|
|||
stm32_eth_device.parent.parent.read = rt_stm32_eth_read;
|
||||
stm32_eth_device.parent.parent.write = rt_stm32_eth_write;
|
||||
stm32_eth_device.parent.parent.control = rt_stm32_eth_control;
|
||||
stm32_eth_device.parent.parent.private = RT_NULL;
|
||||
stm32_eth_device.parent.parent.user_data = RT_NULL;
|
||||
|
||||
stm32_eth_device.parent.eth_rx = rt_stm32_eth_rx;
|
||||
stm32_eth_device.parent.eth_tx = rt_stm32_eth_tx;
|
||||
|
|
|
@ -237,7 +237,7 @@ void rt_hw_uart_init(void)
|
|||
uart->parent.read = rt_uart_read;
|
||||
uart->parent.write = rt_uart_write;
|
||||
uart->parent.control = RT_NULL;
|
||||
uart->parent.private = RT_NULL;
|
||||
uart->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&uart->parent,
|
||||
"uart0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX);
|
||||
|
|
Loading…
Reference in New Issue