2022-01-07 08:58:03 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// See LICENSE.txt for the text of the license.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// at91sam7s USB CDC device implementation
|
|
|
|
// based on the "Basic USB Example" from ATMEL (doc6123.pdf)
|
|
|
|
//-----------------------------------------------------------------------------
|
2019-03-09 15:49:41 +08:00
|
|
|
|
|
|
|
#ifndef _USB_CDC_H_
|
|
|
|
#define _USB_CDC_H_
|
|
|
|
|
|
|
|
#include "common.h"
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "at91sam7s512.h"
|
2019-03-09 15:49:41 +08:00
|
|
|
|
2023-11-15 18:04:52 +08:00
|
|
|
#define AT91C_USB_EP_CONTROL_SIZE 8
|
|
|
|
#define AT91C_USB_EP_OUT_SIZE 64
|
|
|
|
#define AT91C_USB_EP_IN_SIZE 64
|
|
|
|
|
2019-04-10 16:35:03 +08:00
|
|
|
void usb_disable(void);
|
|
|
|
void usb_enable(void);
|
|
|
|
bool usb_check(void);
|
|
|
|
bool usb_poll(void);
|
2023-11-14 01:12:21 +08:00
|
|
|
uint16_t usb_available_length(void);
|
2019-04-10 16:35:03 +08:00
|
|
|
bool usb_poll_validate_length(void);
|
2019-04-06 07:00:54 +08:00
|
|
|
uint32_t usb_read(uint8_t *data, size_t len);
|
2019-04-23 04:58:45 +08:00
|
|
|
int usb_write(const uint8_t *data, const size_t len);
|
2023-11-14 01:12:21 +08:00
|
|
|
int async_usb_write_start(void);
|
|
|
|
void async_usb_write_pushByte(uint8_t data);
|
|
|
|
bool async_usb_write_requestWrite(void);
|
|
|
|
int async_usb_write_stop(void);
|
2019-04-16 16:01:08 +08:00
|
|
|
uint32_t usb_read_ng(uint8_t *data, size_t len);
|
2023-02-18 07:42:46 +08:00
|
|
|
void usb_update_serial(uint64_t newSerialNumber);
|
2019-03-09 15:49:41 +08:00
|
|
|
|
2019-04-06 07:00:54 +08:00
|
|
|
void SetUSBreconnect(int value);
|
|
|
|
int GetUSBreconnect(void);
|
|
|
|
void SetUSBconfigured(int value);
|
|
|
|
int GetUSBconfigured(void);
|
2019-03-09 15:49:41 +08:00
|
|
|
|
2020-05-14 05:31:28 +08:00
|
|
|
void AT91F_USB_SendData(AT91PS_UDP pudp, const char *pData, uint32_t length);
|
|
|
|
void AT91F_USB_SendZlp(AT91PS_UDP pudp);
|
|
|
|
void AT91F_USB_SendStall(AT91PS_UDP pudp);
|
2019-04-10 16:35:03 +08:00
|
|
|
void AT91F_CDC_Enumerate(void);
|
2019-03-09 15:49:41 +08:00
|
|
|
|
|
|
|
#endif // _USB_CDC_H_
|