tnt has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/36185?usp=email )
Change subject: icE1usb fw: Use proper length for struct usb_cdc_notif_serial_state ......................................................................
icE1usb fw: Use proper length for struct usb_cdc_notif_serial_state
Signed-off-by: Sylvain Munaut tnt@246tNt.com Change-Id: I30d451e76ebd192f037653179b6485b2b43b6dbc --- M firmware/ice40-riscv/icE1usb/usb_gps.c 1 file changed, 15 insertions(+), 4 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified tnt: Looks good to me, approved
diff --git a/firmware/ice40-riscv/icE1usb/usb_gps.c b/firmware/ice40-riscv/icE1usb/usb_gps.c index db188b1..ad893a5 100644 --- a/firmware/ice40-riscv/icE1usb/usb_gps.c +++ b/firmware/ice40-riscv/icE1usb/usb_gps.c @@ -148,6 +148,7 @@ }, .bits = 0x00 }; + const int notif_len = sizeof(struct usb_cdc_notif_serial_state);
/* Check if PPS occurred */ uint32_t pps_now = time_pps_read(); @@ -159,8 +160,8 @@
/* Queue CD Set */ notif.bits = 1; - usb_data_write(ep_regs->bd[0].ptr, ¬if, 12); - ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(10); + usb_data_write(ep_regs->bd[0].ptr, ¬if, notif_len); + ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(notif_len);
/* Need to clear in the future */ g_usb_gps.pps.set = true; @@ -169,8 +170,8 @@ { /* Queue CD Clear */ notif.bits = 0; - usb_data_write(ep_regs->bd[0].ptr, ¬if, 12); - ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(10); + usb_data_write(ep_regs->bd[0].ptr, ¬if, notif_len); + ep_regs->bd[0].csr = USB_BD_STATE_RDY_DATA | USB_BD_LEN(notif_len);
/* Cleared */ g_usb_gps.pps.set = false;