Merge branch 'for-4.0-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[linux-2.6-block.git] / drivers / staging / comedi / drivers / jr3_pci.h
CommitLineData
b2be969b
BP
1/* Helper types to take care of the fact that the DSP card memory
2 * is 16 bits, but aligned on a 32 bit PCI boundary
3 */
4
95b24682 5static inline u16 get_u16(const u32 __iomem *p)
07b509e6 6{
95b24682 7 return (u16)readl(p);
07b509e6
AB
8}
9
95b24682 10static inline void set_u16(u32 __iomem *p, u16 val)
07b509e6
AB
11{
12 writel(val, p);
13}
14
95b24682 15static inline s16 get_s16(const s32 __iomem *p)
07b509e6 16{
95b24682 17 return (s16)readl(p);
07b509e6
AB
18}
19
95b24682 20static inline void set_s16(s32 __iomem *p, s16 val)
07b509e6
AB
21{
22 writel(val, p);
23}
24
b2be969b
BP
25/* The raw data is stored in a format which facilitates rapid
26 * processing by the JR3 DSP chip. The raw_channel structure shows the
27 * format for a single channel of data. Each channel takes four,
28 * two-byte words.
29 *
30 * Raw_time is an unsigned integer which shows the value of the JR3
31 * DSP's internal clock at the time the sample was received. The clock
32 * runs at 1/10 the JR3 DSP cycle time. JR3's slowest DSP runs at 10
33 * Mhz. At 10 Mhz raw_time would therefore clock at 1 Mhz.
34 *
35 * Raw_data is the raw data received directly from the sensor. The
36 * sensor data stream is capable of representing 16 different
37 * channels. Channel 0 shows the excitation voltage at the sensor. It
38 * is used to regulate the voltage over various cable lengths.
39 * Channels 1-6 contain the coupled force data Fx through Mz. Channel
40 * 7 contains the sensor's calibration data. The use of channels 8-15
41 * varies with different sensors.
42 */
43
2deee55e 44struct raw_channel {
54298a8d 45 u32 raw_time;
0642feb3
BP
46 s32 raw_data;
47 s32 reserved[2];
2deee55e 48};
07b509e6 49
b2be969b
BP
50/* The force_array structure shows the layout for the decoupled and
51 * filtered force data.
52 */
cdc14cd0 53struct force_array {
0642feb3
BP
54 s32 fx;
55 s32 fy;
56 s32 fz;
57 s32 mx;
58 s32 my;
59 s32 mz;
60 s32 v1;
61 s32 v2;
cdc14cd0 62};
07b509e6 63
b2be969b
BP
64/* The six_axis_array structure shows the layout for the offsets and
65 * the full scales.
66 */
5671c0c2 67struct six_axis_array {
0642feb3
BP
68 s32 fx;
69 s32 fy;
70 s32 fz;
71 s32 mx;
72 s32 my;
73 s32 mz;
5671c0c2 74};
07b509e6 75
b2be969b
BP
76/* VECT_BITS */
77/* The vect_bits structure shows the layout for indicating
78 * which axes to use in computing the vectors. Each bit signifies
79 * selection of a single axis. The V1x axis bit corresponds to a hex
80 * value of 0x0001 and the V2z bit corresponds to a hex value of
81 * 0x0020. Example: to specify the axes V1x, V1y, V2x, and V2z the
82 * pattern would be 0x002b. Vector 1 defaults to a force vector and
83 * vector 2 defaults to a moment vector. It is possible to change one
84 * or the other so that two force vectors or two moment vectors are
85 * calculated. Setting the changeV1 bit or the changeV2 bit will
86 * change that vector to be the opposite of its default. Therefore to
87 * have two force vectors, set changeV1 to 1.
88 */
07b509e6 89
f3fd0937
BP
90/* vect_bits appears to be unused at this time */
91enum {
07b509e6
AB
92 fx = 0x0001,
93 fy = 0x0002,
94 fz = 0x0004,
95 mx = 0x0008,
96 my = 0x0010,
97 mz = 0x0020,
98 changeV2 = 0x0040,
99 changeV1 = 0x0080
135f8a5e 100};
07b509e6 101
b2be969b
BP
102/* WARNING_BITS */
103/* The warning_bits structure shows the bit pattern for the warning
104 * word. The bit fields are shown from bit 0 (lsb) to bit 15 (msb).
105 */
106
107/* XX_NEAR_SET */
108/* The xx_near_sat bits signify that the indicated axis has reached or
109 * exceeded the near saturation value.
110 */
07b509e6 111
f3fd0937 112enum {
07b509e6
AB
113 fx_near_sat = 0x0001,
114 fy_near_sat = 0x0002,
115 fz_near_sat = 0x0004,
116 mx_near_sat = 0x0008,
117 my_near_sat = 0x0010,
118 mz_near_sat = 0x0020
135f8a5e 119};
07b509e6 120
b2be969b
BP
121/* ERROR_BITS */
122/* XX_SAT */
123/* MEMORY_ERROR */
124/* SENSOR_CHANGE */
125
126/* The error_bits structure shows the bit pattern for the error word.
127 * The bit fields are shown from bit 0 (lsb) to bit 15 (msb). The
128 * xx_sat bits signify that the indicated axis has reached or exceeded
129 * the saturation value. The memory_error bit indicates that a problem
130 * was detected in the on-board RAM during the power-up
131 * initialization. The sensor_change bit indicates that a sensor other
132 * than the one originally plugged in has passed its CRC check. This
133 * bit latches, and must be reset by the user.
134 *
135 */
136
137/* SYSTEM_BUSY */
138
139/* The system_busy bit indicates that the JR3 DSP is currently busy
140 * and is not calculating force data. This occurs when a new
141 * coordinate transformation, or new sensor full scale is set by the
142 * user. A very fast system using the force data for feedback might
143 * become unstable during the approximately 4 ms needed to accomplish
144 * these calculations. This bit will also become active when a new
145 * sensor is plugged in and the system needs to recalculate the
146 * calibration CRC.
147 */
148
149/* CAL_CRC_BAD */
150
151/* The cal_crc_bad bit indicates that the calibration CRC has not
152 * calculated to zero. CRC is short for cyclic redundancy code. It is
153 * a method for determining the integrity of messages in data
154 * communication. The calibration data stored inside the sensor is
155 * transmitted to the JR3 DSP along with the sensor data. The
156 * calibration data has a CRC attached to the end of it, to assist in
157 * determining the completeness and integrity of the calibration data
158 * received from the sensor. There are two reasons the CRC may not
159 * have calculated to zero. The first is that all the calibration data
160 * has not yet been received, the second is that the calibration data
161 * has been corrupted. A typical sensor transmits the entire contents
162 * of its calibration matrix over 30 times a second. Therefore, if
163 * this bit is not zero within a couple of seconds after the sensor
164 * has been plugged in, there is a problem with the sensor's
165 * calibration data.
166 */
167
168/* WATCH_DOG */
169/* WATCH_DOG2 */
170
171/* The watch_dog and watch_dog2 bits are sensor, not processor, watch
172 * dog bits. Watch_dog indicates that the sensor data line seems to be
173 * acting correctly, while watch_dog2 indicates that sensor data and
174 * clock are being received. It is possible for watch_dog2 to go off
175 * while watch_dog does not. This would indicate an improper clock
176 * signal, while data is acting correctly. If either watch dog barks,
177 * the sensor data is not being received correctly.
178 */
07b509e6 179
f3fd0937 180enum error_bits_t {
07b509e6
AB
181 fx_sat = 0x0001,
182 fy_sat = 0x0002,
183 fz_sat = 0x0004,
184 mx_sat = 0x0008,
185 my_sat = 0x0010,
186 mz_sat = 0x0020,
187 memory_error = 0x0400,
188 sensor_change = 0x0800,
189 system_busy = 0x1000,
190 cal_crc_bad = 0x2000,
191 watch_dog2 = 0x4000,
192 watch_dog = 0x8000
f3fd0937 193};
07b509e6 194
b2be969b
BP
195/* THRESH_STRUCT */
196
197/* This structure shows the layout for a single threshold packet inside of a
198 * load envelope. Each load envelope can contain several threshold structures.
199 * 1. data_address contains the address of the data for that threshold. This
200 * includes filtered, unfiltered, raw, rate, counters, error and warning data
201 * 2. threshold is the is the value at which, if data is above or below, the
202 * bits will be set ... (pag.24).
203 * 3. bit_pattern contains the bits that will be set if the threshold value is
204 * met or exceeded.
205 */
206
38443673 207struct thresh_struct {
07b509e6
AB
208 s32 data_address;
209 s32 threshold;
210 s32 bit_pattern;
38443673 211};
07b509e6 212
b2be969b
BP
213/* LE_STRUCT */
214
215/* Layout of a load enveloped packet. Four thresholds are showed ... for more
216 * see manual (pag.25)
217 * 1. latch_bits is a bit pattern that show which bits the user wants to latch.
218 * The latched bits will not be reset once the threshold which set them is
219 * no longer true. In that case the user must reset them using the reset_bit
220 * command.
221 * 2. number_of_xx_thresholds specify how many GE/LE threshold there are.
222 */
0306b0cb 223struct le_struct {
07b509e6
AB
224 s32 latch_bits;
225 s32 number_of_ge_thresholds;
226 s32 number_of_le_thresholds;
227 struct thresh_struct thresholds[4];
228 s32 reserved;
0306b0cb 229};
07b509e6 230
b2be969b
BP
231/* LINK_TYPES */
232/* Link types is an enumerated value showing the different possible transform
233 * link types.
234 * 0 - end transform packet
235 * 1 - translate along X axis (TX)
236 * 2 - translate along Y axis (TY)
237 * 3 - translate along Z axis (TZ)
238 * 4 - rotate about X axis (RX)
239 * 5 - rotate about Y axis (RY)
240 * 6 - rotate about Z axis (RZ)
241 * 7 - negate all axes (NEG)
242 */
243
4e1ccd97 244enum link_types {
07b509e6
AB
245 end_x_form,
246 tx,
247 ty,
248 tz,
249 rx,
250 ry,
251 rz,
252 neg
4e1ccd97 253};
07b509e6 254
b2be969b
BP
255/* TRANSFORM */
256/* Structure used to describe a transform. */
1c31ddaf 257struct intern_transform {
07b509e6 258 struct {
54298a8d 259 u32 link_type;
0642feb3 260 s32 link_amount;
07b509e6 261 } link[8];
1c31ddaf 262};
07b509e6 263
9ef6a833 264/* JR3 force/torque sensor data definition. For more information see sensor
265 * and hardware manuals.
266 */
07b509e6 267
67080790 268struct jr3_channel {
b2be969b
BP
269 /* Raw_channels is the area used to store the raw data coming from */
270 /* the sensor. */
07b509e6 271
2deee55e 272 struct raw_channel raw_channels[16]; /* offset 0x0000 */
07b509e6 273
b2be969b
BP
274 /* Copyright is a null terminated ASCII string containing the JR3 */
275 /* copyright notice. */
07b509e6 276
54298a8d 277 u32 copyright[0x0018]; /* offset 0x0040 */
0642feb3 278 s32 reserved1[0x0008]; /* offset 0x0058 */
07b509e6 279
b2be969b
BP
280 /* Shunts contains the sensor shunt readings. Some JR3 sensors have
281 * the ability to have their gains adjusted. This allows the
282 * hardware full scales to be adjusted to potentially allow
283 * better resolution or dynamic range. For sensors that have
284 * this ability, the gain of each sensor channel is measured at
285 * the time of calibration using a shunt resistor. The shunt
286 * resistor is placed across one arm of the resistor bridge, and
287 * the resulting change in the output of that channel is
288 * measured. This measurement is called the shunt reading, and
289 * is recorded here. If the user has changed the gain of the //
290 * sensor, and made new shunt measurements, those shunt
291 * measurements can be placed here. The JR3 DSP will then scale
292 * the calibration matrix such so that the gains are again
293 * proper for the indicated shunt readings. If shunts is 0, then
294 * the sensor cannot have its gain changed. For details on
295 * changing the sensor gain, and making shunts readings, please
296 * see the sensor manual. To make these values take effect the
297 * user must call either command (5) use transform # (pg. 33) or
298 * command (10) set new full scales (pg. 38).
299 */
07b509e6 300
5671c0c2 301 struct six_axis_array shunts; /* offset 0x0060 */
07b509e6
AB
302 s32 reserved2[2]; /* offset 0x0066 */
303
b2be969b
BP
304 /* Default_FS contains the full scale that is used if the user does */
305 /* not set a full scale. */
07b509e6 306
5671c0c2 307 struct six_axis_array default_FS; /* offset 0x0068 */
0a85b6f0 308 s32 reserved3; /* offset 0x006e */
07b509e6 309
b2be969b
BP
310 /* Load_envelope_num is the load envelope number that is currently
311 * in use. This value is set by the user after one of the load
312 * envelopes has been initialized.
313 */
07b509e6 314
0642feb3 315 s32 load_envelope_num; /* offset 0x006f */
07b509e6 316
b2be969b
BP
317 /* Min_full_scale is the recommend minimum full scale. */
318
319 /* These values in conjunction with max_full_scale (pg. 9) helps
320 * determine the appropriate value for setting the full scales. The
321 * software allows the user to set the sensor full scale to an
322 * arbitrary value. But setting the full scales has some hazards. If
323 * the full scale is set too low, the data will saturate
324 * prematurely, and dynamic range will be lost. If the full scale is
325 * set too high, then resolution is lost as the data is shifted to
326 * the right and the least significant bits are lost. Therefore the
327 * maximum full scale is the maximum value at which no resolution is
328 * lost, and the minimum full scale is the value at which the data
329 * will not saturate prematurely. These values are calculated
330 * whenever a new coordinate transformation is calculated. It is
331 * possible for the recommended maximum to be less than the
332 * recommended minimum. This comes about primarily when using
333 * coordinate translations. If this is the case, it means that any
334 * full scale selection will be a compromise between dynamic range
335 * and resolution. It is usually recommended to compromise in favor
336 * of resolution which means that the recommend maximum full scale
337 * should be chosen.
338 *
339 * WARNING: Be sure that the full scale is no less than 0.4% of the
340 * recommended minimum full scale. Full scales below this value will
341 * cause erroneous results.
342 */
07b509e6 343
5671c0c2 344 struct six_axis_array min_full_scale; /* offset 0x0070 */
0a85b6f0 345 s32 reserved4; /* offset 0x0076 */
07b509e6 346
b2be969b
BP
347 /* Transform_num is the transform number that is currently in use.
348 * This value is set by the JR3 DSP after the user has used command
349 * (5) use transform # (pg. 33).
350 */
07b509e6 351
0642feb3 352 s32 transform_num; /* offset 0x0077 */
07b509e6 353
b2be969b
BP
354 /* Max_full_scale is the recommended maximum full scale. See */
355 /* min_full_scale (pg. 9) for more details. */
07b509e6 356
5671c0c2 357 struct six_axis_array max_full_scale; /* offset 0x0078 */
0a85b6f0 358 s32 reserved5; /* offset 0x007e */
07b509e6 359
b2be969b
BP
360 /* Peak_address is the address of the data which will be monitored
361 * by the peak routine. This value is set by the user. The peak
362 * routine will monitor any 8 contiguous addresses for peak values.
363 * (ex. to watch filter3 data for peaks, set this value to 0x00a8).
364 */
07b509e6 365
0642feb3 366 s32 peak_address; /* offset 0x007f */
07b509e6 367
b2be969b
BP
368 /* Full_scale is the sensor full scales which are currently in use.
369 * Decoupled and filtered data is scaled so that +/- 16384 is equal
370 * to the full scales. The engineering units used are indicated by
371 * the units value discussed on page 16. The full scales for Fx, Fy,
372 * Fz, Mx, My and Mz can be written by the user prior to calling
373 * command (10) set new full scales (pg. 38). The full scales for V1
374 * and V2 are set whenever the full scales are changed or when the
375 * axes used to calculate the vectors are changed. The full scale of
376 * V1 and V2 will always be equal to the largest full scale of the
377 * axes used for each vector respectively.
378 */
07b509e6 379
cdc14cd0 380 struct force_array full_scale; /* offset 0x0080 */
07b509e6 381
b2be969b
BP
382 /* Offsets contains the sensor offsets. These values are subtracted from
383 * the sensor data to obtain the decoupled data. The offsets are set a
384 * few seconds (< 10) after the calibration data has been received.
385 * They are set so that the output data will be zero. These values
386 * can be written as well as read. The JR3 DSP will use the values
387 * written here within 2 ms of being written. To set future
388 * decoupled data to zero, add these values to the current decoupled
389 * data values and place the sum here. The JR3 DSP will change these
390 * values when a new transform is applied. So if the offsets are
391 * such that FX is 5 and all other values are zero, after rotating
392 * about Z by 90 degrees, FY would be 5 and all others would be zero.
393 */
07b509e6 394
5671c0c2 395 struct six_axis_array offsets; /* offset 0x0088 */
07b509e6 396
b2be969b
BP
397 /* Offset_num is the number of the offset currently in use. This
398 * value is set by the JR3 DSP after the user has executed the use
399 * offset # command (pg. 34). It can vary between 0 and 15.
400 */
07b509e6 401
0a85b6f0 402 s32 offset_num; /* offset 0x008e */
07b509e6 403
b2be969b
BP
404 /* Vect_axes is a bit map showing which of the axes are being used
405 * in the vector calculations. This value is set by the JR3 DSP
406 * after the user has executed the set vector axes command (pg. 37).
407 */
07b509e6 408
0a85b6f0 409 u32 vect_axes; /* offset 0x008f */
07b509e6 410
b2be969b
BP
411 /* Filter0 is the decoupled, unfiltered data from the JR3 sensor.
412 * This data has had the offsets removed.
413 *
414 * These force_arrays hold the filtered data. The decoupled data is
415 * passed through cascaded low pass filters. Each succeeding filter
416 * has a cutoff frequency of 1/4 of the preceding filter. The cutoff
417 * frequency of filter1 is 1/16 of the sample rate from the sensor.
418 * For a typical sensor with a sample rate of 8 kHz, the cutoff
419 * frequency of filter1 would be 500 Hz. The following filters would
420 * cutoff at 125 Hz, 31.25 Hz, 7.813 Hz, 1.953 Hz and 0.4883 Hz.
421 */
07b509e6
AB
422
423 struct force_array filter[7]; /* offset 0x0090,
424 offset 0x0098,
425 offset 0x00a0,
426 offset 0x00a8,
427 offset 0x00b0,
428 offset 0x00b8 ,
429 offset 0x00c0 */
430
b2be969b
BP
431 /* Rate_data is the calculated rate data. It is a first derivative
432 * calculation. It is calculated at a frequency specified by the
433 * variable rate_divisor (pg. 12). The data on which the rate is
434 * calculated is specified by the variable rate_address (pg. 12).
435 */
07b509e6 436
cdc14cd0 437 struct force_array rate_data; /* offset 0x00c8 */
07b509e6 438
b2be969b
BP
439 /* Minimum_data & maximum_data are the minimum and maximum (peak)
440 * data values. The JR3 DSP can monitor any 8 contiguous data items
441 * for minimums and maximums at full sensor bandwidth. This area is
442 * only updated at user request. This is done so that the user does
443 * not miss any peaks. To read the data, use either the read peaks
444 * command (pg. 40), or the read and reset peaks command (pg. 39).
445 * The address of the data to watch for peaks is stored in the
446 * variable peak_address (pg. 10). Peak data is lost when executing
447 * a coordinate transformation or a full scale change. Peak data is
448 * also lost when plugging in a new sensor.
449 */
07b509e6 450
cdc14cd0
BP
451 struct force_array minimum_data; /* offset 0x00d0 */
452 struct force_array maximum_data; /* offset 0x00d8 */
07b509e6 453
b2be969b
BP
454 /* Near_sat_value & sat_value contain the value used to determine if
455 * the raw sensor is saturated. Because of decoupling and offset
456 * removal, it is difficult to tell from the processed data if the
457 * sensor is saturated. These values, in conjunction with the error
458 * and warning words (pg. 14), provide this critical information.
459 * These two values may be set by the host processor. These values
460 * are positive signed values, since the saturation logic uses the
461 * absolute values of the raw data. The near_sat_value defaults to
462 * approximately 80% of the ADC's full scale, which is 26214, while
463 * sat_value defaults to the ADC's full scale:
464 *
465 * sat_value = 32768 - 2^(16 - ADC bits)
466 */
07b509e6 467
0642feb3 468 s32 near_sat_value; /* offset 0x00e0 */
0a85b6f0 469 s32 sat_value; /* offset 0x00e1 */
07b509e6 470
b2be969b
BP
471 /* Rate_address, rate_divisor & rate_count contain the data used to
472 * control the calculations of the rates. Rate_address is the
473 * address of the data used for the rate calculation. The JR3 DSP
474 * will calculate rates for any 8 contiguous values (ex. to
475 * calculate rates for filter3 data set rate_address to 0x00a8).
476 * Rate_divisor is how often the rate is calculated. If rate_divisor
477 * is 1, the rates are calculated at full sensor bandwidth. If
478 * rate_divisor is 200, rates are calculated every 200 samples.
479 * Rate_divisor can be any value between 1 and 65536. Set
480 * rate_divisor to 0 to calculate rates every 65536 samples.
481 * Rate_count starts at zero and counts until it equals
482 * rate_divisor, at which point the rates are calculated, and
483 * rate_count is reset to 0. When setting a new rate divisor, it is
484 * a good idea to set rate_count to one less than rate divisor. This
485 * will minimize the time necessary to start the rate calculations.
486 */
07b509e6 487
0642feb3 488 s32 rate_address; /* offset 0x00e2 */
54298a8d 489 u32 rate_divisor; /* offset 0x00e3 */
0a85b6f0 490 u32 rate_count; /* offset 0x00e4 */
07b509e6 491
b2be969b
BP
492 /* Command_word2 through command_word0 are the locations used to
493 * send commands to the JR3 DSP. Their usage varies with the command
494 * and is detailed later in the Command Definitions section (pg.
495 * 29). In general the user places values into various memory
496 * locations, and then places the command word into command_word0.
497 * The JR3 DSP will process the command and place a 0 into
498 * command_word0 to indicate successful completion. Alternatively
499 * the JR3 DSP will place a negative number into command_word0 to
500 * indicate an error condition. Please note the command locations
501 * are numbered backwards. (I.E. command_word2 comes before
502 * command_word1).
503 */
07b509e6 504
0642feb3
BP
505 s32 command_word2; /* offset 0x00e5 */
506 s32 command_word1; /* offset 0x00e6 */
507 s32 command_word0; /* offset 0x00e7 */
07b509e6 508
b2be969b
BP
509 /* Count1 through count6 are unsigned counters which are incremented
510 * every time the matching filters are calculated. Filter1 is
511 * calculated at the sensor data bandwidth. So this counter would
512 * increment at 8 kHz for a typical sensor. The rest of the counters
513 * are incremented at 1/4 the interval of the counter immediately
514 * preceding it, so they would count at 2 kHz, 500 Hz, 125 Hz etc.
515 * These counters can be used to wait for data. Each time the
516 * counter changes, the corresponding data set can be sampled, and
517 * this will insure that the user gets each sample, once, and only
518 * once.
519 */
07b509e6 520
54298a8d
BP
521 u32 count1; /* offset 0x00e8 */
522 u32 count2; /* offset 0x00e9 */
523 u32 count3; /* offset 0x00ea */
524 u32 count4; /* offset 0x00eb */
525 u32 count5; /* offset 0x00ec */
526 u32 count6; /* offset 0x00ed */
07b509e6 527
b2be969b
BP
528 /* Error_count is a running count of data reception errors. If this
529 * counter is changing rapidly, it probably indicates a bad sensor
530 * cable connection or other hardware problem. In most installations
531 * error_count should not change at all. But it is possible in an
532 * extremely noisy environment to experience occasional errors even
533 * without a hardware problem. If the sensor is well grounded, this
534 * is probably unavoidable in these environments. On the occasions
535 * where this counter counts a bad sample, that sample is ignored.
536 */
07b509e6 537
54298a8d 538 u32 error_count; /* offset 0x00ee */
07b509e6 539
b2be969b
BP
540 /* Count_x is a counter which is incremented every time the JR3 DSP
541 * searches its job queues and finds nothing to do. It indicates the
542 * amount of idle time the JR3 DSP has available. It can also be
543 * used to determine if the JR3 DSP is alive. See the Performance
544 * Issues section on pg. 49 for more details.
545 */
07b509e6 546
0a85b6f0 547 u32 count_x; /* offset 0x00ef */
07b509e6 548
b2be969b
BP
549 /* Warnings & errors contain the warning and error bits
550 * respectively. The format of these two words is discussed on page
551 * 21 under the headings warnings_bits and error_bits.
552 */
07b509e6 553
0a85b6f0 554 u32 warnings; /* offset 0x00f0 */
54298a8d 555 u32 errors; /* offset 0x00f1 */
07b509e6 556
b2be969b
BP
557 /* Threshold_bits is a word containing the bits that are set by the
558 * load envelopes. See load_envelopes (pg. 17) and thresh_struct
559 * (pg. 23) for more details.
560 */
07b509e6 561
0642feb3 562 s32 threshold_bits; /* offset 0x00f2 */
07b509e6 563
b2be969b
BP
564 /* Last_crc is the value that shows the actual calculated CRC. CRC
565 * is short for cyclic redundancy code. It should be zero. See the
566 * description for cal_crc_bad (pg. 21) for more information.
567 */
07b509e6 568
0a85b6f0 569 s32 last_CRC; /* offset 0x00f3 */
07b509e6 570
b2be969b
BP
571 /* EEProm_ver_no contains the version number of the sensor EEProm.
572 * EEProm version numbers can vary between 0 and 255.
573 * Software_ver_no contains the software version number. Version
574 * 3.02 would be stored as 302.
575 */
07b509e6 576
0642feb3
BP
577 s32 eeprom_ver_no; /* offset 0x00f4 */
578 s32 software_ver_no; /* offset 0x00f5 */
07b509e6 579
b2be969b
BP
580 /* Software_day & software_year are the release date of the software
581 * the JR3 DSP is currently running. Day is the day of the year,
582 * with January 1 being 1, and December 31, being 365 for non leap
583 * years.
584 */
07b509e6 585
0642feb3
BP
586 s32 software_day; /* offset 0x00f6 */
587 s32 software_year; /* offset 0x00f7 */
07b509e6 588
b2be969b
BP
589 /* Serial_no & model_no are the two values which uniquely identify a
590 * sensor. This model number does not directly correspond to the JR3
591 * model number, but it will provide a unique identifier for
592 * different sensor configurations.
593 */
07b509e6 594
0a85b6f0
MT
595 u32 serial_no; /* offset 0x00f8 */
596 u32 model_no; /* offset 0x00f9 */
07b509e6 597
b2be969b
BP
598 /* Cal_day & cal_year are the sensor calibration date. Day is the
599 * day of the year, with January 1 being 1, and December 31, being
600 * 366 for leap years.
601 */
07b509e6 602
0a85b6f0
MT
603 s32 cal_day; /* offset 0x00fa */
604 s32 cal_year; /* offset 0x00fb */
07b509e6 605
b2be969b
BP
606 /* Units is an enumerated read only value defining the engineering
607 * units used in the sensor full scale. The meanings of particular
608 * values are discussed in the section detailing the force_units
609 * structure on page 22. The engineering units are setto customer
610 * specifications during sensor manufacture and cannot be changed by
611 * writing to Units.
612 *
613 * Bits contains the number of bits of resolution of the ADC
614 * currently in use.
615 *
616 * Channels is a bit field showing which channels the current sensor
617 * is capable of sending. If bit 0 is active, this sensor can send
618 * channel 0, if bit 13 is active, this sensor can send channel 13,
619 * etc. This bit can be active, even if the sensor is not currently
620 * sending this channel. Some sensors are configurable as to which
621 * channels to send, and this field only contains information on the
622 * channels available to send, not on the current configuration. To
623 * find which channels are currently being sent, monitor the
624 * Raw_time fields (pg. 19) in the raw_channels array (pg. 7). If
625 * the time is changing periodically, then that channel is being
626 * received.
627 */
07b509e6 628
54298a8d 629 u32 units; /* offset 0x00fc */
0642feb3 630 s32 bits; /* offset 0x00fd */
0a85b6f0 631 s32 channels; /* offset 0x00fe */
07b509e6 632
b2be969b
BP
633 /* Thickness specifies the overall thickness of the sensor from
634 * flange to flange. The engineering units for this value are
635 * contained in units (pg. 16). The sensor calibration is relative
636 * to the center of the sensor. This value allows easy coordinate
637 * transformation from the center of the sensor to either flange.
638 */
07b509e6 639
0a85b6f0 640 s32 thickness; /* offset 0x00ff */
07b509e6 641
b2be969b
BP
642 /* Load_envelopes is a table containing the load envelope
643 * descriptions. There are 16 possible load envelope slots in the
644 * table. The slots are on 16 word boundaries and are numbered 0-15.
645 * Each load envelope needs to start at the beginning of a slot but
646 * need not be fully contained in that slot. That is to say that a
647 * single load envelope can be larger than a single slot. The
648 * software has been tested and ran satisfactorily with 50
649 * thresholds active. A single load envelope this large would take
650 * up 5 of the 16 slots. The load envelope data is laid out in an
651 * order that is most efficient for the JR3 DSP. The structure is
652 * detailed later in the section showing the definition of the
653 * le_struct structure (pg. 23).
654 */
07b509e6 655
0306b0cb 656 struct le_struct load_envelopes[0x10]; /* offset 0x0100 */
07b509e6 657
b2be969b
BP
658 /* Transforms is a table containing the transform descriptions.
659 * There are 16 possible transform slots in the table. The slots are
660 * on 16 word boundaries and are numbered 0-15. Each transform needs
661 * to start at the beginning of a slot but need not be fully
662 * contained in that slot. That is to say that a single transform
663 * can be larger than a single slot. A transform is 2 * no of links
664 * + 1 words in length. So a single slot can contain a transform
665 * with 7 links. Two slots can contain a transform that is 15 links.
666 * The layout is detailed later in the section showing the
667 * definition of the transform structure (pg. 26).
668 */
07b509e6 669
1c31ddaf 670 struct intern_transform transforms[0x10]; /* offset 0x0200 */
67080790 671};
07b509e6 672
b2e1b3c2 673struct jr3_t {
07b509e6 674 struct {
127301cb 675 u32 program_lo[0x4000]; /* 0x00000 - 0x10000 */
67080790 676 struct jr3_channel data; /* 0x10000 - 0x10c00 */
b2be969b 677 char pad2[0x30000 - 0x00c00]; /* 0x10c00 - 0x40000 */
127301cb
HS
678 u32 program_hi[0x8000]; /* 0x40000 - 0x60000 */
679 u32 reset; /* 0x60000 - 0x60004 */
b2be969b 680 char pad3[0x20000 - 0x00004]; /* 0x60004 - 0x80000 */
07b509e6 681 } channel[4];
b2e1b3c2 682};