1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-09-30 00:58:32 +03:00

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
This commit is contained in:
Werner Almesberger 2010-11-06 17:03:33 -03:00
parent 10b4b51e4f
commit 190e8f0082
3 changed files with 28 additions and 9 deletions

View File

@ -22,7 +22,7 @@
uint8_t cntr[4];
enum hw_type hw_type = HW_TYPE_V1;
enum hw_type hw_type;
static void delay(unsigned ms)
@ -37,17 +37,22 @@ static void delay(unsigned ms)
static void init_io(void)
{
if (VERSION_ID) {
/* flash LED a second time */
int i;
/* SDCC bug - needs parentheses here */
hw_type = VERSION_ID1 ?
(VERSION_ID2 ? HW_TYPE_V2 : HW_TYPE_V3) :
HW_TYPE_V1;
for (i = HW_TYPE_V1; i != hw_type; i++) {
/* flash LED a second or third time */
LEDv2 = 0;
delay(250);
LEDv2 = 1;
delay(250);
PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT;
hw_type = HW_TYPE_V2;
}
if (hw_type == HW_TYPE_V2)
PROBE_TERM_MODE |= 1 << PROBE_TERM_BIT;
/*
* Signal Mode Value
@ -70,7 +75,7 @@ static void init_io(void)
P2 = 0;
P3 = 0;
if (hw_type == HW_TYPE_V2)
if (hw_type == HW_TYPE_V2 || hw_type == HW_TYPE_V3)
PROBE_TERM = 1;
/*

View File

@ -25,6 +25,7 @@ extern uint8_t cntr[4];
extern enum hw_type {
HW_TYPE_V1 = 0,
HW_TYPE_V2 = 1,
HW_TYPE_V3 = 2,
} hw_type;
#endif /* !CNTR_H */

View File

@ -30,6 +30,7 @@
*
* - v1: 100 kOhm termination (not very useful)
* - v2: pull-up for input amplifier
* - v3: 330 Ohm termination
*/
#define PROBE_TERM P1_2
@ -40,8 +41,20 @@
* In version 1, P2_1 is used to provide ground to the input side. In version
* 2, we use a ground place for this and P2_1 is unconnected. We can therefore
* use it to identify the hardware version.
*
* In version 3, P2_0 is connected to ground. In all other versions, it is
* unconnected.
*
* Board VERSION_ID1
* | VERSION_ID2
* | |
* v1 0 Z
* v2 Z Z
* v3 Z 0
*
*/
#define VERSION_ID P2_1
#define VERSION_ID1 P2_1
#define VERSION_ID2 P2_0
#endif /* !IO_H */