[En-Nut-Discussion] half duplex USART driver

Dusan Ferbas dferbas at dfsoft.cz
Fri Apr 9 00:09:05 CEST 2004


Harald,

I know that code has to be compiled for quick performance. But I want to 
avoid having several Nut libraries for each different applications. This is 
always a source of problems.

Nice solution will be if only few routines from usartavr (e.g. TxStart and 
TxComplete) can be replaced by custom ones. This was my solution with old 
uart driver - I had different comm_low module where all signal handling was 
done. But new driver has its own "signal routines" within its body. 
Unfortunately usartavr.c is included into other .c module and routines are 
static with same names for different HW uarts. More over linker does not 
support distinguished linking within a module.

I would like to stay as much as possible with original source codes because 
of lot of new releases. Currently we maintain only 1 set of Nut libraries. 
What about to have modem.h at a place with a path modifiable from a 
makefile ? I think that everybody developing more than 1 application can 
have similar problem.

>Dusan,
>
>Regarding your question, how to specify different ports
>for different hardware:
>
>For the RS232 controls, I intended to use include/cfg/modem.h.
>But frankly, I didn't used it myself yet. :-) In two
>instances we wrote a complete self contained driver for
>customers (who paid the code, so we can't publish it).
>
>The main problem is, that it can't be made software
>configurable without losing performance. If constants
>are used in outb(), inb(), cbi(), sbi() etc. the
>compiler is able to translate them into a single
>machine instruction. Using constants requires to
>recompile the related library.
>
>Unless no one comes up with a better solution, I'd
>continue on the initial track, using modem.h, but
>change it somehow like
>
>#if defined(ETHERNUT2)
>#include <cfg/ethernut2.h>
>#elif define(DUSAN_PERFMON)
>#include <cfg/dfperfmon.h>
>#....
>
>and use
>HWDEF=-DDUSAN_PERFMON

Dusan 




More information about the En-Nut-Discussion mailing list