[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: NI M - cmd test update (from comedi )
Module: xenomai-3 Branch: master Commit: 7988c4132872f09611db5a219c425769b687 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7988c4132872f09611db5a219c425769b687 Author: Jorge Ramirez-Ortiz j...@xenomai.org Date: Tue Aug 26 13:45:23 2014 -0400 drivers/analogy: NI M - cmd test update (from comedi) In order to mimic the comedi behaviour, the simulation comand shall update command fields specifics to the driver. To that end, the a4l_cmd_t structure defines a driver specific bitfield to indidate which states are allowed by the driver to not be reported as errors. --- include/rtdm/uapi/analogy.h| 33 +-- .../analogy/national_instruments/mio_common.c | 256 +--- 2 files changed, 190 insertions(+), 99 deletions(-) diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h index 98c6154..458d5f7 100644 --- a/include/rtdm/uapi/analogy.h +++ b/include/rtdm/uapi/analogy.h @@ -236,7 +236,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t; /** * Reference definition macro */ -#define AREF(a) (((a) 0xf) 24) +#define AREF(a) (((a) 0x03) 24) /** * Flags definition macro */ @@ -244,7 +244,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t; /** * Channel + range + reference definition macro */ -#define PACK(a, b, c) (CHAN(a) | RNG(b) | AREF(c)) +#define PACK(a, b, c) (a | RNG(b) | AREF(c)) /** * Channel + range + reference + flags definition macro */ @@ -276,8 +276,8 @@ typedef struct a4l_dev_info a4l_dvinfo_t; #define CR_DITHER CR_ALT_FILTER #define CR_DEGLITCH CR_ALT_FILTER #define CR_ALT_SOURCE (127) -#define CR_EDGE(128) -#define CR_INVERT (129) +#define CR_EDGE(130) +#define CR_INVERT (131) #endif /* !DOXYGEN_CPP */ @@ -288,43 +288,46 @@ typedef struct a4l_dev_info a4l_dvinfo_t; struct a4l_cmd_desc { unsigned char idx_subd; - /** Subdevice to which the command will be applied. */ + /** Subdevice to which the command will be applied. */ unsigned long flags; -/** Command flags */ + /** Command flags */ /* Command trigger characteristics */ unsigned int start_src; - /** Start trigger type */ + /** Start trigger type */ unsigned int start_arg; - /** Start trigger argument */ + /** Start trigger argument */ unsigned int scan_begin_src; -/** Scan begin trigger type */ + /** Scan begin trigger type */ unsigned int scan_begin_arg; -/** Scan begin trigger argument */ + /** Scan begin trigger argument */ unsigned int convert_src; - /** Convert trigger type */ + /** Convert trigger type */ unsigned int convert_arg; - /** Convert trigger argument */ + /** Convert trigger argument */ unsigned int scan_end_src; /** Scan end trigger type */ unsigned int scan_end_arg; /** Scan end trigger argument */ unsigned int stop_src; - /** Stop trigger type */ + /** Stop trigger type */ unsigned int stop_arg; /** Stop trigger argument */ unsigned char nb_chan; /** Count of channels related with the command */ unsigned int *chan_descs; - /** Tab containing channels descriptors */ + /** Tab containing channels descriptors */ /* Driver specific fields */ + unsigned int valid_simul_stages; + /** cmd simulation valid stages (driver dependent) */ + unsigned int data_len; /** Driver specific buffer size */ sampl_t *data; - /** Driver specific buffer pointer */ + /** Driver specific buffer pointer */ }; typedef struct a4l_cmd_desc a4l_cmd_t; diff --git a/kernel/drivers/analogy/national_instruments/mio_common.c b/kernel/drivers/analogy/national_instruments/mio_common.c index e5ccf7a..6c5bba0 100644 --- a/kernel/drivers/analogy/national_instruments/mio_common.c +++ b/kernel/drivers/analogy/national_instruments/mio_common.c @@ -2029,52 +2029,145 @@ int ni_ai_inttrig(struct a4l_subdevice *subd, lsampl_t trignum) return 1; } -static int ni_ai_cmdtest(struct a4l_subdevice *subd, struct a4l_cmd_desc * cmd) +#define cfc_check_trigger_arg_is(a,b) __cfc_check_trigger_arg_is(a,b, dev, __LINE__) +static inline int __cfc_check_trigger_arg_is(unsigned int *arg, +
[Xenomai-git] Jorge Ramirez-Ortiz : drivers/analogy: NI M - cmd test update (from comedi )
Module: xenomai-3 Branch: next Commit: add4ebedafb2ede14a4bd7ad61b1cfc72d5fc630 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=add4ebedafb2ede14a4bd7ad61b1cfc72d5fc630 Author: Jorge Ramirez-Ortiz j...@xenomai.org Date: Tue Aug 26 13:45:23 2014 -0400 drivers/analogy: NI M - cmd test update (from comedi) In order to mimic the comedi behaviour, the simulation comand shall update command fields specifics to the driver. To that end, the a4l_cmd_t structure defines a driver specific bitfield to indidate which states are allowed by the driver to not be reported as errors. --- include/rtdm/uapi/analogy.h| 33 +-- .../analogy/national_instruments/mio_common.c | 256 +--- 2 files changed, 190 insertions(+), 99 deletions(-) diff --git a/include/rtdm/uapi/analogy.h b/include/rtdm/uapi/analogy.h index 98c6154..458d5f7 100644 --- a/include/rtdm/uapi/analogy.h +++ b/include/rtdm/uapi/analogy.h @@ -236,7 +236,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t; /** * Reference definition macro */ -#define AREF(a) (((a) 0xf) 24) +#define AREF(a) (((a) 0x03) 24) /** * Flags definition macro */ @@ -244,7 +244,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t; /** * Channel + range + reference definition macro */ -#define PACK(a, b, c) (CHAN(a) | RNG(b) | AREF(c)) +#define PACK(a, b, c) (a | RNG(b) | AREF(c)) /** * Channel + range + reference + flags definition macro */ @@ -276,8 +276,8 @@ typedef struct a4l_dev_info a4l_dvinfo_t; #define CR_DITHER CR_ALT_FILTER #define CR_DEGLITCH CR_ALT_FILTER #define CR_ALT_SOURCE (127) -#define CR_EDGE(128) -#define CR_INVERT (129) +#define CR_EDGE(130) +#define CR_INVERT (131) #endif /* !DOXYGEN_CPP */ @@ -288,43 +288,46 @@ typedef struct a4l_dev_info a4l_dvinfo_t; struct a4l_cmd_desc { unsigned char idx_subd; - /** Subdevice to which the command will be applied. */ + /** Subdevice to which the command will be applied. */ unsigned long flags; -/** Command flags */ + /** Command flags */ /* Command trigger characteristics */ unsigned int start_src; - /** Start trigger type */ + /** Start trigger type */ unsigned int start_arg; - /** Start trigger argument */ + /** Start trigger argument */ unsigned int scan_begin_src; -/** Scan begin trigger type */ + /** Scan begin trigger type */ unsigned int scan_begin_arg; -/** Scan begin trigger argument */ + /** Scan begin trigger argument */ unsigned int convert_src; - /** Convert trigger type */ + /** Convert trigger type */ unsigned int convert_arg; - /** Convert trigger argument */ + /** Convert trigger argument */ unsigned int scan_end_src; /** Scan end trigger type */ unsigned int scan_end_arg; /** Scan end trigger argument */ unsigned int stop_src; - /** Stop trigger type */ + /** Stop trigger type */ unsigned int stop_arg; /** Stop trigger argument */ unsigned char nb_chan; /** Count of channels related with the command */ unsigned int *chan_descs; - /** Tab containing channels descriptors */ + /** Tab containing channels descriptors */ /* Driver specific fields */ + unsigned int valid_simul_stages; + /** cmd simulation valid stages (driver dependent) */ + unsigned int data_len; /** Driver specific buffer size */ sampl_t *data; - /** Driver specific buffer pointer */ + /** Driver specific buffer pointer */ }; typedef struct a4l_cmd_desc a4l_cmd_t; diff --git a/kernel/drivers/analogy/national_instruments/mio_common.c b/kernel/drivers/analogy/national_instruments/mio_common.c index e5ccf7a..6c5bba0 100644 --- a/kernel/drivers/analogy/national_instruments/mio_common.c +++ b/kernel/drivers/analogy/national_instruments/mio_common.c @@ -2029,52 +2029,145 @@ int ni_ai_inttrig(struct a4l_subdevice *subd, lsampl_t trignum) return 1; } -static int ni_ai_cmdtest(struct a4l_subdevice *subd, struct a4l_cmd_desc * cmd) +#define cfc_check_trigger_arg_is(a,b) __cfc_check_trigger_arg_is(a,b, dev, __LINE__) +static inline int __cfc_check_trigger_arg_is(unsigned int *arg, +