mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 05:55:46 +08:00
Make sure that there is one space after for
This commit is contained in:
@@ -81,7 +81,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (g_irqtos || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (g_irqtos || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ void os_start(void)
|
|||||||
|
|
||||||
_up_puts("Test complete");
|
_up_puts("Test complete");
|
||||||
_up_putnl();
|
_up_putnl();
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
|||||||
/* Make some feeble effort to perserve the stack contents. This is
|
/* Make some feeble effort to perserve the stack contents. This is
|
||||||
* feeble because the stack surely contains invalid pointers and other
|
* feeble because the stack surely contains invalid pointers and other
|
||||||
* content that will not work in the child context. However, if the
|
* content that will not work in the child context. However, if the
|
||||||
* user follows all of the caveats of vfor() usage, even this feeble
|
* user follows all of the caveats of vfork() usage, even this feeble
|
||||||
* effort is overkill.
|
* effort is overkill.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ static int up_interrupt(int irq, void *context)
|
|||||||
* until we have been looping for a long time.
|
* until we have been looping for a long time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* Get the current UART status and check for loop
|
/* Get the current UART status and check for loop
|
||||||
* termination conditions
|
* termination conditions
|
||||||
|
|||||||
@@ -832,7 +832,7 @@ static int up_interrupt(int irq, void *context)
|
|||||||
* until we have been looping for a long time.
|
* until we have been looping for a long time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* Get the current UART status and check for loop
|
/* Get the current UART status and check for loop
|
||||||
* termination conditions
|
* termination conditions
|
||||||
|
|||||||
@@ -165,5 +165,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shouldn't get here */
|
/* Shouldn't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,6 +181,6 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shoulnd't get here */
|
/* Shoulnd't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -257,5 +257,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shouldn't get here */
|
/* Shouldn't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -357,5 +357,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shouldn't get here */
|
/* Shouldn't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,5 +174,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shoulnd't get here */
|
/* Shoulnd't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,5 +191,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shouldn't get here */
|
/* Shouldn't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,5 +175,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shoulnd't get here */
|
/* Shoulnd't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,6 +306,6 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shoulnd't get here */
|
/* Shoulnd't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,5 +165,5 @@ void __start(void)
|
|||||||
|
|
||||||
/* Shoulnd't get here */
|
/* Shoulnd't get here */
|
||||||
|
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ pid_t up_vfork(const struct vfork_s *context)
|
|||||||
/* Make some feeble effort to perserve the stack contents. This is
|
/* Make some feeble effort to perserve the stack contents. This is
|
||||||
* feeble because the stack surely contains invalid pointers and other
|
* feeble because the stack surely contains invalid pointers and other
|
||||||
* content that will not work in the child context. However, if the
|
* content that will not work in the child context. However, if the
|
||||||
* user follows all of the caveats of vfor() usage, even this feeble
|
* user follows all of the caveats of vfork() usage, even this feeble
|
||||||
* effort is overkill.
|
* effort is overkill.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ static void _up_assert(int errorcode)
|
|||||||
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (current_regs || ((struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -294,12 +294,12 @@ static int init_graph_vga(int width, int height,int chain4)
|
|||||||
outb(val, 0x3c2);
|
outb(val, 0x3c2);
|
||||||
outw(0x0e11, 0x3d4); /* enable regs 0-7 */
|
outw(0x0e11, 0x3d4); /* enable regs 0-7 */
|
||||||
|
|
||||||
for(a = 0; a < SZ(g_hor_regs); ++a)
|
for (a = 0; a < SZ(g_hor_regs); ++a)
|
||||||
{
|
{
|
||||||
outw((uint16_t)((w[a] << 8) + g_hor_regs[a]), 0x3d4);
|
outw((uint16_t)((w[a] << 8) + g_hor_regs[a]), 0x3d4);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(a = 0; a < SZ(g_ver_regs); ++a)
|
for (a = 0; a < SZ(g_ver_regs); ++a)
|
||||||
{
|
{
|
||||||
outw((uint16_t)((h[a] << 8) + g_ver_regs[a]), 0x3d4);
|
outw((uint16_t)((h[a] << 8) + g_ver_regs[a]), 0x3d4);
|
||||||
}
|
}
|
||||||
@@ -330,7 +330,7 @@ static int init_graph_vga(int width, int height,int chain4)
|
|||||||
outb(0x33, 0x3c0);
|
outb(0x33, 0x3c0);
|
||||||
outb(0x00, 0x3c0);
|
outb(0x00, 0x3c0);
|
||||||
|
|
||||||
for(a = 0; a < 16; a++) /* ega pal */
|
for (a = 0; a < 16; a++) /* ega pal */
|
||||||
{
|
{
|
||||||
outb((uint8_t)a, 0x3c0);
|
outb((uint8_t)a, 0x3c0);
|
||||||
outb((uint8_t)a, 0x3c0);
|
outb((uint8_t)a, 0x3c0);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static void _up_assert(int errorcode) /* noreturn_function */
|
|||||||
if (up_interrupt_context() || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (up_interrupt_context() || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ static void _up_assert(int errorcode) /* noreturn_function */
|
|||||||
if (up_interrupt_context() || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
if (up_interrupt_context() || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
|
||||||
{
|
{
|
||||||
(void)irqsave();
|
(void)irqsave();
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
board_led_on(LED_PANIC);
|
board_led_on(LED_PANIC);
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ static uint8_t spi_transfer(uint8_t ch)
|
|||||||
|
|
||||||
/* Send the byte, repeating if some error occurs */
|
/* Send the byte, repeating if some error occurs */
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
outp(EZ80_SPI_TSR, ch);
|
outp(EZ80_SPI_TSR, ch);
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ void open1788_sdram_initialize(void)
|
|||||||
|
|
||||||
/* Wait 128 AHB clock cycles */
|
/* Wait 128 AHB clock cycles */
|
||||||
|
|
||||||
for(i = 0; i < 128; i++);
|
for (i = 0; i < 128; i++);
|
||||||
|
|
||||||
/* 64ms/8192 = 7.8125us, nx16x8.33ns < 7.8125us, n < 58.6*/
|
/* 64ms/8192 = 7.8125us, nx16x8.33ns < 7.8125us, n < 58.6*/
|
||||||
|
|
||||||
|
|||||||
@@ -665,7 +665,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
/* Loopo until control-C */
|
/* Loopo until control-C */
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* Read characters from the console, and echo them to the target tty */
|
/* Read characters from the console, and echo them to the target tty */
|
||||||
|
|
||||||
|
|||||||
@@ -104,5 +104,5 @@ void board_power_off(void)
|
|||||||
|
|
||||||
// trigger shutdown with pull-up resistor (not push-pull!) and wait.
|
// trigger shutdown with pull-up resistor (not push-pull!) and wait.
|
||||||
stm32_gpiowrite(GPIO_PCLR, true);
|
stm32_gpiowrite(GPIO_PCLR, true);
|
||||||
for(;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-44
@@ -190,38 +190,33 @@ struct vsn_sif_s {
|
|||||||
sem_t exclusive_access;
|
sem_t exclusive_access;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private data
|
* Private data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct vsn_sif_s vsn_sif;
|
struct vsn_sif_s vsn_sif;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Semaphores
|
* Semaphores
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void sif_sem_wait(void)
|
void sif_sem_wait(void)
|
||||||
{
|
{
|
||||||
while (sem_wait( &vsn_sif.exclusive_access ) != 0)
|
while (sem_wait(&vsn_sif.exclusive_access) != 0)
|
||||||
{
|
{
|
||||||
ASSERT(errno == EINTR);
|
ASSERT(errno == EINTR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void inline sif_sem_post(void)
|
void inline sif_sem_post(void)
|
||||||
{
|
{
|
||||||
sem_post( &vsn_sif.exclusive_access );
|
sem_post(&vsn_sif.exclusive_access);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* GPIOs and Alternative Functions
|
* GPIOs and Alternative Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void sif_gpios_reset(void)
|
void sif_gpios_reset(void)
|
||||||
{
|
{
|
||||||
vsn_sif.gpio[0] = vsn_sif.gpio[1] = VSN_SIF_GPIO_HIGHZ;
|
vsn_sif.gpio[0] = vsn_sif.gpio[1] = VSN_SIF_GPIO_HIGHZ;
|
||||||
@@ -230,7 +225,6 @@ void sif_gpios_reset(void)
|
|||||||
stm32_configgpio(GPIO_GP2_HIZ);
|
stm32_configgpio(GPIO_GP2_HIZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sif_gpio1_update(void)
|
void sif_gpio1_update(void)
|
||||||
{
|
{
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
@@ -246,12 +240,11 @@ void sif_gpio1_update(void)
|
|||||||
if (stm32_configgpio(val) == ERROR)
|
if (stm32_configgpio(val) == ERROR)
|
||||||
printf("Error updating1\n");
|
printf("Error updating1\n");
|
||||||
|
|
||||||
if ( stm32_gpioread(val) )
|
if (stm32_gpioread(val))
|
||||||
vsn_sif.gpio[0] |= VSN_SIF_GPIO_READ_MASK;
|
vsn_sif.gpio[0] |= VSN_SIF_GPIO_READ_MASK;
|
||||||
else vsn_sif.gpio[0] &= ~VSN_SIF_GPIO_READ_MASK;
|
else vsn_sif.gpio[0] &= ~VSN_SIF_GPIO_READ_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sif_gpio2_update(void)
|
void sif_gpio2_update(void)
|
||||||
{
|
{
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
@@ -267,12 +260,11 @@ void sif_gpio2_update(void)
|
|||||||
if (stm32_configgpio(val) == ERROR)
|
if (stm32_configgpio(val) == ERROR)
|
||||||
printf("Error updating2\n");
|
printf("Error updating2\n");
|
||||||
|
|
||||||
if ( stm32_gpioread(val) )
|
if (stm32_gpioread(val))
|
||||||
vsn_sif.gpio[1] |= VSN_SIF_GPIO_READ_MASK;
|
vsn_sif.gpio[1] |= VSN_SIF_GPIO_READ_MASK;
|
||||||
else vsn_sif.gpio[1] &= ~VSN_SIF_GPIO_READ_MASK;
|
else vsn_sif.gpio[1] &= ~VSN_SIF_GPIO_READ_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sif_gpios_lock(vsn_sif_state_t peripheral)
|
int sif_gpios_lock(vsn_sif_state_t peripheral)
|
||||||
{
|
{
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@@ -284,16 +276,12 @@ int sif_gpios_unlock(vsn_sif_state_t peripheral)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Analog Outputs
|
* Analog Outputs
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static volatile int test = 0, teirq;
|
static volatile int test = 0, teirq;
|
||||||
|
|
||||||
|
|
||||||
static int sif_anout_isr(int irq, void *context)
|
static int sif_anout_isr(int irq, void *context)
|
||||||
{
|
{
|
||||||
STM32_TIM_ACKINT(vsn_sif.tim8, 0);
|
STM32_TIM_ACKINT(vsn_sif.tim8, 0);
|
||||||
@@ -304,7 +292,6 @@ static int sif_anout_isr(int irq, void *context)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sif_anout_init(void)
|
int sif_anout_init(void)
|
||||||
{
|
{
|
||||||
vsn_sif.tim3 = stm32_tim_init(3);
|
vsn_sif.tim3 = stm32_tim_init(3);
|
||||||
@@ -346,23 +333,19 @@ void sif_anout_update(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sif_anout_callback(void)
|
void sif_anout_callback(void)
|
||||||
{
|
{
|
||||||
// called at rate of PWM interrupt
|
// called at rate of PWM interrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Analog Input Reference Tap
|
* Analog Input Reference Tap
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void sif_anref_init(void)
|
void sif_anref_init(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Analog Input Sampler Unit
|
* Analog Input Sampler Unit
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -434,13 +417,11 @@ int sif_anin_setgain(int gain)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int sif_anin_reset(void)
|
int sif_anin_reset(void)
|
||||||
{
|
{
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Device driver functions
|
* Device driver functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -456,7 +437,6 @@ int devsif_open(FAR struct file *filep)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int devsif_close(FAR struct file *filep)
|
int devsif_close(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
sif_sem_wait();
|
sif_sem_wait();
|
||||||
@@ -475,7 +455,6 @@ int devsif_close(FAR struct file *filep)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t devsif_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
static ssize_t devsif_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
||||||
{
|
{
|
||||||
sif_sem_wait();
|
sif_sem_wait();
|
||||||
@@ -484,16 +463,14 @@ static ssize_t devsif_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t devsif_write(FAR struct file *filep, FAR const char *buffer, size_t len)
|
static ssize_t devsif_write(FAR struct file *filep, FAR const char *buffer, size_t len)
|
||||||
{
|
{
|
||||||
sif_sem_wait();
|
sif_sem_wait();
|
||||||
printf("getpid: %d\n", getpid() );
|
printf("getpid: %d\n", getpid());
|
||||||
sif_sem_post();
|
sif_sem_post();
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_POLL
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
static int devsif_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
static int devsif_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||||
bool setup)
|
bool setup)
|
||||||
@@ -509,7 +486,6 @@ static int devsif_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int devsif_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
int devsif_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
sif_sem_wait();
|
sif_sem_wait();
|
||||||
@@ -517,12 +493,10 @@ int devsif_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
static const struct file_operations devsif_fops = {
|
static const struct file_operations devsif_fops = {
|
||||||
devsif_open, /* open */
|
devsif_open, /* open */
|
||||||
devsif_close, /* close */
|
devsif_close, /* close */
|
||||||
@@ -535,7 +509,6 @@ static const struct file_operations devsif_fops = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Bring up the Sensor Interface by initializing all of the desired
|
/** Bring up the Sensor Interface by initializing all of the desired
|
||||||
* hardware components.
|
* hardware components.
|
||||||
**/
|
**/
|
||||||
@@ -551,8 +524,8 @@ int sif_init(void)
|
|||||||
/* Initialize hardware */
|
/* Initialize hardware */
|
||||||
|
|
||||||
sif_gpios_reset();
|
sif_gpios_reset();
|
||||||
if ( sif_anout_init() != OK ) return -1;
|
if (sif_anout_init() != OK) return -1;
|
||||||
if ( sif_anin_reset() != OK ) return -1;
|
if (sif_anin_reset() != OK) return -1;
|
||||||
|
|
||||||
/* If everything is okay, register the driver */
|
/* If everything is okay, register the driver */
|
||||||
|
|
||||||
@@ -560,7 +533,6 @@ int sif_init(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** SIF Utility
|
/** SIF Utility
|
||||||
*
|
*
|
||||||
* Provides direct access to the sensor connector, readings, and diagnostic.
|
* Provides direct access to the sensor connector, readings, and diagnostic.
|
||||||
@@ -579,7 +551,7 @@ int sif_main(int argc, char *argv[])
|
|||||||
vsn_sif.gpio[1] = atoi(argv[3]);
|
vsn_sif.gpio[1] = atoi(argv[3]);
|
||||||
sif_gpio1_update();
|
sif_gpio1_update();
|
||||||
sif_gpio2_update();
|
sif_gpio2_update();
|
||||||
printf("GPIO States: %2x %2x\n", vsn_sif.gpio[0], vsn_sif.gpio[1] );
|
printf("GPIO States: %2x %2x\n", vsn_sif.gpio[0], vsn_sif.gpio[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "pwr") && argc == 3) {
|
else if (!strcmp(argv[1], "pwr") && argc == 3) {
|
||||||
@@ -593,7 +565,7 @@ int sif_main(int argc, char *argv[])
|
|||||||
t_set.tv_sec = atoi(argv[2]);
|
t_set.tv_sec = atoi(argv[2]);
|
||||||
clock_settime(CLOCK_REALTIME, &t_set);
|
clock_settime(CLOCK_REALTIME, &t_set);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "free") ) {
|
else if (!strcmp(argv[1], "free")) {
|
||||||
uint16_t page = 0, stpage = 0xFFFF;
|
uint16_t page = 0, stpage = 0xFFFF;
|
||||||
int status;
|
int status;
|
||||||
do {
|
do {
|
||||||
@@ -613,17 +585,17 @@ int sif_main(int argc, char *argv[])
|
|||||||
while (status >= 0);
|
while (status >= 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "erase") && argc == 3 ) {
|
else if (!strcmp(argv[1], "erase") && argc == 3) {
|
||||||
int page = atoi(argv[2]);
|
int page = atoi(argv[2]);
|
||||||
printf("Erase result: %d\n", up_progmem_erasepage(page) );
|
printf("Erase result: %d\n", up_progmem_erasepage(page));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "flash") && argc == 3 ) {
|
else if (!strcmp(argv[1], "flash") && argc == 3) {
|
||||||
uint16_t page = atoi(argv[2]);
|
uint16_t page = atoi(argv[2]);
|
||||||
uint32_t addr = page * up_progmem_pagesize(page);
|
uint32_t addr = page * up_progmem_pagesize(page);
|
||||||
|
|
||||||
printf("Write result: %d (writing to address %xh)\n",
|
printf("Write result: %d (writing to address %xh)\n",
|
||||||
up_progmem_write( addr, "Test", 4 ), addr);
|
up_progmem_write(addr, "Test", 4), addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "i2c") && argc == 3) {
|
else if (!strcmp(argv[1], "i2c") && argc == 3) {
|
||||||
@@ -644,8 +616,8 @@ int sif_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Sample some values */
|
/* Sample some values */
|
||||||
|
|
||||||
for (i=0; i<1000; ) {
|
for (i=0; i<1000;) {
|
||||||
if ( (a = lis331dl_getreadings(lis)) ) {
|
if ((a = lis331dl_getreadings(lis))) {
|
||||||
i++;
|
i++;
|
||||||
printf("%d %d %d\n", a->x, a->y, a->z);
|
printf("%d %d %d\n", a->x, a->y, a->z);
|
||||||
}
|
}
|
||||||
@@ -717,6 +689,6 @@ int sif_main(int argc, char *argv[])
|
|||||||
|
|
||||||
fprintf(stderr, "rtc time = %u, active = %u / %u, time / systick = %u / %u\n",
|
fprintf(stderr, "rtc time = %u, active = %u / %u, time / systick = %u / %u\n",
|
||||||
up_rtc_time(), t_active.tv_sec, t_active.tv_nsec,
|
up_rtc_time(), t_active.tv_sec, t_active.tv_nsec,
|
||||||
time(NULL), clock_systimer() );
|
time(NULL), clock_systimer());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ static inline void rit_clear(FAR struct rit_dev_s *priv)
|
|||||||
|
|
||||||
/* Display each row */
|
/* Display each row */
|
||||||
|
|
||||||
for(row = 0; row < RIT_YRES; row++)
|
for (row = 0; row < RIT_YRES; row++)
|
||||||
{
|
{
|
||||||
/* Display a horizontal run */
|
/* Display a horizontal run */
|
||||||
|
|
||||||
@@ -680,7 +680,7 @@ static inline void rit_clear(FAR struct rit_dev_s *priv)
|
|||||||
|
|
||||||
/* Display each row */
|
/* Display each row */
|
||||||
|
|
||||||
for(row = 0; row < RIT_YRES; row++)
|
for (row = 0; row < RIT_YRES; row++)
|
||||||
{
|
{
|
||||||
/* Display a horizontal run */
|
/* Display a horizontal run */
|
||||||
|
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ static inline int nxffs_startpos(FAR struct nxffs_volume_s *volume,
|
|||||||
* compacting.
|
* compacting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* Is there wasted space between the offset where the we could have
|
/* Is there wasted space between the offset where the we could have
|
||||||
* valid data and the offset to the beginning of the first valid
|
* valid data and the offset to the beginning of the first valid
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ int inet_pton(int af, FAR const char *src, FAR void *dst)
|
|||||||
numoffset = 0;
|
numoffset = 0;
|
||||||
ndots = 0;
|
ndots = 0;
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
ch = (uint8_t)src[srcoffset++];
|
ch = (uint8_t)src[srcoffset++];
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ int inet_pton(int af, FAR const char *src, FAR void *dst)
|
|||||||
nrsep = 0;
|
nrsep = 0;
|
||||||
rtime = false;
|
rtime = false;
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
ch = (uint8_t)src[srcoffset++];
|
ch = (uint8_t)src[srcoffset++];
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ void sq_rem(FAR sq_entry_t *node, sq_queue_t *queue)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FAR sq_entry_t *prev;
|
FAR sq_entry_t *prev;
|
||||||
for(prev = (FAR sq_entry_t*)queue->head;
|
for (prev = (FAR sq_entry_t*)queue->head;
|
||||||
prev && prev->flink != node;
|
prev && prev->flink != node;
|
||||||
prev = prev->flink);
|
prev = prev->flink);
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ FAR sq_entry_t *sq_remlast(sq_queue_t *queue)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FAR sq_entry_t *prev;
|
FAR sq_entry_t *prev;
|
||||||
for(prev = queue->head;
|
for (prev = queue->head;
|
||||||
prev && prev->flink != ret;
|
prev && prev->flink != ret;
|
||||||
prev = prev->flink);
|
prev = prev->flink);
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ FAR char *lib_fgets(FAR char *buf, size_t buflen, FILE *stream,
|
|||||||
* the next character and one for the null terminator.
|
* the next character and one for the null terminator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* Get the next character */
|
/* Get the next character */
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void uip_neighbor_init(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < ENTRIES; ++i)
|
for (i = 0; i < ENTRIES; ++i)
|
||||||
{
|
{
|
||||||
entries[i].time = MAX_TIME;
|
entries[i].time = MAX_TIME;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ void uip_neighbor_periodic(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < ENTRIES; ++i)
|
for (i = 0; i < ENTRIES; ++i)
|
||||||
{
|
{
|
||||||
if (entries[i].time < MAX_TIME)
|
if (entries[i].time < MAX_TIME)
|
||||||
{
|
{
|
||||||
@@ -125,7 +125,7 @@ static struct neighbor_entry *find_entry(uip_ipaddr_t ipaddr)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < ENTRIES; ++i)
|
for (i = 0; i < ENTRIES; ++i)
|
||||||
{
|
{
|
||||||
if (uip_ipaddr_cmp(entries[i].ipaddr, ipaddr))
|
if (uip_ipaddr_cmp(entries[i].ipaddr, ipaddr))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ static FAR sigpendq_t *sig_findpendingsignal(FAR struct task_group_s *group,
|
|||||||
|
|
||||||
/* Seach the list for a sigpendion on this signal */
|
/* Seach the list for a sigpendion on this signal */
|
||||||
|
|
||||||
for(sigpend = (FAR sigpendq_t*)group->sigpendingq.head;
|
for (sigpend = (FAR sigpendq_t*)group->sigpendingq.head;
|
||||||
(sigpend && sigpend->info.si_signo != signo);
|
(sigpend && sigpend->info.si_signo != signo);
|
||||||
sigpend = sigpend->flink);
|
sigpend = sigpend->flink);
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ FAR sigactq_t *sig_findaction(FAR struct tcb_s *stcb, int signo)
|
|||||||
|
|
||||||
/* Seach the list for a sigaction on this signal */
|
/* Seach the list for a sigaction on this signal */
|
||||||
|
|
||||||
for(sigact = (FAR sigactq_t*)stcb->sigactionq.head;
|
for (sigact = (FAR sigactq_t*)stcb->sigactionq.head;
|
||||||
((sigact) && (sigact->signo != signo));
|
((sigact) && (sigact->signo != signo));
|
||||||
sigact = sigact->flink);
|
sigact = sigact->flink);
|
||||||
|
|
||||||
|
|||||||
@@ -690,7 +690,7 @@ static char *read_line(FILE *stream)
|
|||||||
|
|
||||||
/* Loop to handle continuation lines */
|
/* Loop to handle continuation lines */
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* How long is the line so far? */
|
/* How long is the line so far? */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user