Forums » Software Development »
Typo in rs485_test code
Added by Ian Martin almost 12 years ago
Thank you for putting up the great resource at:
http://support.criticallink.com/redmine/projects/armc8-platforms/wiki/Driving_RS-485_transceivers
But there is a typo in rs485_test.tar. I believe "#define gpio_pin padding [1]" should be "#define gpio_pin padding [0]".
Regards,
Ian Martin
Replies (1)
RE: Typo in rs485_test code - Added by Michael Williamson almost 12 years ago
Hi Ian,
It depends on the version of the compiler you are using and where it is getting it's kernel headers from.
The TI tools from their 05.03.02.00 SDK, what we used to run the test, have a definition of the their serial_rs485 structure in <linux/rs485.h> as:
struct serial_rs485 { __u32 flags; /* RS485 feature flags */ #define SER_RS485_ENABLED (1 << 0) #define SER_RS485_RTS_ON_SEND (1 << 1) #define SER_RS485_RTS_AFTER_SEND (1 << 2) __u32 delay_rts_before_send; /* Milliseconds */ __u32 padding[6]; /* Memory is cheap, new structs are a royal PITA .. */ };
This was taken from a very old kernel and in this case the #define is correct when you compare the updated structure from the patches, you need to skip the zero index because the new structure also includes a delay_rts_after_send field in the kernel patch before the padding / GPIO pin.
This was why we recommended using the local structure definition instead.
This is also why, quite often, it's nice to advance your toolchain to stay current with any updates to the kernel APIs...
-Mike