enc28j60: Print revision during initialization
This is useful as debug information since the revisions of this device have notable differences. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
parent
ba6a0bc381
commit
b21da96e67
|
@ -114,6 +114,7 @@
|
||||||
#define MAADR5 0x00 /* MAADR<15:8> */
|
#define MAADR5 0x00 /* MAADR<15:8> */
|
||||||
#define MAADR6 0x01 /* MAADR<7:0> */
|
#define MAADR6 0x01 /* MAADR<7:0> */
|
||||||
#define MISTAT 0x0a
|
#define MISTAT 0x0a
|
||||||
|
#define EREVID 0x12
|
||||||
|
|
||||||
#define EPKTCNT_BANK 0x01
|
#define EPKTCNT_BANK 0x01
|
||||||
#define ERXFCON 0x18
|
#define ERXFCON 0x18
|
||||||
|
@ -233,6 +234,24 @@ softreset(void)
|
||||||
bank = ERXTX_BANK;
|
bank = ERXTX_BANK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#if DEBUG
|
||||||
|
static uint8_t
|
||||||
|
readrev(void)
|
||||||
|
{
|
||||||
|
uint8_t rev;
|
||||||
|
setregbank(MAADRX_BANK);
|
||||||
|
rev = readreg(EREVID);
|
||||||
|
switch(rev) {
|
||||||
|
case 2:
|
||||||
|
return 1;
|
||||||
|
case 6:
|
||||||
|
return 7;
|
||||||
|
default:
|
||||||
|
return rev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
reset(void)
|
reset(void)
|
||||||
{
|
{
|
||||||
|
@ -464,6 +483,8 @@ enc28j60_init(uint8_t *mac_addr)
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
PRINTF("ENC28J60 rev. B%d\n", readrev());
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue