linux/net/nfc/nci/uart.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2015, Marvell International Ltd.
 *
 * Inspired (hugely) by HCI LDISC implementation in Bluetooth.
 *
 *  Copyright (C) 2000-2001  Qualcomm Incorporated
 *  Copyright (C) 2002-2003  Maxim Krasnyansky <[email protected]>
 *  Copyright (C) 2004-2005  Marcel Holtmann <[email protected]>
 */

#include <linux/module.h>

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ptrace.h>
#include <linux/poll.h>

#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/signal.h>
#include <linux/ioctl.h>
#include <linux/skbuff.h>

#include <net/nfc/nci.h>
#include <net/nfc/nci_core.h>

/* TX states  */
#define NCI_UART_SENDING
#define NCI_UART_TX_WAKEUP

static struct nci_uart *nci_uart_drivers[NCI_UART_DRIVER_MAX];

static inline struct sk_buff *nci_uart_dequeue(struct nci_uart *nu)
{}

static inline int nci_uart_queue_empty(struct nci_uart *nu)
{}

static int nci_uart_tx_wakeup(struct nci_uart *nu)
{}

static void nci_uart_write_work(struct work_struct *work)
{}

static int nci_uart_set_driver(struct tty_struct *tty, unsigned int driver)
{}

/* ------ LDISC part ------ */

/* nci_uart_tty_open
 *
 *     Called when line discipline changed to NCI_UART.
 *
 * Arguments:
 *     tty    pointer to tty info structure
 * Return Value:
 *     0 if success, otherwise error code
 */
static int nci_uart_tty_open(struct tty_struct *tty)
{}

/* nci_uart_tty_close()
 *
 *    Called when the line discipline is changed to something
 *    else, the tty is closed, or the tty detects a hangup.
 */
static void nci_uart_tty_close(struct tty_struct *tty)
{}

/* nci_uart_tty_wakeup()
 *
 *    Callback for transmit wakeup. Called when low level
 *    device driver can accept more send data.
 *
 * Arguments:        tty    pointer to associated tty instance data
 * Return Value:    None
 */
static void nci_uart_tty_wakeup(struct tty_struct *tty)
{}

/* -- Default recv_buf handler --
 *
 * This handler supposes that NCI frames are sent over UART link without any
 * framing. It reads NCI header, retrieve the packet size and once all packet
 * bytes are received it passes it to nci_uart driver for processing.
 */
static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
				     int count)
{}

/* nci_uart_tty_receive()
 *
 *     Called by tty low level driver when receive data is
 *     available.
 *
 * Arguments:  tty          pointer to tty instance data
 *             data         pointer to received data
 *             flags        pointer to flags for data
 *             count        count of received data in bytes
 *
 * Return Value:    None
 */
static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
				 const u8 *flags, size_t count)
{}

/* nci_uart_tty_ioctl()
 *
 *    Process IOCTL system call for the tty device.
 *
 * Arguments:
 *
 *    tty        pointer to tty instance data
 *    cmd        IOCTL command code
 *    arg        argument for IOCTL call (cmd dependent)
 *
 * Return Value:    Command dependent
 */
static int nci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
			      unsigned long arg)
{}

/* We don't provide read/write/poll interface for user space. */
static ssize_t nci_uart_tty_read(struct tty_struct *tty, struct file *file,
				 u8 *buf, size_t nr, void **cookie,
				 unsigned long offset)
{}

static ssize_t nci_uart_tty_write(struct tty_struct *tty, struct file *file,
				  const u8 *data, size_t count)
{}

static int nci_uart_send(struct nci_uart *nu, struct sk_buff *skb)
{}

int nci_uart_register(struct nci_uart *nu)
{}
EXPORT_SYMBOL_GPL();

void nci_uart_unregister(struct nci_uart *nu)
{}
EXPORT_SYMBOL_GPL();

void nci_uart_set_config(struct nci_uart *nu, int baudrate, int flow_ctrl)
{}
EXPORT_SYMBOL_GPL();

static struct tty_ldisc_ops nci_uart_ldisc =;

static int __init nci_uart_init(void)
{}

static void __exit nci_uart_exit(void)
{}

module_init();
module_exit(nci_uart_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS_LDISC();