IndustryPack Drivers
Comm302 HDLC Driver Interface
Functions provided by driver:
int hdlcInit(PhysSpec *phys_spec);
Configures and initializes channel. PhysSpec defines the physical configuration.
typedef struct
{
ui32 baud_rate;
ui8 tclk_mode; /* from TCLK pin, RCLK pin or baud rate generator */
ui8 rclk_mode; /* from RCLK pin, TCLK pin or baud rate generator */
ui8 encoding; /* HDLC_NRZI or HDLC_NRZ */
ui16 CTS_timeout; /* # seconds persistence or 0xFFFF ignore */
ui16 DCD_timeout; /* # seconds persistence or 0xFFFF ignore */
ui16 DSR_timeout; /* # seconds persistence or 0xFFFF ignore */
} PhysSpec;
int connect(void);
Starts channel's transmitter and receiver. Asserts line signal outputs.
void disconnect(void);
Stops channel's transmitter and receiver. De-asserts line signal outputs.
int send(LapbBuf *bufp);
Queues buffer for transmission
void poll(void);
Processes interrupt events.
void statistics(int print, PhysStats *statp);
Reads and/or writes to stdout the channel's physical statistics.
Functions provided by upper layer:
void *hdlcAdd(int (*connect)(void), void (*disconnect)(void), int (*send)(LapbBuf *bufp), void (*poll)(void), void (*statistics)(int print, PhysStats *statp), void (*check_sig)(void));
Installs driver in upper layer protocol stack.
void hdlcDataInd(LapbId *lapb, LapbBuf *bufp);
Passes received buffer to upper layer protocol stack.
void hdlcDiscInd(LapbId *lapb);
Reports physical disconnect to upper layer protocol stack.
void hdlcFreeBuf(LapbId *lapb, LapbBuf *bufp);
Frees buffer allocated from upper layer protocol stack.
LapbBuf *hdlcGetRxBuf(LapbId *lapb);
Allocates buffer from upper layer protocol stack.
int hdlcPollReq(LapbId *lapb);
Requests interrupt processing from upper layer protocol stack.
|