Advertisement
AnthonyCagliano

Untitled

Nov 6th, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. struct _device_init_t {
  2. const usb_standard_descriptors_t* descriptors;
  3. usb_error_t (*usb_handler)();
  4. };
  5. struct _device_init_t device_idata[INET_DEVICES] = {
  6. {NULL, NULL},
  7. {srl_GetCDCStandardDescriptors, srl_handle_usb_event}
  8. };
  9.  
  10. void ntwk_init(void){
  11. uint8_t inet_devices = 0;
  12. uint24_t err;
  13.  
  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. gamestate.inet_data.inet_process = usb_HandleEvents;
  21.  
  22. for(uint8_t i=0; i<INET_DEVICES;i++){
  23. if (inet_devices>>i) {
  24. if (usb_Init(device_idata[i].usb_handler,
  25. NULL,
  26. device_idata[i].descriptors,
  27. USB_DEFAULT_INIT_FLAGS))
  28. exit(ERR_USBDRV_ERROR);
  29. enqueue(gamestate.inet_data.inet_process, true);
  30. return;
  31. }
  32. }
  33. }
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement