/* drivers/tty/smux_private.h
 *
 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * 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.
 *
 */
#ifndef SMUX_PRIVATE_H
#define SMUX_PRIVATE_H

#define SMUX_MAX_PKT_SIZE   8192
#define SMUX_BROADCAST_LCID 0xFF

/* SMUX Protocol Characters */
#define SMUX_MAGIC          0x33FC
#define SMUX_MAGIC_WORD1    0xFC
#define SMUX_MAGIC_WORD2    0x33
#define SMUX_WAKEUP_REQ     0xFD
#define SMUX_WAKEUP_ACK     0xFE

/* Unit testing characters */
#define SMUX_UT_ECHO_REQ    0xF0
#define SMUX_UT_ECHO_ACK_OK 0xF1
#define SMUX_UT_ECHO_ACK_FAIL 0xF2

/* Maximum number of packets in retry queue */
#define SMUX_RX_RETRY_MAX_PKTS 32

struct tty_struct;

/* Packet header. */
struct smux_hdr_t {
	uint16_t magic;
	uint8_t flags;
	uint8_t cmd;
	uint8_t pad_len;
	uint8_t lcid;
	uint16_t payload_len;
};

/* Internal packet structure. */
struct smux_pkt_t {
	struct smux_hdr_t hdr;
	int allocated;
	unsigned char *payload;
	int free_payload;
	struct list_head list;
	void *priv;
};

/* SMUX Packet Commands */
enum {
	SMUX_CMD_DATA = 0x0,
	SMUX_CMD_OPEN_LCH = 0x1,
	SMUX_CMD_CLOSE_LCH = 0x2,
	SMUX_CMD_STATUS = 0x3,
	SMUX_CMD_PWR_CTL = 0x4,

	SMUX_CMD_BYTE, /* for internal usage */
	SMUX_NUM_COMMANDS
};

/* Open command flags */
enum {
	SMUX_CMD_OPEN_ACK = 1 << 0,
	SMUX_CMD_OPEN_POWER_COLLAPSE = 1 << 1,
	SMUX_CMD_OPEN_REMOTE_LOOPBACK = 1 << 2,
};

/* Close command flags */
enum {
	SMUX_CMD_CLOSE_ACK = 1 << 0,
};

/* Power command flags */
enum {
	SMUX_CMD_PWR_CTL_ACK =  1 << 0,
};

/* Local logical channel states */
enum {
	SMUX_LCH_LOCAL_CLOSED,
	SMUX_LCH_LOCAL_OPENING,
	SMUX_LCH_LOCAL_OPENED,
	SMUX_LCH_LOCAL_CLOSING,
};

/* Remote logical channel states */
enum {
	SMUX_LCH_REMOTE_CLOSED,
	SMUX_LCH_REMOTE_OPENED,
};


int smux_assert_lch_id(uint32_t lcid);
void smux_init_pkt(struct smux_pkt_t *pkt);
struct smux_pkt_t *smux_alloc_pkt(void);
int smux_alloc_pkt_payload(struct smux_pkt_t *pkt);
void smux_free_pkt(struct smux_pkt_t *pkt);
int smux_serialize(struct smux_pkt_t *pkt, char *out,
					unsigned int *out_len);

void smux_rx_state_machine(const unsigned char *data, int len, int flag);
void smuxld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
			   char *fp, int count);

/* testing parameters */
extern int smux_byte_loopback;
extern int smux_simulate_wakeup_delay;

#endif /* SMUX_PRIVATE_H */
