Forum Discussion
Altera_Forum
Honored Contributor
19 years agosorry, I forget to mention that you have to define
ALTERA_AVALON_UART_USE_IOCTL in c-compiler settings in your system library. (see altera_avalon_uart.c) it is indeed only the baudrate setting, that is supported by the altera device driver's ioctrl function. the ioctrl function is the "linux" way to set the baudrate. the direct way to modify the baudrate like Billooj suggest's works, but it ignores the driver. this is not so much a problem in the case of only baudrate settings, but modifying other uart registers directly may confuse the hal driver. it is dangerous to bypass the driver, that means mix hall driver functions and direct SDK access, if you do not exactly know what you are doing. e.g. in the case of the baudrate, if you set the baudrate with IOWR_ALTERA_AVALON_UART_DIVISOR, you cannot read it back with "res=ioctl(filedescriptor,TIOCMGET,&term);" if you work with filedescriptors you can change "/dev/uart_0" to e.g. "/dev/uart1" and everything works again. I think result is IOWR_ALTERA_AVALON_UART_DIVISOR is advantage: - simple - short - works disadvantage - dangerous to directly access hardware registers, which is normally done by the HAL driver. (not a good programming style, also not possible in linux" - not portable