/*
 *  User Mode Init manager - For shared transport
 *
 *  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef UIM_H
#define UIM_H

/* Paramaters to set the baud rate*/
#define  FLOW_CTL	0x0001
#define  BOTHER		0x00001000
#define  ARM_NCCS	19

#ifndef TCGETS2
#define TCGETS2      _IOR('T', 0x2A, struct termios2)
#endif

#ifndef TCSETS2
#define TCSETS2      _IOW('T', 0x2B, struct termios2)
#endif

/*HCI Command and Event information*/
#define HCI_HDR_OPCODE  0xff36
#define RESP_PREFIX	0x04
#define MAX_TRY		10

/* HCI Packet types */
#define HCI_COMMAND_PKT		0x01
#define HCI_EVENT_PKT		0x04

/* HCI command macros*/
#define HCI_EVENT_HDR_SIZE      2
#define HCI_COMMAND_HDR_SIZE    3

/* HCI event macros*/
#define EVT_CMD_COMPLETE_SIZE	3
#define EVT_CMD_STATUS_SIZE	4
#define EVT_CMD_COMPLETE	0x0E
#define EVT_CMD_STATUS		0x0F

#define VERBOSE
/*Debug logs*/
#define UIM_ERR(fmt, arg...)  printf("uim:"fmt"\n" , ##arg)
#if defined(UIM_DEBUG)		/* limited debug messages */
#define UIM_START_FUNC()      printf("uim: Inside %s", __func__)
#define UIM_DBG(fmt, arg...)  printf("uim:"fmt"\n" , ## arg)
#define UIM_VER(fmt, arg...)
#elif defined(VERBOSE)		/* very verbose */
#define UIM_START_FUNC()      printf("uim: Inside %s", __func__)
#define UIM_DBG(fmt, arg...)  printf("uim:"fmt"\n" , ## arg)
#define UIM_VER(fmt, arg...)  printf("uim:"fmt"\n" , ## arg)
#else /* error msgs only */
#define UIM_START_FUNC()
#define UIM_DBG(fmt, arg...)
#define UIM_VER(fmt, arg...)
#endif

/*Termios2 structure for setting the Custom baud rate*/
struct termios2 {
	tcflag_t c_iflag;	/* input mode flags */
	tcflag_t c_oflag;	/* output mode flags */
	tcflag_t c_cflag;	/* control mode flags */
	tcflag_t c_lflag;	/* local mode flags */
	cc_t c_line;		/* line discipline */
	cc_t c_cc[ARM_NCCS];	/* control characters */
	speed_t c_ispeed;	/* input speed */
	speed_t c_ospeed;	/* output speed */
};

/* HCI command header*/
struct hci_command_hdr {
	uint16_t        opcode;         /* OCF & OGF */
	uint8_t         plen;
} __attribute__ ((packed));

/* HCI event header*/
struct hci_event_hdr {
	uint8_t         evt;
	uint8_t         plen;
} __attribute__ ((packed));

/* HCI command complete event*/
struct evt_cmd_complete {
	uint8_t         ncmd;
	uint16_t        opcode;
} __attribute__ ((packed));

/* HCI event status*/
struct evt_cmd_status {
	uint8_t         status;
	uint8_t         ncmd;
	uint16_t        opcode;
} __attribute__ ((packed));

/* HCI Event structure to set the cusrom baud rate*/
struct command_complete_t {
	uint8_t uart_prefix;
	struct hci_event_hdr hci_hdr;
	struct evt_cmd_complete cmd_complete;
	uint8_t status;
	uint8_t data[16];
} __attribute__ ((packed));

/* HCI Command structure to set the cusrom baud rate*/
struct uim_speed_change_cmd {
	uint8_t uart_prefix;
	struct hci_command_hdr hci_hdr;
	uint32_t speed;
} __attribute__ ((packed));

/* Signal received from KIM will install line discipline at first,
 * the next signal received from KIM will un-install the
 * line discipline*/
enum {
	/* expecting signal from KIM to setup uart fd for ST */
	INSTALL_N_TI_WL,

	/* expecting signal from KIM to close uart fd */
	UNINSTALL_N_TI_WL,
};

/* Functions to insert and remove the kernel modules from the system*/
extern int init_module(void *, unsigned int, const char *);
extern int delete_module(const char *, unsigned int);
extern int load_file(const char *, unsigned int *);

#endif /* UIM_H */
