Fix examples.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
2018-09-26 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
Fix for chopstx_intr_done. No spurious interrupts.
|
||||||
|
* contrib/adc-mkl27z.c (adc_wait_completion): Fix.
|
||||||
|
* contrib/adc-stm32f103.c (adc_wait_completion): Likewise.
|
||||||
|
* contrib/usart-stm32f103.c (usart_main): Likewise.
|
||||||
|
* example-cdc-gnu-linux/usb-cdc.c (tty_main): Likewise.
|
||||||
|
* example-cdc/usb-cdc.c (tty_main): Likewise.
|
||||||
|
* example-fraucheky/main.c (usb_main): Likewise.
|
||||||
|
* example-fs-bb48/touch.c (touch_get): Likewise.
|
||||||
|
* example-fs-bb48/usb-cdc.c (tty_main): Likewise.
|
||||||
|
* example-primer2/primer2-ts.c (adc3_conversion): Likewise.
|
||||||
|
* example-usb-serial/usb-cdc.c (cdc_main): Likewise.
|
||||||
|
|
||||||
2018-09-26 NIIBE Yutaka <gniibe@fsij.org>
|
2018-09-26 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* chopstx.h (chopstx_intr_done): New function.
|
* chopstx.h (chopstx_intr_done): New function.
|
||||||
|
|||||||
12
NEWS
12
NEWS
@@ -1,6 +1,18 @@
|
|||||||
NEWS - Noteworthy changes
|
NEWS - Noteworthy changes
|
||||||
|
|
||||||
|
|
||||||
|
* Major changes in Chopstx 1.10
|
||||||
|
|
||||||
|
Released 2018-09-XX
|
||||||
|
|
||||||
|
** Function chopstx_intr_wait is not deprecated, now.
|
||||||
|
Once, it was said that it's deprecated, but it's active again.
|
||||||
|
|
||||||
|
** API change: chopstx_poll, chopstx_intr_wait, chopstx_intr_done
|
||||||
|
To avoid spurious interrupt, we introduce new function
|
||||||
|
chopstx_intr_done, which should be called after interrupt handling.
|
||||||
|
|
||||||
|
|
||||||
* Major changes in Chopstx 1.9
|
* Major changes in Chopstx 1.9
|
||||||
|
|
||||||
Released 2018-05-09
|
Released 2018-05-09
|
||||||
|
|||||||
@@ -295,19 +295,20 @@ adc_stop (void)
|
|||||||
int
|
int
|
||||||
adc_wait_completion (void)
|
adc_wait_completion (void)
|
||||||
{
|
{
|
||||||
struct chx_poll_head *pd_array[1] = { (struct chx_poll_head *)&adc_intr };
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Wait DMA completion */
|
/* Wait DMA completion */
|
||||||
chopstx_poll (NULL, 1, pd_array);
|
chopstx_intr_wait (&adc_intr);
|
||||||
|
|
||||||
DMA0->DSR_BCR = (1 << 24);
|
DMA0->DSR_BCR = (1 << 24);
|
||||||
DMA1->DSR_BCR = (1 << 24);
|
DMA1->DSR_BCR = (1 << 24);
|
||||||
|
|
||||||
adc_stop_conversion ();
|
adc_stop_conversion ();
|
||||||
|
|
||||||
|
chopstx_intr_done (&adc_intr);
|
||||||
|
|
||||||
for (i = 0; i < adc.count; i++)
|
for (i = 0; i < adc.count; i++)
|
||||||
*adc.p++ = (uint8_t)adc.buf[i];
|
*adc.p++ = (uint8_t)adc.buf[i];
|
||||||
|
|
||||||
|
|||||||
@@ -316,11 +316,10 @@ int
|
|||||||
adc_wait_completion (void)
|
adc_wait_completion (void)
|
||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
struct chx_poll_head *pd_array[1] = { (struct chx_poll_head *)&adc_intr };
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
chopstx_poll (NULL, 1, pd_array);
|
chopstx_intr_wait (&adc_intr);
|
||||||
flags = DMA1->ISR & STM32_DMA_ISR_MASK; /* Channel 1 interrupt cause. */
|
flags = DMA1->ISR & STM32_DMA_ISR_MASK; /* Channel 1 interrupt cause. */
|
||||||
/*
|
/*
|
||||||
* Clear interrupt cause of channel 1.
|
* Clear interrupt cause of channel 1.
|
||||||
@@ -329,6 +328,7 @@ adc_wait_completion (void)
|
|||||||
* and TEIF.
|
* and TEIF.
|
||||||
*/
|
*/
|
||||||
DMA1->IFCR = (flags & ~1);
|
DMA1->IFCR = (flags & ~1);
|
||||||
|
chopstx_intr_done (&adc_intr);
|
||||||
|
|
||||||
if ((flags & STM32_DMA_ISR_TEIF) != 0) /* DMA errors */
|
if ((flags & STM32_DMA_ISR_TEIF) != 0) /* DMA errors */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -541,10 +541,16 @@ usart_main (void *arg)
|
|||||||
chopstx_poll (NULL, n, usart_poll);
|
chopstx_poll (NULL, n, usart_poll);
|
||||||
|
|
||||||
if (usart2_intr.ready)
|
if (usart2_intr.ready)
|
||||||
usart2_tx_ready = handle_intr (USART2, &usart2_rb_h2a, &usart2_stat);
|
{
|
||||||
|
usart2_tx_ready = handle_intr (USART2, &usart2_rb_h2a, &usart2_stat);
|
||||||
|
chopstx_intr_done (&usart2_intr);
|
||||||
|
}
|
||||||
|
|
||||||
if (usart3_intr.ready)
|
if (usart3_intr.ready)
|
||||||
usart3_tx_ready = handle_intr (USART3, &usart3_rb_h2a, &usart3_stat);
|
{
|
||||||
|
usart3_tx_ready = handle_intr (USART3, &usart3_rb_h2a, &usart3_stat);
|
||||||
|
chopstx_intr_done (&usart3_intr);
|
||||||
|
}
|
||||||
|
|
||||||
if (usart2_tx_ready && usart2_app_write_event.ready)
|
if (usart2_tx_ready && usart2_app_write_event.ready)
|
||||||
usart2_tx_ready = handle_tx_ready (USART2,
|
usart2_tx_ready = handle_tx_ready (USART2,
|
||||||
|
|||||||
@@ -708,6 +708,7 @@ tty_main (void *arg)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
e = usb_lld_event_handler (&dev);
|
e = usb_lld_event_handler (&dev);
|
||||||
|
chopstx_intr_done (&usb_intr);
|
||||||
ep_num = USB_EVENT_ENDP (e);
|
ep_num = USB_EVENT_ENDP (e);
|
||||||
|
|
||||||
if (ep_num != 0)
|
if (ep_num != 0)
|
||||||
|
|||||||
@@ -719,6 +719,7 @@ tty_main (void *arg)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
e = usb_lld_event_handler (&dev);
|
e = usb_lld_event_handler (&dev);
|
||||||
|
chopstx_intr_done (&usb_intr);
|
||||||
ep_num = USB_EVENT_ENDP (e);
|
ep_num = USB_EVENT_ENDP (e);
|
||||||
|
|
||||||
if (ep_num != 0)
|
if (ep_num != 0)
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ usb_main (void *arg)
|
|||||||
|
|
||||||
event_handle:
|
event_handle:
|
||||||
e = usb_lld_event_handler (&dev);
|
e = usb_lld_event_handler (&dev);
|
||||||
|
chopstx_intr_done (&interrupt);
|
||||||
ep_num = USB_EVENT_ENDP (e);
|
ep_num = USB_EVENT_ENDP (e);
|
||||||
|
|
||||||
if (ep_num != 0)
|
if (ep_num != 0)
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ touch_get (void)
|
|||||||
TPM1->SC = 0;
|
TPM1->SC = 0;
|
||||||
TPM1->CNT = 0xffff; /* Writing causes reset of the counter. */
|
TPM1->CNT = 0xffff; /* Writing causes reset of the counter. */
|
||||||
|
|
||||||
|
chopstx_intr_done (&tpm1_intr);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -708,6 +708,7 @@ tty_main (void *arg)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
e = usb_lld_event_handler (&dev);
|
e = usb_lld_event_handler (&dev);
|
||||||
|
chopstx_intr_done (&usb_intr);
|
||||||
ep_num = USB_EVENT_ENDP (e);
|
ep_num = USB_EVENT_ENDP (e);
|
||||||
|
|
||||||
if (ep_num != 0)
|
if (ep_num != 0)
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ void adc3_conversion (uint32_t *result)
|
|||||||
/* Stop conversion. */
|
/* Stop conversion. */
|
||||||
ADC3->CR2 &= ~ADC_CR2_JSWSTART;
|
ADC3->CR2 &= ~ADC_CR2_JSWSTART;
|
||||||
|
|
||||||
|
#if USE_ADC3_INTR
|
||||||
|
chopstx_intr_done (&adc3_intr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -770,6 +770,7 @@ cdc_main (void *arg)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
e = usb_lld_event_handler (&dev);
|
e = usb_lld_event_handler (&dev);
|
||||||
|
chopstx_intr_done (&usb_intr);
|
||||||
ep_num = USB_EVENT_ENDP (e);
|
ep_num = USB_EVENT_ENDP (e);
|
||||||
|
|
||||||
if (ep_num != 0)
|
if (ep_num != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user