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, NetTxAncillary *ancillary)
 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

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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
2.4.4

Definition in file ppp_hdlc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 32 of file ppp_hdlc.c.

Function Documentation

◆ pppHdlcDriverDisableIrq()

void pppHdlcDriverDisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 137 of file ppp_hdlc.c.

◆ pppHdlcDriverEnableIrq()

void pppHdlcDriverEnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 125 of file ppp_hdlc.c.

◆ pppHdlcDriverEventHandler()

void pppHdlcDriverEventHandler ( NetInterface interface)

PPP HDLC driver event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 148 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 76 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 553 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 529 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 602 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 632 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 432 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 294 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 395 of file ppp_hdlc.c.

◆ pppHdlcDriverSendPacket()

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

Send a packet.

Parameters
[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer containing the data to send
[in]offsetOffset to the first data byte
[in]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 185 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 115 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 381 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 679 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 578 of file ppp_hdlc.c.

Variable Documentation

◆ pppHdlcDriver

void pppHdlcDriverEventHandler(NetInterface *interface)
PPP HDLC driver event handler.
Definition: ppp_hdlc.c:148
void pppHdlcDriverDisableIrq(NetInterface *interface)
Disable interrupts.
Definition: ppp_hdlc.c:137
#define FALSE
Definition: os_port.h:46
error_t pppHdlcDriverUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
Definition: ppp_hdlc.c:381
@ NIC_TYPE_PPP
PPP interface.
Definition: nic.h:84
error_t pppHdlcDriverSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
Definition: ppp_hdlc.c:185
void pppHdlcDriverEnableIrq(NetInterface *interface)
Enable interrupts.
Definition: ppp_hdlc.c:125
error_t pppHdlcDriverInit(NetInterface *interface)
PPP HDLC driver initialization.
Definition: ppp_hdlc.c:76
#define PPP_DEFAULT_MRU
Definition: ppp.h:128
void pppHdlcDriverTick(NetInterface *interface)
PPP HDLC driver timer handler.
Definition: ppp_hdlc.c:115