What would be the best practice to detect USB disconnect?
I have tried to access the flags/port in XUD_Ports.xc but
xc would gives an error of violates parallel usage rules
afformentioned ports.
in port flag0_port = PORT_USB_FLAG0;
in port flag1_port = PORT_USB_FLAG1;
in port flag2_port = PORT_USB_FLAG2;
#if (XUD_SERIES_SUPPORT == XUD_X200_SERIES)
in buffered port:32 p_usb_clk = on USB_TILE : XS1_PORT_1J;
out buffered port:32 p_usb_txd = on USB_TILE : XS1_PORT_8A;
in buffered port:32 p_usb_rxd = on USB_TILE : XS1_PORT_8B;
out port tx_readyout = on USB_TILE : XS1_PORT_1K;
in port tx_readyin = on USB_TILE : XS1_PORT_1H;
in port rx_rdy = on USB_TILE : XS1_PORT_1I;
Detecting vbus/USB disconnect xCORE-200-MC-AUDIO
-
- Member++
- Posts: 29
- Joined: Wed Jul 04, 2018 4:06 pm
-
- XCore Legend
- Posts: 1913
- Joined: Thu Jun 10, 2010 11:43 am
http://www.xcore.com/viewtopic.php?t=3702
Code: Select all
http://www.xcore.com/viewtopic.php?t=3702
-
- Member++
- Posts: 29
- Joined: Wed Jul 04, 2018 4:06 pm
Thank you for taking your time.
I understand the problem.. but I don't know how to identify which core does it runs on.
I know is that XUD_manager run on tile[0].. and I've tried to use interface to access those values.
Is there a way to pass through the value, some other indicator would work as well.
What would be the best practice: global variable, passing pointer, make interface accessible to XUD_manager ?
//cause USB is in Tile0 can't acces from Tile1
//time for interface
interface LEDs_interface{
void turn_on(int i);
};
//function read vbus with access to interface, then inform led_matrix
//USB problems detection
//Tile[0]
void task1(client interface LEDs_interface c)
{
//this have the return of the LED matrix
//flag2_port :> reset;
//XUD_BusSpeed_t buff ;
while(1){
if((g_curStreamAlt_In || g_curStreamAlt_Out || g_currentConfig)== 0)
{
c.turn_on(4);
}
}
//buff = g_curUsbSpeed;
//if (buff == XUD_SPEED_HS)
//else if(buff == XUD_SPEED_FS)
}
//Tile[1]
void task2(server interface LEDs_interface c)
{
p_leds_row <: 0x0; // 0000 row all on
p_leds_col <: 0x0; // all cols off
while(1)
{
p_leds_col <: 0x3;
delay_milliseconds(500);
p_leds_col <: 0x0;
delay_milliseconds(500);
select
{
//detect enumeration finished
case c.turn_on(int i):
//select column by function
p_leds_col <: i;
delay_milliseconds(500);
break;
}
}
}
I understand the problem.. but I don't know how to identify which core does it runs on.
I know is that XUD_manager run on tile[0].. and I've tried to use interface to access those values.
Is there a way to pass through the value, some other indicator would work as well.
What would be the best practice: global variable, passing pointer, make interface accessible to XUD_manager ?
//cause USB is in Tile0 can't acces from Tile1
//time for interface
interface LEDs_interface{
void turn_on(int i);
};
//function read vbus with access to interface, then inform led_matrix
//USB problems detection
//Tile[0]
void task1(client interface LEDs_interface c)
{
//this have the return of the LED matrix
//flag2_port :> reset;
//XUD_BusSpeed_t buff ;
while(1){
if((g_curStreamAlt_In || g_curStreamAlt_Out || g_currentConfig)== 0)
{
c.turn_on(4);
}
}
//buff = g_curUsbSpeed;
//if (buff == XUD_SPEED_HS)
//else if(buff == XUD_SPEED_FS)
}
//Tile[1]
void task2(server interface LEDs_interface c)
{
p_leds_row <: 0x0; // 0000 row all on
p_leds_col <: 0x0; // all cols off
while(1)
{
p_leds_col <: 0x3;
delay_milliseconds(500);
p_leds_col <: 0x0;
delay_milliseconds(500);
select
{
//detect enumeration finished
case c.turn_on(int i):
//select column by function
p_leds_col <: i;
delay_milliseconds(500);
break;
}
}
}
-
- XCore Legend
- Posts: 1913
- Joined: Thu Jun 10, 2010 11:43 am
Try using the Task Viewer tool:
Application Note: AN00200 Getting Started with the Task Viewer in xTIMEcomposer Studio
https://www.xmos.com/developer/publishe ... dio-readme
reference:
http://www.xcore.com/viewtopic.php?t=4642
Application Note: AN00200 Getting Started with the Task Viewer in xTIMEcomposer Studio
https://www.xmos.com/developer/publishe ... dio-readme
reference:
http://www.xcore.com/viewtopic.php?t=4642
-
- Member++
- Posts: 29
- Joined: Wed Jul 04, 2018 4:06 pm
I'm currently working with the USB audio 2.0 reference software and adapting the software to fit our need.
I'm adding my code to main.xc under module_usb_audio
I feel like I'm doing something wrong here in term of organization since we have the app_usb_aud_xk_216_mc
I feel like the module should not be touched... is this the case or I'm just paranoid?
I've read the doc, but as the main.xc is under module_usb_audio so the task is not showing.
And on the app_usb_aud_xk_216_mc there is no main
[there's user_main.h under app_usb_aud_xk_216_mc but not user_main.xc. should I create user_main.xc and work in there?]
I'm adding my code to main.xc under module_usb_audio
I feel like I'm doing something wrong here in term of organization since we have the app_usb_aud_xk_216_mc
I feel like the module should not be touched... is this the case or I'm just paranoid?
I've read the doc, but as the main.xc is under module_usb_audio so the task is not showing.
And on the app_usb_aud_xk_216_mc there is no main
[there's user_main.h under app_usb_aud_xk_216_mc but not user_main.xc. should I create user_main.xc and work in there?]