2 * carl9170user - userspace testing utility for ar9170 devices
4 * USB back-end API declaration
6 * Copyright 2009, 2010 Christian Lamparter <chunkeey@googlemail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __CARL9170USER_USB_H
24 #define __CARL9170USER_USB_H
27 #include "SDL_thread.h"
35 #define AR9170_RX_BULK_BUFS 16
36 #define AR9170_RX_BULK_BUF_SIZE 8192
37 #define AR9170_RX_BULK_IRQ_SIZE 64
40 #define AR9170_EP_TX (LIBUSB_ENDPOINT_OUT | AR9170_USB_EP_TX)
41 #define AR9170_EP_RX (LIBUSB_ENDPOINT_IN | AR9170_USB_EP_RX)
42 #define AR9170_EP_IRQ (LIBUSB_ENDPOINT_IN | AR9170_USB_EP_IRQ)
43 #define AR9170_EP_CMD (LIBUSB_ENDPOINT_OUT | AR9170_USB_EP_CMD)
45 #define AR9170_TX_MAX_ACTIVE_URBS 8
47 #define CARL9170_FIRMWARE_FILE "/lib/firmware/carl9170-1"
48 void carlusb_reset_txep(struct carlu *ar);
52 libusb_device_handle *dev;
55 SDL_Thread *event_thread;
56 bool stop_event_polling;
58 struct libusb_transfer *rx_ring[AR9170_RX_BULK_BUFS];
60 struct libusb_transfer *rx_interrupt;
61 unsigned char irq_buf[AR9170_RX_BULK_IRQ_SIZE];
63 unsigned char cmd_buf[CARL9170_MAX_CMD_LEN];
65 struct list_head tx_queue;
66 SDL_mutex *tx_queue_lock;
67 unsigned int tx_queue_len;
69 struct list_head dev_list;
72 unsigned int miniboot_size;
81 struct carlu *carlusb_probe(void);
82 void carlusb_close(struct carlu *ar);
84 void carlusb_tx(struct carlu *ar, struct frame *frame);
85 int carlusb_fw_check(struct carlusb *ar);
87 int carlusb_cmd(struct carlu *_ar, uint8_t oid, uint8_t *cmd, size_t clen,
88 uint8_t *rsp, size_t rlen);
90 int carlusb_print_known_devices(void);
92 #endif /* __CARL9170USER_USB_H */