diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-26 19:36:54 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-26 19:36:54 -0600 |
commit | 71e1a86a033c380f85dd300d788af63bfef25bab (patch) | |
tree | 07aa53d5a933ba51535a78972edbfe0cd95a31c5 /tusb_helpers.h.gen | |
parent | f5da707e77ee954b12f3c961012e4f40fa4e1bd3 (diff) |
wip reorg
Diffstat (limited to 'tusb_helpers.h.gen')
-rwxr-xr-x | tusb_helpers.h.gen | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/tusb_helpers.h.gen b/tusb_helpers.h.gen deleted file mode 100755 index a348b16..0000000 --- a/tusb_helpers.h.gen +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash -# -*- Mode: C -*- -set -e -exec >"${0%.gen}" -cat <<'EOT' -/* tusb_helpers.h - Preprocessor macros that I think should be included in TinyUSB - * - * Copyright (c) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef _USB_HELPERS_H_ -#define _USB_HELPERS_H_ - -/* USB 2.0 §9.6.7 "String" says "The list of currently defined USB LANGIDs can be found at - * http://www.usb.org/developers/docs.html.", but that page 404s. - * - * Once upon a time the USB-IF (usb.org) published a "Language Identifiers (LANGIDs)" version 1.0, - * dated 2000-03-29. There is no longer any mention of this on usb.org, but I found a copy at - * http://www.baiheee.com/Documents/090518/090518112619/USB_LANGIDs.pdf - * - * So how does the USB-IF defined LANGIDs these days? - * - * https://www.usb.org/deprecated-links-and-tools says "To get the latest LANGID definitions go to - * https://docs.microsoft.com/en-us/windows/desktop/intl/language-identifier-constants-and-strings. This - * page will change as new LANGIDs are added." That page has no list of LANGIDs, but says "For the - * predefined primary language identifiers with their valid sublanguage identifiers, see - * [\[MS-LCID\]: Windows Language Code Identifier (LCID) - * Reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-565326e84c37f)." - * That page at the time of this writing as a PDF marked as version 16.0, dated 2024-04-24: - * https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-LCID/%5bMS-LCID%5d.pdf - * [MS-LCID] defines an LCID as a 32-bit value consisting of a 16-bit a "Language ID", a 4-bit "Sort - * ID", and 12 reserved bits. - * - * That is to say: The USB-IF has said in essence "USB LANGIDs are defined to be the 'Language ID' - * portion of Microsoft Windows LCIDs (Language Code Identifiers); refer to Microsoft's published - * list of LCID Language IDs for a list of USB LANGIDs." - * - * The scheme for Language IDs is that the least-significant-byte is "primary" ID and the - * most-significant-byte is a "sublanguage" ID within that. With this in mind, Microsoft's choice - * to sort their list of by most-significant-byte was a poor editorial choice. - */ -EOT -[ -d 3rd-party ] || mkdir 3rd-party -[ -f 3rd-party/MS-LCID.pdf ] || wget -O 3rd-party/MS-LCID.pdf 'https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-LCID/%5bMS-LCID%5d.pdf' -[ -f 3rd-party/MS-LCID.txt ] || pdftotext -layout 3rd-party/MS-LCID.pdf -<3rd-party/MS-LCID.txt \ - grep -E '^\s*0x[0-9A-F]{4}\s+[a-z]' | sed 's/,.*//' | grep -v reserved | # find the lines we're interested in - sed -E 's/^\s*0x(..)(..)\s+(\S.*)/\2 \1 \3/p' | tr '[:lower:]-' '[:upper:]_' | # format them as 'PRIhex SUBhex UPPER_STR' - sort | - sed -E 's/(..) (..) (.*)/#define LANGID_\3 0x\2\1/' | # format them as '#define LANGID_UPPER_STR 0xSUBPRI' - column --table --output-separator=' ' -cat <<'EOT' - -/* USB 2.0 §9.6.6 "Endpoint", field bEndpointAddress, bit 7 */ -#define TUD_ENDPOINT_OUT 0x00 -#define TUD_ENDPOINT_IN 0x80 - -#define TU_UTF16(str) u ## str - -#endif /* _USB_HELPERS_H_ */ -EOT |