2 * carlu - userspace testing utility for ar9170 devices
4 * common API declaration
6 * Copyright 2009-2011 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_H
24 #define __CARL9170USER_H
27 #include "SDL_thread.h"
36 #include "ieee80211.h"
41 libusb_device_handle *dev;
44 SDL_Thread *event_thread;
45 bool stop_event_polling;
47 struct libusb_transfer *rx_ring[AR9170_RX_BULK_BUFS];
49 struct libusb_transfer *rx_interrupt;
50 unsigned char irq_buf[AR9170_RX_BULK_IRQ_SIZE];
53 unsigned char buf[CARL9170_MAX_CMD_LEN];
54 uint32_t buf4[CARL9170_MAX_CMD_LEN / sizeof(uint32_t)];
55 struct carl9170_cmd cmd;
56 struct carl9170_rsp rsp;
59 struct list_head tx_queue;
60 SDL_mutex *tx_queue_lock;
61 unsigned int tx_queue_len;
63 struct list_head dev_list;
66 unsigned int miniboot_size;
79 void (*tx_cb)(struct carlu *, struct frame *);
80 void (*tx_fb_cb)(struct carlu *, struct frame *);
81 void (*rx_cb)(struct carlu *, void *, unsigned int);
82 int (*cmd_cb)(struct carlu *, struct carl9170_rsp *,
83 void *, unsigned int);
87 struct ar9170_eeprom eeprom;
89 struct frame_queue tx_sent_queue[__AR9170_NUM_TXQ];
92 unsigned int dma_chunks;
93 unsigned int dma_chunk_size;
94 unsigned int used_dma_chunks;
96 unsigned int extra_headroom;
104 unsigned long tx_octets;
105 unsigned long rx_octets;
114 struct carlu_tx_info_tx {
118 struct carlu_tx_info {
121 struct carlu_rate rates[CARL9170_TX_MAX_RATES];
124 struct carlu_tx_info_tx tx;
128 static inline struct carlu_tx_info *get_tx_info(struct frame *frame)
130 return (void *) frame->cb;
133 void *carlu_alloc_driver(size_t size);
134 void carlu_free_driver(struct carlu *ar);
136 int carlu_fw_check(struct carlu *ar);
137 void carlu_fw_info(struct carlu *ar);
139 void carlu_rx(struct carlu *ar, struct frame *frame);
140 int carlu_tx(struct carlu *ar, struct frame *frame);
141 void carlu_tx_feedback(struct carlu *ar,
142 struct carl9170_rsp *cmd);
143 void carlu_handle_command(struct carlu *ar, void *buf, unsigned int len);
145 struct frame *carlu_alloc_frame(struct carlu *ar, unsigned int size);
146 void carlu_free_frame(struct carlu *ar, struct frame *frame);
147 #endif /* __CARL9170USER_H */