[En-Nut-Discussion] HDLC driver

Jerome.Dsouza at mt.com Jerome.Dsouza at mt.com
Mon Jul 3 07:27:56 CEST 2006

Dear All,
Sry for the earlier mail, I just now tried to understand the code for the HDLC driver and it looks like the HDLC driver has its own buffer management and interrupt handlers for the UART. So my earlier statement of which driver to use for HDLC driver would not be proper. Sorry for that. 
It seems that the HDLC driver lies directly over the H/W UART and handles all the H/W intricacies itself, and also provides for hardware handshaking. But I dont understand why the PPPC application has not used the HDLC driver.
In the ppc appliction I have noticed that the statement 
#define PPPDEV devahdlco 
has been commented out
and instead the 
#define PPPDEV devuart0 
has been used.
I have used devahdlc0 as the driver for PPP, so I have commented out the latter statement. Is this the only change that would be needed for using HDLC as the driver for PPP. 
What about the hardware handshaking?
How do I enable hardware handshaking for the HDLC driver?
I have already tried it out, by enabling the definitions of
under USART0 in the arch tree of the configurator, also i added UART0_DTR_BIT and UART0_DTR_PORT to the tree by editing the file AVR.nut file.
So now the definitions required for the harware handshake are automatically generated in the file avrpio.h under nutbld folder by the configurator when I build the library.
 Here, I was able to create the library and build the project succesfully. However, when I open the file ppc.lst, I find that there is no assembly code generated inside the preprocessor defines of URT0_CTS_BIT for the part under the ahdlcavr.c.
Can some one please tell me, if I have done something wrong, or is it ok, if the assembler code is not generated. And if its not ok, then what can I do to ensure that the code is generated for the proprocessor defines of UART0_CTS_BIT.
(0157) static void Tx0Complete(void *arg)

(0158) {

(0159) AHDLCDCB *dcb = arg;


(0161) if (dcb->dcb_tx_idx != dcb->dcb_wr_idx) {

5A29 F059 BEQ 0x5A35

5A2A 940E7662 CALL 0x7662

(0162) #ifdef UART0_CTS_BIT                              //------------------

(0163) if (bit_is_set(UART0_CTS_PIN, UART0_CTS_BIT)) {   //

(0164) cbi(UCR, UDRIE);                                  //Is this section OK 

(0165) return;                                           //why is there no assembly code generated for these sections

(0166) }                                                 //in the ahdlcavr.c part of the pppc.lst file.

(0167) #endif                                            //------------------

(0168) outp(dcb->dcb_tx_buf[dcb->dcb_tx_idx], UDR);

5A2C 8DE3 LDD R30,Z+27

5A2D 940E7085 CALL 0x7085

5A2F B82C OUT 0x0C,R2


More information about the En-Nut-Discussion mailing list