Collaboration diagram for AHDLC:
This code contains a modified UART driver with some speed optimizations for PPP, like table driven FCS calculation. It also implements simple modem handshaking (RTS, CTS and DTR).
Defines | |
#define | IN_ACC_MAP(c, m) (( ((u_char) (c)) < 0x20) && ((m) & (1UL << (c))) != 0) |
#define | NUT_THREAD_AHDLCRXSTACK 512 |
Functions | |
int | AhdlcOutput (NUTDEVICE *dev, NETBUF *nb) |
Send HDLC frame. | |
void | AhdlcRx (void *arg) |
Asynchronous HDLC receiver thread. | |
int | AhdlcAvrIOCtl (NUTDEVICE *dev, int req, void *conf) |
Perform on-chip UART control functions. | |
int | AhdlcAvrInit (NUTDEVICE *dev) |
Initialize asynchronous HDLC device. | |
int | AhdlcAvrRead (NUTFILE *fp, void *buffer, int size) |
Read from the asynchronous HDLC device. | |
int | AhdlcAvrPut (NUTDEVICE *dev, CONST void *buffer, int len, int pflg) |
Write to the asynchronous HDLC device. | |
int | AhdlcAvrWrite (NUTFILE *fp, CONST void *buffer, int len) |
Write to the asynchronous HDLC device. | |
int | AhdlcAvrWrite_P (NUTFILE *fp, PGM_P buffer, int len) |
Write to the asynchronous HDLC device. | |
NUTFILE * | AhdlcAvrOpen (NUTDEVICE *dev, CONST char *name, int mode, int acc) |
Open the asynchronous HDLC device. | |
int | AhdlcAvrClose (NUTFILE *fp) |
Close the asynchronous HDLC device. | |
Variables | |
NUTDEVICE | devAhdlc0 |
Device information structure. | |
NUTDEVICE | devAhdlc1 |
Device information structure. |
|
Checks the 32-bit ACCM to see if the byte needs un-escaping |
|
Send HDLC frame.
|
|
Asynchronous HDLC receiver thread. Running at high priority. |
|
Perform on-chip UART control functions.
|
|
Initialize asynchronous HDLC device. This function will be called during device registration. It initializes the hardware, registers all required interrupt handlers and initializes all internal data structures used by this driver.
|
|
Read from the asynchronous HDLC device. This function is called by the low level input routines of the C runtime library, using the _NUTDEVICE::dev_read entry. The function may block the calling thread until at least one character has been received or a timeout occurs. It is recommended to set a proper read timeout with software handshake. In this case a timeout may occur, if the communication peer lost our last XON character. The application may then use ioctl() to disable the receiver and do the read again. This will send out another XON.
|
|
Write to the asynchronous HDLC device.
|
|
Write to the asynchronous HDLC device. This function is called by the low level output routines of the C runtime library, using the _NUTDEVICE::dev_write entry. The function may block the calling thread.
|
|
Write to the asynchronous HDLC device. Similar to AhdlcWrite() except that the data is located in program memory. This function is called by the low level output routines of the C runtime library, using the _NUTDEVICE::dev_write_P entry. The function may block the calling thread.
|
|
Open the asynchronous HDLC device. This function is called by the low level open routine of the C runtime library, using the _NUTDEVICE::dev_open entry.
|
|
Close the asynchronous HDLC device. This function is called by the low level close routine of the C runtime library, using the _NUTDEVICE::dev_close entry.
|
|
Initial value: { 0, {'u', 'a', 'r', 't', '0', 0, 0, 0, 0}, IFTYP_CHAR, 0, 0, 0, &dcb_ahdlc, AhdlcAvrInit, AhdlcAvrIOCtl, AhdlcAvrRead, AhdlcAvrWrite, AhdlcAvrWrite_P, AhdlcAvrOpen, AhdlcAvrClose, 0 } A pointer to this structure must be passed to NutRegisterDevice() to bind this device driver to the Nut/OS kernel. |
|
Initial value: { 0, {'u', 'a', 'r', 't', '1', 0, 0, 0, 0}, IFTYP_CHAR, 1, 0, 0, &dcb_ahdlc, AhdlcAvrInit, AhdlcAvrIOCtl, AhdlcAvrRead, AhdlcAvrWrite, AhdlcAvrWrite_P, AhdlcAvrOpen, AhdlcAvrClose, 0 } A pointer to this structure must be passed to NutRegisterDevice() to bind this device driver to the Nut/OS kernel. |