Pl011::read(PacketPtr pkt)
{
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
+ assert(pkt->getSize() <= 4);
Addr daddr = pkt->getAddr() - pioAddr;
break;
}
- switch(pkt->getSize()) {
- case 1:
- pkt->setLE<uint8_t>(data);
- break;
- case 2:
- pkt->setLE<uint16_t>(data);
- break;
- case 4:
- pkt->setLE<uint32_t>(data);
- break;
- default:
- panic("Uart read size too big?\n");
- break;
- }
-
-
+ pkt->setUintX(data, ByteOrder::little);
pkt->makeAtomicResponse();
return pioDelay;
}
{
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
+ assert(pkt->getSize() <= 4);
Addr daddr = pkt->getAddr() - pioAddr;
// use a temporary data since the uart registers are read/written with
// different size operations
//
- uint32_t data = 0;
-
- switch(pkt->getSize()) {
- case 1:
- data = pkt->getLE<uint8_t>();
- break;
- case 2:
- data = pkt->getLE<uint16_t>();
- break;
- case 4:
- data = pkt->getLE<uint32_t>();
- break;
- default:
- panic("Uart write size too big?\n");
- break;
- }
-
+ const uint32_t data = pkt->getUintX(ByteOrder::little);
switch (daddr) {
case UART_DR:
PL031::read(PacketPtr pkt)
{
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
- assert(pkt->getSize() == 4);
+ assert(pkt->getSize() <= 4);
Addr daddr = pkt->getAddr() - pioAddr;
uint32_t data;
break;
}
- switch(pkt->getSize()) {
- case 1:
- pkt->setLE<uint8_t>(data);
- break;
- case 2:
- pkt->setLE<uint16_t>(data);
- break;
- case 4:
- pkt->setLE<uint32_t>(data);
- break;
- default:
- panic("Uart read size too big?\n");
- break;
- }
-
-
+ pkt->setUintX(data, ByteOrder::little);
pkt->makeAtomicResponse();
return pioDelay;
}
PL031::write(PacketPtr pkt)
{
assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
- assert(pkt->getSize() == 4);
+ assert(pkt->getSize() <= 4);
Addr daddr = pkt->getAddr() - pioAddr;
DPRINTF(Timer, "Writing to RTC at offset: %#x\n", daddr);
Tick
UFSHostDevice::write(PacketPtr pkt)
{
- uint32_t data = 0;
-
- switch (pkt->getSize()) {
-
- case 1:
- data = pkt->getLE<uint8_t>();
- break;
-
- case 2:
- data = pkt->getLE<uint16_t>();
- break;
+ assert(pkt->getSize() <= 4);
- case 4:
- data = pkt->getLE<uint32_t>();
- break;
-
- default:
- panic("Undefined UFSHCD controller write size!\n");
- break;
- }
+ const uint32_t data = pkt->getUintX(ByteOrder::little);
switch (pkt->getAddr() & 0xFF)
{