Monday, April 20, 2009

Spinning into control

After completing the changes from semaphors to spinlocks, the driver seems to have gained much stability. The locking mechanism is based off of the pl2302 driver. Currently the device will lose data if under heavy load. The other driver also made me realize (assuming its done correctly!) that I don't need to lock nearly as much as I thought I did. To help testing, I am making a serial program that can work with shell scripts. The only two command line programs that I know that work with serial are screen and minicom, neither of which is for automated use.
During this upgrade, additional register accesses were decoded into human readable defines and a few translation errors I had made earlier were fixed. These were due to the baud rate latch divisor multiplexing. Basically, if a certain register had a special value on the chip, it causes register addresses to actually write to different data.
As things develop, I will lock the code more properly. Currently you could easily generate unexpected output on the serial port due to a number of race conditions from multiple users. A prime example is the issues arrising from the divisor multiplexing. Future revisions will lock these as it is found to be safe and necessary. However, any locking errors right now will not result in system instabiility, just unexpected results on the serial port.

Friday, April 17, 2009

Misc updates

Seems that the MosChip site virus may have been a google bug. In any case, I have a beta tester now for my driver. She/he is using virtual machines to run the dongles through Windows and would like to use them directly on Linux.
The code is being converted to spinlocks and is modeled off of another driver, the pl2303. It is another USB-serial converter that I have and has very clean code, so makes a good model.

Friday, April 3, 2009

Need some DDT

Although it wasn't so bad getting it to transmit and receive data, getting the driver to behave stably has been elusive. In particular, the locking scheme is not working. Code modifications are under way to base the locking scheme off of the pl2302 USB-serial driver. mos7703 currently uses mutexes, but I'm converting the code to spinlocks since this was generally recommended to me anyway. I also posted on linuxquestions.org hoping to get someone to take a look at it, but didn't recieve any responses. See it at http://www.linuxquestions.org/questions/linux-kernel-70/mos7703-serial-driver-714933/ Once I get more of a reasonably solid driver working, I'll post to the Linux Kernel Mailling List.
I've also recieved techniques for keeping compatibility across kernels. I've managed to clean up the code and use less preprocessor logic. This mostly involves using some high level wrapper functions for different kernels, and then using a few inline core functions to do the actual logic. Also trying to clean up some of the ugly macros around this.