Merge branch 'master' of git://github.com/chunkeey/carl9170fw
[carl9170fw.git] / tools / carlu / src / carlu.h
index 08fca20f1c1f2f62148c05690dd6f6a5fdda1cec..5e2c6bb58c28110d0cab1e52e2519acc03a222dd 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * carl9170user - userspace testing utility for ar9170 devices
+ * carlu - userspace testing utility for ar9170 devices
  *
  * common API declaration
  *
- * Copyright 2009, 2010 Christian Lamparter <chunkeey@googlemail.com>
+ * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "eeprom.h"
 #include "ieee80211.h"
 #include "wlan.h"
+#include "usb.h"
 
 struct carlu {
+       libusb_device_handle *dev;
+       libusb_context *ctx;
+
+       SDL_Thread *event_thread;
+       bool stop_event_polling;
+
+       struct libusb_transfer *rx_ring[AR9170_RX_BULK_BUFS];
+
+       struct libusb_transfer *rx_interrupt;
+       unsigned char irq_buf[AR9170_RX_BULK_IRQ_SIZE];
+
+       union {
+               unsigned char buf[CARL9170_MAX_CMD_LEN];
+               uint32_t buf4[CARL9170_MAX_CMD_LEN / sizeof(uint32_t)];
+               struct carl9170_cmd cmd;
+               struct carl9170_rsp rsp;
+       } cmd;
+
+       struct list_head tx_queue;
+       SDL_mutex *tx_queue_lock;
+       unsigned int tx_queue_len;
+
+       struct list_head dev_list;
+       unsigned int idx;
+
+       unsigned int miniboot_size;
+       unsigned int rx_max;
+
+       int event_pipe[2];
+
        SDL_cond *resp_pend;
        SDL_mutex *resp_lock;
        uint8_t *resp_buf;
@@ -109,7 +140,7 @@ void carlu_rx(struct carlu *ar, struct frame *frame);
 int carlu_tx(struct carlu *ar, struct frame *frame);
 void carlu_tx_feedback(struct carlu *ar,
                          struct carl9170_rsp *cmd);
-void carlu_handle_command(struct carlu *ar, void *buf, size_t len);
+void carlu_handle_command(struct carlu *ar, void *buf, unsigned int len);
 
 struct frame *carlu_alloc_frame(struct carlu *ar, unsigned int size);
 void carlu_free_frame(struct carlu *ar, struct frame *frame);