Nuccio Raciti |
Hi,
I need to add two USB virtual serial to the AVR32 platform, the goal is to have both the console and the remote file system managed by the USB port (with the benefits of simplicity and economy). Of course I want to keep (optional) the capability to have a traditional UART. The question is: Where is the right place to add this support? This is my first choice: * /platform/avr32/platform.c + /platform/avr32/usb-cdc.c + /platform/avr32/usb-cdc.h Or maybe I need to change eLua common code? Thanks and regards, Nuccio _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Tim Michals |
I'm adding adding it to the serial code in the platform code. for example: Transmit: void platform_s_uart_send( unsigned id, u8 data ) { switch(id) { case USB_SERIALPORT_1: break; default: //HW based serial port
break; } } Receive: int platform_s_uart_recv( unsigned id, s32 timeout)
{ switch(id) {
case USB_SERIALPORT_1:
break;
default:
//HW based serial port
break;
}
} Invoking the receive ISR from USB interrupt: In platform_int.c, when a receive interrupt occurs call uart_common_rx_handler with the virtual serial number, USB_SERIALPORT_1, this in turn
calls platform_s_uart_recv, which is in the AVR32 platform. Bogdan made a change to common_uart.c to use a while statement: static void cmn_uart_rx_inthandler( elua_int_resnum resnum ) { int data; if( buf_is_enabled( BUF_ID_UART, resnum ) || resnum == SERMUX_PHYS_ID ) { while( -1 != ( data = platform_s_uart_recv( resnum, 0 ) ) ) <--- call into the platform to get all data in the receive buffer, return -1 when there is no data. cmn_rx_handler( resnum, ( u8 )data ); } I'm doing this for a LPC23xx platform. Hope this helps. Also, I'm not supporting polling at this time, it is all interrupt driven. From: Nuccio Raciti <[hidden email]> To: eLua Users and Development List (www.eluaproject.net) <[hidden email]> Sent: Friday, June 3, 2011 4:31 AM Subject: [eLua-dev] The right place where add virtual serial (USB-CDC class) on eLua Hi, I need to add two USB virtual serial to the AVR32 platform, the goal is to have both the console and the remote file system managed by the USB port (with the benefits of simplicity and economy). Of course I want to keep (optional) the capability to have a traditional UART. The question is: Where is the right place to add this support? This is my first choice: * /platform/avr32/platform.c + /platform/avr32/usb-cdc.c + /platform/avr32/usb-cdc.h Or maybe I need to change eLua common code? Thanks and regards, Nuccio _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Nuccio Raciti |
Hi Tim,
this helps me, I will give a look inside LPC23xx sources... Thanks, Nuccio Il giorno ven, 03/06/2011 alle 06.24 -0700, Tim michals ha scritto: > I'm adding adding it to the serial code in the platform code. for > example: > Transmit: > > void platform_s_uart_send( unsigned id, u8 data ) > { > switch(id) > { > case USB_SERIALPORT_1: > break; > > > default: > //HW based serial port > > break; > } > } > Receive: > > int platform_s_uart_recv( unsigned id, s32 timeout) > { > switch(id) > { > case USB_SERIALPORT_1: > break; > > > default: > //HW based serial port > > break; > } > } > > > > Invoking the receive ISR from USB interrupt: > In platform_int.c, when a receive interrupt occurs call > uart_common_rx_handler with the virtual serial number, > USB_SERIALPORT_1, this in turn calls platform_s_uart_recv, which is in > the AVR32 platform. Bogdan made a change to common_uart.c to use a > while statement: > > > static void cmn_uart_rx_inthandler( elua_int_resnum resnum ) > { > int data; > > if( buf_is_enabled( BUF_ID_UART, resnum ) || resnum == > SERMUX_PHYS_ID ) > { > while( -1 != ( data = platform_s_uart_recv( resnum, 0 ) ) ) <--- > call into the platform to get all data in the receive buffer, return > -1 when there is no data. > cmn_rx_handler( resnum, ( u8 )data ); > } > > > > I'm doing this for a LPC23xx platform. Hope this helps. Also, I'm not > supporting polling at this time, it is all interrupt driven. > > > > > > > ______________________________________________________________________ > From: Nuccio Raciti <[hidden email]> > To: eLua Users and Development List (www.eluaproject.net) > <[hidden email]> > Sent: Friday, June 3, 2011 4:31 AM > Subject: [eLua-dev] The right place where add virtual serial (USB-CDC > class) on eLua > > Hi, > > I need to add two USB virtual serial to the AVR32 platform, > the goal is to have both the console and the remote file system > managed by > the USB port (with the benefits of simplicity and economy). > Of course I want to keep (optional) the capability to have a > traditional UART. > > The question is: Where is the right place to add this support? > > This is my first choice: > * /platform/avr32/platform.c > + /platform/avr32/usb-cdc.c > + /platform/avr32/usb-cdc.h > > Or maybe I need to change eLua common code? > > Thanks and regards, > Nuccio > > > > > > > _______________________________________________ > eLua-dev mailing list > [hidden email] > https://lists.berlios.de/mailman/listinfo/elua-dev > > > _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
In reply to this post by Nuccio Raciti
Hi,
On Fri, Jun 3, 2011 at 12:31 PM, Nuccio Raciti <[hidden email]> wrote:
Hi, Ideally we'd try to make this platform-independent. However, I'm not at all that good with USB, so I can't design a suitable platform interface for this (if someone else can please let me know). So we can keep the code local to the platform(s) for now and maybe refactor it one day.
Best, Bogdan _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Tim Michals |
I'm in process of making the USB client stack more generic. I was thinking of a directory structure: Top level elua/src/modules/USB /common /device /cdc-serial /core /host /core Each platform would then have handlers for USB HW. It would be good to make sure this works on a couple of platforms. The main issue, is handling full speed and high speed. Does the AVR32 have high speed
usb? From: Bogdan Marinescu <[hidden email]> To: [hidden email]; eLua Users and Development List (www.eluaproject.net) <[hidden email]> Sent: Friday, June 3, 2011 11:12 AM Subject: Re: [eLua-dev] The right place where add virtual serial (USB-CDC class) on eLua Hi, On Fri, Jun 3, 2011 at 12:31 PM, Nuccio Raciti <[hidden email]> wrote:
Hi, Ideally we'd try to make this platform-independent. However, I'm not at all that good with USB, so I can't design a suitable platform interface for this (if someone else can please let me know). So we can keep the code local to the platform(s) for now and maybe refactor it one day.
Best, Bogdan _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Some models (e.g. AT32UC3Axxx ) do; they're still one of the few MCUs with high speed USB 2.0 in quad flatpack. Since HS USB is slowing becoming more common (e.g. the new STM32F2 series has it), I'd say it's good to plan for it. --Tony
_______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Free forum by Nabble | Edit this page |