wireless: 60g protocol constants
[carl9170fw.git] / tools / carlu / src / carlu.h
index 7101cc8c0d3c7785635ce788f66fc8bd131ab7c4..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,17 +140,8 @@ 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);
-
-int carlu_cmd_echo(struct carlu *ar, const uint32_t message);
-int carlu_cmd_reboot(struct carlu *ar);
-int carlu_cmd_read_eeprom(struct carlu *ar);
-int carlu_cmd_mem_dump(struct carlu *ar, const uint32_t start,
-                       const unsigned int len, void *_buf);
-int carlu_cmd_write_mem(struct carlu *ar, const uint32_t addr,
-                       const uint32_t val);
-
 #endif /* __CARL9170USER_H */