#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
#include <asm/byteorder.h>
#define VERSION_STRING DRIVER_DESC " 2.1d"
#define NOZOMI_DEBUG_LEVEL 0x00
static int debug = NOZOMI_DEBUG_LEVEL;
module_param(debug, int, S_IRUGO | S_IWUSR);
#define DBG_(lvl, fmt, args...) \
pr_debug("[%d] %s(): " fmt "\n", \
__LINE__, __func__, ##args); \
#define DBG1(args...) DBG_(0x01, ##args)
#define DBG2(args...) DBG_(0x02, ##args)
#define DBG3(args...) DBG_(0x04, ##args)
#define DBG4(args...) DBG_(0x08, ##args)
#define DUMP(buf__, len__) \
char tbuf[TMP_BUF_MAX] = {0}; \
u32 data_len = min_t(u32, len__, TMP_BUF_MAX); \
strscpy(tbuf, buf__, data_len); \
if (tbuf[data_len - 2] == '\r') \
tbuf[data_len - 2] = 'r'; \
DBG1("SENDING: '%s' (%d+n)", tbuf, len__); \
DBG1("SENDING: '%s' (%d)", tbuf, len__); \
#define NOZOMI_NAME "nozomi"
#define NOZOMI_NAME_TTY "nozomi_tty"
#define DRIVER_DESC "Nozomi driver"