/****************************************************************************
*
*	Name:			hasbani.h
*
*	Description:	 E2 Linux Driver Header File.
*
*	Copyright:		(c) 1999 Conexant Systems Inc.
*
*	Revision:	Date:		Author:				Description:
*
*	Linux-1.0	May 29 2002	Shen Wei Wang			Modified.
*					shenwei.wang@conexant.com
*
*****************************************************************************
*	$Author:   Shen Wei Wang  $
*	$Revision:   1.0  $
*	$Modtime:   May 29 2002 11:09:58  $
****************************************************************************/

#ifndef __HASBANI_H__
#define __HASBANI_H__

//#define __KERNEL__
//#define MODULE


#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/skbuff.h>



#include <linux/netdevice.h>
#include <linux/etherdevice.h> 
#include <linux/rtnetlink.h>
#include <asm/uaccess.h>



#include "customer.h"

#ifndef USB_CLASS_DATA 
typedef struct urb urb_t;
typedef urb_t *purb_t;
#endif

typedef enum
{
   DEV_E2,
   DEV_E2RM,
   DEV_K2,
   DEV_HASBANI
} DEV_TYPE;

/******* USB layer data structures ***********/
struct hsb_usb_context
{
	purb_t purb;
	struct sk_buff* skb;
	struct usb_device * pdev;                                
};
 
struct hsb_usb_device
{
	struct hsb_usb_context send_context, recv_context;
	struct sk_buff_head send_queue_head, recv_queue_head;
	
	spinlock_t          sndqlock;
	spinlock_t          recvqlock;
	spinlock_t          cmdrecvqlock;
	struct usb_device * pdev;
	int minor;
	int started;
	//Ethernet related:
	struct net_device* hsb_eth_dev;
	
	//for download only
	wait_queue_head_t iscomplete;
	void *pMemConexant;
	
	unsigned char bSetMac;
	unsigned char bDownload;
	unsigned char bSoftBoot;
	urb_t *       dldsndurb;
	urb_t *       dldrcvurb;
	unsigned char bDldError;
	struct sk_buff_head cmd_recv_queue_head;
	DEV_TYPE DevType;
		
};

/******* USB layer subroutines ************/
int hsb_usb_start(struct net_device* dev);
void hsb_usb_stop2(struct hsb_usb_device * phsb_device);
void hsb_usb_stop(struct net_device* dev);

int hsb_usb_send(struct net_device* dev, struct sk_buff* skb);

/******* Ethernet layer data structures ********/
struct hsb_eth_priv_data
{
	struct net_device_stats net_stats;
	struct hsb_usb_device* usb_dev;
};

/******* Ethernet layer subroutines *********/
int hsb_eth_startdevice(struct hsb_usb_device* );
void hsb_eth_stopdevice(struct hsb_usb_device*);

void hsb_eth_rx(struct net_device* usb_dev, struct sk_buff* skb);

#endif
