Commit a506aa57 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez

irq-demo: Flush channel before starting the new interrupts

parent f88a74d4
...@@ -292,6 +292,18 @@ static int get_hw_ts_from_fmc_dio_device(fmc_dio_device dev, int ch, ...@@ -292,6 +292,18 @@ static int get_hw_ts_from_fmc_dio_device(fmc_dio_device dev, int ch,
return 0; return 0;
} }
void flush_fmc_dio_device_channel(fmc_dio_device dev, int ch)
{
int ret;
struct usr_timestamp *ts;
unsigned int nts;
ret = get_hw_ts_from_fmc_dio_device(dev, ch, &ts, &nts);
if(ret == 0) {
free(ts);
}
}
static int get_kernel_leaps_info(fmc_dio_device dev) static int get_kernel_leaps_info(fmc_dio_device dev)
{ {
struct timex tx = {0}; struct timex tx = {0};
......
...@@ -39,6 +39,7 @@ int get_tai_ts_from_fmc_dio_device(fmc_dio_device dev, int ch, ...@@ -39,6 +39,7 @@ int get_tai_ts_from_fmc_dio_device(fmc_dio_device dev, int ch,
struct usr_timestamp **ts, unsigned int *nts); struct usr_timestamp **ts, unsigned int *nts);
int get_utc_ts_from_fmc_dio_device(fmc_dio_device dev, int ch, int get_utc_ts_from_fmc_dio_device(fmc_dio_device dev, int ch,
struct usr_timestamp **ts, unsigned int *nts); struct usr_timestamp **ts, unsigned int *nts);
void flush_fmc_dio_device_channel(fmc_dio_device dev, int ch);
unsigned int get_total_n_timestamps(fmc_dio_device dev); unsigned int get_total_n_timestamps(fmc_dio_device dev);
unsigned int get_partial_n_timestamps(fmc_dio_device dev); unsigned int get_partial_n_timestamps(fmc_dio_device dev);
......
...@@ -118,10 +118,12 @@ int main(int argc, char *argv[]) ...@@ -118,10 +118,12 @@ int main(int argc, char *argv[])
/* Before starting IRQ demo, Interrupts should be properly configured: /* Before starting IRQ demo, Interrupts should be properly configured:
* 1) Disable all interrupts * 1) Disable all interrupts
* 2) Enable the TEST_FMC_DIO_CH interrupt line * 2) Flush TEST_FMC_DIO_CH channel
* 3) Setup specific information for interrupt line (period from user arguments or default one) * 3) Enable the TEST_FMC_DIO_CH interrupt line
* 4) Setup specific information for interrupt line (period from user arguments or default one)
*/ */
disable_fmc_dio_device_all_irq(dev); disable_fmc_dio_device_all_irq(dev);
flush_fmc_dio_device_channel(dev, TEST_FMC_DIO_CH);
enable_fmc_dio_device_irq(dev, TEST_FMC_DIO_CH); enable_fmc_dio_device_irq(dev, TEST_FMC_DIO_CH);
setup_fmc_dio_device_irq(dev, user_arguments->irq_period, TEST_FMC_DIO_COUNT); setup_fmc_dio_device_irq(dev, user_arguments->irq_period, TEST_FMC_DIO_COUNT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment