Skip to content

Commit

Permalink
fix weird code in USB_ReadPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Jul 9, 2019
1 parent b983cc8 commit fcb1208
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions board/drivers/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,12 @@ int current_int0_alt_setting = 0;
// packet read and write

void *USB_ReadPacket(void *dest, uint16_t len) {

void *dest_copy = dest;
uint32_t *dest_copy = (uint32_t *)dest;
uint32_t count32b = (len + 3U) / 4U;

for (uint32_t i = 0; i < count32b; i++) {
// packed?
*(__attribute__((__packed__)) uint32_t *)dest_copy = USBx_DFIFO(0);
dest_copy += 4;
*dest_copy = USBx_DFIFO(0);
dest_copy++;
}
return ((void *)dest_copy);
}
Expand Down

0 comments on commit fcb1208

Please sign in to comment.