Advertisement
AnthonyCagliano

Untitled

Nov 2nd, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. usb_standard_descriptors_t* descriptors[] = {
  2. NULL,
  3. srl_GetCDCStandardDescriptors()
  4. };
  5.  
  6. usb_error_t (*usb_handlers)()[] = {
  7. NULL,
  8. srl_handle_usb_event
  9. };
  10.  
  11. bool ntwk_init(void){
  12. uint8_t inet_devices = 0;
  13. uint24_t err;
  14. if (!libload_IsLibLoaded(USBDRVCE)) exit(ERR_USBDRV_NOT_FOUND);
  15.  
  16. inet_devices |= libload_IsLibLoaded(TCPDRVCE);
  17. inet_devices |= (libload_IsLibLoaded(SRLDRVCE)<<1);
  18. if (!inet_devices) exit(ERR_IFACE_NOT_FOUND);
  19.  
  20. for(uint8_t i=0; i<INET_DEVICES;i++){
  21. if (inet_devices>>i) {
  22. if(usb_Init(usb_handlers[i],
  23. NULL,
  24. descriptors[i],
  25. USB_DEFAULT_INIT_FLAGS))
  26. exit(ERR_USBDRV_ERROR);
  27. enqueue(ntwk_process, NULL, true);
  28. return;
  29. }
  30. }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement