Converting 32 bit JTAG ID to Avr::TargetSignature instance
This commit is contained in:
@@ -31,6 +31,35 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
|
||||
*/
|
||||
return TargetSignature(payloadData[3], payloadData[2], payloadData[1]);
|
||||
}
|
||||
case Avr8PhysicalInterface::JTAG: {
|
||||
/*
|
||||
* When using the JTAG interface, the get device ID command returns a 32 bit JTAG ID. This takes
|
||||
* the following form:
|
||||
*
|
||||
* VVVV PPPPPPPPPPPPPPPP MMMMMMMMMMM L
|
||||
*
|
||||
* - (V) - Version nibble (4 bits)
|
||||
* - (P) - Part number (this is typically the AVR signature excluding the manufacture
|
||||
* byte (0x1E)) (16 bits)
|
||||
* - (M) - Manufacture identity (11 bits)
|
||||
* - (L) - LSB indicator (1 bit)
|
||||
*
|
||||
* We convert this into a Avr::TargetSignature by extracting the relevant part number and assuming
|
||||
* a manufacture byte of 0x1E.
|
||||
*
|
||||
* TODO: We're not considering the value of the LSB indicator bit. We're just assuming it will
|
||||
* always be MSB. Is this assumption correct?
|
||||
*/
|
||||
auto jtagId = static_cast<std::uint32_t>(
|
||||
(payloadData[0] << 24) | (payloadData[1] << 16) | (payloadData[2] << 8) | (payloadData[3])
|
||||
);
|
||||
|
||||
return TargetSignature(
|
||||
0x1E,
|
||||
static_cast<unsigned char>((jtagId << 4) >> 24),
|
||||
static_cast<unsigned char>((jtagId << 12) >> 24)
|
||||
);
|
||||
}
|
||||
default: {
|
||||
return TargetSignature(payloadData[0], payloadData[1], payloadData[2]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user