00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __BT_A_DEV_H
00010 #define __BT_A_DEV_H
00011
00012 #include <linux/init.h>
00013 #include <linux/kernel.h>
00014 #include <linux/module.h>
00015 #include <linux/types.h>
00016 #include <linux/sched.h>
00017 #include <linux/fs.h>
00018 #include <linux/cdev.h>
00019 #include <linux/workqueue.h>
00020 #include <linux/poll.h>
00021 #include <linux/device.h>
00022 #include <linux/delay.h>
00023 #include <linux/slab.h>
00024
00025 #include <asm/uaccess.h>
00026
00027 #include <sdioemb/sdio.h>
00028 #include <sdioemb/sdio_csr.h>
00029 #include <sdioemb/sdio_cis.h>
00030 #include <sdioemb/sdio_bt_a.h>
00031 #include <csr_sdio.h>
00032 #include <csr_sdio_lib.h>
00033
00034 #define BC_DEEP_SLEEP_EXIT_TIMEOUT_MS 50
00035
00036 struct rx_queue_entry {
00037 struct list_head node;
00038 size_t len;
00039 size_t read;
00040 uint8_t *data;
00041 };
00042
00043 struct bt_a_device {
00044 struct sdioemb_bt_a_dev bdev;
00045 CsrSdioFunction * func;
00046
00047 int minor;
00048 int card_present;
00049 struct mutex mutex;
00050 struct workqueue_struct * workqueue;
00051 struct work_struct irq_work;
00052 wait_queue_head_t read_waitq;
00053 spinlock_t rx_queue_lock;
00054 struct list_head rx_queue;
00055 int rx_queue_len;
00056 #define RX_QUEUE_LEN_MAX 20
00057 wait_queue_head_t drowsy_waitq;
00058 struct timer_list idle_timer;
00059 struct work_struct torpid_work;
00060 struct cdev cdev;
00061 atomic_t ref_count;
00062 };
00063
00064 #define bt_err(bt, fmt, args...) printk(KERN_ERR "sdio_bt_a%d: " fmt, \
00065 (bt)->fdev->slot_id, ## args)
00066 #define bt_warn(bt, fmt, args...) printk(KERN_WARNING "sdio_bt_a%d: " fmt, \
00067 (bt)->fdev->slot_id, ## args)
00068
00069 int card_driver_register(void);
00070 void card_driver_unregister(void);
00071
00072 int needs_read_ack(struct bt_a_device *bt);
00073 void start_function(struct bt_a_device *bt);
00074 int check_for_reset(struct bt_a_device *bt);
00075 int tx_packet(struct bt_a_device *bt, const char *packet, ssize_t len);
00076 void set_sleep_state(struct bt_a_device *bt, enum sdio_sleep_state state);
00077 void handle_interrupt(struct bt_a_device *bt);
00078
00079 void fix_quirks(struct bt_a_device *bt);
00080
00081 void rx_queue_add(struct bt_a_device *bt, struct rx_queue_entry *rx_entry);
00082 struct rx_queue_entry *rx_queue_head(struct bt_a_device *bt);
00083 void rx_queue_remove(struct bt_a_device *bt, struct rx_queue_entry *rx_entry);
00084
00085 #endif