-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #911 from riscv/from_upstream
From upstream
- Loading branch information
Showing
23 changed files
with
379 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
doc/usb_adapters/esp_usb_jtag/303a_1001_esp_usb_jtag.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later | ||
|
||
# Optional comment | ||
|
||
Bus 002 Device 035: ID 303a:1001 | ||
Device Descriptor: | ||
bLength 18 | ||
bDescriptorType 1 | ||
bcdUSB 2.00 | ||
bDeviceClass 239 Miscellaneous Device | ||
bDeviceSubClass 2 | ||
bDeviceProtocol 1 Interface Association | ||
bMaxPacketSize0 64 | ||
idVendor 0x303a | ||
idProduct 0x1001 | ||
bcdDevice 1.01 | ||
iManufacturer 1 Espressif | ||
iProduct 2 USB JTAG/serial debug unit | ||
iSerial 3 7C:DF:A1:A2:8F:38 | ||
bNumConfigurations 1 | ||
Configuration Descriptor: | ||
bLength 9 | ||
bDescriptorType 2 | ||
wTotalLength 0x0062 | ||
bNumInterfaces 3 | ||
bConfigurationValue 1 | ||
iConfiguration 0 | ||
bmAttributes 0xc0 | ||
Self Powered | ||
MaxPower 500mA | ||
Interface Association: | ||
bLength 8 | ||
bDescriptorType 11 | ||
bFirstInterface 0 | ||
bInterfaceCount 2 | ||
bFunctionClass 2 Communications | ||
bFunctionSubClass 2 Abstract (modem) | ||
bFunctionProtocol 0 | ||
iFunction 0 | ||
Interface Descriptor: | ||
bLength 9 | ||
bDescriptorType 4 | ||
bInterfaceNumber 0 | ||
bAlternateSetting 0 | ||
bNumEndpoints 1 | ||
bInterfaceClass 2 Communications | ||
bInterfaceSubClass 2 Abstract (modem) | ||
bInterfaceProtocol 0 | ||
iInterface 0 | ||
CDC Header: | ||
bcdCDC 1.10 | ||
CDC ACM: | ||
bmCapabilities 0x02 | ||
line coding and serial state | ||
CDC Union: | ||
bMasterInterface 0 | ||
bSlaveInterface 1 | ||
CDC Call Management: | ||
bmCapabilities 0x03 | ||
call management | ||
use DataInterface | ||
bDataInterface 1 | ||
Endpoint Descriptor: | ||
bLength 7 | ||
bDescriptorType 5 | ||
bEndpointAddress 0x82 EP 2 IN | ||
bmAttributes 3 | ||
Transfer Type Interrupt | ||
Synch Type None | ||
Usage Type Data | ||
wMaxPacketSize 0x0040 1x 64 bytes | ||
bInterval 1 | ||
Interface Descriptor: | ||
bLength 9 | ||
bDescriptorType 4 | ||
bInterfaceNumber 1 | ||
bAlternateSetting 0 | ||
bNumEndpoints 2 | ||
bInterfaceClass 10 CDC Data | ||
bInterfaceSubClass 2 | ||
bInterfaceProtocol 0 | ||
iInterface 0 | ||
Endpoint Descriptor: | ||
bLength 7 | ||
bDescriptorType 5 | ||
bEndpointAddress 0x01 EP 1 OUT | ||
bmAttributes 2 | ||
Transfer Type Bulk | ||
Synch Type None | ||
Usage Type Data | ||
wMaxPacketSize 0x0040 1x 64 bytes | ||
bInterval 1 | ||
Endpoint Descriptor: | ||
bLength 7 | ||
bDescriptorType 5 | ||
bEndpointAddress 0x81 EP 1 IN | ||
bmAttributes 2 | ||
Transfer Type Bulk | ||
Synch Type None | ||
Usage Type Data | ||
wMaxPacketSize 0x0040 1x 64 bytes | ||
bInterval 1 | ||
Interface Descriptor: | ||
bLength 9 | ||
bDescriptorType 4 | ||
bInterfaceNumber 2 | ||
bAlternateSetting 0 | ||
bNumEndpoints 2 | ||
bInterfaceClass 255 Vendor Specific Class | ||
bInterfaceSubClass 255 Vendor Specific Subclass | ||
bInterfaceProtocol 1 | ||
iInterface 0 | ||
Endpoint Descriptor: | ||
bLength 7 | ||
bDescriptorType 5 | ||
bEndpointAddress 0x02 EP 2 OUT | ||
bmAttributes 2 | ||
Transfer Type Bulk | ||
Synch Type None | ||
Usage Type Data | ||
wMaxPacketSize 0x0040 1x 64 bytes | ||
bInterval 1 | ||
Endpoint Descriptor: | ||
bLength 7 | ||
bDescriptorType 5 | ||
bEndpointAddress 0x83 EP 3 IN | ||
bmAttributes 2 | ||
Transfer Type Bulk | ||
Synch Type None | ||
Usage Type Data | ||
wMaxPacketSize 0x0040 1x 64 bytes | ||
bInterval 1 | ||
Device Status: 0x0001 | ||
Self Powered |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
/*************************************************************************** | ||
* Copyright (C) 2013-2014 by Franck Jullien * | ||
* [email protected] * | ||
* * | ||
* Copyright (C) 2022 Otto-von-Guericke-Universität Magdeburg * | ||
* [email protected] * | ||
***************************************************************************/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include "crc32.h" | ||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
static uint32_t crc_le_step(uint32_t poly, uint32_t crc, uint32_t data_in, | ||
unsigned int data_bits) | ||
{ | ||
for (unsigned int i = 0; i < data_bits; i++) { | ||
uint32_t d, c; | ||
d = ((data_in >> i) & 0x1) ? 0xffffffff : 0; | ||
c = (crc & 0x1) ? 0xffffffff : 0; | ||
crc = crc >> 1; | ||
crc = crc ^ ((d ^ c) & poly); | ||
} | ||
|
||
return crc; | ||
} | ||
|
||
uint32_t crc32_le(uint32_t poly, uint32_t seed, const void *_data, | ||
size_t data_len) | ||
{ | ||
if (((uintptr_t)_data & 0x3) || (data_len & 0x3)) { | ||
/* data is unaligned, processing data one byte at a time */ | ||
const uint8_t *data = _data; | ||
for (size_t i = 0; i < data_len; i++) | ||
seed = crc_le_step(poly, seed, data[i], 8); | ||
} else { | ||
/* data is aligned, processing 32 bit at a time */ | ||
data_len >>= 2; | ||
const uint32_t *data = _data; | ||
for (size_t i = 0; i < data_len; i++) | ||
seed = crc_le_step(poly, seed, data[i], 32); | ||
} | ||
|
||
return seed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
|
||
/*************************************************************************** | ||
* Copyright (C) 2022 Otto-von-Guericke-Universität Magdeburg * | ||
* [email protected] * | ||
***************************************************************************/ | ||
|
||
#ifndef OPENOCD_HELPER_CRC32_H | ||
#define OPENOCD_HELPER_CRC32_H | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
/** @file | ||
* A generic CRC32 implementation | ||
*/ | ||
|
||
/** | ||
* CRC32 polynomial commonly used for little endian CRC32 | ||
*/ | ||
#define CRC32_POLY_LE 0xedb88320 | ||
|
||
/** | ||
* Calculate the CRC32 value of the given data | ||
* @param poly The polynomial of the CRC | ||
* @param seed The seed to use (mostly either `0` or `0xffffffff`) | ||
* @param data The data to calculate the CRC32 of | ||
* @param data_len The length of the data in @p data in bytes | ||
* @return The CRC value of the first @p data_len bytes at @p data | ||
* @note This function can be used to incrementally compute the CRC one | ||
* chunk of data at a time by using the CRC32 of the previous chunk | ||
* as @p seed for the next chunk. | ||
*/ | ||
uint32_t crc32_le(uint32_t poly, uint32_t seed, const void *data, | ||
size_t data_len); | ||
|
||
#endif /* OPENOCD_HELPER_CRC32_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.