Hello LQ,
i'm trying to access a piece of hardware over rs232. According to the protocol
of the hardware, i have to send an address byte using mark parity and several command bytes using space parity.
When setting the parity modes using tcsetattr with optional_actions set to TCSADRAIN or TSCAFLUSH, it needs about 15 ms to switch parity modes and send the address byte, which is not acceptable. When using the parameter TCSANOW performance is just fine, but i'm getting protocol errors.
My guess about the 15 ms when using TSCADRAIN is that i'm running into a context switch, as i get the same timing results when using TCSANOW with usleep.
At the moment, i'm slowing my application down using a delay-loop
Is there a way, waiting until the new portstate is set (like TSCADRAIN does) without running into a context switch?
Thanks,
Stefan