Advertisement
AnthonyCagliano

Untitled

Nov 6th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 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. void 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. gameflags.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(usb_handlers[i],
  25. NULL,
  26. descriptors[i],
  27. USB_DEFAULT_INIT_FLAGS))
  28. exit(ERR_USBDRV_ERROR);
  29. enqueue(gameflags.inet_data.inet_process, NULL, true);
  30. return;
  31. }
  32. }
  33. }
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement