I've created a fork and have basic serial ports and USB CDC serial working. Now just getting the data from the USB virtual serial port to the eLua framework.
For example, the virtual serial port=1 +the last physical serial port. So all of the UART functions are still used with a switch or if statement to make the physical Serial port+1 to USB virtual Serial. Thoughts? Also, where the headache is it may not be connected with the code is running IE USB is disconnected... But the virtual UART functions will return -1 in this case. The main issue is the USB CDC Serial can send a packet of data, more then one character. So, looking at the code I was thinking of changing the common_uart.c static void cmn_uart_rx_inthandler( elua_int_resnum resnum ) { if( buf_is_enabled( BUF_ID_UART, resnum ) || resnum == SERMUX_PHYS_ID ) cmn_rx_handler( resnum, platform_s_uart_recv( resnum, 0 ) ); to static void cmn_uart_rx_inthandler( elua_int_resnum resnum ) { if( buf_is_enabled( BUF_ID_UART, resnum ) || resnum == SERMUX_PHYS_ID ) { u8 _data; while (-1 != (_data = platform_s_uart_recv( resnum, 0 )) cmn_rx_handler( resnum, _data ); So this way it just gets all of the data and buffers it etc, if not using ISR it uses the standard UART functions. Enabling Interrupts on USB Serial is just a stub. Thoughts? OR just way off base? |
Hi (and sorry for the late reply),
On Fri, Apr 29, 2011 at 8:08 AM, Tim Michals <[hidden email]> wrote:
Not way off base, but personally I think that the proper way to handle this would be to enable serial buffering (BUF_ENABLE_UART). This is exactly why we have buffers, they function as a "bridge" between two ends of a connection, one of which produces items and another consumes items, generally at different speeds. Please let me know if you need help with enabling the serial buffers.
Best, Bogdan _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Hello, (and also sorry for the late reply. Time will be really scarce in the next 3~4 weeks)
Having USB CDC now sounds like a great addition to eLua (Thankssssss !) I'm not familiar with the implementations and could also not visualize how portable yours will be. But the what I could understand from the Virtual Serial Port metaphor seems to keep things simple and easy to use. Best Dado On Wed, May 4, 2011 at 03:30, Bogdan Marinescu <[hidden email]> wrote: Hi (and sorry for the late reply), _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
I'm using a modified LPCUSB project for the USB stack. This is the fastest way to work out all of the interfaces issues with eLua. Current fork: - Using USB as another serial port. - Getting the buffer issues, control, and simple API working Next: - USB Client as a composite device (Having multiple protocols on one physical USB port) - 1 or 2 serial ports - 1 serial port and one Ethernet port - 1 serial port and one MSD (Mass storage) - Updated the stack to be more generic - USB Host
Mode (Having a USB A connector, or A/B, or modified B connector, for Panda board) - Connecting a Ethernet dongle - Connecting Ethernet wireless dongle - USB MSD (Flash stick) From: Dado Sutter <[hidden email]> To: eLua Users and Development List (www.eluaproject.net) <[hidden email]> Sent: Wednesday, May 4, 2011 2:13 AM Subject: Re: [eLua-dev] Panda Board status Hello, (and also sorry for the late reply. Time will be really scarce in the next 3~4 weeks) Having USB CDC now sounds like a great addition to eLua (Thankssssss !) I'm not familiar with the implementations and could also not visualize how portable yours will be. But the what I could understand from the Virtual Serial Port metaphor seems to keep things simple and easy to use. Best Dado On Wed, May 4, 2011 at 03:30, Bogdan Marinescu <[hidden email]> wrote: Hi (and sorry for the late reply), _______________________________________________ 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 BogdanM
Yes, I have BUF_ENABLE_UART enabled. This is my understanding how the UART ISR buffering works The UART fires an interrupt, this invokes a common function handler, uart_rx_common_handler, static void uart_rx_common_handler( elua_int_resnum resnum ) { cmn_int_handler( INT_UART_RX, resnum ); VICVectAddr = 0; } cmn_int_handler calls the function below: #ifdef BUF_ENABLE_UART static elua_int_c_handler prev_uart_rx_handler; static void cmn_uart_rx_inthandler( elua_int_resnum resnum ) { if( buf_is_enabled( BUF_ID_UART, resnum ) || resnum == SERMUX_PHYS_ID ) cmn_rx_handler( resnum, platform_s_uart_recv( resnum, 0 ) ); Within the function platform_s_uart_recv is called, returns only one character, USB can send a buffer of characters in one interrupt. From: Bogdan Marinescu <[hidden email]> To: eLua Users and Development List (www.eluaproject.net) <[hidden email]> Sent: Wednesday, May 4, 2011 1:30 AM Subject: Re: [eLua-dev] Panda Board status Hi (and sorry for the late reply), On Fri, Apr 29, 2011 at 8:08 AM, Tim Michals <[hidden email]> wrote:
Not way off base, but personally I think that the proper way to handle this would be to enable serial buffering (BUF_ENABLE_UART). This is exactly why we have buffers, they function as a "bridge" between two ends of a connection, one of which produces items and another consumes items, generally at different speeds. Please let me know if you need help with enabling the serial buffers.
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 |
Hi,
On Thu, May 5, 2011 at 7:48 PM, Tim michals <[hidden email]> wrote:
My bad, you are absolutely right. I'll add that patch with a single modification: I'll make "_data" an int (you probably can see why :) ). Best, Bogdan
_______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Is there some type of ISR/Thread safe lock, or ISR/Thread safe queue? For example using interrupts to transmit data on the serial port. The TX routine is transmitting 10 characters, a driver can queue the characters to a ISR/Thread safe queue and transmit them using an ISR. If another transmit comes along, the driver attempts to queue more data, the queue must lock ISR/Thread. Looking at few of the CPU platform ports, TX routines are blocking waiting for transmits to complete? From: Bogdan Marinescu <[hidden email]> To: Tim michals <[hidden email]>; eLua Users and Development List (www.eluaproject.net) <[hidden email]> Sent: Thursday, May 5, 2011 12:04 PM Subject: Re: [eLua-dev] Panda Board status Hi, On Thu, May 5, 2011 at 7:48 PM, Tim michals <[hidden email]> wrote:
My bad, you are absolutely right. I'll add that patch with a single modification: I'll make "_data" an int (you probably can see why :) ). Best, Bogdan
_______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Hi,
On Fri, May 6, 2011 at 5:24 AM, Tim michals <[hidden email]> wrote:
The buffers (src/buf.c) are ISR safe. And we don't have threads :)
I believe the buffers can do this. The locking solution is very brutal (they simply enable/disable global interrupts) but they should still be able to do this.
Yes, currently all the TX routines are blocking on all platforms.
Best, Bogdan
_______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Free forum by Nabble | Edit this page |