X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tools%2Fcarlu%2Fsrc%2Fcarlu.h;h=5e2c6bb58c28110d0cab1e52e2519acc03a222dd;hb=2410b6d77a15fc53d2e5ccffd0a1deff96676cab;hp=7101cc8c0d3c7785635ce788f66fc8bd131ab7c4;hpb=e72388a0aa23da8bc8e24a0cbe9d523c5a9ce294;p=carl9170fw.git diff --git a/tools/carlu/src/carlu.h b/tools/carlu/src/carlu.h index 7101cc8..5e2c6bb 100644 --- a/tools/carlu/src/carlu.h +++ b/tools/carlu/src/carlu.h @@ -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 + * Copyright 2009-2011 Christian Lamparter * * 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 @@ -35,8 +35,39 @@ #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 */