1.适配更新。
This commit is contained in:
@@ -51,11 +51,11 @@ static struct drv_adc_data adc_drv_data[] =
|
||||
|
||||
static struct drv_adc_channel_data adc_channel_drv_data[] = DRV_ADC_CHANNEL_CONFIG;
|
||||
|
||||
static struct mr_adc adc_dev[mr_array_num(adc_drv_data)];
|
||||
static struct mr_adc adc_dev[MR_ARRAY_NUM(adc_drv_data)];
|
||||
|
||||
static struct drv_adc_channel_data *drv_adc_get_channel_data(int channel)
|
||||
{
|
||||
if (channel >= mr_array_num(adc_channel_drv_data))
|
||||
if (channel >= MR_ARRAY_NUM(adc_channel_drv_data))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -160,12 +160,12 @@ int drv_adc_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(adc_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(adc_dev); index++)
|
||||
{
|
||||
mr_adc_register(&adc_dev[index], adc_name[index], &adc_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_adc_init);
|
||||
MR_INIT_DRV_EXPORT(drv_adc_init);
|
||||
|
||||
#endif /* MR_USING_ADC */
|
||||
|
||||
@@ -41,7 +41,7 @@ static struct mr_pin pin_dev;
|
||||
static struct drv_pin_port_data *drv_pin_get_port_data(int pin)
|
||||
{
|
||||
pin >>= 4;
|
||||
if ((pin >= mr_array_num(pin_port_drv_data)) || (pin_port_drv_data[pin].port == MR_NULL))
|
||||
if ((pin >= MR_ARRAY_NUM(pin_port_drv_data)) || (pin_port_drv_data[pin].port == MR_NULL))
|
||||
{
|
||||
return MR_NULL;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ static struct drv_pin_port_data *drv_pin_get_port_data(int pin)
|
||||
static struct drv_pin_data *drv_pin_get_data(int pin)
|
||||
{
|
||||
pin &= 0x0f;
|
||||
if (pin >= mr_array_num(pin_drv_data))
|
||||
if (pin >= MR_ARRAY_NUM(pin_drv_data))
|
||||
{
|
||||
return MR_NULL;
|
||||
}
|
||||
@@ -362,6 +362,6 @@ int drv_pin_init(void)
|
||||
{
|
||||
return mr_pin_register(&pin_dev, "pin", &pin_drv);
|
||||
}
|
||||
MR_DRV_EXPORT(drv_pin_init);
|
||||
MR_INIT_DRV_EXPORT(drv_pin_init);
|
||||
|
||||
#endif /* MR_USING_PIN */
|
||||
|
||||
@@ -94,7 +94,7 @@ static struct drv_serial_data serial_drv_data[] =
|
||||
#endif /* MR_USING_UART8 */
|
||||
};
|
||||
|
||||
static struct mr_serial serial_dev[mr_array_num(serial_drv_data)];
|
||||
static struct mr_serial serial_dev[MR_ARRAY_NUM(serial_drv_data)];
|
||||
|
||||
static int drv_serial_configure(struct mr_serial *serial, struct mr_serial_config *config)
|
||||
{
|
||||
@@ -170,9 +170,9 @@ static int drv_serial_configure(struct mr_serial *serial, struct mr_serial_confi
|
||||
}
|
||||
}
|
||||
|
||||
switch (config->invert)
|
||||
switch (config->polarity)
|
||||
{
|
||||
case MR_SERIAL_NRZ_NORMAL:
|
||||
case MR_SERIAL_POLARITY_NORMAL:
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -420,12 +420,12 @@ int drv_serial_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(serial_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(serial_dev); index++)
|
||||
{
|
||||
mr_serial_register(&serial_dev[index], serial_name[index], &serial_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_serial_init);
|
||||
MR_INIT_DRV_EXPORT(drv_serial_init);
|
||||
|
||||
#endif /* MR_USING_SERIAL */
|
||||
|
||||
@@ -76,7 +76,7 @@ static struct drv_spi_bus_data spi_bus_drv_data[] =
|
||||
#endif /* MR_USING_SPI6 */
|
||||
};
|
||||
|
||||
static struct mr_spi_bus spi_bus_dev[mr_array_num(spi_bus_drv_data)];
|
||||
static struct mr_spi_bus spi_bus_dev[MR_ARRAY_NUM(spi_bus_drv_data)];
|
||||
|
||||
static int drv_spi_bus_configure(struct mr_spi_bus *spi_bus, struct mr_spi_config *config)
|
||||
{
|
||||
@@ -384,12 +384,12 @@ int drv_spi_bus_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(spi_bus_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(spi_bus_dev); index++)
|
||||
{
|
||||
mr_spi_bus_register(&spi_bus_dev[index], spi_bus_name[index], &spi_bus_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_spi_bus_init);
|
||||
MR_INIT_DRV_EXPORT(drv_spi_bus_init);
|
||||
|
||||
#endif /* MR_USING_SPI */
|
||||
|
||||
@@ -148,7 +148,7 @@ static struct drv_timer_data timer_drv_data[] =
|
||||
#endif /* MR_USING_TIMER14 */
|
||||
};
|
||||
|
||||
static struct mr_timer timer_dev[mr_array_num(timer_drv_data)];
|
||||
static struct mr_timer timer_dev[MR_ARRAY_NUM(timer_drv_data)];
|
||||
|
||||
static struct mr_timer_info timer_info[] =
|
||||
{
|
||||
@@ -497,12 +497,12 @@ int drv_timer_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(timer_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(timer_dev); index++)
|
||||
{
|
||||
mr_timer_register(&timer_dev[index], timer_name[index], &timer_drv[index], &timer_info[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_timer_init);
|
||||
MR_INIT_DRV_EXPORT(drv_timer_init);
|
||||
|
||||
#endif /* MR_USING_TIMER */
|
||||
|
||||
@@ -42,11 +42,11 @@ static struct drv_adc_data adc_drv_data[] =
|
||||
|
||||
static struct drv_adc_channel_data adc_channel_drv_data[] = DRV_ADC_CHANNEL_CONFIG;
|
||||
|
||||
static struct mr_adc adc_dev[mr_array_num(adc_drv_data)];
|
||||
static struct mr_adc adc_dev[MR_ARRAY_NUM(adc_drv_data)];
|
||||
|
||||
static struct drv_adc_channel_data *drv_adc_get_channel_data(int channel)
|
||||
{
|
||||
if (channel >= mr_array_num(adc_channel_drv_data))
|
||||
if (channel >= MR_ARRAY_NUM(adc_channel_drv_data))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -170,12 +170,12 @@ int drv_adc_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(adc_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(adc_dev); index++)
|
||||
{
|
||||
mr_adc_register(&adc_dev[index], adc_name[index], &adc_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_adc_init);
|
||||
MR_INIT_DRV_EXPORT(drv_adc_init);
|
||||
|
||||
#endif /* MR_USING_ADC */
|
||||
|
||||
@@ -23,7 +23,7 @@ static struct mr_dac dac_dev;
|
||||
|
||||
static struct drv_dac_channel_data *drv_dac_get_channel_data(int channel)
|
||||
{
|
||||
if (channel >= mr_array_num(dac_channel_drv_data))
|
||||
if (channel >= MR_ARRAY_NUM(dac_channel_drv_data))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -153,6 +153,6 @@ int drv_dac_init(void)
|
||||
{
|
||||
return mr_dac_register(&dac_dev, "dac1", &dac_drv);
|
||||
}
|
||||
MR_DRV_EXPORT(drv_dac_init);
|
||||
MR_INIT_DRV_EXPORT(drv_dac_init);
|
||||
|
||||
#endif /* MR_USING_DAC */
|
||||
|
||||
@@ -40,7 +40,7 @@ static struct drv_i2c_bus_data i2c_bus_drv_data[] =
|
||||
#endif /* MR_USING_I2C2 */
|
||||
};
|
||||
|
||||
static struct mr_i2c_bus i2c_bus_dev[mr_array_num(i2c_bus_drv_data)];
|
||||
static struct mr_i2c_bus i2c_bus_dev[MR_ARRAY_NUM(i2c_bus_drv_data)];
|
||||
|
||||
static int drv_i2c_bus_configure(struct mr_i2c_bus *i2c_bus, struct mr_i2c_config *config, int addr, int addr_bits)
|
||||
{
|
||||
@@ -277,12 +277,12 @@ int drv_i2c_bus_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(i2c_bus_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(i2c_bus_dev); index++)
|
||||
{
|
||||
mr_i2c_bus_register(&i2c_bus_dev[index], i2c_bus_name[index], &i2c_bus_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_i2c_bus_init);
|
||||
MR_INIT_DRV_EXPORT(drv_i2c_bus_init);
|
||||
|
||||
#endif /* MR_USING_I2C */
|
||||
|
||||
@@ -41,7 +41,7 @@ static struct mr_pin pin_dev;
|
||||
static struct drv_pin_port_data *drv_pin_get_port_data(int pin)
|
||||
{
|
||||
pin >>= 4;
|
||||
if ((pin >= mr_array_num(pin_port_drv_data)) || (pin_port_drv_data[pin].port == MR_NULL))
|
||||
if ((pin >= MR_ARRAY_NUM(pin_port_drv_data)) || (pin_port_drv_data[pin].port == MR_NULL))
|
||||
{
|
||||
return MR_NULL;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ static struct drv_pin_port_data *drv_pin_get_port_data(int pin)
|
||||
static struct drv_pin_data *drv_pin_get_data(int pin)
|
||||
{
|
||||
pin &= 0x0f;
|
||||
if (pin >= mr_array_num(pin_drv_data))
|
||||
if (pin >= MR_ARRAY_NUM(pin_drv_data))
|
||||
{
|
||||
return MR_NULL;
|
||||
}
|
||||
@@ -451,6 +451,6 @@ int drv_pin_init(void)
|
||||
{
|
||||
return mr_pin_register(&pin_dev, "pin", &pin_drv);
|
||||
}
|
||||
MR_DRV_EXPORT(drv_pin_init);
|
||||
MR_INIT_DRV_EXPORT(drv_pin_init);
|
||||
|
||||
#endif /* MR_USING_PIN */
|
||||
|
||||
@@ -94,7 +94,7 @@ static struct drv_serial_data serial_drv_data[] =
|
||||
#endif /* MR_USING_UART8 */
|
||||
};
|
||||
|
||||
static struct mr_serial serial_dev[mr_array_num(serial_drv_data)];
|
||||
static struct mr_serial serial_dev[MR_ARRAY_NUM(serial_drv_data)];
|
||||
|
||||
static int drv_serial_configure(struct mr_serial *serial, struct mr_serial_config *config)
|
||||
{
|
||||
@@ -195,9 +195,9 @@ static int drv_serial_configure(struct mr_serial *serial, struct mr_serial_confi
|
||||
}
|
||||
}
|
||||
|
||||
switch (config->invert)
|
||||
switch (config->polarity)
|
||||
{
|
||||
case MR_SERIAL_NRZ_NORMAL:
|
||||
case MR_SERIAL_POLARITY_NORMAL:
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -455,12 +455,12 @@ int drv_serial_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(serial_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(serial_dev); index++)
|
||||
{
|
||||
mr_serial_register(&serial_dev[index], serial_name[index], &serial_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_serial_init);
|
||||
MR_INIT_DRV_EXPORT(drv_serial_init);
|
||||
|
||||
#endif /* MR_USING_SERIAL */
|
||||
|
||||
@@ -49,7 +49,7 @@ static struct drv_spi_bus_data spi_bus_drv_data[] =
|
||||
#endif /* MR_USING_SPI3 */
|
||||
};
|
||||
|
||||
static struct mr_spi_bus spi_bus_dev[mr_array_num(spi_bus_drv_data)];
|
||||
static struct mr_spi_bus spi_bus_dev[MR_ARRAY_NUM(spi_bus_drv_data)];
|
||||
|
||||
static int drv_spi_bus_configure(struct mr_spi_bus *spi_bus, struct mr_spi_config *config)
|
||||
{
|
||||
@@ -366,12 +366,12 @@ int drv_spi_bus_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(spi_bus_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(spi_bus_dev); index++)
|
||||
{
|
||||
mr_spi_bus_register(&spi_bus_dev[index], spi_bus_name[index], &spi_bus_drv[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_spi_bus_init);
|
||||
MR_INIT_DRV_EXPORT(drv_spi_bus_init);
|
||||
|
||||
#endif /* MR_USING_SPI */
|
||||
|
||||
@@ -112,7 +112,7 @@ static struct drv_timer_data timer_drv_data[] =
|
||||
#endif /* MR_USING_TIMER10 */
|
||||
};
|
||||
|
||||
static struct mr_timer timer_dev[mr_array_num(timer_drv_data)];
|
||||
static struct mr_timer timer_dev[MR_ARRAY_NUM(timer_drv_data)];
|
||||
|
||||
static struct mr_timer_info timer_info[] =
|
||||
{
|
||||
@@ -392,12 +392,12 @@ int drv_timer_init(void)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (index = 0; index < mr_array_num(timer_dev); index++)
|
||||
for (index = 0; index < MR_ARRAY_NUM(timer_dev); index++)
|
||||
{
|
||||
mr_timer_register(&timer_dev[index], timer_name[index], &timer_drv[index], &timer_info[index]);
|
||||
}
|
||||
return MR_EOK;
|
||||
}
|
||||
MR_DRV_EXPORT(drv_timer_init);
|
||||
MR_INIT_DRV_EXPORT(drv_timer_init);
|
||||
|
||||
#endif /* MR_USING_TIMER */
|
||||
|
||||
Reference in New Issue
Block a user