18F4550 - Registers dedicated to USB
1) In the datasheet, generic names assigned to buffer descriptors for endpoints are:
BDnSTAT : BD Status register
BDnCNT : BD Byte Count register
BDnADRL : BD Address Low register
BDnADRH : BD Address High register
But Brad Minch seems to define separate blocks for IN and OUT (some shown only).
#define BD0OST 0x0400
#define BD0OBC 0x0401
#define BD0OAL 0x0402
#define BD0OAH 0x0403
#define BD0IST 0x0404
#define BD0IBC 0x0405
#define BD0IAL 0x0406
#define BD0IAH 0x0407
#define BD1OST 0x0408
#define BD1OBC 0x0409
#define BD1OAL 0x040A
#define BD1OAH 0x040B
#define BD1IST 0x040C
#define BD1IBC 0x040D
#define BD1IAL 0x040E
#define BD1IAH 0x040F
................................
Why?
2) In the .INC file defining USB values, we find this notation:
#define TOKEN_OUT (0x01<<2)
#define TOKEN_ACK (0x02<<2)
#define TOKEN_IN (0x09<<2)
#define TOKEN_SETUP (0x0D<<2)
a) What is the actual meaning of each case?
b) Isn't it simpler to define a plain binary or hex value?
1) In the datasheet, generic names assigned to buffer descriptors for endpoints are:
BDnSTAT : BD Status register
BDnCNT : BD Byte Count register
BDnADRL : BD Address Low register
BDnADRH : BD Address High register
But Brad Minch seems to define separate blocks for IN and OUT (some shown only).
#define BD0OST 0x0400
#define BD0OBC 0x0401
#define BD0OAL 0x0402
#define BD0OAH 0x0403
#define BD0IST 0x0404
#define BD0IBC 0x0405
#define BD0IAL 0x0406
#define BD0IAH 0x0407
#define BD1OST 0x0408
#define BD1OBC 0x0409
#define BD1OAL 0x040A
#define BD1OAH 0x040B
#define BD1IST 0x040C
#define BD1IBC 0x040D
#define BD1IAL 0x040E
#define BD1IAH 0x040F
................................
Why?
2) In the .INC file defining USB values, we find this notation:
#define TOKEN_OUT (0x01<<2)
#define TOKEN_ACK (0x02<<2)
#define TOKEN_IN (0x09<<2)
#define TOKEN_SETUP (0x0D<<2)
a) What is the actual meaning of each case?
b) Isn't it simpler to define a plain binary or hex value?