Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct _netcfg {
- bool impl;
- usb_standard_descriptors_t* descriptors;
- usb_error_t (*handle_usb_event)(usb_event_t event, void *event_data,
- usb_callback_data_t *callback_data);
- };
- struct _netcfg ntwk_opt[] = {
- {false, NULL, NULL},
- {true, srl_GetCDCStandardDescriptors(), srl_handle_usb_event}
- }
- void ntwk_init(void *data){
- uint8_t devices;
- uint24_t err;
- if (!libload_IsLibLoaded(USBDRVCE)){
- err = ERR_USBDRVCE;
- enqueue(exit_program, &err, false);
- return;
- }
- devices |= libload_IsLibLoaded(TCPDRVCE);
- devices |= (libload_IsLibLoaded(SRLDRVCE)<<1);
- if (!devices){
- err = ERR_NOINETDEVICE;
- enqueue(exit_program, &err, false);
- return;
- }
- for(uint8_t i=0; i<INET_DEVICES;i++){
- if (devices>>i)
- if (ntwk_opts[i].impl){
- usb_Init(ntwk_opts[i].handle_usb_event,
- NULL,
- ntwk_opts[i].descriptors,
- USB_DEFAULT_INIT_FLAGS);
- enqueue(ntwk_process, NULL, true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement