Advertisement
AnthonyCagliano

Untitled

Nov 2nd, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. struct _netcfg {
  2. bool impl;
  3. usb_standard_descriptors_t* descriptors;
  4. usb_error_t (*handle_usb_event)(usb_event_t event, void *event_data,
  5. usb_callback_data_t *callback_data);
  6. };
  7. struct _netcfg ntwk_opt[] = {
  8. {false, NULL, NULL},
  9. {true, srl_GetCDCStandardDescriptors(), srl_handle_usb_event}
  10. }
  11.  
  12. void ntwk_init(void *data){
  13. uint8_t devices;
  14. uint24_t err;
  15. if (!libload_IsLibLoaded(USBDRVCE)){
  16. err = ERR_USBDRVCE;
  17. enqueue(exit_program, &err, false);
  18. return;
  19. }
  20. devices |= libload_IsLibLoaded(TCPDRVCE);
  21. devices |= (libload_IsLibLoaded(SRLDRVCE)<<1);
  22. if (!devices){
  23. err = ERR_NOINETDEVICE;
  24. enqueue(exit_program, &err, false);
  25. return;
  26. }
  27. for(uint8_t i=0; i<INET_DEVICES;i++){
  28. if (devices>>i)
  29. if (ntwk_opts[i].impl){
  30. usb_Init(ntwk_opts[i].handle_usb_event,
  31. NULL,
  32. ntwk_opts[i].descriptors,
  33. USB_DEFAULT_INIT_FLAGS);
  34. enqueue(ntwk_process, NULL, true);
  35. }
  36. }
  37. }
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement