1 | # |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | |
---|
5 | This is a port of the Winsystems Linux driver to RTEMS. |
---|
6 | |
---|
7 | In general, the goal was to minimize changes to the user level |
---|
8 | library and only replace Linux IO calls to the device driver |
---|
9 | with direct access functions. |
---|
10 | |
---|
11 | The driver uses 4 Classic API Barriers. |
---|
12 | |
---|
13 | --joel sherrill |
---|
14 | |
---|
15 | Issues |
---|
16 | ====== |
---|
17 | + The library is not reentrant. The GNU/Linux version uses global variables |
---|
18 | to track the state of certain variables and access to these is not protected. |
---|
19 | This design flaw is carried over into the RTEMS version. |
---|
20 | |
---|
21 | + We want to timestamp samples and the initial code did not do that. I |
---|
22 | added this. |
---|
23 | |
---|
24 | New Methods |
---|
25 | =========== |
---|
26 | void pcmmio_initialize( |
---|
27 | unsigned short _base_port, |
---|
28 | unsigned short _irq |
---|
29 | ); |
---|
30 | |
---|
31 | void flush_buffered_ints(void); |
---|
32 | |
---|
33 | int wait_adc_int_with_timeout(int adc_num, int milliseconds); |
---|
34 | |
---|
35 | int wait_dac_int_with_timeout(int dac_num, int milliseconds); |
---|
36 | |
---|
37 | int wait_dio_int_with_timeout(int milliseconds); |
---|
38 | |
---|
39 | int wait_dio_int_with_timestamp( |
---|
40 | int milliseconds, |
---|
41 | unsigned long long *timestamp |
---|
42 | ); |
---|
43 | int dio_get_missed_interrupts(void); |
---|
44 | |
---|
45 | RTEMS Configuration |
---|
46 | =================== |
---|
47 | The driver needs: |
---|
48 | |
---|
49 | + 3 Classic API Barriers |
---|
50 | + 1 Classic API Message Queue |
---|
51 | - 1024 buffers of sizeof(din_messsage_t) (should be 12 bytes) |
---|
52 | |
---|
53 | The pcmmio_shell example is probably over configured but is a |
---|
54 | working guide. |
---|
55 | |
---|
56 | RTEMS Shell Commands |
---|
57 | ==================== |
---|
58 | The following RTEMS Shell configuration aids are defined to assist in |
---|
59 | adding PCMMIO related commands to your shell. |
---|
60 | CONFIGURE_PCMMIO_ALIASES |
---|
61 | CONFIGURE_PCMMIO_COMMANDS |
---|
62 | |
---|
63 | pcmmio_din - Read Discrete Inputs |
---|
64 | pcmmio_din [-i iterations] [-p period] [-v] |
---|
65 | Where: maximum iterations defaults to 1 |
---|
66 | the period is in milliseconds and defaults to 1000 |
---|
67 | |
---|
68 | pcmmio_dout - Write a Discrete Output |
---|
69 | pcmmio_dout bit value |
---|
70 | Where: bit must be 0-47 |
---|
71 | value must be 0 or 1 |
---|
72 | |
---|
73 | pcmmio_adc - Read Analog Inputs |
---|
74 | pcmmio_adc [-i iterations] [-p period] [-v] |
---|
75 | Where: maximum iterations defaults to 1 |
---|
76 | the period is in milliseconds and defaults to 1000 |
---|
77 | |
---|
78 | pcmmio_dac - Write Analog Output |
---|
79 | pcmmio_dac dac voltage |
---|
80 | pcmmio_dac dac low high step time_per_step maximum_time |
---|
81 | |
---|
82 | Where: dac must be 0-7 |
---|
83 | voltages and step must be -10V to +10V |
---|
84 | times are in milliseconds |
---|
85 | |
---|
86 | First form is a single write. |
---|
87 | Second form writes a pattern. |
---|
88 | |
---|
89 | pcmmio_irq - Wait for PCMMIO IRQs |
---|
90 | pcmmio_irq [-i iterations] [-p period] [-v] [-d|-D DAC|-a ADC] |
---|
91 | |
---|
92 | Where: maximum iterations defaults to 1 |
---|
93 | the period is in milliseconds and defaults to 1000 |
---|
94 | -d enables discrete input irq monitoring |
---|
95 | -D DAC enables irq monitoring on the DAC channel "DAC" |
---|
96 | -a ADC enables irq monitoring on the ADC channel "ADC" |
---|
97 | |
---|
98 | You select one of the three IRQ sources to monitor. |
---|
99 | |
---|
100 | Aliases |
---|
101 | + adc - alias for pcmmio_adc |
---|
102 | + dac - alias for pcmmio_dac |
---|
103 | + din - alias for pcmmio_din |
---|
104 | + dout - alias for pcmmio_dout |
---|