@@ -417,6 +417,8 @@ static void cdcncm_disconnect(FAR struct usbdevclass_driver_s *driver,
417
417
418
418
static void cdcncm_ep0incomplete (FAR struct usbdev_ep_s * ep ,
419
419
FAR struct usbdev_req_s * req );
420
+ static void cdcncm_intcomplete (FAR struct usbdev_ep_s * ep ,
421
+ FAR struct usbdev_req_s * req );
420
422
static void cdcncm_rdcomplete (FAR struct usbdev_ep_s * ep ,
421
423
FAR struct usbdev_req_s * req );
422
424
static void cdcncm_wrcomplete (FAR struct usbdev_ep_s * ep ,
@@ -1424,6 +1426,39 @@ static void cdcncm_ep0incomplete(FAR struct usbdev_ep_s *ep,
1424
1426
}
1425
1427
}
1426
1428
1429
+ /****************************************************************************
1430
+ * Name: cdcncm_intcomplete
1431
+ *
1432
+ * Description:
1433
+ * Handle completion of interrupt write request. This function probably
1434
+ * executes in the context of an interrupt handler.
1435
+ *
1436
+ ****************************************************************************/
1437
+
1438
+ static void cdcncm_intcomplete (FAR struct usbdev_ep_s * ep ,
1439
+ FAR struct usbdev_req_s * req )
1440
+ {
1441
+ FAR struct cdcncm_driver_s * self = (FAR struct cdcncm_driver_s * )ep -> priv ;
1442
+
1443
+ if (req -> result || req -> xfrd != req -> len )
1444
+ {
1445
+ uerr ("result: %hd, xfrd: %hu\n" , req -> result , req -> xfrd );
1446
+ }
1447
+
1448
+ if (self -> notify != NCM_NOTIFY_NONE )
1449
+ {
1450
+ cdcncm_notify_worker (self );
1451
+ }
1452
+ else if (!self -> isncm )
1453
+ {
1454
+ /* After the NIC information is synchronized, subsequent
1455
+ * notifications are all related to the mbim control.
1456
+ */
1457
+
1458
+ self -> notify = NCM_NOTIFY_RESPONSE_AVAILABLE ;
1459
+ }
1460
+ }
1461
+
1427
1462
/****************************************************************************
1428
1463
* Name: cdcncm_rdcomplete
1429
1464
*
@@ -1715,25 +1750,16 @@ static void cdcncm_notify_worker(FAR void *arg)
1715
1750
FAR struct cdcncm_driver_s * self = arg ;
1716
1751
int ret ;
1717
1752
1718
- while (self -> notify != NCM_NOTIFY_NONE )
1753
+ ret = cdcncm_notify (self );
1754
+ if (ret > 0 )
1719
1755
{
1720
- ret = cdcncm_notify (self );
1721
- if (ret > 0 )
1722
- {
1723
- FAR struct usbdev_req_s * notifyreq = self -> notifyreq ;
1756
+ FAR struct usbdev_req_s * notifyreq = self -> notifyreq ;
1724
1757
1725
- notifyreq -> len = ret ;
1726
- notifyreq -> flags = USBDEV_REQFLAGS_NULLPKT ;
1758
+ notifyreq -> len = ret ;
1759
+ notifyreq -> flags = USBDEV_REQFLAGS_NULLPKT ;
1727
1760
1728
- EP_SUBMIT (self -> epint , notifyreq );
1729
- }
1761
+ EP_SUBMIT (self -> epint , notifyreq );
1730
1762
}
1731
-
1732
- /* After the NIC information is synchronized, subsequent notifications
1733
- * are all related to the mbim control
1734
- */
1735
-
1736
- self -> notify = NCM_NOTIFY_RESPONSE_AVAILABLE ;
1737
1763
}
1738
1764
1739
1765
/****************************************************************************
@@ -2399,7 +2425,7 @@ static int cdcncm_bind(FAR struct usbdevclass_driver_s *driver,
2399
2425
goto error ;
2400
2426
}
2401
2427
2402
- self -> notifyreq -> callback = cdcncm_wrcomplete ;
2428
+ self -> notifyreq -> callback = cdcncm_intcomplete ;
2403
2429
2404
2430
/* Pre-allocate read requests. The buffer size is NTB_DEFAULT_IN_SIZE. */
2405
2431
0 commit comments