├── .gitignore ├── .travis.yml ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── Makefile ├── README.md ├── build.rs ├── device.x └── svd ├── esp8266.base.svd └── patches ├── _dport.yaml ├── _gpio.yaml ├── _io_mux.yaml ├── _misc.yaml ├── _rtc.yaml ├── _spi.yaml ├── _timer.yaml ├── _uart.yaml └── esp8266.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | src 4 | svd/esp8266.svd 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | rust: 3 | - nightly 4 | cache: cargo 5 | dist: "trusty" 6 | before_install: 7 | - python --version 8 | - pyenv install 3.6.3 9 | - pyenv global 3.6.3 10 | 11 | matrix: 12 | fast_finish: true 13 | 14 | install: 15 | - rustup component add rustfmt 16 | - pip3 install --upgrade --user svdtools 17 | - cargo install form --force 18 | - cargo install --git https://github.com/rust-embedded/svd2rust svd2rust --force 19 | 20 | script: make clean patch generate form fmt 21 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "esp8266" 3 | version = "0.3.0" 4 | description = "A minimal peripheral access crate the ESP8266" 5 | authors = ["Robin Appelman "] 6 | edition = "2018" 7 | repository = "https://github.com/esp-rs/esp8266" 8 | 9 | include = [ 10 | "/src/**", 11 | ] 12 | license = "MIT OR Apache-2.0" 13 | 14 | [dependencies] 15 | bare-metal = "1" 16 | vcell = "0.1" 17 | xtensa-lx = "0.4" 18 | xtensa-lx-rt = { version = "0.7.0", optional = true } 19 | 20 | [features] 21 | default=[] 22 | rt=["xtensa-lx-rt"] 23 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 The esp-rs Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | OUTPUT=esp8266.svd 2 | BASE=esp8266.base.svd 3 | 4 | all: clean patch generate form fmt build 5 | 6 | clean: 7 | rm -rf src/ 8 | 9 | patch: 10 | rm -f svd/$(OUTPUT) 11 | svd patch svd/patches/esp8266.yaml 12 | mv svd/$(BASE).patched svd/$(OUTPUT) 13 | 14 | generate: 15 | svd2rust --target xtensa-lx -i svd/$(OUTPUT) 16 | 17 | form: 18 | form -i lib.rs -o src/ 19 | rm lib.rs 20 | 21 | fmt: 22 | cargo fmt 23 | 24 | build: 25 | cargo clean 26 | cargo build 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esp8266 2 | 3 | --- 4 | 5 | ## This project has moved! It can now be found in the [esp-rs/esp-pacs](https://github.com/esp-rs/esp-pacs/tree/main/esp8266) repository. 6 | 7 | --- 8 | 9 | [![Build Status](https://travis-ci.com/esp-rs/esp8266.svg?branch=master)](https://travis-ci.com/esp-rs/esp8266) 10 | ![crates.io](https://img.shields.io/crates/v/esp8266.svg) 11 | 12 | A peripheral access crate the ESP8266. See the [`svd2rust` repo](https://github.com/rust-embedded/svd2rust) for more infomation on how to use this crate. Espressif do not provide an SVD for the ESP8266, so the SVD used in this project has been generated from the C header documentation via the [idf2svd](https://github.com/MabezDev/idf2svd) tool. 13 | 14 | Join in on the discussion: https://matrix.to/#/#esp-rs:matrix.org! 15 | 16 | ## [`Documentation`](https://docs.rs/esp8266/latest/esp8266/) 17 | 18 | ## Building 19 | 20 | Required dependencies: 21 | 22 | - [form](https://crates.io/crates/form) 23 | - [svd](https://github.com/stm32-rs/svdtools) 24 | - [svd2rust](https://github.com/rust-embedded/svd2rust) 25 | 26 | ``` 27 | $ make 28 | ``` 29 | 30 | ## Submitting new patches 31 | 32 | The base svd file created from `idf2svd` should **not** be edited. Instead the svd is manipulated through the svdtools patching tool. 33 | 34 | See [svdtools](https://github.com/stm32-rs/svdtools) and [Device and Peripheral YAML Format](https://github.com/stm32-rs/svdtools#device-and-peripheral-yaml-format) for more infomation on patching. 35 | 36 | ## License 37 | 38 | Licensed under either of 39 | 40 | - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or 41 | http://www.apache.org/licenses/LICENSE-2.0) 42 | - MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 43 | 44 | at your option. 45 | 46 | ### Contribution 47 | 48 | Unless you explicitly state otherwise, any contribution intentionally submitted 49 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 50 | dual licensed as above, without any additional terms or conditions. 51 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::fs::File; 3 | use std::io::Write; 4 | use std::path::PathBuf; 5 | fn main() { 6 | if env::var_os("CARGO_FEATURE_RT").is_some() { 7 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 8 | File::create(out.join("device.x")) 9 | .unwrap() 10 | .write_all(include_bytes!("device.x")) 11 | .unwrap(); 12 | println!("cargo:rustc-link-search={}", out.display()); 13 | println!("cargo:rerun-if-changed=device.x"); 14 | } 15 | println!("cargo:rerun-if-changed=build.rs"); 16 | } 17 | -------------------------------------------------------------------------------- /device.x: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /svd/patches/_dport.yaml: -------------------------------------------------------------------------------- 1 | "DPORT": 2 | EDGE_INT_ENABLE: 3 | _add: 4 | wdt_edge_int_enable: 5 | description: "Enable the watchdog timer edge interrupt" 6 | bitOffset: 0 7 | bitWidth: 1 8 | timer1_edge_int_enable: 9 | description: "Enable the timer1 edge interrupt" 10 | bitOffset: 1 11 | bitWidth: 1 12 | _add: 13 | IOSWAP: 14 | description: IO Swap register 15 | addressOffset: 0x28 16 | size: 32 17 | access: read-write 18 | resetValue: 0x00000000 19 | fields: 20 | uart: 21 | description: "Swap UART" 22 | bitOffset: 0 23 | bitWidth: 1 24 | spi: 25 | description: "Swap SPI" 26 | bitOffset: 1 27 | bitWidth: 1 28 | uart0: 29 | description: "Swap UART0 pins (u0rxd <-> u0cts), (u0txd <-> u0rts)" 30 | bitOffset: 2 31 | bitWidth: 1 32 | uart1: 33 | description: "Swap UART1 pins (u1rxd <-> u1cts), (u1txd <-> u1rts)" 34 | bitOffset: 3 35 | bitWidth: 1 36 | hspi: 37 | description: "Set HSPI with higher priority" 38 | bitOffset: 5 39 | bitWidth: 1 40 | double_hspi: 41 | description: "Set two SPI masters on HSPI" 42 | bitOffset: 6 43 | bitWidth: 1 44 | double_cspi: 45 | description: "Set two SPI masters on CSPI" 46 | bitOffset: 7 47 | bitWidth: 1 48 | SPI_CACHE: 49 | description: "Controls SPI memory-mapped caching" 50 | addressOffset: 0xc 51 | size: 32 52 | access: read-write 53 | resetValue: 0x00000000 54 | fields: 55 | cache_flush_start: 56 | description: "Flush cache" 57 | bitOffset: 0 58 | bitWidth: 1 59 | cache_empty: 60 | description: "Cache is empty" 61 | bitOffset: 1 62 | bitWidth: 1 63 | cache_enable: 64 | description: "Cache enable" 65 | bitOffset: 8 66 | bitWidth: 1 67 | busy: 68 | description: "SPI busy" 69 | bitOffset: 9 70 | bitWidth: 1 71 | block: 72 | description: "Flash memory block to map, in 2mb blocks" 73 | bitOffset: 16 74 | bitWidth: 3 75 | offset: 76 | description: "Offset within block to map, in megabytes" 77 | bitOffset: 24 78 | bitWidth: 2 79 | target: 80 | description: "Controls where the spi flash is mapped (unconfirmed)" 81 | bitOffset: 26 82 | bitWidth: 1 83 | SPI_INTERRUPT_TYPE: 84 | description: "SPI interrupt type register" 85 | addressOffset: 0x20 86 | size: 32 87 | access: read-only 88 | resetValue: 0x00000000 89 | fields: 90 | spi0: 91 | description: "SPI0 interrupt" 92 | bitOffset: 4 93 | bitWidth: 1 94 | spi1: 95 | description: "SPI1 interrupt" 96 | bitOffset: 7 97 | bitWidth: 1 98 | i2s: 99 | description: "I2S interrupt" 100 | bitOffset: 9 101 | bitWidth: 1 102 | SPI_CACHE_TARGET: 103 | description: "Control where the cache is mapped (unconfirmed)" 104 | addressOffset: 0x24 105 | size: 32 106 | access: read-write 107 | resetValue: 0x00000000 108 | fields: 109 | target1: 110 | bitOffset: 3 111 | bitWidth: 1 112 | target2: 113 | bitOffset: 4 114 | bitWidth: 1 -------------------------------------------------------------------------------- /svd/patches/_gpio.yaml: -------------------------------------------------------------------------------- 1 | GPIO: 2 | "GPIO_PIN*": 3 | "GPIO_PIN*_INT_TYPE": 4 | disabled: [0, "interrupt is disabled"] 5 | positive_edge: [1, "interrupt is triggered on the positive edge"] 6 | negative_edge: [2, "interrupt is triggered on the negative edge"] 7 | both_edges: [3, "interrupt is triggered on both edges"] 8 | low_level: [4, "interrupt is triggered on the low level"] 9 | high_level: [5, "interrupt is triggered on the high level"] 10 | "GPIO_PIN*_DRIVER": 11 | open_drain: [0, "open drain"] 12 | normal: [1, "normal"] 13 | "GPIO_PIN*_SOURCE": 14 | sigma_delta: [0, "sigma-delta"] 15 | gpio_data: [1, "gpio data"] 16 | -------------------------------------------------------------------------------- /svd/patches/_io_mux.yaml: -------------------------------------------------------------------------------- 1 | IO_MUX: 2 | "IO_MUX_[MUSG]*": # matches the 16 pin configuration, but not IO_MUX_CONF 3 | _add: 4 | FUNCTION_SELECT_LOW_BITS: 5 | description: "configures IO_MUX function, bottom 2 bits" 6 | bitOffset: 4 7 | bitWidth: 2 8 | FUNCTION_SELECT_HIGH_BIT: 9 | description: "configures IO_MUX function, upper bit" 10 | bitOffset: 8 11 | bitWidth: 1 12 | PULLUP: 13 | description: "configures pull up" 14 | bitOffset: 7 15 | bitWidth: 1 16 | SLEEP_PULLUP: 17 | description: "configures pull up during sleep mode" 18 | bitOffset: 3 19 | bitWidth: 1 20 | SLEEP_ENABLE: 21 | description: "configures output enable during sleep mode" 22 | bitOffset: 0 23 | bitWidth: 1 -------------------------------------------------------------------------------- /svd/patches/_misc.yaml: -------------------------------------------------------------------------------- 1 | _add: 2 | # See https://web.archive.org/web/20170604020535/http://esp8266-re.foogod.com/wiki/Random_Number_Generator 3 | RNG: 4 | description: RNG register 5 | baseAddress: "0x3FF20E44" 6 | addressBlock: 7 | offset: 0x0 8 | size: 32 9 | usage: "registers" 10 | registers: 11 | rng: 12 | description: RNG register 13 | addressOffset: 0x0 14 | size: 32 15 | access: read-only 16 | resetValue: 0x00000000 17 | RTCCNTL: 18 | description: "Internal I2C registers" 19 | baseAddress: 0x60000d00 20 | addressBlock: 21 | offset: 0x0 22 | size: 32 23 | usage: "registers" 24 | registers: 25 | PLL: 26 | description: PLL I2C Register 27 | addressOffset: 0x10 28 | size: 32 29 | access: read-write 30 | resetValue: 0 31 | fields: 32 | BLOCK: 33 | description: Block 34 | bitOffset: 0 35 | bitWidth: 8 36 | ADDR: 37 | description: Address 38 | bitOffset: 8 39 | bitWidth: 8 40 | DATA: 41 | description: Data 42 | bitOffset: 16 43 | bitWidth: 8 44 | WRITE: 45 | description: Write 46 | bitOffset: 24 47 | bitWidth: 1 48 | BUSY: 49 | description: Ready 50 | bitOffset: 25 51 | bitWidth: 1 52 | # See https://mongoose-os.com/blog/esp8266-watchdog-timer/ 53 | WDT: 54 | WDT_CTL: 55 | _add: 56 | enable: 57 | description: "Enable the watchdog timer." 58 | bitOffset: 0 59 | bitWidth: 1 60 | stage_1_no_reset: 61 | description: "When set to 1, and running in two-stage mode, it turns the watchdog into a single shot timer that doesn't reset the device." 62 | bitOffset: 1 63 | bitWidth: 1 64 | stage_1_disable: 65 | description: "Set to 1 to disable the stage 1 of the watchdog timer" 66 | bitOffset: 2 67 | bitWidth: 1 68 | unknown_3: 69 | bitOffset: 3 70 | bitWidth: 1 71 | unknown_4: 72 | bitOffset: 4 73 | bitWidth: 1 74 | unknown_5: 75 | bitOffset: 5 76 | bitWidth: 1 77 | WDT_RST: 78 | _modify: 79 | description: Watchdog reset 80 | WDT_OP: 81 | _modify: 82 | description: Reload value for stage 0 83 | WDT_OP_ND: 84 | _modify: 85 | description: Reload value for stage 1 86 | _add: 87 | count: 88 | description: Watchdog clock cycle count 89 | addressOffset: 0xc 90 | size: 32 91 | access: read-write 92 | resetValue: 0x00000000 93 | stage: 94 | description: The current watchdog stage 95 | addressOffset: 0x10 96 | size: 32 97 | access: read-write 98 | resetValue: 0x00000000 99 | reset_stage: 100 | description: Watchdog stage reset 101 | addressOffset: 0x18 102 | size: 32 103 | access: read-write 104 | resetValue: 0x00000000 105 | -------------------------------------------------------------------------------- /svd/patches/_rtc.yaml: -------------------------------------------------------------------------------- 1 | # https://github.com/cesanta/mongoose-os/blob/f626b5113861634e9a4acc96bdb73de29ed8a4d0/platforms/esp8266/rboot/rboot/rboot.c#L129-L135 2 | RTC: 3 | _add: 4 | PAD_XPD_DCDC_CONF: 5 | access: read-write 6 | addressOffset: 0xA0 7 | description: PAD_XPD_DCDC_CONF 8 | resetValue: 0x0 9 | size: 32 10 | RTC_GPIO_CONF: 11 | access: read-write 12 | addressOffset: 0x90 13 | description: RTC_GPIO_CONF 14 | resetValue: 0x0 15 | size: 32 16 | RTC_GPIO_ENABLE: 17 | access: read-write 18 | addressOffset: 0x74 19 | description: RTC_GPIO_ENABLE 20 | resetValue: 0x0 21 | size: 32 22 | RTC_GPIO_IN_DATA: 23 | access: read-write 24 | addressOffset: 0x8C 25 | description: RTC_GPIO_IN_DATA 26 | resetValue: 0x0 27 | size: 32 28 | RTC_GPIO_OUT: 29 | access: read-write 30 | addressOffset: 0x68 31 | description: RTC_GPIO_OUT 32 | resetValue: 0x0 33 | size: 32 34 | -------------------------------------------------------------------------------- /svd/patches/_spi.yaml: -------------------------------------------------------------------------------- 1 | "SPI*": 2 | SPI_CMD: 3 | _add: 4 | spi_read: 5 | bitOffset: 31 6 | bitWidth: 1 7 | spi_write_enable: 8 | bitOffset: 30 9 | bitWidth: 1 10 | spi_write_disable: 11 | bitOffset: 29 12 | bitWidth: 1 13 | spi_read_id: 14 | bitOffset: 28 15 | bitWidth: 1 16 | spi_read_sr: 17 | bitOffset: 27 18 | bitWidth: 1 19 | spi_write_sr: 20 | bitOffset: 26 21 | bitWidth: 1 22 | spi_pp: 23 | bitOffset: 25 24 | bitWidth: 1 25 | spi_se: 26 | bitOffset: 24 27 | bitWidth: 1 28 | spi_be: 29 | bitOffset: 23 30 | bitWidth: 1 31 | spi_ce: 32 | bitOffset: 22 33 | bitWidth: 1 34 | spi_dp: 35 | bitOffset: 21 36 | bitWidth: 1 37 | spi_res: 38 | bitOffset: 20 39 | bitWidth: 1 40 | spi_hpm: 41 | bitOffset: 19 42 | bitWidth: 1 43 | SPI_ADDR: 44 | _add: 45 | address: 46 | bitOffset: 0 47 | bitWidth: 24 48 | size: 49 | bitOffset: 24 50 | bitWidth: 8 51 | SPI_USER: 52 | _add: 53 | spi_ck_o_edge: 54 | description: "In the master mode, 1: rising-edge; 0: falling-edge" 55 | bitOffset: 7 56 | bitWidth: 1 57 | spi_cs_setup: 58 | description: "spi cs is enable when spi is in prepare phase. 1: enable 0: disable." 59 | bitOffset: 5 60 | bitWidth: 1 61 | spi_cs_hold: 62 | description: "spi cs keep low when spi is in done phase. 1: enable 0: disable." 63 | bitOffset: 4 64 | bitWidth: 1 65 | spi_ahb_user_command: 66 | description: "reserved" 67 | bitOffset: 3 68 | bitWidth: 1 69 | spi_flash_mode: 70 | bitOffset: 2 71 | bitWidth: 1 72 | spi_ahb_user_command_4byte: 73 | description: "reserved" 74 | bitOffset: 1 75 | bitWidth: 1 76 | spi_duplex: 77 | description: "set spi in full duplex mode" 78 | bitOffset: 0 79 | bitWidth: 1 80 | SPI_PIN: 81 | _add: 82 | spi_idle_edge: 83 | description: "In the master mode, 1: high when idle; 0: low when idle" 84 | bitOffset: 29 85 | bitWidth: 1 86 | SPI_SLAVE: 87 | _add: 88 | spi_buffer_enable: 89 | description: "Enable read/write buffer" 90 | bitOffset: 29 91 | bitWidth: 1 92 | sta_enable: 93 | description: "Enable read/write buffer" 94 | bitOffset: 28 95 | bitWidth: 1 96 | interrupt_trans_enable: 97 | description: "Enable TRANS interrupts" 98 | bitOffset: 9 99 | bitWidth: 1 100 | interrupt_ws_enable: 101 | description: "Enable status write interrupts" 102 | bitOffset: 8 103 | bitWidth: 1 104 | interrupt_rs_enable: 105 | description: "Enable status read interrupts" 106 | bitOffset: 7 107 | bitWidth: 1 108 | interrupt_wb_enable: 109 | description: "Enable buffer write interrupts" 110 | bitOffset: 6 111 | bitWidth: 1 112 | interrupt_rb_enable: 113 | description: "Enable buffer read interrupts" 114 | bitOffset: 5 115 | bitWidth: 1 116 | SPI_SLAVE1: 117 | _add: 118 | spi_status_fast_enable: 119 | description: "Enable fast spi slave status " 120 | bitOffset: 26 121 | bitWidth: 1 122 | spi_status_read: 123 | description: "Enable spi slave status" 124 | bitOffset: 25 125 | bitWidth: 1 126 | SPI_CTRL: 127 | _add: 128 | two_byte_status: 129 | description: "Enable two byte status" 130 | bitOffset: 22 131 | bitWidth: 1 132 | wp_reg: 133 | description: "Write protect?" 134 | bitOffset: 21 135 | bitWidth: 1 136 | share_but: 137 | description: "Share bus" 138 | bitOffset: 19 139 | bitWidth: 1 140 | hold_mode: 141 | description: "Hold mode" 142 | bitOffset: 18 143 | bitWidth: 1 144 | enable_ahb: 145 | description: "Enable AHB" 146 | bitOffset: 17 147 | bitWidth: 1 148 | sst_aai: 149 | description: "SST_AAI?" 150 | bitOffset: 16 151 | bitWidth: 1 152 | res_and_res: 153 | description: "'Res and res'?" 154 | bitOffset: 15 155 | bitWidth: 1 156 | _add: 157 | SPI_CTRL1: 158 | addressOffset: 0xc 159 | size: 32 160 | access: read-write 161 | resetValue: 0 162 | fields: 163 | status: 164 | description: "In the slave mode, it is the status for master to read out." 165 | bitOffset: 0 166 | bitWidth: 16 167 | wb_mode: 168 | description: "Mode bits in the flash fast read mode, it is combined with spi_fastrd_mode bit." 169 | bitOffset: 16 170 | bitWidth: 8 171 | status_ext: 172 | description: "In the slave mode,it is the status for master to read out." 173 | bitOffset: 24 174 | bitWidth: 8 175 | SPI_EXT0: 176 | addressOffset: 0xF0 177 | size: 32 178 | access: read-write 179 | resetValue: 0 180 | fields: 181 | pp_enable: 182 | bitOffset: 31 183 | bitWidth: 1 184 | pp_shift: 185 | bitOffset: 16 186 | bitWidth: 4 187 | pp_time: 188 | bitOffset: 0 189 | bitWidth: 12 190 | SPI_EXT1: 191 | addressOffset: 0xF4 192 | size: 32 193 | access: read-write 194 | resetValue: 0 195 | fields: 196 | erase_enable: 197 | bitOffset: 31 198 | bitWidth: 1 199 | erase_shift: 200 | bitOffset: 16 201 | bitWidth: 4 202 | erase_time: 203 | bitOffset: 0 204 | bitWidth: 12 205 | SPI_EXT2: 206 | addressOffset: 0xF8 207 | size: 32 208 | access: read-write 209 | resetValue: 0 210 | fields: 211 | st: 212 | bitOffset: 0 213 | bitWidth: 3 -------------------------------------------------------------------------------- /svd/patches/_timer.yaml: -------------------------------------------------------------------------------- 1 | "TIMER*": 2 | FRC*_CTRL: 3 | _add: 4 | timer_enable: 5 | description: "Enable or disable the timer" 6 | bitOffset: 7 7 | bitWidth: 1 8 | access: read-write 9 | rollover: 10 | description: "Automatically reload when the counter hits zero" 11 | bitOffset: 6 12 | bitWidth: 1 13 | access: read-write 14 | prescale_divider: 15 | description: "Pre-scale divider for the timer" 16 | bitOffset: 2 17 | bitWidth: 2 18 | access: read-write 19 | interrupt_type: 20 | description: "Configure the interrupt type" 21 | bitOffset: 0 22 | bitWidth: 1 23 | access: read-write 24 | prescale_divider: 25 | devided_by_1: [0, "divided by 1"] 26 | devided_by_16: [1, "divided by 16"] 27 | devided_by_256: [2, "divided by 256"] 28 | interrupt_type: 29 | edge: [0, "edge"] 30 | level: [1, "level"] 31 | -------------------------------------------------------------------------------- /svd/patches/_uart.yaml: -------------------------------------------------------------------------------- 1 | "UART*": 2 | UART_FIFO: 3 | _add: 4 | rxfifo_write_byte: 5 | description: "R/W share the same address" 6 | bitOffset: 0 7 | bitWidth: 8 -------------------------------------------------------------------------------- /svd/patches/esp8266.yaml: -------------------------------------------------------------------------------- 1 | _svd: ../esp8266.base.svd 2 | 3 | 4 | _include: 5 | - "_dport.yaml" 6 | - "_gpio.yaml" 7 | - "_io_mux.yaml" 8 | - "_misc.yaml" 9 | - "_rtc.yaml" 10 | - "_spi.yaml" 11 | - "_timer.yaml" 12 | - "_uart.yaml" 13 | --------------------------------------------------------------------------------