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.

4 comments: