mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-07 07:28:46 +00:00
vs-code server
This commit is contained in:
32
node_modules/.package-lock.json
generated
vendored
Normal file
32
node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "ESP-Nodes",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/atob-lite": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
|
||||
"integrity": "sha512-LEeSAWeh2Gfa2FtlQE1shxQ8zi5F9GHarrGKz08TMdODD5T4eH6BMsvtnhbWZ+XQn+Gb6om/917ucvRu7l7ukw=="
|
||||
},
|
||||
"node_modules/esptool-js": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/esptool-js/-/esptool-js-0.5.6.tgz",
|
||||
"integrity": "sha512-5xkKxWNUuXyqdg4oS6rFVhGDr0yPNVF6qTHEMpZj26/0DeymfBlM2bT5RQdpEDatx211gDVe7op/9gKyMVbL9g==",
|
||||
"dependencies": {
|
||||
"atob-lite": "^2.0.0",
|
||||
"pako": "^2.1.0",
|
||||
"tslib": "^2.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
|
||||
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||
}
|
||||
}
|
||||
}
|
6
node_modules/atob-lite/.npmignore
generated
vendored
Normal file
6
node_modules/atob-lite/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
*.log
|
||||
.DS_Store
|
||||
bundle.js
|
||||
test
|
||||
test.js
|
18
node_modules/atob-lite/LICENSE.md
generated
vendored
Normal file
18
node_modules/atob-lite/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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.
|
37
node_modules/atob-lite/README.md
generated
vendored
Normal file
37
node_modules/atob-lite/README.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# atob-lite
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
Smallest/simplest possible means of using atob with both Node and browserify.
|
||||
|
||||
In the browser, decoding base64 strings is done using:
|
||||
|
||||
``` javascript
|
||||
var decoded = atob(encoded)
|
||||
```
|
||||
|
||||
However in Node, it's done like so:
|
||||
|
||||
``` javascript
|
||||
var decoded = new Buffer(encoded, 'base64').toString('utf8')
|
||||
```
|
||||
|
||||
You can easily check if `Buffer` exists and switch between the approaches
|
||||
accordingly, but using `Buffer` anywhere in your browser source will pull
|
||||
in browserify's `Buffer` shim which is pretty hefty. This package uses
|
||||
the `main` and `browser` fields in its `package.json` to perform this
|
||||
check at build time and avoid pulling `Buffer` in unnecessarily.
|
||||
|
||||
## Usage
|
||||
|
||||
[](https://nodei.co/npm/atob-lite/)
|
||||
|
||||
### `decoded = atob(encoded)`
|
||||
|
||||
Returns the decoded value of a base64-encoded string.
|
||||
|
||||
## License
|
||||
|
||||
MIT. See [LICENSE.md](http://github.com/hughsk/atob-lite/blob/master/LICENSE.md) for details.
|
3
node_modules/atob-lite/atob-browser.js
generated
vendored
Normal file
3
node_modules/atob-lite/atob-browser.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function _atob(str) {
|
||||
return atob(str)
|
||||
}
|
3
node_modules/atob-lite/atob-node.js
generated
vendored
Normal file
3
node_modules/atob-lite/atob-node.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function atob(str) {
|
||||
return Buffer.from(str, 'base64').toString('binary')
|
||||
}
|
42
node_modules/atob-lite/package.json
generated
vendored
Normal file
42
node_modules/atob-lite/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "atob-lite",
|
||||
"version": "2.0.0",
|
||||
"description": "Smallest/simplest possible means of using atob with both Node and browserify",
|
||||
"main": "atob-node.js",
|
||||
"browser": "atob-browser.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "npm run test-node && npm run test-browser",
|
||||
"test-node": "node test | tap-spec",
|
||||
"test-browser": "browserify test | smokestack | tap-spec"
|
||||
},
|
||||
"author": {
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com",
|
||||
"url": "http://hughsk.io/"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"browserify": "^10.2.4",
|
||||
"smokestack": "^3.3.0",
|
||||
"tap-closer": "^1.0.0",
|
||||
"tap-spec": "^4.0.0",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hughsk/atob-lite.git"
|
||||
},
|
||||
"keywords": [
|
||||
"atob",
|
||||
"base64",
|
||||
"isomorphic",
|
||||
"browser",
|
||||
"node",
|
||||
"shared"
|
||||
],
|
||||
"homepage": "https://github.com/hughsk/atob-lite",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hughsk/atob-lite/issues"
|
||||
}
|
||||
}
|
202
node_modules/esptool-js/LICENSE
generated
vendored
Normal file
202
node_modules/esptool-js/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Espressif Systems (Shanghai) CO LTD
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
83
node_modules/esptool-js/README.md
generated
vendored
Normal file
83
node_modules/esptool-js/README.md
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
# Javascript implementation of esptool
|
||||
|
||||
This repository contains a Javascript implementation of [esptool](https://github.com/espressif/esptool), a serial flasher utility for Espressif chips. `esptool-js` is based on [Web Serial API](https://wicg.github.io/serial/) and works in Google Chrome and Microsoft Edge [version 89 or later](https://developer.mozilla.org/en-US/docs/Web/API/Serial#browser_compatibility) browsers and Google Chrome on Android [version 61 or later](https://developer.mozilla.org/en-US/docs/Web/API/USB#browser_compatibility) via the [web-serial-polyfill](https://github.com/google/web-serial-polyfill) compatibility layer.
|
||||
|
||||
**NOTE:** Unlike the Python-based esptool, `esptool-js` doesn't implement generation of binary images out of ELF files, and doesn't include companion tools similar to [espefuse.py](https://github.com/espressif/esptool/wiki/espefuse) and [espsecure.py](https://github.com/espressif/esptool/wiki/espsecure).
|
||||
|
||||
## Usage
|
||||
|
||||
**CDN**
|
||||
|
||||
`https://unpkg.com/esptool-js/lib/index.js` or `https://unpkg.com/esptool-js/bundle.js` to use the single bundle JavaScript file.
|
||||
|
||||
**NPM**
|
||||
|
||||
`npm install --save esptool-js`
|
||||
|
||||
**Yarn**
|
||||
|
||||
`yarn add --save esptool-js`
|
||||
|
||||
Check an example project [here](https://github.com/espressif/esptool-js/tree/main/examples/typescript).
|
||||
|
||||
**Nightly builds** for <a href="https://nightly.link/espressif/esptool-js/workflows/ci/main">ESPTOOL-JS</a>
|
||||
|
||||
## Define port filters for device using WebSerial
|
||||
|
||||
```js
|
||||
const portFilters: { usbVendorId?: number | undefined, usbProductId?: number | undefined }[] = [];
|
||||
const device = await navigator.serial.requestPort({ filters: portFilters });
|
||||
```
|
||||
|
||||
## Inject a Terminal to use with esptool-js
|
||||
|
||||
```js
|
||||
// You can use any JavaScript compatible terminal by wrapping it in a helper object like this:
|
||||
let espLoaderTerminal = {
|
||||
clean() {
|
||||
// Implement the clean function call for your terminal here.
|
||||
},
|
||||
writeLine(data) {
|
||||
// Implement the writeLine function call for your terminal here.
|
||||
},
|
||||
write(data) {
|
||||
// Implement the write function call for your terminal here.
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
You can pass this terminal object to `ESPLoader` constructor as shown in the [examples projects](./examples/).
|
||||
|
||||
## Live demo
|
||||
|
||||
Visit https://espressif.github.io/esptool-js/ to see this tool in action.
|
||||
|
||||
## Testing it locally
|
||||
|
||||
```sh
|
||||
npm install
|
||||
npm run build
|
||||
cd examples/typescript
|
||||
npm install
|
||||
npm run dev # Run local sever with example code
|
||||
```
|
||||
|
||||
Then open `http://localhost:1234` in a Chrome browser. The `npm run build` step builds the `lib` used in the example `examples/typescript/index.html`. Update this reference as described in [Usage](#usage) section.
|
||||
|
||||
## Test from Pull Request artifact
|
||||
|
||||
If you are testing the main branch or any Pull Request (PR) artifact you can follow these steps:
|
||||
|
||||
1. Get the `esptool-js-<version>.tgz` where `<version>` is the current version and download it.
|
||||
2. Add the following line to your project's package.json dependencies
|
||||
|
||||
```json
|
||||
"dependencies": {
|
||||
"esptool-js": "file:../path/to/esptool-js-<version>.tgz"
|
||||
}
|
||||
```
|
||||
3. Use the package like `import "esptool-js/lib/index.js"` when added in package.json as shown before.
|
||||
|
||||
## License
|
||||
|
||||
The code in this repository is Copyright (c) 2023 Espressif Systems (Shanghai) Co. Ltd. It is licensed under Apache 2.0 license, as described in [LICENSE](https://github.com/espressif/esptool-js/blob/main/LICENSE) file.
|
2
node_modules/esptool-js/bundle.js
generated
vendored
Normal file
2
node_modules/esptool-js/bundle.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
400
node_modules/esptool-js/lib/esploader.d.ts
generated
vendored
Normal file
400
node_modules/esptool-js/lib/esploader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,400 @@
|
||||
import { Transport } from "./webserial.js";
|
||||
import { ROM } from "./targets/rom.js";
|
||||
import { ResetStrategy } from "./reset.js";
|
||||
import { LoaderOptions } from "./types/loaderOptions.js";
|
||||
import { FlashOptions } from "./types/flashOptions.js";
|
||||
import { After, Before } from "./types/resetModes.js";
|
||||
declare type FlashReadCallback = ((packet: Uint8Array, progress: number, totalSize: number) => void) | null;
|
||||
export declare class ESPLoader {
|
||||
ESP_RAM_BLOCK: number;
|
||||
ESP_FLASH_BEGIN: number;
|
||||
ESP_FLASH_DATA: number;
|
||||
ESP_FLASH_END: number;
|
||||
ESP_MEM_BEGIN: number;
|
||||
ESP_MEM_END: number;
|
||||
ESP_MEM_DATA: number;
|
||||
ESP_WRITE_REG: number;
|
||||
ESP_READ_REG: number;
|
||||
ESP_SPI_ATTACH: number;
|
||||
ESP_CHANGE_BAUDRATE: number;
|
||||
ESP_FLASH_DEFL_BEGIN: number;
|
||||
ESP_FLASH_DEFL_DATA: number;
|
||||
ESP_FLASH_DEFL_END: number;
|
||||
ESP_SPI_FLASH_MD5: number;
|
||||
ESP_ERASE_FLASH: number;
|
||||
ESP_ERASE_REGION: number;
|
||||
ESP_READ_FLASH: number;
|
||||
ESP_RUN_USER_CODE: number;
|
||||
ESP_IMAGE_MAGIC: number;
|
||||
ESP_CHECKSUM_MAGIC: number;
|
||||
ROM_INVALID_RECV_MSG: number;
|
||||
DEFAULT_TIMEOUT: number;
|
||||
ERASE_REGION_TIMEOUT_PER_MB: number;
|
||||
ERASE_WRITE_TIMEOUT_PER_MB: number;
|
||||
MD5_TIMEOUT_PER_MB: number;
|
||||
CHIP_ERASE_TIMEOUT: number;
|
||||
FLASH_READ_TIMEOUT: number;
|
||||
MAX_TIMEOUT: number;
|
||||
CHIP_DETECT_MAGIC_REG_ADDR: number;
|
||||
DETECTED_FLASH_SIZES: {
|
||||
[key: number]: string;
|
||||
};
|
||||
DETECTED_FLASH_SIZES_NUM: {
|
||||
[key: number]: number;
|
||||
};
|
||||
USB_JTAG_SERIAL_PID: number;
|
||||
chip: ROM;
|
||||
IS_STUB: boolean;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
transport: Transport;
|
||||
private baudrate;
|
||||
private serialOptions?;
|
||||
private terminal?;
|
||||
private romBaudrate;
|
||||
private debugLogging;
|
||||
private syncStubDetected;
|
||||
private resetConstructors;
|
||||
/**
|
||||
* Create a new ESPLoader to perform serial communication
|
||||
* such as read/write flash memory and registers using a LoaderOptions object.
|
||||
* @param {LoaderOptions} options - LoaderOptions object argument for ESPLoader.
|
||||
* ```
|
||||
* const myLoader = new ESPLoader({ transport: Transport, baudrate: number, terminal?: IEspLoaderTerminal });
|
||||
* ```
|
||||
*/
|
||||
constructor(options: LoaderOptions);
|
||||
_sleep(ms: number): Promise<unknown>;
|
||||
/**
|
||||
* Write to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
write(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Write error message to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
error(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Write information message to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
info(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Write debug message to ESP Loader constructor's terminal with or without new line.
|
||||
* @param {string} str - String to write.
|
||||
* @param {boolean} withNewline - Add new line at the end ?
|
||||
*/
|
||||
debug(str: string, withNewline?: boolean): void;
|
||||
/**
|
||||
* Convert short integer to byte array
|
||||
* @param {number} i - Number to convert.
|
||||
* @returns {Uint8Array} Byte array.
|
||||
*/
|
||||
_shortToBytearray(i: number): Uint8Array;
|
||||
/**
|
||||
* Convert an integer to byte array
|
||||
* @param {number} i - Number to convert.
|
||||
* @returns {ROM} The chip ROM class related to given magic hex number.
|
||||
*/
|
||||
_intToByteArray(i: number): Uint8Array;
|
||||
/**
|
||||
* Convert a byte array to short integer.
|
||||
* @param {number} i - Number to convert.
|
||||
* @param {number} j - Number to convert.
|
||||
* @returns {number} Return a short integer number.
|
||||
*/
|
||||
_byteArrayToShort(i: number, j: number): number;
|
||||
/**
|
||||
* Convert a byte array to integer.
|
||||
* @param {number} i - Number to convert.
|
||||
* @param {number} j - Number to convert.
|
||||
* @param {number} k - Number to convert.
|
||||
* @param {number} l - Number to convert.
|
||||
* @returns {number} Return a integer number.
|
||||
*/
|
||||
_byteArrayToInt(i: number, j: number, k: number, l: number): number;
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {ArrayBuffer} buffer1 - First array buffer.
|
||||
* @param {ArrayBuffer} buffer2 - magic hex number to select ROM.
|
||||
* @returns {ArrayBufferLike} Return an array buffer.
|
||||
*/
|
||||
_appendBuffer(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBufferLike;
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {Uint8Array} arr1 - First array buffer.
|
||||
* @param {Uint8Array} arr2 - magic hex number to select ROM.
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned array.
|
||||
*/
|
||||
_appendArray(arr1: Uint8Array, arr2: Uint8Array): Uint8Array;
|
||||
/**
|
||||
* Convert a unsigned 8 bit integer array to byte string.
|
||||
* @param {Uint8Array} u8Array - magic hex number to select ROM.
|
||||
* @returns {string} Return the equivalent string.
|
||||
*/
|
||||
ui8ToBstr(u8Array: Uint8Array): string;
|
||||
/**
|
||||
* Convert a byte string to unsigned 8 bit integer array.
|
||||
* @param {string} bStr - binary string input
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned integer array.
|
||||
*/
|
||||
bstrToUi8(bStr: string): Uint8Array;
|
||||
/**
|
||||
* Flush the serial input by raw read with 200 ms timeout.
|
||||
*/
|
||||
flushInput(): Promise<void>;
|
||||
/**
|
||||
* Use the device serial port read function with given timeout to create a valid packet.
|
||||
* @param {number} op Operation number
|
||||
* @param {number} timeout timeout number in milliseconds
|
||||
* @returns {[number, Uint8Array]} valid response packet.
|
||||
*/
|
||||
readPacket(op?: number | null, timeout?: number): Promise<[number, Uint8Array]>;
|
||||
/**
|
||||
* Write a serial command to the chip
|
||||
* @param {number} op - Operation number
|
||||
* @param {Uint8Array} data - Unsigned 8 bit array
|
||||
* @param {number} chk - channel number
|
||||
* @param {boolean} waitResponse - wait for response ?
|
||||
* @param {number} timeout - timeout number in milliseconds
|
||||
* @returns {Promise<[number, Uint8Array]>} Return a number and a 8 bit unsigned integer array.
|
||||
*/
|
||||
command(op?: number | null, data?: Uint8Array, chk?: number, waitResponse?: boolean, timeout?: number): Promise<[number, Uint8Array]>;
|
||||
/**
|
||||
* Read a register from chip.
|
||||
* @param {number} addr - Register address number
|
||||
* @param {number} timeout - Timeout in milliseconds (Default: 3000ms)
|
||||
* @returns {number} - Command number value
|
||||
*/
|
||||
readReg(addr: number, timeout?: number): Promise<number>;
|
||||
/**
|
||||
* Write a number value to register address in chip.
|
||||
* @param {number} addr - Register address number
|
||||
* @param {number} value - Number value to write in register
|
||||
* @param {number} mask - Hex number for mask
|
||||
* @param {number} delayUs Delay number
|
||||
* @param {number} delayAfterUs Delay after previous delay
|
||||
*/
|
||||
writeReg(addr: number, value: number, mask?: number, delayUs?: number, delayAfterUs?: number): Promise<void>;
|
||||
/**
|
||||
* Sync chip by sending sync command.
|
||||
* @returns {[number, Uint8Array]} Command result
|
||||
*/
|
||||
sync(): Promise<[number, Uint8Array]>;
|
||||
/**
|
||||
* Attempt to connect to the chip by sending a reset sequence and later a sync command.
|
||||
* @param {string} mode - Reset mode to use
|
||||
* @param {ResetStrategy} resetStrategy - Reset strategy class to use for connect
|
||||
* @returns {string} - Returns 'success' or 'error' message.
|
||||
*/
|
||||
_connectAttempt(mode: string | undefined, resetStrategy: ResetStrategy | null): Promise<string>;
|
||||
/**
|
||||
* Constructs a sequence of reset strategies based on the OS,
|
||||
* used ESP chip, external settings, and environment variables.
|
||||
* Returns a tuple of one or more reset strategies to be tried sequentially.
|
||||
* @param {string} mode - Reset mode to use
|
||||
* @returns {ResetStrategy[]} - Array of reset strategies
|
||||
*/
|
||||
constructResetSequence(mode: Before): ResetStrategy[];
|
||||
/**
|
||||
* Perform a connection to chip.
|
||||
* @param {string} mode - Reset mode to use. Example: 'default_reset' | 'no_reset'
|
||||
* @param {number} attempts - Number of connection attempts
|
||||
* @param {boolean} detecting - Detect the connected chip
|
||||
*/
|
||||
connect(mode?: Before, attempts?: number, detecting?: boolean): Promise<void>;
|
||||
/**
|
||||
* Connect and detect the existing chip.
|
||||
* @param {string} mode Reset mode to use for connection.
|
||||
*/
|
||||
detectChip(mode?: Before): Promise<void>;
|
||||
/**
|
||||
* Execute the command and check the command response.
|
||||
* @param {string} opDescription Command operation description.
|
||||
* @param {number} op Command operation number
|
||||
* @param {Uint8Array} data Command value
|
||||
* @param {number} chk Checksum to use
|
||||
* @param {number} timeout TImeout number in milliseconds (ms)
|
||||
* @returns {number} Command result
|
||||
*/
|
||||
checkCommand(opDescription?: string, op?: number | null, data?: Uint8Array, chk?: number, timeout?: number): Promise<number | Uint8Array>;
|
||||
/**
|
||||
* Start downloading an application image to RAM
|
||||
* @param {number} size Image size number
|
||||
* @param {number} blocks Number of data blocks
|
||||
* @param {number} blocksize Size of each data block
|
||||
* @param {number} offset Image offset number
|
||||
*/
|
||||
memBegin(size: number, blocks: number, blocksize: number, offset: number): Promise<void>;
|
||||
/**
|
||||
* Get the checksum for given unsigned 8-bit array
|
||||
* @param {Uint8Array} data Unsigned 8-bit integer array
|
||||
* @param {number} state Initial checksum
|
||||
* @returns {number} - Array checksum
|
||||
*/
|
||||
checksum(data: Uint8Array, state?: number): number;
|
||||
/**
|
||||
* Send a block of image to RAM
|
||||
* @param {Uint8Array} buffer Unsigned 8-bit array
|
||||
* @param {number} seq Sequence number
|
||||
*/
|
||||
memBlock(buffer: Uint8Array, seq: number): Promise<void>;
|
||||
/**
|
||||
* Leave RAM download mode and run application
|
||||
* @param {number} entrypoint - Entrypoint number
|
||||
*/
|
||||
memFinish(entrypoint: number): Promise<void>;
|
||||
/**
|
||||
* Configure SPI flash pins
|
||||
* @param {number} hspiArg - Argument for SPI attachment
|
||||
*/
|
||||
flashSpiAttach(hspiArg: number): Promise<void>;
|
||||
/**
|
||||
* Scale timeouts which are size-specific.
|
||||
* @param {number} secondsPerMb Seconds per megabytes as number
|
||||
* @param {number} sizeBytes Size bytes number
|
||||
* @returns {number} - Scaled timeout for specified size.
|
||||
*/
|
||||
timeoutPerMb(secondsPerMb: number, sizeBytes: number): number;
|
||||
/**
|
||||
* Start downloading to Flash (performs an erase)
|
||||
* @param {number} size Size to erase
|
||||
* @param {number} offset Offset to erase
|
||||
* @returns {number} Number of blocks (of size self.FLASH_WRITE_SIZE) to write.
|
||||
*/
|
||||
flashBegin(size: number, offset: number): Promise<number>;
|
||||
/**
|
||||
* Start downloading compressed data to Flash (performs an erase)
|
||||
* @param {number} size Write size
|
||||
* @param {number} compsize Compressed size
|
||||
* @param {number} offset Offset for write
|
||||
* @returns {number} Returns number of blocks (size self.FLASH_WRITE_SIZE) to write.
|
||||
*/
|
||||
flashDeflBegin(size: number, compsize: number, offset: number): Promise<number>;
|
||||
/**
|
||||
* Write block to flash, retry if fail
|
||||
* @param {Uint8Array} data Unsigned 8-bit array data.
|
||||
* @param {number} seq Sequence number
|
||||
* @param {number} timeout Timeout in milliseconds (ms)
|
||||
*/
|
||||
flashBlock(data: Uint8Array, seq: number, timeout: number): Promise<void>;
|
||||
/**
|
||||
* Write block to flash, send compressed, retry if fail
|
||||
* @param {Uint8Array} data Unsigned int 8-bit array data to write
|
||||
* @param {number} seq Sequence number
|
||||
* @param {number} timeout Timeout in milliseconds (ms)
|
||||
*/
|
||||
flashDeflBlock(data: Uint8Array, seq: number, timeout: number): Promise<void>;
|
||||
/**
|
||||
* Leave flash mode and run/reboot
|
||||
* @param {boolean} reboot Reboot after leaving flash mode ?
|
||||
*/
|
||||
flashFinish(reboot?: boolean): Promise<void>;
|
||||
/**
|
||||
* Leave compressed flash mode and run/reboot
|
||||
* @param {boolean} reboot Reboot after leaving flash mode ?
|
||||
*/
|
||||
flashDeflFinish(reboot?: boolean): Promise<void>;
|
||||
/**
|
||||
* Run an arbitrary SPI flash command.
|
||||
*
|
||||
* This function uses the "USR_COMMAND" functionality in the ESP
|
||||
* SPI hardware, rather than the precanned commands supported by
|
||||
* hardware. So the value of spiflashCommand is an actual command
|
||||
* byte, sent over the wire.
|
||||
*
|
||||
* After writing command byte, writes 'data' to MOSI and then
|
||||
* reads back 'readBits' of reply on MISO. Result is a number.
|
||||
* @param {number} spiflashCommand Command to execute in SPI
|
||||
* @param {Uint8Array} data Data to send
|
||||
* @param {number} readBits Number of bits to read
|
||||
* @returns {number} Register SPI_W0_REG value
|
||||
*/
|
||||
runSpiflashCommand(spiflashCommand: number, data: Uint8Array, readBits: number): Promise<number>;
|
||||
/**
|
||||
* Read flash id by executing the SPIFLASH_RDID flash command.
|
||||
* @returns {Promise<number>} Register SPI_W0_REG value
|
||||
*/
|
||||
readFlashId(): Promise<number>;
|
||||
/**
|
||||
* Execute the erase flash command
|
||||
* @returns {Promise<number | Uint8Array>} Erase flash command result
|
||||
*/
|
||||
eraseFlash(): Promise<number | Uint8Array>;
|
||||
/**
|
||||
* Convert a number or unsigned 8-bit array to hex string
|
||||
* @param {number | Uint8Array } buffer Data to convert to hex string.
|
||||
* @returns {string} A hex string
|
||||
*/
|
||||
toHex(buffer: number | Uint8Array): string;
|
||||
/**
|
||||
* Calculate the MD5 Checksum command
|
||||
* @param {number} addr Address number
|
||||
* @param {number} size Package size
|
||||
* @returns {string} MD5 Checksum string
|
||||
*/
|
||||
flashMd5sum(addr: number, size: number): Promise<string>;
|
||||
readFlash(addr: number, size: number, onPacketReceived?: FlashReadCallback): Promise<Uint8Array>;
|
||||
/**
|
||||
* Upload the flasher ROM bootloader (flasher stub) to the chip.
|
||||
* @returns {ROM} The Chip ROM
|
||||
*/
|
||||
runStub(): Promise<ROM>;
|
||||
/**
|
||||
* Change the chip baudrate.
|
||||
*/
|
||||
changeBaud(): Promise<void>;
|
||||
/**
|
||||
* Execute the main function of ESPLoader.
|
||||
* @param {string} mode Reset mode to use
|
||||
* @returns {string} chip ROM
|
||||
*/
|
||||
main(mode?: Before): Promise<string>;
|
||||
/**
|
||||
* Get flash size bytes from flash size string.
|
||||
* @param {string} flashSize Flash Size string
|
||||
* @returns {number} Flash size bytes
|
||||
*/
|
||||
flashSizeBytes: (flashSize: string) => number;
|
||||
/**
|
||||
* Parse a given flash size string to a number
|
||||
* @param {string} flsz Flash size to request
|
||||
* @returns {number} Flash size number
|
||||
*/
|
||||
parseFlashSizeArg(flsz: string): number;
|
||||
/**
|
||||
* Update the image flash parameters with given arguments.
|
||||
* @param {string} image binary image as string
|
||||
* @param {number} address flash address number
|
||||
* @param {string} flashSize Flash size string
|
||||
* @param {string} flashMode Flash mode string
|
||||
* @param {string} flashFreq Flash frequency string
|
||||
* @returns {string} modified image string
|
||||
*/
|
||||
_updateImageFlashParams(image: string, address: number, flashSize: string, flashMode: string, flashFreq: string): string;
|
||||
/**
|
||||
* Write set of file images into given address based on given FlashOptions object.
|
||||
* @param {FlashOptions} options FlashOptions to configure how and what to write into flash.
|
||||
*/
|
||||
writeFlash(options: FlashOptions): Promise<void>;
|
||||
/**
|
||||
* Read SPI flash manufacturer and device id.
|
||||
*/
|
||||
flashId(): Promise<void>;
|
||||
getFlashSize(): Promise<number>;
|
||||
/**
|
||||
* Soft reset the device chip. Soft reset with run user code is the closest.
|
||||
* @param {boolean} stayInBootloader Flag to indicate if to stay in bootloader
|
||||
*/
|
||||
softReset(stayInBootloader: boolean): Promise<void>;
|
||||
/**
|
||||
* Execute this function to execute after operation reset functions.
|
||||
* @param {After} mode After operation mode. Default is 'hard_reset'.
|
||||
* @param { boolean } usingUsbOtg For 'hard_reset' to specify if using USB-OTG
|
||||
*/
|
||||
after(mode?: After, usingUsbOtg?: boolean): Promise<void>;
|
||||
}
|
||||
export {};
|
1359
node_modules/esptool-js/lib/esploader.js
generated
vendored
Normal file
1359
node_modules/esptool-js/lib/esploader.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
node_modules/esptool-js/lib/index.d.ts
generated
vendored
Normal file
9
node_modules/esptool-js/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export { ESPLoader } from "./esploader.js";
|
||||
export { ClassicReset, CustomReset, HardReset, UsbJtagSerialReset, validateCustomResetStringSequence, ResetConstructors, } from "./reset.js";
|
||||
export { ROM } from "./targets/rom.js";
|
||||
export { Transport, SerialOptions } from "./webserial.js";
|
||||
export { decodeBase64Data, getStubJsonByChipName, Stub } from "./stubFlasher.js";
|
||||
export { LoaderOptions } from "./types/loaderOptions.js";
|
||||
export { FlashOptions } from "./types/flashOptions.js";
|
||||
export { IEspLoaderTerminal } from "./types/loaderTerminal.js";
|
||||
export { Before, After } from "./types/resetModes.js";
|
5
node_modules/esptool-js/lib/index.js
generated
vendored
Normal file
5
node_modules/esptool-js/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { ESPLoader } from "./esploader.js";
|
||||
export { ClassicReset, CustomReset, HardReset, UsbJtagSerialReset, validateCustomResetStringSequence, } from "./reset.js";
|
||||
export { ROM } from "./targets/rom.js";
|
||||
export { Transport } from "./webserial.js";
|
||||
export { decodeBase64Data, getStubJsonByChipName } from "./stubFlasher.js";
|
149
node_modules/esptool-js/lib/reset.d.ts
generated
vendored
Normal file
149
node_modules/esptool-js/lib/reset.d.ts
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
import { Transport } from "./webserial.js";
|
||||
/**
|
||||
* Set of reset functions for ESP Loader connection.
|
||||
* @interface ResetConstructors
|
||||
*/
|
||||
export interface ResetConstructors {
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
* @param resetDelay Delay in milliseconds for reset.
|
||||
*/
|
||||
classicReset?: (transport: Transport, resetDelay: number) => ClassicReset;
|
||||
/**
|
||||
* Execute a set of commands for USB JTAG serial reset.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
*/
|
||||
usbJTAGSerialReset?: (transport: Transport) => UsbJtagSerialReset;
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
* @param {boolean} usingUsbOtg is it using USB-OTG ?
|
||||
*/
|
||||
hardReset?: (transport: Transport, usingUsbOtg?: boolean) => HardReset;
|
||||
/**
|
||||
* Execute a custom set of commands that will reset the chip.
|
||||
* @param transport Transport class to perform serial communication.
|
||||
* @param {string} sequenceString Custom string sequence for reset strategy
|
||||
*/
|
||||
customReset?: (transport: Transport, sequenceString: string) => CustomReset;
|
||||
}
|
||||
/**
|
||||
* Reset strategy class
|
||||
*/
|
||||
export interface ResetStrategy {
|
||||
transport: Transport;
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {number} resetDelay Delay in milliseconds for reset.
|
||||
*/
|
||||
export declare class ClassicReset implements ResetStrategy {
|
||||
resetDelay: number;
|
||||
transport: Transport;
|
||||
constructor(transport: Transport, resetDelay: number);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands for USB JTAG serial reset.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
*/
|
||||
export declare class UsbJtagSerialReset implements ResetStrategy {
|
||||
transport: Transport;
|
||||
constructor(transport: Transport);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands that will hard reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {boolean} usingUsbOtg is it using USB-OTG ?
|
||||
*/
|
||||
export declare class HardReset implements ResetStrategy {
|
||||
transport: Transport;
|
||||
private usingUsbOtg;
|
||||
constructor(transport: Transport, usingUsbOtg?: boolean);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Validate a sequence string based on the following format:
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {string} seqStr Sequence string to validate
|
||||
* @returns {boolean} Is the sequence string valid ?
|
||||
*/
|
||||
export declare function validateCustomResetStringSequence(seqStr: string): boolean;
|
||||
/**
|
||||
* Custom reset strategy defined with a string.
|
||||
*
|
||||
* The sequenceString input string consists of individual commands divided by "|".
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {string} sequenceString Custom string sequence for reset strategy
|
||||
*/
|
||||
export declare class CustomReset implements ResetStrategy {
|
||||
transport: Transport;
|
||||
private sequenceString;
|
||||
constructor(transport: Transport, sequenceString: string);
|
||||
reset(): Promise<void>;
|
||||
}
|
||||
declare const _default: {
|
||||
ClassicReset: typeof ClassicReset;
|
||||
CustomReset: typeof CustomReset;
|
||||
HardReset: typeof HardReset;
|
||||
UsbJtagSerialReset: typeof UsbJtagSerialReset;
|
||||
validateCustomResetStringSequence: typeof validateCustomResetStringSequence;
|
||||
};
|
||||
export default _default;
|
198
node_modules/esptool-js/lib/reset.js
generated
vendored
Normal file
198
node_modules/esptool-js/lib/reset.js
generated
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* Sleep for ms milliseconds
|
||||
* @param {number} ms Milliseconds to wait
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
/**
|
||||
* Execute a classic set of commands that will reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {number} resetDelay Delay in milliseconds for reset.
|
||||
*/
|
||||
export class ClassicReset {
|
||||
constructor(transport, resetDelay) {
|
||||
this.resetDelay = resetDelay;
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
await this.transport.setDTR(false);
|
||||
await this.transport.setRTS(true);
|
||||
await sleep(100);
|
||||
await this.transport.setDTR(true);
|
||||
await this.transport.setRTS(false);
|
||||
await sleep(this.resetDelay);
|
||||
await this.transport.setDTR(false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands for USB JTAG serial reset.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
*/
|
||||
export class UsbJtagSerialReset {
|
||||
constructor(transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
await this.transport.setRTS(false);
|
||||
await this.transport.setDTR(false);
|
||||
await sleep(100);
|
||||
await this.transport.setDTR(true);
|
||||
await this.transport.setRTS(false);
|
||||
await sleep(100);
|
||||
await this.transport.setRTS(true);
|
||||
await this.transport.setDTR(false);
|
||||
await this.transport.setRTS(true);
|
||||
await sleep(100);
|
||||
await this.transport.setRTS(false);
|
||||
await this.transport.setDTR(false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute a set of commands that will hard reset the chip.
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {boolean} usingUsbOtg is it using USB-OTG ?
|
||||
*/
|
||||
export class HardReset {
|
||||
constructor(transport, usingUsbOtg = false) {
|
||||
this.transport = transport;
|
||||
this.usingUsbOtg = usingUsbOtg;
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
if (this.usingUsbOtg) {
|
||||
await sleep(200);
|
||||
await this.transport.setRTS(false);
|
||||
await sleep(200);
|
||||
}
|
||||
else {
|
||||
await sleep(100);
|
||||
await this.transport.setRTS(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Validate a sequence string based on the following format:
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
* @param {string} seqStr Sequence string to validate
|
||||
* @returns {boolean} Is the sequence string valid ?
|
||||
*/
|
||||
export function validateCustomResetStringSequence(seqStr) {
|
||||
const commands = ["D", "R", "W"];
|
||||
const commandsList = seqStr.split("|");
|
||||
for (const cmd of commandsList) {
|
||||
const code = cmd[0];
|
||||
const arg = cmd.slice(1);
|
||||
if (!commands.includes(code)) {
|
||||
return false; // Invalid command code
|
||||
}
|
||||
if (code === "D" || code === "R") {
|
||||
if (arg !== "0" && arg !== "1") {
|
||||
return false; // Invalid argument for D and R commands
|
||||
}
|
||||
}
|
||||
else if (code === "W") {
|
||||
const delay = parseInt(arg);
|
||||
if (isNaN(delay) || delay <= 0) {
|
||||
return false; // Invalid argument for W command
|
||||
}
|
||||
}
|
||||
}
|
||||
return true; // All commands are valid
|
||||
}
|
||||
/**
|
||||
* Custom reset strategy defined with a string.
|
||||
*
|
||||
* The sequenceString input string consists of individual commands divided by "|".
|
||||
*
|
||||
* Commands (e.g. R0) are defined by a code (R) and an argument (0).
|
||||
*
|
||||
* The commands are:
|
||||
*
|
||||
* D: setDTR - 1=True / 0=False
|
||||
*
|
||||
* R: setRTS - 1=True / 0=False
|
||||
*
|
||||
* W: Wait (time delay) - positive integer number (miliseconds)
|
||||
*
|
||||
* "D0|R1|W100|D1|R0|W50|D0" represents the classic reset strategy
|
||||
* @param {Transport} transport Transport class to perform serial communication.
|
||||
* @param {string} sequenceString Custom string sequence for reset strategy
|
||||
*/
|
||||
export class CustomReset {
|
||||
constructor(transport, sequenceString) {
|
||||
this.transport = transport;
|
||||
this.sequenceString = sequenceString;
|
||||
this.transport = transport;
|
||||
}
|
||||
async reset() {
|
||||
const resetDictionary = {
|
||||
D: async (arg) => await this.transport.setDTR(arg),
|
||||
R: async (arg) => await this.transport.setRTS(arg),
|
||||
W: async (delay) => await sleep(delay),
|
||||
};
|
||||
try {
|
||||
const isValidSequence = validateCustomResetStringSequence(this.sequenceString);
|
||||
if (!isValidSequence) {
|
||||
return;
|
||||
}
|
||||
const cmds = this.sequenceString.split("|");
|
||||
for (const cmd of cmds) {
|
||||
const cmdKey = cmd[0];
|
||||
const cmdVal = cmd.slice(1);
|
||||
if (cmdKey === "W") {
|
||||
await resetDictionary["W"](Number(cmdVal));
|
||||
}
|
||||
else if (cmdKey === "D" || cmdKey === "R") {
|
||||
await resetDictionary[cmdKey](cmdVal === "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error("Invalid custom reset sequence");
|
||||
}
|
||||
}
|
||||
}
|
||||
export default { ClassicReset, CustomReset, HardReset, UsbJtagSerialReset, validateCustomResetStringSequence };
|
22
node_modules/esptool-js/lib/stubFlasher.d.ts
generated
vendored
Normal file
22
node_modules/esptool-js/lib/stubFlasher.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface Stub {
|
||||
bss_start?: number;
|
||||
data: string;
|
||||
decodedData: Uint8Array;
|
||||
data_start: number;
|
||||
entry: number;
|
||||
text: string;
|
||||
decodedText: Uint8Array;
|
||||
text_start: number;
|
||||
}
|
||||
/**
|
||||
* Import flash stub json for the given chip name.
|
||||
* @param {string} chipName Name of chip to obtain flasher stub
|
||||
* @returns {Stub} Stub information and decoded text and data
|
||||
*/
|
||||
export declare function getStubJsonByChipName(chipName: string): Promise<Stub | undefined>;
|
||||
/**
|
||||
* Convert a base 64 string to Uint8Array.
|
||||
* @param {string} dataStr Base64 String to decode
|
||||
* @returns {Uint8Array} Decoded Uint8Array
|
||||
*/
|
||||
export declare function decodeBase64Data(dataStr: string): Uint8Array;
|
69
node_modules/esptool-js/lib/stubFlasher.js
generated
vendored
Normal file
69
node_modules/esptool-js/lib/stubFlasher.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import atob from "atob-lite";
|
||||
/**
|
||||
* Import flash stub json for the given chip name.
|
||||
* @param {string} chipName Name of chip to obtain flasher stub
|
||||
* @returns {Stub} Stub information and decoded text and data
|
||||
*/
|
||||
export async function getStubJsonByChipName(chipName) {
|
||||
let jsonStub;
|
||||
switch (chipName) {
|
||||
case "ESP32":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32.json");
|
||||
break;
|
||||
case "ESP32-C2":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c2.json");
|
||||
break;
|
||||
case "ESP32-C3":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c3.json");
|
||||
break;
|
||||
case "ESP32-C5":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c5.json");
|
||||
break;
|
||||
case "ESP32-C6":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c6.json");
|
||||
break;
|
||||
case "ESP32-C61":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32c61.json");
|
||||
break;
|
||||
case "ESP32-H2":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32h2.json");
|
||||
break;
|
||||
case "ESP32-P4":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32p4.json");
|
||||
break;
|
||||
case "ESP32-S2":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32s2.json");
|
||||
break;
|
||||
case "ESP32-S3":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_32s3.json");
|
||||
break;
|
||||
case "ESP8266":
|
||||
jsonStub = await import("./targets/stub_flasher/stub_flasher_8266.json");
|
||||
break;
|
||||
}
|
||||
if (jsonStub) {
|
||||
return {
|
||||
bss_start: jsonStub.bss_start,
|
||||
data: jsonStub.data,
|
||||
data_start: jsonStub.data_start,
|
||||
entry: jsonStub.entry,
|
||||
text: jsonStub.text,
|
||||
text_start: jsonStub.text_start,
|
||||
decodedData: decodeBase64Data(jsonStub.data),
|
||||
decodedText: decodeBase64Data(jsonStub.text),
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Convert a base 64 string to Uint8Array.
|
||||
* @param {string} dataStr Base64 String to decode
|
||||
* @returns {Uint8Array} Decoded Uint8Array
|
||||
*/
|
||||
export function decodeBase64Data(dataStr) {
|
||||
const decoded = atob(dataStr);
|
||||
const chardata = decoded.split("").map(function (x) {
|
||||
return x.charCodeAt(0);
|
||||
});
|
||||
return new Uint8Array(chardata);
|
||||
}
|
32
node_modules/esptool-js/lib/targets/esp32.d.ts
generated
vendored
Normal file
32
node_modules/esptool-js/lib/targets/esp32.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
DR_REG_SYSCON_BASE: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
FLASH_SIZES: {
|
||||
[key: string]: number;
|
||||
};
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
readEfuse(loader: ESPLoader, offset: number): Promise<number>;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
}
|
185
node_modules/esptool-js/lib/targets/esp32.js
generated
vendored
Normal file
185
node_modules/esptool-js/lib/targets/esp32.js
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32";
|
||||
this.IMAGE_CHIP_ID = 0;
|
||||
this.EFUSE_RD_REG_BASE = 0x3ff5a000;
|
||||
this.DR_REG_SYSCON_BASE = 0x3ff66000;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x60000078;
|
||||
this.XTAL_CLK_DIVIDER = 1;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x1000;
|
||||
this.SPI_REG_BASE = 0x3ff42000;
|
||||
this.SPI_USR_OFFS = 0x1c;
|
||||
this.SPI_USR1_OFFS = 0x20;
|
||||
this.SPI_USR2_OFFS = 0x24;
|
||||
this.SPI_W0_OFFS = 0x80;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x28;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x2c;
|
||||
}
|
||||
async readEfuse(loader, offset) {
|
||||
const addr = this.EFUSE_RD_REG_BASE + 4 * offset;
|
||||
loader.debug("Read efuse " + addr);
|
||||
return await loader.readReg(addr);
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const word3 = await this.readEfuse(loader, 3);
|
||||
let pkgVersion = (word3 >> 9) & 0x07;
|
||||
pkgVersion += ((word3 >> 2) & 0x1) << 3;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const word3 = await this.readEfuse(loader, 3);
|
||||
const word5 = await this.readEfuse(loader, 5);
|
||||
const apbCtlDate = await loader.readReg(this.DR_REG_SYSCON_BASE + 0x7c);
|
||||
const revBit0 = (word3 >> 15) & 0x1;
|
||||
const revBit1 = (word5 >> 20) & 0x1;
|
||||
const revBit2 = (apbCtlDate >> 31) & 0x1;
|
||||
if (revBit0 != 0) {
|
||||
if (revBit1 != 0) {
|
||||
if (revBit2 != 0) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const chipDesc = [
|
||||
"ESP32-D0WDQ6",
|
||||
"ESP32-D0WD",
|
||||
"ESP32-D2WD",
|
||||
"",
|
||||
"ESP32-U4WDH",
|
||||
"ESP32-PICO-D4",
|
||||
"ESP32-PICO-V3-02",
|
||||
];
|
||||
let chipName = "";
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
const chipRevision = await this.getChipRevision(loader);
|
||||
const rev3 = chipRevision == 3;
|
||||
const single_core = (await this.readEfuse(loader, 3)) & (1 << 0);
|
||||
if (single_core != 0) {
|
||||
chipDesc[0] = "ESP32-S0WDQ6";
|
||||
chipDesc[1] = "ESP32-S0WD";
|
||||
}
|
||||
if (rev3) {
|
||||
chipDesc[5] = "ESP32-PICO-V3";
|
||||
}
|
||||
if (pkgVersion >= 0 && pkgVersion <= 6) {
|
||||
chipName = chipDesc[pkgVersion];
|
||||
}
|
||||
else {
|
||||
chipName = "Unknown ESP32";
|
||||
}
|
||||
if (rev3 && (pkgVersion === 0 || pkgVersion === 1)) {
|
||||
chipName += "-V3";
|
||||
}
|
||||
return chipName + " (revision " + chipRevision + ")";
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi"];
|
||||
const word3 = await this.readEfuse(loader, 3);
|
||||
const chipVerDisBt = word3 & (1 << 1);
|
||||
if (chipVerDisBt === 0) {
|
||||
features.push(" BT");
|
||||
}
|
||||
const chipVerDisAppCpu = word3 & (1 << 0);
|
||||
if (chipVerDisAppCpu !== 0) {
|
||||
features.push(" Single Core");
|
||||
}
|
||||
else {
|
||||
features.push(" Dual Core");
|
||||
}
|
||||
const chipCpuFreqRated = word3 & (1 << 13);
|
||||
if (chipCpuFreqRated !== 0) {
|
||||
const chipCpuFreqLow = word3 & (1 << 12);
|
||||
if (chipCpuFreqLow !== 0) {
|
||||
features.push(" 160MHz");
|
||||
}
|
||||
else {
|
||||
features.push(" 240MHz");
|
||||
}
|
||||
}
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
if ([2, 4, 5, 6].indexOf(pkgVersion) !== -1) {
|
||||
features.push(" Embedded Flash");
|
||||
}
|
||||
if (pkgVersion === 6) {
|
||||
features.push(" Embedded PSRAM");
|
||||
}
|
||||
const word4 = await this.readEfuse(loader, 4);
|
||||
const adcVref = (word4 >> 8) & 0x1f;
|
||||
if (adcVref !== 0) {
|
||||
features.push(" VRef calibration in efuse");
|
||||
}
|
||||
const blk3PartRes = (word3 >> 14) & 0x1;
|
||||
if (blk3PartRes !== 0) {
|
||||
features.push(" BLK3 partially reserved");
|
||||
}
|
||||
const word6 = await this.readEfuse(loader, 6);
|
||||
const codingScheme = word6 & 0x3;
|
||||
const codingSchemeArr = ["None", "3/4", "Repeat (UNSUPPORTED)", "Invalid"];
|
||||
features.push(" Coding Scheme " + codingSchemeArr[codingScheme]);
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Unsupported crystal in use");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await this.readEfuse(loader, 1);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await this.readEfuse(loader, 2);
|
||||
mac1 = mac1 >>> 0;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
}
|
37
node_modules/esptool-js/lib/targets/esp32c2.d.ts
generated
vendored
Normal file
37
node_modules/esptool-js/lib/targets/esp32c2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ESP32C3ROM } from "./esp32c3.js";
|
||||
export declare class ESP32C2ROM extends ESP32C3ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
changeBaudRate(loader: ESPLoader): Promise<void>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
114
node_modules/esptool-js/lib/targets/esp32c2.js
generated
vendored
Normal file
114
node_modules/esptool-js/lib/targets/esp32c2.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
import { ESP32C3ROM } from "./esp32c3.js";
|
||||
export class ESP32C2ROM extends ESP32C3ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C2";
|
||||
this.IMAGE_CHIP_ID = 12;
|
||||
this.EFUSE_BASE = 0x60008800;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x040;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.XTAL_CLK_DIVIDER = 1;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 1;
|
||||
const block1Addr = this.EFUSE_BASE + 0x040;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const word3 = await loader.readReg(addr);
|
||||
const pkgVersion = (word3 >> 22) & 0x07;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const block1Addr = this.EFUSE_BASE + 0x040;
|
||||
const numWord = 1;
|
||||
const pos = 20;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const ret = ((await loader.readReg(addr)) & (0x03 << pos)) >> pos;
|
||||
return ret;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
let desc;
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
if (pkgVer === 0 || pkgVer === 1) {
|
||||
desc = "ESP32-C2";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C2";
|
||||
}
|
||||
const chip_rev = await this.getChipRevision(loader);
|
||||
desc += " (revision " + chip_rev + ")";
|
||||
return desc;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["Wi-Fi", "BLE"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Unsupported crystal in use");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
async changeBaudRate(loader) {
|
||||
const rom_with_26M_XTAL = await this.getCrystalFreq(loader);
|
||||
if (rom_with_26M_XTAL === 26) {
|
||||
loader.changeBaud();
|
||||
}
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
37
node_modules/esptool-js/lib/targets/esp32c3.d.ts
generated
vendored
Normal file
37
node_modules/esptool-js/lib/targets/esp32c3.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32C3ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getFlashCap(loader: ESPLoader): Promise<number>;
|
||||
getFlashVendor(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
133
node_modules/esptool-js/lib/targets/esp32c3.js
generated
vendored
Normal file
133
node_modules/esptool-js/lib/targets/esp32c3.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32C3ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C3";
|
||||
this.IMAGE_CHIP_ID = 5;
|
||||
this.EFUSE_BASE = 0x60008800;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const word3 = await loader.readReg(addr);
|
||||
const pkgVersion = (word3 >> 21) & 0x07;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const numWord = 3;
|
||||
const pos = 18;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const ret = ((await loader.readReg(addr)) & (0x7 << pos)) >> pos;
|
||||
return ret;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
let desc;
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C3";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C3";
|
||||
}
|
||||
const chip_rev = await this.getChipRevision(loader);
|
||||
desc += " (revision " + chip_rev + ")";
|
||||
return desc;
|
||||
}
|
||||
async getFlashCap(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const flashCap = (registerValue >> 27) & 0x07;
|
||||
return flashCap;
|
||||
}
|
||||
async getFlashVendor(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const vendorId = (registerValue >> 0) & 0x07;
|
||||
const vendorMap = {
|
||||
1: "XMC",
|
||||
2: "GD",
|
||||
3: "FM",
|
||||
4: "TT",
|
||||
5: "ZBIT",
|
||||
};
|
||||
return vendorMap[vendorId] || "";
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi", "BLE"];
|
||||
const flashMap = {
|
||||
0: null,
|
||||
1: "Embedded Flash 4MB",
|
||||
2: "Embedded Flash 2MB",
|
||||
3: "Embedded Flash 1MB",
|
||||
4: "Embedded Flash 8MB",
|
||||
};
|
||||
const flashCap = await this.getFlashCap(loader);
|
||||
const flashVendor = await this.getFlashVendor(loader);
|
||||
const flash = flashMap[flashCap];
|
||||
const flashDescription = flash !== undefined ? flash : "Unknown Embedded Flash";
|
||||
if (flash !== null) {
|
||||
features.push(`${flashDescription} (${flashVendor})`);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
70
node_modules/esptool-js/lib/targets/esp32c5.d.ts
generated
vendored
Normal file
70
node_modules/esptool-js/lib/targets/esp32c5.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { ESPLoader } from "../esploader";
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export declare class ESP32C5ROM extends ESP32C6ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
IROM_MAP_START: number;
|
||||
IROM_MAP_END: number;
|
||||
DROM_MAP_START: number;
|
||||
DROM_MAP_END: number;
|
||||
PCR_SYSCLK_CONF_REG: number;
|
||||
PCR_SYSCLK_XTAL_FREQ_V: number;
|
||||
PCR_SYSCLK_XTAL_FREQ_S: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
FLASH_FREQUENCY: {
|
||||
"80m": number;
|
||||
"40m": number;
|
||||
"20m": number;
|
||||
};
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
getCrystalFreqRomExpect(loader: ESPLoader): Promise<number>;
|
||||
}
|
129
node_modules/esptool-js/lib/targets/esp32c5.js
generated
vendored
Normal file
129
node_modules/esptool-js/lib/targets/esp32c5.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export class ESP32C5ROM extends ESP32C6ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C5";
|
||||
this.IMAGE_CHIP_ID = 23;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x2000;
|
||||
this.EFUSE_BASE = 0x600b4800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 24;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 28;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 12;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x038;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 20;
|
||||
this.IROM_MAP_START = 0x42000000;
|
||||
this.IROM_MAP_END = 0x42800000;
|
||||
this.DROM_MAP_START = 0x42800000;
|
||||
this.DROM_MAP_END = 0x43000000;
|
||||
this.PCR_SYSCLK_CONF_REG = 0x60096110;
|
||||
this.PCR_SYSCLK_XTAL_FREQ_V = 0x7f << 24;
|
||||
this.PCR_SYSCLK_XTAL_FREQ_S = 24;
|
||||
this.XTAL_CLK_DIVIDER = 1;
|
||||
this.UARTDEV_BUF_NO = 0x4085f51c; // Variable in ROM .bss which indicates the port in use
|
||||
// Magic value for ESP32C5
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x1101406f, 0x63e1406f, 0x5fd1406f];
|
||||
this.FLASH_FREQUENCY = {
|
||||
"80m": 0xf,
|
||||
"40m": 0x0,
|
||||
"20m": 0x2,
|
||||
};
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x42800000, 0x43000000, "DROM"],
|
||||
[0x40800000, 0x40860000, "DRAM"],
|
||||
[0x40800000, 0x40860000, "BYTE_ACCESSIBLE"],
|
||||
[0x4003a000, 0x40040000, "DROM_MASK"],
|
||||
[0x40000000, 0x4003a000, "IROM_MASK"],
|
||||
[0x42000000, 0x42800000, "IROM"],
|
||||
[0x40800000, 0x40860000, "IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_DRAM"],
|
||||
[0x600fe000, 0x60100000, "MEM_INTERNAL2"],
|
||||
];
|
||||
this.UF2_FAMILY_ID = 0xf71c0343;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "ECDSA_KEY",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
12: "KM_INIT_KEY",
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 26) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 0) & 0x0f;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 4) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
let desc;
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C5";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C5";
|
||||
}
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${desc} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["Wi-Fi 6 (dual-band)", "BT 5 (LE)"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
// The crystal detection algorithm of ESP32/ESP8266
|
||||
// works for ESP32-C5 as well.
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 45) {
|
||||
normXtal = 48;
|
||||
}
|
||||
else if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Unsupported crystal in use");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
async getCrystalFreqRomExpect(loader) {
|
||||
return (((await loader.readReg(this.PCR_SYSCLK_CONF_REG)) & this.PCR_SYSCLK_XTAL_FREQ_V) >> this.PCR_SYSCLK_XTAL_FREQ_S);
|
||||
}
|
||||
}
|
36
node_modules/esptool-js/lib/targets/esp32c6.d.ts
generated
vendored
Normal file
36
node_modules/esptool-js/lib/targets/esp32c6.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32C6ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipRevision(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
96
node_modules/esptool-js/lib/targets/esp32c6.js
generated
vendored
Normal file
96
node_modules/esptool-js/lib/targets/esp32c6.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32C6ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C6";
|
||||
this.IMAGE_CHIP_ID = 13;
|
||||
this.EFUSE_BASE = 0x600b0800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const word3 = await loader.readReg(addr);
|
||||
const pkgVersion = (word3 >> 21) & 0x07;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getChipRevision(loader) {
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const numWord = 3;
|
||||
const pos = 18;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const ret = ((await loader.readReg(addr)) & (0x7 << pos)) >> pos;
|
||||
return ret;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
let desc;
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C6";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C6";
|
||||
}
|
||||
const chipRev = await this.getChipRevision(loader);
|
||||
desc += " (revision " + chipRev + ")";
|
||||
return desc;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["Wi-Fi 6", "BT 5", "IEEE802.15.4"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
62
node_modules/esptool-js/lib/targets/esp32c61.d.ts
generated
vendored
Normal file
62
node_modules/esptool-js/lib/targets/esp32c61.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
import { ESPLoader } from "../esploader";
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export declare class ESP32C61ROM extends ESP32C6ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
UART_DATE_REG_ADDR: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
FLASH_FREQUENCY: {
|
||||
"80m": number;
|
||||
"40m": number;
|
||||
"20m": number;
|
||||
};
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
13: string;
|
||||
14: string;
|
||||
15: string;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
}
|
122
node_modules/esptool-js/lib/targets/esp32c61.js
generated
vendored
Normal file
122
node_modules/esptool-js/lib/targets/esp32c61.js
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
import { ESP32C6ROM } from "./esp32c6";
|
||||
export class ESP32C61ROM extends ESP32C6ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-C61";
|
||||
this.IMAGE_CHIP_ID = 20;
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x33f0206f, 0x2421606f];
|
||||
this.UART_DATE_REG_ADDR = 0x60000000 + 0x7c;
|
||||
this.EFUSE_BASE = 0x600b4800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 12;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 16;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 20;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x030;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 23;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 26;
|
||||
this.FLASH_FREQUENCY = {
|
||||
"80m": 0xf,
|
||||
"40m": 0x0,
|
||||
"20m": 0x2,
|
||||
};
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x41800000, 0x42000000, "DROM"],
|
||||
[0x40800000, 0x40860000, "DRAM"],
|
||||
[0x40800000, 0x40860000, "BYTE_ACCESSIBLE"],
|
||||
[0x4004ac00, 0x40050000, "DROM_MASK"],
|
||||
[0x40000000, 0x4004ac00, "IROM_MASK"],
|
||||
[0x41000000, 0x41800000, "IROM"],
|
||||
[0x40800000, 0x40860000, "IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_IRAM"],
|
||||
[0x50000000, 0x50004000, "RTC_DRAM"],
|
||||
[0x600fe000, 0x60100000, "MEM_INTERNAL2"],
|
||||
];
|
||||
this.UF2_FAMILY_ID = 0x77d850c4;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "ECDSA_KEY",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
12: "KM_INIT_KEY",
|
||||
13: "XTS_AES_256_KEY_1_PSRAM",
|
||||
14: "XTS_AES_256_KEY_2_PSRAM",
|
||||
15: "XTS_AES_128_KEY_PSRAM",
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 26) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 0) & 0x0f;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 4) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
let desc;
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-C61";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-C61";
|
||||
}
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${desc} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["WiFi 6", "BT 5"];
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
}
|
41
node_modules/esptool-js/lib/targets/esp32h2.d.ts
generated
vendored
Normal file
41
node_modules/esptool-js/lib/targets/esp32h2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32H2ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
USB_RAM_BLOCK: number;
|
||||
UARTDEV_BUF_NO_USB: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
postConnect(loader: ESPLoader): Promise<void>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
103
node_modules/esptool-js/lib/targets/esp32h2.js
generated
vendored
Normal file
103
node_modules/esptool-js/lib/targets/esp32h2.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32H2ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-H2";
|
||||
this.IMAGE_CHIP_ID = 16;
|
||||
this.EFUSE_BASE = 0x600b0800;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.UART_CLKDIV_REG = 0x3ff40014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x6000007c;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.USB_RAM_BLOCK = 0x800;
|
||||
this.UARTDEV_BUF_NO_USB = 3;
|
||||
this.UARTDEV_BUF_NO = 0x3fcef14c;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 4;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 0) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 18) & 0x07;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 21) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVer = await this.getPkgVersion(loader);
|
||||
let desc;
|
||||
if (pkgVer === 0) {
|
||||
desc = "ESP32-H2";
|
||||
}
|
||||
else {
|
||||
desc = "unknown ESP32-H2";
|
||||
}
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${desc} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["BT 5 (LE)", "IEEE802.15.4", "Single Core", "96MHz"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
// ESP32H2 XTAL is fixed to 32MHz
|
||||
return 32;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async postConnect(loader) {
|
||||
const bufNo = (await loader.readReg(this.UARTDEV_BUF_NO)) & 0xff;
|
||||
loader.debug("In _post_connect " + bufNo);
|
||||
if (bufNo == this.UARTDEV_BUF_NO_USB) {
|
||||
loader.ESP_RAM_BLOCK = this.USB_RAM_BLOCK;
|
||||
}
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
78
node_modules/esptool-js/lib/targets/esp32p4.d.ts
generated
vendored
Normal file
78
node_modules/esptool-js/lib/targets/esp32p4.d.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ESP32ROM } from "./esp32.js";
|
||||
export declare class ESP32P4ROM extends ESP32ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
IROM_MAP_START: number;
|
||||
IROM_MAP_END: number;
|
||||
DROM_MAP_START: number;
|
||||
DROM_MAP_END: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
UART_DATE_REG_ADDR: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_1: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_2: number;
|
||||
PURPOSE_VAL_XTS_AES128_KEY: number;
|
||||
SUPPORTS_ENCRYPTED_FLASH: boolean;
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN: number;
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
12: string;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
getFlashVoltage(loader: ESPLoader): Promise<void>;
|
||||
overrideVddsdio(loader: ESPLoader): Promise<void>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getFlashCryptConfig(loader: ESPLoader): Promise<void>;
|
||||
getSecureBootEnabled(laoder: ESPLoader): Promise<number>;
|
||||
getKeyBlockPurpose(loader: ESPLoader, keyBlock: number): Promise<number | undefined>;
|
||||
isFlashEncryptionKeyValid(loader: ESPLoader): Promise<boolean>;
|
||||
}
|
181
node_modules/esptool-js/lib/targets/esp32p4.js
generated
vendored
Normal file
181
node_modules/esptool-js/lib/targets/esp32p4.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
import { ESP32ROM } from "./esp32.js";
|
||||
export class ESP32P4ROM extends ESP32ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-P4";
|
||||
this.IMAGE_CHIP_ID = 18;
|
||||
this.IROM_MAP_START = 0x40000000;
|
||||
this.IROM_MAP_END = 0x4c000000;
|
||||
this.DROM_MAP_START = 0x40000000;
|
||||
this.DROM_MAP_END = 0x4c000000;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x2000; // First 2 sectors are reserved for FE purposes
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x0, 0x0addbad0];
|
||||
this.UART_DATE_REG_ADDR = 0x500ca000 + 0x8c;
|
||||
this.EFUSE_BASE = 0x5012d000;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.SPI_REG_BASE = 0x5008d000; // SPIMEM1
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 24;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 28;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 12;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 20;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x038;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 20;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_1 = 2;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_2 = 3;
|
||||
this.PURPOSE_VAL_XTS_AES128_KEY = 4;
|
||||
this.SUPPORTS_ENCRYPTED_FLASH = true;
|
||||
this.FLASH_ENCRYPTED_WRITE_ALIGN = 16;
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x40000000, 0x4c000000, "DROM"],
|
||||
[0x4ff00000, 0x4ffa0000, "DRAM"],
|
||||
[0x4ff00000, 0x4ffa0000, "BYTE_ACCESSIBLE"],
|
||||
[0x4fc00000, 0x4fc20000, "DROM_MASK"],
|
||||
[0x4fc00000, 0x4fc20000, "IROM_MASK"],
|
||||
[0x40000000, 0x4c000000, "IROM"],
|
||||
[0x4ff00000, 0x4ffa0000, "IRAM"],
|
||||
[0x50108000, 0x50110000, "RTC_IRAM"],
|
||||
[0x50108000, 0x50110000, "RTC_DRAM"],
|
||||
[0x600fe000, 0x60100000, "MEM_INTERNAL2"],
|
||||
];
|
||||
this.UF2_FAMILY_ID = 0x3d308e94;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "ECDSA_KEY",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
12: "KM_INIT_KEY",
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 2;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
return (registerValue >> 27) & 0x07;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
return (registerValue >> 0) & 0x0f;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 2;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
return (registerValue >> 4) & 0x03;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
const chipName = pkgVersion === 0 ? "ESP32-P4" : "unknown ESP32-P4";
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${chipName} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
return ["High-Performance MCU"];
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40; // ESP32P4 XTAL is fixed to 40MHz
|
||||
}
|
||||
async getFlashVoltage(loader) {
|
||||
return;
|
||||
}
|
||||
async overrideVddsdio(loader) {
|
||||
loader.debug("VDD_SDIO overrides are not supported for ESP32-P4");
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
async getFlashCryptConfig(loader) {
|
||||
return; // doesn't exist on ESP32-P4
|
||||
}
|
||||
async getSecureBootEnabled(laoder) {
|
||||
const registerValue = await laoder.readReg(this.EFUSE_SECURE_BOOT_EN_REG);
|
||||
return registerValue & this.EFUSE_SECURE_BOOT_EN_MASK;
|
||||
}
|
||||
async getKeyBlockPurpose(loader, keyBlock) {
|
||||
if (keyBlock < 0 || keyBlock > this.EFUSE_MAX_KEY) {
|
||||
loader.debug(`Valid key block numbers must be in range 0-${this.EFUSE_MAX_KEY}`);
|
||||
return;
|
||||
}
|
||||
const regShiftDictionary = [
|
||||
[this.EFUSE_PURPOSE_KEY0_REG, this.EFUSE_PURPOSE_KEY0_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY1_REG, this.EFUSE_PURPOSE_KEY1_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY2_REG, this.EFUSE_PURPOSE_KEY2_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY3_REG, this.EFUSE_PURPOSE_KEY3_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY4_REG, this.EFUSE_PURPOSE_KEY4_SHIFT],
|
||||
[this.EFUSE_PURPOSE_KEY5_REG, this.EFUSE_PURPOSE_KEY5_SHIFT],
|
||||
];
|
||||
const [reg, shift] = regShiftDictionary[keyBlock];
|
||||
const registerValue = await loader.readReg(reg);
|
||||
return (registerValue >> shift) & 0xf;
|
||||
}
|
||||
async isFlashEncryptionKeyValid(loader) {
|
||||
const purposes = [];
|
||||
for (let i = 0; i <= this.EFUSE_MAX_KEY; i++) {
|
||||
const purpose = await this.getKeyBlockPurpose(loader, i);
|
||||
purposes.push(purpose);
|
||||
}
|
||||
const isXtsAes128Key = purposes.find((p) => p === this.PURPOSE_VAL_XTS_AES128_KEY);
|
||||
if (typeof isXtsAes128Key !== undefined) {
|
||||
return true;
|
||||
}
|
||||
const isXtsAes256Key1 = purposes.find((p) => p === this.PURPOSE_VAL_XTS_AES256_KEY_1);
|
||||
const isXtsAes256Key2 = purposes.find((p) => p === this.PURPOSE_VAL_XTS_AES256_KEY_2);
|
||||
if (typeof isXtsAes256Key1 !== undefined && typeof isXtsAes256Key2 !== undefined) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
111
node_modules/esptool-js/lib/targets/esp32s2.d.ts
generated
vendored
Normal file
111
node_modules/esptool-js/lib/targets/esp32s2.d.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32S2ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
IROM_MAP_START: number;
|
||||
IROM_MAP_END: number;
|
||||
DROM_MAP_START: number;
|
||||
DROM_MAP_END: number;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
SPI_ADDR_REG_MSB: boolean;
|
||||
MAC_EFUSE_REG: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
SUPPORTS_ENCRYPTED_FLASH: boolean;
|
||||
FLASH_ENCRYPTED_WRITE_ALIGN: number;
|
||||
EFUSE_BASE: number;
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
EFUSE_BLOCK2_ADDR: number;
|
||||
EFUSE_PURPOSE_KEY0_REG: number;
|
||||
EFUSE_PURPOSE_KEY0_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY1_REG: number;
|
||||
EFUSE_PURPOSE_KEY1_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY2_REG: number;
|
||||
EFUSE_PURPOSE_KEY2_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY3_REG: number;
|
||||
EFUSE_PURPOSE_KEY3_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY4_REG: number;
|
||||
EFUSE_PURPOSE_KEY4_SHIFT: number;
|
||||
EFUSE_PURPOSE_KEY5_REG: number;
|
||||
EFUSE_PURPOSE_KEY5_SHIFT: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG: number;
|
||||
EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_REG: number;
|
||||
EFUSE_SPI_BOOT_CRYPT_CNT_MASK: number;
|
||||
EFUSE_SECURE_BOOT_EN_REG: number;
|
||||
EFUSE_SECURE_BOOT_EN_MASK: number;
|
||||
EFUSE_RD_REPEAT_DATA3_REG: number;
|
||||
EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_1: number;
|
||||
PURPOSE_VAL_XTS_AES256_KEY_2: number;
|
||||
PURPOSE_VAL_XTS_AES128_KEY: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
UARTDEV_BUF_NO_USB_OTG: number;
|
||||
USB_RAM_BLOCK: number;
|
||||
GPIO_STRAP_REG: number;
|
||||
GPIO_STRAP_SPI_BOOT_MASK: number;
|
||||
GPIO_STRAP_VDDSPI_MASK: number;
|
||||
RTC_CNTL_OPTION1_REG: number;
|
||||
RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK: number;
|
||||
RTCCNTL_BASE_REG: number;
|
||||
RTC_CNTL_WDTCONFIG0_REG: number;
|
||||
RTC_CNTL_WDTCONFIG1_REG: number;
|
||||
RTC_CNTL_WDTWPROTECT_REG: number;
|
||||
RTC_CNTL_WDT_WKEY: number;
|
||||
MEMORY_MAP: (string | number)[][];
|
||||
EFUSE_VDD_SPI_REG: number;
|
||||
VDD_SPI_XPD: number;
|
||||
VDD_SPI_TIEH: number;
|
||||
VDD_SPI_FORCE: number;
|
||||
UF2_FAMILY_ID: number;
|
||||
EFUSE_MAX_KEY: number;
|
||||
KEY_PURPOSES: {
|
||||
0: string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
8: string;
|
||||
9: string;
|
||||
10: string;
|
||||
11: string;
|
||||
};
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getFlashVersion(loader: ESPLoader): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getFlashCap(loader: ESPLoader): Promise<number>;
|
||||
getPsramVersion(loader: ESPLoader): Promise<number>;
|
||||
getPsramCap(loader: ESPLoader): Promise<number>;
|
||||
getBlock2Version(loader: ESPLoader): Promise<number>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
usingUsbOtg(loader: ESPLoader): Promise<boolean>;
|
||||
postConnect(loader: ESPLoader): Promise<void>;
|
||||
}
|
239
node_modules/esptool-js/lib/targets/esp32s2.js
generated
vendored
Normal file
239
node_modules/esptool-js/lib/targets/esp32s2.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32S2ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-S2";
|
||||
this.IMAGE_CHIP_ID = 2;
|
||||
this.IROM_MAP_START = 0x40080000;
|
||||
this.IROM_MAP_END = 0x40b80000;
|
||||
this.DROM_MAP_START = 0x3f000000;
|
||||
this.DROM_MAP_END = 0x3f3f0000;
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0x000007c6];
|
||||
this.SPI_REG_BASE = 0x3f402000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.SPI_ADDR_REG_MSB = false;
|
||||
this.MAC_EFUSE_REG = 0x3f41a044; // ESP32-S2 has special block for MAC efuses
|
||||
this.UART_CLKDIV_REG = 0x3f400014;
|
||||
this.SUPPORTS_ENCRYPTED_FLASH = true;
|
||||
this.FLASH_ENCRYPTED_WRITE_ALIGN = 16;
|
||||
// todo: use espefuse APIs to get this info
|
||||
this.EFUSE_BASE = 0x3f41a000;
|
||||
this.EFUSE_RD_REG_BASE = this.EFUSE_BASE + 0x030; // BLOCK0 read base address
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x044;
|
||||
this.EFUSE_BLOCK2_ADDR = this.EFUSE_BASE + 0x05c;
|
||||
this.EFUSE_PURPOSE_KEY0_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY0_SHIFT = 24;
|
||||
this.EFUSE_PURPOSE_KEY1_REG = this.EFUSE_BASE + 0x34;
|
||||
this.EFUSE_PURPOSE_KEY1_SHIFT = 28;
|
||||
this.EFUSE_PURPOSE_KEY2_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY2_SHIFT = 0;
|
||||
this.EFUSE_PURPOSE_KEY3_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY3_SHIFT = 4;
|
||||
this.EFUSE_PURPOSE_KEY4_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY4_SHIFT = 8;
|
||||
this.EFUSE_PURPOSE_KEY5_REG = this.EFUSE_BASE + 0x38;
|
||||
this.EFUSE_PURPOSE_KEY5_SHIFT = 12;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_REG = this.EFUSE_RD_REG_BASE;
|
||||
this.EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT = 1 << 19;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_REG = this.EFUSE_BASE + 0x034;
|
||||
this.EFUSE_SPI_BOOT_CRYPT_CNT_MASK = 0x7 << 18;
|
||||
this.EFUSE_SECURE_BOOT_EN_REG = this.EFUSE_BASE + 0x038;
|
||||
this.EFUSE_SECURE_BOOT_EN_MASK = 1 << 20;
|
||||
this.EFUSE_RD_REPEAT_DATA3_REG = this.EFUSE_BASE + 0x3c;
|
||||
this.EFUSE_RD_REPEAT_DATA3_REG_FLASH_TYPE_MASK = 1 << 9;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_1 = 2;
|
||||
this.PURPOSE_VAL_XTS_AES256_KEY_2 = 3;
|
||||
this.PURPOSE_VAL_XTS_AES128_KEY = 4;
|
||||
this.UARTDEV_BUF_NO = 0x3ffffd14; // Variable in ROM .bss which indicates the port in use
|
||||
this.UARTDEV_BUF_NO_USB_OTG = 2; // Value of the above indicating that USB-OTG is in use
|
||||
this.USB_RAM_BLOCK = 0x800; // Max block size USB-OTG is used
|
||||
this.GPIO_STRAP_REG = 0x3f404038;
|
||||
this.GPIO_STRAP_SPI_BOOT_MASK = 1 << 3; // Not download mode
|
||||
this.GPIO_STRAP_VDDSPI_MASK = 1 << 4;
|
||||
this.RTC_CNTL_OPTION1_REG = 0x3f408128;
|
||||
this.RTC_CNTL_FORCE_DOWNLOAD_BOOT_MASK = 0x1; // Is download mode forced over USB?
|
||||
this.RTCCNTL_BASE_REG = 0x3f408000;
|
||||
this.RTC_CNTL_WDTCONFIG0_REG = this.RTCCNTL_BASE_REG + 0x0094;
|
||||
this.RTC_CNTL_WDTCONFIG1_REG = this.RTCCNTL_BASE_REG + 0x0098;
|
||||
this.RTC_CNTL_WDTWPROTECT_REG = this.RTCCNTL_BASE_REG + 0x00ac;
|
||||
this.RTC_CNTL_WDT_WKEY = 0x50d83aa1;
|
||||
this.MEMORY_MAP = [
|
||||
[0x00000000, 0x00010000, "PADDING"],
|
||||
[0x3f000000, 0x3ff80000, "DROM"],
|
||||
[0x3f500000, 0x3ff80000, "EXTRAM_DATA"],
|
||||
[0x3ff9e000, 0x3ffa0000, "RTC_DRAM"],
|
||||
[0x3ff9e000, 0x40000000, "BYTE_ACCESSIBLE"],
|
||||
[0x3ff9e000, 0x40072000, "MEM_INTERNAL"],
|
||||
[0x3ffb0000, 0x40000000, "DRAM"],
|
||||
[0x40000000, 0x4001a100, "IROM_MASK"],
|
||||
[0x40020000, 0x40070000, "IRAM"],
|
||||
[0x40070000, 0x40072000, "RTC_IRAM"],
|
||||
[0x40080000, 0x40800000, "IROM"],
|
||||
[0x50000000, 0x50002000, "RTC_DATA"],
|
||||
];
|
||||
this.EFUSE_VDD_SPI_REG = this.EFUSE_BASE + 0x34;
|
||||
this.VDD_SPI_XPD = 1 << 4;
|
||||
this.VDD_SPI_TIEH = 1 << 5;
|
||||
this.VDD_SPI_FORCE = 1 << 6;
|
||||
this.UF2_FAMILY_ID = 0xbfdd4eee;
|
||||
this.EFUSE_MAX_KEY = 5;
|
||||
this.KEY_PURPOSES = {
|
||||
0: "USER/EMPTY",
|
||||
1: "RESERVED",
|
||||
2: "XTS_AES_256_KEY_1",
|
||||
3: "XTS_AES_256_KEY_2",
|
||||
4: "XTS_AES_128_KEY",
|
||||
5: "HMAC_DOWN_ALL",
|
||||
6: "HMAC_DOWN_JTAG",
|
||||
7: "HMAC_DOWN_DIGITAL_SIGNATURE",
|
||||
8: "HMAC_UP",
|
||||
9: "SECURE_BOOT_DIGEST0",
|
||||
10: "SECURE_BOOT_DIGEST1",
|
||||
11: "SECURE_BOOT_DIGEST2",
|
||||
};
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x60000078;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x1000;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 4;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const word = await loader.readReg(addr);
|
||||
const pkgVersion = (word >> 0) & 0x0f;
|
||||
return pkgVersion;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const hiNumWord = 3;
|
||||
const hi = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * hiNumWord)) >> 20) & 0x01;
|
||||
const lowNumWord = 4;
|
||||
const low = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * lowNumWord)) >> 4) & 0x07;
|
||||
return (hi << 3) + low;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 18) & 0x03;
|
||||
}
|
||||
async getFlashVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 21) & 0x0f;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const chipDesc = {
|
||||
0: "ESP32-S2",
|
||||
1: "ESP32-S2FH2",
|
||||
2: "ESP32-S2FH4",
|
||||
102: "ESP32-S2FNR2",
|
||||
100: "ESP32-S2R2",
|
||||
};
|
||||
const chipIndex = (await this.getFlashCap(loader)) + (await this.getPsramCap(loader)) * 100;
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
return `${chipDesc[chipIndex] || "unknown ESP32-S2"} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getFlashCap(loader) {
|
||||
return await this.getFlashVersion(loader);
|
||||
}
|
||||
async getPsramVersion(loader) {
|
||||
const numWord = 3;
|
||||
const addr = this.EFUSE_BLOCK1_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const psramCap = (registerValue >> 28) & 0x0f;
|
||||
return psramCap;
|
||||
}
|
||||
async getPsramCap(loader) {
|
||||
return await this.getPsramVersion(loader);
|
||||
}
|
||||
async getBlock2Version(loader) {
|
||||
const numWord = 4;
|
||||
const addr = this.EFUSE_BLOCK2_ADDR + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const block2Ver = (registerValue >> 4) & 0x07;
|
||||
return block2Ver;
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi"];
|
||||
const flashMap = {
|
||||
0: "No Embedded Flash",
|
||||
1: "Embedded Flash 2MB",
|
||||
2: "Embedded Flash 4MB",
|
||||
};
|
||||
const flashCap = await this.getFlashCap(loader);
|
||||
const flashDescription = flashMap[flashCap] || "Unknown Embedded Flash";
|
||||
features.push(flashDescription);
|
||||
const psramMap = {
|
||||
0: "No Embedded Flash",
|
||||
1: "Embedded PSRAM 2MB",
|
||||
2: "Embedded PSRAM 4MB",
|
||||
};
|
||||
const psramCap = await this.getPsramCap(loader);
|
||||
const psramDescription = psramMap[psramCap] || "Unknown Embedded PSRAM";
|
||||
features.push(psramDescription);
|
||||
const block2VersionMap = {
|
||||
0: "No calibration in BLK2 of efuse",
|
||||
1: "ADC and temperature sensor calibration in BLK2 of efuse V1",
|
||||
2: "ADC and temperature sensor calibration in BLK2 of efuse V2",
|
||||
};
|
||||
const block2Ver = await this.getBlock2Version(loader);
|
||||
const block2VersionDescription = block2VersionMap[block2Ver] || "Unknown Calibration in BLK2";
|
||||
features.push(block2VersionDescription);
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
async usingUsbOtg(loader) {
|
||||
const uartNo = (await loader.readReg(this.UARTDEV_BUF_NO)) & 0xff;
|
||||
return uartNo === this.UARTDEV_BUF_NO_USB_OTG;
|
||||
}
|
||||
async postConnect(loader) {
|
||||
const usingUsbOtg = await this.usingUsbOtg(loader);
|
||||
loader.debug("In _post_connect using USB OTG ?" + usingUsbOtg);
|
||||
if (usingUsbOtg) {
|
||||
loader.ESP_RAM_BLOCK = this.USB_RAM_BLOCK;
|
||||
}
|
||||
}
|
||||
}
|
51
node_modules/esptool-js/lib/targets/esp32s3.d.ts
generated
vendored
Normal file
51
node_modules/esptool-js/lib/targets/esp32s3.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP32S3ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
IMAGE_CHIP_ID: number;
|
||||
EFUSE_BASE: number;
|
||||
MAC_EFUSE_REG: number;
|
||||
EFUSE_BLOCK1_ADDR: number;
|
||||
EFUSE_BLOCK2_ADDR: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
FLASH_SIZES: {
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
USB_RAM_BLOCK: number;
|
||||
UARTDEV_BUF_NO_USB: number;
|
||||
UARTDEV_BUF_NO: number;
|
||||
getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
getPkgVersion(loader: ESPLoader): Promise<number>;
|
||||
getRawMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMinorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getRawMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getMajorChipVersion(loader: ESPLoader): Promise<number>;
|
||||
getBlkVersionMajor(loader: ESPLoader): Promise<number>;
|
||||
getBlkVersionMinor(loader: ESPLoader): Promise<number>;
|
||||
isEco0(loader: ESPLoader, minorRaw: number): Promise<boolean>;
|
||||
getFlashCap(loader: ESPLoader): Promise<number>;
|
||||
getFlashVendor(loader: ESPLoader): Promise<string>;
|
||||
getPsramCap(loader: ESPLoader): Promise<number>;
|
||||
getPsramVendor(loader: ESPLoader): Promise<string>;
|
||||
getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
postConnect(loader: ESPLoader): Promise<void>;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
201
node_modules/esptool-js/lib/targets/esp32s3.js
generated
vendored
Normal file
201
node_modules/esptool-js/lib/targets/esp32s3.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP32S3ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP32-S3";
|
||||
this.IMAGE_CHIP_ID = 9;
|
||||
this.EFUSE_BASE = 0x60007000;
|
||||
this.MAC_EFUSE_REG = this.EFUSE_BASE + 0x044;
|
||||
this.EFUSE_BLOCK1_ADDR = this.EFUSE_BASE + 0x44;
|
||||
this.EFUSE_BLOCK2_ADDR = this.EFUSE_BASE + 0x5c;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.UART_DATE_REG_ADDR = 0x60000080;
|
||||
this.FLASH_WRITE_SIZE = 0x400;
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0x0;
|
||||
this.FLASH_SIZES = {
|
||||
"1MB": 0x00,
|
||||
"2MB": 0x10,
|
||||
"4MB": 0x20,
|
||||
"8MB": 0x30,
|
||||
"16MB": 0x40,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60002000;
|
||||
this.SPI_USR_OFFS = 0x18;
|
||||
this.SPI_USR1_OFFS = 0x1c;
|
||||
this.SPI_USR2_OFFS = 0x20;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0x24;
|
||||
this.SPI_MISO_DLEN_OFFS = 0x28;
|
||||
this.SPI_W0_OFFS = 0x58;
|
||||
this.USB_RAM_BLOCK = 0x800;
|
||||
this.UARTDEV_BUF_NO_USB = 3;
|
||||
this.UARTDEV_BUF_NO = 0x3fcef14c;
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const majorRev = await this.getMajorChipVersion(loader);
|
||||
const minorRev = await this.getMinorChipVersion(loader);
|
||||
const pkgVersion = await this.getPkgVersion(loader);
|
||||
const chipName = {
|
||||
0: "ESP32-S3 (QFN56)",
|
||||
1: "ESP32-S3-PICO-1 (LGA56)",
|
||||
};
|
||||
return `${chipName[pkgVersion] || "unknown ESP32-S3"} (revision v${majorRev}.${minorRev})`;
|
||||
}
|
||||
async getPkgVersion(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 21) & 0x07;
|
||||
}
|
||||
async getRawMinorChipVersion(loader) {
|
||||
const hiNumWord = 5;
|
||||
const hi = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * hiNumWord)) >> 23) & 0x01;
|
||||
const lowNumWord = 3;
|
||||
const low = ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * lowNumWord)) >> 18) & 0x07;
|
||||
return (hi << 3) + low;
|
||||
}
|
||||
async getMinorChipVersion(loader) {
|
||||
const minorRaw = await this.getRawMinorChipVersion(loader);
|
||||
if (await this.isEco0(loader, minorRaw)) {
|
||||
return 0;
|
||||
}
|
||||
return this.getRawMinorChipVersion(loader);
|
||||
}
|
||||
async getRawMajorChipVersion(loader) {
|
||||
const numWord = 5;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 24) & 0x03;
|
||||
}
|
||||
async getMajorChipVersion(loader) {
|
||||
const minorRaw = await this.getRawMinorChipVersion(loader);
|
||||
if (await this.isEco0(loader, minorRaw)) {
|
||||
return 0;
|
||||
}
|
||||
return this.getRawMajorChipVersion(loader);
|
||||
}
|
||||
async getBlkVersionMajor(loader) {
|
||||
const numWord = 4;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK2_ADDR + 4 * numWord)) >> 0) & 0x03;
|
||||
}
|
||||
async getBlkVersionMinor(loader) {
|
||||
const numWord = 3;
|
||||
return ((await loader.readReg(this.EFUSE_BLOCK1_ADDR + 4 * numWord)) >> 24) & 0x07;
|
||||
}
|
||||
async isEco0(loader, minorRaw) {
|
||||
// Workaround: The major version field was allocated to other purposes
|
||||
// when block version is v1.1.
|
||||
// Luckily only chip v0.0 have this kind of block version and efuse usage.
|
||||
return ((minorRaw & 0x7) === 0 &&
|
||||
(await this.getBlkVersionMajor(loader)) === 1 &&
|
||||
(await this.getBlkVersionMinor(loader)) === 1);
|
||||
}
|
||||
async getFlashCap(loader) {
|
||||
const numWord = 3;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const flashCap = (registerValue >> 27) & 0x07;
|
||||
return flashCap;
|
||||
}
|
||||
async getFlashVendor(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const vendorId = (registerValue >> 0) & 0x07;
|
||||
const vendorMap = {
|
||||
1: "XMC",
|
||||
2: "GD",
|
||||
3: "FM",
|
||||
4: "TT",
|
||||
5: "BY",
|
||||
};
|
||||
return vendorMap[vendorId] || "";
|
||||
}
|
||||
async getPsramCap(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const psramCap = (registerValue >> 3) & 0x03;
|
||||
return psramCap;
|
||||
}
|
||||
async getPsramVendor(loader) {
|
||||
const numWord = 4;
|
||||
const block1Addr = this.EFUSE_BASE + 0x044;
|
||||
const addr = block1Addr + 4 * numWord;
|
||||
const registerValue = await loader.readReg(addr);
|
||||
const vendorId = (registerValue >> 7) & 0x03;
|
||||
const vendorMap = {
|
||||
1: "AP_3v3",
|
||||
2: "AP_1v8",
|
||||
};
|
||||
return vendorMap[vendorId] || "";
|
||||
}
|
||||
async getChipFeatures(loader) {
|
||||
const features = ["Wi-Fi", "BLE"];
|
||||
const flashMap = {
|
||||
0: null,
|
||||
1: "Embedded Flash 8MB",
|
||||
2: "Embedded Flash 4MB",
|
||||
};
|
||||
const flashCap = await this.getFlashCap(loader);
|
||||
const flashVendor = await this.getFlashVendor(loader);
|
||||
const flash = flashMap[flashCap];
|
||||
const flashDescription = flash !== undefined ? flash : "Unknown Embedded Flash";
|
||||
if (flash !== null) {
|
||||
features.push(`${flashDescription} (${flashVendor})`);
|
||||
}
|
||||
const psramMap = {
|
||||
0: null,
|
||||
1: "Embedded PSRAM 8MB",
|
||||
2: "Embedded PSRAM 2MB",
|
||||
};
|
||||
const psramCap = await this.getPsramCap(loader);
|
||||
const psramVendor = await this.getPsramVendor(loader);
|
||||
const psram = psramMap[psramCap];
|
||||
const psramDescription = psram !== undefined ? psram : "Unknown Embedded PSRAM";
|
||||
if (psram !== null) {
|
||||
features.push(`${psramDescription} (${psramVendor})`);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
return 40;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async postConnect(loader) {
|
||||
const bufNo = (await loader.readReg(this.UARTDEV_BUF_NO)) & 0xff;
|
||||
loader.debug("In _post_connect " + bufNo);
|
||||
if (bufNo == this.UARTDEV_BUF_NO_USB) {
|
||||
loader.ESP_RAM_BLOCK = this.USB_RAM_BLOCK;
|
||||
}
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await loader.readReg(this.MAC_EFUSE_REG);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await loader.readReg(this.MAC_EFUSE_REG + 4);
|
||||
mac1 = (mac1 >>> 0) & 0x0000ffff;
|
||||
const mac = new Uint8Array(6);
|
||||
mac[0] = (mac1 >> 8) & 0xff;
|
||||
mac[1] = mac1 & 0xff;
|
||||
mac[2] = (mac0 >> 24) & 0xff;
|
||||
mac[3] = (mac0 >> 16) & 0xff;
|
||||
mac[4] = (mac0 >> 8) & 0xff;
|
||||
mac[5] = mac0 & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
38
node_modules/esptool-js/lib/targets/esp8266.d.ts
generated
vendored
Normal file
38
node_modules/esptool-js/lib/targets/esp8266.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
import { ROM } from "./rom.js";
|
||||
export declare class ESP8266ROM extends ROM {
|
||||
CHIP_NAME: string;
|
||||
CHIP_DETECT_MAGIC_VALUE: number[];
|
||||
EFUSE_RD_REG_BASE: number;
|
||||
UART_CLKDIV_REG: number;
|
||||
UART_CLKDIV_MASK: number;
|
||||
XTAL_CLK_DIVIDER: number;
|
||||
FLASH_WRITE_SIZE: number;
|
||||
BOOTLOADER_FLASH_OFFSET: number;
|
||||
UART_DATE_REG_ADDR: number;
|
||||
FLASH_SIZES: {
|
||||
"512KB": number;
|
||||
"256KB": number;
|
||||
"1MB": number;
|
||||
"2MB": number;
|
||||
"4MB": number;
|
||||
"2MB-c1": number;
|
||||
"4MB-c1": number;
|
||||
"8MB": number;
|
||||
"16MB": number;
|
||||
};
|
||||
SPI_REG_BASE: number;
|
||||
SPI_USR_OFFS: number;
|
||||
SPI_USR1_OFFS: number;
|
||||
SPI_USR2_OFFS: number;
|
||||
SPI_MOSI_DLEN_OFFS: number;
|
||||
SPI_MISO_DLEN_OFFS: number;
|
||||
SPI_W0_OFFS: number;
|
||||
readEfuse(loader: ESPLoader, offset: number): Promise<number>;
|
||||
getChipDescription(loader: ESPLoader): Promise<"ESP8285" | "ESP8266EX">;
|
||||
getChipFeatures: (loader: ESPLoader) => Promise<string[]>;
|
||||
getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
_d2h(d: number): string;
|
||||
readMac(loader: ESPLoader): Promise<string>;
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
}
|
118
node_modules/esptool-js/lib/targets/esp8266.js
generated
vendored
Normal file
118
node_modules/esptool-js/lib/targets/esp8266.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
import { ROM } from "./rom.js";
|
||||
export class ESP8266ROM extends ROM {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.CHIP_NAME = "ESP8266";
|
||||
this.CHIP_DETECT_MAGIC_VALUE = [0xfff0c101];
|
||||
this.EFUSE_RD_REG_BASE = 0x3ff00050;
|
||||
this.UART_CLKDIV_REG = 0x60000014;
|
||||
this.UART_CLKDIV_MASK = 0xfffff;
|
||||
this.XTAL_CLK_DIVIDER = 2;
|
||||
this.FLASH_WRITE_SIZE = 0x4000;
|
||||
// NOT IMPLEMENTED, SETTING EMPTY VALUE
|
||||
this.BOOTLOADER_FLASH_OFFSET = 0;
|
||||
this.UART_DATE_REG_ADDR = 0;
|
||||
this.FLASH_SIZES = {
|
||||
"512KB": 0x00,
|
||||
"256KB": 0x10,
|
||||
"1MB": 0x20,
|
||||
"2MB": 0x30,
|
||||
"4MB": 0x40,
|
||||
"2MB-c1": 0x50,
|
||||
"4MB-c1": 0x60,
|
||||
"8MB": 0x80,
|
||||
"16MB": 0x90,
|
||||
};
|
||||
this.SPI_REG_BASE = 0x60000200;
|
||||
this.SPI_USR_OFFS = 0x1c;
|
||||
this.SPI_USR1_OFFS = 0x20;
|
||||
this.SPI_USR2_OFFS = 0x24;
|
||||
this.SPI_MOSI_DLEN_OFFS = 0; // not in esp8266
|
||||
this.SPI_MISO_DLEN_OFFS = 0; // not in esp8266
|
||||
this.SPI_W0_OFFS = 0x40;
|
||||
this.getChipFeatures = async (loader) => {
|
||||
const features = ["WiFi"];
|
||||
if ((await this.getChipDescription(loader)) == "ESP8285")
|
||||
features.push("Embedded Flash");
|
||||
return features;
|
||||
};
|
||||
}
|
||||
async readEfuse(loader, offset) {
|
||||
const addr = this.EFUSE_RD_REG_BASE + 4 * offset;
|
||||
loader.debug("Read efuse " + addr);
|
||||
return await loader.readReg(addr);
|
||||
}
|
||||
async getChipDescription(loader) {
|
||||
const efuse3 = await this.readEfuse(loader, 2);
|
||||
const efuse0 = await this.readEfuse(loader, 0);
|
||||
const is8285 = ((efuse0 & (1 << 4)) | (efuse3 & (1 << 16))) != 0; // One or the other efuse bit is set for ESP8285
|
||||
return is8285 ? "ESP8285" : "ESP8266EX";
|
||||
}
|
||||
async getCrystalFreq(loader) {
|
||||
const uartDiv = (await loader.readReg(this.UART_CLKDIV_REG)) & this.UART_CLKDIV_MASK;
|
||||
const etsXtal = (loader.transport.baudrate * uartDiv) / 1000000 / this.XTAL_CLK_DIVIDER;
|
||||
let normXtal;
|
||||
if (etsXtal > 33) {
|
||||
normXtal = 40;
|
||||
}
|
||||
else {
|
||||
normXtal = 26;
|
||||
}
|
||||
if (Math.abs(normXtal - etsXtal) > 1) {
|
||||
loader.info("WARNING: Detected crystal freq " +
|
||||
etsXtal +
|
||||
"MHz is quite different to normalized freq " +
|
||||
normXtal +
|
||||
"MHz. Unsupported crystal in use?");
|
||||
}
|
||||
return normXtal;
|
||||
}
|
||||
_d2h(d) {
|
||||
const h = (+d).toString(16);
|
||||
return h.length === 1 ? "0" + h : h;
|
||||
}
|
||||
async readMac(loader) {
|
||||
let mac0 = await this.readEfuse(loader, 0);
|
||||
mac0 = mac0 >>> 0;
|
||||
let mac1 = await this.readEfuse(loader, 1);
|
||||
mac1 = mac1 >>> 0;
|
||||
let mac3 = await this.readEfuse(loader, 3);
|
||||
mac3 = mac3 >>> 0;
|
||||
const mac = new Uint8Array(6);
|
||||
if (mac3 != 0) {
|
||||
mac[0] = (mac3 >> 16) & 0xff;
|
||||
mac[1] = (mac3 >> 8) & 0xff;
|
||||
mac[2] = mac3 & 0xff;
|
||||
}
|
||||
else if (((mac1 >> 16) & 0xff) == 0) {
|
||||
mac[0] = 0x18;
|
||||
mac[1] = 0xfe;
|
||||
mac[2] = 0x34;
|
||||
}
|
||||
else if (((mac1 >> 16) & 0xff) == 1) {
|
||||
mac[0] = 0xac;
|
||||
mac[1] = 0xd0;
|
||||
mac[2] = 0x74;
|
||||
}
|
||||
else {
|
||||
loader.error("Unknown OUI");
|
||||
}
|
||||
mac[3] = (mac1 >> 8) & 0xff;
|
||||
mac[4] = mac1 & 0xff;
|
||||
mac[5] = (mac0 >> 24) & 0xff;
|
||||
return (this._d2h(mac[0]) +
|
||||
":" +
|
||||
this._d2h(mac[1]) +
|
||||
":" +
|
||||
this._d2h(mac[2]) +
|
||||
":" +
|
||||
this._d2h(mac[3]) +
|
||||
":" +
|
||||
this._d2h(mac[4]) +
|
||||
":" +
|
||||
this._d2h(mac[5]));
|
||||
}
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
83
node_modules/esptool-js/lib/targets/rom.d.ts
generated
vendored
Normal file
83
node_modules/esptool-js/lib/targets/rom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
import { ESPLoader } from "../esploader.js";
|
||||
/**
|
||||
* Represents a chip ROM with basic registers field and abstract functions.
|
||||
*/
|
||||
export declare abstract class ROM {
|
||||
/**
|
||||
* Read ESP32 eFuse.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @param {number} offset - Offset to start erase.
|
||||
* @returns {number} The eFuse number.
|
||||
*/
|
||||
protected readEfuse?(loader: ESPLoader, offset: number): Promise<number>;
|
||||
/**
|
||||
* Get the package version number.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {number} The package version number.
|
||||
*/
|
||||
protected getPkgVersion?(loader: ESPLoader): Promise<number>;
|
||||
/**
|
||||
* Get the chip revision number.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {number} The chip revision number.
|
||||
*/
|
||||
protected getChipRevision?(loader: ESPLoader): Promise<number>;
|
||||
/**
|
||||
* Get the chip description.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The chip description as string.
|
||||
*/
|
||||
abstract getChipDescription(loader: ESPLoader): Promise<string>;
|
||||
/**
|
||||
* Get the chip features.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The chip features as string.
|
||||
*/
|
||||
abstract getChipFeatures(loader: ESPLoader): Promise<string[]>;
|
||||
/**
|
||||
* Get the crystal frequency for the chip.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The crystal frequency as number.
|
||||
*/
|
||||
abstract getCrystalFreq(loader: ESPLoader): Promise<number>;
|
||||
/**
|
||||
* Convert a number to hex string.
|
||||
* @param {number} d - Number to convert to hex string.
|
||||
* @returns {string} The hex string.
|
||||
*/
|
||||
abstract _d2h(d: number): string;
|
||||
/**
|
||||
* Get the chip mac address.
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
* @returns {string} The mac address string.
|
||||
*/
|
||||
abstract readMac(loader: ESPLoader): Promise<string>;
|
||||
/**
|
||||
* Function to be executed after chip connection
|
||||
* @param {ESPLoader} loader - Loader class to communicate with chip.
|
||||
*/
|
||||
postConnect?(loader: ESPLoader): Promise<void>;
|
||||
/**
|
||||
* Get the chip erase size.
|
||||
* @param {number} offset - Offset to start erase.
|
||||
* @param {number} size - Size to erase.
|
||||
* @returns {number} The erase size of the chip as number.
|
||||
*/
|
||||
getEraseSize(offset: number, size: number): number;
|
||||
abstract FLASH_SIZES: {
|
||||
[key: string]: number;
|
||||
};
|
||||
abstract BOOTLOADER_FLASH_OFFSET: number;
|
||||
abstract CHIP_NAME: string;
|
||||
abstract FLASH_WRITE_SIZE: number;
|
||||
abstract SPI_MOSI_DLEN_OFFS: number;
|
||||
abstract SPI_MISO_DLEN_OFFS: number;
|
||||
abstract SPI_REG_BASE: number;
|
||||
abstract SPI_USR_OFFS: number;
|
||||
abstract SPI_USR1_OFFS: number;
|
||||
abstract SPI_USR2_OFFS: number;
|
||||
abstract SPI_W0_OFFS: number;
|
||||
abstract UART_CLKDIV_MASK: number;
|
||||
abstract UART_CLKDIV_REG: number;
|
||||
abstract UART_DATE_REG_ADDR: number;
|
||||
}
|
14
node_modules/esptool-js/lib/targets/rom.js
generated
vendored
Normal file
14
node_modules/esptool-js/lib/targets/rom.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Represents a chip ROM with basic registers field and abstract functions.
|
||||
*/
|
||||
export class ROM {
|
||||
/**
|
||||
* Get the chip erase size.
|
||||
* @param {number} offset - Offset to start erase.
|
||||
* @param {number} size - Size to erase.
|
||||
* @returns {number} The erase size of the chip as number.
|
||||
*/
|
||||
getEraseSize(offset, size) {
|
||||
return size;
|
||||
}
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"entry": 1074521580,
|
||||
"text": "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",
|
||||
"text_start": 1074520064,
|
||||
"data": "DMD8P+znC0B/6AtAZ+0LQAbpC0Cf6AtABukLQGXpC0CC6gtA9OoLQJ3qC0CV5wtAGuoLQHTqC0CI6QtAGOsLQLDpC0AY6wtAbegLQMroC0AG6QtAZekLQIXoC0DI6wtAKe0LQLjmC0BL7QtAuOYLQLjmC0C45gtAuOYLQLjmC0C45gtAuOYLQLjmC0Bv6wtAuOYLQEnsC0Ap7QtA",
|
||||
"data_start": 1073605544,
|
||||
"bss_start": 1073528832
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c2.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c2.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"entry": 1077413304,
|
||||
"text": "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",
|
||||
"text_start": 1077411840,
|
||||
"data": "DEDKP+AIOEAsCThAhAk4QFIKOEC+CjhAbAo4QKgHOEAOCjhATgo4QJgJOEBYBzhAzAk4QFgHOEC6CDhA/gg4QCwJOECECThAzAg4QBIIOEBCCDhAyAg4QBYNOEAsCThA1gs4QMoMOECkBjhA9Aw4QKQGOECkBjhApAY4QKQGOECkBjhApAY4QKQGOECkBjhAcgs4QKQGOEDyCzhAygw4QA==",
|
||||
"data_start": 1070295976,
|
||||
"bss_start": 1070219264
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c3.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c3.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c5.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c5.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c6.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c6.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c61.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32c61.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32h2.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32h2.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32p4.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32p4.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"entry": 1341195918,
|
||||
"text": "QREixCbCBsa3Jw1QEUc3BPVP2Mu3JA1QEwQEANxAkYuR57JAIkSSREEBgoCIQBxAE3X1D4KX3bcBEbenDFBOxoOphwBKyDcJ9U8mylLEBs4izLekDFB9WhMJCQDATBN09D8N4PJAYkQjqDQBQknSRLJJIkoFYYKAiECDJwkAE3X1D4KXfRTjGUT/yb8TBwAMlEGqh2MY5QCFR4XGI6AFAHlVgoAFR2OH5gAJRmONxgB9VYKAQgUTB7ANQYVjlecCiUecwfW3kwbADWMW1QCYwRMFAAyCgJMG0A19VWOV1wCYwRMFsA2CgLc19k9BEZOFRboGxmE/Y0UFBrc39k+Th8exA6cHCAPWRwgTdfUPkwYWAMIGwYIjktcIMpcjAKcAA9dHCJFnk4cHBGMe9wI3t/VPEwfHsaFnupcDpgcIt/b1T7c39k+Th8exk4bGtWMf5gAjpscII6DXCCOSBwghoPlX4wb1/LJAQQGCgCOm1wgjoOcI3bc31whQfEudi/X/N8cIUHxLnYv1/4KAQREGxt03t9cIUCOmBwI3BwAImMOYQ33/yFeyQBNF9f8FiUEBgoBBEQbG2T993TcHAEC31whQmMM31whQHEP9/7JAQQGCgEERIsQ3hPVPkwcEAUrAA6kHAQbGJsJjCgkERTc5xb1HEwQEAYFEY9YnAQREvYiTtBQAfTeFPxxENwaAABOXxwCZ4DcGAAG39v8AdY+31ghQ2MKQwphCff9BR5HgBUczCelAupcjKCQBHMSyQCJEkkQCSUEBgoABEQbOIswlNzcE9E9sABMFxP6XAM//54Ag86qHBUWV57JHk/cHID7GiTc31whQHEe3BkAAEwXE/tWPHMeyRZcAz//ngKDwMzWgAPJAYkQFYYKAQRG3h/VPBsaThwcBBUcjgOcAE9fFAJjHBWd9F8zDyMf5jTqVqpWxgYzLI6oHAEE3GcETBVAMskBBAYKAAREizDeE9U+TBwQBJsrER07GBs5KyKqJEwQEAWPzlQCuhKnAAylEACaZE1nJABxIY1XwABxEY175ArU9fd1IQCaGzoWXAM//54Cg4xN19Q8BxZMHQAxcyFxAppdcwFxEhY9cxPJAYkTSREJJskkFYYKAaTVtv0ERBsaXAM//54BA1gNFhQGyQGkVEzUVAEEBgoBBEQbGxTcRwRlFskBBARcDz/9nAOPPQREGxibCIsSqhJcAz//ngADNdT8NyTcH9U+TBgcAg9dGABMEBwCFB8IHwYMjkvYAkwYADGOG1AATB+ADY3X3AG03IxIEALJAIkSSREEBgoBBEQbGEwcADGMa5QATBbANRTcTBcANskBBAVm/EwewDeMb5f5xNxMF0A31t0ERIsQmwgbGKoSzBLUAYxeUALJAIkSSREEBgoADRQQABQRNP+23NXEmy07H/XKFaf10Is1KyVLFVsMGz5OEhPoWkZOHCQemlxgIs4TnACqJJoUuhJcAz//ngOAZk4cJBxgIBWq6l7OKR0Ex5AVnfXWTBYX6kwcHBxMFhfkUCKqXM4XXAJMHBweul7OF1wAqxpcAz//ngKAWMkXBRZU3AUWFYhaR+kBqRNpESkm6SSpKmkoNYYKAooljc4oAhWlOhtaFSoWXAM//54CgyRN19Q8B7U6G1oUmhZcAz//ngOARTpkzBDRBUbcTBTAGVb8TBQAMSb0xcf1yBWdO11LVVtNezwbfIt0m20rZWtFizWbLaslux/13FpETBwcHPpccCLqXPsYjqgf4qokuirKKtosNNZMHAAIZwbcHAgA+hZcAz//ngIAKhWdj5VcTBWR9eRMJifqTBwQHypcYCDOJ5wBKhZcAz//ngAAJfXsTDDv5kwyL+RMHBAeTBwQHFAhil+aXgUQzDNcAs4zXAFJNY3xNCWPxpANBqJk/ooUIAY01uTcihgwBSoWXAM//54DgBKKZopRj9UQDs4ekQWPxdwMzBJpAY/OKAFaEIoYMAU6FlwDP/+eA4LgTdfUPVd0CzAFEeV2NTaMJAQBihZcAz//ngKCnffkDRTEB5oVZPGNPBQDj4o3+hWeThwcHopcYCLqX2pcjiqf4BQTxt+MVpf2RR+MF9PYFZ311kwcHB5MFhfoTBYX5FAiqlzOF1wCTBwcHrpezhdcAKsaXAM//54AA+3E9MkXBRWUzUT3dObcHAgAZ4ZMHAAI+hZcAz//ngAD4hWIWkfpQalTaVEpZulkqWppaClv6S2pM2kxKTbpNKWGCgLdXQUkZcZOH94QBRYbeotym2srYztbS1NbS2tDezuLM5srqyO7GPs6XAM//54DgoHkxBcU3R9hQt2cRUBMHF6qYzyOgBwAjrAcAmNPYT7cGBABVj9jPI6AHArcH9U83N/ZPk4cHABMHx7ohoCOgBwCRB+Pt5/7VM5FFaAjFOfE7t7f1T5OHx7EhZz6XIyD3CLcH8U83CfVPk4eHDiMg+QC3OfZPKTmTicmxEwkJAGMFBRC3Zw1QEwcQArjPhUVFRZcAz//ngKDmtwXxTwFGk4UFAEVFlwDP/+eAoOe3Jw1QEUeYyzcFAgCXAM//54Dg5rcHDlCIX4FFt4T1T3GJYRUTNRUAlwDP/+eAYKXBZ/0XEwcAEIVmQWa3BQABAUWThAQBtwr1Tw1qlwDP/+eAIJsTiwoBJpqDp8kI9d+Dq8kIhUcjpgkIIwLxAoPHGwAJRyMT4QKjAvECAtRNR2OB5whRR2OP5wYpR2Of5wCDxzsAA8crAKIH2Y8RR2OW5wCDp4sAnEM+1NE5oUVIEMU2g8c7AAPHKwCiB9mPEWdBB2N09wQTBbANqTYTBcANkTYTBeAOPT5dMUG3twXxTwFGk4WFAxVFlwDP/+eAoNg3pwxQXEcTBQACk+cXEFzHMbfJRyMT8QJNtwPHGwDRRmPn5gKFRmPm5gABTBME8A+FqHkXE3f3D8lG4+jm/rc29k8KB5OGBrs2lxhDAoeTBgcDk/b2DxFG42nW/BMH9wITd/cPjUZj6+YItzb2TwoHk4bGvzaXGEMChxMHQAJjl+cQAtQdRAFFcTwBReU0ATH9PqFFSBB9FCE2dfQBTAFEE3X0D8E8E3X8D+k0zTbjHgTqg8cbAElHY2v3MAlH43b36vUXk/f3Dz1H42D36jc39k+KBxMHx8C6l5xDgocFRJ3rcBCBRQFFl/DO/+eAoHcd4dFFaBBtNAFEMagFRIHvl/DO/+eAIH0zNKAAKaAhR2OF5wAFRAFMYbcDrIsAA6TLALNnjADSB/X30TBl9cFsIpz9HH19MwWMQF3cs3eVAZXjwWwzBYxAY+aMAv18MwWMQF3QMYGX8M7/54DAeV35ZpT1tzGBl/DO/+eAwHhd8WqU0bdBgZfwzv/ngAB4WfkzBJRBwbchR+OK5/ABTBMEAAw5t0FHzb9BRwVE453n9oOlywADpYsAOTy5v0FHBUTjk+f2A6cLAZFnY+7nHoOlSwEDpYsA7/C/hz2/QUcFROOT5/SDpwsBEWdjbvccA6fLAIOlSwEDpYsAM4TnAu/wP4UjrAQAIySKsDm3A8cEAGMHBxQDp4sAwRcTBAAMYxP3AMBIAUeTBvAOY0b3AoPHWwADx0sAAUyiB9mPA8drAEIHXY+Dx3sA4gfZj+OC9uYTBBAMsb0zhusAA0aGAQUHsY7ht4PHBAD9y9xEY5EHFsBII4AEAEW9YUdjlucCg6fLAQOniwGDpksBA6YLAYOlywADpYsAl/DO/+eAgGgqjDM0oAAxtQFMBUQZtRFHBUTjm+fmtxcOUPRfZXd9FwVm+Y7RjgOliwCThQcI9N+UQfmO0Y6UwZOFRwiUQfmO0Y6UwbRfgUV1j1GPuN+X8M7/54AgaxG9E/f3AOMRB+qT3EcAE4SLAAFMfV3jcZzbSESX8M7/54AgThhEVEAQQPmOYwenARxCE0f3/32P2Y4UwgUMQQTZvxFHhbVBRwVE45Tn3oOniwADp0sBIyb5ACMk6QBdu4MliQDBF5Hlic8BTBMEYAyxswMnyQBjZvcGE/c3AOMVB+IDKMkAAUYBRzMF6ECzhuUAY2n3AOMBBtIjJqkAIyTZABm7M4brABBOEQeQwgVG6b8hRwVE457n1gMkyQAZwBMEgAwjJgkAIyQJADM0gACNswFMEwQgDNWxAUwTBIAM8bkBTBMEkAzRuRMHIA1jg+cMEwdADeOY57gDxDsAg8crACIEXYyX8M7/54AATgOsxABBFGNzhAEijOMGDLbAQGKUMYCcSGNV8ACcRGNb9Arv8O/Rdd3IQGKGk4WLAZfwzv/ngABKAcWTB0AM3MjcQOKX3MDcRLOHh0HcxJfwzv/ngOBIDbYJZRMFBXEDrMsAA6SLAJfwzv/ngKA4t6cMUNhLtwYAAcEWk1dHARIHdY+9i9mPs4eHAwFFs9WHApfwzv/ngAA6EwWAPpfwzv/ngEA10byDpksBA6YLAYOlywADpYsA7/DP/n28g8U7AIPHKwAThYsBogXdjcEV7/DP21207/Avyz2/A8Q7AIPHKwATjIsBIgRdjNxEQRTN45FHhUtj/4cIkweQDNzIrbwDpw0AItAFSLOH7EA+1oMnirBjc/QADUhCxjrE7/CvxiJHMkg3hfVP4oV8EJOGCgEQEBMFhQKX8M7/54BgNze39U+TCAcBglcDp4iwg6UNAB2MHY8+nLJXI6TosKqLvpUjoL0Ak4cKAZ2NAcWhZ2OX9QBahe/wb9EjoG0BCcTcRJnD409w92PfCwCTB3AMvbeFS7c99k+3jPVPk43NupOMDAHpv+OaC5zcROOHB5yTB4AMqbeDp4sA45AHnO/wD9YJZRMFBXGX8M7/54CgIpfwzv/ngKAnTbIDpMsA4w4EmO/wz9MTBYA+l/DO/+eAgCAClFmy9lBmVNZURlm2WSZalloGW/ZLZkzWTEZNtk0JYYKAAAA=",
|
||||
"text_start": 1341194240,
|
||||
"data": "EAD1TwYK8U9WCvFPrgrxT4QL8U/wC/FPngvxT9QI8U9AC/FPgAvxT8IK8U+ECPFP9grxT4QI8U/gCfFPJgrxT1YK8U+uCvFP8gnxTzgJ8U9oCfFP7gnxT0AO8U9WCvFPCA3xTwAO8U/EB/FPJA7xT8QH8U/EB/FPxAfxT8QH8U/EB/FPxAfxT8QH8U/EB/FPpAzxT8QH8U8mDfFPAA7xTw==",
|
||||
"data_start": 1341533100,
|
||||
"bss_start": 1341456384
|
||||
}
|
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s2.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s2.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s3.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_32s3.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_8266.json
generated
vendored
Normal file
8
node_modules/esptool-js/lib/targets/stub_flasher/stub_flasher_8266.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
node_modules/esptool-js/lib/types/error.d.ts
generated
vendored
Normal file
11
node_modules/esptool-js/lib/types/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Represents a Espressif chip error.
|
||||
*/
|
||||
declare class ESPError extends Error {
|
||||
}
|
||||
/**
|
||||
* Represents a Espressif timeout chip error.
|
||||
*/
|
||||
declare class TimeoutError extends ESPError {
|
||||
}
|
||||
export { ESPError, TimeoutError };
|
11
node_modules/esptool-js/lib/types/error.js
generated
vendored
Normal file
11
node_modules/esptool-js/lib/types/error.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Represents a Espressif chip error.
|
||||
*/
|
||||
class ESPError extends Error {
|
||||
}
|
||||
/**
|
||||
* Represents a Espressif timeout chip error.
|
||||
*/
|
||||
class TimeoutError extends ESPError {
|
||||
}
|
||||
export { ESPError, TimeoutError };
|
49
node_modules/esptool-js/lib/types/flashOptions.d.ts
generated
vendored
Normal file
49
node_modules/esptool-js/lib/types/flashOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Options for flashing a device with firmware.
|
||||
* @interface FlashOptions
|
||||
*/
|
||||
export interface FlashOptions {
|
||||
/**
|
||||
* An array of file objects representing the data to be flashed.
|
||||
* @type {Array<{ data: string; address: number }>}
|
||||
*/
|
||||
fileArray: {
|
||||
data: string;
|
||||
address: number;
|
||||
}[];
|
||||
/**
|
||||
* The size of the flash memory to be used.
|
||||
* @type {string}
|
||||
*/
|
||||
flashSize: string;
|
||||
/**
|
||||
* The flash mode to be used (e.g., QIO, QOUT, DIO, DOUT).
|
||||
* @type {string}
|
||||
*/
|
||||
flashMode: string;
|
||||
/**
|
||||
* The flash frequency to be used (e.g., 40MHz, 80MHz).
|
||||
* @type {string}
|
||||
*/
|
||||
flashFreq: string;
|
||||
/**
|
||||
* Flag indicating whether to erase all existing data in the flash memory before flashing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
eraseAll: boolean;
|
||||
/**
|
||||
* Flag indicating whether to compress the data before flashing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
compress: boolean;
|
||||
/**
|
||||
* A function to report the progress of the flashing operation (optional).
|
||||
* @type {(fileIndex: number, written: number, total: number) => void}
|
||||
*/
|
||||
reportProgress?: (fileIndex: number, written: number, total: number) => void;
|
||||
/**
|
||||
* A function to calculate the MD5 hash of the firmware image (optional).
|
||||
* @type {(image: string) => string}
|
||||
*/
|
||||
calculateMD5Hash?: (image: string) => string;
|
||||
}
|
1
node_modules/esptool-js/lib/types/flashOptions.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/flashOptions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
54
node_modules/esptool-js/lib/types/loaderOptions.d.ts
generated
vendored
Normal file
54
node_modules/esptool-js/lib/types/loaderOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/// <reference types="w3c-web-serial" />
|
||||
import { ResetConstructors } from "../reset";
|
||||
import { Transport } from "../webserial";
|
||||
import { IEspLoaderTerminal } from "./loaderTerminal";
|
||||
/**
|
||||
* Options to configure ESPLoader.
|
||||
* @interface LoaderOptions
|
||||
*/
|
||||
export interface LoaderOptions {
|
||||
/**
|
||||
* The transport mechanism to communicate with the device.
|
||||
* @type {Transport}
|
||||
*/
|
||||
transport: Transport;
|
||||
/**
|
||||
* The port to initialize the transport class.
|
||||
* @type {SerialPort}
|
||||
*/
|
||||
port?: SerialPort;
|
||||
/**
|
||||
* Set of options for SerialPort class.
|
||||
* @type {Transport}
|
||||
*/
|
||||
serialOptions?: SerialOptions;
|
||||
/**
|
||||
* The baud rate to be used for communication with the device.
|
||||
* @type {number}
|
||||
*/
|
||||
baudrate: number;
|
||||
/**
|
||||
* An optional terminal interface to interact with the loader during the process.
|
||||
* @type {IEspLoaderTerminal}
|
||||
*/
|
||||
terminal?: IEspLoaderTerminal;
|
||||
/**
|
||||
* The baud rate to be used during the initial ROM communication with the device.
|
||||
* @type {number}
|
||||
*/
|
||||
romBaudrate: number;
|
||||
/**
|
||||
* Flag indicating whether to enable debug logging for the loader (optional).
|
||||
* @type {boolean}
|
||||
*/
|
||||
debugLogging?: boolean;
|
||||
/**
|
||||
* Reset functions for connection. If undefined will use default ones.
|
||||
* @type {ResetConstructors}
|
||||
*/
|
||||
resetConstructors?: ResetConstructors;
|
||||
/**
|
||||
* Indicate if trace messages should be enabled or not.
|
||||
*/
|
||||
enableTracing?: boolean;
|
||||
}
|
1
node_modules/esptool-js/lib/types/loaderOptions.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/loaderOptions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
22
node_modules/esptool-js/lib/types/loaderTerminal.d.ts
generated
vendored
Normal file
22
node_modules/esptool-js/lib/types/loaderTerminal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* A wrapper around your implementation of a terminal by
|
||||
* implementing the clean, write and writeLine methods
|
||||
* which are called by the ESPLoader class.
|
||||
* @interface IEspLoaderTerminal
|
||||
*/
|
||||
export interface IEspLoaderTerminal {
|
||||
/**
|
||||
* Execute a terminal clean command.
|
||||
*/
|
||||
clean: () => void;
|
||||
/**
|
||||
* Write a string of data that include a line terminator.
|
||||
* @param {string} data - The string to write with line terminator.
|
||||
*/
|
||||
writeLine: (data: string) => void;
|
||||
/**
|
||||
* Write a string of data.
|
||||
* @param {string} data - The string to write.
|
||||
*/
|
||||
write: (data: string) => void;
|
||||
}
|
1
node_modules/esptool-js/lib/types/loaderTerminal.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/loaderTerminal.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
8
node_modules/esptool-js/lib/types/resetModes.d.ts
generated
vendored
Normal file
8
node_modules/esptool-js/lib/types/resetModes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Reset modes that can be used before connection to chip
|
||||
*/
|
||||
export declare type Before = "default_reset" | "usb_reset" | "no_reset" | "no_reset_no_sync";
|
||||
/**
|
||||
* Reset modes that can be used after operation is finished.
|
||||
*/
|
||||
export declare type After = "hard_reset" | "soft_reset" | "no_reset" | "no_reset_stub";
|
1
node_modules/esptool-js/lib/types/resetModes.js
generated
vendored
Normal file
1
node_modules/esptool-js/lib/types/resetModes.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
8
node_modules/esptool-js/lib/util.d.ts
generated
vendored
Normal file
8
node_modules/esptool-js/lib/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Pad to the next alignment boundary
|
||||
* @param {Uint8Array} data Uint8Array data to pad
|
||||
* @param {number} alignment Alignment boundary to fulfill
|
||||
* @param {number} padCharacter Character to fill with
|
||||
* @returns {Uint8Array} Padded UInt8Array image
|
||||
*/
|
||||
export declare function padTo(data: Uint8Array, alignment: number, padCharacter?: number): Uint8Array;
|
18
node_modules/esptool-js/lib/util.js
generated
vendored
Normal file
18
node_modules/esptool-js/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Pad to the next alignment boundary
|
||||
* @param {Uint8Array} data Uint8Array data to pad
|
||||
* @param {number} alignment Alignment boundary to fulfill
|
||||
* @param {number} padCharacter Character to fill with
|
||||
* @returns {Uint8Array} Padded UInt8Array image
|
||||
*/
|
||||
export function padTo(data, alignment, padCharacter = 0xff) {
|
||||
const padMod = data.length % alignment;
|
||||
if (padMod !== 0) {
|
||||
const padding = new Uint8Array(alignment - padMod).fill(padCharacter);
|
||||
const paddedData = new Uint8Array(data.length + padding.length);
|
||||
paddedData.set(data);
|
||||
paddedData.set(padding, data.length);
|
||||
return paddedData;
|
||||
}
|
||||
return data;
|
||||
}
|
154
node_modules/esptool-js/lib/webserial.d.ts
generated
vendored
Normal file
154
node_modules/esptool-js/lib/webserial.d.ts
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
/// <reference types="w3c-web-serial" />
|
||||
/**
|
||||
* Options for device serialPort.
|
||||
* @interface SerialOptions
|
||||
*
|
||||
* Note: According to the documentation of the Web Serial API, 'baudRate' is a
|
||||
* 'required' field as part of serial options. However, we are currently
|
||||
* maintaining 'baudRate' as a separate parameter outside the options
|
||||
* dictionary, and it is effectively used in the code. For now, we are
|
||||
* keeping it optional in the dictionary to avoid conflicts.
|
||||
*/
|
||||
export interface SerialOptions {
|
||||
/**
|
||||
* A positive, non-zero value indicating the baud rate at which serial communication should be established.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
baudRate?: number | undefined;
|
||||
/**
|
||||
* The number of data bits per frame. Either 7 or 8.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
dataBits?: number | undefined;
|
||||
/**
|
||||
* The number of stop bits at the end of a frame. Either 1 or 2.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
stopBits?: number | undefined;
|
||||
/**
|
||||
* The parity mode: none, even or odd
|
||||
* @type {ParityType | undefined}
|
||||
*/
|
||||
parity?: ParityType | undefined;
|
||||
/**
|
||||
* A positive, non-zero value indicating the size of the read and write buffers that should be created.
|
||||
* @type {number | undefined}
|
||||
*/
|
||||
bufferSize?: number | undefined;
|
||||
/**
|
||||
* The flow control mode: none or hardware.
|
||||
* @type {FlowControlType | undefined}
|
||||
*/
|
||||
flowControl?: FlowControlType | undefined;
|
||||
}
|
||||
/**
|
||||
* Wrapper class around Webserial API to communicate with the serial device.
|
||||
* @param {typeof import("w3c-web-serial").SerialPort} device - Requested device prompted by the browser.
|
||||
*
|
||||
* ```
|
||||
* const port = await navigator.serial.requestPort();
|
||||
* ```
|
||||
*/
|
||||
declare class Transport {
|
||||
device: SerialPort;
|
||||
tracing: boolean;
|
||||
slipReaderEnabled: boolean;
|
||||
baudrate: number;
|
||||
private traceLog;
|
||||
private lastTraceTime;
|
||||
private reader;
|
||||
private buffer;
|
||||
constructor(device: SerialPort, tracing?: boolean, enableSlipReader?: boolean);
|
||||
/**
|
||||
* Request the serial device vendor ID and Product ID as string.
|
||||
* @returns {string} Return the device VendorID and ProductID from SerialPortInfo as formatted string.
|
||||
*/
|
||||
getInfo(): string;
|
||||
/**
|
||||
* Request the serial device product id from SerialPortInfo.
|
||||
* @returns {number | undefined} Return the product ID.
|
||||
*/
|
||||
getPid(): number | undefined;
|
||||
/**
|
||||
* Format received or sent data for tracing output.
|
||||
* @param {string} message Message to format as trace line.
|
||||
*/
|
||||
trace(message: string): void;
|
||||
returnTrace(): Promise<void>;
|
||||
hexify(s: Uint8Array): string;
|
||||
hexConvert(uint8Array: Uint8Array, autoSplit?: boolean): string;
|
||||
/**
|
||||
* Format data packet using the Serial Line Internet Protocol (SLIP).
|
||||
* @param {Uint8Array} data Binary unsigned 8 bit array data to format.
|
||||
* @returns {Uint8Array} Formatted unsigned 8 bit data array.
|
||||
*/
|
||||
slipWriter(data: Uint8Array): Uint8Array;
|
||||
/**
|
||||
* Write binary data to device using the WebSerial device writable stream.
|
||||
* @param {Uint8Array} data 8 bit unsigned data array to write to device.
|
||||
*/
|
||||
write(data: Uint8Array): Promise<void>;
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {Uint8Array} arr1 - First array buffer.
|
||||
* @param {Uint8Array} arr2 - magic hex number to select ROM.
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned array.
|
||||
*/
|
||||
appendArray(arr1: Uint8Array, arr2: Uint8Array): Uint8Array;
|
||||
private readLoop;
|
||||
newRead(numBytes: number, timeout: number): Promise<Uint8Array>;
|
||||
flushInput(): Promise<void>;
|
||||
flushOutput(): Promise<void>;
|
||||
inWaiting(): number;
|
||||
/**
|
||||
* Detect if the data read from device is a Fatal or Guru meditation error.
|
||||
* @param {Uint8Array} input Data read from device
|
||||
*/
|
||||
private detectPanicHandler;
|
||||
private SLIP_END;
|
||||
private SLIP_ESC;
|
||||
private SLIP_ESC_END;
|
||||
private SLIP_ESC_ESC;
|
||||
/**
|
||||
* Take a data array and return the first well formed packet after
|
||||
* replacing the escape sequence. Reads at least 8 bytes.
|
||||
* @param {number} timeout Timeout read data.
|
||||
* @yields {Uint8Array} Formatted packet using SLIP escape sequences.
|
||||
*/
|
||||
read(timeout: number): AsyncGenerator<Uint8Array>;
|
||||
/**
|
||||
* Read from serial device without slip formatting.
|
||||
* @yields {Uint8Array} The next number in the Fibonacci sequence.
|
||||
*/
|
||||
rawRead(): AsyncGenerator<Uint8Array>;
|
||||
_DTR_state: boolean;
|
||||
/**
|
||||
* Send the RequestToSend (RTS) signal to given state
|
||||
* # True for EN=LOW, chip in reset and False EN=HIGH, chip out of reset
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
setRTS(state: boolean): Promise<void>;
|
||||
/**
|
||||
* Send the dataTerminalReady (DTS) signal to given state
|
||||
* # True for IO0=LOW, chip in reset and False IO0=HIGH
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
setDTR(state: boolean): Promise<void>;
|
||||
/**
|
||||
* Connect to serial device using the Webserial open method.
|
||||
* @param {number} baud Number baud rate for serial connection. Default is 115200.
|
||||
* @param {typeof import("w3c-web-serial").SerialOptions} serialOptions Serial Options for WebUSB SerialPort class.
|
||||
*/
|
||||
connect(baud?: number, serialOptions?: SerialOptions): Promise<void>;
|
||||
sleep(ms: number): Promise<unknown>;
|
||||
/**
|
||||
* Wait for a given timeout ms for serial device unlock.
|
||||
* @param {number} timeout Timeout time in milliseconds (ms) to sleep
|
||||
*/
|
||||
waitForUnlock(timeout: number): Promise<void>;
|
||||
/**
|
||||
* Disconnect from serial device by running SerialPort.close() after streams unlock.
|
||||
*/
|
||||
disconnect(): Promise<void>;
|
||||
}
|
||||
export { Transport };
|
383
node_modules/esptool-js/lib/webserial.js
generated
vendored
Normal file
383
node_modules/esptool-js/lib/webserial.js
generated
vendored
Normal file
@@ -0,0 +1,383 @@
|
||||
/* global SerialPort, ParityType, FlowControlType */
|
||||
/**
|
||||
* Wrapper class around Webserial API to communicate with the serial device.
|
||||
* @param {typeof import("w3c-web-serial").SerialPort} device - Requested device prompted by the browser.
|
||||
*
|
||||
* ```
|
||||
* const port = await navigator.serial.requestPort();
|
||||
* ```
|
||||
*/
|
||||
class Transport {
|
||||
constructor(device, tracing = false, enableSlipReader = true) {
|
||||
this.device = device;
|
||||
this.tracing = tracing;
|
||||
this.slipReaderEnabled = false;
|
||||
this.baudrate = 0;
|
||||
this.traceLog = "";
|
||||
this.lastTraceTime = Date.now();
|
||||
this.buffer = new Uint8Array(0);
|
||||
this.SLIP_END = 0xc0;
|
||||
this.SLIP_ESC = 0xdb;
|
||||
this.SLIP_ESC_END = 0xdc;
|
||||
this.SLIP_ESC_ESC = 0xdd;
|
||||
this._DTR_state = false;
|
||||
this.slipReaderEnabled = enableSlipReader;
|
||||
}
|
||||
/**
|
||||
* Request the serial device vendor ID and Product ID as string.
|
||||
* @returns {string} Return the device VendorID and ProductID from SerialPortInfo as formatted string.
|
||||
*/
|
||||
getInfo() {
|
||||
const info = this.device.getInfo();
|
||||
return info.usbVendorId && info.usbProductId
|
||||
? `WebSerial VendorID 0x${info.usbVendorId.toString(16)} ProductID 0x${info.usbProductId.toString(16)}`
|
||||
: "";
|
||||
}
|
||||
/**
|
||||
* Request the serial device product id from SerialPortInfo.
|
||||
* @returns {number | undefined} Return the product ID.
|
||||
*/
|
||||
getPid() {
|
||||
return this.device.getInfo().usbProductId;
|
||||
}
|
||||
/**
|
||||
* Format received or sent data for tracing output.
|
||||
* @param {string} message Message to format as trace line.
|
||||
*/
|
||||
trace(message) {
|
||||
const delta = Date.now() - this.lastTraceTime;
|
||||
const prefix = `TRACE ${delta.toFixed(3)}`;
|
||||
const traceMessage = `${prefix} ${message}`;
|
||||
console.log(traceMessage);
|
||||
this.traceLog += traceMessage + "\n";
|
||||
}
|
||||
async returnTrace() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(this.traceLog);
|
||||
console.log("Text copied to clipboard!");
|
||||
}
|
||||
catch (err) {
|
||||
console.error("Failed to copy text:", err);
|
||||
}
|
||||
}
|
||||
hexify(s) {
|
||||
return Array.from(s)
|
||||
.map((byte) => byte.toString(16).padStart(2, "0"))
|
||||
.join("")
|
||||
.padEnd(16, " ");
|
||||
}
|
||||
hexConvert(uint8Array, autoSplit = true) {
|
||||
if (autoSplit && uint8Array.length > 16) {
|
||||
let result = "";
|
||||
let s = uint8Array;
|
||||
while (s.length > 0) {
|
||||
const line = s.slice(0, 16);
|
||||
const asciiLine = String.fromCharCode(...line)
|
||||
.split("")
|
||||
.map((c) => (c === " " || (c >= " " && c <= "~" && c !== " ") ? c : "."))
|
||||
.join("");
|
||||
s = s.slice(16);
|
||||
result += `\n ${this.hexify(line.slice(0, 8))} ${this.hexify(line.slice(8))} | ${asciiLine}`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return this.hexify(uint8Array);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format data packet using the Serial Line Internet Protocol (SLIP).
|
||||
* @param {Uint8Array} data Binary unsigned 8 bit array data to format.
|
||||
* @returns {Uint8Array} Formatted unsigned 8 bit data array.
|
||||
*/
|
||||
slipWriter(data) {
|
||||
const outData = [];
|
||||
outData.push(0xc0);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i] === 0xdb) {
|
||||
outData.push(0xdb, 0xdd);
|
||||
}
|
||||
else if (data[i] === 0xc0) {
|
||||
outData.push(0xdb, 0xdc);
|
||||
}
|
||||
else {
|
||||
outData.push(data[i]);
|
||||
}
|
||||
}
|
||||
outData.push(0xc0);
|
||||
return new Uint8Array(outData);
|
||||
}
|
||||
/**
|
||||
* Write binary data to device using the WebSerial device writable stream.
|
||||
* @param {Uint8Array} data 8 bit unsigned data array to write to device.
|
||||
*/
|
||||
async write(data) {
|
||||
const outData = this.slipWriter(data);
|
||||
if (this.device.writable) {
|
||||
const writer = this.device.writable.getWriter();
|
||||
if (this.tracing) {
|
||||
console.log("Write bytes");
|
||||
this.trace(`Write ${outData.length} bytes: ${this.hexConvert(outData)}`);
|
||||
}
|
||||
await writer.write(outData);
|
||||
writer.releaseLock();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Append a buffer array after another buffer array
|
||||
* @param {Uint8Array} arr1 - First array buffer.
|
||||
* @param {Uint8Array} arr2 - magic hex number to select ROM.
|
||||
* @returns {Uint8Array} Return a 8 bit unsigned array.
|
||||
*/
|
||||
appendArray(arr1, arr2) {
|
||||
const combined = new Uint8Array(arr1.length + arr2.length);
|
||||
combined.set(arr1);
|
||||
combined.set(arr2, arr1.length);
|
||||
return combined;
|
||||
}
|
||||
// Asynchronous generator to yield incoming data chunks
|
||||
async *readLoop(timeout) {
|
||||
if (!this.reader)
|
||||
return;
|
||||
try {
|
||||
while (true) {
|
||||
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Read timeout exceeded")), timeout));
|
||||
// Await the race between the timeout and the reader read
|
||||
const result = await Promise.race([this.reader.read(), timeoutPromise]);
|
||||
// If a timeout occurs, result will be null; otherwise, it will have { value, done }
|
||||
if (result === null)
|
||||
break;
|
||||
const { value, done } = result;
|
||||
if (done || !value)
|
||||
break;
|
||||
yield value; // Yield each data chunk
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error reading from serial port:", error);
|
||||
}
|
||||
finally {
|
||||
this.buffer = new Uint8Array(0);
|
||||
}
|
||||
}
|
||||
// Read a specific number of bytes
|
||||
async newRead(numBytes, timeout) {
|
||||
if (this.buffer.length >= numBytes) {
|
||||
const output = this.buffer.slice(0, numBytes);
|
||||
this.buffer = this.buffer.slice(numBytes); // Remove the returned data from buffer
|
||||
return output;
|
||||
}
|
||||
while (this.buffer.length < numBytes) {
|
||||
const readLoop = this.readLoop(timeout);
|
||||
const { value, done } = await readLoop.next();
|
||||
if (done || !value) {
|
||||
break;
|
||||
}
|
||||
// Append the newly read data to the buffer
|
||||
this.buffer = this.appendArray(this.buffer, value);
|
||||
}
|
||||
// Return as much data as possible
|
||||
const output = this.buffer.slice(0, numBytes);
|
||||
this.buffer = this.buffer.slice(numBytes);
|
||||
return output;
|
||||
}
|
||||
async flushInput() {
|
||||
var _a;
|
||||
if (this.reader && !(await this.reader.closed)) {
|
||||
await this.reader.cancel();
|
||||
this.reader.releaseLock();
|
||||
this.reader = (_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.getReader();
|
||||
}
|
||||
}
|
||||
async flushOutput() {
|
||||
var _a, _b;
|
||||
this.buffer = new Uint8Array(0);
|
||||
await ((_a = this.device.writable) === null || _a === void 0 ? void 0 : _a.getWriter().close());
|
||||
(_b = this.device.writable) === null || _b === void 0 ? void 0 : _b.getWriter().releaseLock();
|
||||
}
|
||||
// `inWaiting` returns the count of bytes in the buffer
|
||||
inWaiting() {
|
||||
return this.buffer.length;
|
||||
}
|
||||
/**
|
||||
* Detect if the data read from device is a Fatal or Guru meditation error.
|
||||
* @param {Uint8Array} input Data read from device
|
||||
*/
|
||||
detectPanicHandler(input) {
|
||||
const guruMeditationRegex = /G?uru Meditation Error: (?:Core \d panic'ed \(([a-zA-Z ]*)\))?/;
|
||||
const fatalExceptionRegex = /F?atal exception \(\d+\): (?:([a-zA-Z ]*)?.*epc)?/;
|
||||
const inputString = new TextDecoder("utf-8").decode(input);
|
||||
const match = inputString.match(guruMeditationRegex) || inputString.match(fatalExceptionRegex);
|
||||
if (match) {
|
||||
const cause = match[1] || match[2];
|
||||
const msg = `Guru Meditation Error detected${cause ? ` (${cause})` : ""}`;
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Take a data array and return the first well formed packet after
|
||||
* replacing the escape sequence. Reads at least 8 bytes.
|
||||
* @param {number} timeout Timeout read data.
|
||||
* @yields {Uint8Array} Formatted packet using SLIP escape sequences.
|
||||
*/
|
||||
async *read(timeout) {
|
||||
var _a;
|
||||
if (!this.reader) {
|
||||
this.reader = (_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.getReader();
|
||||
}
|
||||
let partialPacket = null;
|
||||
let isEscaping = false;
|
||||
let successfulSlip = false;
|
||||
while (true) {
|
||||
const waitingBytes = this.inWaiting();
|
||||
const readBytes = await this.newRead(waitingBytes > 0 ? waitingBytes : 1, timeout);
|
||||
if (!readBytes || readBytes.length === 0) {
|
||||
const msg = partialPacket === null
|
||||
? successfulSlip
|
||||
? "Serial data stream stopped: Possible serial noise or corruption."
|
||||
: "No serial data received."
|
||||
: `Packet content transfer stopped`;
|
||||
this.trace(msg);
|
||||
throw new Error(msg);
|
||||
}
|
||||
this.trace(`Read ${readBytes.length} bytes: ${this.hexConvert(readBytes)}`);
|
||||
let i = 0; // Track position in readBytes
|
||||
while (i < readBytes.length) {
|
||||
const byte = readBytes[i++];
|
||||
if (partialPacket === null) {
|
||||
if (byte === this.SLIP_END) {
|
||||
partialPacket = new Uint8Array(0); // Start of a new packet
|
||||
}
|
||||
else {
|
||||
this.trace(`Read invalid data: ${this.hexConvert(readBytes)}`);
|
||||
const remainingData = await this.newRead(this.inWaiting(), timeout);
|
||||
this.trace(`Remaining data in serial buffer: ${this.hexConvert(remainingData)}`);
|
||||
this.detectPanicHandler(new Uint8Array([...readBytes, ...(remainingData || [])]));
|
||||
throw new Error(`Invalid head of packet (0x${byte.toString(16)}): Possible serial noise or corruption.`);
|
||||
}
|
||||
}
|
||||
else if (isEscaping) {
|
||||
isEscaping = false;
|
||||
if (byte === this.SLIP_ESC_END) {
|
||||
partialPacket = this.appendArray(partialPacket, new Uint8Array([this.SLIP_END]));
|
||||
}
|
||||
else if (byte === this.SLIP_ESC_ESC) {
|
||||
partialPacket = this.appendArray(partialPacket, new Uint8Array([this.SLIP_ESC]));
|
||||
}
|
||||
else {
|
||||
this.trace(`Read invalid data: ${this.hexConvert(readBytes)}`);
|
||||
const remainingData = await this.newRead(this.inWaiting(), timeout);
|
||||
this.trace(`Remaining data in serial buffer: ${this.hexConvert(remainingData)}`);
|
||||
this.detectPanicHandler(new Uint8Array([...readBytes, ...(remainingData || [])]));
|
||||
throw new Error(`Invalid SLIP escape (0xdb, 0x${byte.toString(16)})`);
|
||||
}
|
||||
}
|
||||
else if (byte === this.SLIP_ESC) {
|
||||
isEscaping = true;
|
||||
}
|
||||
else if (byte === this.SLIP_END) {
|
||||
this.trace(`Received full packet: ${this.hexConvert(partialPacket)}`);
|
||||
this.buffer = this.appendArray(this.buffer, readBytes.slice(i));
|
||||
yield partialPacket;
|
||||
partialPacket = null;
|
||||
successfulSlip = true;
|
||||
}
|
||||
else {
|
||||
partialPacket = this.appendArray(partialPacket, new Uint8Array([byte]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read from serial device without slip formatting.
|
||||
* @yields {Uint8Array} The next number in the Fibonacci sequence.
|
||||
*/
|
||||
async *rawRead() {
|
||||
if (!this.reader)
|
||||
return;
|
||||
try {
|
||||
while (true) {
|
||||
const { value, done } = await this.reader.read();
|
||||
if (done || !value)
|
||||
break;
|
||||
if (this.tracing) {
|
||||
console.log("Raw Read bytes");
|
||||
this.trace(`Read ${value.length} bytes: ${this.hexConvert(value)}`);
|
||||
}
|
||||
yield value; // Yield each data chunk
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error reading from serial port:", error);
|
||||
}
|
||||
finally {
|
||||
this.buffer = new Uint8Array(0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send the RequestToSend (RTS) signal to given state
|
||||
* # True for EN=LOW, chip in reset and False EN=HIGH, chip out of reset
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
async setRTS(state) {
|
||||
await this.device.setSignals({ requestToSend: state });
|
||||
// # Work-around for adapters on Windows using the usbser.sys driver:
|
||||
// # generate a dummy change to DTR so that the set-control-line-state
|
||||
// # request is sent with the updated RTS state and the same DTR state
|
||||
// Referenced to esptool.py
|
||||
await this.setDTR(this._DTR_state);
|
||||
}
|
||||
/**
|
||||
* Send the dataTerminalReady (DTS) signal to given state
|
||||
* # True for IO0=LOW, chip in reset and False IO0=HIGH
|
||||
* @param {boolean} state Boolean state to set the signal
|
||||
*/
|
||||
async setDTR(state) {
|
||||
this._DTR_state = state;
|
||||
await this.device.setSignals({ dataTerminalReady: state });
|
||||
}
|
||||
/**
|
||||
* Connect to serial device using the Webserial open method.
|
||||
* @param {number} baud Number baud rate for serial connection. Default is 115200.
|
||||
* @param {typeof import("w3c-web-serial").SerialOptions} serialOptions Serial Options for WebUSB SerialPort class.
|
||||
*/
|
||||
async connect(baud = 115200, serialOptions = {}) {
|
||||
var _a;
|
||||
await this.device.open({
|
||||
baudRate: baud,
|
||||
dataBits: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.dataBits,
|
||||
stopBits: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.stopBits,
|
||||
bufferSize: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.bufferSize,
|
||||
parity: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.parity,
|
||||
flowControl: serialOptions === null || serialOptions === void 0 ? void 0 : serialOptions.flowControl,
|
||||
});
|
||||
this.baudrate = baud;
|
||||
this.reader = (_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.getReader();
|
||||
}
|
||||
async sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
/**
|
||||
* Wait for a given timeout ms for serial device unlock.
|
||||
* @param {number} timeout Timeout time in milliseconds (ms) to sleep
|
||||
*/
|
||||
async waitForUnlock(timeout) {
|
||||
while ((this.device.readable && this.device.readable.locked) ||
|
||||
(this.device.writable && this.device.writable.locked)) {
|
||||
await this.sleep(timeout);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disconnect from serial device by running SerialPort.close() after streams unlock.
|
||||
*/
|
||||
async disconnect() {
|
||||
var _a, _b;
|
||||
if ((_a = this.device.readable) === null || _a === void 0 ? void 0 : _a.locked) {
|
||||
await ((_b = this.reader) === null || _b === void 0 ? void 0 : _b.cancel());
|
||||
}
|
||||
await this.waitForUnlock(400);
|
||||
await this.device.close();
|
||||
this.reader = undefined;
|
||||
}
|
||||
}
|
||||
export { Transport };
|
57
node_modules/esptool-js/package.json
generated
vendored
Normal file
57
node_modules/esptool-js/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "esptool-js",
|
||||
"version": "0.5.6",
|
||||
"module": "lib/index.js",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"bundle.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run clean && tsc && rollup --config",
|
||||
"clean": "rimraf lib bundle.js .parcel-cache esptool-js-*.tgz",
|
||||
"format": "prettier --write \"src/**/*.ts\"",
|
||||
"genDocs": "rimraf docs && typedoc",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lintAndFix": "eslint . --ext .ts --fix",
|
||||
"prepare": "npm run build",
|
||||
"test": "echo \"Error: no test specified\"",
|
||||
"prepublishOnly": "npm run test && npm run lint"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/espressif/esptool-js.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/espressif/esptool-js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"atob-lite": "^2.0.0",
|
||||
"pako": "^2.1.0",
|
||||
"tslib": "^2.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-babel": "^6.0.2",
|
||||
"@rollup/plugin-commonjs": "^23.0.2",
|
||||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"@rollup/plugin-terser": "^0.1.0",
|
||||
"@types/atob-lite": "^2.0.2",
|
||||
"@types/pako": "^2.0.0",
|
||||
"@types/w3c-web-serial": "^1.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
||||
"@typescript-eslint/parser": "^5.43.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jsdoc": "^46.4.5",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"prettier": "^2.7.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^3.3.0",
|
||||
"typedoc": "^0.25.2",
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
}
|
21
node_modules/pako/LICENSE
generated
vendored
Normal file
21
node_modules/pako/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn
|
||||
|
||||
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.
|
177
node_modules/pako/README.md
generated
vendored
Normal file
177
node_modules/pako/README.md
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
pako
|
||||
==========================================
|
||||
|
||||
[](https://github.com/nodeca/pako/actions)
|
||||
[](https://www.npmjs.org/package/pako)
|
||||
|
||||
> zlib port to javascript, very fast!
|
||||
|
||||
__Why pako is cool:__
|
||||
|
||||
- Results are binary equal to well known [zlib](http://www.zlib.net/) (now contains ported zlib v1.2.8).
|
||||
- Almost as fast in modern JS engines as C implementation (see benchmarks).
|
||||
- Works in browsers, you can browserify any separate component.
|
||||
|
||||
This project was done to understand how fast JS can be and is it necessary to
|
||||
develop native C modules for CPU-intensive tasks. Enjoy the result!
|
||||
|
||||
|
||||
__Benchmarks:__
|
||||
|
||||
|
||||
node v12.16.3 (zlib 1.2.9), 1mb input sample:
|
||||
|
||||
```
|
||||
deflate-imaya x 4.75 ops/sec ±4.93% (15 runs sampled)
|
||||
deflate-pako x 10.38 ops/sec ±0.37% (29 runs sampled)
|
||||
deflate-zlib x 17.74 ops/sec ±0.77% (46 runs sampled)
|
||||
gzip-pako x 8.86 ops/sec ±1.41% (29 runs sampled)
|
||||
inflate-imaya x 107 ops/sec ±0.69% (77 runs sampled)
|
||||
inflate-pako x 131 ops/sec ±1.74% (82 runs sampled)
|
||||
inflate-zlib x 258 ops/sec ±0.66% (88 runs sampled)
|
||||
ungzip-pako x 115 ops/sec ±1.92% (80 runs sampled)
|
||||
```
|
||||
|
||||
node v14.15.0 (google's zlib), 1mb output sample:
|
||||
|
||||
```
|
||||
deflate-imaya x 4.93 ops/sec ±3.09% (16 runs sampled)
|
||||
deflate-pako x 10.22 ops/sec ±0.33% (29 runs sampled)
|
||||
deflate-zlib x 18.48 ops/sec ±0.24% (48 runs sampled)
|
||||
gzip-pako x 10.16 ops/sec ±0.25% (28 runs sampled)
|
||||
inflate-imaya x 110 ops/sec ±0.41% (77 runs sampled)
|
||||
inflate-pako x 134 ops/sec ±0.66% (83 runs sampled)
|
||||
inflate-zlib x 402 ops/sec ±0.74% (87 runs sampled)
|
||||
ungzip-pako x 113 ops/sec ±0.62% (80 runs sampled)
|
||||
```
|
||||
|
||||
zlib's test is partially affected by marshalling (that make sense for inflate only).
|
||||
You can change deflate level to 0 in benchmark source, to investigate details.
|
||||
For deflate level 6 results can be considered as correct.
|
||||
|
||||
__Install:__
|
||||
|
||||
```
|
||||
npm install pako
|
||||
```
|
||||
|
||||
|
||||
Examples / API
|
||||
--------------
|
||||
|
||||
Full docs - http://nodeca.github.io/pako/
|
||||
|
||||
```javascript
|
||||
const pako = require('pako');
|
||||
|
||||
// Deflate
|
||||
//
|
||||
const input = new Uint8Array();
|
||||
//... fill input data here
|
||||
const output = pako.deflate(input);
|
||||
|
||||
// Inflate (simple wrapper can throw exception on broken stream)
|
||||
//
|
||||
const compressed = new Uint8Array();
|
||||
//... fill data to uncompress here
|
||||
try {
|
||||
const result = pako.inflate(compressed);
|
||||
// ... continue processing
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
//
|
||||
// Alternate interface for chunking & without exceptions
|
||||
//
|
||||
|
||||
const deflator = new pako.Deflate();
|
||||
|
||||
deflator.push(chunk1, false);
|
||||
deflator.push(chunk2); // second param is false by default.
|
||||
...
|
||||
deflator.push(chunk_last, true); // `true` says this chunk is last
|
||||
|
||||
if (deflator.err) {
|
||||
console.log(deflator.msg);
|
||||
}
|
||||
|
||||
const output = deflator.result;
|
||||
|
||||
|
||||
const inflator = new pako.Inflate();
|
||||
|
||||
inflator.push(chunk1);
|
||||
inflator.push(chunk2);
|
||||
...
|
||||
inflator.push(chunk_last); // no second param because end is auto-detected
|
||||
|
||||
if (inflator.err) {
|
||||
console.log(inflator.msg);
|
||||
}
|
||||
|
||||
const output = inflator.result;
|
||||
```
|
||||
|
||||
Sometime you can wish to work with strings. For example, to send
|
||||
stringified objects to server. Pako's deflate detects input data type, and
|
||||
automatically recode strings to utf-8 prior to compress. Inflate has special
|
||||
option, to say compressed data has utf-8 encoding and should be recoded to
|
||||
javascript's utf-16.
|
||||
|
||||
```javascript
|
||||
const pako = require('pako');
|
||||
|
||||
const test = { my: 'super', puper: [456, 567], awesome: 'pako' };
|
||||
|
||||
const compressed = pako.deflate(JSON.stringify(test));
|
||||
|
||||
const restored = JSON.parse(pako.inflate(compressed, { to: 'string' }));
|
||||
```
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
Pako does not contain some specific zlib functions:
|
||||
|
||||
- __deflate__ - methods `deflateCopy`, `deflateBound`, `deflateParams`,
|
||||
`deflatePending`, `deflatePrime`, `deflateTune`.
|
||||
- __inflate__ - methods `inflateCopy`, `inflateMark`,
|
||||
`inflatePrime`, `inflateGetDictionary`, `inflateSync`, `inflateSyncPoint`, `inflateUndermine`.
|
||||
- High level inflate/deflate wrappers (classes) may not support some flush
|
||||
modes.
|
||||
|
||||
|
||||
pako for enterprise
|
||||
-------------------
|
||||
|
||||
Available as part of the Tidelift Subscription
|
||||
|
||||
The maintainers of pako and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-pako?utm_source=npm-pako&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
- Andrey Tupitsin [@anrd83](https://github.com/andr83)
|
||||
- Vitaly Puzrin [@puzrin](https://github.com/puzrin)
|
||||
|
||||
Personal thanks to:
|
||||
|
||||
- Vyacheslav Egorov ([@mraleph](https://github.com/mraleph)) for his awesome
|
||||
tutorials about optimising JS code for v8, [IRHydra](http://mrale.ph/irhydra/)
|
||||
tool and his advices.
|
||||
- David Duponchel ([@dduponchel](https://github.com/dduponchel)) for help with
|
||||
testing.
|
||||
|
||||
Original implementation (in C):
|
||||
|
||||
- [zlib](http://zlib.net/) by Jean-loup Gailly and Mark Adler.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
- MIT - all files, except `/lib/zlib` folder
|
||||
- ZLIB - `/lib/zlib` content
|
6688
node_modules/pako/dist/pako.es5.js
generated
vendored
Normal file
6688
node_modules/pako/dist/pako.es5.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/pako/dist/pako.es5.min.js
generated
vendored
Normal file
2
node_modules/pako/dist/pako.es5.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6877
node_modules/pako/dist/pako.esm.mjs
generated
vendored
Normal file
6877
node_modules/pako/dist/pako.esm.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6896
node_modules/pako/dist/pako.js
generated
vendored
Normal file
6896
node_modules/pako/dist/pako.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/pako/dist/pako.min.js
generated
vendored
Normal file
2
node_modules/pako/dist/pako.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3924
node_modules/pako/dist/pako_deflate.es5.js
generated
vendored
Normal file
3924
node_modules/pako/dist/pako_deflate.es5.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/pako/dist/pako_deflate.es5.min.js
generated
vendored
Normal file
2
node_modules/pako/dist/pako_deflate.es5.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4126
node_modules/pako/dist/pako_deflate.js
generated
vendored
Normal file
4126
node_modules/pako/dist/pako_deflate.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/pako/dist/pako_deflate.min.js
generated
vendored
Normal file
2
node_modules/pako/dist/pako_deflate.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3229
node_modules/pako/dist/pako_inflate.es5.js
generated
vendored
Normal file
3229
node_modules/pako/dist/pako_inflate.es5.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/pako/dist/pako_inflate.es5.min.js
generated
vendored
Normal file
2
node_modules/pako/dist/pako_inflate.es5.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3239
node_modules/pako/dist/pako_inflate.js
generated
vendored
Normal file
3239
node_modules/pako/dist/pako_inflate.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/pako/dist/pako_inflate.min.js
generated
vendored
Normal file
2
node_modules/pako/dist/pako_inflate.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/pako/index.js
generated
vendored
Normal file
18
node_modules/pako/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Top level file is just a mixin of submodules & constants
|
||||
'use strict';
|
||||
|
||||
const { Deflate, deflate, deflateRaw, gzip } = require('./lib/deflate');
|
||||
|
||||
const { Inflate, inflate, inflateRaw, ungzip } = require('./lib/inflate');
|
||||
|
||||
const constants = require('./lib/zlib/constants');
|
||||
|
||||
module.exports.Deflate = Deflate;
|
||||
module.exports.deflate = deflate;
|
||||
module.exports.deflateRaw = deflateRaw;
|
||||
module.exports.gzip = gzip;
|
||||
module.exports.Inflate = Inflate;
|
||||
module.exports.inflate = inflate;
|
||||
module.exports.inflateRaw = inflateRaw;
|
||||
module.exports.ungzip = ungzip;
|
||||
module.exports.constants = constants;
|
380
node_modules/pako/lib/deflate.js
generated
vendored
Normal file
380
node_modules/pako/lib/deflate.js
generated
vendored
Normal file
@@ -0,0 +1,380 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
const zlib_deflate = require('./zlib/deflate');
|
||||
const utils = require('./utils/common');
|
||||
const strings = require('./utils/strings');
|
||||
const msg = require('./zlib/messages');
|
||||
const ZStream = require('./zlib/zstream');
|
||||
|
||||
const toString = Object.prototype.toString;
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
const {
|
||||
Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH,
|
||||
Z_OK, Z_STREAM_END,
|
||||
Z_DEFAULT_COMPRESSION,
|
||||
Z_DEFAULT_STRATEGY,
|
||||
Z_DEFLATED
|
||||
} = require('./zlib/constants');
|
||||
|
||||
/* ===========================================================================*/
|
||||
|
||||
|
||||
/**
|
||||
* class Deflate
|
||||
*
|
||||
* Generic JS-style wrapper for zlib calls. If you don't need
|
||||
* streaming behaviour - use more simple functions: [[deflate]],
|
||||
* [[deflateRaw]] and [[gzip]].
|
||||
**/
|
||||
|
||||
/* internal
|
||||
* Deflate.chunks -> Array
|
||||
*
|
||||
* Chunks of output data, if [[Deflate#onData]] not overridden.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Deflate.result -> Uint8Array
|
||||
*
|
||||
* Compressed result, generated by default [[Deflate#onData]]
|
||||
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
|
||||
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
|
||||
**/
|
||||
|
||||
/**
|
||||
* Deflate.err -> Number
|
||||
*
|
||||
* Error code after deflate finished. 0 (Z_OK) on success.
|
||||
* You will not need it in real life, because deflate errors
|
||||
* are possible only on wrong options or bad `onData` / `onEnd`
|
||||
* custom handlers.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Deflate.msg -> String
|
||||
*
|
||||
* Error message, if [[Deflate.err]] != 0
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* new Deflate(options)
|
||||
* - options (Object): zlib deflate options.
|
||||
*
|
||||
* Creates new deflator instance with specified params. Throws exception
|
||||
* on bad params. Supported options:
|
||||
*
|
||||
* - `level`
|
||||
* - `windowBits`
|
||||
* - `memLevel`
|
||||
* - `strategy`
|
||||
* - `dictionary`
|
||||
*
|
||||
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
||||
* for more information on these.
|
||||
*
|
||||
* Additional options, for internal needs:
|
||||
*
|
||||
* - `chunkSize` - size of generated data chunks (16K by default)
|
||||
* - `raw` (Boolean) - do raw deflate
|
||||
* - `gzip` (Boolean) - create gzip wrapper
|
||||
* - `header` (Object) - custom header for gzip
|
||||
* - `text` (Boolean) - true if compressed data believed to be text
|
||||
* - `time` (Number) - modification time, unix timestamp
|
||||
* - `os` (Number) - operation system code
|
||||
* - `extra` (Array) - array of bytes with extra data (max 65536)
|
||||
* - `name` (String) - file name (binary string)
|
||||
* - `comment` (String) - comment (binary string)
|
||||
* - `hcrc` (Boolean) - true if header crc should be added
|
||||
*
|
||||
* ##### Example:
|
||||
*
|
||||
* ```javascript
|
||||
* const pako = require('pako')
|
||||
* , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])
|
||||
* , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);
|
||||
*
|
||||
* const deflate = new pako.Deflate({ level: 3});
|
||||
*
|
||||
* deflate.push(chunk1, false);
|
||||
* deflate.push(chunk2, true); // true -> last chunk
|
||||
*
|
||||
* if (deflate.err) { throw new Error(deflate.err); }
|
||||
*
|
||||
* console.log(deflate.result);
|
||||
* ```
|
||||
**/
|
||||
function Deflate(options) {
|
||||
this.options = utils.assign({
|
||||
level: Z_DEFAULT_COMPRESSION,
|
||||
method: Z_DEFLATED,
|
||||
chunkSize: 16384,
|
||||
windowBits: 15,
|
||||
memLevel: 8,
|
||||
strategy: Z_DEFAULT_STRATEGY
|
||||
}, options || {});
|
||||
|
||||
let opt = this.options;
|
||||
|
||||
if (opt.raw && (opt.windowBits > 0)) {
|
||||
opt.windowBits = -opt.windowBits;
|
||||
}
|
||||
|
||||
else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {
|
||||
opt.windowBits += 16;
|
||||
}
|
||||
|
||||
this.err = 0; // error code, if happens (0 = Z_OK)
|
||||
this.msg = ''; // error message
|
||||
this.ended = false; // used to avoid multiple onEnd() calls
|
||||
this.chunks = []; // chunks of compressed data
|
||||
|
||||
this.strm = new ZStream();
|
||||
this.strm.avail_out = 0;
|
||||
|
||||
let status = zlib_deflate.deflateInit2(
|
||||
this.strm,
|
||||
opt.level,
|
||||
opt.method,
|
||||
opt.windowBits,
|
||||
opt.memLevel,
|
||||
opt.strategy
|
||||
);
|
||||
|
||||
if (status !== Z_OK) {
|
||||
throw new Error(msg[status]);
|
||||
}
|
||||
|
||||
if (opt.header) {
|
||||
zlib_deflate.deflateSetHeader(this.strm, opt.header);
|
||||
}
|
||||
|
||||
if (opt.dictionary) {
|
||||
let dict;
|
||||
// Convert data if needed
|
||||
if (typeof opt.dictionary === 'string') {
|
||||
// If we need to compress text, change encoding to utf8.
|
||||
dict = strings.string2buf(opt.dictionary);
|
||||
} else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
|
||||
dict = new Uint8Array(opt.dictionary);
|
||||
} else {
|
||||
dict = opt.dictionary;
|
||||
}
|
||||
|
||||
status = zlib_deflate.deflateSetDictionary(this.strm, dict);
|
||||
|
||||
if (status !== Z_OK) {
|
||||
throw new Error(msg[status]);
|
||||
}
|
||||
|
||||
this._dict_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deflate#push(data[, flush_mode]) -> Boolean
|
||||
* - data (Uint8Array|ArrayBuffer|String): input data. Strings will be
|
||||
* converted to utf8 byte sequence.
|
||||
* - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
|
||||
* See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
|
||||
*
|
||||
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
|
||||
* new compressed chunks. Returns `true` on success. The last data block must
|
||||
* have `flush_mode` Z_FINISH (or `true`). That will flush internal pending
|
||||
* buffers and call [[Deflate#onEnd]].
|
||||
*
|
||||
* On fail call [[Deflate#onEnd]] with error code and return false.
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* ```javascript
|
||||
* push(chunk, false); // push one of data chunks
|
||||
* ...
|
||||
* push(chunk, true); // push last chunk
|
||||
* ```
|
||||
**/
|
||||
Deflate.prototype.push = function (data, flush_mode) {
|
||||
const strm = this.strm;
|
||||
const chunkSize = this.options.chunkSize;
|
||||
let status, _flush_mode;
|
||||
|
||||
if (this.ended) { return false; }
|
||||
|
||||
if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;
|
||||
else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;
|
||||
|
||||
// Convert data if needed
|
||||
if (typeof data === 'string') {
|
||||
// If we need to compress text, change encoding to utf8.
|
||||
strm.input = strings.string2buf(data);
|
||||
} else if (toString.call(data) === '[object ArrayBuffer]') {
|
||||
strm.input = new Uint8Array(data);
|
||||
} else {
|
||||
strm.input = data;
|
||||
}
|
||||
|
||||
strm.next_in = 0;
|
||||
strm.avail_in = strm.input.length;
|
||||
|
||||
for (;;) {
|
||||
if (strm.avail_out === 0) {
|
||||
strm.output = new Uint8Array(chunkSize);
|
||||
strm.next_out = 0;
|
||||
strm.avail_out = chunkSize;
|
||||
}
|
||||
|
||||
// Make sure avail_out > 6 to avoid repeating markers
|
||||
if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {
|
||||
this.onData(strm.output.subarray(0, strm.next_out));
|
||||
strm.avail_out = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
status = zlib_deflate.deflate(strm, _flush_mode);
|
||||
|
||||
// Ended => flush and finish
|
||||
if (status === Z_STREAM_END) {
|
||||
if (strm.next_out > 0) {
|
||||
this.onData(strm.output.subarray(0, strm.next_out));
|
||||
}
|
||||
status = zlib_deflate.deflateEnd(this.strm);
|
||||
this.onEnd(status);
|
||||
this.ended = true;
|
||||
return status === Z_OK;
|
||||
}
|
||||
|
||||
// Flush if out buffer full
|
||||
if (strm.avail_out === 0) {
|
||||
this.onData(strm.output);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Flush if requested and has data
|
||||
if (_flush_mode > 0 && strm.next_out > 0) {
|
||||
this.onData(strm.output.subarray(0, strm.next_out));
|
||||
strm.avail_out = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strm.avail_in === 0) break;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deflate#onData(chunk) -> Void
|
||||
* - chunk (Uint8Array): output data.
|
||||
*
|
||||
* By default, stores data blocks in `chunks[]` property and glue
|
||||
* those in `onEnd`. Override this handler, if you need another behaviour.
|
||||
**/
|
||||
Deflate.prototype.onData = function (chunk) {
|
||||
this.chunks.push(chunk);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Deflate#onEnd(status) -> Void
|
||||
* - status (Number): deflate status. 0 (Z_OK) on success,
|
||||
* other if not.
|
||||
*
|
||||
* Called once after you tell deflate that the input stream is
|
||||
* complete (Z_FINISH). By default - join collected chunks,
|
||||
* free memory and fill `results` / `err` properties.
|
||||
**/
|
||||
Deflate.prototype.onEnd = function (status) {
|
||||
// On success - join
|
||||
if (status === Z_OK) {
|
||||
this.result = utils.flattenChunks(this.chunks);
|
||||
}
|
||||
this.chunks = [];
|
||||
this.err = status;
|
||||
this.msg = this.strm.msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* deflate(data[, options]) -> Uint8Array
|
||||
* - data (Uint8Array|ArrayBuffer|String): input data to compress.
|
||||
* - options (Object): zlib deflate options.
|
||||
*
|
||||
* Compress `data` with deflate algorithm and `options`.
|
||||
*
|
||||
* Supported options are:
|
||||
*
|
||||
* - level
|
||||
* - windowBits
|
||||
* - memLevel
|
||||
* - strategy
|
||||
* - dictionary
|
||||
*
|
||||
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
||||
* for more information on these.
|
||||
*
|
||||
* Sugar (options):
|
||||
*
|
||||
* - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
|
||||
* negative windowBits implicitly.
|
||||
*
|
||||
* ##### Example:
|
||||
*
|
||||
* ```javascript
|
||||
* const pako = require('pako')
|
||||
* const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);
|
||||
*
|
||||
* console.log(pako.deflate(data));
|
||||
* ```
|
||||
**/
|
||||
function deflate(input, options) {
|
||||
const deflator = new Deflate(options);
|
||||
|
||||
deflator.push(input, true);
|
||||
|
||||
// That will never happens, if you don't cheat with options :)
|
||||
if (deflator.err) { throw deflator.msg || msg[deflator.err]; }
|
||||
|
||||
return deflator.result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deflateRaw(data[, options]) -> Uint8Array
|
||||
* - data (Uint8Array|ArrayBuffer|String): input data to compress.
|
||||
* - options (Object): zlib deflate options.
|
||||
*
|
||||
* The same as [[deflate]], but creates raw data, without wrapper
|
||||
* (header and adler32 crc).
|
||||
**/
|
||||
function deflateRaw(input, options) {
|
||||
options = options || {};
|
||||
options.raw = true;
|
||||
return deflate(input, options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gzip(data[, options]) -> Uint8Array
|
||||
* - data (Uint8Array|ArrayBuffer|String): input data to compress.
|
||||
* - options (Object): zlib deflate options.
|
||||
*
|
||||
* The same as [[deflate]], but create gzip wrapper instead of
|
||||
* deflate one.
|
||||
**/
|
||||
function gzip(input, options) {
|
||||
options = options || {};
|
||||
options.gzip = true;
|
||||
return deflate(input, options);
|
||||
}
|
||||
|
||||
|
||||
module.exports.Deflate = Deflate;
|
||||
module.exports.deflate = deflate;
|
||||
module.exports.deflateRaw = deflateRaw;
|
||||
module.exports.gzip = gzip;
|
||||
module.exports.constants = require('./zlib/constants');
|
419
node_modules/pako/lib/inflate.js
generated
vendored
Normal file
419
node_modules/pako/lib/inflate.js
generated
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
const zlib_inflate = require('./zlib/inflate');
|
||||
const utils = require('./utils/common');
|
||||
const strings = require('./utils/strings');
|
||||
const msg = require('./zlib/messages');
|
||||
const ZStream = require('./zlib/zstream');
|
||||
const GZheader = require('./zlib/gzheader');
|
||||
|
||||
const toString = Object.prototype.toString;
|
||||
|
||||
/* Public constants ==========================================================*/
|
||||
/* ===========================================================================*/
|
||||
|
||||
const {
|
||||
Z_NO_FLUSH, Z_FINISH,
|
||||
Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR
|
||||
} = require('./zlib/constants');
|
||||
|
||||
/* ===========================================================================*/
|
||||
|
||||
|
||||
/**
|
||||
* class Inflate
|
||||
*
|
||||
* Generic JS-style wrapper for zlib calls. If you don't need
|
||||
* streaming behaviour - use more simple functions: [[inflate]]
|
||||
* and [[inflateRaw]].
|
||||
**/
|
||||
|
||||
/* internal
|
||||
* inflate.chunks -> Array
|
||||
*
|
||||
* Chunks of output data, if [[Inflate#onData]] not overridden.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Inflate.result -> Uint8Array|String
|
||||
*
|
||||
* Uncompressed result, generated by default [[Inflate#onData]]
|
||||
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
|
||||
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
|
||||
**/
|
||||
|
||||
/**
|
||||
* Inflate.err -> Number
|
||||
*
|
||||
* Error code after inflate finished. 0 (Z_OK) on success.
|
||||
* Should be checked if broken data possible.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Inflate.msg -> String
|
||||
*
|
||||
* Error message, if [[Inflate.err]] != 0
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* new Inflate(options)
|
||||
* - options (Object): zlib inflate options.
|
||||
*
|
||||
* Creates new inflator instance with specified params. Throws exception
|
||||
* on bad params. Supported options:
|
||||
*
|
||||
* - `windowBits`
|
||||
* - `dictionary`
|
||||
*
|
||||
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
||||
* for more information on these.
|
||||
*
|
||||
* Additional options, for internal needs:
|
||||
*
|
||||
* - `chunkSize` - size of generated data chunks (16K by default)
|
||||
* - `raw` (Boolean) - do raw inflate
|
||||
* - `to` (String) - if equal to 'string', then result will be converted
|
||||
* from utf8 to utf16 (javascript) string. When string output requested,
|
||||
* chunk length can differ from `chunkSize`, depending on content.
|
||||
*
|
||||
* By default, when no options set, autodetect deflate/gzip data format via
|
||||
* wrapper header.
|
||||
*
|
||||
* ##### Example:
|
||||
*
|
||||
* ```javascript
|
||||
* const pako = require('pako')
|
||||
* const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])
|
||||
* const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);
|
||||
*
|
||||
* const inflate = new pako.Inflate({ level: 3});
|
||||
*
|
||||
* inflate.push(chunk1, false);
|
||||
* inflate.push(chunk2, true); // true -> last chunk
|
||||
*
|
||||
* if (inflate.err) { throw new Error(inflate.err); }
|
||||
*
|
||||
* console.log(inflate.result);
|
||||
* ```
|
||||
**/
|
||||
function Inflate(options) {
|
||||
this.options = utils.assign({
|
||||
chunkSize: 1024 * 64,
|
||||
windowBits: 15,
|
||||
to: ''
|
||||
}, options || {});
|
||||
|
||||
const opt = this.options;
|
||||
|
||||
// Force window size for `raw` data, if not set directly,
|
||||
// because we have no header for autodetect.
|
||||
if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
|
||||
opt.windowBits = -opt.windowBits;
|
||||
if (opt.windowBits === 0) { opt.windowBits = -15; }
|
||||
}
|
||||
|
||||
// If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
|
||||
if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&
|
||||
!(options && options.windowBits)) {
|
||||
opt.windowBits += 32;
|
||||
}
|
||||
|
||||
// Gzip header has no info about windows size, we can do autodetect only
|
||||
// for deflate. So, if window size not set, force it to max when gzip possible
|
||||
if ((opt.windowBits > 15) && (opt.windowBits < 48)) {
|
||||
// bit 3 (16) -> gzipped data
|
||||
// bit 4 (32) -> autodetect gzip/deflate
|
||||
if ((opt.windowBits & 15) === 0) {
|
||||
opt.windowBits |= 15;
|
||||
}
|
||||
}
|
||||
|
||||
this.err = 0; // error code, if happens (0 = Z_OK)
|
||||
this.msg = ''; // error message
|
||||
this.ended = false; // used to avoid multiple onEnd() calls
|
||||
this.chunks = []; // chunks of compressed data
|
||||
|
||||
this.strm = new ZStream();
|
||||
this.strm.avail_out = 0;
|
||||
|
||||
let status = zlib_inflate.inflateInit2(
|
||||
this.strm,
|
||||
opt.windowBits
|
||||
);
|
||||
|
||||
if (status !== Z_OK) {
|
||||
throw new Error(msg[status]);
|
||||
}
|
||||
|
||||
this.header = new GZheader();
|
||||
|
||||
zlib_inflate.inflateGetHeader(this.strm, this.header);
|
||||
|
||||
// Setup dictionary
|
||||
if (opt.dictionary) {
|
||||
// Convert data if needed
|
||||
if (typeof opt.dictionary === 'string') {
|
||||
opt.dictionary = strings.string2buf(opt.dictionary);
|
||||
} else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
|
||||
opt.dictionary = new Uint8Array(opt.dictionary);
|
||||
}
|
||||
if (opt.raw) { //In raw mode we need to set the dictionary early
|
||||
status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);
|
||||
if (status !== Z_OK) {
|
||||
throw new Error(msg[status]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inflate#push(data[, flush_mode]) -> Boolean
|
||||
* - data (Uint8Array|ArrayBuffer): input data
|
||||
* - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE
|
||||
* flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,
|
||||
* `true` means Z_FINISH.
|
||||
*
|
||||
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
|
||||
* new output chunks. Returns `true` on success. If end of stream detected,
|
||||
* [[Inflate#onEnd]] will be called.
|
||||
*
|
||||
* `flush_mode` is not needed for normal operation, because end of stream
|
||||
* detected automatically. You may try to use it for advanced things, but
|
||||
* this functionality was not tested.
|
||||
*
|
||||
* On fail call [[Inflate#onEnd]] with error code and return false.
|
||||
*
|
||||
* ##### Example
|
||||
*
|
||||
* ```javascript
|
||||
* push(chunk, false); // push one of data chunks
|
||||
* ...
|
||||
* push(chunk, true); // push last chunk
|
||||
* ```
|
||||
**/
|
||||
Inflate.prototype.push = function (data, flush_mode) {
|
||||
const strm = this.strm;
|
||||
const chunkSize = this.options.chunkSize;
|
||||
const dictionary = this.options.dictionary;
|
||||
let status, _flush_mode, last_avail_out;
|
||||
|
||||
if (this.ended) return false;
|
||||
|
||||
if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;
|
||||
else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;
|
||||
|
||||
// Convert data if needed
|
||||
if (toString.call(data) === '[object ArrayBuffer]') {
|
||||
strm.input = new Uint8Array(data);
|
||||
} else {
|
||||
strm.input = data;
|
||||
}
|
||||
|
||||
strm.next_in = 0;
|
||||
strm.avail_in = strm.input.length;
|
||||
|
||||
for (;;) {
|
||||
if (strm.avail_out === 0) {
|
||||
strm.output = new Uint8Array(chunkSize);
|
||||
strm.next_out = 0;
|
||||
strm.avail_out = chunkSize;
|
||||
}
|
||||
|
||||
status = zlib_inflate.inflate(strm, _flush_mode);
|
||||
|
||||
if (status === Z_NEED_DICT && dictionary) {
|
||||
status = zlib_inflate.inflateSetDictionary(strm, dictionary);
|
||||
|
||||
if (status === Z_OK) {
|
||||
status = zlib_inflate.inflate(strm, _flush_mode);
|
||||
} else if (status === Z_DATA_ERROR) {
|
||||
// Replace code with more verbose
|
||||
status = Z_NEED_DICT;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip snyc markers if more data follows and not raw mode
|
||||
while (strm.avail_in > 0 &&
|
||||
status === Z_STREAM_END &&
|
||||
strm.state.wrap > 0 &&
|
||||
data[strm.next_in] !== 0)
|
||||
{
|
||||
zlib_inflate.inflateReset(strm);
|
||||
status = zlib_inflate.inflate(strm, _flush_mode);
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case Z_STREAM_ERROR:
|
||||
case Z_DATA_ERROR:
|
||||
case Z_NEED_DICT:
|
||||
case Z_MEM_ERROR:
|
||||
this.onEnd(status);
|
||||
this.ended = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remember real `avail_out` value, because we may patch out buffer content
|
||||
// to align utf8 strings boundaries.
|
||||
last_avail_out = strm.avail_out;
|
||||
|
||||
if (strm.next_out) {
|
||||
if (strm.avail_out === 0 || status === Z_STREAM_END) {
|
||||
|
||||
if (this.options.to === 'string') {
|
||||
|
||||
let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
|
||||
|
||||
let tail = strm.next_out - next_out_utf8;
|
||||
let utf8str = strings.buf2string(strm.output, next_out_utf8);
|
||||
|
||||
// move tail & realign counters
|
||||
strm.next_out = tail;
|
||||
strm.avail_out = chunkSize - tail;
|
||||
if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
|
||||
|
||||
this.onData(utf8str);
|
||||
|
||||
} else {
|
||||
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Must repeat iteration if out buffer is full
|
||||
if (status === Z_OK && last_avail_out === 0) continue;
|
||||
|
||||
// Finalize if end of stream reached.
|
||||
if (status === Z_STREAM_END) {
|
||||
status = zlib_inflate.inflateEnd(this.strm);
|
||||
this.onEnd(status);
|
||||
this.ended = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strm.avail_in === 0) break;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Inflate#onData(chunk) -> Void
|
||||
* - chunk (Uint8Array|String): output data. When string output requested,
|
||||
* each chunk will be string.
|
||||
*
|
||||
* By default, stores data blocks in `chunks[]` property and glue
|
||||
* those in `onEnd`. Override this handler, if you need another behaviour.
|
||||
**/
|
||||
Inflate.prototype.onData = function (chunk) {
|
||||
this.chunks.push(chunk);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Inflate#onEnd(status) -> Void
|
||||
* - status (Number): inflate status. 0 (Z_OK) on success,
|
||||
* other if not.
|
||||
*
|
||||
* Called either after you tell inflate that the input stream is
|
||||
* complete (Z_FINISH). By default - join collected chunks,
|
||||
* free memory and fill `results` / `err` properties.
|
||||
**/
|
||||
Inflate.prototype.onEnd = function (status) {
|
||||
// On success - join
|
||||
if (status === Z_OK) {
|
||||
if (this.options.to === 'string') {
|
||||
this.result = this.chunks.join('');
|
||||
} else {
|
||||
this.result = utils.flattenChunks(this.chunks);
|
||||
}
|
||||
}
|
||||
this.chunks = [];
|
||||
this.err = status;
|
||||
this.msg = this.strm.msg;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* inflate(data[, options]) -> Uint8Array|String
|
||||
* - data (Uint8Array|ArrayBuffer): input data to decompress.
|
||||
* - options (Object): zlib inflate options.
|
||||
*
|
||||
* Decompress `data` with inflate/ungzip and `options`. Autodetect
|
||||
* format via wrapper header by default. That's why we don't provide
|
||||
* separate `ungzip` method.
|
||||
*
|
||||
* Supported options are:
|
||||
*
|
||||
* - windowBits
|
||||
*
|
||||
* [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
|
||||
* for more information.
|
||||
*
|
||||
* Sugar (options):
|
||||
*
|
||||
* - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
|
||||
* negative windowBits implicitly.
|
||||
* - `to` (String) - if equal to 'string', then result will be converted
|
||||
* from utf8 to utf16 (javascript) string. When string output requested,
|
||||
* chunk length can differ from `chunkSize`, depending on content.
|
||||
*
|
||||
*
|
||||
* ##### Example:
|
||||
*
|
||||
* ```javascript
|
||||
* const pako = require('pako');
|
||||
* const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));
|
||||
* let output;
|
||||
*
|
||||
* try {
|
||||
* output = pako.inflate(input);
|
||||
* } catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* ```
|
||||
**/
|
||||
function inflate(input, options) {
|
||||
const inflator = new Inflate(options);
|
||||
|
||||
inflator.push(input);
|
||||
|
||||
// That will never happens, if you don't cheat with options :)
|
||||
if (inflator.err) throw inflator.msg || msg[inflator.err];
|
||||
|
||||
return inflator.result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* inflateRaw(data[, options]) -> Uint8Array|String
|
||||
* - data (Uint8Array|ArrayBuffer): input data to decompress.
|
||||
* - options (Object): zlib inflate options.
|
||||
*
|
||||
* The same as [[inflate]], but creates raw data, without wrapper
|
||||
* (header and adler32 crc).
|
||||
**/
|
||||
function inflateRaw(input, options) {
|
||||
options = options || {};
|
||||
options.raw = true;
|
||||
return inflate(input, options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ungzip(data[, options]) -> Uint8Array|String
|
||||
* - data (Uint8Array|ArrayBuffer): input data to decompress.
|
||||
* - options (Object): zlib inflate options.
|
||||
*
|
||||
* Just shortcut to [[inflate]], because it autodetects format
|
||||
* by header.content. Done for convenience.
|
||||
**/
|
||||
|
||||
|
||||
module.exports.Inflate = Inflate;
|
||||
module.exports.inflate = inflate;
|
||||
module.exports.inflateRaw = inflateRaw;
|
||||
module.exports.ungzip = inflate;
|
||||
module.exports.constants = require('./zlib/constants');
|
48
node_modules/pako/lib/utils/common.js
generated
vendored
Normal file
48
node_modules/pako/lib/utils/common.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
const _has = (obj, key) => {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
};
|
||||
|
||||
module.exports.assign = function (obj /*from1, from2, from3, ...*/) {
|
||||
const sources = Array.prototype.slice.call(arguments, 1);
|
||||
while (sources.length) {
|
||||
const source = sources.shift();
|
||||
if (!source) { continue; }
|
||||
|
||||
if (typeof source !== 'object') {
|
||||
throw new TypeError(source + 'must be non-object');
|
||||
}
|
||||
|
||||
for (const p in source) {
|
||||
if (_has(source, p)) {
|
||||
obj[p] = source[p];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
// Join array of chunks to single array.
|
||||
module.exports.flattenChunks = (chunks) => {
|
||||
// calculate data length
|
||||
let len = 0;
|
||||
|
||||
for (let i = 0, l = chunks.length; i < l; i++) {
|
||||
len += chunks[i].length;
|
||||
}
|
||||
|
||||
// join chunks
|
||||
const result = new Uint8Array(len);
|
||||
|
||||
for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {
|
||||
let chunk = chunks[i];
|
||||
result.set(chunk, pos);
|
||||
pos += chunk.length;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
174
node_modules/pako/lib/utils/strings.js
generated
vendored
Normal file
174
node_modules/pako/lib/utils/strings.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
// String encode/decode helpers
|
||||
'use strict';
|
||||
|
||||
|
||||
// Quick check if we can use fast array to bin string conversion
|
||||
//
|
||||
// - apply(Array) can fail on Android 2.2
|
||||
// - apply(Uint8Array) can fail on iOS 5.1 Safari
|
||||
//
|
||||
let STR_APPLY_UIA_OK = true;
|
||||
|
||||
try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }
|
||||
|
||||
|
||||
// Table with utf8 lengths (calculated by first byte of sequence)
|
||||
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
|
||||
// because max possible codepoint is 0x10ffff
|
||||
const _utf8len = new Uint8Array(256);
|
||||
for (let q = 0; q < 256; q++) {
|
||||
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
|
||||
}
|
||||
_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start
|
||||
|
||||
|
||||
// convert string to array (typed, when possible)
|
||||
module.exports.string2buf = (str) => {
|
||||
if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {
|
||||
return new TextEncoder().encode(str);
|
||||
}
|
||||
|
||||
let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
|
||||
|
||||
// count binary size
|
||||
for (m_pos = 0; m_pos < str_len; m_pos++) {
|
||||
c = str.charCodeAt(m_pos);
|
||||
if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
|
||||
c2 = str.charCodeAt(m_pos + 1);
|
||||
if ((c2 & 0xfc00) === 0xdc00) {
|
||||
c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
|
||||
m_pos++;
|
||||
}
|
||||
}
|
||||
buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;
|
||||
}
|
||||
|
||||
// allocate buffer
|
||||
buf = new Uint8Array(buf_len);
|
||||
|
||||
// convert
|
||||
for (i = 0, m_pos = 0; i < buf_len; m_pos++) {
|
||||
c = str.charCodeAt(m_pos);
|
||||
if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {
|
||||
c2 = str.charCodeAt(m_pos + 1);
|
||||
if ((c2 & 0xfc00) === 0xdc00) {
|
||||
c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);
|
||||
m_pos++;
|
||||
}
|
||||
}
|
||||
if (c < 0x80) {
|
||||
/* one byte */
|
||||
buf[i++] = c;
|
||||
} else if (c < 0x800) {
|
||||
/* two bytes */
|
||||
buf[i++] = 0xC0 | (c >>> 6);
|
||||
buf[i++] = 0x80 | (c & 0x3f);
|
||||
} else if (c < 0x10000) {
|
||||
/* three bytes */
|
||||
buf[i++] = 0xE0 | (c >>> 12);
|
||||
buf[i++] = 0x80 | (c >>> 6 & 0x3f);
|
||||
buf[i++] = 0x80 | (c & 0x3f);
|
||||
} else {
|
||||
/* four bytes */
|
||||
buf[i++] = 0xf0 | (c >>> 18);
|
||||
buf[i++] = 0x80 | (c >>> 12 & 0x3f);
|
||||
buf[i++] = 0x80 | (c >>> 6 & 0x3f);
|
||||
buf[i++] = 0x80 | (c & 0x3f);
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
};
|
||||
|
||||
// Helper
|
||||
const buf2binstring = (buf, len) => {
|
||||
// On Chrome, the arguments in a function call that are allowed is `65534`.
|
||||
// If the length of the buffer is smaller than that, we can use this optimization,
|
||||
// otherwise we will take a slower path.
|
||||
if (len < 65534) {
|
||||
if (buf.subarray && STR_APPLY_UIA_OK) {
|
||||
return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));
|
||||
}
|
||||
}
|
||||
|
||||
let result = '';
|
||||
for (let i = 0; i < len; i++) {
|
||||
result += String.fromCharCode(buf[i]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
// convert array to string
|
||||
module.exports.buf2string = (buf, max) => {
|
||||
const len = max || buf.length;
|
||||
|
||||
if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {
|
||||
return new TextDecoder().decode(buf.subarray(0, max));
|
||||
}
|
||||
|
||||
let i, out;
|
||||
|
||||
// Reserve max possible length (2 words per char)
|
||||
// NB: by unknown reasons, Array is significantly faster for
|
||||
// String.fromCharCode.apply than Uint16Array.
|
||||
const utf16buf = new Array(len * 2);
|
||||
|
||||
for (out = 0, i = 0; i < len;) {
|
||||
let c = buf[i++];
|
||||
// quick process ascii
|
||||
if (c < 0x80) { utf16buf[out++] = c; continue; }
|
||||
|
||||
let c_len = _utf8len[c];
|
||||
// skip 5 & 6 byte codes
|
||||
if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }
|
||||
|
||||
// apply mask on first byte
|
||||
c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;
|
||||
// join the rest
|
||||
while (c_len > 1 && i < len) {
|
||||
c = (c << 6) | (buf[i++] & 0x3f);
|
||||
c_len--;
|
||||
}
|
||||
|
||||
// terminated by end of string?
|
||||
if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }
|
||||
|
||||
if (c < 0x10000) {
|
||||
utf16buf[out++] = c;
|
||||
} else {
|
||||
c -= 0x10000;
|
||||
utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);
|
||||
utf16buf[out++] = 0xdc00 | (c & 0x3ff);
|
||||
}
|
||||
}
|
||||
|
||||
return buf2binstring(utf16buf, out);
|
||||
};
|
||||
|
||||
|
||||
// Calculate max possible position in utf8 buffer,
|
||||
// that will not break sequence. If that's not possible
|
||||
// - (very small limits) return max size as is.
|
||||
//
|
||||
// buf[] - utf8 bytes array
|
||||
// max - length limit (mandatory);
|
||||
module.exports.utf8border = (buf, max) => {
|
||||
|
||||
max = max || buf.length;
|
||||
if (max > buf.length) { max = buf.length; }
|
||||
|
||||
// go back from last position, until start of sequence found
|
||||
let pos = max - 1;
|
||||
while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }
|
||||
|
||||
// Very small and broken sequence,
|
||||
// return max, because we should return something anyway.
|
||||
if (pos < 0) { return max; }
|
||||
|
||||
// If we came to start of buffer - that means buffer is too small,
|
||||
// return max too.
|
||||
if (pos === 0) { return max; }
|
||||
|
||||
return (pos + _utf8len[buf[pos]] > max) ? pos : max;
|
||||
};
|
59
node_modules/pako/lib/zlib/README
generated
vendored
Normal file
59
node_modules/pako/lib/zlib/README
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
Content of this folder follows zlib C sources as close as possible.
|
||||
That's intended to simplify maintainability and guarantee equal API
|
||||
and result.
|
||||
|
||||
Key differences:
|
||||
|
||||
- Everything is in JavaScript.
|
||||
- No platform-dependent blocks.
|
||||
- Some things like crc32 rewritten to keep size small and make JIT
|
||||
work better.
|
||||
- Some code is different due missed features in JS (macros, pointers,
|
||||
structures, header files)
|
||||
- Specific API methods are not implemented (see notes in root readme)
|
||||
|
||||
This port is based on zlib 1.2.8.
|
||||
|
||||
This port is under zlib license (see below) with contribution and addition of javascript
|
||||
port under expat license (see LICENSE at root of project)
|
||||
|
||||
Copyright:
|
||||
(C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
(C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
|
||||
|
||||
From zlib's README
|
||||
=============================================================================
|
||||
|
||||
Acknowledgments:
|
||||
|
||||
The deflate format used by zlib was defined by Phil Katz. The deflate and
|
||||
zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
||||
people who reported problems and suggested various improvements in zlib; they
|
||||
are too numerous to cite here.
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
|
||||
Copyright (c) <''year''> <''copyright holders''>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
51
node_modules/pako/lib/zlib/adler32.js
generated
vendored
Normal file
51
node_modules/pako/lib/zlib/adler32.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
// Note: adler32 takes 12% for level 0 and 2% for level 6.
|
||||
// It isn't worth it to make additional optimizations as in original.
|
||||
// Small size is preferable.
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
const adler32 = (adler, buf, len, pos) => {
|
||||
let s1 = (adler & 0xffff) |0,
|
||||
s2 = ((adler >>> 16) & 0xffff) |0,
|
||||
n = 0;
|
||||
|
||||
while (len !== 0) {
|
||||
// Set limit ~ twice less than 5552, to keep
|
||||
// s2 in 31-bits, because we force signed ints.
|
||||
// in other case %= will fail.
|
||||
n = len > 2000 ? 2000 : len;
|
||||
len -= n;
|
||||
|
||||
do {
|
||||
s1 = (s1 + buf[pos++]) |0;
|
||||
s2 = (s2 + s1) |0;
|
||||
} while (--n);
|
||||
|
||||
s1 %= 65521;
|
||||
s2 %= 65521;
|
||||
}
|
||||
|
||||
return (s1 | (s2 << 16)) |0;
|
||||
};
|
||||
|
||||
|
||||
module.exports = adler32;
|
68
node_modules/pako/lib/zlib/constants.js
generated
vendored
Normal file
68
node_modules/pako/lib/zlib/constants.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
module.exports = {
|
||||
|
||||
/* Allowed flush values; see deflate() and inflate() below for details */
|
||||
Z_NO_FLUSH: 0,
|
||||
Z_PARTIAL_FLUSH: 1,
|
||||
Z_SYNC_FLUSH: 2,
|
||||
Z_FULL_FLUSH: 3,
|
||||
Z_FINISH: 4,
|
||||
Z_BLOCK: 5,
|
||||
Z_TREES: 6,
|
||||
|
||||
/* Return codes for the compression/decompression functions. Negative values
|
||||
* are errors, positive values are used for special but normal events.
|
||||
*/
|
||||
Z_OK: 0,
|
||||
Z_STREAM_END: 1,
|
||||
Z_NEED_DICT: 2,
|
||||
Z_ERRNO: -1,
|
||||
Z_STREAM_ERROR: -2,
|
||||
Z_DATA_ERROR: -3,
|
||||
Z_MEM_ERROR: -4,
|
||||
Z_BUF_ERROR: -5,
|
||||
//Z_VERSION_ERROR: -6,
|
||||
|
||||
/* compression levels */
|
||||
Z_NO_COMPRESSION: 0,
|
||||
Z_BEST_SPEED: 1,
|
||||
Z_BEST_COMPRESSION: 9,
|
||||
Z_DEFAULT_COMPRESSION: -1,
|
||||
|
||||
|
||||
Z_FILTERED: 1,
|
||||
Z_HUFFMAN_ONLY: 2,
|
||||
Z_RLE: 3,
|
||||
Z_FIXED: 4,
|
||||
Z_DEFAULT_STRATEGY: 0,
|
||||
|
||||
/* Possible values of the data_type field (though see inflate()) */
|
||||
Z_BINARY: 0,
|
||||
Z_TEXT: 1,
|
||||
//Z_ASCII: 1, // = Z_TEXT (deprecated)
|
||||
Z_UNKNOWN: 2,
|
||||
|
||||
/* The deflate compression method */
|
||||
Z_DEFLATED: 8
|
||||
//Z_NULL: null // Use -1 or null inline, depending on var type
|
||||
};
|
59
node_modules/pako/lib/zlib/crc32.js
generated
vendored
Normal file
59
node_modules/pako/lib/zlib/crc32.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
// Note: we can't get significant speed boost here.
|
||||
// So write code to minimize size - no pregenerated tables
|
||||
// and array tools dependencies.
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
// Use ordinary array, since untyped makes no boost here
|
||||
const makeTable = () => {
|
||||
let c, table = [];
|
||||
|
||||
for (var n = 0; n < 256; n++) {
|
||||
c = n;
|
||||
for (var k = 0; k < 8; k++) {
|
||||
c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
|
||||
}
|
||||
table[n] = c;
|
||||
}
|
||||
|
||||
return table;
|
||||
};
|
||||
|
||||
// Create table on load. Just 255 signed longs. Not a problem.
|
||||
const crcTable = new Uint32Array(makeTable());
|
||||
|
||||
|
||||
const crc32 = (crc, buf, len, pos) => {
|
||||
const t = crcTable;
|
||||
const end = pos + len;
|
||||
|
||||
crc ^= -1;
|
||||
|
||||
for (let i = pos; i < end; i++) {
|
||||
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
|
||||
}
|
||||
|
||||
return (crc ^ (-1)); // >>> 0;
|
||||
};
|
||||
|
||||
|
||||
module.exports = crc32;
|
2048
node_modules/pako/lib/zlib/deflate.js
generated
vendored
Normal file
2048
node_modules/pako/lib/zlib/deflate.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
58
node_modules/pako/lib/zlib/gzheader.js
generated
vendored
Normal file
58
node_modules/pako/lib/zlib/gzheader.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
function GZheader() {
|
||||
/* true if compressed data believed to be text */
|
||||
this.text = 0;
|
||||
/* modification time */
|
||||
this.time = 0;
|
||||
/* extra flags (not used when writing a gzip file) */
|
||||
this.xflags = 0;
|
||||
/* operating system */
|
||||
this.os = 0;
|
||||
/* pointer to extra field or Z_NULL if none */
|
||||
this.extra = null;
|
||||
/* extra field length (valid if extra != Z_NULL) */
|
||||
this.extra_len = 0; // Actually, we don't need it in JS,
|
||||
// but leave for few code modifications
|
||||
|
||||
//
|
||||
// Setup limits is not necessary because in js we should not preallocate memory
|
||||
// for inflate use constant limit in 65536 bytes
|
||||
//
|
||||
|
||||
/* space at extra (only when reading header) */
|
||||
// this.extra_max = 0;
|
||||
/* pointer to zero-terminated file name or Z_NULL */
|
||||
this.name = '';
|
||||
/* space at name (only when reading header) */
|
||||
// this.name_max = 0;
|
||||
/* pointer to zero-terminated comment or Z_NULL */
|
||||
this.comment = '';
|
||||
/* space at comment (only when reading header) */
|
||||
// this.comm_max = 0;
|
||||
/* true if there was or will be a header crc */
|
||||
this.hcrc = 0;
|
||||
/* true when done reading gzip header (not used when writing a gzip file) */
|
||||
this.done = false;
|
||||
}
|
||||
|
||||
module.exports = GZheader;
|
344
node_modules/pako/lib/zlib/inffast.js
generated
vendored
Normal file
344
node_modules/pako/lib/zlib/inffast.js
generated
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
'use strict';
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
// See state defs from inflate.js
|
||||
const BAD = 16209; /* got a data error -- remain here until reset */
|
||||
const TYPE = 16191; /* i: waiting for type bits, including last-flag bit */
|
||||
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
available, an end-of-block is encountered, or a data error is encountered.
|
||||
When large enough input and output buffers are supplied to inflate(), for
|
||||
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
||||
inflate execution time is spent in this routine.
|
||||
|
||||
Entry assumptions:
|
||||
|
||||
state.mode === LEN
|
||||
strm.avail_in >= 6
|
||||
strm.avail_out >= 258
|
||||
start >= strm.avail_out
|
||||
state.bits < 8
|
||||
|
||||
On return, state.mode is one of:
|
||||
|
||||
LEN -- ran out of enough output space or enough available input
|
||||
TYPE -- reached end of block code, inflate() to interpret next block
|
||||
BAD -- error in block data
|
||||
|
||||
Notes:
|
||||
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm.avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm.avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
module.exports = function inflate_fast(strm, start) {
|
||||
let _in; /* local strm.input */
|
||||
let last; /* have enough input while in < last */
|
||||
let _out; /* local strm.output */
|
||||
let beg; /* inflate()'s initial strm.output */
|
||||
let end; /* while out < end, enough space available */
|
||||
//#ifdef INFLATE_STRICT
|
||||
let dmax; /* maximum distance from zlib header */
|
||||
//#endif
|
||||
let wsize; /* window size or zero if not using window */
|
||||
let whave; /* valid bytes in the window */
|
||||
let wnext; /* window write index */
|
||||
// Use `s_window` instead `window`, avoid conflict with instrumentation tools
|
||||
let s_window; /* allocated sliding window, if wsize != 0 */
|
||||
let hold; /* local strm.hold */
|
||||
let bits; /* local strm.bits */
|
||||
let lcode; /* local strm.lencode */
|
||||
let dcode; /* local strm.distcode */
|
||||
let lmask; /* mask for first level of length codes */
|
||||
let dmask; /* mask for first level of distance codes */
|
||||
let here; /* retrieved table entry */
|
||||
let op; /* code bits, operation, extra bits, or */
|
||||
/* window position, window bytes to copy */
|
||||
let len; /* match length, unused bytes */
|
||||
let dist; /* match distance */
|
||||
let from; /* where to copy match from */
|
||||
let from_source;
|
||||
|
||||
|
||||
let input, output; // JS specific, because we have no pointers
|
||||
|
||||
/* copy state to local variables */
|
||||
const state = strm.state;
|
||||
//here = state.here;
|
||||
_in = strm.next_in;
|
||||
input = strm.input;
|
||||
last = _in + (strm.avail_in - 5);
|
||||
_out = strm.next_out;
|
||||
output = strm.output;
|
||||
beg = _out - (start - strm.avail_out);
|
||||
end = _out + (strm.avail_out - 257);
|
||||
//#ifdef INFLATE_STRICT
|
||||
dmax = state.dmax;
|
||||
//#endif
|
||||
wsize = state.wsize;
|
||||
whave = state.whave;
|
||||
wnext = state.wnext;
|
||||
s_window = state.window;
|
||||
hold = state.hold;
|
||||
bits = state.bits;
|
||||
lcode = state.lencode;
|
||||
dcode = state.distcode;
|
||||
lmask = (1 << state.lenbits) - 1;
|
||||
dmask = (1 << state.distbits) - 1;
|
||||
|
||||
|
||||
/* decode literals and length/distances until end-of-block or not enough
|
||||
input data or output space */
|
||||
|
||||
top:
|
||||
do {
|
||||
if (bits < 15) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
|
||||
here = lcode[hold & lmask];
|
||||
|
||||
dolen:
|
||||
for (;;) { // Goto emulation
|
||||
op = here >>> 24/*here.bits*/;
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
op = (here >>> 16) & 0xff/*here.op*/;
|
||||
if (op === 0) { /* literal */
|
||||
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
// "inflate: literal '%c'\n" :
|
||||
// "inflate: literal 0x%02x\n", here.val));
|
||||
output[_out++] = here & 0xffff/*here.val*/;
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
len = here & 0xffff/*here.val*/;
|
||||
op &= 15; /* number of extra bits */
|
||||
if (op) {
|
||||
if (bits < op) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
len += hold & ((1 << op) - 1);
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
}
|
||||
//Tracevv((stderr, "inflate: length %u\n", len));
|
||||
if (bits < 15) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = dcode[hold & dmask];
|
||||
|
||||
dodist:
|
||||
for (;;) { // goto emulation
|
||||
op = here >>> 24/*here.bits*/;
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
op = (here >>> 16) & 0xff/*here.op*/;
|
||||
|
||||
if (op & 16) { /* distance base */
|
||||
dist = here & 0xffff/*here.val*/;
|
||||
op &= 15; /* number of extra bits */
|
||||
if (bits < op) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
if (bits < op) {
|
||||
hold += input[_in++] << bits;
|
||||
bits += 8;
|
||||
}
|
||||
}
|
||||
dist += hold & ((1 << op) - 1);
|
||||
//#ifdef INFLATE_STRICT
|
||||
if (dist > dmax) {
|
||||
strm.msg = 'invalid distance too far back';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
//#endif
|
||||
hold >>>= op;
|
||||
bits -= op;
|
||||
//Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||
op = _out - beg; /* max distance in output */
|
||||
if (dist > op) { /* see if copy from window */
|
||||
op = dist - op; /* distance back in window */
|
||||
if (op > whave) {
|
||||
if (state.sane) {
|
||||
strm.msg = 'invalid distance too far back';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
|
||||
// (!) This block is disabled in zlib defaults,
|
||||
// don't enable it for binary compatibility
|
||||
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
// if (len <= op - whave) {
|
||||
// do {
|
||||
// output[_out++] = 0;
|
||||
// } while (--len);
|
||||
// continue top;
|
||||
// }
|
||||
// len -= op - whave;
|
||||
// do {
|
||||
// output[_out++] = 0;
|
||||
// } while (--op > whave);
|
||||
// if (op === 0) {
|
||||
// from = _out - dist;
|
||||
// do {
|
||||
// output[_out++] = output[from++];
|
||||
// } while (--len);
|
||||
// continue top;
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
from = 0; // window index
|
||||
from_source = s_window;
|
||||
if (wnext === 0) { /* very common case */
|
||||
from += wsize - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
}
|
||||
else if (wnext < op) { /* wrap around window */
|
||||
from += wsize + wnext - op;
|
||||
op -= wnext;
|
||||
if (op < len) { /* some from end of window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = 0;
|
||||
if (wnext < len) { /* some from start of window */
|
||||
op = wnext;
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* contiguous in window */
|
||||
from += wnext - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
output[_out++] = s_window[from++];
|
||||
} while (--op);
|
||||
from = _out - dist; /* rest from output */
|
||||
from_source = output;
|
||||
}
|
||||
}
|
||||
while (len > 2) {
|
||||
output[_out++] = from_source[from++];
|
||||
output[_out++] = from_source[from++];
|
||||
output[_out++] = from_source[from++];
|
||||
len -= 3;
|
||||
}
|
||||
if (len) {
|
||||
output[_out++] = from_source[from++];
|
||||
if (len > 1) {
|
||||
output[_out++] = from_source[from++];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
from = _out - dist; /* copy direct from output */
|
||||
do { /* minimum length is three */
|
||||
output[_out++] = output[from++];
|
||||
output[_out++] = output[from++];
|
||||
output[_out++] = output[from++];
|
||||
len -= 3;
|
||||
} while (len > 2);
|
||||
if (len) {
|
||||
output[_out++] = output[from++];
|
||||
if (len > 1) {
|
||||
output[_out++] = output[from++];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((op & 64) === 0) { /* 2nd level distance code */
|
||||
here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||
continue dodist;
|
||||
}
|
||||
else {
|
||||
strm.msg = 'invalid distance code';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
|
||||
break; // need to emulate goto via "continue"
|
||||
}
|
||||
}
|
||||
else if ((op & 64) === 0) { /* 2nd level length code */
|
||||
here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
|
||||
continue dolen;
|
||||
}
|
||||
else if (op & 32) { /* end-of-block */
|
||||
//Tracevv((stderr, "inflate: end of block\n"));
|
||||
state.mode = TYPE;
|
||||
break top;
|
||||
}
|
||||
else {
|
||||
strm.msg = 'invalid literal/length code';
|
||||
state.mode = BAD;
|
||||
break top;
|
||||
}
|
||||
|
||||
break; // need to emulate goto via "continue"
|
||||
}
|
||||
} while (_in < last && _out < end);
|
||||
|
||||
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
||||
len = bits >> 3;
|
||||
_in -= len;
|
||||
bits -= len << 3;
|
||||
hold &= (1 << bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
strm.next_in = _in;
|
||||
strm.next_out = _out;
|
||||
strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
|
||||
strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
|
||||
state.hold = hold;
|
||||
state.bits = bits;
|
||||
return;
|
||||
};
|
1572
node_modules/pako/lib/zlib/inflate.js
generated
vendored
Normal file
1572
node_modules/pako/lib/zlib/inflate.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
340
node_modules/pako/lib/zlib/inftrees.js
generated
vendored
Normal file
340
node_modules/pako/lib/zlib/inftrees.js
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
'use strict';
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
const MAXBITS = 15;
|
||||
const ENOUGH_LENS = 852;
|
||||
const ENOUGH_DISTS = 592;
|
||||
//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
|
||||
|
||||
const CODES = 0;
|
||||
const LENS = 1;
|
||||
const DISTS = 2;
|
||||
|
||||
const lbase = new Uint16Array([ /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
]);
|
||||
|
||||
const lext = new Uint8Array([ /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
|
||||
]);
|
||||
|
||||
const dbase = new Uint16Array([ /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
8193, 12289, 16385, 24577, 0, 0
|
||||
]);
|
||||
|
||||
const dext = new Uint8Array([ /* Distance codes 0..29 extra */
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
||||
28, 28, 29, 29, 64, 64
|
||||
]);
|
||||
|
||||
const inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>
|
||||
{
|
||||
const bits = opts.bits;
|
||||
//here = opts.here; /* table entry for duplication */
|
||||
|
||||
let len = 0; /* a code's length in bits */
|
||||
let sym = 0; /* index of code symbols */
|
||||
let min = 0, max = 0; /* minimum and maximum code lengths */
|
||||
let root = 0; /* number of index bits for root table */
|
||||
let curr = 0; /* number of index bits for current table */
|
||||
let drop = 0; /* code bits to drop for sub-table */
|
||||
let left = 0; /* number of prefix codes available */
|
||||
let used = 0; /* code entries in table used */
|
||||
let huff = 0; /* Huffman code */
|
||||
let incr; /* for incrementing code, index */
|
||||
let fill; /* index for replicating entries */
|
||||
let low; /* low bits for current root entry */
|
||||
let mask; /* mask for low root bits */
|
||||
let next; /* next available space in table */
|
||||
let base = null; /* base value table to use */
|
||||
// let shoextra; /* extra bits table to use */
|
||||
let match; /* use base and extra for symbol >= match */
|
||||
const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
|
||||
const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
|
||||
let extra = null;
|
||||
|
||||
let here_bits, here_op, here_val;
|
||||
|
||||
/*
|
||||
Process a set of code lengths to create a canonical Huffman code. The
|
||||
code lengths are lens[0..codes-1]. Each length corresponds to the
|
||||
symbols 0..codes-1. The Huffman code is generated by first sorting the
|
||||
symbols by length from short to long, and retaining the symbol order
|
||||
for codes with equal lengths. Then the code starts with all zero bits
|
||||
for the first code of the shortest length, and the codes are integer
|
||||
increments for the same length, and zeros are appended as the length
|
||||
increases. For the deflate format, these bits are stored backwards
|
||||
from their more natural integer increment ordering, and so when the
|
||||
decoding tables are built in the large loop below, the integer codes
|
||||
are incremented backwards.
|
||||
|
||||
This routine assumes, but does not check, that all of the entries in
|
||||
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
||||
1..MAXBITS is interpreted as that code length. zero means that that
|
||||
symbol does not occur in this code.
|
||||
|
||||
The codes are sorted by computing a count of codes for each length,
|
||||
creating from that a table of starting indices for each length in the
|
||||
sorted table, and then entering the symbols in order in the sorted
|
||||
table. The sorted table is work[], with that space being provided by
|
||||
the caller.
|
||||
|
||||
The length counts are used for other purposes as well, i.e. finding
|
||||
the minimum and maximum length codes, determining if there are any
|
||||
codes at all, checking for a valid set of lengths, and looking ahead
|
||||
at length counts to determine sub-table sizes when building the
|
||||
decoding tables.
|
||||
*/
|
||||
|
||||
/* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
|
||||
for (len = 0; len <= MAXBITS; len++) {
|
||||
count[len] = 0;
|
||||
}
|
||||
for (sym = 0; sym < codes; sym++) {
|
||||
count[lens[lens_index + sym]]++;
|
||||
}
|
||||
|
||||
/* bound code lengths, force root to be within code lengths */
|
||||
root = bits;
|
||||
for (max = MAXBITS; max >= 1; max--) {
|
||||
if (count[max] !== 0) { break; }
|
||||
}
|
||||
if (root > max) {
|
||||
root = max;
|
||||
}
|
||||
if (max === 0) { /* no symbols to code at all */
|
||||
//table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
|
||||
//table.bits[opts.table_index] = 1; //here.bits = (var char)1;
|
||||
//table.val[opts.table_index++] = 0; //here.val = (var short)0;
|
||||
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
||||
|
||||
|
||||
//table.op[opts.table_index] = 64;
|
||||
//table.bits[opts.table_index] = 1;
|
||||
//table.val[opts.table_index++] = 0;
|
||||
table[table_index++] = (1 << 24) | (64 << 16) | 0;
|
||||
|
||||
opts.bits = 1;
|
||||
return 0; /* no symbols, but wait for decoding to report error */
|
||||
}
|
||||
for (min = 1; min < max; min++) {
|
||||
if (count[min] !== 0) { break; }
|
||||
}
|
||||
if (root < min) {
|
||||
root = min;
|
||||
}
|
||||
|
||||
/* check for an over-subscribed or incomplete set of lengths */
|
||||
left = 1;
|
||||
for (len = 1; len <= MAXBITS; len++) {
|
||||
left <<= 1;
|
||||
left -= count[len];
|
||||
if (left < 0) {
|
||||
return -1;
|
||||
} /* over-subscribed */
|
||||
}
|
||||
if (left > 0 && (type === CODES || max !== 1)) {
|
||||
return -1; /* incomplete set */
|
||||
}
|
||||
|
||||
/* generate offsets into symbol table for each length for sorting */
|
||||
offs[1] = 0;
|
||||
for (len = 1; len < MAXBITS; len++) {
|
||||
offs[len + 1] = offs[len] + count[len];
|
||||
}
|
||||
|
||||
/* sort symbols by length, by symbol order within each length */
|
||||
for (sym = 0; sym < codes; sym++) {
|
||||
if (lens[lens_index + sym] !== 0) {
|
||||
work[offs[lens[lens_index + sym]]++] = sym;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Create and fill in decoding tables. In this loop, the table being
|
||||
filled is at next and has curr index bits. The code being used is huff
|
||||
with length len. That code is converted to an index by dropping drop
|
||||
bits off of the bottom. For codes where len is less than drop + curr,
|
||||
those top drop + curr - len bits are incremented through all values to
|
||||
fill the table with replicated entries.
|
||||
|
||||
root is the number of index bits for the root table. When len exceeds
|
||||
root, sub-tables are created pointed to by the root entry with an index
|
||||
of the low root bits of huff. This is saved in low to check for when a
|
||||
new sub-table should be started. drop is zero when the root table is
|
||||
being filled, and drop is root when sub-tables are being filled.
|
||||
|
||||
When a new sub-table is needed, it is necessary to look ahead in the
|
||||
code lengths to determine what size sub-table is needed. The length
|
||||
counts are used for this, and so count[] is decremented as codes are
|
||||
entered in the tables.
|
||||
|
||||
used keeps track of how many table entries have been allocated from the
|
||||
provided *table space. It is checked for LENS and DIST tables against
|
||||
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
||||
the initial root table size constants. See the comments in inftrees.h
|
||||
for more information.
|
||||
|
||||
sym increments through all symbols, and the loop terminates when
|
||||
all codes of length max, i.e. all codes, have been processed. This
|
||||
routine permits incomplete codes, so another loop after this one fills
|
||||
in the rest of the decoding tables with invalid code markers.
|
||||
*/
|
||||
|
||||
/* set up for code type */
|
||||
// poor man optimization - use if-else instead of switch,
|
||||
// to avoid deopts in old v8
|
||||
if (type === CODES) {
|
||||
base = extra = work; /* dummy value--not used */
|
||||
match = 20;
|
||||
|
||||
} else if (type === LENS) {
|
||||
base = lbase;
|
||||
extra = lext;
|
||||
match = 257;
|
||||
|
||||
} else { /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
match = 0;
|
||||
}
|
||||
|
||||
/* initialize opts for loop */
|
||||
huff = 0; /* starting code */
|
||||
sym = 0; /* starting code symbol */
|
||||
len = min; /* starting code length */
|
||||
next = table_index; /* current table to fill in */
|
||||
curr = root; /* current table index bits */
|
||||
drop = 0; /* current bits to drop from code for index */
|
||||
low = -1; /* trigger new sub-table when len > root */
|
||||
used = 1 << root; /* use root table entries */
|
||||
mask = used - 1; /* mask for comparing low */
|
||||
|
||||
/* check available table space */
|
||||
if ((type === LENS && used > ENOUGH_LENS) ||
|
||||
(type === DISTS && used > ENOUGH_DISTS)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* process all codes and make table entries */
|
||||
for (;;) {
|
||||
/* create table entry */
|
||||
here_bits = len - drop;
|
||||
if (work[sym] + 1 < match) {
|
||||
here_op = 0;
|
||||
here_val = work[sym];
|
||||
}
|
||||
else if (work[sym] >= match) {
|
||||
here_op = extra[work[sym] - match];
|
||||
here_val = base[work[sym] - match];
|
||||
}
|
||||
else {
|
||||
here_op = 32 + 64; /* end of block */
|
||||
here_val = 0;
|
||||
}
|
||||
|
||||
/* replicate for those indices with low len bits equal to huff */
|
||||
incr = 1 << (len - drop);
|
||||
fill = 1 << curr;
|
||||
min = fill; /* save offset to next table */
|
||||
do {
|
||||
fill -= incr;
|
||||
table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
|
||||
} while (fill !== 0);
|
||||
|
||||
/* backwards increment the len-bit code huff */
|
||||
incr = 1 << (len - 1);
|
||||
while (huff & incr) {
|
||||
incr >>= 1;
|
||||
}
|
||||
if (incr !== 0) {
|
||||
huff &= incr - 1;
|
||||
huff += incr;
|
||||
} else {
|
||||
huff = 0;
|
||||
}
|
||||
|
||||
/* go to next symbol, update count, len */
|
||||
sym++;
|
||||
if (--count[len] === 0) {
|
||||
if (len === max) { break; }
|
||||
len = lens[lens_index + work[sym]];
|
||||
}
|
||||
|
||||
/* create new sub-table if needed */
|
||||
if (len > root && (huff & mask) !== low) {
|
||||
/* if first time, transition to sub-tables */
|
||||
if (drop === 0) {
|
||||
drop = root;
|
||||
}
|
||||
|
||||
/* increment past last table */
|
||||
next += min; /* here min is 1 << curr */
|
||||
|
||||
/* determine length of next table */
|
||||
curr = len - drop;
|
||||
left = 1 << curr;
|
||||
while (curr + drop < max) {
|
||||
left -= count[curr + drop];
|
||||
if (left <= 0) { break; }
|
||||
curr++;
|
||||
left <<= 1;
|
||||
}
|
||||
|
||||
/* check for enough space */
|
||||
used += 1 << curr;
|
||||
if ((type === LENS && used > ENOUGH_LENS) ||
|
||||
(type === DISTS && used > ENOUGH_DISTS)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* point entry in root table to sub-table */
|
||||
low = huff & mask;
|
||||
/*table.op[low] = curr;
|
||||
table.bits[low] = root;
|
||||
table.val[low] = next - opts.table_index;*/
|
||||
table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
|
||||
}
|
||||
}
|
||||
|
||||
/* fill in remaining table entry if code is incomplete (guaranteed to have
|
||||
at most one remaining entry, since if the code is incomplete, the
|
||||
maximum code length that was allowed to get this far is one bit) */
|
||||
if (huff !== 0) {
|
||||
//table.op[next + huff] = 64; /* invalid code marker */
|
||||
//table.bits[next + huff] = len - drop;
|
||||
//table.val[next + huff] = 0;
|
||||
table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
|
||||
}
|
||||
|
||||
/* set return parameters */
|
||||
//opts.table_index += used;
|
||||
opts.bits = root;
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
module.exports = inflate_table;
|
32
node_modules/pako/lib/zlib/messages.js
generated
vendored
Normal file
32
node_modules/pako/lib/zlib/messages.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
module.exports = {
|
||||
2: 'need dictionary', /* Z_NEED_DICT 2 */
|
||||
1: 'stream end', /* Z_STREAM_END 1 */
|
||||
0: '', /* Z_OK 0 */
|
||||
'-1': 'file error', /* Z_ERRNO (-1) */
|
||||
'-2': 'stream error', /* Z_STREAM_ERROR (-2) */
|
||||
'-3': 'data error', /* Z_DATA_ERROR (-3) */
|
||||
'-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
|
||||
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
|
||||
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
|
||||
};
|
1179
node_modules/pako/lib/zlib/trees.js
generated
vendored
Normal file
1179
node_modules/pako/lib/zlib/trees.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
47
node_modules/pako/lib/zlib/zstream.js
generated
vendored
Normal file
47
node_modules/pako/lib/zlib/zstream.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
// (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would be
|
||||
// appreciated but is not required.
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be
|
||||
// misrepresented as being the original software.
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
function ZStream() {
|
||||
/* next input byte */
|
||||
this.input = null; // JS specific, because we have no pointers
|
||||
this.next_in = 0;
|
||||
/* number of bytes available at input */
|
||||
this.avail_in = 0;
|
||||
/* total number of input bytes read so far */
|
||||
this.total_in = 0;
|
||||
/* next output byte should be put there */
|
||||
this.output = null; // JS specific, because we have no pointers
|
||||
this.next_out = 0;
|
||||
/* remaining free space at output */
|
||||
this.avail_out = 0;
|
||||
/* total number of bytes output so far */
|
||||
this.total_out = 0;
|
||||
/* last error message, NULL if no error */
|
||||
this.msg = ''/*Z_NULL*/;
|
||||
/* not visible by applications */
|
||||
this.state = null;
|
||||
/* best guess about the data type: binary or text */
|
||||
this.data_type = 2/*Z_UNKNOWN*/;
|
||||
/* adler32 value of the uncompressed data */
|
||||
this.adler = 0;
|
||||
}
|
||||
|
||||
module.exports = ZStream;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user