Date:2010-11-06 21:03:33 (13 years 4 months ago)
Author:Werner Almesberger
Commit:190e8f00827e6b1211caf10d69b565ee8f397f63
Message:Firmware support for CNTR version 3.

- common/io.h: describe the role of PROBE_TERM in version 3
- common/io.h (VERSION_ID): renamed to VERSION_ID1
- common/io.h (VERSION_ID2): added P2_0, and described version number
encoding
- cntr/cntr.h (enum hw_type): added HW_TYPE_V3
- cntr/cntr.c (init_io): decode version 3, flash LED three times, and
configure PROBE_TERM according to version
Files: cntr/fw/cntr/cntr.c (3 diffs)
cntr/fw/cntr/cntr.h (1 diff)
cntr/fw/common/io.h (2 diffs)

Change Details

cntr/fw/cntr/cntr.c
2222
2323
2424uint8_t cntr[4];
25enum hw_type hw_type = HW_TYPE_V1;
25enum hw_type hw_type;
2626
2727
2828static void delay(unsigned ms)
...... 
3737
3838static void init_io(void)
3939{
40    if (VERSION_ID) {
41        /* flash LED a second time */
40    int i;
41
42    /* SDCC bug - needs parentheses here */
43    hw_type = VERSION_ID1 ?
44        (VERSION_ID2 ? HW_TYPE_V2 : HW_TYPE_V3) :
45        HW_TYPE_V1;
46
47    for (i = HW_TYPE_V1; i != hw_type; i++) {
48        /* flash LED a second or third time */
4249        LEDv2 = 0;
4350        delay(250);
4451        LEDv2 = 1;
4552        delay(250);
46
47        PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT;
48
49        hw_type = HW_TYPE_V2;
5053    }
54    if (hw_type == HW_TYPE_V2)
55        PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT;
5156
5257    /*
5358     * Signal Mode Value
...... 
7075    P2 = 0;
7176    P3 = 0;
7277
73    if (hw_type == HW_TYPE_V2)
78    if (hw_type == HW_TYPE_V2 || hw_type == HW_TYPE_V3)
7479        PROBE_TERM = 1;
7580
7681    /*
cntr/fw/cntr/cntr.h
2525extern enum hw_type {
2626    HW_TYPE_V1 = 0,
2727    HW_TYPE_V2 = 1,
28    HW_TYPE_V3 = 2,
2829} hw_type;
2930
3031#endif /* !CNTR_H */
cntr/fw/common/io.h
3030 *
3131 * - v1: 100 kOhm termination (not very useful)
3232 * - v2: pull-up for input amplifier
33 * - v3: 330 Ohm termination
3334 */
3435
3536#define PROBE_TERM P1_2
...... 
4041 * In version 1, P2_1 is used to provide ground to the input side. In version
4142 * 2, we use a ground place for this and P2_1 is unconnected. We can therefore
4243 * use it to identify the hardware version.
44 *
45 * In version 3, P2_0 is connected to ground. In all other versions, it is
46 * unconnected.
47 *
48 * Board VERSION_ID1
49 * | VERSION_ID2
50 * | |
51 * v1 0 Z
52 * v2 Z Z
53 * v3 Z 0
54 *
4355 */
4456
45#define VERSION_ID P2_1
57#define VERSION_ID1 P2_1
58#define VERSION_ID2 P2_0
4659
4760#endif /* !IO_H */

Archive Download the corresponding diff file



interactive