/*
 * ds.h v1.27: 1995/02/25 08:34:02 (David Hinds)
 */

#ifndef _LINUX_DS_H
#define _LINUX_DS_H

#ifdef __KERNEL__

typedef struct dev_link_t {
    char		dev_name[8];
    u_char		major, minor;
    u_long		state, open;
    struct wait_queue	*pending;
    struct timer_list	release;
    client_handle_t	handle;
    io_req_t		io;
    irq_req_t		irq;
    config_req_t	conf;
    window_handle_t	win;
    void		*priv;
    struct dev_link_t	*next;
} dev_link_t;

/* Flags for device state */
#define DEV_PRESENT		0x01
#define DEV_CONFIG		0x02
#define DEV_STALE_CONFIG	0x04	/* release on close */
#define DEV_STALE_LINK		0x08	/* detach on release */
#define DEV_CONFIG_PENDING	0x10
#define DEV_RELEASE_PENDING	0x20
#define DEV_SUSPEND		0x40
#define DEV_BUSY		0x80

#define DEV_OK(l) \
    ((l) && ((l->state & ~DEV_BUSY) == (DEV_CONFIG|DEV_PRESENT)))

int register_pcmcia_driver(dev_info_t *dev_info,
			   dev_link_t *(*attach)(void),
			   void (*detach)(dev_link_t *));

int unregister_pcmcia_driver(dev_info_t *dev_info);

#endif /* __KERNEL__ */

typedef struct tuple_parse_t {
    tuple_t		tuple;
    char		data[255];
    cisparse_t		parse;
} tuple_parse_t;

typedef struct bind_info_t {
    dev_info_t		dev_info;
    struct dev_link_t	*instance;
    char		name[8];
    u_char		major, minor;
    struct socket_bind_t *next;
} bind_info_t;

typedef union ds_ioctl_arg_t {
    servinfo_t		servinfo;
    adjust_t		adjust;
    config_t		config;
    tuple_t		tuple;
    tuple_parse_t	tuple_parse;
    client_req_t	client_req;
    status_t		status;
    conf_reg_t		conf_reg;
    bind_info_t		bind_info;
    cisinfo_t		cisinfo;
} ds_ioctl_arg_t;

#define DS_GET_CARD_SERVICES_INFO	_IOR ('d', 1, servinfo_t)
#define DS_ADJUST_RESOURCE_INFO		_IOWR('d', 2, adjust_t)
#define DS_GET_CONFIGURATION_INFO	_IOR ('d', 3, config_t)
#define DS_GET_FIRST_TUPLE		_IOWR('d', 4, tuple_t)
#define DS_GET_NEXT_TUPLE		_IOWR('d', 5, tuple_t)
#define DS_GET_TUPLE_DATA		_IOWR('d', 6, tuple_parse_t)
#define DS_PARSE_TUPLE			_IOWR('d', 7, tuple_parse_t)
#define DS_RESET_CARD			_IO  ('d', 8)
#define DS_GET_STATUS			_IOR ('d', 9, status_t)
#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
#define DS_VALIDATE_CIS			_IOR ('d', 11, cisinfo_t)
#define DS_SUSPEND_CARD			_IO  ('d', 12)
#define DS_RESUME_CARD			_IO  ('d', 13)
#define DS_EJECT_CARD			_IO  ('d', 14)
#define DS_INSERT_CARD			_IO  ('d', 15)

#define DS_BIND_REQUEST			_IOWR('d',60, bind_info_t)
#define DS_GET_DEVICE_INFO		_IOWR('d',61, bind_info_t) 
#define DS_UNBIND_REQUEST		_IOW ('d',62, bind_info_t)

#endif /* _LINUX_DS_H */
