ppp_hdlc.c File Reference

PPP HDLC driver. More...

#include <stdio.h>
#include "core/net.h"
#include "ppp/ppp.h"
#include "ppp/ppp_hdlc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NIC_TRACE_LEVEL
 

Functions

error_t pppHdlcDriverInit (NetInterface *interface)
 PPP HDLC driver initialization. More...
 
void pppHdlcDriverTick (NetInterface *interface)
 PPP HDLC driver timer handler. More...
 
void pppHdlcDriverEnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void pppHdlcDriverDisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void pppHdlcDriverEventHandler (NetInterface *interface)
 PPP HDLC driver event handler. More...
 
error_t pppHdlcDriverSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset)
 Send a packet. More...
 
error_t pppHdlcDriverReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t pppHdlcDriverUpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
error_t pppHdlcDriverSendAtCommand (NetInterface *interface, const char_t *data)
 Send AT command. More...
 
error_t pppHdlcDriverReceiveAtCommand (NetInterface *interface, char_t *data, size_t size)
 Wait for an incoming AT command. More...
 
error_t pppHdlcDriverPurgeTxBuffer (PppContext *context)
 Purge TX buffer. More...
 
error_t pppHdlcDriverPurgeRxBuffer (PppContext *context)
 Purge RX buffer. More...
 
void pppHdlcDriverWriteTxQueue (PppContext *context, uint8_t c)
 Write TX queue. More...
 
uint8_t pppHdlcDriverReadRxQueue (PppContext *context)
 Read RX queue. More...
 
bool_t pppHdlcDriverReadTxQueue (NetInterface *interface, int_t *c)
 Read TX queue. More...
 
bool_t pppHdlcDriverWriteRxQueue (NetInterface *interface, uint8_t c)
 Write RX queue. More...
 

Variables

const NicDriver pppHdlcDriver
 PPP HDLC driver. More...
 

Detailed Description

PPP HDLC driver.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file ppp_hdlc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 30 of file ppp_hdlc.c.

Function Documentation

◆ pppHdlcDriverDisableIrq()

void pppHdlcDriverDisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 135 of file ppp_hdlc.c.

◆ pppHdlcDriverEnableIrq()

void pppHdlcDriverEnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 123 of file ppp_hdlc.c.

◆ pppHdlcDriverEventHandler()

void pppHdlcDriverEventHandler ( NetInterface interface)

PPP HDLC driver event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 146 of file ppp_hdlc.c.

◆ pppHdlcDriverInit()

error_t pppHdlcDriverInit ( NetInterface interface)

PPP HDLC driver initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 74 of file ppp_hdlc.c.

◆ pppHdlcDriverPurgeRxBuffer()

error_t pppHdlcDriverPurgeRxBuffer ( PppContext context)

Purge RX buffer.

Parameters
[in]contextPointer to the PPP context
Returns
Error code

Definition at line 528 of file ppp_hdlc.c.

◆ pppHdlcDriverPurgeTxBuffer()

error_t pppHdlcDriverPurgeTxBuffer ( PppContext context)

Purge TX buffer.

Parameters
[in]contextPointer to the PPP context
Returns
Error code

Definition at line 504 of file ppp_hdlc.c.

◆ pppHdlcDriverReadRxQueue()

uint8_t pppHdlcDriverReadRxQueue ( PppContext context)

Read RX queue.

Parameters
[in]contextPointer to the PPP context
Returns
Character read from the queue

Definition at line 577 of file ppp_hdlc.c.

◆ pppHdlcDriverReadTxQueue()

bool_t pppHdlcDriverReadTxQueue ( NetInterface interface,
int_t c 
)

Read TX queue.

Parameters
[in]interfaceUnderlying network interface
[out]cCharacter read from the queue
Returns
TRUE if a context switch is required

Definition at line 607 of file ppp_hdlc.c.

◆ pppHdlcDriverReceiveAtCommand()

error_t pppHdlcDriverReceiveAtCommand ( NetInterface interface,
char_t data,
size_t  size 
)

Wait for an incoming AT command.

Parameters
[in]interfaceUnderlying network interface
[out]dataBuffer where to store the incoming AT command
[in]sizeSize of the buffer, in bytes
Returns
Error code

Definition at line 421 of file ppp_hdlc.c.

◆ pppHdlcDriverReceivePacket()

error_t pppHdlcDriverReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 290 of file ppp_hdlc.c.

◆ pppHdlcDriverSendAtCommand()

error_t pppHdlcDriverSendAtCommand ( NetInterface interface,
const char_t data 
)

Send AT command.

Parameters
[in]interfaceUnderlying network interface
[in]dataNULL-terminated string that contains the AT command to be sent
Returns
Error code

Definition at line 386 of file ppp_hdlc.c.

◆ pppHdlcDriverSendPacket()

error_t pppHdlcDriverSendPacket ( NetInterface interface,
const NetBuffer buffer,
size_t  offset 
)

Send a packet.

Parameters
[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer containing the data to send
[in]offsetOffset to the first data byte
Returns
Error code

Definition at line 181 of file ppp_hdlc.c.

◆ pppHdlcDriverTick()

void pppHdlcDriverTick ( NetInterface interface)

PPP HDLC driver timer handler.

This routine is periodically called by the TCP/IP stack to handle periodic operations such as polling the link state

Parameters
[in]interfaceUnderlying network interface

Definition at line 113 of file ppp_hdlc.c.

◆ pppHdlcDriverUpdateMacAddrFilter()

error_t pppHdlcDriverUpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 372 of file ppp_hdlc.c.

◆ pppHdlcDriverWriteRxQueue()

bool_t pppHdlcDriverWriteRxQueue ( NetInterface interface,
uint8_t  c 
)

Write RX queue.

Parameters
[in]interfaceUnderlying network interface
[in]cCharacter to be written
Returns
TRUE if a context switch is required

Definition at line 654 of file ppp_hdlc.c.

◆ pppHdlcDriverWriteTxQueue()

void pppHdlcDriverWriteTxQueue ( PppContext context,
uint8_t  c 
)

Write TX queue.

Parameters
[in]contextPointer to the PPP context
[in]cCharacter to be written

Definition at line 553 of file ppp_hdlc.c.

Variable Documentation

◆ pppHdlcDriver

const NicDriver pppHdlcDriver
Initial value:
=
{
NULL,
NULL,
NULL,
}
error_t pppHdlcDriverSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset)
Send a packet.
Definition: ppp_hdlc.c:181
void pppHdlcDriverEnableIrq(NetInterface *interface)
Enable interrupts.
Definition: ppp_hdlc.c:123
error_t pppHdlcDriverInit(NetInterface *interface)
PPP HDLC driver initialization.
Definition: ppp_hdlc.c:74
PPP interface.
Definition: nic.h:70
void pppHdlcDriverDisableIrq(NetInterface *interface)
Disable interrupts.
Definition: ppp_hdlc.c:135
#define PPP_DEFAULT_MRU
Definition: ppp.h:126
void pppHdlcDriverEventHandler(NetInterface *interface)
PPP HDLC driver event handler.
Definition: ppp_hdlc.c:146
void pppHdlcDriverTick(NetInterface *interface)
PPP HDLC driver timer handler.
Definition: ppp_hdlc.c:113
error_t pppHdlcDriverUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
Definition: ppp_hdlc.c:372
#define FALSE
Definition: os_port.h:44

PPP HDLC driver.

Definition at line 47 of file ppp_hdlc.c.