#ifndef SERH #define SERH /*! @addtogroup Serial Serial ports on the 37e12 are asychronous devices, and as such, can receive data at any time. Parsed serial data is stored as a string in Cop_Data.RS232_string or Cop_Data.RS422_string depending on the port that received it. The maximum size of this string is RS232BUFSIZE or RS422BUFSIZE. It gets cat'ed to with each received data packet. To see exactly what happens look in the CopParsePacket function inside the switch statement for the SER232 and SER422 cases. To reset these strings just write a zero to the first element of the string, the cat functions will then start overwriting from that point. received data sets the BITMASK(SER232) and BITMASK(SER422) bits for new received data on the 232 or 422 ports respectively. This is typically redundant however as it will also result in a stringlen>0 with the Cop_Data structure's RXxxx_string elements. */ /*@{*/ #include #include #define RS232PORT 0 #define RS422PORT 1 #define EIGHT_BIT 0x00 #define NINE_BIT 0x10 typedef struct Serconfig{ __u16 id; //! port number, RS232PORT or RS422PORT __u16 mode; //! EIGHT_BIT or NINE_BIT __u16 baud; // Any baud rate from 9600 to 56k, the proper divisors are computed internally by the 37e12 firmware. }Serconfig; /*!Configure a 37e12's mode and baud rate @param fd file descriptor of the 37e12 @param port port to address RS232PORT or RS422PORT @param baud the baud rate @param mode EIGHT_BIT OR NINE_BIT */ int E12_Serial_Config(int fd, int port, int baud,int mode); /*!Write data to a serial port @param fd file descriptor of the 37e12 */ int E12_Serial_Write(int fd, int port, int numchars,char *buffer); /*@}*/ #endif