libosmocore 1.9.0.196-9975
Osmocom core library
sercomm.c File Reference
#include "config.h"
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/sercomm.h>
#include <osmocom/core/linuxlist.h>

Macros

#define DEFAULT_RX_MSG_SIZE   2048
 
#define HDLC_FLAG   0x7E
 
#define HDLC_ESCAPE   0x7D
 
#define HDLC_C_UI   0x03
 
#define HDLC_C_P_BIT   (1 << 4)
 
#define HDLC_C_F_BIT   (1 << 4)
 

Enumerations

enum  rx_state {
  RX_ST_WAIT_START ,
  RX_ST_ADDR ,
  RX_ST_CTRL ,
  RX_ST_DATA ,
  RX_ST_ESCAPE
}
 

Functions

void sercomm_drv_lock (unsigned long __attribute__((unused)) *flags)
 Protect against IRQ context. More...
 
void sercomm_drv_unlock (unsigned long __attribute__((unused)) *flags)
 Release protection against IRQ context. More...
 
 __attribute__ ((weak))
 
void osmo_sercomm_init (struct osmo_sercomm_inst *sercomm)
 Initialize an Osmocom sercomm instance. More...
 
int osmo_sercomm_initialized (struct osmo_sercomm_inst *sercomm)
 Determine if a given Osmocom sercomm instance has been initialized. More...
 
void osmo_sercomm_sendmsg (struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
 User interface for transmitting messages for a given DLCI. More...
 
unsigned int osmo_sercomm_tx_queue_depth (struct osmo_sercomm_inst *sercomm, uint8_t dlci)
 How deep is the Tx queue for a given DLCI? More...
 
int osmo_sercomm_change_speed (struct osmo_sercomm_inst *sercomm, uint32_t bdrt)
 wait until everything has been transmitted, then grab the lock and change the baud rate as requested More...
 
int osmo_sercomm_drv_pull (struct osmo_sercomm_inst *sercomm, uint8_t *ch)
 fetch one octet of to-be-transmitted serial data More...
 
int osmo_sercomm_register_rx_cb (struct osmo_sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb)
 Register a handler for a given DLCI. More...
 
static void dispatch_rx_msg (struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg)
 
int osmo_sercomm_drv_rx_char (struct osmo_sercomm_inst *sercomm, uint8_t ch)
 the driver has received one byte, pass it into sercomm layer More...