- 28 Oct, 2015 40 commits
-
-
Ian Abbott authored
Implement COMEDI asynchronous commands on the fake analog output subdevice. This is useful for testing asynchronous commands in the "write" direction when no real hardware is available. A normal kernel timer is used to drive the command. The new timer expiry function `waveform_ao_timer()` handles whole "scans" at a time according to the number of scan period that have elapsed since the last scan. Data for each channel in the scan is written to the internal loopback array `devpriv->ao_loopbacks[]` and can be read back on the analog input channels. However, if several scan periods are outstanding in the timer expiry function, only the latest available scan data is written to the loopback array in order to save processing time. The expiry function also checks for underrun conditions, and checks for normal termination of the asynchronous command when a "stop" scan count is reached. After the command is tested by `waveform_ao_cmdtest()` and set up by `waveform_ao_cmd()`, it is not started until an internal trigger function `waveform_ao_inttrig_start()` is called as a result of the user performing an `INSN_INTTRIG` instruction on the subdevice. The command is stopped when the "cancel" handler `waveform_ao_cancel()` is called. This may be due to the command terminating due to completion or an error, or as a result of the user cancelling the command. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
`waveform_ai_interrupt()` is a timer expiry function used to generate fake waveform data for an analog input subdevice. Rename it to `waveform_ai_timer()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
For asynchronous command handling on the analog input subdevice, a kernel timer routine is used to generate the fake waveform data. A "scan" consists of a number of conversions separated in time by a conversion period. Successive scans are separated in time by a scan period, which is at least the conversion period multiplied by the number of conversions per scan. Currently, the timer routine does not generate any data until the end of a scan period, generating whole scans of data at a time. Change it to generate data at the end of each conversion period, with an extra delay after the final conversion in each scan if necessary. Use new member `ai_convert_time` in the private data structure `struct waveform_private` to keep track of when the next conversion is due. This replaces the old member `ai_last_scan_time` which kept track of the time of the previous scan. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
COMEDI drivers often allow the last value written to a channel on an analog output subdevice to be read back via the "insn_read" handler. The "comedi_test" driver does not currently support that. It is a bit special because it loops back the last values written to the channel on the analog output subdevice to be read back via corresponding channels on the analog input subdevice. The "insn_read" handler for the analog input subdevice is `waveform_ai_insn_read()`. Set that as the "insn_read" handler for the analog output subdevice as well. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
The last sample values written to the AO subdevice channels by its "insn_write" handler `waveform_ao_insn_write()` are stored in the member array `ao_loopbacks[]` in the device private data `struct waveform_private`. They can be read back via the "insn_read" handler of the AI subdevice `waveform_ai_insn_read()`. As the stored sample values are only 16 bits wide, change the type of the `ao_loopbacks[]` member to `unsigned short` to save some space. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
The asynchronous command handling for the analog input subdevice uses a kernel timer which expires approximately `HZ` times a second. However, it only needs to do anything after each scan period. Set the timer to expire just after the next scan period. Although the timer expiry function `waveform_ai_interrupt()` uses precise time values to generate the fake waveforms used to generate the data, those time values are constructed in a precise sequence, and do not depend on the time the timer expiry function is actually called. So the timer expiry rate does not have to be very precise. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
Rename the members `struct waveform_private` associated with fake waveform generation. The affected members are `uvolt_amplitude` --> `wf_amplitude` (the amplitude of the waveform), `usec_period` --> `wf_period` (the period of the waveform), and `usec_current` --> `wf_current` (the current time within a waveform period). Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
Rename the members of `struct waveform_private` that are used to handle AI commands, apart from those members used to control fake waveform generation. The renames are `timer` --> `ai_timer`, `scan_period` --> `ai_scan_period`, and `convert_period` --> `ai_convert_period`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
The private data structure `struct waveform_private` currently uses member `last` to remember the time of the last timer interrupt, and the member `usec_remainder` to keep track of how far into a simulated scan the interrupt occurred. Replace these with a single new member `ai_last_scan_time` that records the time of the last scan. This simplifies the calculation of the number of scans to simulate in the timer routine, `waveform_ai_interrupt()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
Use `unsigned int` instead of `unsigned long` to hold the period of the fake waveform generator and the current time within each waveform. The waveform period will be no more than `INT_MAX` and the current time within the waveform (prior to the modulo operation to bring it actually within the waveform period) will be no more than `INT_MAX + UINT_MAX / 1000`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
The fake waveform generator functions, `fake_sawtooth()` and `fake_squarewave()`, called from `fake_waveform()`, have a `current_time` parameter which is the time since the start of a waveform period. The parameter value may be greater than the waveform period so they do a modulo operation to bring it into range. Do the modulo operations outside the functions in `waveform_ai_interrupt()` so that the waveform generator functions always get a `current_time` parameter less than the waveform period and do not have to do the modulo operation themselves. Also, only do the modulo operations when the time since the start of a waveform exceeds the waveform period. Usually, several samples are produced in each waveform period and modulo operations are typically more expensive than a simple comparison. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
It is quite common for COMEDI subdevices that support commands to support setting `scan_begin_src` to `TRIG_FOLLOW`. This means the next scan begins once all conversions in the current scan are complete. Support the following timing combinations for the AI subdevice: scan_begin_src == TRIG_TIMER && convert_src == TRIG_TIMER scan_begin_src == TRIG_TIMER && convert_src == TRIG_NOW scan_begin_src == TRIG_FOLLOW && convert_src == TRIG_TIMER The actual scan period in microseconds is stored in the `scan_period` member of the private data structure `struct waveform_private`. An `unsigned int` is still wide enough, because the conversion period is no more than `UINT_MAX / 1000` microseconds and the number of conversions is no more than 16 (`N_CHANS * 2`). Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
When testing the parameters for setting up an asynchronous command on the AI subdevice, limit the maximum conversion period (`cmd->convert_arg`) so that the number of conversions in a scan (`cmd->scan_end_arg`, same as `cmd->chanlist_len`) multiplied by the conversion period fits within an `unsigned int`, as that is used to limit the minimum scan period (`cmd->scan_begin_arg`). Also ensure rounding of the conversion period and scan period to the nearest microsecond both fit in an `unsigned int`. Do all this in stage 4 ("fix up any arguments") of the command testing. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
The `static const int nano_per_micro` variable is set to 1000, the number of nanoseconds in a microsecond. Remove it and use the `NSEC_PER_USEC` macro from <linux/time.h> instead. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
While an asynchronous command is running on the analog input subdevice, fake waveform generators are connected to each channel to provide the input voltages that are converted to sample value. Channel 0 is connected to a sawtooth generator, channel 1 is connected to a squarewave generator, and the remaining channels are connected to a flatline generator. The non-flatline generators share the same amplitude (in microvolts) and period (in microseconds) which are configured when the COMEDI device is attached. All waveforms are centered around 0 microvolts and the non-flatline waveforms go between -amplitude and +amplitude. It is possible for the waveforms to swing outside the input range of the channels to which they are connected. When that happens, the sample values resulting from simulated A-to-D conversion will wrap around due to integer overflow. Prevent that by clamping the sample values that would go out of range. This is closer to how a real hardware device would behave (assuming the input voltage is not high enough to damage the hardware!). Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ian Abbott authored
Use the preferred style for multi-line comments. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Christian Gromm authored
This patch removes the unnecessary wait_queue that has exclusively been used for the poll function and its poll_table. Instead, an already existing one is used. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Christian Gromm authored
This patch replaces the usage of min() by min_t(). Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch adds brackets on all of the conditional branches in order to follow the linux coding style. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch moves the logical operators on the previous line in order to follow the linux coding style. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch removes unwanted blank lines in order to follow the linux coding style. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch properly aligns the block comment in order to follow the linux coding style convetions. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch add blank lines after functions definitions in order to follow the linux coding style. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch changes uint8_t type to preferred kernel type u8 in order to follow the linux coding style conventions. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch properly aligns the function arguments or its parameters in order to match the open bracket. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ioana Ciornei authored
This patch adds spaces around binary operators such as '*', '/', '+' in order to improve readability. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Punit Vara authored
This patch is to the host_interface.c that fixes up following warning by checkpatch: -prefer eth_broadcast_addr() over memset() Signed-off-by: Punit Vara <punitvara@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch fixes line over 80 characters found by checkpatch. WARNING: line over 80 characters FILE: drivers/staging/wilc1000/host_interface.h:424: Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch replaces kmalloc followed by memcpy with kmemdup. It is also added error checking to return -ENOMEM when kmemdup is failed. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes tenuAuth_type to auth_type that is sixth argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes u8mode to mode that is fifth argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes u8Keyidx to index that is fourth argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes u8WepKeylen to len that is third argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes pu8WepKey to key that is second argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes data type of variable i from u8 to int. It is used as index of an array to print its content. It's better to use as data type of int. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes struct host_if_drv of host_int_add_wep_key_bss_ap function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes return type of host_int_add_wep_key_bss_ap from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch fixes line over 80 characters found by checkpatch. WARNING: line over 80 characters FILE: drivers/staging/wilc1000/host_interface.h:408: Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch replaces kmalloc followed by memcpy with kmemdup. It is also added error checking of kmemdup. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Chaehyun Lim authored
This patch changes u8Keyidx to index that is fourth argument of host_int_add_wep_key_bss_sta to avoid camelcase. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-