Merge pull request #2616 from jmichelp/fix14b
[RRG-proxmark3.git] / common_arm / usb_cdc.h
blob2df1acc1ee371d65cb8c6c412e4e1a67d60251bd
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // at91sam7s USB CDC device implementation
17 // based on the "Basic USB Example" from ATMEL (doc6123.pdf)
18 //-----------------------------------------------------------------------------
20 #ifndef _USB_CDC_H_
21 #define _USB_CDC_H_
23 #include "common.h"
24 #include "at91sam7s512.h"
26 #define AT91C_USB_EP_CONTROL_SIZE 8
27 #define AT91C_USB_EP_OUT_SIZE 64
28 #define AT91C_USB_EP_IN_SIZE 64
30 void usb_disable(void);
31 void usb_enable(void);
32 bool usb_check(void);
33 bool usb_poll(void);
34 uint16_t usb_available_length(void);
35 bool usb_poll_validate_length(void);
36 uint32_t usb_read(uint8_t *data, size_t len);
37 int usb_write(const uint8_t *data, const size_t len);
38 int async_usb_write_start(void);
39 void async_usb_write_pushByte(uint8_t data);
40 bool async_usb_write_requestWrite(void);
41 int async_usb_write_stop(void);
42 bool usb_read_ng_has_buffered_data(void);
43 uint32_t usb_read_ng(uint8_t *data, size_t len);
44 void usb_update_serial(uint64_t newSerialNumber);
46 void SetUSBreconnect(int value);
47 int GetUSBreconnect(void);
48 void SetUSBconfigured(int value);
49 int GetUSBconfigured(void);
51 void AT91F_USB_SendData(AT91PS_UDP pudp, const char *pData, uint32_t length);
52 void AT91F_USB_SendZlp(AT91PS_UDP pudp);
53 void AT91F_USB_SendStall(AT91PS_UDP pudp);
54 void AT91F_CDC_Enumerate(void);
56 #endif // _USB_CDC_H_