diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..fadb38a7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*~
+[._]*.un~
+*.swp
diff --git a/IDE_Board_Manager/package_sparkfun_index.json b/IDE_Board_Manager/package_sparkfun_index.json
index 434d71b5..77fd744d 100644
--- a/IDE_Board_Manager/package_sparkfun_index.json
+++ b/IDE_Board_Manager/package_sparkfun_index.json
@@ -6,352 +6,3025 @@
"websiteURL": "https://SparkFun.com",
"email": "TechSupport@SparkFun.com",
"help": {
- "online": "https://forum.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"platforms": [
{
- "name": "SparkFun AVR Boards",
- "architecture": "avr",
- "version": "1.1.5",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.2.1",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.5.tar.bz2",
- "archiveFileName": "sparkfunboards.1.1.5.tar.bz2",
- "checksum": "SHA-256:41f9728983e0dbab597bb46ddf00b5bac6cfec7c8f3771ecd1612dae58bb0366",
- "size": "1162215",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.2.1.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.2.1.tar.gz",
+ "checksum": "SHA-256:9314d74c46e7f762438ccc065a827b72da88367224b9d22091ed0ab78b1ed9d2",
+ "size": "73180870",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "RedBoard"
- },
- {
- "name": "MaKey MaKey"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "Pro Micro"
+ "name": "SparkFun Artemis Dev Kit"
},
{
- "name": "Fio v3"
+ "name": "SparkFun Artemis MicroMod"
},
{
- "name": "Qduino Mini"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Digital Sandbox"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "Mega Pro"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "RedBot"
+ "name": "SparkFun Artemis Thing Plus"
},
{
- "name": "Serial 7-segment Display"
+ "name": "SparkFun Edge"
},
{
- "name": "ATmega128RFA1 Dev Board"
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun AVR Boards",
- "architecture": "avr",
- "version": "1.1.6",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.2.0",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.6.tar.bz2",
- "archiveFileName": "sparkfunboards.1.1.6.tar.bz2",
- "checksum": "SHA-256:049FA0DF51602120EC1BDAC19F440FC0CC448C23BB277DD0D8DF855C52ACD483",
- "size": "1159276",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.2.0.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.2.0.tar.gz",
+ "checksum": "SHA-256:89c19130dd1826cccfc25c2ade1c455cbb496ce79d287549f37f47df45529e8c",
+ "size": "73160477",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "RedBoard"
- },
- {
- "name": "MaKey MaKey"
- },
- {
- "name": "Pro Micro"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "Fio v3"
+ "name": "SparkFun Artemis Dev Kit"
},
{
- "name": "Qduino Mini"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Digital Sandbox"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "Mega Pro"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "RedBot"
+ "name": "SparkFun Artemis Thing Plus"
},
{
- "name": "Serial 7-segment Display"
+ "name": "SparkFun Edge"
},
{
- "name": "ATmega128RFA1 Dev Board"
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun AVR Boards",
- "architecture": "avr",
- "version": "1.1.7",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.1.2",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.7.tar.bz2",
- "archiveFileName": "sparkfunboards.1.1.7.tar.bz2",
- "checksum": "SHA-256:16A9CA03A7869C424562795504B82FEED0FB6A7D4A63FC94280FBBA44132257C",
- "size": "1236343",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.1.2_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.1.2_ble-beta.tar.gz",
+ "checksum": "SHA-256:8f1377d92d206f78d737a337626d24ed8e80c55a82f9a3c99bad3944a5727f5b",
+ "size": "73604683",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "RedBoard"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "MaKey MaKey"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Pro Micro"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "Fio v3"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "Qduino Mini"
+ "name": "SparkFun Artemis Thing Plus"
},
{
- "name": "Digital Sandbox"
+ "name": "SparkFun Edge"
},
{
- "name": "Mega Pro"
+ "name": "SparkFun Edge2"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.1.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.1.1_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.1.1_ble-beta.tar.gz",
+ "checksum": "SHA-256:996510336f9eae30d9ecc53b95b964367767ac31ab8853b01a77002361b77c09",
+ "size": "73595443",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
},
{
- "name": "RedBot"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Serial 7-segment Display"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "ATmega128RFA1 Dev Board"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "LilyPad USB Plus"
+ "name": "SparkFun Artemis Thing Plus"
+ },
+ {
+ "name": "SparkFun Edge"
+ },
+ {
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun AVR Boards",
- "architecture": "avr",
- "version": "1.1.8",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.30",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.8.tar.bz2",
- "archiveFileName": "sparkfunboards.1.1.8.tar.bz2",
- "checksum": "SHA-256:23D479AF10DC97F4DB8EA8AD514FE92C4391EADD8D9DD5EF1D49A70EA05255C3",
- "size": "1238017",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.30_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.30_ble-beta.tar.gz",
+ "checksum": "SHA-256:0c90ce012b94ab584005f8aa791efc8e3577580048256131d174eadb6fd7c709",
+ "size": "78908328",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "RedBoard"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "MaKey MaKey"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Pro Micro"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "Fio v3"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "Qduino Mini"
+ "name": "SparkFun Artemis Thing Plus"
},
{
- "name": "Digital Sandbox"
+ "name": "SparkFun Edge"
},
{
- "name": "Mega Pro"
+ "name": "SparkFun Edge2"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.29",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.29_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.29_ble-beta.tar.gz",
+ "checksum": "SHA-256:7e40c8e365d76a1d05b8b6a61ac2b6819b8ce41a8c41390cb61a89d9367a79cd",
+ "size": "64401917",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
},
{
- "name": "RedBot"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Serial 7-segment Display"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "ATmega128RFA1 Dev Board"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "LilyPad USB Plus"
+ "name": "SparkFun Artemis Thing Plus"
+ },
+ {
+ "name": "SparkFun Edge"
+ },
+ {
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun AVR Boards",
- "architecture": "avr",
- "version": "1.1.9",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.28",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.9.tar.bz2",
- "archiveFileName": "sparkfunboards.1.1.9.tar.bz2",
- "checksum": "SHA-256:89480C355876966DB68504E4E4130719942320AECF0AD6AEF819299796B22202",
- "size": "1238253",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.28_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.28_ble-beta.tar.gz",
+ "checksum": "SHA-256:fb699e84dc66137ebcc4dee59b58cd6395d50c023fd9c66c3a7da16611a1a8dd",
+ "size": "64399205",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "RedBoard"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "MaKey MaKey"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Pro Micro"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "Fio v3"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "Qduino Mini"
+ "name": "SparkFun Artemis Thing Plus"
},
{
- "name": "Digital Sandbox"
+ "name": "SparkFun Edge"
},
{
- "name": "Mega Pro"
+ "name": "SparkFun Edge2"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.27",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.27_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.27_ble-beta.tar.gz",
+ "checksum": "SHA-256:5a50e63d4a1e0d4c9e9812338b6adb433062ab0df539975c6bb6e65a266e42fa",
+ "size": "64398505",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
},
{
- "name": "RedBot"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Serial 7-segment Display"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "ATmega128RFA1 Dev Board"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "LilyPad USB Plus"
+ "name": "SparkFun Artemis Thing Plus"
+ },
+ {
+ "name": "SparkFun Edge"
+ },
+ {
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun AVR Boards",
- "architecture": "avr",
- "version": "1.1.10",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.23",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.10.tar.bz2",
- "archiveFileName": "sparkfunboards.1.1.10.tar.bz2",
- "checksum": "SHA-256:ABC30EF048B0BE63B6E3BB02A1FD52F35E2FC4A1CAFD60D4E7C3F9FD776129C0",
- "size": "1237620",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.23_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.23_ble-beta.tar.gz",
+ "checksum": "SHA-256:c7128c8f5b30b71f3b498ac3f88758564fb8f6fa3eb8dded45b00873e3e16ffa",
+ "size": "64396858",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "RedBoard"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "MaKey MaKey"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Pro Micro"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "Fio v3"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "Qduino Mini"
+ "name": "SparkFun Artemis Thing Plus"
},
{
- "name": "Digital Sandbox"
+ "name": "SparkFun Edge"
},
{
- "name": "Mega Pro"
+ "name": "SparkFun Edge2"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.20",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.20_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.20_ble-beta.tar.gz",
+ "checksum": "SHA-256:da6de17179dda462a1a2abd0ab1f384e4fcfe0ad0e581fd4720f254042767bce",
+ "size": "63501439",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
},
{
- "name": "RedBot"
+ "name": "SparkFun RedBoard Artemis"
},
{
- "name": "Serial 7-segment Display"
+ "name": "SparkFun RedBoard Artemis ATP"
},
{
- "name": "ATmega128RFA1 Dev Board"
+ "name": "SparkFun RedBoard Artemis Nano"
},
{
- "name": "LilyPad USB Plus"
+ "name": "SparkFun Artemis Thing Plus"
+ },
+ {
+ "name": "SparkFun Edge"
+ },
+ {
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.5)",
- "architecture": "samd",
- "version": "1.0.0",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.17",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.0.0.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.0.0.tar.bz2",
- "checksum": "SHA-256:12e0be6862a3a28b6515755dcad2842757caf4e5270326554f95059512ebaab5",
- "size": "268954",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.17_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.17_ble-beta.tar.gz",
+ "checksum": "SHA-256:63918da5aeacafd3dcace4bd34a02a29044b926167b0de0e8ffd0d1fdc1835d0",
+ "size": "47788681",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "name": "SparkFun RedBoard Artemis"
+ },
+ {
+ "name": "SparkFun RedBoard Artemis ATP"
+ },
+ {
+ "name": "SparkFun RedBoard Artemis Nano"
+ },
+ {
+ "name": "SparkFun Artemis Thing Plus"
+ },
+ {
+ "name": "SparkFun Edge"
+ },
+ {
+ "name": "SparkFun Edge2"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
},
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.5)",
- "architecture": "samd",
- "version": "1.1.0",
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.11",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.1.0.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.1.0.tar.bz2",
- "checksum": "SHA-256:5d71cbf8ccf5781eef9809d7b3141041daf3ed1a1272f5278762ece5a0aecf44",
- "size": "279683",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.11_ble-beta.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.11_ble-beta.tar.gz",
+ "checksum": "SHA-256:ceddc7ee397108c6c71cc7eacebbff547b40b4a49bf7f20899dc09d864774a3e",
+ "size": "48118344",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "name": "SparkFun Artemis Module"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "name": "SparkFun RedBoard Artemis"
+ },
+ {
+ "name": "SparkFun RedBoard Artemis ATP"
+ },
+ {
+ "name": "SparkFun RedBoard Artemis Nano"
+ },
+ {
+ "name": "SparkFun Artemis Thing Plus"
+ },
+ {
+ "name": "SparkFun Edge"
+ },
+ {
+ "name": "SparkFun Edge2"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.4",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/v1.0.4.tar.gz",
+ "archiveFileName": "Arduino_Apollo3-1.0.4.tar.gz",
+ "checksum": "SHA-256:e7881e3aec46fc8269586506634d1e4838f3de14e422ca37ac65c0c73e5edd50",
+ "size": "47539194",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis ATP"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis Nano"
+ },
+ {
+ "name": "SparkFun Edge"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "1.0.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/1.0.0.zip",
+ "archiveFileName": "Arduino_Apollo3-1.0.0.zip",
+ "checksum": "SHA-256:36f0e04e2f2d2b281622d0f7fc1c41f38f1a24b6824c3f2f2b568cb29eb9fb6b",
+ "size": "66433091",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis ATP"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis Nano"
+ },
+ {
+ "name": "SparkFun Edge"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun Apollo3 Boards",
+ "architecture": "apollo3",
+ "version": "0.0.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Apollo3/archive/0.0.0.zip",
+ "archiveFileName": "Arduino_Apollo3-0.0.0.zip",
+ "checksum": "SHA-256:4cece2fcfff35e7b9d8ef1c433cf7fde3b94ae8ad9b1f9eb0fb5ee8b8abd5231",
+ "size": "45062118",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun Artemis Module"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis Mega"
+ },
+ {
+ "name": "SparkFun BlackBoard Artemis Nano"
+ },
+ {
+ "name": "SparkFun Edge"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "8-2018-q4-major"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.5",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.5.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.5.tar.bz2",
+ "checksum": "SHA-256:41f9728983e0dbab597bb46ddf00b5bac6cfec7c8f3771ecd1612dae58bb0366",
+ "size": "1162215",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.6",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.6.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.6.tar.bz2",
+ "checksum": "SHA-256:049FA0DF51602120EC1BDAC19F440FC0CC448C23BB277DD0D8DF855C52ACD483",
+ "size": "1159276",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.7",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.7.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.7.tar.bz2",
+ "checksum": "SHA-256:16A9CA03A7869C424562795504B82FEED0FB6A7D4A63FC94280FBBA44132257C",
+ "size": "1236343",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.8",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.8.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.8.tar.bz2",
+ "checksum": "SHA-256:23D479AF10DC97F4DB8EA8AD514FE92C4391EADD8D9DD5EF1D49A70EA05255C3",
+ "size": "1238017",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.9",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.9.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.9.tar.bz2",
+ "checksum": "SHA-256:89480C355876966DB68504E4E4130719942320AECF0AD6AEF819299796B22202",
+ "size": "1238253",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.10",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.10.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.10.tar.bz2",
+ "checksum": "SHA-256:ABC30EF048B0BE63B6E3BB02A1FD52F35E2FC4A1CAFD60D4E7C3F9FD776129C0",
+ "size": "1237620",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.11",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.11.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.11.tar.bz2",
+ "checksum": "SHA-256:59CFDDF1C806B42DECFB52297F2BCF2CF0B31DFBF27ED413B7421B476369B1DD",
+ "size": "1239209",
+ "help": {
+ "online": "https://forums.sparkfun.com"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ },
+ {
+ "name": "SerLCD"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.12",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.12.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.12.tar.bz2",
+ "checksum": "SHA-256:034005EAC0255376E3108858238A17CF8654F31400DAC60BF0D756E332C3251D",
+ "size": "1249477",
+ "help": {
+ "online": "https://forums.sparkfun.com"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ },
+ {
+ "name": "SerLCD"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun AVR Boards",
+ "architecture": "avr",
+ "version": "1.1.13",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfunboards.1.1.13.tar.bz2",
+ "archiveFileName": "sparkfunboards.1.1.13.tar.bz2",
+ "checksum": "SHA-256:D7AF391CAFC5E16830CAC7C13484EF62765DD7A36AABA5F25020CE3C39617115",
+ "size": "1257480",
+ "help": {
+ "online": "https://forums.sparkfun.com"
+ },
+ "boards": [
+ {
+ "name": "RedBoard"
+ },
+ {
+ "name": "MaKey MaKey"
+ },
+ {
+ "name": "Pro Micro"
+ },
+ {
+ "name": "Fio v3"
+ },
+ {
+ "name": "Qduino Mini"
+ },
+ {
+ "name": "Digital Sandbox"
+ },
+ {
+ "name": "Mega Pro"
+ },
+ {
+ "name": "RedBot"
+ },
+ {
+ "name": "Serial 7-segment Display"
+ },
+ {
+ "name": "ATmega128RFA1 Dev Board"
+ },
+ {
+ "name": "LilyPad USB Plus"
+ },
+ {
+ "name": "SerLCD"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun ESP32 Boards",
+ "architecture": "esp32",
+ "version": "1.0.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-esp32-1.0.0.tar.bz2",
+ "archiveFileName": "sparkfun-esp32-1.0.0.tar.bz2",
+ "checksum": "SHA-256:030ee494bdf5ae8870042704e99ba0e27313c42f90a284babeaaac9a2deeb6a1",
+ "size": "33167738",
+ "boards": [
+ {
+ "name": "SparkFun ESP32 Thing"
+ },
+ {
+ "name": "SparkFun ESP32 Thing Plus"
+ },
+ {
+ "name": "SparkFun ESP32 MicroMod"
+ },
+ {
+ "name": "SparkFun Lora Gateway 1-Channel"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "esp32",
+ "version": "1.22.0-80-g6c4433a-5.2.0",
+ "name": "xtensa-esp32-elf-gcc"
+ },
+ {
+ "packager": "esp32",
+ "version": "2.6.1",
+ "name": "esptool_py"
+ },
+ {
+ "packager": "esp32",
+ "version": "0.2.3",
+ "name": "mkspiffs"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun ESP32 Boards",
+ "architecture": "esp32",
+ "version": "1.0.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-esp32-1.0.1.tar.bz2",
+ "archiveFileName": "sparkfun-esp32-1.0.1.tar.bz2",
+ "checksum": "SHA-256:030ee494bdf5ae8870042704e99ba0e27313c42f90a284babeaaac9a2deeb6a1",
+ "size": "33167738",
+ "boards": [
+ {
+ "name": "SparkFun ESP32 Thing"
+ },
+ {
+ "name": "SparkFun ESP32 Thing Plus"
+ },
+ {
+ "name": "SparkFun ESP32 MicroMod"
+ },
+ {
+ "name": "SparkFun Lora Gateway 1-Channel"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "esp32",
+ "version": "1.22.0-97-gc752ad5-5.2.0",
+ "name": "xtensa-esp32-elf-gcc"
+ },
+ {
+ "packager": "esp32",
+ "version": "3.0.0",
+ "name": "esptool_py"
+ },
+ {
+ "packager": "esp32",
+ "version": "0.2.3",
+ "name": "mkspiffs"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.5)",
+ "architecture": "samd",
+ "version": "1.0.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.0.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.0.0.tar.bz2",
+ "checksum": "SHA-256:12e0be6862a3a28b6515755dcad2842757caf4e5270326554f95059512ebaab5",
+ "size": "268954",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.5)",
+ "architecture": "samd",
+ "version": "1.1.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.1.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.1.0.tar.bz2",
+ "checksum": "SHA-256:5d71cbf8ccf5781eef9809d7b3141041daf3ed1a1272f5278762ece5a0aecf44",
+ "size": "279683",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.5)",
+ "architecture": "samd",
+ "version": "1.2.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.2.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.2.0.tar.bz2",
+ "checksum": "SHA-256:50e055f311e07ba4d154bf00aa10579648024bef680bb3eb267401c496f791e6",
+ "size": "281932",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.6)",
+ "architecture": "samd",
+ "version": "1.2.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.2.1.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.2.1.tar.bz2",
+ "checksum": "SHA-256:63b90fb26a18a89b2f51556a08286117cdade38d6cb7a16eb1eccb7d1d92422a",
+ "size": "280405",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.8)",
+ "architecture": "samd",
+ "version": "1.2.2",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.2.2.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.2.2.tar.bz2",
+ "checksum": "SHA-256:21bc1ab1a8fd6550dca3b4953deaa2066d49ffa2583cd8e8a1e36d0c0ab00d52",
+ "size": "283240",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.8)",
+ "architecture": "samd",
+ "version": "1.3.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.3.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.3.0.tar.bz2",
+ "checksum": "SHA-256:87695137f303000099e7e6d3fae3e87d5882ed999e4c14403c65cf51a4d6a6be",
+ "size": "195440",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.9)",
+ "architecture": "samd",
+ "version": "1.3.2",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.3.2.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.3.2.tar.bz2",
+ "checksum": "SHA-256:eb4274a3df4c6c4dbc1396600b1efc9cd9454e5be4880530ff87ba4fb3e6216a",
+ "size": "206253",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards",
+ "architecture": "samd",
+ "version": "1.4.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.4.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.4.0.tar.bz2",
+ "checksum": "SHA-256:968918117E6EA9C7F3982F83E07B6459663AB844779855B5E175E19461C16691",
+ "size": "289555",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "bossac",
+ "version": "1.4.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.19)",
+ "architecture": "samd",
+ "version": "1.5.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.5.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.5.0.tar.bz2",
+ "checksum": "SHA-256:05C4FBC7CC924BED99B9A2618F57FAA1DDEA210AFFB7AFEE57639E6B9FEB445C",
+ "size": "322443",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.19)",
+ "architecture": "samd",
+ "version": "1.5.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.5.1.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.5.1.tar.bz2",
+ "checksum": "SHA-256:774052679A88EA43F5CEA2BAD88398E7310D4B879B8745613648D9F09BCB26DA",
+ "size": "323505",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.19)",
+ "architecture": "samd",
+ "version": "1.5.2",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.5.2.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.5.2.tar.bz2",
+ "checksum": "SHA-256:AB0F5486D0EFAE48E47716C7B01340F3E503D55CFD6872FFD3DBEB28E4095F2B",
+ "size": "328665",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.19)",
+ "architecture": "samd",
+ "version": "1.5.3",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.5.3.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.5.3.tar.bz2",
+ "checksum": "SHA-256:EB3721D8C72D02F32DBC0D9F1F2730B4A5EA809D13F0C3D7606E789B9281B545",
+ "size": "337917",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.19)",
+ "architecture": "samd",
+ "version": "1.5.4",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.5.4.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.5.4.tar.bz2",
+ "checksum": "SHA-256:3C92A1EEAF05F7166C21D7AB507FA7ADBFF23F5802A084A34133CB074BB812E0",
+ "size": "453746",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ }
+ ],
+ "toolsDependencies": []
+ },
+ {
+ "name": "SparkFun SAMD Boards",
+ "architecture": "samd",
+ "version": "1.6.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.6.1.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.6.1.tar.bz2",
+ "checksum": "SHA-256:AF18934847988926A71BB1C998D4FB2C1A5B5336442FAE8576EE80944EB49456",
+ "size": "1619817",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.6.2",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.6.2.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.6.2.tar.bz2",
+ "checksum": "SHA-256:C06952DC372B9C42B4B308C44449979AC6B4F8B87356C45061E3B1CBCC699B2D",
+ "size": "1619901",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.0.tar.bz2",
+ "checksum": "SHA-256:543F0B2F4E10AA81E3961791E30986763C0E8C9841FF2725C3DDD4747E5D83AF",
+ "size": "1696059",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.1.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.1.tar.bz2",
+ "checksum": "SHA-256:86E5F0C0D089E7384557E54191B4BE17A473FE0ACA31181606425BA3199402AC",
+ "size": "1713629",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.2",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.2.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.2.tar.bz2",
+ "checksum": "SHA-256:8356F897430129912057E7D7AB8611D2739B8B79E7E0E47CD0A798255D19E960",
+ "size": "1713505",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.3",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.3.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.3.tar.bz2",
+ "checksum": "SHA-256:2AD34AB24D42E2BE0AE2C6D09BF550E26A6BB2182C2CAFBD76CFE69E2FFE8325",
+ "size": "1702560",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.4",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.4.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.4.tar.bz2",
+ "checksum": "SHA-256:3EA7A59316A8E59D7F552E9714C74DA9D16F9CFE420294BC5F0007B6512D8FD0",
+ "size": "1695731",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.5",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.5.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.5.tar.bz2",
+ "checksum": "SHA-256:B7A7F787960D41B378197EE6FF83CD0324892170818902B28FD1B28B40C908FC",
+ "size": "1696179",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.6",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.6.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.6.tar.bz2",
+ "checksum": "SHA-256:BEFF40BBD0832B6478A49FEBD1DC839C1F3635431788A6A482F67C6300AE798E",
+ "size": "2840910",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.7",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.7.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.7.tar.bz2",
+ "checksum": "SHA-256:2B5DD4726EAF42BEFC44F23ADCE18C4D40EB376E795839A20E130F1D6C3F543B",
+ "size": "2841070",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.8",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.8.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.8.tar.bz2",
+ "checksum": "SHA-256:312FC086189AE7D66C33E56EBB68DE51FAC86F13EE6476D4284278E043ED9971",
+ "size": "2841028",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.7.9",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.7.9.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.7.9.tar.bz2",
+ "checksum": "SHA-256:56034D4E9A4DA4AFF1366E7931C4088CBBC2F469CB195D85E9FCFCED44A7730D",
+ "size": "2840851",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.0.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.0.tar.bz2",
+ "checksum": "SHA-256:1E4EF7ACBE51E13669CCD48DFC4724A44FA28A962E7F3E4A37A0F7DB516C8703",
+ "size": "2841419",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.1",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.1.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.1.tar.bz2",
+ "checksum": "SHA-256:F13CD49463FAD77A0B132030CDD59DA12C9D9B9C3255C6B124101108DE282B9F",
+ "size": "2840753",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.2",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.2.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.2.tar.bz2",
+ "checksum": "SHA-256:D3EC50E06BF1A8F9A58CBEE5AFB9797180964F6BD794BE252FF71A6459731A59",
+ "size": "2841065",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.3",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.3.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.3.tar.bz2",
+ "checksum": "SHA-256:74393DAD50FCFDCCF36EC15FA1CC4354258E9050BDB1C1692E58F0C21F82C2D6",
+ "size": "2840829",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.4",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.4.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.4.tar.bz2",
+ "checksum": "SHA-256:44AF7E7C756B863AE9303DD217740BE60DC305ED3EEBC8B46F0FCA3CC7848F1F",
+ "size": "2841082",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.5",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.5.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.5.tar.bz2",
+ "checksum": "SHA-256:41F1C50981C2435F1423F128EF678830B92606396429DD86D376333F4DC82540",
+ "size": "2841197",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.6",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.6.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.6.tar.bz2",
+ "checksum": "SHA-256:DB464F1224D46AF4C9780A79F3E29505D7EE98528AD1761C3775E4EA2FCE6009",
+ "size": "2841326",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "Sparkfun SAMD21 Pro RF"
+ },
+ {
+ "name": "Sparkfun RedBoard Turbo"
+ },
+ {
+ "name": "Sparkfun SAMD51 Thing Plus"
+ },
+ {
+ "name": "Sparkfun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.7",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.7.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.7.tar.bz2",
+ "checksum": "SHA-256:BCE89B08AD7661DF68469F5C2B5A84B3E6457948EFEACEB0C5743334FEC58303",
+ "size": "2914716",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.8",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.8.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.8.tar.bz2",
+ "checksum": "SHA-256:521363491AF51B1E48F5C5EB00D8B4BDFF0311ACDE9C267FE926F43AC519E0B6",
+ "size": "2963776",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun Qwiic USB Bridge"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.9",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.9.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.9.tar.bz2",
+ "checksum": "SHA-256:9FA7994E170112A5DCC399FD1D13CC0D59D63AD6F1FE346B7FE9A2BD48517825",
+ "size": "2937532",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun Qwiic USB Bridge"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
},
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.5)",
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
"architecture": "samd",
- "version": "1.2.0",
+ "version": "1.8.10",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.2.0.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.2.0.tar.bz2",
- "checksum": "SHA-256:50e055f311e07ba4d154bf00aa10579648024bef680bb3eb267401c496f791e6",
- "size": "281932",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.10.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.10.tar.bz2",
+ "checksum": "SHA-256:28877556ae73317e7aa1ab36d0b6e35bb8f7bc6c07c6fd7acc691fcb52390e54",
+ "size": "2945910",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
@@ -359,166 +3032,843 @@
},
{
"name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun Qwiic USB Bridge"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
},
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.6)",
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
"architecture": "samd",
- "version": "1.2.1",
+ "version": "1.8.11",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.2.1.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.2.1.tar.bz2",
- "checksum": "SHA-256:63b90fb26a18a89b2f51556a08286117cdade38d6cb7a16eb1eccb7d1d92422a",
- "size": "280405",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.11.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.11.tar.bz2",
+ "checksum": "SHA-256:8514a8da20695ea48577f89a52046ef4c3e23190aac190128c3bb32ef308aa28",
+ "size": "2945652",
"help": {
- "online": "https://forums.sparkfun.com"
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun Qwiic USB Bridge"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "4.8.3-2014q1"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.12",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.12.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.12.tar.bz2",
+ "checksum": "SHA-256:5cff4d33754f7b431e1edac81e87d6b5b5e709c4c2d7aafd983f38d15b8fdfbe",
+ "size": "2945670",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
+ },
+ "boards": [
+ {
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun Qwiic USB Bridge"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "7-2017q4"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.8.1)",
+ "architecture": "samd",
+ "version": "1.8.13",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-samd-1.8.13.tar.bz2",
+ "archiveFileName": "sparkfun-samd-1.8.13.tar.bz2",
+ "checksum": "SHA-256:226fd5bba05a7842db47e6d0b0d880d15fa9a7180b8bb48f0c1611b9abcceb48",
+ "size": "2950780",
+ "help": {
+ "online": "https://learn.sparkfun.com/tutorials/installing-arduino-ide/board-add-ons-with-arduino-board-manager"
},
"boards": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "name": "SparkFun SAMD21 Mini Breakout"
+ },
+ {
+ "name": "SparkFun SAMD21 Dev Breakout"
+ },
+ {
+ "name": "SparkFun 9DoF Razor IMU M0"
+ },
+ {
+ "name": "LilyPad LilyMini"
+ },
+ {
+ "name": "SparkFun SAMD21 Pro RF"
+ },
+ {
+ "name": "SparkFun RedBoard Turbo"
+ },
+ {
+ "name": "SparkFun SAMD51 Thing Plus"
+ },
+ {
+ "name": "SparkFun Qwiic Micro"
+ },
+ {
+ "name": "SparkFun Qwiic USB Bridge"
+ },
+ {
+ "name": "SparkFun SAMD51 MicroMod"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "arduino",
+ "name": "arm-none-eabi-gcc",
+ "version": "7-2017q4"
+ },
+ {
+ "packager": "arduino",
+ "name": "bossac",
+ "version": "1.8.0-48-gb176eee"
+ },
+ {
+ "packager": "arduino",
+ "name": "openocd",
+ "version": "0.9.0-arduino"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS",
+ "version": "4.5.0"
+ },
+ {
+ "packager": "arduino",
+ "name": "CMSIS-Atmel",
+ "version": "1.2.0"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun STM32 Boards",
+ "architecture": "stm32",
+ "version": "1.0.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-stm32-1.0.0.tar.bz2",
+ "archiveFileName": "sparkfun-stm32-1.0.0.tar.bz2",
+ "checksum": "SHA-256:2ea9f35f66fbb73b26698319f202391b525d1cceb7a8fe2be454e89dc6e5b922",
+ "size": "4982552",
+ "boards": [
+ {
+ "name": "SparkFun STM32 Thing Plus"
+ },
+ {
+ "name": "SparkFun STM32 MicroMod"
+ },
+ {
+ "name": "Generic F405RG"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "version": "5.5.1",
+ "name": "CMSIS"
+ },
+ {
+ "packager": "SparkFun",
+ "version": "1.4.0",
+ "name": "STM32Tools"
+ },
+ {
+ "packager": "SparkFun",
+ "version": "9.2.1-1.1",
+ "name": "xpack-arm-none-eabi-gcc"
+ }
+ ]
+ },
+ {
+ "name": "SparkFun STM32 Boards",
+ "architecture": "stm32",
+ "version": "2.0.0",
+ "category": "Contributed",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-stm32-2.0.0.tar.bz2",
+ "archiveFileName": "sparkfun-stm32-2.0.0.tar.bz2",
+ "checksum": "SHA-256:B896703B553C925A2F04E23611919356F02D10DA6B545A513CD3C0FEF65540E3",
+ "size": "4910455",
+ "boards": [
+ {
+ "name": "SparkFun STM32 Thing Plus"
+ },
+ {
+ "name": "SparkFun STM32 MicroMod"
+ },
+ {
+ "name": "Generic F405RG"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "version": "5.7.0",
+ "name": "CMSIS"
+ },
+ {
+ "packager": "SparkFun",
+ "version": "2.0.0",
+ "name": "STM32Tools"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "packager": "SparkFun",
+ "version": "9.3.1-1.3",
+ "name": "xpack-arm-none-eabi-gcc"
}
- ],
- "toolsDependencies": []
+ ]
},
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.8)",
- "architecture": "samd",
- "version": "1.2.2",
+ "name": "SparkFun STM32 Boards",
+ "architecture": "stm32",
+ "version": "2.1.0",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.2.2.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.2.2.tar.bz2",
- "checksum": "SHA-256:21bc1ab1a8fd6550dca3b4953deaa2066d49ffa2583cd8e8a1e36d0c0ab00d52",
- "size": "283240",
- "help": {
- "online": "https://forums.sparkfun.com"
- },
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-stm32-2.1.0.tar.bz2",
+ "archiveFileName": "sparkfun-stm32-2.1.0.tar.bz2",
+ "checksum": "SHA-256:7fce5c41b0c645134c9ec640636329594d5750fc82e2e4a61f2d605bb5633872",
+ "size": "4955866",
"boards": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "name": "SparkFun STM32 Thing Plus"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "name": "SparkFun STM32 MicroMod"
+ },
+ {
+ "name": "SparkFun STM32 MicroMod DFU"
+ },
+ {
+ "name": "Generic F405RG"
}
],
- "toolsDependencies": []
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "version": "5.7.0",
+ "name": "CMSIS"
+ },
+ {
+ "packager": "SparkFun",
+ "version": "2.0.0",
+ "name": "STM32Tools"
+ },
+ {
+ "packager": "SparkFun",
+ "version": "9.3.1-1.3",
+ "name": "xpack-arm-none-eabi-gcc"
+ }
+ ]
},
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.8)",
- "architecture": "samd",
- "version": "1.3.0",
+ "name": "SparkFun nRF52 boards using Adafruit nRF52 core",
+ "architecture": "nrf52",
+ "version": "1.0.0",
"category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.3.0.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.3.0.tar.bz2",
- "checksum": "SHA-256:87695137f303000099e7e6d3fae3e87d5882ed999e4c14403c65cf51a4d6a6be",
- "size": "195440",
- "help": {
- "online": "https://forums.sparkfun.com"
- },
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-nrf52-1.0.0.tar.bz2",
+ "archiveFileName": "sparkfun-nrf52-1.0.0.tar.bz2",
+ "checksum": "SHA-256:132d7b14433daf5cf8ae2db4f52e32e7e18eb0f8f038836c6948c1ead2be7597",
+ "size": "16458697",
"boards": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "name": "SparkFun Thing Plus NINA-B306"
+ }
+ ],
+ "toolsDependencies": [
+ {
+ "packager": "SparkFun",
+ "name": "arm-none-eabi-gcc",
+ "version": "9-2019q4"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "packager": "SparkFun",
+ "name": "nrfjprog",
+ "version": "9.4.0"
},
{
- "name": "SparkFun 9DoF Razor IMU M0"
+ "packager": "SparkFun",
+ "name": "CMSIS",
+ "version": "5.7.0"
}
- ],
- "toolsDependencies": []
- },
+ ]
+ }
+ ],
+ "tools": [
{
- "name": "SparkFun SAMD Boards (dependency: Arduino SAMD Boards 1.6.9)",
- "architecture": "samd",
- "version": "1.3.2",
- "category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.3.2.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.3.2.tar.bz2",
- "checksum": "SHA-256:eb4274a3df4c6c4dbc1396600b1efc9cd9454e5be4880530ff87ba4fb3e6216a",
- "size": "206253",
- "help": {
- "online": "https://forums.sparkfun.com"
- },
- "boards": [
+ "version": "8-2018-q4-major",
+ "name": "arm-none-eabi-gcc",
+ "systems": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "host": "x86_64-apple-darwin",
+ "url": "https://cdn.sparkfun.com/large/gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2",
+ "checksum": "SHA-256:0b528ed24db9f0fa39e5efdae9bcfc56bf9e07555cb267c70ff3fee84ec98460",
+ "archiveFileName": "gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2",
+ "size": "111430151"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "host": "i386-apple-darwin11",
+ "url": "https://cdn.sparkfun.com/large/gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2",
+ "checksum": "SHA-256:0b528ed24db9f0fa39e5efdae9bcfc56bf9e07555cb267c70ff3fee84ec98460",
+ "archiveFileName": "gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2",
+ "size": "111430151"
},
{
- "name": "SparkFun 9DoF Razor IMU M0"
+ "host": "i686-linux-gnu",
+ "url": "https://cdn.sparkfun.com/large/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2",
+ "checksum": "SHA-256:fb31fbdfe08406ece43eef5df623c0b2deb8b53e405e2c878300f7a1f303ee52",
+ "archiveFileName": "gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2",
+ "size": "107253352"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://cdn.sparkfun.com/large/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2",
+ "checksum": "SHA-256:fb31fbdfe08406ece43eef5df623c0b2deb8b53e405e2c878300f7a1f303ee52",
+ "archiveFileName": "gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2",
+ "size": "107253352"
+ },
+ {
+ "host": "i686-mingw32",
+ "url": "https://cdn.sparkfun.com/large/gcc-arm-none-eabi-8-2018-q4-major-win32-modified.zip",
+ "checksum": "SHA-256:98f47ed254ce31942408028c3a4a75ad4ee9fe7f318daecafb8c101bc19a6e23",
+ "archiveFileName": "gcc-arm-none-eabi-8-2018-q4-major-win32-modified.zip",
+ "size": "135448870"
}
- ],
- "toolsDependencies": []
+ ]
},
{
- "name": "SparkFun SAMD Boards",
- "architecture": "samd",
- "version": "1.4.0",
- "category": "Contributed",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfun-samd-1.4.0.tar.bz2",
- "archiveFileName": "sparkfun-samd-1.4.0.tar.bz2",
- "checksum": "SHA-256:968918117E6EA9C7F3982F83E07B6459663AB844779855B5E175E19461C16691",
- "size": "289555",
- "help": {
- "online": "https://forums.sparkfun.com"
- },
- "boards": [
+ "name": "arm-none-eabi-gcc",
+ "version": "9-2019q4",
+ "systems": [
{
- "name": "SparkFun SAMD21 Mini Breakout"
+ "host": "arm-linux-gnueabihf",
+ "url": "http://downloads.arduino.cc/tools/gcc-arm-none-eabi-7-2019-q4-major-linuxarm.tar.bz2",
+ "archiveFileName": "gcc-arm-none-eabi-7-2019-q4-major-linuxarm.tar.bz2",
+ "checksum": "SHA-256:34180943d95f759c66444a40b032f7dd9159a562670fc334f049567de140c51b",
+ "size": "96613739"
},
{
- "name": "SparkFun SAMD21 Dev Breakout"
+ "host": "aarch64-linux-gnu",
+ "url": "https://github.com/adafruit/arduino-board-index/releases/download/build-tools/gcc-arm-none-eabi-9-2019-q4-major-aarch64-linux.tar.bz2",
+ "archiveFileName": "gcc-arm-none-eabi-9-2019-q4-major-aarch64-linux.tar.bz2",
+ "checksum": "MD5:0dfa059aae18fcf7d842e30c525076a4",
+ "size": "128670769"
},
{
- "name": "SparkFun 9DoF Razor IMU M0"
+ "host": "i686-mingw32",
+ "url": "https://github.com/adafruit/arduino-board-index/releases/download/build-tools/gcc-arm-none-eabi-9-2019-q4-major-win32.zip",
+ "archiveFileName": "gcc-arm-none-eabi-9-2019-q4-major-win32.zip",
+ "checksum": "MD5:9d60cbb0e358ab6a9d3c9e5dc3624dd2",
+ "size": "153520070"
},
{
- "name": "LilyPad LilyMini"
- }
- ],
- "toolsDependencies": [
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/adafruit/arduino-board-index/releases/download/build-tools/gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2",
+ "archiveFileName": "gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2",
+ "checksum": "MD5:241b64f0578db2cf146034fc5bcee3d4",
+ "size": "116770520"
+ },
{
- "packager": "SparkFun",
- "name": "bossac",
- "version": "1.4.0"
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/adafruit/arduino-board-index/releases/download/build-tools/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2",
+ "archiveFileName": "gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2",
+ "checksum": "MD5:fe0029de4f4ec43cf7008944e34ff8cc",
+ "size": "116802378"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "http://downloads.arduino.cc/tools/gcc-arm-none-eabi-7-2018-q2-update-linux32.tar.bz2",
+ "archiveFileName": "gcc-arm-none-eabi-7-2018-q2-update-linux32.tar.bz2",
+ "checksum": "SHA-256:090a0bc2b1956bc49392dff924a6c30fa57c88130097b1972204d67a45ce3cf3",
+ "size": "97427309"
}
]
- }
- ],
- "tools": [
+ },
{
"name": "bossac",
"version": "1.4.0",
"systems": [
{
"host": "i686-mingw32",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/sparkfun/samd-tools/bossac/bossac-1.4.0-win.zip",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/sparkfun/samd-tools/bossac/bossac-1.4.0-win.zip",
"archiveFileName": "bossac-1.4.0-win.zip",
"checksum": "SHA-256:BCA6503F5DBB1F96693AFD0701A759ECFB3BE5B9FB3F9D901CA17853B224F4EB",
"size": "314705"
},
{
"host": "x86_64-pc-linux-gnu",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/sparkfun/samd-tools/bossac/bossac-1.4.0-linux64.tar.bz2",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/sparkfun/samd-tools/bossac/bossac-1.4.0-linux64.tar.bz2",
"archiveFileName": "bossac-1.4.0-linux64.tar.bz2",
"checksum": "SHA-256:BB8F398BF84C5F31880FE9A2C7AE0174592516CE4821B49744B426AA968ADA10",
"size": "225696"
},
{
"host": "x86_64-apple-darwin",
- "url": "https://github.com/sparkfun/Arduino_Boards/raw/master/sparkfun/samd-tools/bossac/bossac-1.4.0-osx.tar.bz2",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/sparkfun/samd-tools/bossac/bossac-1.4.0-osx.tar.bz2",
"archiveFileName": "bossac-1.4.0-osx.tar.bz2",
"checksum": "SHA-256:D0F225846D7BC80A74324D783CDB35C42A7F85EAD73CC016C0CC767B0AA5E81C",
"size": "74461"
}
]
+ },
+ {
+ "name": "CMSIS",
+ "version": "5.5.1",
+ "systems": [
+ {
+ "host": "i686-mingw32",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.5.1/CMSIS-5.5.1.tar.bz2",
+ "archiveFileName": "CMSIS-5.5.1.tar.bz2",
+ "checksum": "SHA-256:3dddbd241986fc7a7861a62c748abf350055ac4542d362f38f1778caad2c4bf8",
+ "size": "24351965"
+ },
+ {
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.5.1/CMSIS-5.5.1.tar.bz2",
+ "archiveFileName": "CMSIS-5.5.1.tar.bz2",
+ "checksum": "SHA-256:3dddbd241986fc7a7861a62c748abf350055ac4542d362f38f1778caad2c4bf8",
+ "size": "24351965"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.5.1/CMSIS-5.5.1.tar.bz2",
+ "archiveFileName": "CMSIS-5.5.1.tar.bz2",
+ "checksum": "SHA-256:3dddbd241986fc7a7861a62c748abf350055ac4542d362f38f1778caad2c4bf8",
+ "size": "24351965"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.5.1/CMSIS-5.5.1.tar.bz2",
+ "archiveFileName": "CMSIS-5.5.1.tar.bz2",
+ "checksum": "SHA-256:3dddbd241986fc7a7861a62c748abf350055ac4542d362f38f1778caad2c4bf8",
+ "size": "24351965"
+ },
+ {
+ "host": "arm-linux-gnueabihf",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.5.1/CMSIS-5.5.1.tar.bz2",
+ "archiveFileName": "CMSIS-5.5.1.tar.bz2",
+ "checksum": "SHA-256:3dddbd241986fc7a7861a62c748abf350055ac4542d362f38f1778caad2c4bf8",
+ "size": "24351965"
+ },
+ {
+ "host": "all",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.5.1/CMSIS-5.5.1.tar.bz2",
+ "archiveFileName": "CMSIS-5.5.1.tar.bz2",
+ "checksum": "SHA-256:3dddbd241986fc7a7861a62c748abf350055ac4542d362f38f1778caad2c4bf8",
+ "size": "24351965"
+ }
+ ]
+ },
+ {
+ "name": "CMSIS",
+ "version": "5.7.0",
+ "systems": [
+ {
+ "host": "i686-mingw32",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.7.0/CMSIS-5.7.0.tar.bz2",
+ "archiveFileName": "CMSIS-5.7.0.tar.bz2",
+ "checksum": "SHA-256:0b04b0f214e483bcc360cda985cddc0de8031714019ceabcda4770d510b82bfe",
+ "size": "26151901"
+ },
+ {
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.7.0/CMSIS-5.7.0.tar.bz2",
+ "archiveFileName": "CMSIS-5.7.0.tar.bz2",
+ "checksum": "SHA-256:0b04b0f214e483bcc360cda985cddc0de8031714019ceabcda4770d510b82bfe",
+ "size": "26151901"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.7.0/CMSIS-5.7.0.tar.bz2",
+ "archiveFileName": "CMSIS-5.7.0.tar.bz2",
+ "checksum": "SHA-256:0b04b0f214e483bcc360cda985cddc0de8031714019ceabcda4770d510b82bfe",
+ "size": "26151901"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.7.0/CMSIS-5.7.0.tar.bz2",
+ "archiveFileName": "CMSIS-5.7.0.tar.bz2",
+ "checksum": "SHA-256:0b04b0f214e483bcc360cda985cddc0de8031714019ceabcda4770d510b82bfe",
+ "size": "26151901"
+ },
+ {
+ "host": "arm-linux-gnueabihf",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.7.0/CMSIS-5.7.0.tar.bz2",
+ "archiveFileName": "CMSIS-5.7.0.tar.bz2",
+ "checksum": "SHA-256:0b04b0f214e483bcc360cda985cddc0de8031714019ceabcda4770d510b82bfe",
+ "size": "26151901"
+ },
+ {
+ "host": "all",
+ "url": "https://github.com/stm32duino/ArduinoModule-CMSIS/releases/download/5.7.0/CMSIS-5.7.0.tar.bz2",
+ "archiveFileName": "CMSIS-5.7.0.tar.bz2",
+ "checksum": "SHA-256:0b04b0f214e483bcc360cda985cddc0de8031714019ceabcda4770d510b82bfe",
+ "size": "26151901"
+ }
+ ]
+ },
+ {
+ "name": "STM32Tools",
+ "version": "1.4.0",
+ "systems": [
+ {
+ "host": "i686-mingw32",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/1.4.0/STM32Tools-1.4.0-windows.tar.bz2",
+ "archiveFileName": "STM32Tools-1.4.0-windows.tar.bz2",
+ "checksum": "SHA-256:9d0e5401c28f83de6b9e5c1d3dd08c71f89ed574113af8a0b78c3e677653be07",
+ "size": "2818862"
+ },
+ {
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/1.4.0/STM32Tools-1.4.0-mac.tar.bz2",
+ "archiveFileName": "STM32Tools-1.4.0-mac.tar.bz2",
+ "checksum": "SHA-256:861ab52fbfd6aa02e9efbd4f568bc536c6669975675660417b4c2e719fe15304",
+ "size": "757807"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/1.4.0/STM32Tools-1.4.0-linux.tar.bz2",
+ "archiveFileName": "STM32Tools-1.4.0-linux.tar.bz2",
+ "checksum": "SHA-256:03ce112090a39ea5176b4401ec06208b8d8cccb4eb705c8f03c5aa74f3c99918",
+ "size": "755585"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/1.4.0/STM32Tools-1.4.0-linux.tar.bz2",
+ "archiveFileName": "STM32Tools-1.4.0-linux.tar.bz2",
+ "checksum": "SHA-256:03ce112090a39ea5176b4401ec06208b8d8cccb4eb705c8f03c5aa74f3c99918",
+ "size": "755585"
+ }
+ ]
+ },
+ {
+ "name": "STM32Tools",
+ "version": "2.0.0",
+ "systems": [
+ {
+ "host": "i686-mingw32",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/2.0.0/STM32Tools-2.0.0-windows.tar.bz2",
+ "archiveFileName": "STM32Tools-2.0.0-windows.tar.bz2",
+ "checksum": "SHA-256:6316ffd1667344952bc5e16ff60783f9b4211d1eb54fc0d0c28e836b1490b717",
+ "size": "2486087"
+ },
+ {
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/2.0.0/STM32Tools-2.0.0-mac.tar.bz2",
+ "archiveFileName": "STM32Tools-2.0.0-mac.tar.bz2",
+ "checksum": "SHA-256:2612be87206d2ba6f7cf797c194dbc070139defc884b881c1957a8d148c2114c",
+ "size": "486398"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/2.0.0/STM32Tools-2.0.0-linux.tar.bz2",
+ "archiveFileName": "STM32Tools-2.0.0-linux.tar.bz2",
+ "checksum": "SHA-256:850186554df1d56f5f5336d6310551b734b2ff97c92677ca0ece11f134b72d0f",
+ "size": "479795"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/2.0.0/STM32Tools-2.0.0-linux.tar.bz2",
+ "archiveFileName": "STM32Tools-2.0.0-linux.tar.bz2",
+ "checksum": "SHA-256:850186554df1d56f5f5336d6310551b734b2ff97c92677ca0ece11f134b72d0f",
+ "size": "479795"
+ },
+ {
+ "host": "arm-linux-gnueabihf",
+ "url": "https://github.com/stm32duino/Arduino_Tools/releases/download/2.0.0/STM32Tools-2.0.0-linux.tar.bz2",
+ "archiveFileName": "STM32Tools-2.0.0-linux.tar.bz2",
+ "checksum": "SHA-256:850186554df1d56f5f5336d6310551b734b2ff97c92677ca0ece11f134b72d0f",
+ "size": "479795"
+ }
+ ]
+ },
+ {
+ "name": "xpack-arm-none-eabi-gcc",
+ "version": "9.2.1-1.1",
+ "systems": [
+ {
+ "host": "i686-mingw32",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.2.1-1.1/xpack-arm-none-eabi-gcc-9.2.1-1.1-win32-x32.zip",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.2.1-1.1-win32-x32.zip",
+ "checksum": "SHA-256:d13aaff4caae6e5f1b871d50accc1759c4f5750574dbd4d6f6e3017c33f39dc6",
+ "size": "128697954"
+ },
+ {
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.2.1-1.1/xpack-arm-none-eabi-gcc-9.2.1-1.1-darwin-x64.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.2.1-1.1-darwin-x64.tar.gz",
+ "checksum": "SHA-256:6ff68117083624273c56244cf4242989a65069b376a9727ec4a230be824340f3",
+ "size": "132371371"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.2.1-1.1/xpack-arm-none-eabi-gcc-9.2.1-1.1-linux-x64.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.2.1-1.1-linux-x64.tar.gz",
+ "checksum": "SHA-256:bbde117b97f229dfe63721c0323c3da6839e83cf302c8f4ff25e0f36ecf7a428",
+ "size": "135081450"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.2.1-1.1/xpack-arm-none-eabi-gcc-9.2.1-1.1-linux-x32.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.2.1-1.1-linux-x32.tar.gz",
+ "checksum": "SHA-256:e9f4b5f3ebe7e4391e2423e4106493d7cfcdee9eee4a1f0766f1c23662093a49",
+ "size": "137429272"
+ }
+ ]
+ },
+ {
+ "name": "xpack-arm-none-eabi-gcc",
+ "version": "9.3.1-1.3",
+ "systems": [
+ {
+ "host": "arm-linux-gnueabihf",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.3.1-1.3/xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-arm.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-arm.tar.gz",
+ "checksum": "SHA-256:0e6720296f291141cd757d90e6bf60867a1232de9abc52b0cde28af12eeb94f2",
+ "size": "147111321"
+ },
+ {
+ "host": "aarch64-linux-gnu",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.3.1-1.3/xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-arm64.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-arm64.tar.gz",
+ "checksum": "SHA-256:9a9e96b9ac3634d7632d35aa0d8138f8468d4f3f4d752374a95420ff7c8e4476",
+ "size": "150584175"
+ },
+ {
+ "host": "i686-mingw32",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.3.1-1.3/xpack-arm-none-eabi-gcc-9.3.1-1.3-win32-x32.zip",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.3.1-1.3-win32-x32.zip",
+ "checksum": "SHA-256:7432cfff045dc421d2ba177c3777ec1e82d4febe5f5f51fb2e90ff07d27cd466",
+ "size": "148593506"
+ },
+ {
+ "host": "x86_64-apple-darwin",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.3.1-1.3/xpack-arm-none-eabi-gcc-9.3.1-1.3-darwin-x64.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.3.1-1.3-darwin-x64.tar.gz",
+ "checksum": "SHA-256:f22f0d49c27f844dcfe629a6a33878d767b6945acd7508d9578b20b17b106f4c",
+ "size": "148641073"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.3.1-1.3/xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-x64.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-x64.tar.gz",
+ "checksum": "SHA-256:9045d261b000d921887fc801427542eed2df1616f63a2969a2640f8be2593686",
+ "size": "151422620"
+ },
+ {
+ "host": "i686-pc-linux-gnu",
+ "url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v9.3.1-1.3/xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-x32.tar.gz",
+ "archiveFileName": "xpack-arm-none-eabi-gcc-9.3.1-1.3-linux-x32.tar.gz",
+ "checksum": "SHA-256:1950c7b0b4e35bacec32450158ec192ac469189a5fb27c2fd7c01e9603e50e64",
+ "size": "154309058"
+ }
+ ]
+ },
+ {
+ "name": "nrfjprog",
+ "version": "9.4.0",
+ "systems": [
+ {
+ "host": "i386-apple-darwin11",
+ "checksum": "MD5:04f65e24f36d55d10b71c1ebf49cd070",
+ "size": "362222",
+ "archiveFileName": "nrfjprog-9.4.0-mac.tar.bz2",
+ "url": "https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/download/gcc-5_2-2015q4/nrfjprog-9.4.0-mac.tar.bz2"
+ },
+ {
+ "host": "i686-linux-gnu",
+ "checksum": "MD5:9cf73f1f78cb8e249ed4e6f963d08a35",
+ "size": "177428",
+ "archiveFileName": "nrfjprog-9.4.0-linux32.tar.bz2",
+ "url": "https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/download/gcc-5_2-2015q4/nrfjprog-9.4.0-linux32.tar.bz2"
+ },
+ {
+ "host": "x86_64-pc-linux-gnu",
+ "checksum": "MD5:da3c7b348e0c22766f175a4a9cca0d19",
+ "size": "190020",
+ "archiveFileName": "nrfjprog-9.4.0-linux64.tar.bz2",
+ "url": "https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/download/gcc-5_2-2015q4/nrfjprog-9.4.0-linux64.tar.bz2"
+ },
+ {
+ "host": "i686-mingw32",
+ "checksum": "MD5:8352392ae0272173e1508d1218f51671",
+ "size": "851576",
+ "archiveFileName": "nrfjprog-9.4.0-win32.tar.bz2",
+ "url": "https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/download/gcc-5_2-2015q4/nrfjprog-9.4.0-win32.tar.bz2"
+ },
+ {
+ "host": "arm-linux-gnueabihf",
+ "checksum": "MD5:3703bed3c1114e8f4ef1b0b2d65aeb0a",
+ "size": "2794097",
+ "archiveFileName": "nrfjprog-10.15.0-arm.tar.bz2",
+ "url": "https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/download/gcc-5_2-2015q4/nrfjprog-10.15.0-arm.tar.bz2"
+ },
+ {
+ "host": "aarch64-linux-gnu",
+ "checksum": "MD5:3703bed3c1114e8f4ef1b0b2d65aeb0a",
+ "size": "2794097",
+ "archiveFileName": "nrfjprog-10.15.0-arm.tar.bz2",
+ "url": "https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/download/gcc-5_2-2015q4/nrfjprog-10.15.0-arm.tar.bz2"
+ }
+ ]
}
]
},
@@ -532,14 +3882,14 @@
{
"category": "Contributed",
"name": "SparkFun ESP8266 Boards",
- "url": "https://cdn.sparkfun.com/assets/learn_tutorials/4/9/5/sparkfun-esp8266-2.1.0.tar.bz2",
- "checksum": "SHA-256:FE3E0504B38A5A4C912801A3E4633380A666DC77B8D3043548187AF8675477DA",
+ "url": "https://github.com/sparkfun/Arduino_Boards/raw/main/IDE_Board_Manager/sparkfun-esp8266-2.1.2.tar.bz2",
+ "checksum": "SHA-256:6A3722A50B09DCEF92818B5C0E5A6C752E84181F1ABFD0959DACC39D8E2F1C94",
"help": {
"online": "https://learn.sparkfun.com"
},
- "version": "2.1.0",
+ "version": "2.1.2",
"architecture": "esp8266",
- "archiveFileName": "sparkfun-esp8266-2.1.0.tar.bz2",
+ "archiveFileName": "sparkfun-esp8266-2.1.2.tar.bz2",
"boards": [
{
"name": "SparkFun Blynk Board - ESP8266"
@@ -571,7 +3921,7 @@
"name": "mkspiffs"
}
],
- "size": "5436076"
+ "size": "1905291"
}
],
"tools": [
@@ -580,39 +3930,46 @@
"name": "xtensa-lx106-elf-gcc",
"systems": [
{
- "url": "http://arduino.esp8266.com/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
+ "url": "https://github.com/esp8266/Arduino/releases/download/2.3.0/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum": "SHA-256:10476b9c11a7a90f40883413ddfb409f505b20692e316c4e597c4c175b4be09c",
"host": "i686-mingw32",
"archiveFileName": "win32-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"size": "153527527"
},
{
- "url": "http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
+ "url": "https://github.com/esp8266/Arduino/releases/download/2.3.0/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum": "SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
"host": "x86_64-apple-darwin",
"archiveFileName": "osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"size": "35385382"
},
{
- "url": "http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
+ "url": "https://github.com/esp8266/Arduino/releases/download/2.3.0/osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"checksum": "SHA-256:0cf150193997bd1355e0f49d3d49711730035257bc1aee1eaaad619e56b9e4e6",
"host": "i386-apple-darwin",
"archiveFileName": "osx-xtensa-lx106-elf-gb404fb9-2.tar.gz",
"size": "35385382"
},
{
- "url": "http://arduino.esp8266.com/linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
+ "url": "https://github.com/esp8266/Arduino/releases/download/2.3.0/linux64-xtensa-lx106-elf-gb404fb9.tgz",
"checksum": "SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7",
"host": "x86_64-pc-linux-gnu",
"archiveFileName": "linux64-xtensa-lx106-elf-gb404fb9.tar.gz",
"size": "30262903"
},
{
- "url": "http://arduino.esp8266.com/linux32-xtensa-lx106-elf.tar.gz",
+ "url": "https://github.com/esp8266/Arduino/releases/download/2.3.0/linux32-xtensa-lx106-elf.tar.gz",
"checksum": "SHA-256:b24817819f0078fb05895a640e806e0aca9aa96b47b80d2390ac8e2d9ddc955a",
"host": "i686-pc-linux-gnu",
"archiveFileName": "linux32-xtensa-lx106-elf.tar.gz",
"size": "32734156"
+ },
+ {
+ "url": "https://github.com/esp8266/Arduino/releases/download/2.3.0/linuxarm-xtensa-lx106-elf-g46f160f-2.tar.gz",
+ "checksum": "SHA-256:f693946288f2ffa17288ef75ae16fa08573993f2b0a2a5e6bc35a68dc6087443",
+ "host": "arm-linux-gnueabihf",
+ "archiveFileName": "linuxarm-xtensa-lx106-elf-g46f160f-2.tar.gz",
+ "size": "34938475"
}
]
},
@@ -822,8 +4179,8 @@
]
}
],
- "email": "ivan@esp8266.com",
- "name": "esp8266"
+ "email": "elias.santistevan@sparkfun.com",
+ "name": "SparkFun"
}
]
}
diff --git a/IDE_Board_Manager/sparkfun-esp32-1.0.0.tar.bz2 b/IDE_Board_Manager/sparkfun-esp32-1.0.0.tar.bz2
new file mode 100644
index 00000000..2e8b1953
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-esp32-1.0.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-esp32-1.0.1.tar.bz2 b/IDE_Board_Manager/sparkfun-esp32-1.0.1.tar.bz2
new file mode 100644
index 00000000..2e8b1953
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-esp32-1.0.1.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-esp8266-2.1.1.tar.bz2 b/IDE_Board_Manager/sparkfun-esp8266-2.1.1.tar.bz2
new file mode 100644
index 00000000..fb680e9c
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-esp8266-2.1.1.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-esp8266-2.1.2.tar.bz2 b/IDE_Board_Manager/sparkfun-esp8266-2.1.2.tar.bz2
new file mode 100644
index 00000000..75ae6cc6
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-esp8266-2.1.2.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-nrf52-1.0.0.tar.bz2 b/IDE_Board_Manager/sparkfun-nrf52-1.0.0.tar.bz2
new file mode 100644
index 00000000..643a4576
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-nrf52-1.0.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.5.0.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.5.0.tar.bz2
new file mode 100644
index 00000000..eb3a1ded
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.5.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.5.1.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.5.1.tar.bz2
new file mode 100644
index 00000000..f7e7c031
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.5.1.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.5.2.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.5.2.tar.bz2
new file mode 100644
index 00000000..dfdd414f
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.5.2.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.5.3.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.5.3.tar.bz2
new file mode 100644
index 00000000..05a732b3
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.5.3.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.5.4.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.5.4.tar.bz2
new file mode 100644
index 00000000..251771fa
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.5.4.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.6.1.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.6.1.tar.bz2
new file mode 100644
index 00000000..bb24b140
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.6.1.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.6.2.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.6.2.tar.bz2
new file mode 100644
index 00000000..f1bca472
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.6.2.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.0.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.0.tar.bz2
new file mode 100644
index 00000000..7e06149a
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.1.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.1.tar.bz2
new file mode 100644
index 00000000..069cba62
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.1.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.2.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.2.tar.bz2
new file mode 100644
index 00000000..4c1f36f8
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.2.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.3.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.3.tar.bz2
new file mode 100644
index 00000000..2e6bc3cb
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.3.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.4.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.4.tar.bz2
new file mode 100644
index 00000000..c4cfe783
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.4.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.5.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.5.tar.bz2
new file mode 100644
index 00000000..ab253b39
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.5.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.6.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.6.tar.bz2
new file mode 100644
index 00000000..acbfba3f
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.6.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.7.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.7.tar.bz2
new file mode 100644
index 00000000..528afcc9
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.7.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.8.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.8.tar.bz2
new file mode 100644
index 00000000..dce47eae
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.8.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.7.9.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.7.9.tar.bz2
new file mode 100644
index 00000000..21a19c54
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.7.9.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.0.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.0.tar.bz2
new file mode 100644
index 00000000..bf495ccc
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.1.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.1.tar.bz2
new file mode 100644
index 00000000..f82e787b
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.1.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.10.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.10.tar.bz2
new file mode 100644
index 00000000..9f00ec6a
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.10.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.11.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.11.tar.bz2
new file mode 100644
index 00000000..0abe1ba7
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.11.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.12.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.12.tar.bz2
new file mode 100644
index 00000000..c32e33fb
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.12.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.13.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.13.tar.bz2
new file mode 100644
index 00000000..7c92674b
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.13.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.2.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.2.tar.bz2
new file mode 100644
index 00000000..3cfa97de
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.2.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.3.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.3.tar.bz2
new file mode 100644
index 00000000..b4de2211
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.3.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.4.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.4.tar.bz2
new file mode 100644
index 00000000..e7dd815d
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.4.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.5.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.5.tar.bz2
new file mode 100644
index 00000000..6cf3f7af
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.5.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.6.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.6.tar.bz2
new file mode 100644
index 00000000..ae15c4ea
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.6.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.7.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.7.tar.bz2
new file mode 100644
index 00000000..40d8d59a
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.7.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.8.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.8.tar.bz2
new file mode 100644
index 00000000..012b90a0
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.8.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-samd-1.8.9.tar.bz2 b/IDE_Board_Manager/sparkfun-samd-1.8.9.tar.bz2
new file mode 100644
index 00000000..10f0e46d
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-samd-1.8.9.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-stm32-1.0.0.tar.bz2 b/IDE_Board_Manager/sparkfun-stm32-1.0.0.tar.bz2
new file mode 100644
index 00000000..dbb1d76f
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-stm32-1.0.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-stm32-2.0.0.tar.bz2 b/IDE_Board_Manager/sparkfun-stm32-2.0.0.tar.bz2
new file mode 100644
index 00000000..a32d93e4
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-stm32-2.0.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfun-stm32-2.1.0.tar.bz2 b/IDE_Board_Manager/sparkfun-stm32-2.1.0.tar.bz2
new file mode 100644
index 00000000..eaf2f8a3
Binary files /dev/null and b/IDE_Board_Manager/sparkfun-stm32-2.1.0.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfunboards.1.1.11.tar.bz2 b/IDE_Board_Manager/sparkfunboards.1.1.11.tar.bz2
new file mode 100644
index 00000000..28a3cd6c
Binary files /dev/null and b/IDE_Board_Manager/sparkfunboards.1.1.11.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfunboards.1.1.12.tar.bz2 b/IDE_Board_Manager/sparkfunboards.1.1.12.tar.bz2
new file mode 100644
index 00000000..36e6f77d
Binary files /dev/null and b/IDE_Board_Manager/sparkfunboards.1.1.12.tar.bz2 differ
diff --git a/IDE_Board_Manager/sparkfunboards.1.1.13.tar.bz2 b/IDE_Board_Manager/sparkfunboards.1.1.13.tar.bz2
new file mode 100644
index 00000000..1ab0ef85
Binary files /dev/null and b/IDE_Board_Manager/sparkfunboards.1.1.13.tar.bz2 differ
diff --git a/README.md b/README.md
index f9523220..f5fc00db 100644
--- a/README.md
+++ b/README.md
@@ -4,52 +4,79 @@ This repository contains support for the following SparkFun Arduino-compatible d
**IMPORTANT NOTE:** These board files have been updated for compatibility with Arduino version 1.8 and higher. Some boards (e.g. SAMD) may not compile correctly with earlier versions of Arduino. If you need compatibility with earlier versions of Arduino, you can choose previous releases of these boards from the Boards Manager.
+#### Apollo3 Boards
+
+- [Artemis Module](https://www.sparkfun.com/products/15484)
+- [Redboard Artemis](https://www.sparkfun.com/products/15444)
+- [Redboard Artemis ATP](https://www.sparkfun.com/products/15442)
+- [Redboard Artemis Nano](https://www.sparkfun.com/products/15443)
+- [Edge](https://www.sparkfun.com/products/15170)
+
#### AVR Boards
-* [RedBoard](https://www.sparkfun.com/products/12757)
-* [MaKey MaKey](https://www.sparkfun.com/products/11511)
-* [Pro Micro 3.3V](https://www.sparkfun.com/products/10999)
-* [Pro Micro 5V](https://www.sparkfun.com/products/11098)
-* [Fio v3](https://www.sparkfun.com/products/11520)
-* [Qduino Mini](https://www.sparkfun.com/products/13614)
-* [Digital Sandbox](https://www.sparkfun.com/products/12651)
-* [Mega Pro 3.3V](https://www.sparkfun.com/products/10744)
-* [Mega Pro 5V](https://www.sparkfun.com/products/11007)
-* [RedBot](https://www.sparkfun.com/products/12097)
-* [Serial 7-Segment Display](https://www.sparkfun.com/products/11441)
-* [ATmega128RFA1 Development Board](https://www.sparkfun.com/products/11197)
-* [LilyPad USB Plus](https://www.sparkfun.com/products/14346)
+- [RedBoard](https://www.sparkfun.com/products/12757)
+- [MaKey MaKey](https://www.sparkfun.com/products/11511)
+- [Pro Micro 3.3V](https://www.sparkfun.com/products/10999)
+- [Pro Micro 5V](https://www.sparkfun.com/products/11098)
+- [Fio v3](https://www.sparkfun.com/products/11520)
+- [Qduino Mini](https://www.sparkfun.com/products/13614)
+- [Digital Sandbox](https://www.sparkfun.com/products/12651)
+- [Mega Pro 3.3V](https://www.sparkfun.com/products/10744)
+- [Mega Pro 5V](https://www.sparkfun.com/products/11007)
+- [RedBot](https://www.sparkfun.com/products/12097)
+- [Serial 7-Segment Display](https://www.sparkfun.com/products/11441)
+- [ATmega128RFA1 Development Board](https://www.sparkfun.com/products/11197)
+- [LilyPad USB Plus](https://www.sparkfun.com/products/14346)
#### SAMD (ARM Cortex-M0+) Boards
-* [SparkFun SAMD21 Dev Breakout](https://www.sparkfun.com/products/13672)
-* [SparkFun SAMD21 Mini Breakout](https://www.sparkfun.com/products/13664)
-* [SparkFun 9DoF Razor IMU M0 (SAMD21)](https://www.sparkfun.com/products/14001)
-* [SparkFun LilyMini ProtoSnap (SAMD11)](https://www.sparkfun.com/products/14063)
-* [SparkFun LilyMini (SAMD11)](https://www.sparkfun.com/products/14064)
+- [SparkFun SAMD21 Dev Breakout](https://www.sparkfun.com/products/13672)
+- [SparkFun SAMD21 Mini Breakout](https://www.sparkfun.com/products/13664)
+- [SparkFun 9DoF Razor IMU M0 (SAMD21)](https://www.sparkfun.com/products/14001)
+- [SparkFun LilyMini ProtoSnap (SAMD11)](https://www.sparkfun.com/products/14063)
+- [SparkFun LilyMini (SAMD11)](https://www.sparkfun.com/products/14064)
+- [SparkFun SAMD21 Pro RF LoRa 915MHz](https://www.sparkfun.com/products/14916)
+- [SparkFun Qwiic Micro](https://www.sparkfun.com/products/15423)
#### ESP8266 Boards
-* [ESP8266 Thing](https://www.sparkfun.com/products/13231)
-* [ESP8266 WiFi Shield](https://www.sparkfun.com/products/13287)
+_These boards are supported by [Espressif](https://github.com/esp8266/Arduino)_. :+1:
+
+- [ESP8266 Thing](https://www.sparkfun.com/products/13231)
+- [ESP8266 Thing Dev](https://www.sparkfun.com/products/13711)
+- [ESP8266 WiFi Shield](https://www.sparkfun.com/products/13287)
+- [SparkFun Blynk](https://www.sparkfun.com/products/13794)
+
+#### ESP32 Boards
+
+_These boards are supported by [Espressif](https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md)._ :+1:
+
+- [SparkFun Thing Plus - ESP32 WROOM](https://www.sparkfun.com/products/14689)
+- [SparkFun ESP32 Thing](https://www.sparkfun.com/products/13907)
+- [SparkFun LoRa Gateway - 1-Channel (ESP32)](https://www.sparkfun.com/products/15006)
+- [SparkFun MicroMod ESP32 Processor](https://www.sparkfun.com/products/16781)
+
+#### nRF52 Boards
+
+- [SparkFun Thing Plus NINA-B306](https://www.sparkfun.com/products/20854)
### Installation Instructions
To add board support for our products, start Arduino and open the Preferences window (**File** > **Preferences**). Now copy and paste the following URL into the 'Additional Boards Manager URLs' input field:
- https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
+ https://raw.githubusercontent.com/sparkfun/Arduino_Boards/main/IDE_Board_Manager/package_sparkfun_index.json

If there is already an URL from another manufacturer in that field, click the button at the right end of the field. This will open an editing window allowing you to paste the above URL onto a new line.
-### AVR and ESP Installation Instructions
+### Apollo3 and AVR Installation Instructions
Open the Boards Manager window by selecting **Tools** > **Board**, scroll to the top of the board list, and select **Boards Manager**.

-If you type "sparkfun" (without quotes) into the "filter your search" field, you will see options to install SparkFun's AVR and ESP board files. Click in the desired box, and click the "Install" button that appears. Once installed, the boards will appear at the bottom of the board list.
+If you type "sparkfun" (without quotes) into the "filter your search" field, you will see options to install SparkFun's Apollo3 and AVR board files. Click in the desired box, and click the "Install" button that appears. Once installed, the boards will appear at the bottom of the board list.

@@ -69,10 +96,18 @@ Now click anywhere in the "SparkFun SAMD Boards" box, and click "Install". This
You're now ready to use SparkFun SAMD boards. They will appear at the bottom of the board list.
+### ESP Boards?
+
+All support for our ESP based boards are supported within their respective Espressif's Repository.
+
+- For our ESP8266 based boards: [Blynk](https://www.sparkfun.com/products/13794), [ESP8266 Thing](https://www.sparkfun.com/products/13231), or [ESP8266 Thing Dev](https://www.sparkfun.com/products/13711), you can install the board files by following the instructions [here](https://github.com/esp8266/Arduino).
+
+- For our ESP32 based boards Boards: [SparkFun Thing Plus - ESP32 WROOM](https://www.sparkfun.com/products/14689), [SparkFun ESP32 Thing](https://www.sparkfun.com/products/13907), [SparkFun LoRa Gateway - 1-Channel (ESP32](https://www.sparkfun.com/products/15006) you can install the board files by following the instructions [here](https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md).
+
### Notes
-* Some boards such as the Arduino Pro and Pro Mini come in more than one flavor. For these **you must select the correct processor** in the 'Tools' menu.
-* Information on compiling and programming the bootloaders can be found in the bootloaders directory.
+- Some boards such as the Arduino Pro and Pro Mini come in more than one flavor. For these **you must select the correct processor** in the 'Tools' menu.
+- Information on compiling and programming the bootloaders can be found in the bootloaders directory.
**Have fun!**
-\-Your friends at SparkFun
\ No newline at end of file
+\-Your friends at SparkFun
diff --git a/sparkfun/avr/Qduino/Qduino.cpp b/sparkfun/avr/Qduino/Qduino.cpp
index 2e2c1f4c..3573ff56 100755
--- a/sparkfun/avr/Qduino/Qduino.cpp
+++ b/sparkfun/avr/Qduino/Qduino.cpp
@@ -7,7 +7,7 @@
* mattnewberry@me.com *
* *
***************************************************************************
- * *
+ * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU License. *
* This program is distributed in the hope that it will be useful, *
@@ -22,7 +22,7 @@
#include "Wire.h"
void qduino::setup(){
-
+
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode(11, OUTPUT);
@@ -32,21 +32,21 @@ void qduino::setup(){
}
void qduino::setRGB(uint8_t r, uint8_t g, uint8_t b){
-
+
// ratio for R:G:B is 4:7:7 for forward voltage
-
+
r = 255 - r; // set all values to opposite values
g = 255 - g; // because LED is common anode
b = 255 - b;
-
+
int newr = map(r, 0, 255, 0, 146);
-
+
analogWrite(10, newr);
analogWrite(11, g);
analogWrite(13, b);
}
-void qduino::setRGB(COLORS color){
+void qduino::setRGB(COLORS color){
switch (color) {
case RED:
analogWrite(10, 0);
@@ -97,31 +97,31 @@ void qduino::setRGB(COLORS color){
}
void qduino::rainbow(uint8_t duration)
-{
+{
uint8_t rgbColor[3];
// Keep values for duration bounded
if (duration < 1) duration = 1;
if (duration > 5) duration = 5;
-
+
int newDuration = map(duration, 1, 5, 500, 3000);
-
+
// Start off with red.
rgbColor[0] = 255;
rgbColor[1] = 0;
- rgbColor[2] = 0;
-
+ rgbColor[2] = 0;
+
// Choose the colours to increment and decrement.
for (uint8_t decColor = 0; decColor < 3; decColor += 1)
{
int incColor = decColor == 2 ? 0 : decColor + 1;
-
+
// cross-fade the two colours.
for(uint8_t i = 0; i < 255; i += 1)
{
rgbColor[decColor] -= 1;
rgbColor[incColor] += 1;
-
+
analogWrite(10, rgbColor[0]);
analogWrite(11, rgbColor[1]);
analogWrite(13, rgbColor[2]);
@@ -131,7 +131,7 @@ void qduino::rainbow(uint8_t duration)
}
void qduino::ledOff()
-{
+{
analogWrite(10, 255);
analogWrite(11, 255);
analogWrite(13, 255);
@@ -167,7 +167,7 @@ char fuelGauge::getVersion()
byte msb = 0;
byte lsb = 0;
readFrom(MAX1704_VERSION, msb, lsb);
-
+
value = 0xFF00 & (msb<<8);
value |= 0xFF & lsb;
@@ -211,7 +211,7 @@ boolean fuelGauge::inSleep()
byte lsb = 0;
readFrom(MAX1704_CONFIG,msb,lsb);
- byte sleep = (lsb >>7) & 0x01;
+ byte sleep = (lsb >>7) & 0x01;
return int(sleep) == 1;
}
@@ -256,7 +256,7 @@ void fuelGauge::wakeUp()
Wire.endTransmission();
// This delay is here to ensure it's fully awake before moving on
- delay(150);
+ delay(150);
}
void fuelGauge::performCommand(byte address, int value)
@@ -281,6 +281,5 @@ void fuelGauge::readFrom(byte address, byte &msb, byte &lsb)
msb = Wire.read();
lsb = Wire.read();
}
- Wire.endTransmission();
+ //Wire.endTransmission();
}
-
diff --git a/sparkfun/avr/Qduino/examples/batteryLeveltoRGB/batteryLeveltoRGB.ino b/sparkfun/avr/Qduino/examples/batteryLeveltoRGB/batteryLeveltoRGB.ino
index 754a8f2d..9b29481d 100644
--- a/sparkfun/avr/Qduino/examples/batteryLeveltoRGB/batteryLeveltoRGB.ino
+++ b/sparkfun/avr/Qduino/examples/batteryLeveltoRGB/batteryLeveltoRGB.ino
@@ -36,15 +36,15 @@ void loop(){
q.setRGB("green");
- } else if(charge >= 50 && charge << 75) {
+ } else if(charge >= 50 && charge < 75) {
q.setRGB("yellow");
- } else if(charge >= 25 && charge << 50) {
+ } else if(charge >= 25 && charge < 50) {
q.setRGB("orange");
- } else if(charge << 25) {
+ } else if(charge < 25) {
q.setRGB("red");
}
diff --git a/sparkfun/avr/avrdude.conf b/sparkfun/avr/avrdude.conf
index c8b7467e..0557959c 100644
--- a/sparkfun/avr/avrdude.conf
+++ b/sparkfun/avr/avrdude.conf
@@ -1,4 +1,4 @@
-# $Id: avrdude.conf.in 1236 2013-09-16 19:40:15Z joerg_wunsch $ -*- text -*-
+# $Id: avrdude.conf.in 1371 2016-02-15 20:15:07Z joerg_wunsch $ -*- text -*-
#
# AVRDUDE Configuration File
#
@@ -10,6 +10,10 @@
# identifies which part AVRDUDE is going to be programming and must match
# one of the parts' "id" parameter.
#
+# DO NOT MODIFY THIS FILE. Modifications will be overwritten the next
+# time a "make install" is run. For user-specific additions, use the
+# "-C +filename" commandline option.
+#
# Possible entry formats are:
#
# programmer
@@ -31,7 +35,7 @@
# pgmled = ; # pin number
# vfyled = ; # pin number
# usbvid = ; # USB VID (Vendor ID)
-# usbpid = ; # USB PID (Product ID)
+# usbpid = [, ...] # USB PID (Product ID) (1)
# usbdev = ; # USB interface or other device info
# usbvendor = ; # USB Vendor Name
# usbproduct = ; # USB Product Name
@@ -41,6 +45,8 @@
# For a pin list all pins must be inverted.
# A single pin can be specified as usual = ~ , for lists
# specify it as follows = ~ ( [, ... ] ) .
+#
+# (1) Not all programmer types can process a list of PIDs.
# ;
#
# part
@@ -54,6 +60,7 @@
# stk500_devcode = ; # numeric
# avr910_devcode = ; # numeric
# signature = ; # signature bytes
+# usbpid = ; # DFU USB PID
# chip_erase_delay = ; # micro-seconds
# reset = dedicated | io;
# retry_pulse = reset | sck;
@@ -327,8 +334,8 @@
#
# Overall avrdude defaults; suitable for ~/.avrduderc
#
-default_parallel = "unknown";
-default_serial = "unknown";
+default_parallel = "lpt1";
+default_serial = "com1";
# default_bitclock = 2.5;
# Turn off safemode by default
@@ -460,6 +467,64 @@ programmer
# from Amontec
;
+# UM232H module from FTDI and Glyn.com.au.
+# See helix.air.net.au for detailed usage information.
+# J1: Connect pin 2 and 3 for USB power.
+# J2: Connect pin 2 and 3 for USB power.
+# J2: Pin 7 is SCK
+# : Pin 8 is MOSI
+# : Pin 9 is MISO
+# : Pin 11 is RST
+# : Pin 6 is ground
+# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get
+# a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant.
+programmer
+ id = "UM232H";
+ desc = "FT232H based module from FTDI and Glyn.com.au";
+ type = "avrftdi";
+ usbvid = 0x0403;
+# Note: This PID is reserved for generic 232H devices and
+# should be programmed into the EEPROM
+ usbpid = 0x6014;
+ usbdev = "A";
+ usbvendor = "";
+ usbproduct = "";
+ usbsn = "";
+#ISP-signals
+ sck = 0;
+ mosi = 1;
+ miso = 2;
+ reset = 3;
+;
+
+# C232HM module from FTDI and Glyn.com.au.
+# : Orange is SCK
+# : Yellow is MOSI
+# : Green is MISO
+# : Brown is RST
+# : Black is ground
+# Use the -b flag to set the SPI clock rate eg -b 3750000 is the fastest I could get
+# a 16MHz Atmega1280 to program reliably. The 232H is conveniently 5V tolerant.
+programmer
+ id = "C232HM";
+ desc = "FT232H based module from FTDI and Glyn.com.au";
+ type = "avrftdi";
+ usbvid = 0x0403;
+# Note: This PID is reserved for generic 232H devices and
+# should be programmed into the EEPROM
+ usbpid = 0x6014;
+ usbdev = "A";
+ usbvendor = "";
+ usbproduct = "";
+ usbsn = "";
+#ISP-signals
+ sck = 0;
+ mosi = 1;
+ miso = 2;
+ reset = 3;
+;
+
+
# On the adapter you can read "O-Link". On the PCB is printed "OpenJTAG v3.1"
# You can find it as "OpenJTAG ARM JTAG USB" in the internet.
# (But there are also several projects called Open JTAG, eg.
@@ -521,6 +586,24 @@ programmer
buff = 7;
;
+# submitted as bug #46020
+programmer
+ id = "tumpa";
+ desc = "TIAO USB Multi-Protocol Adapter";
+ type = "avrftdi";
+ connection_type = usb;
+ usbvid = 0x0403;
+ usbpid = 0x8A98;
+ usbdev = "A";
+ usbvendor = "TIAO";
+ usbproduct = "";
+ usbsn = "";
+ sck = 0; # TCK 9
+ mosi = 1; # TDI 5
+ miso = 2; # TDO 13
+ reset = 3; # TMS 7
+;
+
programmer
id = "avrisp";
desc = "Atmel AVR ISP";
@@ -658,8 +741,8 @@ programmer
type = "ftdi_syncbb";
connection_type = usb;
miso = 1; # RxD
- sck = 0; # RTS
- mosi = 2; # TxD
+ sck = 0; # TxD
+ mosi = 2; # RTS
reset = 4; # DTR
;
@@ -694,6 +777,47 @@ programmer parent "arduino-ft232r"
desc = "alias for arduino-ft232r";
;
+# There is a ATmega328P kit PCB called "uncompatino".
+# This board allows ISP via its on-board FT232R.
+# This is designed like Arduino Duemilanove but has no standard ICPS header.
+# Its 4 pairs of pins are shorted to enable ftdi_syncbb.
+# http://akizukidenshi.com/catalog/g/gP-07487/
+# http://akizukidenshi.com/download/ds/akizuki/k6096_manual_20130816.pdf
+programmer
+ id = "uncompatino";
+ desc = "uncompatino with all pairs of pins shorted";
+ type = "ftdi_syncbb";
+ connection_type = usb;
+ miso = 3; # cts
+ sck = 5; # dsr
+ mosi = 6; # dcd
+ reset = 7; # ri
+;
+
+# FTDI USB to serial cable TTL-232R-5V with a custom adapter for ICSP
+# http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
+# http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf
+# For ICSP pinout see for example http://www.atmel.com/images/doc2562.pdf
+# (Figure 1. ISP6PIN header pinout and Table 1. Connections required for ISP ...)
+# TTL-232R GND 1 Black -> ICPS GND (pin 6)
+# TTL-232R CTS 2 Brown -> ICPS MOSI (pin 4)
+# TTL-232R VCC 3 Red -> ICPS VCC (pin 2)
+# TTL-232R TXD 4 Orange -> ICPS RESET (pin 5)
+# TTL-232R RXD 5 Yellow -> ICPS SCK (pin 3)
+# TTL-232R RTS 6 Green -> ICPS MISO (pin 1)
+# Except for VCC and GND, you can connect arbitual pairs as long as
+# the following table is adjusted.
+programmer
+ id = "ttl232r";
+ desc = "FTDI TTL232R-5V with ICSP adapter";
+ type = "ftdi_syncbb";
+ connection_type = usb;
+ miso = 2; # rts
+ sck = 1; # rxd
+ mosi = 3; # cts
+ reset = 0; # txd
+;
+
programmer
id = "usbasp";
desc = "USBasp, http://www.fischl.de/usbasp/";
@@ -752,13 +876,22 @@ programmer
programmer
id = "arduinoisp";
- desc = " ";
+ desc = "Arduino ISP Programmer";
type = "usbtiny";
connection_type = usb;
usbvid = 0x2341;
usbpid = 0x0049;
;
+programmer
+ id = "arduinoisporg";
+ desc = "Arduino ISP Programmer";
+ type = "usbtiny";
+ connection_type = usb;
+ usbvid = 0x2A03;
+ usbpid = 0x0049;
+;
+
programmer
id = "butterfly";
desc = "Atmel Butterfly Development Board";
@@ -944,6 +1077,7 @@ programmer
desc = "Atmel AVR JTAGICE3 in JTAG mode";
type = "jtagice3";
connection_type = usb;
+ usbpid = 0x2110, 0x2140;
;
programmer
@@ -951,6 +1085,7 @@ programmer
desc = "Atmel AVR JTAGICE3 in PDI mode";
type = "jtagice3_pdi";
connection_type = usb;
+ usbpid = 0x2110, 0x2140;
;
programmer
@@ -958,6 +1093,7 @@ programmer
desc = "Atmel AVR JTAGICE3 in debugWIRE mode";
type = "jtagice3_dw";
connection_type = usb;
+ usbpid = 0x2110, 0x2140;
;
programmer
@@ -965,6 +1101,63 @@ programmer
desc = "Atmel AVR JTAGICE3 in ISP mode";
type = "jtagice3_isp";
connection_type = usb;
+ usbpid = 0x2110, 0x2140;
+;
+
+programmer
+ id = "xplainedpro";
+ desc = "Atmel AVR XplainedPro in JTAG mode";
+ type = "jtagice3";
+ connection_type = usb;
+ usbpid = 0x2111;
+;
+
+programmer
+ id = "xplainedmini";
+ desc = "Atmel AVR XplainedMini in ISP mode";
+ type = "jtagice3_isp";
+ connection_type = usb;
+ usbpid = 0x2145;
+;
+
+programmer
+ id = "xplainedmini_dw";
+ desc = "Atmel AVR XplainedMini in debugWIRE mode";
+ type = "jtagice3_dw";
+ connection_type = usb;
+ usbpid = 0x2145;
+;
+
+programmer
+ id = "atmelice";
+ desc = "Atmel-ICE (ARM/AVR) in JTAG mode";
+ type = "jtagice3";
+ connection_type = usb;
+ usbpid = 0x2141;
+;
+
+programmer
+ id = "atmelice_pdi";
+ desc = "Atmel-ICE (ARM/AVR) in PDI mode";
+ type = "jtagice3_pdi";
+ connection_type = usb;
+ usbpid = 0x2141;
+;
+
+programmer
+ id = "atmelice_dw";
+ desc = "Atmel-ICE (ARM/AVR) in debugWIRE mode";
+ type = "jtagice3_dw";
+ connection_type = usb;
+ usbpid = 0x2141;
+;
+
+programmer
+ id = "atmelice_isp";
+ desc = "Atmel-ICE (ARM/AVR) in ISP mode";
+ type = "jtagice3_isp";
+ connection_type = usb;
+ usbpid = 0x2141;
;
@@ -982,6 +1175,225 @@ programmer
connection_type = usb;
;
+programmer
+ id = "flip1";
+ desc = "FLIP USB DFU protocol version 1 (doc7618)";
+ type = "flip1";
+ connection_type = usb;
+;
+
+programmer
+ id = "flip2";
+ desc = "FLIP USB DFU protocol version 2 (AVR4023)";
+ type = "flip2";
+ connection_type = usb;
+;
+
+# Parallel port programmers.
+
+programmer
+ id = "bsd";
+ desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/";
+ type = "par";
+ connection_type = parallel;
+ vcc = 2, 3, 4, 5;
+ reset = 7;
+ sck = 8;
+ mosi = 9;
+ miso = 10;
+;
+
+programmer
+ id = "stk200";
+ desc = "STK200";
+ type = "par";
+ connection_type = parallel;
+ buff = 4, 5;
+ sck = 6;
+ mosi = 7;
+ reset = 9;
+ miso = 10;
+;
+
+# The programming dongle used by the popular Ponyprog
+# utility. It is almost similar to the STK200 one,
+# except that there is a LED indicating that the
+# programming is currently in progress.
+
+programmer parent "stk200"
+ id = "pony-stk200";
+ desc = "Pony Prog STK200";
+ pgmled = 8;
+;
+
+programmer
+ id = "dt006";
+ desc = "Dontronics DT006";
+ type = "par";
+ connection_type = parallel;
+ reset = 4;
+ sck = 5;
+ mosi = 2;
+ miso = 11;
+;
+
+programmer parent "dt006"
+ id = "bascom";
+ desc = "Bascom SAMPLE programming cable";
+;
+
+programmer
+ id = "alf";
+ desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/";
+ type = "par";
+ connection_type = parallel;
+ vcc = 2, 3, 4, 5;
+ buff = 6;
+ reset = 7;
+ sck = 8;
+ mosi = 9;
+ miso = 10;
+ errled = 1;
+ rdyled = 14;
+ pgmled = 16;
+ vfyled = 17;
+;
+
+programmer
+ id = "sp12";
+ desc = "Steve Bolt's Programmer";
+ type = "par";
+ connection_type = parallel;
+ vcc = 4,5,6,7,8;
+ reset = 3;
+ sck = 2;
+ mosi = 9;
+ miso = 11;
+;
+
+programmer
+ id = "picoweb";
+ desc = "Picoweb Programming Cable, http://www.picoweb.net/";
+ type = "par";
+ connection_type = parallel;
+ reset = 2;
+ sck = 3;
+ mosi = 4;
+ miso = 13;
+;
+
+programmer
+ id = "abcmini";
+ desc = "ABCmini Board, aka Dick Smith HOTCHIP";
+ type = "par";
+ connection_type = parallel;
+ reset = 4;
+ sck = 3;
+ mosi = 2;
+ miso = 10;
+;
+
+programmer
+ id = "futurlec";
+ desc = "Futurlec.com programming cable.";
+ type = "par";
+ connection_type = parallel;
+ reset = 3;
+ sck = 2;
+ mosi = 1;
+ miso = 10;
+;
+
+
+# From the contributor of the "xil" jtag cable:
+# The "vcc" definition isn't really vcc (the cable gets its power from
+# the programming circuit) but is necessary to switch one of the
+# buffer lines (trying to add it to the "buff" lines doesn't work in
+# avrdude versions before 5.5j).
+# With this, TMS connects to RESET, TDI to MOSI, TDO to MISO and TCK
+# to SCK (plus vcc/gnd of course)
+programmer
+ id = "xil";
+ desc = "Xilinx JTAG cable";
+ type = "par";
+ connection_type = parallel;
+ mosi = 2;
+ sck = 3;
+ reset = 4;
+ buff = 5;
+ miso = 13;
+ vcc = 6;
+;
+
+
+programmer
+ id = "dapa";
+ desc = "Direct AVR Parallel Access cable";
+ type = "par";
+ connection_type = parallel;
+ vcc = 3;
+ reset = 16;
+ sck = 1;
+ mosi = 2;
+ miso = 11;
+;
+
+programmer
+ id = "atisp";
+ desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from micro-research.co.th";
+ type = "par";
+ connection_type = parallel;
+ reset = ~6;
+ sck = ~8;
+ mosi = ~7;
+ miso = ~10;
+;
+
+programmer
+ id = "ere-isp-avr";
+ desc = "ERE ISP-AVR ";
+ type = "par";
+ connection_type = parallel;
+ reset = ~4;
+ sck = 3;
+ mosi = 2;
+ miso = 10;
+;
+
+programmer
+ id = "blaster";
+ desc = "Altera ByteBlaster";
+ type = "par";
+ connection_type = parallel;
+ sck = 2;
+ miso = 11;
+ reset = 3;
+ mosi = 8;
+ buff = 14;
+;
+
+# It is almost same as pony-stk200, except vcc on pin 5 to auto
+# disconnect port (download on http://electropol.free.fr/spip/spip.php?article27)
+programmer parent "pony-stk200"
+ id = "frank-stk200";
+ desc = "Frank STK200";
+ buff = ; # delete buff pin assignment
+ vcc = 5;
+;
+
+# The AT98ISP Cable is a simple parallel dongle for AT89 family.
+# http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877
+programmer
+ id = "89isp";
+ desc = "Atmel at89isp cable";
+ type = "par";
+ connection_type = parallel;
+ reset = 17;
+ sck = 1;
+ mosi = 2;
+ miso = 10;
+;
+
#This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface
#
@@ -1005,30 +1417,7 @@ programmer
# miso = ?;
#;
-#This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface and direct
-#GPIO memory registers read/write.
-#
-#To enable it set the configuration below to match the GPIO lines connected to the
-#relevant ISP header pins and uncomment the entry definition. In case you don't
-#have the required permissions to edit this system wide config file put the
-#entry in a separate .conf file and use it with -C+.conf
-#on the command line.
-#
-#To check if your avrdude build has support for the arduinotre programmer compiled in,
-#use -c?type on the command line and look for arduinotre in the list. If it's not available
-#you need pass the --enable-arduinotre=yes option to configure and recompile avrdude.
-#
-#programmer
-# id = "arduinotre";
-# desc = "Arduino TRE bitbanging using GPIO registers";
-# type = "arduinotre";
-# reset = ~65;
-# sck = 49;
-# mosi = 48;
-# miso = 61;
-#;
-
-# some ultra cheap programmers use bitbanging on the
+# some ultra cheap programmers use bitbanging on the
# serialport.
#
# PC - DB9 - Pins for RS232:
@@ -4041,28 +4430,236 @@ part
readback_p1 = 0xff;
readback_p2 = 0xff;
read_lo = " 0 0 1 0 0 0 0 0",
- " 0 a14 a13 a12 a11 a10 a9 a8",
+ " 0 a14 a13 a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ read_hi = " 0 0 1 0 1 0 0 0",
+ " 0 a14 a13 a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ loadpage_lo = " 0 1 0 0 0 0 0 0",
+ " 0 0 x x x x x x",
+ " x x a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ loadpage_hi = " 0 1 0 0 1 0 0 0",
+ " 0 0 x x x x x x",
+ " x x a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ writepage = " 0 1 0 0 1 1 0 0",
+ " 0 a14 a13 a12 a11 a10 a9 a8",
+ " a7 a6 x x x x x x",
+ " x x x x x x x x";
+
+ mode = 0x21;
+ delay = 6;
+ blocksize = 256;
+ readsize = 256;
+ ;
+
+ memory "lock"
+ size = 1;
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+ "x x x x x x x x x x o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
+ "x x x x x x x x 1 1 i i i i i i";
+ min_write_delay = 9000;
+ max_write_delay = 9000;
+ ;
+
+ memory "lfuse"
+ size = 1;
+ read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
+ "x x x x x x x x o o o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
+ "x x x x x x x x i i i i i i i i";
+ min_write_delay = 9000;
+ max_write_delay = 9000;
+ ;
+
+ memory "hfuse"
+ size = 1;
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
+ "x x x x x x x x o o o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
+ "x x x x x x x x i i i i i i i i";
+ min_write_delay = 9000;
+ max_write_delay = 9000;
+ ;
+
+ memory "efuse"
+ size = 1;
+
+ read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
+ "x x x x x x x x o o o o o o o o";
+
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
+ "x x x x x x x x 1 1 1 1 1 i i i";
+ min_write_delay = 9000;
+ max_write_delay = 9000;
+ ;
+
+ memory "signature"
+ size = 3;
+ read = "0 0 1 1 0 0 0 0 x x x x x x x x",
+ "x x x x x x a1 a0 o o o o o o o o";
+ ;
+
+ memory "calibration"
+ size = 1;
+
+ read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
+ "0 0 0 0 0 0 0 0 o o o o o o o o";
+ ;
+ ;
+
+
+#------------------------------------------------------------
+# ATmega324PA
+#------------------------------------------------------------
+
+# similar to ATmega324P
+
+part parent "m324p"
+ id = "m324pa";
+ desc = "ATmega324PA";
+ signature = 0x1e 0x95 0x11;
+
+ ocdrev = 3;
+ ;
+
+
+#------------------------------------------------------------
+# ATmega644
+#------------------------------------------------------------
+
+# similar to ATmega164
+
+part
+ id = "m644";
+ desc = "ATmega644";
+ has_jtag = yes;
+ stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one
+ avr910_devcode = 0x74;
+ signature = 0x1e 0x96 0x09;
+ pagel = 0xd7;
+ bs2 = 0xa0;
+ chip_erase_delay = 55000;
+ pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
+ "x x x x x x x x x x x x x x x x";
+
+ chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x",
+ "x x x x x x x x x x x x x x x x";
+
+ timeout = 200;
+ stabdelay = 100;
+ cmdexedelay = 25;
+ synchloops = 32;
+ bytedelay = 0;
+ pollindex = 3;
+ pollvalue = 0x53;
+ predelay = 1;
+ postdelay = 1;
+ pollmethod = 0;
+
+ pp_controlstack =
+ 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+ 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+ 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+ 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02;
+ hventerstabdelay = 100;
+ progmodedelay = 0;
+ latchcycles = 6;
+ togglevtg = 0;
+ poweroffdelay = 0;
+ resetdelayms = 0;
+ resetdelayus = 0;
+ hvleavestabdelay = 15;
+ chiperasepulsewidth = 0;
+ chiperasepolltimeout = 10;
+ programfusepulsewidth = 0;
+ programfusepolltimeout = 5;
+ programlockpulsewidth = 0;
+ programlockpolltimeout = 5;
+
+ idr = 0x31;
+ spmcr = 0x57;
+ allowfullpagebitstream = no;
+
+ ocdrev = 3;
+
+ memory "eeprom"
+ paged = no; /* leave this "no" */
+ page_size = 8; /* for parallel programming */
+ size = 2048;
+ min_write_delay = 9000;
+ max_write_delay = 9000;
+ readback_p1 = 0xff;
+ readback_p2 = 0xff;
+ read = " 1 0 1 0 0 0 0 0",
+ " 0 0 x x a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ write = " 1 1 0 0 0 0 0 0",
+ " 0 0 x x a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ loadpage_lo = " 1 1 0 0 0 0 0 1",
+ " 0 0 0 0 0 0 0 0",
+ " 0 0 0 0 0 a2 a1 a0",
+ " i i i i i i i i";
+
+ writepage = " 1 1 0 0 0 0 1 0",
+ " 0 0 x x a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 0 0 0",
+ " x x x x x x x x";
+
+ mode = 0x41;
+ delay = 10;
+ blocksize = 128;
+ readsize = 256;
+ ;
+
+ memory "flash"
+ paged = yes;
+ size = 65536;
+ page_size = 256;
+ num_pages = 256;
+ min_write_delay = 4500;
+ max_write_delay = 4500;
+ readback_p1 = 0xff;
+ readback_p2 = 0xff;
+ read_lo = " 0 0 1 0 0 0 0 0",
+ "a15 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
read_hi = " 0 0 1 0 1 0 0 0",
- " 0 a14 a13 a12 a11 a10 a9 a8",
+ "a15 a14 a13 a12 a11 a10 a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" o o o o o o o o";
loadpage_lo = " 0 1 0 0 0 0 0 0",
" 0 0 x x x x x x",
- " x x a5 a4 a3 a2 a1 a0",
+ " x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
loadpage_hi = " 0 1 0 0 1 0 0 0",
" 0 0 x x x x x x",
- " x x a5 a4 a3 a2 a1 a0",
+ " x a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
writepage = " 0 1 0 0 1 1 0 0",
- " 0 a14 a13 a12 a11 a10 a9 a8",
- " a7 a6 x x x x x x",
+ "a15 a14 a13 a12 a11 a10 a9 a8",
+ " a7 x x x x x x x",
" x x x x x x x x";
mode = 0x21;
@@ -4130,35 +4727,35 @@ part
;
;
-
#------------------------------------------------------------
-# ATmega324PA
+# ATmega644P
#------------------------------------------------------------
-# similar to ATmega324P
+# similar to ATmega164p
-part parent "m324p"
- id = "m324pa";
- desc = "ATmega324PA";
- signature = 0x1e 0x95 0x11;
+part parent "m644"
+ id = "m644p";
+ desc = "ATmega644P";
+ signature = 0x1e 0x96 0x0a;
ocdrev = 3;
;
+
#------------------------------------------------------------
-# ATmega644
+# ATmega1284
#------------------------------------------------------------
# similar to ATmega164
part
- id = "m644";
- desc = "ATmega644";
+ id = "m1284";
+ desc = "ATmega1284";
has_jtag = yes;
stk500_devcode = 0x82; # no STK500v1 support, use the ATmega16 one
avr910_devcode = 0x74;
- signature = 0x1e 0x96 0x09;
+ signature = 0x1e 0x97 0x06;
pagel = 0xd7;
bs2 = 0xa0;
chip_erase_delay = 55000;
@@ -4177,7 +4774,7 @@ part
pollvalue = 0x53;
predelay = 1;
postdelay = 1;
- pollmethod = 0;
+ pollmethod = 1;
pp_controlstack =
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
@@ -4187,9 +4784,9 @@ part
hventerstabdelay = 100;
progmodedelay = 0;
latchcycles = 6;
- togglevtg = 0;
- poweroffdelay = 0;
- resetdelayms = 0;
+ togglevtg = 1;
+ poweroffdelay = 15;
+ resetdelayms = 1;
resetdelayus = 0;
hvleavestabdelay = 15;
chiperasepulsewidth = 0;
@@ -4208,7 +4805,7 @@ part
memory "eeprom"
paged = no; /* leave this "no" */
page_size = 8; /* for parallel programming */
- size = 2048;
+ size = 4096;
min_write_delay = 9000;
max_write_delay = 9000;
readback_p1 = 0xff;
@@ -4241,9 +4838,9 @@ part
memory "flash"
paged = yes;
- size = 65536;
+ size = 131072;
page_size = 256;
- num_pages = 256;
+ num_pages = 512;
min_write_delay = 4500;
max_write_delay = 4500;
readback_p1 = 0xff;
@@ -4273,8 +4870,8 @@ part
" a7 x x x x x x x",
" x x x x x x x x";
- mode = 0x21;
- delay = 6;
+ mode = 0x41;
+ delay = 10;
blocksize = 256;
readsize = 256;
;
@@ -4338,20 +4935,6 @@ part
;
;
-#------------------------------------------------------------
-# ATmega644P
-#------------------------------------------------------------
-
-# similar to ATmega164p
-
-part parent "m644"
- id = "m644p";
- desc = "ATmega644P";
- signature = 0x1e 0x96 0x0a;
-
- ocdrev = 3;
- ;
-
#------------------------------------------------------------
@@ -5963,6 +6546,13 @@ part
"x x x x x x x x i i i i i i i i";
;
+ # Required for Arduino IDE
+ # see: https://github.com/arduino/Arduino/issues/2075
+ # https://github.com/arduino/Arduino/issues/2075#issuecomment-238031689
+ memory "efuse"
+ size = 0;
+ ;
+
memory "lock"
size = 1;
min_write_delay = 2000;
@@ -6447,7 +7037,7 @@ part
"x x x x x x x x x x x i i i i i";
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x o o o o o";
+ "x x x x x x x x o o o o o o o o";
min_write_delay = 9000;
max_write_delay = 9000;
;
@@ -6638,7 +7228,7 @@ part
"x x x x x x x x x x x x x x x i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x x x o";
+ "x x x x x x x x o o o o o o o o";
min_write_delay = 4500;
max_write_delay = 4500;
;
@@ -6829,7 +7419,7 @@ part
"x x x x x x x x x x x x x x x i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x x x o";
+ "x x x x x x x x o o o o o o o o";
min_write_delay = 4500;
max_write_delay = 4500;
;
@@ -7020,7 +7610,7 @@ part
"x x x x x x x x x x x x x x x i";
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x x x o";
+ "x x x x x x x x o o o o o o o o";
min_write_delay = 4500;
max_write_delay = 4500;
;
@@ -7034,6 +7624,66 @@ part
;
+#------------------------------------------------------------
+# ATtiny28
+#------------------------------------------------------------
+
+# This is an HVPP-only device.
+
+part
+ id = "t28";
+ desc = "ATtiny28";
+ stk500_devcode = 0x22;
+ avr910_devcode = 0x5c;
+ signature = 0x1e 0x91 0x07;
+
+ pp_controlstack =
+ 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
+ 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
+ 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
+ 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
+ hventerstabdelay = 100;
+ progmodedelay = 0;
+ latchcycles = 0;
+ togglevtg = 0;
+ poweroffdelay = 0;
+ resetdelayms = 0;
+ resetdelayus = 0;
+ hvleavestabdelay = 15;
+ resetdelay = 15;
+ chiperasepulsewidth = 0;
+ chiperasepolltimeout = 10;
+ programfusepulsewidth = 0;
+ programfusepolltimeout = 5;
+ programlockpulsewidth = 0;
+ programlockpolltimeout = 5;
+
+ memory "flash"
+ size = 2048;
+ page_size = 2;
+ readsize = 256;
+ delay = 5;
+ ;
+
+ memory "signature"
+ size = 3;
+ ;
+
+ memory "lock"
+ size = 1;
+ ;
+
+ memory "calibration"
+ size = 1;
+ ;
+
+ memory "fuse"
+ size = 1;
+ ;
+;
+
+
+
#------------------------------------------------------------
# ATmega48
#------------------------------------------------------------
@@ -7192,7 +7842,7 @@ part
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x x x o";
+ "x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x x x i";
@@ -7234,6 +7884,18 @@ part parent "m48"
ocdrev = 1;
;
+#------------------------------------------------------------
+# ATmega48PB
+#------------------------------------------------------------
+
+part parent "m48"
+ id = "m48pb";
+ desc = "ATmega48PB";
+ signature = 0x1e 0x92 0x10;
+
+ ocdrev = 1;
+ ;
+
#------------------------------------------------------------
# ATmega88
#------------------------------------------------------------
@@ -7392,7 +8054,7 @@ part
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x o o o";
+ "x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x i i i";
@@ -7434,6 +8096,18 @@ part parent "m88"
ocdrev = 1;
;
+#------------------------------------------------------------
+# ATmega88PB
+#------------------------------------------------------------
+
+part parent "m88"
+ id = "m88pb";
+ desc = "ATmega88PB";
+ signature = 0x1e 0x93 0x16;
+
+ ocdrev = 1;
+ ;
+
#------------------------------------------------------------
# ATmega168
#------------------------------------------------------------
@@ -7594,7 +8268,7 @@ part
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x o o o";
+ "x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x i i i";
@@ -7636,6 +8310,18 @@ part parent "m168"
ocdrev = 1;
;
+#------------------------------------------------------------
+# ATmega168PB
+#------------------------------------------------------------
+
+part parent "m168"
+ id = "m168pb";
+ desc = "ATmega168PB";
+ signature = 0x1e 0x94 0x15;
+
+ ocdrev = 1;
+;
+
#------------------------------------------------------------
# ATtiny88
#------------------------------------------------------------
@@ -7794,7 +8480,7 @@ part
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x o o o";
+ "x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x x x i";
@@ -7984,7 +8670,7 @@ part
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x x x o o o";
+ "x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x x x i i i";
@@ -8022,6 +8708,26 @@ part parent "m328"
ocdrev = 1;
;
+#------------------------------------------------------------
+# ATmega32m1
+#------------------------------------------------------------
+
+part parent "m328"
+ id = "m32m1";
+ desc = "ATmega32M1";
+ # stk500_devcode = 0x;
+ # avr910_devcode = 0x;
+ signature = 0x1e 0x95 0x84;
+ bs2 = 0xe2;
+
+ memory "efuse"
+ read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
+ "x x x x x x x x o o o o o o o o";
+ write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
+ "x x x x x x x x x x i i i i i i";
+ ;
+;
+
#------------------------------------------------------------
# ATtiny2313
#------------------------------------------------------------
@@ -8668,6 +9374,16 @@ part parent "pwm3b"
;
;
+#------------------------------------------------------------
+# AT90PWM216
+#------------------------------------------------------------
+# Completely identical to AT90PWM316 (including the signature!)
+
+part parent "pwm316"
+ id = "pwm216";
+ desc = "AT90PWM216";
+ ;
+
#------------------------------------------------------------
# ATtiny25
#------------------------------------------------------------
@@ -8806,6 +9522,8 @@ part
size = 1;
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+ "0 0 0 0 0 0 0 0 o o o o o o o o";
min_write_delay = 9000;
max_write_delay = 9000;
;
@@ -8844,7 +9562,7 @@ part
;
memory "calibration"
- size = 2;
+ size = 1;
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
"0 0 0 0 0 0 0 a0 o o o o o o o o";
;
@@ -8987,6 +9705,8 @@ part
size = 1;
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+ "0 0 0 0 0 0 0 0 o o o o o o o o";
min_write_delay = 9000;
max_write_delay = 9000;
;
@@ -9025,7 +9745,7 @@ part
;
memory "calibration"
- size = 2;
+ size = 1;
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
"0 0 0 0 0 0 0 a0 o o o o o o o o";
;
@@ -9169,6 +9889,8 @@ part
size = 1;
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
+ read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
+ "0 0 0 0 0 0 0 0 o o o o o o o o";
min_write_delay = 9000;
max_write_delay = 9000;
;
@@ -9207,7 +9929,7 @@ part
;
memory "calibration"
- size = 2;
+ size = 1;
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
"0 0 0 0 0 0 0 a0 o o o o o o o o";
;
@@ -9616,7 +10338,7 @@ part
desc = "ATmega2560";
signature = 0x1e 0x98 0x01;
has_jtag = yes;
-# stk500_devcode = 0xB2;
+ stk500_devcode = 0xB2;
# avr910_devcode = 0x43;
chip_erase_delay = 9000;
pagel = 0xD7;
@@ -9877,9 +10599,43 @@ part parent "m2561"
id = "m256rfr2";
desc = "ATmega256RFR2";
signature = 0x1e 0xa8 0x02;
- chip_erase_delay = 55000;
+ chip_erase_delay = 18500;
bs2 = 0xE2;
+ memory "eeprom"
+ paged = no; /* leave this "no" */
+ page_size = 8; /* for parallel programming */
+ size = 8192;
+ min_write_delay = 13000;
+ max_write_delay = 13000;
+ readback_p1 = 0x00;
+ readback_p2 = 0x00;
+ read = " 1 0 1 0 0 0 0 0",
+ " x x x a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ write = " 1 1 0 0 0 0 0 0",
+ " x x x a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ loadpage_lo = " 1 1 0 0 0 0 0 1",
+ " 0 0 0 0 0 0 0 0",
+ " 0 0 0 0 0 a2 a1 a0",
+ " i i i i i i i i";
+
+ writepage = " 1 1 0 0 0 0 1 0",
+ " 0 0 x a12 a11 a10 a9 a8",
+ " a7 a6 a5 a4 a3 0 0 0",
+ " x x x x x x x x";
+
+ mode = 0x41;
+ delay = 10;
+ blocksize = 8;
+ readsize = 256;
+ ;
+
ocdrev = 4;
;
@@ -9948,6 +10704,42 @@ part parent "m128rfa1"
blocksize = 256;
readsize = 256;
;
+
+ memory "eeprom"
+ paged = no; /* leave this "no" */
+ page_size = 8; /* for parallel programming */
+ size = 2048;
+ min_write_delay = 13000;
+ max_write_delay = 13000;
+ readback_p1 = 0x00;
+ readback_p2 = 0x00;
+ read = " 1 0 1 0 0 0 0 0",
+ " x x x x x a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " o o o o o o o o";
+
+ write = " 1 1 0 0 0 0 0 0",
+ " x x x x x a10 a9 a8",
+ " a7 a6 a5 a4 a3 a2 a1 a0",
+ " i i i i i i i i";
+
+ loadpage_lo = " 1 1 0 0 0 0 0 1",
+ " 0 0 0 0 0 0 0 0",
+ " 0 0 0 0 0 a2 a1 a0",
+ " i i i i i i i i";
+
+ writepage = " 1 1 0 0 0 0 1 0",
+ " 0 0 x x x a10 a9 a8",
+ " a7 a6 a5 a4 a3 0 0 0",
+ " x x x x x x x x";
+
+ mode = 0x41;
+ delay = 10;
+ blocksize = 8;
+ readsize = 256;
+ ;
+
+
;
#------------------------------------------------------------
@@ -10720,6 +11512,7 @@ part
id = "m32u4";
desc = "ATmega32U4";
signature = 0x1e 0x95 0x87;
+ usbpid = 0x2ff4;
has_jtag = yes;
# stk500_devcode = 0xB2;
# avr910_devcode = 0x43;
@@ -10910,6 +11703,7 @@ part
id = "usb646";
desc = "AT90USB646";
signature = 0x1e 0x96 0x82;
+ usbpid = 0x2ff9;
has_jtag = yes;
# stk500_devcode = 0xB2;
# avr910_devcode = 0x43;
@@ -11113,6 +11907,7 @@ part
id = "usb1286";
desc = "AT90USB1286";
signature = 0x1e 0x97 0x82;
+ usbpid = 0x2ffb;
has_jtag = yes;
# stk500_devcode = 0xB2;
# avr910_devcode = 0x43;
@@ -11318,6 +12113,7 @@ part
has_jtag = no;
has_debugwire = yes;
signature = 0x1e 0x94 0x82;
+ usbpid = 0x2ffa;
chip_erase_delay = 9000;
reset = io;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
@@ -11504,6 +12300,7 @@ part
has_jtag = no;
has_debugwire = yes;
signature = 0x1e 0x93 0x82;
+ usbpid = 0x2ff7;
chip_erase_delay = 9000;
reset = io;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
@@ -11692,6 +12489,7 @@ part
has_jtag = no;
has_debugwire = yes;
signature = 0x1e 0x95 0x8a;
+ usbpid = 0x2ff0;
chip_erase_delay = 9000;
reset = io;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
@@ -11879,6 +12677,7 @@ part
has_jtag = no;
has_debugwire = yes;
signature = 0x1e 0x94 0x89;
+ usbpid = 0x2fef;
chip_erase_delay = 9000;
reset = io;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
@@ -12066,6 +12865,7 @@ part
has_jtag = no;
has_debugwire = yes;
signature = 0x1e 0x93 0x89;
+ usbpid = 0x2fee;
chip_erase_delay = 9000;
reset = io;
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
@@ -12145,8 +12945,8 @@ part
memory "flash"
paged = yes;
size = 8192;
- page_size = 64;
- num_pages = 128;
+ page_size = 128;
+ num_pages = 64;
min_write_delay = 4500;
max_write_delay = 4500;
readback_p1 = 0x00;
@@ -12178,7 +12978,7 @@ part
mode = 0x41;
delay = 6;
- blocksize = 64;
+ blocksize = 128;
readsize = 256;
;
@@ -12705,6 +13505,7 @@ part parent ".xmega"
id = "x16a4u";
desc = "ATxmega16A4U";
signature = 0x1e 0x94 0x41;
+ usbpid = 0x2fe3;
memory "eeprom"
size = 0x400;
@@ -12793,6 +13594,7 @@ part parent ".xmega"
id = "x32a4u";
desc = "ATxmega32A4U";
signature = 0x1e 0x95 0x41;
+ usbpid = 0x2fe4;
memory "eeprom"
size = 0x400;
@@ -12881,6 +13683,7 @@ part parent ".xmega"
id = "x64a4u";
desc = "ATxmega64A4U";
signature = 0x1e 0x96 0x46;
+ usbpid = 0x2fe5;
memory "eeprom"
size = 0x800;
@@ -12933,6 +13736,7 @@ part parent "x64a4u"
id = "x64c3";
desc = "ATxmega64C3";
signature = 0x1e 0x96 0x49;
+ usbpid = 0x2fd6;
;
#------------------------------------------------------------
@@ -12979,6 +13783,7 @@ part parent "x64a1"
id = "x64a1u";
desc = "ATxmega64A1U";
signature = 0x1e 0x96 0x4e;
+ usbpid = 0x2fe8;
;
#------------------------------------------------------------
@@ -12999,6 +13804,7 @@ part parent "x64a1"
id = "x64a3u";
desc = "ATxmega64A3U";
signature = 0x1e 0x96 0x42;
+ usbpid = 0x2fe5;
;
#------------------------------------------------------------
@@ -13019,6 +13825,7 @@ part parent "x64a1"
id = "x64b1";
desc = "ATxmega64B1";
signature = 0x1e 0x96 0x52;
+ usbpid = 0x2fe1;
;
#------------------------------------------------------------
@@ -13029,6 +13836,7 @@ part parent "x64a1"
id = "x64b3";
desc = "ATxmega64B3";
signature = 0x1e 0x96 0x51;
+ usbpid = 0x2fdf;
;
#------------------------------------------------------------
@@ -13039,6 +13847,7 @@ part parent ".xmega"
id = "x128c3";
desc = "ATxmega128C3";
signature = 0x1e 0x97 0x52;
+ usbpid = 0x2fd7;
memory "eeprom"
size = 0x800;
@@ -13137,6 +13946,7 @@ part parent "x128a1"
id = "x128a1u";
desc = "ATxmega128A1U";
signature = 0x1e 0x97 0x4c;
+ usbpid = 0x2fed;
;
#------------------------------------------------------------
@@ -13157,6 +13967,7 @@ part parent "x128a1"
id = "x128a3u";
desc = "ATxmega128A3U";
signature = 0x1e 0x97 0x42;
+ usbpid = 0x2fe6;
;
#------------------------------------------------------------
@@ -13225,6 +14036,7 @@ part parent ".xmega"
id = "x128a4u";
desc = "ATxmega128A4U";
signature = 0x1e 0x97 0x46;
+ usbpid = 0x2fde;
memory "eeprom"
size = 0x800;
@@ -13277,6 +14089,7 @@ part parent ".xmega"
id = "x128b1";
desc = "ATxmega128B1";
signature = 0x1e 0x97 0x4d;
+ usbpid = 0x2fea;
has_jtag = yes;
memory "eeprom"
@@ -13335,6 +14148,7 @@ part parent "x128b1"
id = "x128b3";
desc = "ATxmega128B3";
signature = 0x1e 0x97 0x4b;
+ usbpid = 0x2fe0;
;
#------------------------------------------------------------
@@ -13345,6 +14159,7 @@ part parent ".xmega"
id = "x192c3";
desc = "ATxmega192C3";
signature = 0x1e 0x97 0x51;
+ # usbpid = 0x2f??;
memory "eeprom"
size = 0x800;
@@ -13433,6 +14248,7 @@ part parent "x192a1"
id = "x192a3u";
desc = "ATxmega192A3U";
signature = 0x1e 0x97 0x44;
+ usbpid = 0x2fe7;
;
#------------------------------------------------------------
@@ -13443,6 +14259,7 @@ part parent ".xmega"
id = "x256c3";
desc = "ATxmega256C3";
signature = 0x1e 0x98 0x46;
+ usbpid = 0x2fda;
memory "eeprom"
size = 0x1000;
@@ -13531,6 +14348,7 @@ part parent "x256a1"
id = "x256a3u";
desc = "ATxmega256A3U";
signature = 0x1e 0x98 0x42;
+ usbpid = 0x2fec;
;
#------------------------------------------------------------
@@ -13551,6 +14369,7 @@ part parent "x256a1"
id = "x256a3bu";
desc = "ATxmega256A3BU";
signature = 0x1e 0x98 0x43;
+ usbpid = 0x2fe2;
;
#------------------------------------------------------------
@@ -13561,6 +14380,7 @@ part parent ".xmega"
id = "x384c3";
desc = "ATxmega384C3";
signature = 0x1e 0x98 0x45;
+ usbpid = 0x2fdb;
memory "eeprom"
size = 0x1000;
@@ -13647,7 +14467,7 @@ part parent ".xmega"
memory "boot"
size = 0x800;
- offset = 0x00804000;
+ offset = 0x00802000;
page_size = 0x80;
readsize = 0x100;
;
@@ -13751,7 +14571,7 @@ part parent ".xmega"
memory "boot"
size = 0x1000;
- offset = 0x00804000;
+ offset = 0x00808000;
page_size = 0x80;
readsize = 0x100;
;
@@ -13956,7 +14776,7 @@ part
min_write_delay = 4500;
max_write_delay = 4500;
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
- "x x x x x x x x x x x o o o o o";
+ "x x x x x x x x o o o o o o o o";
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
"x x x x x x x x x x x i i i i i";
diff --git a/sparkfun/avr/boards.txt b/sparkfun/avr/boards.txt
index e870abde..aaef557c 100644
--- a/sparkfun/avr/boards.txt
+++ b/sparkfun/avr/boards.txt
@@ -380,3 +380,29 @@ LilyPadProtoUSB.build.board=AVR_LILYPAD_ARDUINO_USB_PLUS_BOARD
LilyPadProtoUSB.build.core=arduino:arduino
LilyPadProtoUSB.build.variant=lilypadusbplus
LilyPadProtoUSB.build.extra_flags={build.usb_flags}
+
+
+################################################################################
+################################### SerLCD #####################################
+################################################################################
+SerLCD.name=SparkFun SerLCD
+
+SerLCD.upload.tool=avrdude
+SerLCD.upload.protocol=arduino
+SerLCD.upload.maximum_size=32256
+SerLCD.upload.maximum_data_size=2048
+SerLCD.upload.speed=115200
+
+SerLCD.bootloader.tool=avrdude
+SerLCD.bootloader.low_fuses=0xFF
+SerLCD.bootloader.high_fuses=0xDE
+SerLCD.bootloader.extended_fuses=0xFD
+SerLCD.bootloader.unlock_bits=0x3F
+SerLCD.bootloader.lock_bits=0x0F
+SerLCD.bootloader.file=optiboot/optiboot_SerLCD.hex
+
+SerLCD.build.mcu=atmega328p
+SerLCD.build.f_cpu=11059200L
+SerLCD.build.board=AVR_UNO
+SerLCD.build.core=arduino:arduino
+SerLCD.build.variant=arduino:standard
diff --git a/sparkfun/avr/bootloaders/optiboot/Makefile b/sparkfun/avr/bootloaders/optiboot/Makefile
index f2e99ac9..14ea68df 100644
--- a/sparkfun/avr/bootloaders/optiboot/Makefile
+++ b/sparkfun/avr/bootloaders/optiboot/Makefile
@@ -24,10 +24,10 @@ PROGRAM = optiboot
# Arduino user IDE setup, or the Arduino source tree.
# Uncomment this next lines to build within the arduino environment,
# using the arduino-included avrgcc toolset (mac and pc)
-# ENV ?= arduino
+ENV ?= arduino
# ENV ?= arduinodev
# OS ?= macosx
-# OS ?= windows
+OS ?= windows
# enter the parameters for the avrdude isp tool
@@ -53,6 +53,7 @@ ifeq ($(ENV), arduino)
TOOLROOT = ../../../tools
GCCROOT = $(TOOLROOT)/avr/bin/
AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
+endif
ifeq ($(OS), windows)
# On windows, SOME of the tool paths will need to have backslashes instead
@@ -63,7 +64,7 @@ fixpath = $(subst /,\,$1)
SHELL = cmd.exe
endif
-else ifeq ($(ENV), arduinodev)
+ifeq ($(ENV), arduinodev)
# Arduino IDE source code environment. Use the unpacked compilers created
# by the build (you'll need to do "ant build" first.)
ifeq ($(OS), macosx)
diff --git a/sparkfun/avr/bootloaders/optiboot/optiboot_SerLCD.hex b/sparkfun/avr/bootloaders/optiboot/optiboot_SerLCD.hex
new file mode 100644
index 00000000..6cac620c
--- /dev/null
+++ b/sparkfun/avr/bootloaders/optiboot/optiboot_SerLCD.hex
@@ -0,0 +1,35 @@
+:107E0000112484B714BE81FFF0D085E080938100F7
+:107E100082E08093C00088E18093C10086E0809377
+:107E2000C2008BE08093C4008EE0C9D0259A86E022
+:107E30002DE53DEF91E0309385002093840096BBC3
+:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4
+:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7
+:107E6000A2D0813461F49FD0082FAFD0023811F036
+:107E7000013811F484E001C083E08DD089C08234E0
+:107E800011F484E103C0853419F485E0A6D080C0E4
+:107E9000853579F488D0E82EFF2485D0082F10E0AE
+:107EA000102F00270E291F29000F111F8ED06801E7
+:107EB0006FC0863521F484E090D080E0DECF843638
+:107EC00009F040C070D06FD0082F6DD080E0C81688
+:107ED00080E7D80618F4F601B7BEE895C0E0D1E017
+:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8
+:107EF00018F0F601B7BEE89568D007B600FCFDCFD4
+:107F0000A601A0E0B1E02C9130E011968C91119780
+:107F100090E0982F8827822B932B1296FA010C0160
+:107F200087BEE89511244E5F5F4FF1E0A038BF0790
+:107F300051F7F601A7BEE89507B600FCFDCF97BE46
+:107F4000E89526C08437B1F42ED02DD0F82E2BD052
+:107F50003CD0F601EF2C8F010F5F1F4F84911BD097
+:107F6000EA94F801C1F70894C11CD11CFA94CF0C13
+:107F7000D11C0EC0853739F428D08EE10CD085E9AC
+:107F80000AD08FE07ACF813511F488E018D01DD067
+:107F900080E101D065CF982F8091C00085FFFCCF94
+:107FA0009093C60008958091C00087FFFCCF809118
+:107FB000C00084FD01C0A8958091C6000895E0E648
+:107FC000F0E098E1908380830895EDDF803219F02E
+:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA
+:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6
+:047FF000FF270994CA
+:027FFE00040479
+:0400000300007E007B
+:00000001FF
diff --git a/sparkfun/avr/libraries/Qduino/Qduino.cpp b/sparkfun/avr/libraries/Qduino/Qduino.cpp
index 2e2c1f4c..3573ff56 100755
--- a/sparkfun/avr/libraries/Qduino/Qduino.cpp
+++ b/sparkfun/avr/libraries/Qduino/Qduino.cpp
@@ -7,7 +7,7 @@
* mattnewberry@me.com *
* *
***************************************************************************
- * *
+ * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU License. *
* This program is distributed in the hope that it will be useful, *
@@ -22,7 +22,7 @@
#include "Wire.h"
void qduino::setup(){
-
+
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode(11, OUTPUT);
@@ -32,21 +32,21 @@ void qduino::setup(){
}
void qduino::setRGB(uint8_t r, uint8_t g, uint8_t b){
-
+
// ratio for R:G:B is 4:7:7 for forward voltage
-
+
r = 255 - r; // set all values to opposite values
g = 255 - g; // because LED is common anode
b = 255 - b;
-
+
int newr = map(r, 0, 255, 0, 146);
-
+
analogWrite(10, newr);
analogWrite(11, g);
analogWrite(13, b);
}
-void qduino::setRGB(COLORS color){
+void qduino::setRGB(COLORS color){
switch (color) {
case RED:
analogWrite(10, 0);
@@ -97,31 +97,31 @@ void qduino::setRGB(COLORS color){
}
void qduino::rainbow(uint8_t duration)
-{
+{
uint8_t rgbColor[3];
// Keep values for duration bounded
if (duration < 1) duration = 1;
if (duration > 5) duration = 5;
-
+
int newDuration = map(duration, 1, 5, 500, 3000);
-
+
// Start off with red.
rgbColor[0] = 255;
rgbColor[1] = 0;
- rgbColor[2] = 0;
-
+ rgbColor[2] = 0;
+
// Choose the colours to increment and decrement.
for (uint8_t decColor = 0; decColor < 3; decColor += 1)
{
int incColor = decColor == 2 ? 0 : decColor + 1;
-
+
// cross-fade the two colours.
for(uint8_t i = 0; i < 255; i += 1)
{
rgbColor[decColor] -= 1;
rgbColor[incColor] += 1;
-
+
analogWrite(10, rgbColor[0]);
analogWrite(11, rgbColor[1]);
analogWrite(13, rgbColor[2]);
@@ -131,7 +131,7 @@ void qduino::rainbow(uint8_t duration)
}
void qduino::ledOff()
-{
+{
analogWrite(10, 255);
analogWrite(11, 255);
analogWrite(13, 255);
@@ -167,7 +167,7 @@ char fuelGauge::getVersion()
byte msb = 0;
byte lsb = 0;
readFrom(MAX1704_VERSION, msb, lsb);
-
+
value = 0xFF00 & (msb<<8);
value |= 0xFF & lsb;
@@ -211,7 +211,7 @@ boolean fuelGauge::inSleep()
byte lsb = 0;
readFrom(MAX1704_CONFIG,msb,lsb);
- byte sleep = (lsb >>7) & 0x01;
+ byte sleep = (lsb >>7) & 0x01;
return int(sleep) == 1;
}
@@ -256,7 +256,7 @@ void fuelGauge::wakeUp()
Wire.endTransmission();
// This delay is here to ensure it's fully awake before moving on
- delay(150);
+ delay(150);
}
void fuelGauge::performCommand(byte address, int value)
@@ -281,6 +281,5 @@ void fuelGauge::readFrom(byte address, byte &msb, byte &lsb)
msb = Wire.read();
lsb = Wire.read();
}
- Wire.endTransmission();
+ //Wire.endTransmission();
}
-
diff --git a/sparkfun/avr/platform.txt b/sparkfun/avr/platform.txt
index 0a282020..b42b6a77 100644
--- a/sparkfun/avr/platform.txt
+++ b/sparkfun/avr/platform.txt
@@ -5,7 +5,7 @@
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
-name=Arduino AVR Boards
+name=SparkFun AVR Boards
version=1.6.19
# AVR compile variables
diff --git a/sparkfun/esp8266/LICENSE b/sparkfun/esp8266/LICENSE
deleted file mode 100644
index 2efec221..00000000
--- a/sparkfun/esp8266/LICENSE
+++ /dev/null
@@ -1,11 +0,0 @@
-### License and credits
-
-Arduino IDE is based on Wiring and Processing. It is developed and maintained by the Arduino team. The IDE is licensed under GPL, and the core libraries are licensed under LGPL.
-
-This build includes an xtensa gcc toolchain, which is also under GPL.
-
-Espressif SDK included in this build is under Espressif Public License.
-
-Esptool written by Christian Klippel is licensed under GPLv2, currently maintained by Ivan Grokhotkov: https://github.com/igrr/esptool-ck.
-
-ESP8266 core support, ESP8266WiFi, Ticker, ESP8266WebServer libraries were written by Ivan Grokhotkov, ivan@esp8266.com.
\ No newline at end of file
diff --git a/sparkfun/esp8266/boards.txt b/sparkfun/esp8266/boards.txt
deleted file mode 100644
index ae65474d..00000000
--- a/sparkfun/esp8266/boards.txt
+++ /dev/null
@@ -1,279 +0,0 @@
-menu.UploadSpeed=Upload Speed
-menu.CpuFrequency=CPU Frequency
-menu.FlashSize=Flash Size
-menu.FlashFreq=Flash Frequency
-
-##############################################################
-generic.name=Generic ESP8266 Module
-
-generic.upload.tool=esptool
-generic.upload.speed=115200
-generic.upload.resetmethod=ck
-generic.upload.maximum_size=524288
-generic.upload.wait_for_upload_port=true
-generic.serial.disableDTR=true
-generic.serial.disableRTS=true
-
-generic.build.mcu=esp8266
-generic.build.f_cpu=80000000L
-generic.build.board=ESP8266_ESP01
-generic.build.core=esp8266
-generic.build.variant=generic
-generic.build.flash_mode=qio
-generic.build.flash_size=512K
-generic.build.flash_freq=40
-generic.build.flash_ld=eagle.flash.512k.ld
-generic.build.spiffs_start=0x6B000
-generic.build.spiffs_end=0x7B000
-
-generic.menu.CpuFrequency.80=80 MHz
-generic.menu.CpuFrequency.80.build.f_cpu=80000000L
-generic.menu.CpuFrequency.160=160 MHz
-generic.menu.CpuFrequency.160.build.f_cpu=160000000L
-
-generic.menu.UploadSpeed.115200=115200
-generic.menu.UploadSpeed.115200.upload.speed=115200
-generic.menu.UploadSpeed.9600=9600
-generic.menu.UploadSpeed.9600.upload.speed=9600
-generic.menu.UploadSpeed.57600=57600
-generic.menu.UploadSpeed.57600.upload.speed=57600
-generic.menu.UploadSpeed.256000.windows=256000
-generic.menu.UploadSpeed.256000.upload.speed=256000
-generic.menu.UploadSpeed.230400.linux=230400
-generic.menu.UploadSpeed.230400.macosx=230400
-generic.menu.UploadSpeed.230400.upload.speed=230400
-generic.menu.UploadSpeed.460800.linux=460800
-generic.menu.UploadSpeed.460800.macosx=460800
-generic.menu.UploadSpeed.460800.upload.speed=460800
-generic.menu.UploadSpeed.512000.windows=512000
-generic.menu.UploadSpeed.512000.upload.speed=512000
-generic.menu.UploadSpeed.921600=921600
-generic.menu.UploadSpeed.921600.upload.speed=921600
-
-generic.menu.FlashSize.512K=512K (64K SPIFFS)
-generic.menu.FlashSize.512K.build.flash_size=512K
-generic.menu.FlashSize.512K.build.flash_ld=eagle.flash.512k.ld
-generic.menu.FlashSize.512K.build.spiffs_start=0x6B000
-generic.menu.FlashSize.512K.build.spiffs_end=0x7B000
-generic.menu.FlashSize.1M512=1M (512K SPIFFS)
-generic.menu.FlashSize.1M512.build.flash_size=1M
-generic.menu.FlashSize.1M512.build.flash_ld=eagle.flash.1m512.ld
-generic.menu.FlashSize.1M512.build.spiffs_start=0x6B000
-generic.menu.FlashSize.1M512.build.spiffs_end=0xFB000
-generic.menu.FlashSize.1M256=1M (256K SPIFFS)
-generic.menu.FlashSize.1M256.build.flash_size=1M
-generic.menu.FlashSize.1M256.build.flash_ld=eagle.flash.1m256.ld
-generic.menu.FlashSize.1M256.build.spiffs_start=0xAB000
-generic.menu.FlashSize.1M256.build.spiffs_end=0xFB000
-generic.menu.FlashSize.1M128=1M (128K SPIFFS)
-generic.menu.FlashSize.1M128.build.flash_size=1M
-generic.menu.FlashSize.1M128.build.flash_ld=eagle.flash.1m128.ld
-generic.menu.FlashSize.1M128.build.spiffs_start=0xCB000
-generic.menu.FlashSize.1M128.build.spiffs_end=0xFB000
-generic.menu.FlashSize.1M64=1M (64K SPIFFS)
-generic.menu.FlashSize.1M64.build.flash_size=1M
-generic.menu.FlashSize.1M64.build.flash_ld=eagle.flash.1m64.ld
-generic.menu.FlashSize.1M64.build.spiffs_start=0xEB000
-generic.menu.FlashSize.1M64.build.spiffs_end=0xFB000
-generic.menu.FlashSize.2M=2M (1M SPIFFS)
-generic.menu.FlashSize.2M.build.flash_size=2M
-generic.menu.FlashSize.2M.build.flash_ld=eagle.flash.2m.ld
-generic.menu.FlashSize.2M.build.spiffs_start=0x100000
-generic.menu.FlashSize.2M.build.spiffs_end=0x1FB000
-generic.menu.FlashSize.4M=4M (3M SPIFFS)
-generic.menu.FlashSize.4M.build.flash_size=4M
-generic.menu.FlashSize.4M.build.flash_ld=eagle.flash.4m.ld
-generic.menu.FlashSize.4M.build.spiffs_start=0x100000
-generic.menu.FlashSize.4M.build.spiffs_end=0x3FB000
-generic.menu.FlashSize.8M=8M (7M SPIFFS)
-generic.menu.FlashSize.8M.build.flash_size=1M
-generic.menu.FlashSize.8M.build.flash_ld=eagle.flash.8m.ld
-generic.menu.FlashSize.8M.build.spiffs_start=0x100000
-generic.menu.FlashSize.8M.build.spiffs_end=0x800000
-generic.menu.FlashSize.16M=16M (15M SPIFFS)
-generic.menu.FlashSize.16M.build.flash_size=1M
-generic.menu.FlashSize.16M.build.flash_ld=eagle.flash.16m.ld
-generic.menu.FlashSize.16M.build.spiffs_start=0x100000
-generic.menu.FlashSize.16M.build.spiffs_end=0x1000000
-
-# generic.menu.FlashFreq.40=40MHz
-# generic.menu.FlashFreq.40.build.flash_freq=40
-# generic.menu.FlashFreq.80=80MHz
-# generic.menu.FlashFreq.80.build.flash_freq=80
-
-##############################################################
-thing.name=SparkFun ESP8266 Thing
-
-thing.upload.tool=esptool
-thing.upload.speed=921600
-thing.upload.resetmethod=ck
-thing.upload.maximum_size=524288
-thing.upload.wait_for_upload_port=true
-thing.serial.disableDTR=true
-thing.serial.disableRTS=true
-
-thing.build.mcu=esp8266
-thing.build.f_cpu=80000000L
-thing.build.board=ESP8266_ESP01
-thing.build.core=esp8266
-thing.build.variant=thing
-thing.build.flash_mode=qio
-thing.build.flash_size=4M
-thing.build.flash_freq=40
-thing.build.flash_ld=eagle.flash.4m.ld
-thing.build.spiffs_start=0x100000
-thing.build.spiffs_end=0x3FB000
-
-thing.menu.CpuFrequency.80=80 MHz
-thing.menu.CpuFrequency.80.build.f_cpu=80000000L
-
-thing.menu.UploadSpeed.115200=115200
-thing.menu.UploadSpeed.115200.upload.speed=115200
-thing.menu.UploadSpeed.9600=9600
-thing.menu.UploadSpeed.9600.upload.speed=9600
-thing.menu.UploadSpeed.57600=57600
-thing.menu.UploadSpeed.57600.upload.speed=57600
-thing.menu.UploadSpeed.256000.windows=256000
-thing.menu.UploadSpeed.256000.upload.speed=256000
-thing.menu.UploadSpeed.230400.linux=230400
-thing.menu.UploadSpeed.230400.macosx=230400
-thing.menu.UploadSpeed.230400.upload.speed=230400
-thing.menu.UploadSpeed.460800.linux=460800
-thing.menu.UploadSpeed.460800.macosx=460800
-thing.menu.UploadSpeed.460800.upload.speed=460800
-thing.menu.UploadSpeed.512000.windows=512000
-thing.menu.UploadSpeed.512000.upload.speed=512000
-thing.menu.UploadSpeed.921600=921600
-thing.menu.UploadSpeed.921600.upload.speed=921600
-
-thing.menu.FlashSize.4M=4M (3M SPIFFS)
-thing.menu.FlashSize.4M.build.flash_size=4M
-thing.menu.FlashSize.4M.build.flash_ld=eagle.flash.4m.ld
-thing.menu.FlashSize.4M.build.spiffs_start=0x100000
-thing.menu.FlashSize.4M.build.spiffs_end=0x3FB000
-
-##############################################################
-modwifi.name=Olimex MOD-WIFI-ESP8266(-DEV)
-
-modwifi.upload.tool=esptool
-modwifi.upload.speed=115200
-modwifi.upload.resetmethod=ck
-modwifi.upload.maximum_size=2097152
-modwifi.upload.wait_for_upload_port=true
-modwifi.serial.disableDTR=true
-modwifi.serial.disableRTS=true
-
-modwifi.build.mcu=esp8266
-modwifi.build.f_cpu=80000000L
-modwifi.build.board=MOD_WIFI_ESP8266
-modwifi.build.core=esp8266
-modwifi.build.variant=generic
-# Winbond W25Q16 flash
-modwifi.build.flash_mode=qio
-modwifi.build.flash_size=2M
-modwifi.build.flash_freq=40
-modwifi.build.flash_ld=eagle.flash.2m.ld
-modwifi.build.spiffs_start=0x100000
-modwifi.build.spiffs_end=0x1FB000
-
-modwifi.menu.CpuFrequency.80=80 MHz
-modwifi.menu.CpuFrequency.80.build.f_cpu=80000000L
-modwifi.menu.CpuFrequency.160=160 MHz
-modwifi.menu.CpuFrequency.160.build.f_cpu=160000000L
-
-modwifi.menu.UploadSpeed.115200=115200
-modwifi.menu.UploadSpeed.115200.upload.speed=115200
-modwifi.menu.UploadSpeed.9600=9600
-modwifi.menu.UploadSpeed.9600.upload.speed=9600
-modwifi.menu.UploadSpeed.57600=57600
-modwifi.menu.UploadSpeed.57600.upload.speed=57600
-modwifi.menu.UploadSpeed.256000.windows=256000
-modwifi.menu.UploadSpeed.256000.upload.speed=256000
-modwifi.menu.UploadSpeed.230400.linux=230400
-modwifi.menu.UploadSpeed.230400.macosx=230400
-modwifi.menu.UploadSpeed.230400.macosx=230400
-modwifi.menu.UploadSpeed.230400.upload.speed=230400
-modwifi.menu.UploadSpeed.460800.linux=460800
-modwifi.menu.UploadSpeed.460800.macosx=460800
-modwifi.menu.UploadSpeed.460800.upload.speed=460800
-modwifi.menu.UploadSpeed.512000.windows=512000
-modwifi.menu.UploadSpeed.512000.upload.speed=512000
-modwifi.menu.UploadSpeed.921600=921600
-modwifi.menu.UploadSpeed.921600.upload.speed=921600
-
-##############################################################
-nodemcu.name=NodeMCU (ESP8266 ESP-12 Module)
-
-nodemcu.upload.tool=esptool
-nodemcu.upload.speed=115200
-nodemcu.upload.resetmethod=ck
-nodemcu.upload.maximum_size=4194304
-nodemcu.upload.wait_for_upload_port=true
-nodemcu.serial.disableDTR=true
-nodemcu.serial.disableRTS=true
-
-nodemcu.build.mcu=esp8266
-nodemcu.build.f_cpu=80000000L
-nodemcu.build.board=ESP8266_ESP12
-nodemcu.build.core=esp8266
-nodemcu.build.variant=nodemcu
-nodemcu.build.flash_mode=qio
-nodemcu.build.flash_size=4M
-nodemcu.build.flash_freq=40
-nodemcu.build.flash_ld=eagle.flash.4m.ld
-nodemcu.build.spiffs_start=0x100000
-nodemcu.build.spiffs_end=0x3FB000
-
-nodemcu.menu.CpuFrequency.80=80 MHz
-nodemcu.menu.CpuFrequency.80.build.f_cpu=80000000L
-nodemcu.menu.CpuFrequency.160=160 MHz
-nodemcu.menu.CpuFrequency.160.build.f_cpu=160000000L
-
-nodemcu.menu.UploadSpeed.115200=115200
-nodemcu.menu.UploadSpeed.115200.upload.speed=115200
-nodemcu.menu.UploadSpeed.9600=9600
-nodemcu.menu.UploadSpeed.9600.upload.speed=9600
-nodemcu.menu.UploadSpeed.57600=57600
-nodemcu.menu.UploadSpeed.57600.upload.speed=57600
-nodemcu.menu.UploadSpeed.256000.windows=256000
-nodemcu.menu.UploadSpeed.256000.upload.speed=256000
-nodemcu.menu.UploadSpeed.230400.linux=230400
-nodemcu.menu.UploadSpeed.230400.macosx=230400
-nodemcu.menu.UploadSpeed.230400.macosx=230400
-nodemcu.menu.UploadSpeed.230400.upload.speed=230400
-nodemcu.menu.UploadSpeed.460800.linux=460800
-nodemcu.menu.UploadSpeed.460800.macosx=460800
-nodemcu.menu.UploadSpeed.460800.upload.speed=460800
-nodemcu.menu.UploadSpeed.512000.windows=512000
-nodemcu.menu.UploadSpeed.512000.upload.speed=512000
-nodemcu.menu.UploadSpeed.921600=921600
-nodemcu.menu.UploadSpeed.921600.upload.speed=921600
-
-##############################################################
-# wifio.name=Wifio
-#
-# wifio.upload.tool=esptool
-# wifio.upload.speed=115200
-# wifio.upload.resetmethod=wifio
-# wifio.upload.maximum_size=524288
-# wifio.upload.wait_for_upload_port=true
-#
-# wifio.build.mcu=esp8266
-# wifio.build.f_cpu=80000000L
-# wifio.build.board=ESP8266_WIFIO
-# wifio.build.core=esp8266
-# wifio.build.variant=wifio
-# wifio.build.flash_mode=qio
-# wifio.build.flash_size=512K
-# wifio.build.flash_freq=40
-# wifio.build.flash_ld=eagle.flash.512k.ld
-# wifio.build.spiffs_start=0x6B000
-# wifio.build.spiffs_end=0x7B000
-#
-# wifio.menu.CpuFrequency.80=80MHz
-# wifio.menu.CpuFrequency.80.build.f_cpu=80000000L
-# wifio.menu.CpuFrequency.160=160MHz
-# wifio.menu.CpuFrequency.160.build.f_cpu=160000000L
-#
-# wifio.upload.tool=esptool
-#
diff --git a/sparkfun/esp8266/bootloaders/.DS_Store b/sparkfun/esp8266/bootloaders/.DS_Store
deleted file mode 100644
index 5008ddfc..00000000
Binary files a/sparkfun/esp8266/bootloaders/.DS_Store and /dev/null differ
diff --git a/sparkfun/esp8266/cores/.DS_Store b/sparkfun/esp8266/cores/.DS_Store
deleted file mode 100644
index 8554222f..00000000
Binary files a/sparkfun/esp8266/cores/.DS_Store and /dev/null differ
diff --git a/sparkfun/esp8266/cores/esp8266/Arduino.h b/sparkfun/esp8266/cores/esp8266/Arduino.h
deleted file mode 100644
index 767ea4f2..00000000
--- a/sparkfun/esp8266/cores/esp8266/Arduino.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- Arduino.h - Main include file for the Arduino SDK
- Copyright (c) 2005-2013 Arduino Team. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef Arduino_h
-#define Arduino_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "stdlib_noniso.h"
-#include "binary.h"
-#include "pgmspace.h"
-#include "esp8266_peri.h"
-#include "twi.h"
-
-void yield(void);
-
-#define HIGH 0x1
-#define LOW 0x0
-
-#define PWMRANGE 1023
-
-//GPIO FUNCTIONS
-#define INPUT 0x00
-#define INPUT_PULLUP 0x02
-#define INPUT_PULLDOWN 0x04
-#define OUTPUT 0x01
-#define OUTPUT_OPEN_DRAIN 0x03
-#define SPECIAL 0xF8 //defaults to the usable BUSes uart0rx/tx uart1tx and hspi
-#define FUNCTION_0 0x08
-#define FUNCTION_1 0x18
-#define FUNCTION_2 0x28
-#define FUNCTION_3 0x38
-#define FUNCTION_4 0x48
-
-#define PI 3.1415926535897932384626433832795
-#define HALF_PI 1.5707963267948966192313216916398
-#define TWO_PI 6.283185307179586476925286766559
-#define DEG_TO_RAD 0.017453292519943295769236907684886
-#define RAD_TO_DEG 57.295779513082320876798154814105
-#define EULER 2.718281828459045235360287471352
-
-#define SERIAL 0x0
-#define DISPLAY 0x1
-
-#define LSBFIRST 0
-#define MSBFIRST 1
-
-//Interrupt Modes
-#define DISABLED 0x00
-#define RISING 0x01
-#define FALLING 0x02
-#define CHANGE 0x03
-#define ONLOW 0x04
-#define ONHIGH 0x05
-#define ONLOW_WE 0x0C
-#define ONHIGH_WE 0x0D
-
-#define DEFAULT 1
-#define EXTERNAL 0
-
-//timer dividers
-#define TIM_DIV1 0 //80MHz (80 ticks/us - 104857.588 us max)
-#define TIM_DIV16 1 //5MHz (5 ticks/us - 1677721.4 us max)
-#define TIM_DIV265 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
-//timer int_types
-#define TIM_EDGE 0
-#define TIM_LEVEL 1
-//timer reload values
-#define TIM_SINGLE 0 //on interrupt routine you need to write a new value to start the timer again
-#define TIM_LOOP 1 //on interrupt the counter will start with the same value again
-
-#define timer1_read() (T1V)
-#define timer1_enabled() ((T1C & (1 << TCTE)) != 0)
-#define timer1_interrupted() ((T1C & (1 << TCIS)) != 0)
-
-void timer1_isr_init(void);
-void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload);
-void timer1_disable(void);
-void timer1_attachInterrupt(void (*userFunc)(void));
-void timer1_detachInterrupt(void);
-void timer1_write(uint32_t ticks); //maximum ticks 8388607
-
-// undefine stdlib's abs if encountered
-#ifdef abs
-#undef abs
-#endif
-
-#define abs(x) ((x)>0?(x):-(x))
-#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
-#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
-#define radians(deg) ((deg)*DEG_TO_RAD)
-#define degrees(rad) ((rad)*RAD_TO_DEG)
-#define sq(x) ((x)*(x))
-
-void ets_intr_lock();
-void ets_intr_unlock();
-
-// level (0-15),
-// level 15 will disable ALL interrupts,
-// level 0 will disable most software interrupts
-//
-#define xt_disable_interrupts(state, level) __asm__ __volatile__("rsil %0," __STRINGIFY(level) "; esync; isync; dsync" : "=a" (state))
-#define xt_enable_interrupts(state) __asm__ __volatile__("wsr %0,ps; esync" :: "a" (state) : "memory")
-
-extern uint32_t interruptsState;
-
-#define interrupts() xt_enable_interrupts(interruptsState)
-#define noInterrupts() __asm__ __volatile__("rsil %0,15; esync; isync; dsync" : "=a" (interruptsState))
-
-#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
-#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
-#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
-
-#define lowByte(w) ((uint8_t) ((w) & 0xff))
-#define highByte(w) ((uint8_t) ((w) >> 8))
-
-#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
-#define bitSet(value, bit) ((value) |= (1UL << (bit)))
-#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
-#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
-
-// avr-libc defines _NOP() since 1.6.2
-#ifndef _NOP
-#define _NOP() do { __asm__ volatile ("nop"); } while (0)
-#endif
-
-typedef unsigned int word;
-
-#define bit(b) (1UL << (b))
-#define _BV(b) (1UL << (b))
-
-typedef uint8_t boolean;
-typedef uint8_t byte;
-
-void init(void);
-void initVariant(void);
-
-int atexit(void (*func)()) __attribute__((weak));
-
-void pinMode(uint8_t, uint8_t);
-void digitalWrite(uint8_t, uint8_t);
-int digitalRead(uint8_t);
-int analogRead(uint8_t);
-void analogReference(uint8_t mode);
-void analogWrite(uint8_t, int);
-void analogWriteFreq(uint32_t freq);
-
-unsigned long millis(void);
-unsigned long micros(void);
-void delay(unsigned long);
-void delayMicroseconds(unsigned int us);
-unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
-
-void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
-uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
-
-void attachInterrupt(uint8_t, void (*)(void), int mode);
-void detachInterrupt(uint8_t);
-
-void setup(void);
-void loop(void);
-
-// Get the bit location within the hardware port of the given virtual pin.
-// This comes from the pins_*.c file for the active board configuration.
-#define digitalPinToPort(pin) (0)
-#define digitalPinToBitMask(pin) (1UL << (pin))
-#define portOutputRegister(port) ((volatile uint32_t*) GPO)
-#define portInputRegister(port) ((volatile uint32_t*) GPI)
-#define portModeRegister(port) ((volatile uint32_t*) GPE)
-
-#define NOT_A_PIN -1
-#define NOT_A_PORT -1
-#define NOT_AN_INTERRUPT -1
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#ifdef __cplusplus
-
-#include "WCharacter.h"
-#include "WString.h"
-
-#include "HardwareSerial.h"
-#include "FileSystem.h"
-#include "Esp.h"
-#include "debug.h"
-
-#define min(a,b) ((a)<(b)?(a):(b))
-#define max(a,b) ((a)>(b)?(a):(b))
-
-uint16_t makeWord(uint16_t w);
-uint16_t makeWord(byte h, byte l);
-
-#define word(...) makeWord(__VA_ARGS__)
-
-unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
-
-void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
-void noTone(uint8_t _pin);
-
-// WMath prototypes
-long random(long);
-long random(long, long);
-void randomSeed(unsigned int);
-long map(long, long, long, long, long);
-
-
-#endif
-
-#include "pins_arduino.h"
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/Client.h b/sparkfun/esp8266/cores/esp8266/Client.h
deleted file mode 100644
index d776a2e1..00000000
--- a/sparkfun/esp8266/cores/esp8266/Client.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Client.h - Base class that provides Client
- Copyright (c) 2011 Adrian McEwen. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef client_h
-#define client_h
-#include "Print.h"
-#include "Stream.h"
-#include "IPAddress.h"
-
-class Client: public Stream {
-
- public:
- virtual int connect(IPAddress ip, uint16_t port) =0;
- virtual int connect(const char *host, uint16_t port) =0;
- virtual size_t write(uint8_t) =0;
- virtual size_t write(const uint8_t *buf, size_t size) =0;
- virtual int available() = 0;
- virtual int read() = 0;
- virtual int read(uint8_t *buf, size_t size) = 0;
- virtual int peek() = 0;
- virtual void flush() = 0;
- virtual void stop() = 0;
- virtual uint8_t connected() = 0;
- virtual operator bool() = 0;
- protected:
- uint8_t* rawIPAddress(IPAddress& addr) {
- return addr.raw_address();
- }
- ;
-};
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/Esp.cpp b/sparkfun/esp8266/cores/esp8266/Esp.cpp
deleted file mode 100644
index af6d9946..00000000
--- a/sparkfun/esp8266/cores/esp8266/Esp.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- Esp.cpp - ESP8266-specific APIs
- Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "Arduino.h"
-
-extern "C" {
-#include "user_interface.h"
-}
-
-//extern "C" void ets_wdt_init(uint32_t val);
-extern "C" void ets_wdt_enable(void);
-extern "C" void ets_wdt_disable(void);
-extern "C" void wdt_feed(void);
-
-/**
- * User-defined Literals
- * usage:
- *
- * uint32_t = test = 10_MHz; // --> 10000000
- */
-
-unsigned long long operator"" _kHz(unsigned long long x) {
- return x * 1000;
-}
-
-unsigned long long operator"" _MHz(unsigned long long x) {
- return x * 1000 * 1000;
-}
-
-unsigned long long operator"" _GHz(unsigned long long x) {
- return x * 1000 * 1000 * 1000;
-}
-
-unsigned long long operator"" _kBit(unsigned long long x) {
- return x * 1024;
-}
-
-unsigned long long operator"" _MBit(unsigned long long x) {
- return x * 1024 * 1024;
-}
-
-unsigned long long operator"" _GBit(unsigned long long x) {
- return x * 1024 * 1024 * 1024;
-}
-
-unsigned long long operator"" _kB(unsigned long long x) {
- return x * 1024;
-}
-
-unsigned long long operator"" _MB(unsigned long long x) {
- return x * 1024 * 1024;
-}
-
-unsigned long long operator"" _GB(unsigned long long x) {
- return x * 1024 * 1024 * 1024;
-}
-
-
-EspClass ESP;
-
-EspClass::EspClass()
-{
-
-}
-
-void EspClass::wdtEnable(uint32_t timeout_ms)
-{
- //todo find doku for ets_wdt_init may set the timeout
- ets_wdt_enable();
-}
-
-void EspClass::wdtEnable(WDTO_t timeout_ms)
-{
- wdtEnable((uint32_t) timeout_ms);
-}
-
-void EspClass::wdtDisable(void)
-{
- ets_wdt_disable();
-}
-
-void EspClass::wdtFeed(void)
-{
- wdt_feed();
-}
-
-void EspClass::deepSleep(uint32_t time_us, WakeMode mode)
-{
- system_deep_sleep_set_option(static_cast(mode));
- system_deep_sleep(time_us);
-}
-
-void EspClass::reset(void)
-{
- ((void (*)(void))0x40000080)();
-}
-
-void EspClass::restart(void)
-{
- system_restart();
-}
-
-uint16_t EspClass::getVcc(void)
-{
- return system_get_vdd33();
-}
-
-uint32_t EspClass::getFreeHeap(void)
-{
- return system_get_free_heap_size();
-}
-
-uint32_t EspClass::getChipId(void)
-{
- return system_get_chip_id();
-}
-
-const char * EspClass::getSdkVersion(void)
-{
- return system_get_sdk_version();
-}
-
-uint8_t EspClass::getBootVersion(void)
-{
- return system_get_boot_version();
-}
-
-uint8_t EspClass::getBootMode(void)
-{
- return system_get_boot_mode();
-}
-
-uint8_t EspClass::getCpuFreqMHz(void)
-{
- return system_get_cpu_freq();
-}
-
-
-uint32_t EspClass::getFlashChipId(void)
-{
- return spi_flash_get_id();
-}
-
-uint32_t EspClass::getFlashChipSize(void)
-{
- uint32_t data;
- uint8_t * bytes = (uint8_t *) &data;
- // read first 4 byte (magic byte + flash config)
- if(spi_flash_read(0x0000, &data, 4) == SPI_FLASH_RESULT_OK) {
- switch((bytes[3] & 0xf0) >> 4) {
- case 0x0: // 4 Mbit (512KB)
- return (512_kB);
- case 0x1: // 2 MBit (256KB)
- return (256_kB);
- case 0x2: // 8 MBit (1MB)
- return (1_MB);
- case 0x3: // 16 MBit (2MB)
- return (2_MB);
- case 0x4: // 32 MBit (4MB)
- return (4_MB);
- default: // fail?
- return 0;
- }
- }
- return 0;
-}
-
-uint32_t EspClass::getFlashChipSpeed(void)
-{
- uint32_t data;
- uint8_t * bytes = (uint8_t *) &data;
- // read first 4 byte (magic byte + flash config)
- if(spi_flash_read(0x0000, &data, 4) == SPI_FLASH_RESULT_OK) {
- switch(bytes[3] & 0x0F) {
- case 0x0: // 40 MHz
- return (40_MHz);
- case 0x1: // 26 MHz
- return (26_MHz);
- case 0x2: // 20 MHz
- return (20_MHz);
- case 0xf: // 80 MHz
- return (80_MHz);
- default: // fail?
- return 0;
- }
- }
- return 0;
-}
-
-FlashMode_t EspClass::getFlashChipMode(void)
-{
- FlashMode_t mode = FM_UNKNOWN;
- uint32_t data;
- uint8_t * bytes = (uint8_t *) &data;
- // read first 4 byte (magic byte + flash config)
- if(spi_flash_read(0x0000, &data, 4) == SPI_FLASH_RESULT_OK) {
- mode = (FlashMode_t) bytes[2];
- if(mode > FM_DOUT) {
- mode = FM_UNKNOWN;
- }
- }
- return mode;
-}
-
-/**
- * Infos from
- * http://www.wlxmall.com/images/stock_item/att/A1010004.pdf
- * http://www.gigadevice.com/product-series/5.html?locale=en_US
- * http://www.elinux.org/images/f/f5/Winbond-w25q32.pdf
- */
-uint32_t EspClass::getFlashChipSizeByChipId(void) {
- uint32_t chipId = getFlashChipId();
- /**
- * Chip ID
- * 00 - always 00 (Chip ID use only 3 byte)
- * 17 - ? looks like 2^xx is size in Byte ? //todo: find docu to this
- * 40 - ? may be Speed ? //todo: find docu to this
- * C8 - manufacturer ID
- */
- switch(chipId) {
-
- // GigaDevice
- case 0x1740C8: // GD25Q64B
- return (8_MB);
- case 0x1640C8: // GD25Q32B
- return (4_MB);
- case 0x1540C8: // GD25Q16B
- return (2_MB);
- case 0x1440C8: // GD25Q80
- return (1_MB);
- case 0x1340C8: // GD25Q40
- return (512_kB);
- case 0x1240C8: // GD25Q20
- return (256_kB);
- case 0x1140C8: // GD25Q10
- return (128_kB);
- case 0x1040C8: // GD25Q12
- return (64_kB);
-
- // Winbond
- case 0x1640EF: // W25Q32
- return (4_MB);
- case 0x1540EF: // W25Q16
- return (2_MB);
- case 0x1440EF: // W25Q80
- return (1_MB);
-
- default:
- return 0;
- }
-}
diff --git a/sparkfun/esp8266/cores/esp8266/Esp.h b/sparkfun/esp8266/cores/esp8266/Esp.h
deleted file mode 100644
index 9750dd31..00000000
--- a/sparkfun/esp8266/cores/esp8266/Esp.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- Esp.h - ESP8266-specific APIs
- Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef ESP_H
-#define ESP_H
-/**
- * AVR macros for WDT managment
- */
-typedef enum {
- WDTO_0MS = 0, //!< WDTO_0MS
- WDTO_15MS = 15, //!< WDTO_15MS
- WDTO_30MS = 30, //!< WDTO_30MS
- WDTO_60MS = 60, //!< WDTO_60MS
- WDTO_120MS = 120, //!< WDTO_120MS
- WDTO_250MS = 250, //!< WDTO_250MS
- WDTO_500MS = 500, //!< WDTO_500MS
- WDTO_1S = 1000,//!< WDTO_1S
- WDTO_2S = 2000,//!< WDTO_2S
- WDTO_4S = 4000,//!< WDTO_4S
- WDTO_8S = 8000 //!< WDTO_8S
-} WDTO_t;
-
-
-#define wdt_enable(time) ESP.wdtEnable(time)
-#define wdt_disable() ESP.wdtDisable()
-#define wdt_reset() ESP.wdtFeed()
-
-#define cli() ets_intr_lock() // IRQ Disable
-#define sei() ets_intr_unlock() // IRQ Enable
-
-enum WakeMode {
- WAKE_RF_DEFAULT = 0, // RF_CAL or not after deep-sleep wake up, depends on init data byte 108.
- WAKE_RFCAL = 1, // RF_CAL after deep-sleep wake up, there will be large current.
- WAKE_NO_RFCAL = 2, // no RF_CAL after deep-sleep wake up, there will only be small current.
- WAKE_RF_DISABLED = 4 // disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current.
-};
-
-typedef enum {
- FM_QIO = 0x00,
- FM_QOUT = 0x01,
- FM_DIO = 0x02,
- FM_DOUT = 0x03,
- FM_UNKNOWN = 0xff
-} FlashMode_t;
-
-class EspClass {
- public:
- EspClass();
-
- // TODO: figure out how to set WDT timeout
- void wdtEnable(uint32_t timeout_ms = 0);
- // note: setting the timeout value is not implemented at the moment
- void wdtEnable(WDTO_t timeout_ms = WDTO_0MS);
-
- void wdtDisable(void);
- void wdtFeed(void);
-
- void deepSleep(uint32_t time_us, WakeMode mode = WAKE_RF_DEFAULT);
-
- void reset(void);
- void restart(void);
-
- uint16_t getVcc(void);
- uint32_t getFreeHeap(void);
-
- uint32_t getChipId(void);
-
- const char * getSdkVersion(void);
-
- uint8_t getBootVersion(void);
- uint8_t getBootMode(void);
-
- uint8_t getCpuFreqMHz(void);
-
- uint32_t getFlashChipId(void);
- uint32_t getFlashChipSize(void);
- uint32_t getFlashChipSpeed(void);
- FlashMode_t getFlashChipMode(void);
- uint32_t getFlashChipSizeByChipId(void);
-
- inline uint32_t getCycleCount(void);
-};
-
-uint32_t EspClass::getCycleCount(void)
-{
- uint32_t ccount;
- __asm__ __volatile__("rsr %0,ccount":"=a" (ccount));
- return ccount;
-}
-
-extern EspClass ESP;
-
-#endif //ESP_H
diff --git a/sparkfun/esp8266/cores/esp8266/FileSystem.cpp b/sparkfun/esp8266/cores/esp8266/FileSystem.cpp
deleted file mode 100644
index 0399e4fc..00000000
--- a/sparkfun/esp8266/cores/esp8266/FileSystem.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- FileSystem.cpp - SPIFS implementation for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include "FileSystem.h"
-#include "Arduino.h"
-#include "spiffs/spiffs_esp8266.h"
-
-#define LOGICAL_PAGE_SIZE 256
-#define LOGICAL_BLOCK_SIZE 512
-
-
-// These addresses are defined in the linker script.
-// For each flash memory size there is a linker script variant
-// which sets spiffs location and size.
-extern "C" uint32_t _SPIFFS_start;
-extern "C" uint32_t _SPIFFS_end;
-
-static s32_t api_spiffs_read(u32_t addr, u32_t size, u8_t *dst);
-static s32_t api_spiffs_write(u32_t addr, u32_t size, u8_t *src);
-static s32_t api_spiffs_erase(u32_t addr, u32_t size);
-
-FSClass FS((uint32_t) &_SPIFFS_start, (uint32_t) &_SPIFFS_end, 4);
-
-FSClass::FSClass(uint32_t beginAddress, uint32_t endAddress, uint32_t maxOpenFiles)
-: _beginAddress(beginAddress)
-, _endAddress(endAddress)
-, _maxOpenFiles(maxOpenFiles)
-, _fs({0})
-{
-}
-
-int FSClass::_mountInternal(){
- if (_beginAddress == 0 || _beginAddress >= _endAddress){
- SPIFFS_API_DBG_E("Can't start file system, wrong address\r\n");
- return SPIFFS_ERR_NOT_CONFIGURED;
- }
-
- spiffs_config cfg = {0};
- cfg.phys_addr = _beginAddress;
- cfg.phys_size = _endAddress - _beginAddress;
- cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE;
- cfg.log_block_size = LOGICAL_BLOCK_SIZE;
- cfg.log_page_size = LOGICAL_PAGE_SIZE;
- cfg.hal_read_f = api_spiffs_read;
- cfg.hal_write_f = api_spiffs_write;
- cfg.hal_erase_f = api_spiffs_erase;
-
- SPIFFS_API_DBG_V("FSClass::_mountInternal: start:%x, size:%d Kb\n", cfg.phys_addr, cfg.phys_size / 1024);
-
- _work.reset(new uint8_t[LOGICAL_BLOCK_SIZE]);
- _fdsSize = 32 * _maxOpenFiles;
- _fds.reset(new uint8_t[_fdsSize]);
- _cacheSize = (32 + LOGICAL_PAGE_SIZE) * _maxOpenFiles;
- _cache.reset(new uint8_t[_cacheSize]);
-
- s32_t res = SPIFFS_mount(&_fs,
- &cfg,
- _work.get(),
- _fds.get(),
- _fdsSize,
- _cache.get(),
- _cacheSize,
- NULL);
- SPIFFS_API_DBG_V("FSClass::_mountInternal: %d\n", res);
- return res;
-}
-
-bool FSClass::mount() {
- if(SPIFFS_mounted(&_fs))
- return true;
-
- int res = _mountInternal();
- if(res != SPIFFS_OK){
- int formated = SPIFFS_format(&_fs);
- if(formated != SPIFFS_OK)
- return false;
- res = _mountInternal();
- }
- return (res == SPIFFS_OK);
-}
-
-// TODO: need to invalidate open file objects
-void FSClass::unmount() {
- if(SPIFFS_mounted(&_fs))
- SPIFFS_unmount(&_fs);
-}
-
-bool FSClass::format() {
- if(!SPIFFS_mounted(&_fs)){
- _mountInternal();
- }
- SPIFFS_unmount(&_fs);
- int formated = SPIFFS_format(&_fs);
- if(formated != SPIFFS_OK)
- return false;
- return (_mountInternal() == SPIFFS_OK);
-}
-
-bool FSClass::check() {
- return SPIFFS_check(&_fs) == SPIFFS_OK;
-}
-
-bool FSClass::exists(char *filename) {
- spiffs_stat stat = {0};
- if (SPIFFS_stat(&_fs, filename, &stat) < 0)
- return false;
- return stat.name[0] != '\0';
-}
-
-bool FSClass::create(char *filepath){
- return SPIFFS_creat(&_fs, filepath, 0) == SPIFFS_OK;
-}
-
-bool FSClass::remove(char *filepath){
- return SPIFFS_remove(&_fs, filepath) == SPIFFS_OK;
-}
-
-bool FSClass::rename(char *filename, char *newname) {
- return SPIFFS_rename(&_fs, filename, newname) == SPIFFS_OK;
-}
-
-size_t FSClass::totalBytes(){
- u32_t totalBytes;
- u32_t usedBytes;
- if(SPIFFS_info(&_fs, &totalBytes, &usedBytes) == SPIFFS_OK)
- return totalBytes;
- return 0;
-}
-
-size_t FSClass::usedBytes(){
- u32_t totalBytes;
- u32_t usedBytes;
- if(SPIFFS_info(&_fs, &totalBytes, &usedBytes) == SPIFFS_OK)
- return usedBytes;
- return 0;
-}
-
-FSFile FSClass::open(char *filename, uint8_t mode) {
- if(strcmp(filename, "") == 0 ||
- strcmp(filename, "/") == 0)
- return FSFile(&_fs, "/");
-
- int repeats = 0;
- bool notExist;
- bool canRecreate = (mode & SPIFFS_CREAT) == SPIFFS_CREAT;
- int res;
-
- do{
- notExist = false;
- res = SPIFFS_open(&_fs, filename, (spiffs_flags)mode, 0);
- int code = SPIFFS_errno(&_fs);
- if (res < 0){
- SPIFFS_API_DBG_E("open errno %d\n", code);
- notExist = (code == SPIFFS_ERR_NOT_FOUND || code == SPIFFS_ERR_DELETED || code == SPIFFS_ERR_FILE_DELETED || code == SPIFFS_ERR_IS_FREE);
- if (notExist && canRecreate)
- remove(filename); // fix for deleted files
- }
- } while (notExist && canRecreate && repeats++ < 3);
-
- if(res){
- return FSFile(&_fs, res);
- }
- return FSFile();
-}
-
-FSFile FSClass::open(spiffs_dirent* entry, uint8_t mode){
- int res = SPIFFS_open_by_dirent(&_fs, entry, (spiffs_flags)mode, 0);
- if (res){
- return FSFile(&_fs, res);
- }
- return FSFile();
-}
-
-FSFile::FSFile()
-: _file(0)
-, _stats({0})
-, _fs(0)
-{
-}
-
-FSFile::FSFile(spiffs* fs, String path)
-: _fs(fs)
-{
- if(path == "/"){
- _file = 0x1;
- os_sprintf((char*)_stats.name, "%s", (char*)path.c_str());
- _stats.size = 0;
- _stats.type = SPIFFS_TYPE_DIR;
- SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
- } else {
- _file = SPIFFS_open(_fs, (char *)path.c_str(), (spiffs_flags)FSFILE_READ, 0);
- if(SPIFFS_fstat(_fs, _file, &_stats) != 0){
- SPIFFS_API_DBG_E("fstat errno %d\n", SPIFFS_errno(_fs));
- }
- //debugf("FSFile name: %s, size: %d, type: %d\n", _stats.name, _stats.size, _stats.type);
- if(_stats.type == SPIFFS_TYPE_DIR){
- SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
- }
- }
-}
-
-FSFile::FSFile(spiffs* fs, file_t f)
-: _file(f)
-, _fs(fs)
-{
- if(SPIFFS_fstat(_fs, _file, &_stats) != 0){
- SPIFFS_API_DBG_E("fstat errno %d\n", SPIFFS_errno(_fs));
- }
- //debugf("FSFile name: %s, size: %d, type: %d\n", _stats.name, _stats.size, _stats.type);
- if(_stats.type == SPIFFS_TYPE_DIR){
- SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
- }
-}
-
-void FSFile::close() {
- if (!_file)
- return;
- if(_stats.type == SPIFFS_TYPE_DIR){
- SPIFFS_closedir(&_dir);
- }
- if(os_strlen((char*)_stats.name) > 1)
- SPIFFS_close(_fs, _file);
- _file = 0;
-}
-
-char * FSFile::name(){
- return (char*)_stats.name;
-}
-
-bool FSFile::isDirectory(void) {
- return _stats.type == SPIFFS_TYPE_DIR;
-}
-
-void FSFile::rewindDirectory() {
- if (!_file || !isDirectory())
- return;
- SPIFFS_closedir(&_dir);
- SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
-}
-
-FSFile FSFile::openNextFile(){
- if (!_file || !isDirectory())
- return FSFile();
- struct spiffs_dirent e;
- struct spiffs_dirent *pe = &e;
- if ((pe = SPIFFS_readdir(&_dir, pe))){
- // TODO: store actual FS pointer
- return FS.open((char *)pe->name);
- }
- return FSFile();
-}
-
-uint32_t FSFile::size() {
- if(!_file)
- return 0;
- if(_stats.size)
- return _stats.size;
- uint32_t pos = SPIFFS_tell(_fs, _file);
- SPIFFS_lseek(_fs, _file, 0, SPIFFS_SEEK_END);
- _stats.size = SPIFFS_tell(_fs, _file);
- SPIFFS_lseek(_fs, _file, pos, SPIFFS_SEEK_SET);
- return _stats.size;
-}
-
-int FSFile::available() {
- if (!_file)
- return 0;
- uint32_t pos = SPIFFS_tell(_fs, _file);
- return size() - pos;
-}
-
-uint32_t FSFile::seek(uint32_t pos) {
- if (!_file)
- return 0;
- return SPIFFS_lseek(_fs, _file, pos, SPIFFS_SEEK_SET);
-}
-
-uint32_t FSFile::position() {
- if (!_file)
- return 0;
- return SPIFFS_tell(_fs, _file);
-}
-
-bool FSFile::eof() {
- if (!_file)
- return 0;
- return SPIFFS_eof(_fs, _file);
-}
-
-int FSFile::read(void *buf, uint16_t nbyte) {
- if (!_file || isDirectory())
- return -1;
- return SPIFFS_read(_fs, _file, buf, nbyte);
-}
-
-int FSFile::read() {
- if (! _file || isDirectory())
- return -1;
- int val;
- if(SPIFFS_read(_fs, _file, &val, 1) != 1) return -1;
- return val;
-}
-
-int FSFile::peek() {
- if (!_file || isDirectory())
- return 0;
- int c = read();
- SPIFFS_lseek(_fs, _file, -1, SPIFFS_SEEK_CUR);
- return c;
-}
-
-size_t FSFile::write(const uint8_t *buf, size_t size){
- if (!_file || isDirectory())
- return 0;
- int res = SPIFFS_write(_fs, _file, (uint8_t *)buf, size);
- return (res > 0)?(size_t)res:0;
-}
-
-size_t FSFile::write(uint8_t val) {
- if (!_file || isDirectory())
- return 0;
- return write(&val, 1);
-}
-
-void FSFile::flush(){
- if (!_file || isDirectory())
- return;
- SPIFFS_fflush(_fs, _file);
-}
-
-bool FSFile::remove(){
- if (!_file)
- return 0;
- close();
- return SPIFFS_remove(_fs, (char *)_stats.name) == 0;
-}
-
-int FSFile::lastError(){
- return SPIFFS_errno(_fs);
-}
-
-void FSFile::clearError(){
- _fs->err_code = SPIFFS_OK;
-}
-
-
-static s32_t api_spiffs_read(u32_t addr, u32_t size, u8_t *dst){
- SPIFFS_API_DBG_V("api_spiffs_read: 0x%08x len: %u\n", addr, size);
- flashmem_read(dst, addr, size);
- return SPIFFS_OK;
-}
-
-static s32_t api_spiffs_write(u32_t addr, u32_t size, u8_t *src){
- SPIFFS_API_DBG_V("api_spiffs_write: 0x%08x len: %u\n", addr, size);
- flashmem_write(src, addr, size);
- return SPIFFS_OK;
-}
-
-static s32_t api_spiffs_erase(u32_t addr, u32_t size){
- SPIFFS_API_DBG_V("api_spiffs_erase: 0x%08x len: %u\n", addr, size);
- u32_t sect_first = flashmem_get_sector_of_address(addr);
- u32_t sect_last = flashmem_get_sector_of_address(addr+size);
- while( sect_first <= sect_last )
- if( !flashmem_erase_sector( sect_first ++ ) )
- return SPIFFS_ERR_INTERNAL;
- return SPIFFS_OK;
-}
-
-
diff --git a/sparkfun/esp8266/cores/esp8266/FileSystem.h b/sparkfun/esp8266/cores/esp8266/FileSystem.h
deleted file mode 100644
index 7baf0769..00000000
--- a/sparkfun/esp8266/cores/esp8266/FileSystem.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- FileSystem.h - SPIFS implementation for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef _SPIFFS_CORE_FILESYSTEM_H_
-#define _SPIFFS_CORE_FILESYSTEM_H_
-
-#include
-#include "spiffs/spiffs.h"
-#include "Arduino.h"
-
-#define FSFILE_READ SPIFFS_RDONLY
-#define FSFILE_WRITE (SPIFFS_RDONLY | SPIFFS_WRONLY | SPIFFS_CREAT | SPIFFS_APPEND )
-#define FSFILE_OVERWRITE (SPIFFS_RDONLY | SPIFFS_WRONLY | SPIFFS_CREAT | SPIFFS_APPEND | SPIFFS_TRUNC )
-
-class FSFile : public Stream {
-private:
- spiffs_stat _stats;
- file_t _file;
- spiffs_DIR _dir;
- spiffs * _fs;
-
-public:
- FSFile(spiffs* fs, String path);
- FSFile(spiffs* fs, file_t f);
- FSFile(void);
- virtual size_t write(uint8_t);
- virtual size_t write(const uint8_t *buf, size_t size);
- virtual int read();
- virtual int peek();
- virtual int available();
- virtual void flush();
- int read(void *buf, uint16_t nbyte);
- uint32_t seek(uint32_t pos);
- uint32_t position();
- uint32_t size();
- bool eof();
- void close();
- bool remove();
- int lastError();
- void clearError();
- operator bool() { return _file > 0; }
- char * name();
- bool isDirectory(void);
- void rewindDirectory(void);
- FSFile openNextFile(void);
-
- template size_t write(T &src){
- const size_t bufferSize = 64;
- uint8_t obuf[bufferSize];
- size_t bytesWritten = 0;
- while (true){
- size_t available = src.available();
- if(!available)
- return bytesWritten;
- size_t willWrite = (available < bufferSize) ? available : bufferSize;
- src.read(obuf, willWrite);
- size_t cb = write(obuf, willWrite);
- if (cb != willWrite) {
- return bytesWritten;
- }
- bytesWritten += cb;
- }
- return bytesWritten;
- }
-
- using Print::write;
-};
-
-class FSClass {
-public:
- FSClass(uint32_t beginAddress, uint32_t endAddress, uint32_t maxOpenFiles);
-
- bool mount();
- void unmount();
- bool format();
- bool check();
- bool exists(char *filename);
- bool create(char *filepath);
- bool remove(char *filepath);
- bool rename(char *filename, char *newname);
- size_t totalBytes();
- size_t usedBytes();
- size_t size(){ return _fs.cfg.phys_size; }
- size_t blockSize(){ return _fs.cfg.log_block_size; }
- size_t totalBlocks(){ return _fs.block_count; }
- size_t freeBlocks(){ return _fs.free_blocks; }
- size_t pageSize(){ return _fs.cfg.log_page_size; }
- size_t allocatedPages(){ return _fs.stats_p_allocated; }
- size_t deletedPages(){ return _fs.stats_p_deleted; }
-
- FSFile open(char *filename, uint8_t mode = FSFILE_READ);
- FSFile open(spiffs_dirent* entry, uint8_t mode = FSFILE_READ);
-
-protected:
- int _mountInternal();
- std::unique_ptr _work;
- std::unique_ptr _fds;
- size_t _fdsSize;
- std::unique_ptr _cache;
- size_t _cacheSize;
- uint32_t _beginAddress;
- uint32_t _endAddress;
- uint32_t _maxOpenFiles;
- spiffs _fs;
-
-
-private:
- friend class FSFile;
-};
-
-extern FSClass FS;
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/HardwareSerial.cpp b/sparkfun/esp8266/cores/esp8266/HardwareSerial.cpp
deleted file mode 100644
index 4ea4be78..00000000
--- a/sparkfun/esp8266/cores/esp8266/HardwareSerial.cpp
+++ /dev/null
@@ -1,643 +0,0 @@
-/*
- HardwareSerial.cpp - esp8266 UART support
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Modified 31 March 2015 by Markus Sattler (rewrite the code for UART0 + UART1 support in ESP8266)
- Modified 25 April 2015 by Thomas Flayols (add configuration different from 8N1 in ESP8266)
- Modified 3 May 2015 by Hristo Gochkov (change register access methods)
- */
-
-#include
-#include
-#include
-#include
-#include "Arduino.h"
-#include "cbuf.h"
-
-extern "C" {
-#include "osapi.h"
-#include "ets_sys.h"
-#include "mem.h"
-#include "user_interface.h"
-}
-
-#include "HardwareSerial.h"
-
-#define UART_TX_FIFO_SIZE 0x80
-
-struct uart_ {
- int uart_nr;
- int baud_rate;
- bool rxEnabled;
- bool txEnabled;
- uint8_t rxPin;
- uint8_t txPin;
-};
-
-static const int UART0 = 0;
-static const int UART1 = 1;
-static const int UART_NO = -1;
-
-
-/**
- * UART GPIOs
- *
- * UART0 TX: 1 or 2
- * UART0 RX: 3
- *
- * UART0 SWAP TX: 15
- * UART0 SWAP RX: 13
- *
- *
- * UART1 TX: 7 (NC) or 2
- * UART1 RX: 8 (NC)
- *
- * UART1 SWAP TX: 11 (NC)
- * UART1 SWAP RX: 6 (NC)
- *
- * NC = Not Connected to Module Pads --> No Access
- *
- */
-
-// ####################################################################################################
-// ####################################################################################################
-// ####################################################################################################
-HardwareSerial Serial(UART0);
-HardwareSerial Serial1(UART1);
-
-// ####################################################################################################
-// ####################################################################################################
-// ####################################################################################################
-
-void uart_interrupt_handler(uart_t* uart);
-void uart_wait_for_tx_fifo(uart_t* uart, size_t size_needed);
-
-size_t uart_get_tx_fifo_room(uart_t* uart);
-void uart_wait_for_transmit(uart_t* uart);
-void uart_transmit_char(uart_t* uart, char c);
-void uart_transmit(uart_t* uart, const char* buf, size_t size);
-void uart_flush(uart_t* uart);
-void uart_interrupt_enable(uart_t* uart);
-void uart_interrupt_disable(uart_t* uart);
-void uart_arm_tx_interrupt(uart_t* uart);
-void uart_disarm_tx_interrupt(uart_t* uart);
-void uart_set_baudrate(uart_t* uart, int baud_rate);
-int uart_get_baudrate(uart_t* uart);
-
-uart_t* uart_init(int uart_nr, int baudrate, byte config);
-void uart_uninit(uart_t* uart);
-void uart_swap(uart_t* uart);
-
-void uart_ignore_char(char c);
-void uart0_write_char(char c);
-void uart1_write_char(char c);
-
-void uart_set_debug(int uart_nr);
-int uart_get_debug();
-
-// ####################################################################################################
-// ####################################################################################################
-// ####################################################################################################
-
-void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
-
- // -------------- UART 0 --------------
- if(Serial.isRxEnabled()) {
- while(U0IS & (1 << UIFF)) {
- Serial._rx_complete_irq((char) (U0F & 0xff));
- U0IC = (1 << UIFF);
- }
- }
- if(Serial.isTxEnabled()) {
- if(U0IS & (1 << UIFE)) {
- U0IC = (1 << UIFE);
- Serial._tx_empty_irq();
- }
- }
-
- // -------------- UART 1 --------------
-
- if(Serial1.isRxEnabled()) {
- while(U1IS & (1 << UIFF)) {
- Serial1._rx_complete_irq((char) (U1F & 0xff));
- U1IC = (1 << UIFF);
- }
- }
- if(Serial1.isTxEnabled()) {
- if(U1IS & (1 << UIFE)) {
- U1IC = (1 << UIFE);
- Serial1._tx_empty_irq();
- }
- }
-}
-
-// ####################################################################################################
-
-void uart_wait_for_tx_fifo(uart_t* uart, size_t size_needed) {
- if(uart == 0)
- return;
- if(uart->txEnabled) {
- while(true) {
- size_t tx_count = (USS(uart->uart_nr) >> USTXC) & 0xff;
- if(tx_count <= (UART_TX_FIFO_SIZE - size_needed))
- break;
- }
- }
-}
-
-size_t uart_get_tx_fifo_room(uart_t* uart) {
- if(uart == 0)
- return 0;
- if(uart->txEnabled) {
- return UART_TX_FIFO_SIZE - ((USS(uart->uart_nr) >> USTXC) & 0xff);
- }
- return 0;
-}
-
-void uart_wait_for_transmit(uart_t* uart) {
- if(uart == 0)
- return;
- if(uart->txEnabled) {
- uart_wait_for_tx_fifo(uart, UART_TX_FIFO_SIZE);
- }
-}
-
-void uart_transmit_char(uart_t* uart, char c) {
- if(uart == 0)
- return;
- if(uart->txEnabled) {
- USF(uart->uart_nr) = c;
- }
-}
-
-void uart_transmit(uart_t* uart, const char* buf, size_t size) {
- if(uart == 0)
- return;
- if(uart->txEnabled) {
- while(size) {
- size_t part_size = (size > UART_TX_FIFO_SIZE) ? UART_TX_FIFO_SIZE : size;
- size -= part_size;
-
- uart_wait_for_tx_fifo(uart, part_size);
- for(; part_size; --part_size, ++buf)
- USF(uart->uart_nr) = *buf;
- }
- }
-}
-
-void uart_flush(uart_t* uart) {
- uint32_t tmp = 0x00000000;
-
- if(uart == 0)
- return;
-
- if(uart->rxEnabled) {
- tmp |= (1 << UCRXRST);
- }
-
- if(uart->txEnabled) {
- tmp |= (1 << UCTXRST);
- }
-
- USC0(uart->uart_nr) |= (tmp);
- USC0(uart->uart_nr) &= ~(tmp);
-}
-
-void uart_interrupt_enable(uart_t* uart) {
- if(uart == 0)
- return;
- USIC(uart->uart_nr) = 0x1ff;
- ETS_UART_INTR_ATTACH(&uart_interrupt_handler, uart); // uart parameter is not osed in irq function!
- if(uart->rxEnabled) {
- USIE(uart->uart_nr) |= (1 << UIFF);
- }
- ETS_UART_INTR_ENABLE();
-}
-
-void uart_interrupt_disable(uart_t* uart) {
- if(uart == 0)
- return;
- if(uart->rxEnabled) {
- USIE(uart->uart_nr) &= ~(1 << UIFF);
- }
- if(uart->txEnabled) {
- USIE(uart->uart_nr) &= ~(1 << UIFE);
- }
- //ETS_UART_INTR_DISABLE(); // never disable irq complete may its needed by the other Serial Interface!
-}
-
-void uart_arm_tx_interrupt(uart_t* uart) {
- if(uart == 0)
- return;
- if(uart->txEnabled) {
- USIE(uart->uart_nr) |= (1 << UIFE);
- }
-}
-
-void uart_disarm_tx_interrupt(uart_t* uart) {
- if(uart == 0)
- return;
- if(uart->txEnabled) {
- USIE(uart->uart_nr) &= ~(1 << UIFE);
- }
-}
-
-void uart_set_baudrate(uart_t* uart, int baud_rate) {
- if(uart == 0)
- return;
- uart->baud_rate = baud_rate;
- USD(uart->uart_nr) = (80000000UL / uart->baud_rate);
-}
-
-int uart_get_baudrate(uart_t* uart) {
- if(uart == 0)
- return 0;
- return uart->baud_rate;
-}
-
-uart_t* uart_init(int uart_nr, int baudrate, byte config) {
-
- uint32_t conf1 = 0x00000000;
- uart_t* uart = (uart_t*) os_malloc(sizeof(uart_t));
-
- if(uart == 0) {
- return 0;
- }
-
- uart->uart_nr = uart_nr;
-
- switch(uart->uart_nr) {
- case UART0:
- pinMode(1, SPECIAL);
- pinMode(3, SPECIAL);
- uart->rxEnabled = true;
- uart->txEnabled = true;
- uart->rxPin = 3;
- uart->txPin = 1;
- break;
- case UART1:
- pinMode(2, SPECIAL);
- uart->rxEnabled = false;
- uart->txEnabled = true;
- uart->rxPin = 255;
- uart->txPin = 2;
- break;
- case UART_NO:
- default:
- // big fail!
- break;
- }
- uart_set_baudrate(uart, baudrate);
- USC0(uart->uart_nr) = config;
-
- uart_flush(uart);
- uart_interrupt_enable(uart);
-
- if(uart->rxEnabled) {
- conf1 |= (0x01 << UCFFT);
- }
-
- if(uart->txEnabled) {
- conf1 |= (0x20 << UCFET);
- }
-
- USC1(uart->uart_nr) = conf1;
-
- return uart;
-}
-
-void uart_uninit(uart_t* uart) {
- if(uart == 0)
- return;
- uart_interrupt_disable(uart);
-
- switch(uart->rxPin) {
- case 3:
- pinMode(3, INPUT);
- break;
- case 13:
- pinMode(13, INPUT);
- break;
- }
-
- switch(uart->txPin) {
- case 1:
- pinMode(1, INPUT);
- break;
- case 2:
- pinMode(2, INPUT);
- break;
- case 15:
- pinMode(15, INPUT);
- break;
- }
-
- os_free(uart);
-}
-
-void uart_swap(uart_t* uart) {
- if(uart == 0)
- return;
- switch(uart->uart_nr) {
- case UART0:
- if(uart->txPin == 1 && uart->rxPin == 3) {
- pinMode(15, FUNCTION_4); //TX
- pinMode(13, FUNCTION_4); //RX
- USWAP |= (1 << USWAP0);
- pinMode(1, INPUT); //TX
- pinMode(3, INPUT); //RX
- uart->rxPin = 13;
- uart->txPin = 15;
- } else {
- pinMode(1, SPECIAL); //TX
- pinMode(3, SPECIAL); //RX
- USWAP &= ~(1 << USWAP0);
- pinMode(15, INPUT); //TX
- pinMode(13, INPUT); //RX
- uart->rxPin = 3;
- uart->txPin = 1;
- }
-
- break;
- case UART1:
- // current no swap possible! see GPIO pins used by UART
- break;
- default:
- break;
- }
-}
-
-// ####################################################################################################
-// ####################################################################################################
-// ####################################################################################################
-
-void uart_ignore_char(char c) {
-}
-
-void uart0_write_char(char c) {
- if(&Serial != NULL && Serial.isTxEnabled()) {
- if(Serial.availableForWrite() > 0) {
- if(c == '\n') {
- Serial.write('\r');
- }
- Serial.write(c);
- return;
- }
- }
-
- // wait for the Hardware FIFO
- while(true) {
- if(((USS(0) >> USTXC) & 0xff) <= (UART_TX_FIFO_SIZE - 2)) {
- break;
- }
- }
-
- if(c == '\n') {
- USF(0) = '\r';
- }
- USF(0) = c;
-}
-
-void uart1_write_char(char c) {
- if(&Serial1 != NULL && Serial1.isTxEnabled()) {
- if(Serial1.availableForWrite() > 0) {
- if(c == '\n') {
- Serial1.write('\r');
- }
- Serial1.write(c);
- return;
- }
- }
-
- // wait for the Hardware FIFO
- while(true) {
- if(((USS(1) >> USTXC) & 0xff) <= (UART_TX_FIFO_SIZE - 2)) {
- break;
- }
- }
-
- if(c == '\n') {
- USF(1) = '\r';
- }
- USF(1) = c;
-}
-
-static int s_uart_debug_nr = UART0;
-
-void uart_set_debug(int uart_nr) {
- s_uart_debug_nr = uart_nr;
- switch(s_uart_debug_nr) {
- case UART0:
- system_set_os_print(1);
- ets_install_putc1((void *) &uart0_write_char);
- break;
- case UART1:
- system_set_os_print(1);
- ets_install_putc1((void *) &uart1_write_char);
- break;
- case UART_NO:
- default:
- system_set_os_print(0);
- ets_install_putc1((void *) &uart_ignore_char);
- break;
- }
-}
-
-int uart_get_debug() {
- return s_uart_debug_nr;
-}
-
-// ####################################################################################################
-// ####################################################################################################
-// ####################################################################################################
-
-HardwareSerial::HardwareSerial(int uart_nr) :
- _uart_nr(uart_nr), _uart(0), _tx_buffer(0), _rx_buffer(0), _written(false) {
-}
-
-void HardwareSerial::begin(unsigned long baud, byte config) {
-
- // disable debug for this interface
- if(uart_get_debug() == _uart_nr) {
- uart_set_debug(UART_NO);
- }
-
- _uart = uart_init(_uart_nr, baud, config);
-
- if(_uart == 0) {
- return;
- }
-
- if(_uart->rxEnabled) {
- if(!_rx_buffer)
- _rx_buffer = new cbuf(SERIAL_RX_BUFFER_SIZE);
- }
- if(_uart->txEnabled) {
- if(!_tx_buffer)
- _tx_buffer = new cbuf(SERIAL_TX_BUFFER_SIZE);
- }
- _written = false;
- delay(1);
-}
-
-void HardwareSerial::end() {
- if(uart_get_debug() == _uart_nr) {
- uart_set_debug(UART_NO);
- }
- uart_uninit(_uart);
- delete _rx_buffer;
- delete _tx_buffer;
- _uart = 0;
- _rx_buffer = 0;
- _tx_buffer = 0;
-}
-
-void HardwareSerial::swap() {
- if(_uart == 0)
- return;
- uart_swap(_uart);
-}
-
-void HardwareSerial::setDebugOutput(bool en) {
- if(_uart == 0)
- return;
- if(en) {
- uart_set_debug(_uart->uart_nr);
- } else {
- // disable debug for this interface
- if(uart_get_debug() == _uart_nr) {
- uart_set_debug(UART_NO);
- }
- }
-}
-
-bool HardwareSerial::isTxEnabled(void) {
- if(_uart == 0)
- return false;
- return _uart->txEnabled;
-}
-
-bool HardwareSerial::isRxEnabled(void) {
- if(_uart == 0)
- return false;
- return _uart->rxEnabled;
-}
-
-int HardwareSerial::available(void) {
- if(_uart == 0)
- return 0;
- if(_uart->rxEnabled) {
- return static_cast(_rx_buffer->getSize());
- } else {
- return 0;
- }
-}
-
-int HardwareSerial::peek(void) {
- if(_uart == 0)
- return -1;
- if(_uart->rxEnabled) {
- return _rx_buffer->peek();
- } else {
- return -1;
- }
-}
-
-int HardwareSerial::read(void) {
- if(_uart == 0)
- return -1;
- if(_uart->rxEnabled) {
- return _rx_buffer->read();
- } else {
- return -1;
- }
-}
-
-int HardwareSerial::availableForWrite(void) {
- if(_uart == 0)
- return 0;
- if(_uart->txEnabled) {
- return static_cast(_tx_buffer->room());
- } else {
- return 0;
- }
-}
-
-void HardwareSerial::flush() {
- if(_uart == 0)
- return;
- if(!_uart->txEnabled)
- return;
- if(!_written)
- return;
-
- while(_tx_buffer->getSize() || uart_get_tx_fifo_room(_uart) < UART_TX_FIFO_SIZE)
- yield();
-
- _written = false;
-}
-
-size_t HardwareSerial::write(uint8_t c) {
- if(_uart == 0 || !_uart->txEnabled)
- return 0;
- _written = true;
- size_t room = uart_get_tx_fifo_room(_uart);
- if(room > 0 && _tx_buffer->empty()) {
- uart_transmit_char(_uart, c);
- if(room < 10) {
- uart_arm_tx_interrupt(_uart);
- }
- return 1;
- }
-
- while(_tx_buffer->room() == 0) {
- yield();
- }
-
- _tx_buffer->write(c);
- return 1;
-}
-
-HardwareSerial::operator bool() const {
- return _uart != 0;
-}
-
-void HardwareSerial::_rx_complete_irq(char c) {
- if(_rx_buffer) {
- _rx_buffer->write(c);
- }
-}
-
-void HardwareSerial::_tx_empty_irq(void) {
- if(_uart == 0)
- return;
- if(_tx_buffer == 0)
- return;
- size_t queued = _tx_buffer->getSize();
- if(!queued) {
- uart_disarm_tx_interrupt(_uart);
- return;
- }
-
- size_t room = uart_get_tx_fifo_room(_uart);
- int n = static_cast((queued < room) ? queued : room);
- while(n--) {
- uart_transmit_char(_uart, _tx_buffer->read());
- }
-}
diff --git a/sparkfun/esp8266/cores/esp8266/HardwareSerial.h b/sparkfun/esp8266/cores/esp8266/HardwareSerial.h
deleted file mode 100644
index b196ff38..00000000
--- a/sparkfun/esp8266/cores/esp8266/HardwareSerial.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- HardwareSerial.h - Hardware serial library for Wiring
- Copyright (c) 2006 Nicholas Zambetti. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Modified 28 September 2010 by Mark Sproul
- Modified 14 August 2012 by Alarus
- Modified 3 December 2013 by Matthijs Kooijman
- Modified 18 December 2014 by Ivan Grokhotkov (esp8266 platform support)
- Modified 31 March 2015 by Markus Sattler (rewrite the code for UART0 + UART1 support in ESP8266)
- Modified 25 April 2015 by Thomas Flayols (add configuration different from 8N1 in ESP8266)
- */
-
-#ifndef HardwareSerial_h
-#define HardwareSerial_h
-
-#include
-
-#include "Stream.h"
-
-#define SERIAL_TX_BUFFER_SIZE 256
-#define SERIAL_RX_BUFFER_SIZE 256
-
-// Define config for Serial.begin(baud, config);
-#define SERIAL_5N1 0x10
-#define SERIAL_6N1 0x14
-#define SERIAL_7N1 0x18
-#define SERIAL_8N1 0x1c
-#define SERIAL_5N2 0x30
-#define SERIAL_6N2 0x34
-#define SERIAL_7N2 0x38
-#define SERIAL_8N2 0x3c
-#define SERIAL_5E1 0x12
-#define SERIAL_6E1 0x16
-#define SERIAL_7E1 0x1a
-#define SERIAL_8E1 0x1e
-#define SERIAL_5E2 0x32
-#define SERIAL_6E2 0x36
-#define SERIAL_7E2 0x3a
-#define SERIAL_8E2 0x3e
-#define SERIAL_5O1 0x13
-#define SERIAL_6O1 0x17
-#define SERIAL_7O1 0x1b
-#define SERIAL_8O1 0x1f
-#define SERIAL_5O2 0x33
-#define SERIAL_6O2 0x37
-#define SERIAL_7O2 0x3b
-#define SERIAL_8O2 0x3f
-
-class cbuf;
-
-struct uart_;
-typedef struct uart_ uart_t;
-
-class HardwareSerial: public Stream {
- public:
- HardwareSerial(int uart_nr);
-
- void begin(unsigned long baud) {
- begin(baud, SERIAL_8N1);
- }
- void begin(unsigned long, uint8_t);
- void end();
- void swap(); //toggle between use of GPIO13/GPIO15 or GPIO3/GPIO1 as RX and TX
- int available(void) override;
- int peek(void) override;
- int read(void) override;
- int availableForWrite(void);
- void flush(void) override;
- size_t write(uint8_t) override;
- inline size_t write(unsigned long n) {
- return write((uint8_t) n);
- }
- inline size_t write(long n) {
- return write((uint8_t) n);
- }
- inline size_t write(unsigned int n) {
- return write((uint8_t) n);
- }
- inline size_t write(int n) {
- return write((uint8_t) n);
- }
- using Print::write; // pull in write(str) and write(buf, size) from Print
- operator bool() const;
-
- void setDebugOutput(bool);
- bool isTxEnabled(void);
- bool isRxEnabled(void);
-
- protected:
- friend void uart_interrupt_handler(uart_t* uart);
- void _rx_complete_irq(char c);
- void _tx_empty_irq(void);
-
- protected:
- int _uart_nr;
- uart_t* _uart;
- cbuf* _tx_buffer;
- cbuf* _rx_buffer;
- bool _written;
-};
-
-extern HardwareSerial Serial;
-extern HardwareSerial Serial1;
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/IPAddress.cpp b/sparkfun/esp8266/cores/esp8266/IPAddress.cpp
deleted file mode 100644
index dea1d18a..00000000
--- a/sparkfun/esp8266/cores/esp8266/IPAddress.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- IPAddress.cpp - Base class that provides IPAddress
- Copyright (c) 2011 Adrian McEwen. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include
-#include
-#include
-
-IPAddress::IPAddress() {
- _address.dword = 0;
-}
-
-IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) {
- _address.bytes[0] = first_octet;
- _address.bytes[1] = second_octet;
- _address.bytes[2] = third_octet;
- _address.bytes[3] = fourth_octet;
-}
-
-IPAddress::IPAddress(uint32_t address) {
- _address.dword = address;
-}
-
-IPAddress::IPAddress(const uint8_t *address) {
- memcpy(_address.bytes, address, sizeof(_address.bytes));
-}
-
-IPAddress& IPAddress::operator=(const uint8_t *address) {
- memcpy(_address.bytes, address, sizeof(_address.bytes));
- return *this;
-}
-
-IPAddress& IPAddress::operator=(uint32_t address) {
- _address.dword = address;
- return *this;
-}
-
-bool IPAddress::operator==(const uint8_t* addr) const {
- return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
-}
-
-size_t IPAddress::printTo(Print& p) const {
- size_t n = 0;
- for(int i = 0; i < 3; i++) {
- n += p.print(_address.bytes[i], DEC);
- n += p.print('.');
- }
- n += p.print(_address.bytes[3], DEC);
- return n;
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/IPAddress.h b/sparkfun/esp8266/cores/esp8266/IPAddress.h
deleted file mode 100644
index 73c6cbdf..00000000
--- a/sparkfun/esp8266/cores/esp8266/IPAddress.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- IPAddress.h - Base class that provides IPAddress
- Copyright (c) 2011 Adrian McEwen. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef IPAddress_h
-#define IPAddress_h
-
-#include
-#include
-
-// A class to make it easier to handle and pass around IP addresses
-
-class IPAddress: public Printable {
- private:
- union {
- uint8_t bytes[4]; // IPv4 address
- uint32_t dword;
- } _address;
-
- // Access the raw byte array containing the address. Because this returns a pointer
- // to the internal structure rather than a copy of the address this function should only
- // be used when you know that the usage of the returned uint8_t* will be transient and not
- // stored.
- uint8_t* raw_address() {
- return _address.bytes;
- }
-
- public:
- // Constructors
- IPAddress();
- IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
- IPAddress(uint32_t address);
- IPAddress(const uint8_t *address);
-
- // Overloaded cast operator to allow IPAddress objects to be used where a pointer
- // to a four-byte uint8_t array is expected
- operator uint32_t() const {
- return _address.dword;
- }
- bool operator==(const IPAddress& addr) const {
- return _address.dword == addr._address.dword;
- }
- bool operator==(const uint8_t* addr) const;
-
- // Overloaded index operator to allow getting and setting individual octets of the address
- uint8_t operator[](int index) const {
- return _address.bytes[index];
- }
- uint8_t& operator[](int index) {
- return _address.bytes[index];
- }
-
- // Overloaded copy operators to allow initialisation of IPAddress objects from other types
- IPAddress& operator=(const uint8_t *address);
- IPAddress& operator=(uint32_t address);
-
- virtual size_t printTo(Print& p) const;
-
- friend class EthernetClass;
- friend class UDP;
- friend class Client;
- friend class Server;
- friend class DhcpClass;
- friend class DNSClient;
-};
-
-const IPAddress INADDR_NONE(0, 0, 0, 0);
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/Print.cpp b/sparkfun/esp8266/cores/esp8266/Print.cpp
deleted file mode 100644
index 1f924248..00000000
--- a/sparkfun/esp8266/cores/esp8266/Print.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- Print.cpp - Base class that provides print() and println()
- Copyright (c) 2008 David A. Mellis. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Modified 23 November 2006 by David A. Mellis
- Modified December 2014 by Ivan Grokhotkov
- Modified May 2015 by Michael C. Miller - esp8266 progmem support
- */
-
-#include
-#include
-#include
-#include
-#include "Arduino.h"
-
-#include "Print.h"
-extern "C" {
-#include "c_types.h"
-#include "ets_sys.h"
-}
-
-// Public Methods //////////////////////////////////////////////////////////////
-
-/* default implementation: may be overridden */
-size_t ICACHE_FLASH_ATTR Print::write(const uint8_t *buffer, size_t size) {
- size_t n = 0;
- while(size--) {
- n += write(*buffer++);
- }
- return n;
-}
-
-size_t Print::printf(const char *format, ...) {
- va_list arg;
- va_start(arg, format);
- char temp[256];
- size_t len = ets_vsnprintf(temp, 256, format, arg);
- len = print(temp);
- va_end(arg);
- return len;
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(const __FlashStringHelper *ifsh) {
- PGM_P p = reinterpret_cast(ifsh);
-
- size_t n = 0;
- while (1) {
- uint8_t c = pgm_read_byte(p++);
- if (c == 0) break;
- n += write(c);
- }
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(const String &s) {
- return write(s.c_str(), s.length());
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(const char str[]) {
- return write(str);
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(char c) {
- return write(c);
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(unsigned char b, int base) {
- return print((unsigned long) b, base);
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(int n, int base) {
- return print((long) n, base);
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(unsigned int n, int base) {
- return print((unsigned long) n, base);
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(long n, int base) {
- if(base == 0) {
- return write(n);
- } else if(base == 10) {
- if(n < 0) {
- int t = print('-');
- n = -n;
- return printNumber(n, 10) + t;
- }
- return printNumber(n, 10);
- } else {
- return printNumber(n, base);
- }
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(unsigned long n, int base) {
- if(base == 0)
- return write(n);
- else
- return printNumber(n, base);
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(double n, int digits) {
- return printFloat(n, digits);
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(const __FlashStringHelper *ifsh) {
- size_t n = print(ifsh);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::print(const Printable& x) {
- return x.printTo(*this);
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(void) {
- size_t n = print("\r\n");
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(const String &s) {
- size_t n = print(s);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(const char c[]) {
- size_t n = print(c);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(char c) {
- size_t n = print(c);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(unsigned char b, int base) {
- size_t n = print(b, base);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(int num, int base) {
- size_t n = print(num, base);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(unsigned int num, int base) {
- size_t n = print(num, base);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(long num, int base) {
- size_t n = print(num, base);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(unsigned long num, int base) {
- size_t n = print(num, base);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(double num, int digits) {
- size_t n = print(num, digits);
- n += println();
- return n;
-}
-
-size_t ICACHE_FLASH_ATTR Print::println(const Printable& x) {
- size_t n = print(x);
- n += println();
- return n;
-}
-
-// Private Methods /////////////////////////////////////////////////////////////
-
-size_t ICACHE_FLASH_ATTR Print::printNumber(unsigned long n, uint8_t base) {
- char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
- char *str = &buf[sizeof(buf) - 1];
-
- *str = '\0';
-
- // prevent crash if called with base == 1
- if(base < 2)
- base = 10;
-
- do {
- unsigned long m = n;
- n /= base;
- char c = m - base * n;
- *--str = c < 10 ? c + '0' : c + 'A' - 10;
- } while(n);
-
- return write(str);
-}
-
-size_t ICACHE_FLASH_ATTR Print::printFloat(double number, uint8_t digits) {
- size_t n = 0;
-
- if(isnan(number))
- return print("nan");
- if(isinf(number))
- return print("inf");
- if(number > 4294967040.0)
- return print("ovf"); // constant determined empirically
- if(number < -4294967040.0)
- return print("ovf"); // constant determined empirically
-
- // Handle negative numbers
- if(number < 0.0) {
- n += print('-');
- number = -number;
- }
-
- // Round correctly so that print(1.999, 2) prints as "2.00"
- double rounding = 0.5;
- for(uint8_t i = 0; i < digits; ++i)
- rounding /= 10.0;
-
- number += rounding;
-
- // Extract the integer part of the number and print it
- unsigned long int_part = (unsigned long) number;
- double remainder = number - (double) int_part;
- n += print(int_part);
-
- // Print the decimal point, but only if there are digits beyond
- if(digits > 0) {
- n += print(".");
- }
-
- // Extract digits from the remainder one at a time
- while(digits-- > 0) {
- remainder *= 10.0;
- int toPrint = int(remainder);
- n += print(toPrint);
- remainder -= toPrint;
- }
-
- return n;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/Print.h b/sparkfun/esp8266/cores/esp8266/Print.h
deleted file mode 100644
index 7366174f..00000000
--- a/sparkfun/esp8266/cores/esp8266/Print.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- Print.h - Base class that provides print() and println()
- Copyright (c) 2008 David A. Mellis. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef Print_h
-#define Print_h
-
-#include
-#include
-
-#include "WString.h"
-#include "Printable.h"
-
-#define DEC 10
-#define HEX 16
-#define OCT 8
-#define BIN 2
-
-class Print {
- private:
- int write_error;
- size_t printNumber(unsigned long, uint8_t);
- size_t printFloat(double, uint8_t);
- protected:
- void setWriteError(int err = 1) {
- write_error = err;
- }
- public:
- Print() :
- write_error(0) {
- }
-
- int getWriteError() {
- return write_error;
- }
- void clearWriteError() {
- setWriteError(0);
- }
-
- virtual size_t write(uint8_t) = 0;
- size_t write(const char *str) {
- if(str == NULL)
- return 0;
- return write((const uint8_t *) str, strlen(str));
- }
- virtual size_t write(const uint8_t *buffer, size_t size);
- size_t write(const char *buffer, size_t size) {
- return write((const uint8_t *) buffer, size);
- }
-
- size_t printf(const char * format, ...);
- size_t print(const __FlashStringHelper *);
- size_t print(const String &);
- size_t print(const char[]);
- size_t print(char);
- size_t print(unsigned char, int = DEC);
- size_t print(int, int = DEC);
- size_t print(unsigned int, int = DEC);
- size_t print(long, int = DEC);
- size_t print(unsigned long, int = DEC);
- size_t print(double, int = 2);
- size_t print(const Printable&);
-
- size_t println(const __FlashStringHelper *);
- size_t println(const String &s);
- size_t println(const char[]);
- size_t println(char);
- size_t println(unsigned char, int = DEC);
- size_t println(int, int = DEC);
- size_t println(unsigned int, int = DEC);
- size_t println(long, int = DEC);
- size_t println(unsigned long, int = DEC);
- size_t println(double, int = 2);
- size_t println(const Printable&);
- size_t println(void);
-};
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/Printable.h b/sparkfun/esp8266/cores/esp8266/Printable.h
deleted file mode 100644
index 072b4806..00000000
--- a/sparkfun/esp8266/cores/esp8266/Printable.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- Printable.h - Interface class that allows printing of complex types
- Copyright (c) 2011 Adrian McEwen. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef Printable_h
-#define Printable_h
-
-#include
-
-class Print;
-
-/** The Printable class provides a way for new classes to allow themselves to be printed.
- By deriving from Printable and implementing the printTo method, it will then be possible
- for users to print out instances of this class by passing them into the usual
- Print::print and Print::println methods.
- */
-
-class Printable {
- public:
- virtual size_t printTo(Print& p) const = 0;
-};
-
-#endif
-
diff --git a/sparkfun/esp8266/cores/esp8266/Server.h b/sparkfun/esp8266/cores/esp8266/Server.h
deleted file mode 100644
index db5369f4..00000000
--- a/sparkfun/esp8266/cores/esp8266/Server.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Server.h - Base class that provides Server
- Copyright (c) 2011 Adrian McEwen. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef server_h
-#define server_h
-
-#include "Print.h"
-
-class Server: public Print {
- public:
- virtual void begin() =0;
-};
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/Stream.cpp b/sparkfun/esp8266/cores/esp8266/Stream.cpp
deleted file mode 100644
index c44fc248..00000000
--- a/sparkfun/esp8266/cores/esp8266/Stream.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- Stream.cpp - adds parsing methods to Stream class
- Copyright (c) 2008 David A. Mellis. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Created July 2011
- parsing functions based on TextFinder library by Michael Margolis
- */
-
-#include "Arduino.h"
-#include "Stream.h"
-extern "C" {
-#include "c_types.h"
-}
-#define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait
-#define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field
-
-// private method to read stream with timeout
-int ICACHE_FLASH_ATTR Stream::timedRead() {
- int c;
- _startMillis = millis();
- do {
- c = read();
- if(c >= 0)
- return c;
- yield();
- } while(millis() - _startMillis < _timeout);
- return -1; // -1 indicates timeout
-}
-
-// private method to peek stream with timeout
-int ICACHE_FLASH_ATTR Stream::timedPeek() {
- int c;
- _startMillis = millis();
- do {
- c = peek();
- if(c >= 0)
- return c;
- yield();
- } while(millis() - _startMillis < _timeout);
- return -1; // -1 indicates timeout
-}
-
-// returns peek of the next digit in the stream or -1 if timeout
-// discards non-numeric characters
-int ICACHE_FLASH_ATTR Stream::peekNextDigit() {
- int c;
- while(1) {
- c = timedPeek();
- if(c < 0)
- return c; // timeout
- if(c == '-')
- return c;
- if(c >= '0' && c <= '9')
- return c;
- read(); // discard non-numeric
- }
-}
-
-// Public Methods
-//////////////////////////////////////////////////////////////
-
-void ICACHE_FLASH_ATTR Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait
-{
- _timeout = timeout;
-}
-
-// find returns true if the target string is found
-bool ICACHE_FLASH_ATTR Stream::find(const char *target) {
- return findUntil(target, (char*) "");
-}
-
-// reads data from the stream until the target string of given length is found
-// returns true if target string is found, false if timed out
-bool ICACHE_FLASH_ATTR Stream::find(const char *target, size_t length) {
- return findUntil(target, length, NULL, 0);
-}
-
-// as find but search ends if the terminator string is found
-bool ICACHE_FLASH_ATTR Stream::findUntil(const char *target, const char *terminator) {
- return findUntil(target, strlen(target), terminator, strlen(terminator));
-}
-
-// reads data from the stream until the target string of the given length is found
-// search terminated if the terminator string is found
-// returns true if target string is found, false if terminated or timed out
-bool ICACHE_FLASH_ATTR Stream::findUntil(const char *target, size_t targetLen, const char *terminator, size_t termLen) {
- size_t index = 0; // maximum target string length is 64k bytes!
- size_t termIndex = 0;
- int c;
-
- if(*target == 0)
- return true; // return true if target is a null string
- while((c = timedRead()) > 0) {
-
- if(c != target[index])
- index = 0; // reset index if any char does not match
-
- if(c == target[index]) {
- //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);
- if(++index >= targetLen) { // return true if all chars in the target match
- return true;
- }
- }
-
- if(termLen > 0 && c == terminator[termIndex]) {
- if(++termIndex >= termLen)
- return false; // return false if terminate string found before target string
- } else
- termIndex = 0;
- }
- return false;
-}
-
-// returns the first valid (long) integer value from the current position.
-// initial characters that are not digits (or the minus sign) are skipped
-// function is terminated by the first character that is not a digit.
-long ICACHE_FLASH_ATTR Stream::parseInt() {
- return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout)
-}
-
-// as above but a given skipChar is ignored
-// this allows format characters (typically commas) in values to be ignored
-long ICACHE_FLASH_ATTR Stream::parseInt(char skipChar) {
- boolean isNegative = false;
- long value = 0;
- int c;
-
- c = peekNextDigit();
- // ignore non numeric leading characters
- if(c < 0)
- return 0; // zero returned if timeout
-
- do {
- if(c == skipChar)
- ; // ignore this charactor
- else if(c == '-')
- isNegative = true;
- else if(c >= '0' && c <= '9') // is c a digit?
- value = value * 10 + c - '0';
- read(); // consume the character we got with peek
- c = timedPeek();
- } while((c >= '0' && c <= '9') || c == skipChar);
-
- if(isNegative)
- value = -value;
- return value;
-}
-
-// as parseInt but returns a floating point value
-float ICACHE_FLASH_ATTR Stream::parseFloat() {
- return parseFloat(NO_SKIP_CHAR);
-}
-
-// as above but the given skipChar is ignored
-// this allows format characters (typically commas) in values to be ignored
-float ICACHE_FLASH_ATTR Stream::parseFloat(char skipChar) {
- boolean isNegative = false;
- boolean isFraction = false;
- long value = 0;
- int c;
- float fraction = 1.0;
-
- c = peekNextDigit();
- // ignore non numeric leading characters
- if(c < 0)
- return 0; // zero returned if timeout
-
- do {
- if(c == skipChar)
- ; // ignore
- else if(c == '-')
- isNegative = true;
- else if(c == '.')
- isFraction = true;
- else if(c >= '0' && c <= '9') { // is c a digit?
- value = value * 10 + c - '0';
- if(isFraction)
- fraction *= 0.1;
- }
- read(); // consume the character we got with peek
- c = timedPeek();
- } while((c >= '0' && c <= '9') || c == '.' || c == skipChar);
-
- if(isNegative)
- value = -value;
- if(isFraction)
- return value * fraction;
- else
- return value;
-}
-
-// read characters from stream into buffer
-// terminates if length characters have been read, or timeout (see setTimeout)
-// returns the number of characters placed in the buffer
-// the buffer is NOT null terminated.
-//
-size_t ICACHE_FLASH_ATTR Stream::readBytes(char *buffer, size_t length) {
- size_t count = 0;
- while(count < length) {
- int c = timedRead();
- if(c < 0)
- break;
- *buffer++ = (char) c;
- count++;
- }
- return count;
-}
-
-// as readBytes with terminator character
-// terminates if length characters have been read, timeout, or if the terminator character detected
-// returns the number of characters placed in the buffer (0 means no valid data found)
-
-size_t ICACHE_FLASH_ATTR Stream::readBytesUntil(char terminator, char *buffer, size_t length) {
- if(length < 1)
- return 0;
- size_t index = 0;
- while(index < length) {
- int c = timedRead();
- if(c < 0 || c == terminator)
- break;
- *buffer++ = (char) c;
- index++;
- }
- return index; // return number of characters, not including null terminator
-}
-
-String ICACHE_FLASH_ATTR Stream::readString() {
- String ret;
- int c = timedRead();
- while(c >= 0) {
- ret += (char) c;
- c = timedRead();
- }
- return ret;
-}
-
-String ICACHE_FLASH_ATTR Stream::readStringUntil(char terminator) {
- String ret;
- int c = timedRead();
- while(c >= 0 && c != terminator) {
- ret += (char) c;
- c = timedRead();
- }
- return ret;
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/Stream.h b/sparkfun/esp8266/cores/esp8266/Stream.h
deleted file mode 100644
index 6d08ef1d..00000000
--- a/sparkfun/esp8266/cores/esp8266/Stream.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- Stream.h - base class for character-based streams.
- Copyright (c) 2010 David A. Mellis. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- parsing functions based on TextFinder library by Michael Margolis
- */
-
-#ifndef Stream_h
-#define Stream_h
-
-#include
-#include "Print.h"
-
-// compatability macros for testing
-/*
- #define getInt() parseInt()
- #define getInt(skipChar) parseInt(skipchar)
- #define getFloat() parseFloat()
- #define getFloat(skipChar) parseFloat(skipChar)
- #define getString( pre_string, post_string, buffer, length)
- readBytesBetween( pre_string, terminator, buffer, length)
- */
-
-class Stream: public Print {
- protected:
- unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
- unsigned long _startMillis; // used for timeout measurement
- int timedRead(); // private method to read stream with timeout
- int timedPeek(); // private method to peek stream with timeout
- int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout
-
- public:
- virtual int available() = 0;
- virtual int read() = 0;
- virtual int peek() = 0;
- virtual void flush() = 0;
-
- Stream() {
- _timeout = 1000;
- }
-
-// parsing methods
-
- void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
-
- bool find(const char *target); // reads data from the stream until the target string is found
- bool find(uint8_t *target) {
- return find((char *) target);
- }
- // returns true if target string is found, false if timed out (see setTimeout)
-
- bool find(const char *target, size_t length); // reads data from the stream until the target string of given length is found
- bool find(const uint8_t *target, size_t length) {
- return find((char *) target, length);
- }
- // returns true if target string is found, false if timed out
-
- bool findUntil(const char *target, const char *terminator); // as find but search ends if the terminator string is found
- bool findUntil(const uint8_t *target, const char *terminator) {
- return findUntil((char *) target, terminator);
- }
-
- bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); // as above but search ends if the terminate string is found
- bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) {
- return findUntil((char *) target, targetLen, terminate, termLen);
- }
-
- long parseInt(); // returns the first valid (long) integer value from the current position.
- // initial characters that are not digits (or the minus sign) are skipped
- // integer is terminated by the first character that is not a digit.
-
- float parseFloat(); // float version of parseInt
-
- size_t readBytes(char *buffer, size_t length); // read chars from stream into buffer
- size_t readBytes(uint8_t *buffer, size_t length) {
- return readBytes((char *) buffer, length);
- }
- // terminates if length characters have been read or timeout (see setTimeout)
- // returns the number of characters placed in the buffer (0 means no valid data found)
-
- size_t readBytesUntil(char terminator, char *buffer, size_t length); // as readBytes with terminator character
- size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) {
- return readBytesUntil(terminator, (char *) buffer, length);
- }
- // terminates if length characters have been read, timeout, or if the terminator character detected
- // returns the number of characters placed in the buffer (0 means no valid data found)
-
- // Arduino String functions to be added here
- String readString();
- String readStringUntil(char terminator);
-
- protected:
- long parseInt(char skipChar); // as above but the given skipChar is ignored
- // as above but the given skipChar is ignored
- // this allows format characters (typically commas) in values to be ignored
-
- float parseFloat(char skipChar); // as above but the given skipChar is ignored
-};
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/Tone.cpp b/sparkfun/esp8266/cores/esp8266/Tone.cpp
deleted file mode 100644
index f85ed404..00000000
--- a/sparkfun/esp8266/cores/esp8266/Tone.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Tone.cpp
-
- A Tone Generator Library
-
- Written by Brett Hagman
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Version Modified By Date Comments
- ------- ----------- -------- --------
- 0001 B Hagman 09/08/02 Initial coding
- 0002 B Hagman 09/08/18 Multiple pins
- 0003 B Hagman 09/08/18 Moved initialization from constructor to begin()
- 0004 B Hagman 09/09/26 Fixed problems with ATmega8
- 0005 B Hagman 09/11/23 Scanned prescalars for best fit on 8 bit timers
- 09/11/25 Changed pin toggle method to XOR
- 09/11/25 Fixed timer0 from being excluded
- 0006 D Mellis 09/12/29 Replaced objects with functions
- 0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register
- 0008 S Kanemoto 12/06/22 Fixed for Leonardo by @maris_HY
- *************************************************/
-
-#include "Arduino.h"
-#include "pins_arduino.h"
-
-static int8_t toneBegin(uint8_t _pin) {
- //TODO implement tone
- return 0;
-}
-
-void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) {
- //TODO implement tone
-}
-
-void noTone(uint8_t _pin) {
- //TODO implement tone
-}
diff --git a/sparkfun/esp8266/cores/esp8266/Udp.h b/sparkfun/esp8266/cores/esp8266/Udp.h
deleted file mode 100644
index baf70781..00000000
--- a/sparkfun/esp8266/cores/esp8266/Udp.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Udp.cpp: Library to send/receive UDP packets.
- *
- * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
- * 1) UDP does not guarantee the order in which assembled UDP packets are received. This
- * might not happen often in practice, but in larger network topologies, a UDP
- * packet can be received out of sequence.
- * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
- * aware of it. Again, this may not be a concern in practice on small local networks.
- * For more information, see http://www.cafeaulait.org/course/week12/35.html
- *
- * MIT License:
- * Copyright (c) 2008 Bjoern Hartmann
- * 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.
- *
- * bjoern@cs.stanford.edu 12/30/2008
- */
-
-#ifndef udp_h
-#define udp_h
-
-#include
-#include
-
-class UDP: public Stream {
-
- public:
- virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
- virtual void stop() =0; // Finish with the UDP socket
-
- // Sending UDP packets
-
- // Start building up a packet to send to the remote host specific in ip and port
- // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
- virtual int beginPacket(IPAddress ip, uint16_t port) =0;
- // Start building up a packet to send to the remote host specific in host and port
- // Returns 1 if successful, 0 if there was a problem resolving the hostname or port
- virtual int beginPacket(const char *host, uint16_t port) =0;
- // Finish off this packet and send it
- // Returns 1 if the packet was sent successfully, 0 if there was an error
- virtual int endPacket() =0;
- // Write a single byte into the packet
- virtual size_t write(uint8_t) =0;
- // Write size bytes from buffer into the packet
- virtual size_t write(const uint8_t *buffer, size_t size) =0;
-
- // Start processing the next available incoming packet
- // Returns the size of the packet in bytes, or 0 if no packets are available
- virtual int parsePacket() =0;
- // Number of bytes remaining in the current packet
- virtual int available() =0;
- // Read a single byte from the current packet
- virtual int read() =0;
- // Read up to len bytes from the current packet and place them into buffer
- // Returns the number of bytes read, or 0 if none are available
- virtual int read(unsigned char* buffer, size_t len) =0;
- // Read up to len characters from the current packet and place them into buffer
- // Returns the number of characters read, or 0 if none are available
- virtual int read(char* buffer, size_t len) =0;
- // Return the next byte from the current packet without moving on to the next byte
- virtual int peek() =0;
- virtual void flush() =0; // Finish reading the current packet
-
- // Return the IP address of the host who sent the current incoming packet
- virtual IPAddress remoteIP() =0;
- // Return the port of the host who sent the current incoming packet
- virtual uint16_t remotePort() =0;
- protected:
- uint8_t* rawIPAddress(IPAddress& addr) {
- return addr.raw_address();
- }
-};
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/WCharacter.h b/sparkfun/esp8266/cores/esp8266/WCharacter.h
deleted file mode 100644
index f37ddb71..00000000
--- a/sparkfun/esp8266/cores/esp8266/WCharacter.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- WCharacter.h - Character utility functions for Wiring & Arduino
- Copyright (c) 2010 Hernando Barragan. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef Character_h
-#define Character_h
-
-#include
-#define isascii(__c) ((unsigned)(__c)<=0177)
-#define toascii(__c) ((__c)&0177)
-
-// WCharacter.h prototypes
-inline boolean isAlphaNumeric(int c) __attribute__((always_inline));
-inline boolean isAlpha(int c) __attribute__((always_inline));
-inline boolean isAscii(int c) __attribute__((always_inline));
-inline boolean isWhitespace(int c) __attribute__((always_inline));
-inline boolean isControl(int c) __attribute__((always_inline));
-inline boolean isDigit(int c) __attribute__((always_inline));
-inline boolean isGraph(int c) __attribute__((always_inline));
-inline boolean isLowerCase(int c) __attribute__((always_inline));
-inline boolean isPrintable(int c) __attribute__((always_inline));
-inline boolean isPunct(int c) __attribute__((always_inline));
-inline boolean isSpace(int c) __attribute__((always_inline));
-inline boolean isUpperCase(int c) __attribute__((always_inline));
-inline boolean isHexadecimalDigit(int c) __attribute__((always_inline));
-inline int toAscii(int c) __attribute__((always_inline));
-inline int toLowerCase(int c) __attribute__((always_inline));
-inline int toUpperCase(int c) __attribute__((always_inline));
-
-// Checks for an alphanumeric character.
-// It is equivalent to (isalpha(c) || isdigit(c)).
-inline boolean isAlphaNumeric(int c) {
- return (isalnum(c) == 0 ? false : true);
-}
-
-// Checks for an alphabetic character.
-// It is equivalent to (isupper(c) || islower(c)).
-inline boolean isAlpha(int c) {
- return (isalpha(c) == 0 ? false : true);
-}
-
-// Checks whether c is a 7-bit unsigned char value
-// that fits into the ASCII character set.
-inline boolean isAscii(int c) {
- return ( isascii (c) == 0 ? false : true);
-}
-
-// Checks for a blank character, that is, a space or a tab.
-inline boolean isWhitespace(int c) {
- return (isblank(c) == 0 ? false : true);
-}
-
-// Checks for a control character.
-inline boolean isControl(int c) {
- return (iscntrl(c) == 0 ? false : true);
-}
-
-// Checks for a digit (0 through 9).
-inline boolean isDigit(int c) {
- return (isdigit(c) == 0 ? false : true);
-}
-
-// Checks for any printable character except space.
-inline boolean isGraph(int c) {
- return (isgraph(c) == 0 ? false : true);
-}
-
-// Checks for a lower-case character.
-inline boolean isLowerCase(int c) {
- return (islower(c) == 0 ? false : true);
-}
-
-// Checks for any printable character including space.
-inline boolean isPrintable(int c) {
- return (isprint(c) == 0 ? false : true);
-}
-
-// Checks for any printable character which is not a space
-// or an alphanumeric character.
-inline boolean isPunct(int c) {
- return (ispunct(c) == 0 ? false : true);
-}
-
-// Checks for white-space characters. For the avr-libc library,
-// these are: space, formfeed ('\f'), newline ('\n'), carriage
-// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v').
-inline boolean isSpace(int c) {
- return (isspace(c) == 0 ? false : true);
-}
-
-// Checks for an uppercase letter.
-inline boolean isUpperCase(int c) {
- return (isupper(c) == 0 ? false : true);
-}
-
-// Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7
-// 8 9 a b c d e f A B C D E F.
-inline boolean isHexadecimalDigit(int c) {
- return (isxdigit(c) == 0 ? false : true);
-}
-
-// Converts c to a 7-bit unsigned char value that fits into the
-// ASCII character set, by clearing the high-order bits.
-inline int toAscii(int c) {
- return toascii(c);
-}
-
-// Warning:
-// Many people will be unhappy if you use this function.
-// This function will convert accented letters into random
-// characters.
-
-// Converts the letter c to lower case, if possible.
-inline int toLowerCase(int c) {
- return tolower(c);
-}
-
-// Converts the letter c to upper case, if possible.
-inline int toUpperCase(int c) {
- return toupper(c);
-}
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/WMath.cpp b/sparkfun/esp8266/cores/esp8266/WMath.cpp
deleted file mode 100644
index dcd51f1f..00000000
--- a/sparkfun/esp8266/cores/esp8266/WMath.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
- Part of the Wiring project - http://wiring.org.co
- Copyright (c) 2004-06 Hernando Barragan
- Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA
-
- $Id$
- */
-
-extern "C" {
-#include
-}
-
-void randomSeed(unsigned int seed) {
- if(seed != 0) {
- srand(seed);
- }
-}
-
-long random(long howbig) {
- if(howbig == 0) {
- return 0;
- }
- return rand() % howbig;
-}
-
-long random(long howsmall, long howbig) {
- if(howsmall >= howbig) {
- return howsmall;
- }
- long diff = howbig - howsmall;
- return random(diff) + howsmall;
-}
-
-long map(long x, long in_min, long in_max, long out_min, long out_max) {
- return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
-}
-
-unsigned int makeWord(unsigned int w) {
- return w;
-}
-
-unsigned int makeWord(unsigned char h, unsigned char l) {
- return (h << 8) | l;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/WString.cpp b/sparkfun/esp8266/cores/esp8266/WString.cpp
deleted file mode 100644
index 61fc5ac9..00000000
--- a/sparkfun/esp8266/cores/esp8266/WString.cpp
+++ /dev/null
@@ -1,748 +0,0 @@
-/*
- WString.cpp - String library for Wiring & Arduino
- ...mostly rewritten by Paul Stoffregen...
- Copyright (c) 2009-10 Hernando Barragan. All rights reserved.
- Copyright 2011, Paul Stoffregen, paul@pjrc.com
- Modified by Ivan Grokhotkov, 2014 - esp8266 support
- Modified by Michael C. Miller, 2015 - esp8266 progmem support
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "WString.h"
-#include "stdlib_noniso.h"
-extern "C" {
-#include "osapi.h"
-#include "ets_sys.h"
-#include "mem.h"
-#include "c_types.h"
-}
-
-/*********************************************/
-/* Constructors */
-/*********************************************/
-
-ICACHE_FLASH_ATTR String::String(const char *cstr) {
- init();
- if(cstr)
- copy(cstr, strlen(cstr));
-}
-
-ICACHE_FLASH_ATTR String::String(const String &value) {
- init();
- *this = value;
-}
-
-ICACHE_FLASH_ATTR String::String(const __FlashStringHelper *pstr) {
- init();
- *this = pstr; // see operator =
-}
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-ICACHE_FLASH_ATTR String::String(String &&rval) {
- init();
- move(rval);
-}
-
-ICACHE_FLASH_ATTR String::String(StringSumHelper &&rval) {
- init();
- move(rval);
-}
-#endif
-
-ICACHE_FLASH_ATTR String::String(char c) {
- init();
- char buf[2];
- buf[0] = c;
- buf[1] = 0;
- *this = buf;
-}
-
-ICACHE_FLASH_ATTR String::String(unsigned char value, unsigned char base) {
- init();
- char buf[1 + 8 * sizeof(unsigned char)];
- utoa(value, buf, base);
- *this = buf;
-}
-
-ICACHE_FLASH_ATTR String::String(int value, unsigned char base) {
- init();
- char buf[2 + 8 * sizeof(int)];
- itoa(value, buf, base);
- *this = buf;
-}
-
-ICACHE_FLASH_ATTR String::String(unsigned int value, unsigned char base) {
- init();
- char buf[1 + 8 * sizeof(unsigned int)];
- utoa(value, buf, base);
- *this = buf;
-}
-
-ICACHE_FLASH_ATTR String::String(long value, unsigned char base) {
- init();
- char buf[2 + 8 * sizeof(long)];
- ltoa(value, buf, base);
- *this = buf;
-}
-
-ICACHE_FLASH_ATTR String::String(unsigned long value, unsigned char base) {
- init();
- char buf[1 + 8 * sizeof(unsigned long)];
- ultoa(value, buf, base);
- *this = buf;
-}
-
-ICACHE_FLASH_ATTR String::String(float value, unsigned char decimalPlaces) {
- init();
- char buf[33];
- *this = dtostrf(value, (decimalPlaces + 2), decimalPlaces, buf);
-}
-
-ICACHE_FLASH_ATTR String::String(double value, unsigned char decimalPlaces) {
- init();
- char buf[33];
- *this = dtostrf(value, (decimalPlaces + 2), decimalPlaces, buf);
-}
-
-ICACHE_FLASH_ATTR String::~String() {
- os_free(buffer);
-}
-
-// /*********************************************/
-// /* Memory Management */
-// /*********************************************/
-
-inline void String::init(void) {
- buffer = NULL;
- capacity = 0;
- len = 0;
-}
-
-void ICACHE_FLASH_ATTR String::invalidate(void) {
- if(buffer)
- os_free(buffer);
- buffer = NULL;
- capacity = len = 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::reserve(unsigned int size) {
- if(buffer && capacity >= size)
- return 1;
- if(changeBuffer(size)) {
- if(len == 0)
- buffer[0] = 0;
- return 1;
- }
- return 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::changeBuffer(unsigned int maxStrLen) {
- char *newbuffer = (char *) os_realloc(buffer, maxStrLen + 1);
- if(newbuffer) {
- buffer = newbuffer;
- capacity = maxStrLen;
- return 1;
- }
- return 0;
-}
-
-// /*********************************************/
-// /* Copy and Move */
-// /*********************************************/
-
-String & ICACHE_FLASH_ATTR String::copy(const char *cstr, unsigned int length) {
- if(!reserve(length)) {
- invalidate();
- return *this;
- }
- len = length;
- strcpy(buffer, cstr);
- return *this;
-}
-
-String & ICACHE_FLASH_ATTR String::copy(const __FlashStringHelper *pstr, unsigned int length) {
- if (!reserve(length)) {
- invalidate();
- return *this;
- }
- len = length;
- strcpy_P(buffer, (PGM_P)pstr);
- return *this;
-}
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-void ICACHE_FLASH_ATTR String::move(String &rhs) {
- if(buffer) {
- if(capacity >= rhs.len) {
- strcpy(buffer, rhs.buffer);
- len = rhs.len;
- rhs.len = 0;
- return;
- } else {
- os_free(buffer);
- }
- }
- buffer = rhs.buffer;
- capacity = rhs.capacity;
- len = rhs.len;
- rhs.buffer = NULL;
- rhs.capacity = 0;
- rhs.len = 0;
-}
-#endif
-
-String & ICACHE_FLASH_ATTR String::operator =(const String &rhs) {
- if(this == &rhs)
- return *this;
-
- if(rhs.buffer)
- copy(rhs.buffer, rhs.len);
- else
- invalidate();
-
- return *this;
-}
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-String & ICACHE_FLASH_ATTR String::operator =(String &&rval) {
- if(this != &rval)
- move(rval);
- return *this;
-}
-
-String & ICACHE_FLASH_ATTR String::operator =(StringSumHelper &&rval) {
- if(this != &rval)
- move(rval);
- return *this;
-}
-#endif
-
-String & ICACHE_FLASH_ATTR String::operator =(const char *cstr) {
- if(cstr)
- copy(cstr, strlen(cstr));
- else
- invalidate();
-
- return *this;
-}
-
-String & ICACHE_FLASH_ATTR String::operator = (const __FlashStringHelper *pstr)
-{
- if (pstr) copy(pstr, strlen_P((PGM_P)pstr));
- else invalidate();
-
- return *this;
-}
-
-// /*********************************************/
-// /* concat */
-// /*********************************************/
-
-unsigned char ICACHE_FLASH_ATTR String::concat(const String &s) {
- return concat(s.buffer, s.len);
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(const char *cstr, unsigned int length) {
- unsigned int newlen = len + length;
- if(!cstr)
- return 0;
- if(length == 0)
- return 1;
- if(!reserve(newlen))
- return 0;
- strcpy(buffer + len, cstr);
- len = newlen;
- return 1;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(const char *cstr) {
- if(!cstr)
- return 0;
- return concat(cstr, strlen(cstr));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(char c) {
- char buf[2];
- buf[0] = c;
- buf[1] = 0;
- return concat(buf, 1);
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(unsigned char num) {
- char buf[1 + 3 * sizeof(unsigned char)];
- itoa(num, buf, 10);
- return concat(buf, strlen(buf));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(int num) {
- char buf[2 + 3 * sizeof(int)];
- itoa(num, buf, 10);
- return concat(buf, strlen(buf));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(unsigned int num) {
- char buf[1 + 3 * sizeof(unsigned int)];
- utoa(num, buf, 10);
- return concat(buf, strlen(buf));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(long num) {
- char buf[2 + 3 * sizeof(long)];
- ltoa(num, buf, 10);
- return concat(buf, strlen(buf));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(unsigned long num) {
- char buf[1 + 3 * sizeof(unsigned long)];
- ultoa(num, buf, 10);
- return concat(buf, strlen(buf));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(float num) {
- char buf[20];
- char* string = dtostrf(num, 4, 2, buf);
- return concat(string, strlen(string));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(double num) {
- char buf[20];
- char* string = dtostrf(num, 4, 2, buf);
- return concat(string, strlen(string));
-}
-
-unsigned char ICACHE_FLASH_ATTR String::concat(const __FlashStringHelper * str) {
- if (!str) return 0;
- int length = strlen_P((PGM_P)str);
- if (length == 0) return 1;
- unsigned int newlen = len + length;
- if (!reserve(newlen)) return 0;
- strcpy_P(buffer + len, (PGM_P)str);
- len = newlen;
- return 1;
-}
-
-/*********************************************/
-/* Concatenate */
-/*********************************************/
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, const String &rhs) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(rhs.buffer, rhs.len))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, const char *cstr) {
- StringSumHelper &a = const_cast(lhs);
- if(!cstr || !a.concat(cstr, strlen(cstr)))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, char c) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(c))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, unsigned char num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, int num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, unsigned int num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, long num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, unsigned long num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, float num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator +(const StringSumHelper &lhs, double num) {
- StringSumHelper &a = const_cast(lhs);
- if(!a.concat(num))
- a.invalidate();
- return a;
-}
-
-StringSumHelper & ICACHE_FLASH_ATTR operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs)
-{
- StringSumHelper &a = const_cast(lhs);
- if (!a.concat(rhs)) a.invalidate();
- return a;
-}
-
-// /*********************************************/
-// /* Comparison */
-// /*********************************************/
-
-int ICACHE_FLASH_ATTR String::compareTo(const String &s) const {
- if(!buffer || !s.buffer) {
- if(s.buffer && s.len > 0)
- return 0 - *(unsigned char *) s.buffer;
- if(buffer && len > 0)
- return *(unsigned char *) buffer;
- return 0;
- }
- return strcmp(buffer, s.buffer);
-}
-
-unsigned char ICACHE_FLASH_ATTR String::equals(const String &s2) const {
- return (len == s2.len && compareTo(s2) == 0);
-}
-
-unsigned char ICACHE_FLASH_ATTR String::equals(const char *cstr) const {
- if(len == 0)
- return (cstr == NULL || *cstr == 0);
- if(cstr == NULL)
- return buffer[0] == 0;
- return strcmp(buffer, cstr) == 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::operator<(const String &rhs) const {
- return compareTo(rhs) < 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::operator>(const String &rhs) const {
- return compareTo(rhs) > 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::operator<=(const String &rhs) const {
- return compareTo(rhs) <= 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::operator>=(const String &rhs) const {
- return compareTo(rhs) >= 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::equalsIgnoreCase(const String &s2) const {
- if(this == &s2)
- return 1;
- if(len != s2.len)
- return 0;
- if(len == 0)
- return 1;
- const char *p1 = buffer;
- const char *p2 = s2.buffer;
- while(*p1) {
- if(tolower(*p1++) != tolower(*p2++))
- return 0;
- }
- return 1;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::startsWith(const String &s2) const {
- if(len < s2.len)
- return 0;
- return startsWith(s2, 0);
-}
-
-unsigned char ICACHE_FLASH_ATTR String::startsWith(const String &s2, unsigned int offset) const {
- if(offset > len - s2.len || !buffer || !s2.buffer)
- return 0;
- return strncmp(&buffer[offset], s2.buffer, s2.len) == 0;
-}
-
-unsigned char ICACHE_FLASH_ATTR String::endsWith(const String &s2) const {
- if(len < s2.len || !buffer || !s2.buffer)
- return 0;
- return strcmp(&buffer[len - s2.len], s2.buffer) == 0;
-}
-
-// /*********************************************/
-// /* Character Access */
-// /*********************************************/
-
-char ICACHE_FLASH_ATTR String::charAt(unsigned int loc) const {
- return operator[](loc);
-}
-
-void ICACHE_FLASH_ATTR String::setCharAt(unsigned int loc, char c) {
- if(loc < len)
- buffer[loc] = c;
-}
-
-char & ICACHE_FLASH_ATTR String::operator[](unsigned int index) {
- static char dummy_writable_char;
- if(index >= len || !buffer) {
- dummy_writable_char = 0;
- return dummy_writable_char;
- }
- return buffer[index];
-}
-
-char ICACHE_FLASH_ATTR String::operator[](unsigned int index) const {
- if(index >= len || !buffer)
- return 0;
- return buffer[index];
-}
-
-void ICACHE_FLASH_ATTR String::getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index) const {
- if(!bufsize || !buf)
- return;
- if(index >= len) {
- buf[0] = 0;
- return;
- }
- unsigned int n = bufsize - 1;
- if(n > len - index)
- n = len - index;
- strncpy((char *) buf, buffer + index, n);
- buf[n] = 0;
-}
-
-// /*********************************************/
-// /* Search */
-// /*********************************************/
-ICACHE_FLASH_ATTR ICACHE_FLASH_ATTR
-
-int ICACHE_FLASH_ATTR String::indexOf(char c) const {
- return indexOf(c, 0);
-}
-
-int ICACHE_FLASH_ATTR String::indexOf(char ch, unsigned int fromIndex) const {
- if(fromIndex >= len)
- return -1;
- const char* temp = strchr(buffer + fromIndex, ch);
- if(temp == NULL)
- return -1;
- return temp - buffer;
-}
-
-int ICACHE_FLASH_ATTR String::indexOf(const String &s2) const {
- return indexOf(s2, 0);
-}
-
-int ICACHE_FLASH_ATTR String::indexOf(const String &s2, unsigned int fromIndex) const {
- if(fromIndex >= len)
- return -1;
- const char *found = strstr(buffer + fromIndex, s2.buffer);
- if(found == NULL)
- return -1;
- return found - buffer;
-}
-
-int ICACHE_FLASH_ATTR String::lastIndexOf(char theChar) const {
- return lastIndexOf(theChar, len - 1);
-}
-
-int ICACHE_FLASH_ATTR String::lastIndexOf(char ch, unsigned int fromIndex) const {
- if(fromIndex >= len)
- return -1;
- char tempchar = buffer[fromIndex + 1];
- buffer[fromIndex + 1] = '\0';
- char* temp = strrchr(buffer, ch);
- buffer[fromIndex + 1] = tempchar;
- if(temp == NULL)
- return -1;
- return temp - buffer;
-}
-
-int ICACHE_FLASH_ATTR String::lastIndexOf(const String &s2) const {
- return lastIndexOf(s2, len - s2.len);
-}
-
-int ICACHE_FLASH_ATTR String::lastIndexOf(const String &s2, unsigned int fromIndex) const {
- if(s2.len == 0 || len == 0 || s2.len > len)
- return -1;
- if(fromIndex >= len)
- fromIndex = len - 1;
- int found = -1;
- for(char *p = buffer; p <= buffer + fromIndex; p++) {
- p = strstr(p, s2.buffer);
- if(!p)
- break;
- if((unsigned int) (p - buffer) <= fromIndex)
- found = p - buffer;
- }
- return found;
-}
-
-String ICACHE_FLASH_ATTR String::substring(unsigned int left, unsigned int right) const {
- if(left > right) {
- unsigned int temp = right;
- right = left;
- left = temp;
- }
- String out;
- if(left >= len)
- return out;
- if(right > len)
- right = len;
- char temp = buffer[right]; // save the replaced character
- buffer[right] = '\0';
- out = buffer + left; // pointer arithmetic
- buffer[right] = temp; //restore character
- return out;
-}
-
-// /*********************************************/
-// /* Modification */
-// /*********************************************/
-
-void ICACHE_FLASH_ATTR String::replace(char find, char replace) {
- if(!buffer)
- return;
- for(char *p = buffer; *p; p++) {
- if(*p == find)
- *p = replace;
- }
-}
-
-void ICACHE_FLASH_ATTR String::replace(const String& find, const String& replace) {
- if(len == 0 || find.len == 0)
- return;
- int diff = replace.len - find.len;
- char *readFrom = buffer;
- char *foundAt;
- if(diff == 0) {
- while((foundAt = strstr(readFrom, find.buffer)) != NULL) {
- memcpy(foundAt, replace.buffer, replace.len);
- readFrom = foundAt + replace.len;
- }
- } else if(diff < 0) {
- char *writeTo = buffer;
- while((foundAt = strstr(readFrom, find.buffer)) != NULL) {
- unsigned int n = foundAt - readFrom;
- memcpy(writeTo, readFrom, n);
- writeTo += n;
- memcpy(writeTo, replace.buffer, replace.len);
- writeTo += replace.len;
- readFrom = foundAt + find.len;
- len += diff;
- }
- strcpy(writeTo, readFrom);
- } else {
- unsigned int size = len; // compute size needed for result
- while((foundAt = strstr(readFrom, find.buffer)) != NULL) {
- readFrom = foundAt + find.len;
- size += diff;
- }
- if(size == len)
- return;
- if(size > capacity && !changeBuffer(size))
- return; // XXX: tell user!
- int index = len - 1;
- while(index >= 0 && (index = lastIndexOf(find, index)) >= 0) {
- readFrom = buffer + index + find.len;
- memmove(readFrom + diff, readFrom, len - (readFrom - buffer));
- len += diff;
- buffer[len] = 0;
- memcpy(buffer + index, replace.buffer, replace.len);
- index--;
- }
- }
-}
-
-void ICACHE_FLASH_ATTR String::remove(unsigned int index) {
- // Pass the biggest integer as the count. The remove method
- // below will take care of truncating it at the end of the
- // string.
- remove(index, (unsigned int) -1);
-}
-
-void ICACHE_FLASH_ATTR String::remove(unsigned int index, unsigned int count) {
- if(index >= len) {
- return;
- }
- if(count <= 0) {
- return;
- }
- if(count > len - index) {
- count = len - index;
- }
- char *writeTo = buffer + index;
- len = len - count;
- strncpy(writeTo, buffer + index + count, len - index);
- buffer[len] = 0;
-}
-
-void ICACHE_FLASH_ATTR String::toLowerCase(void) {
- if(!buffer)
- return;
- for(char *p = buffer; *p; p++) {
- *p = tolower(*p);
- }
-}
-
-void ICACHE_FLASH_ATTR String::toUpperCase(void) {
- if(!buffer)
- return;
- for(char *p = buffer; *p; p++) {
- *p = toupper(*p);
- }
-}
-
-void ICACHE_FLASH_ATTR String::trim(void) {
- if(!buffer || len == 0)
- return;
- char *begin = buffer;
- while(isspace(*begin))
- begin++;
- char *end = buffer + len - 1;
- while(isspace(*end) && end >= begin)
- end--;
- len = end + 1 - begin;
- if(begin > buffer)
- memcpy(buffer, begin, len);
- buffer[len] = 0;
-}
-
-// /*********************************************/
-// /* Parsing / Conversion */
-// /*********************************************/
-
-long ICACHE_FLASH_ATTR String::toInt(void) const {
- if(buffer)
- return atol(buffer);
- return 0;
-}
-
-float ICACHE_FLASH_ATTR String::toFloat(void) const {
- if(buffer)
- return atof(buffer);
- return 0;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/WString.h b/sparkfun/esp8266/cores/esp8266/WString.h
deleted file mode 100644
index 531fc88c..00000000
--- a/sparkfun/esp8266/cores/esp8266/WString.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- WString.h - String library for Wiring & Arduino
- ...mostly rewritten by Paul Stoffregen...
- Copyright (c) 2009-10 Hernando Barragan. All right reserved.
- Copyright 2011, Paul Stoffregen, paul@pjrc.com
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef String_class_h
-#define String_class_h
-#ifdef __cplusplus
-
-#include
-#include
-#include
-#include
-
-// An inherited class for holding the result of a concatenation. These
-// result objects are assumed to be writable by subsequent concatenations.
-class StringSumHelper;
-
-// an abstract class used as a means to proide a unique pointer type
-// but really has no body
-class __FlashStringHelper;
-#define F(string_literal) (reinterpret_cast(PSTR(string_literal)))
-
-
-// The string class
-class String {
- // use a function pointer to allow for "if (s)" without the
- // complications of an operator bool(). for more information, see:
- // http://www.artima.com/cppsource/safebool.html
- typedef void (String::*StringIfHelperType)() const;
- void StringIfHelper() const {
- }
-
- public:
- // constructors
- // creates a copy of the initial value.
- // if the initial value is null or invalid, or if memory allocation
- // fails, the string will be marked as invalid (i.e. "if (s)" will
- // be false).
- String(const char *cstr = "");
- String(const String &str);
- String(const __FlashStringHelper *str);
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- String(String &&rval);
- String(StringSumHelper &&rval);
-#endif
- explicit String(char c);
- explicit String(unsigned char, unsigned char base = 10);
- explicit String(int, unsigned char base = 10);
- explicit String(unsigned int, unsigned char base = 10);
- explicit String(long, unsigned char base = 10);
- explicit String(unsigned long, unsigned char base = 10);
- explicit String(float, unsigned char decimalPlaces = 2);
- explicit String(double, unsigned char decimalPlaces = 2);
- ~String(void);
-
- // memory management
- // return true on success, false on failure (in which case, the string
- // is left unchanged). reserve(0), if successful, will validate an
- // invalid string (i.e., "if (s)" will be true afterwards)
- unsigned char reserve(unsigned int size);
- inline unsigned int length(void) const {
- return len;
- }
-
- // creates a copy of the assigned value. if the value is null or
- // invalid, or if the memory allocation fails, the string will be
- // marked as invalid ("if (s)" will be false).
- String & operator =(const String &rhs);
- String & operator =(const char *cstr);
- String & operator = (const __FlashStringHelper *str);
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- String & operator =(String &&rval);
- String & operator =(StringSumHelper &&rval);
-#endif
-
- // concatenate (works w/ built-in types)
-
- // returns true on success, false on failure (in which case, the string
- // is left unchanged). if the argument is null or invalid, the
- // concatenation is considered unsucessful.
- unsigned char concat(const String &str);
- unsigned char concat(const char *cstr);
- unsigned char concat(char c);
- unsigned char concat(unsigned char c);
- unsigned char concat(int num);
- unsigned char concat(unsigned int num);
- unsigned char concat(long num);
- unsigned char concat(unsigned long num);
- unsigned char concat(float num);
- unsigned char concat(double num);
- unsigned char concat(const __FlashStringHelper * str);
-
- // if there's not enough memory for the concatenated value, the string
- // will be left unchanged (but this isn't signalled in any way)
- String & operator +=(const String &rhs) {
- concat(rhs);
- return (*this);
- }
- String & operator +=(const char *cstr) {
- concat(cstr);
- return (*this);
- }
- String & operator +=(char c) {
- concat(c);
- return (*this);
- }
- String & operator +=(unsigned char num) {
- concat(num);
- return (*this);
- }
- String & operator +=(int num) {
- concat(num);
- return (*this);
- }
- String & operator +=(unsigned int num) {
- concat(num);
- return (*this);
- }
- String & operator +=(long num) {
- concat(num);
- return (*this);
- }
- String & operator +=(unsigned long num) {
- concat(num);
- return (*this);
- }
- String & operator +=(float num) {
- concat(num);
- return (*this);
- }
- String & operator +=(double num) {
- concat(num);
- return (*this);
- }
- String & operator += (const __FlashStringHelper *str){
- concat(str);
- return (*this);
- }
-
- friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, const char *cstr);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, char c);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned char num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, int num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned int num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, long num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, unsigned long num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, float num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, double num);
- friend StringSumHelper & operator +(const StringSumHelper &lhs, const __FlashStringHelper *rhs);
-
- // comparison (only works w/ Strings and "strings")
- operator StringIfHelperType() const {
- return buffer ? &String::StringIfHelper : 0;
- }
- int compareTo(const String &s) const;
- unsigned char equals(const String &s) const;
- unsigned char equals(const char *cstr) const;
- unsigned char operator ==(const String &rhs) const {
- return equals(rhs);
- }
- unsigned char operator ==(const char *cstr) const {
- return equals(cstr);
- }
- unsigned char operator !=(const String &rhs) const {
- return !equals(rhs);
- }
- unsigned char operator !=(const char *cstr) const {
- return !equals(cstr);
- }
- unsigned char operator <(const String &rhs) const;
- unsigned char operator >(const String &rhs) const;
- unsigned char operator <=(const String &rhs) const;
- unsigned char operator >=(const String &rhs) const;
- unsigned char equalsIgnoreCase(const String &s) const;
- unsigned char startsWith(const String &prefix) const;
- unsigned char startsWith(const String &prefix, unsigned int offset) const;
- unsigned char endsWith(const String &suffix) const;
-
- // character acccess
- char charAt(unsigned int index) const;
- void setCharAt(unsigned int index, char c);
- char operator [](unsigned int index) const;
- char& operator [](unsigned int index);
- void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index = 0) const;
- void toCharArray(char *buf, unsigned int bufsize, unsigned int index = 0) const {
- getBytes((unsigned char *) buf, bufsize, index);
- }
- const char * c_str() const {
- return buffer;
- }
-
- // search
- int indexOf(char ch) const;
- int indexOf(char ch, unsigned int fromIndex) const;
- int indexOf(const String &str) const;
- int indexOf(const String &str, unsigned int fromIndex) const;
- int lastIndexOf(char ch) const;
- int lastIndexOf(char ch, unsigned int fromIndex) const;
- int lastIndexOf(const String &str) const;
- int lastIndexOf(const String &str, unsigned int fromIndex) const;
- String substring(unsigned int beginIndex) const {
- return substring(beginIndex, len);
- }
- ;
- String substring(unsigned int beginIndex, unsigned int endIndex) const;
-
- // modification
- void replace(char find, char replace);
- void replace(const String& find, const String& replace);
- void remove(unsigned int index);
- void remove(unsigned int index, unsigned int count);
- void toLowerCase(void);
- void toUpperCase(void);
- void trim(void);
-
- // parsing/conversion
- long toInt(void) const;
- float toFloat(void) const;
-
- protected:
- char *buffer; // the actual char array
- unsigned int capacity; // the array length minus one (for the '\0')
- unsigned int len; // the String length (not counting the '\0')
- protected:
- void init(void);
- void invalidate(void);
- unsigned char changeBuffer(unsigned int maxStrLen);
- unsigned char concat(const char *cstr, unsigned int length);
-
- // copy and move
- String & copy(const char *cstr, unsigned int length);
- String & copy(const __FlashStringHelper *pstr, unsigned int length);
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- void move(String &rhs);
-#endif
-};
-
-class StringSumHelper: public String {
- public:
- StringSumHelper(const String &s) :
- String(s) {
- }
- StringSumHelper(const char *p) :
- String(p) {
- }
- StringSumHelper(char c) :
- String(c) {
- }
- StringSumHelper(unsigned char num) :
- String(num) {
- }
- StringSumHelper(int num) :
- String(num) {
- }
- StringSumHelper(unsigned int num) :
- String(num) {
- }
- StringSumHelper(long num) :
- String(num) {
- }
- StringSumHelper(unsigned long num) :
- String(num) {
- }
- StringSumHelper(float num) :
- String(num) {
- }
- StringSumHelper(double num) :
- String(num) {
- }
-};
-
-#endif // __cplusplus
-#endif // String_class_h
diff --git a/sparkfun/esp8266/cores/esp8266/abi.cpp b/sparkfun/esp8266/cores/esp8266/abi.cpp
deleted file mode 100644
index b863997a..00000000
--- a/sparkfun/esp8266/cores/esp8266/abi.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (c) 2014 Arduino. All right reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include
-extern "C" {
-#include "ets_sys.h"
-#include "os_type.h"
-#include "osapi.h"
-#include "mem.h"
-#include "user_interface.h"
-}
-
-void *operator new(size_t size) {
- size = ((size + 3) & ~((size_t)0x3));
- return os_malloc(size);
-}
-
-void *operator new[](size_t size) {
- size = ((size + 3) & ~((size_t)0x3));
- return os_malloc(size);
-}
-
-void operator delete(void * ptr) {
- os_free(ptr);
-}
-
-void operator delete[](void * ptr) {
- os_free(ptr);
-}
-
-extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
-extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
-
-void __cxa_pure_virtual(void) {
- abort();
-}
-
-void __cxa_deleted_virtual(void) {
- abort();
-}
-
-namespace std {
-void __throw_bad_function_call() {
- abort();
-}
-}
-
-// TODO: rebuild windows toolchain to make this unnecessary:
-void* __dso_handle;
-
diff --git a/sparkfun/esp8266/cores/esp8266/cbuf.h b/sparkfun/esp8266/cores/esp8266/cbuf.h
deleted file mode 100644
index 87642510..00000000
--- a/sparkfun/esp8266/cores/esp8266/cbuf.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- cbuf.h - Circular buffer implementation
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __cbuf_h
-#define __cbuf_h
-
-#include
-class cbuf {
- public:
- cbuf(size_t size) :
- _size(size), _buf(new char[size]), _bufend(_buf + size), _begin(_buf), _end(_begin) {
- }
-
- ~cbuf() {
- delete[] _buf;
- }
-
- size_t getSize() const {
- if(_end >= _begin) return _end - _begin;
-
- return _size - (_begin - _end);
- }
-
- size_t room() const {
- if(_end >= _begin) return _size - (_end - _begin) - 1;
-
- return _begin - _end - 1;
- }
-
- bool empty() const {
- return _begin == _end;
- }
-
- int peek() {
- if(_end == _begin) return -1;
-
- return static_cast(*_begin);
- }
-
- int read() {
- if(getSize() == 0) return -1;
-
- char result = *_begin;
- if(++_begin == _bufend) _begin = _buf;
- return static_cast(result);
- }
-
- size_t read(char* dst, size_t size) {
- size_t bytes_available = getSize();
- size_t size_to_read = (size < bytes_available) ? size : bytes_available;
- size_t size_read = size_to_read;
- if(_end < _begin && size_to_read > _bufend - _begin) {
- size_t top_size = _bufend - _begin;
- memcpy(dst, _begin, top_size);
- _begin = _buf;
- size_to_read -= top_size;
- dst += top_size;
- }
- memcpy(dst, _begin, size_to_read);
- _begin += size_to_read;
- if(_begin == _bufend) _begin = _buf;
- return size_read;
- }
-
- size_t write(char c) {
- if(room() == 0) return 0;
-
- *_end = c;
- if(++_end == _bufend) _end = _buf;
- return 1;
- }
-
- size_t write(const char* src, size_t size) {
- size_t bytes_available = room();
- size_t size_to_write = (size < bytes_available) ? size : bytes_available;
- size_t size_written = size_to_write;
- if(_end > _begin && size_to_write > _bufend - _end) {
- size_t top_size = _bufend - _end;
- memcpy(_end, src, top_size);
- _end = _buf;
- size_to_write -= top_size;
- src += top_size;
- }
- memcpy(_end, src, size_to_write);
- _end += size_to_write;
- if(_end == _bufend) _end = _buf;
- return size_written;
- }
-
- void flush() {
- _begin = _buf;
- _end = _buf;
- }
-
- private:
- size_t _size;
- char* _buf;
- char* _bufend;
- char* _begin;
- char* _end;
-};
-
-#endif//__cbuf_h
diff --git a/sparkfun/esp8266/cores/esp8266/cont.S b/sparkfun/esp8266/cores/esp8266/cont.S
deleted file mode 100644
index 0ec47a0a..00000000
--- a/sparkfun/esp8266/cores/esp8266/cont.S
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- cont.S - continuations support for Xtensa call0 ABI
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
- .text
- .align 4
- .literal_position
- .global cont_yield
- .type cont_yield, @function
-cont_yield:
- /* a1: sp */
- /* a2: void* cont_ctx */
- /* adjust stack and save registers */
- addi a1, a1, -24
- s32i a12, a1, 0
- s32i a13, a1, 4
- s32i a14, a1, 8
- s32i a15, a1, 12
- s32i a0, a1, 16
- s32i a2, a1, 20
-
- /* &cont_continue -> cont_ctx.pc_yield */
- movi a3, cont_continue
- s32i a3, a2, 8
- /* sp -> cont_ctx.sp_yield */
- s32i a1, a2, 12
-
- /* a0 <- cont_ctx.pc_ret */
- l32i a0, a2, 0
- /* sp <- cont_ctx.sp_ret */
- l32i a1, a2, 4
- jx a0
-
-cont_continue:
- l32i a12, a1, 0
- l32i a13, a1, 4
- l32i a14, a1, 8
- l32i a15, a1, 12
- l32i a0, a1, 16
- l32i a2, a1, 20
- addi a1, a1, 24
- ret
- .size cont_yield, . - cont_yield
-
-////////////////////////////////////////////////////
-
- .text
- .align 4
- .literal_position
- .global cont_run
- .type cont_run, @function
-cont_run:
- /* a1: sp */
- /* a2: void* cont_ctx */
- /* a3: void (*pfn) */
-
- /* adjust stack and save registers */
- addi a1, a1, -20
- s32i a12, a1, 0
- s32i a13, a1, 4
- s32i a14, a1, 8
- s32i a15, a1, 12
- s32i a0, a1, 16
-
- /* cont_ret -> a4 -> cont_ctx.pc_ret*/
- movi a4, cont_ret
- s32i a4, a2, 0
- /* sp -> cont_ctx.sp_ret */
- s32i a1, a2, 4
-
- /* if cont_ctx.pc_yield != 0, goto cont_resume */
- l32i a4, a2, 8
- bnez a4, cont_resume
- /* else */
- /* set new stack*/
- l32i a1, a2, 16;
- /* goto pfn */
- movi a0, cont_norm
- jx a3
-
-cont_resume:
- /* a1 <- cont_ctx.sp_yield */
- l32i a1, a2, 12
- /* reset yield flag, 0 -> cont_ctx.pc_yield */
- movi a3, 0
- s32i a3, a2, 8
- /* jump to saved cont_ctx.pc_yield */
- movi a0, cont_ret
- jx a4
-
-cont_norm:
- /* calculate pointer to cont_ctx.struct_start from sp */
- l32i a2, a1, 8
- /* sp <- cont_ctx.sp_ret */
- l32i a1, a2, 4
-
-cont_ret:
- /* restore registers */
- l32i a12, a1, 0
- l32i a13, a1, 4
- l32i a14, a1, 8
- l32i a15, a1, 12
- l32i a0, a1, 16
- /* adjust stack and return */
- addi a1, a1, 20
- ret
- .size cont_run, . - cont_run
diff --git a/sparkfun/esp8266/cores/esp8266/cont.h b/sparkfun/esp8266/cores/esp8266/cont.h
deleted file mode 100644
index 52923774..00000000
--- a/sparkfun/esp8266/cores/esp8266/cont.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- cont.h - continuations support for Xtensa call0 ABI
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef CONT_H_
-#define CONT_H_
-
-#ifndef CONT_STACKSIZE
-#define CONT_STACKSIZE 4096
-#endif
-
-typedef struct cont_ {
- void (*pc_ret)(void);
- unsigned* sp_ret;
-
- void (*pc_yield)(void);
- unsigned* sp_yield;
-
- unsigned* stack_end;
- unsigned stack_guard1;
-
- unsigned stack[CONT_STACKSIZE / 4];
-
- unsigned stack_guard2;
- unsigned* struct_start;
-} cont_t;
-
-// Initialize the cont_t structure before calling cont_run
-void cont_init(cont_t*);
-
-// Run function pfn in a separate stack, or continue execution
-// at the point where cont_yield was called
-void cont_run(cont_t*, void (*pfn)(void));
-
-// Return to the point where cont_run was called, saving the
-// execution state (registers and stack)
-void cont_yield(cont_t*);
-
-// Check guard bytes around the stack. Return 0 in case everything is ok,
-// return 1 if guard bytes were overwritten.
-int cont_check(cont_t* cont);
-
-#endif /* CONT_H_ */
diff --git a/sparkfun/esp8266/cores/esp8266/cont_util.c b/sparkfun/esp8266/cores/esp8266/cont_util.c
deleted file mode 100644
index fcb6f024..00000000
--- a/sparkfun/esp8266/cores/esp8266/cont_util.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- cont_util.s - continuations support for Xtensa call0 ABI
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "cont.h"
-
-#define CONT_STACKGUARD 0xfeefeffe
-
-void cont_init(cont_t* cont) {
- cont->stack_guard1 = CONT_STACKGUARD;
- cont->stack_guard2 = CONT_STACKGUARD;
- cont->stack_end = cont->stack + (sizeof(cont->stack) / 4 - 1);
- cont->struct_start = (unsigned*) cont;
-}
-
-int cont_check(cont_t* cont) {
- if(cont->stack_guard1 != CONT_STACKGUARD || cont->stack_guard2 != CONT_STACKGUARD) return 1;
-
- return 0;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_main.cpp b/sparkfun/esp8266/cores/esp8266/core_esp8266_main.cpp
deleted file mode 100644
index d4516544..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_main.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- main.cpp - platform initialization and context switching
- emulation
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//This may be used to change user task stack size:
-//#define CONT_STACKSIZE 4096
-#include
-extern "C" {
-#include "ets_sys.h"
-#include "os_type.h"
-#include "osapi.h"
-#include "mem.h"
-#include "user_interface.h"
-#include "cont.h"
-}
-#define LOOP_TASK_PRIORITY 0
-#define LOOP_QUEUE_SIZE 1
-
-int atexit(void (*func)()) {
- return 0;
-}
-
-extern "C" void ets_update_cpu_frequency(int freqmhz);
-void initVariant() __attribute__((weak));
-void initVariant() {
-}
-
-extern void loop();
-extern void setup();
-
-void preloop_update_frequency() __attribute__((weak));
-void preloop_update_frequency() {
-#if defined(F_CPU) && (F_CPU == 160000000L)
- REG_SET_BIT(0x3ff00014, BIT(0));
- ets_update_cpu_frequency(160);
-#endif
-}
-
-extern void (*__init_array_start)(void);
-extern void (*__init_array_end)(void);
-
-static cont_t g_cont;
-static os_event_t g_loop_queue[LOOP_QUEUE_SIZE];
-
-static uint32_t g_micros_at_task_start;
-
-extern "C" uint32_t esp_micros_at_task_start() {
- return g_micros_at_task_start;
-}
-
-extern "C" void abort() {
- while(1) {
- }
-}
-
-extern "C" void esp_yield() {
- cont_yield(&g_cont);
-}
-
-extern "C" void esp_schedule() {
- system_os_post(LOOP_TASK_PRIORITY, 0, 0);
-}
-
-extern "C" void __yield() {
- esp_schedule();
- esp_yield();
-}
-extern "C" void yield(void) __attribute__ ((weak, alias("__yield")));
-
-static void loop_wrapper() {
- static bool setup_done = false;
- if(!setup_done) {
- setup();
- setup_done = true;
- }
- preloop_update_frequency();
- loop();
- esp_schedule();
-}
-
-static void loop_task(os_event_t *events) {
- g_micros_at_task_start = system_get_time();
- cont_run(&g_cont, &loop_wrapper);
- if(cont_check(&g_cont) != 0) {
- ets_printf("\r\nheap collided with sketch stack\r\n");
- abort();
- }
-}
-
-static void do_global_ctors(void) {
- void (**p)(void);
- for(p = &__init_array_start; p != &__init_array_end; ++p)
- (*p)();
-}
-
-void init_done() {
- do_global_ctors();
- esp_schedule();
-}
-
-extern "C" {
-void user_init(void) {
- uart_div_modify(0, UART_CLK_FREQ / (115200));
-
- init();
-
- initVariant();
-
- cont_init(&g_cont);
-
- system_os_task(loop_task,
- LOOP_TASK_PRIORITY, g_loop_queue,
- LOOP_QUEUE_SIZE);
-
- system_init_done_cb(&init_done);
-}
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_noniso.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_noniso.c
deleted file mode 100644
index eafe4fa7..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_noniso.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- core_esp8266_noniso.c - nonstandard (but usefull) conversion functions
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Modified 03 April 2015 by Markus Sattler
-
- */
-
-#include
-#include "stdlib_noniso.h"
-#include "ets_sys.h"
-
-#define sprintf ets_sprintf
-#define strcpy ets_strcpy
-
-int atoi(const char* s) {
- return (int) atol(s);
-}
-
-long atol(const char* s) {
- char * tmp;
- return strtol(s, &tmp, 10);
-}
-
-double atof(const char* s) {
- char * tmp;
- return strtod(s, &tmp);
-}
-
-void reverse(char* begin, char* end) {
- char *is = begin;
- char *ie = end - 1;
- while(is < ie) {
- char tmp = *ie;
- *ie = *is;
- *is = tmp;
- ++is;
- --ie;
- }
-}
-
-char* itoa(int value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- int quotient = abs(value);
-
- do {
- const int tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- // Apply negative sign
- if(value < 0)
- *out++ = '-';
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char* ltoa(long value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- long quotient = abs(value);
-
- do {
- const long tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- // Apply negative sign
- if(value < 0)
- *out++ = '-';
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char* utoa(unsigned value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- unsigned quotient = value;
-
- do {
- const unsigned tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char* ultoa(unsigned long value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- unsigned long quotient = value;
-
- do {
- const unsigned long tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
-
- if(isnan(number)) {
- strcpy(s, "nan");
- return s;
- }
- if(isinf(number)) {
- strcpy(s, "inf");
- return s;
- }
-
- if(number > 4294967040.0 || number < -4294967040.0) {
- strcpy(s, "ovf");
- return s;
- }
- char* out = s;
- // Handle negative numbers
- if(number < 0.0) {
- *out = '-';
- ++out;
- number = -number;
- }
-
- // Round correctly so that print(1.999, 2) prints as "2.00"
- double rounding = 0.5;
- for(uint8_t i = 0; i < prec; ++i)
- rounding /= 10.0;
-
- number += rounding;
-
- // Extract the integer part of the number and print it
- unsigned long int_part = (unsigned long) number;
- double remainder = number - (double) int_part;
- out += sprintf(out, "%ld", int_part);
-
- // Print the decimal point, but only if there are digits beyond
- if(prec > 0) {
- *out = '.';
- ++out;
- }
-
- for (unsigned char decShift = prec; decShift > 0; decShift--) {
- remainder *= 10.0;
- }
- sprintf(out, "%0*d", prec, (int)remainder);
-
- return s;
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_noniso.c.orig b/sparkfun/esp8266/cores/esp8266/core_esp8266_noniso.c.orig
deleted file mode 100644
index 01795335..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_noniso.c.orig
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- core_esp8266_noniso.c - nonstandard (but usefull) conversion functions
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Modified 03 April 2015 by Markus Sattler
-
- */
-
-#include
-#include "stdlib_noniso.h"
-#include "ets_sys.h"
-
-#define sprintf ets_sprintf
-#define strcpy ets_strcpy
-
-int atoi(const char* s) {
- return (int) atol(s);
-}
-
-long atol(const char* s) {
- long int result = 0;
- int i;
- const char* b = s;
- int sign = 1;
- for(i = 0; *b; ++i, ++b) {
- if(i == 0 && *b == '-') sign = -1;
- int x = *b - '0';
- if(x < 0 || x > 9) break;
- result = result * 10 + x;
- }
- return sign * result;
-}
-
-// Source:
-// https://github.com/anakod/Sming/blob/master/Sming/system/stringconversion.cpp#L93
-<<<<<<< HEAD
-double atof(const char* s)
-{
- double result = 0;
- double factor = 1.0;
-
- while (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n')
- ++s;
-
- if (*s == 0)
- return 0;
-
- if (*s == '-')
- {
- factor = -1.0;
- ++s;
- }
- if (*s == '+')
- {
- ++s;
- }
-
- bool decimals = false;
- char c;
- while((c = *s))
- {
- if (c == '.')
- {
- decimals = true;
- ++s;
- continue;
- }
-
- int d = c - '0';
- if (d < 0 || d > 9)
- break;
-
- result = 10.0 * result + d;
- if (decimals)
- factor *= 0.1;
- ++s;
- }
-
- return result * factor;
-=======
-double atof(const char* s) {
- double result = 0;
- double sign = 1;
-
- while(*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n')
- ++s;
-
- if(*s == 0) return 0;
-
- if(*s == '-') {
- sign = -1;
- ++s;
- }
- if(*s == '+') {
- ++s;
- }
-
- bool decimals = false;
- double factor = 1.0;
- char c;
- while((c = *s)) {
- if(c == '.') {
- decimals = true;
- ++s;
- continue;
- }
-
- int d = c - '0';
- if(d < 0 || d > 9) break;
-
- result = 10.0 * result + d;
- if(decimals) factor *= 0.1;
- ++s;
- }
-
- return result * factor;
->>>>>>> 792737555e6ae51a9dbebc60e33b4e9424c39fcf
-}
-
-void reverse(char* begin, char* end) {
- char *is = begin;
- char *ie = end - 1;
- while(is < ie) {
- char tmp = *ie;
- *ie = *is;
- *is = tmp;
- ++is;
- --ie;
- }
-}
-
-char* itoa(int value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- int quotient = abs(value);
-
- do {
- const int tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- // Apply negative sign
- if(value < 0) *out++ = '-';
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char* ltoa(long value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- long quotient = abs(value);
-
- do {
- const long tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- // Apply negative sign
- if(value < 0) *out++ = '-';
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char* utoa(unsigned value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- unsigned quotient = value;
-
- do {
- const unsigned tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char* ultoa(unsigned long value, char* result, int base) {
- if(base < 2 || base > 16) {
- *result = 0;
- return result;
- }
-
- char* out = result;
- unsigned long quotient = value;
-
- do {
- const unsigned long tmp = quotient / base;
- *out = "0123456789abcdef"[quotient - (tmp * base)];
- ++out;
- quotient = tmp;
- } while(quotient);
-
- reverse(result, out);
- *out = 0;
- return result;
-}
-
-char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
- size_t n = 0;
-
- if(isnan(number)) {
- strcpy(s, "nan");
- return s;
- }
- if(isinf(number)) {
- strcpy(s, "inf");
- return s;
- }
-
- if(number > 4294967040.0 || number < -4294967040.0) {
- strcpy(s, "ovf");
- return s;
- }
- char* out = s;
- // Handle negative numbers
- if(number < 0.0) {
- *out = '-';
- ++out;
- number = -number;
- }
-
- // Round correctly so that print(1.999, 2) prints as "2.00"
- double rounding = 0.5;
- for(uint8_t i = 0; i < prec; ++i)
- rounding /= 10.0;
-
- number += rounding;
-
- // Extract the integer part of the number and print it
- unsigned long int_part = (unsigned long) number;
- double remainder = number - (double) int_part;
- out += sprintf(out, "%d", int_part);
-
- // Print the decimal point, but only if there are digits beyond
- if(prec > 0) {
- *out = '.';
- ++out;
- }
-
- while(prec-- > 0) {
- remainder *= 10.0;
- }
- sprintf(out, "%d", (int) remainder);
-
- return s;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_si2c.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_si2c.c
deleted file mode 100644
index 29149aa0..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_si2c.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- si2c.c - Software I2C library for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include "twi.h"
-#include "pins_arduino.h"
-#include "wiring_private.h"
-
-unsigned char twi_dcount = 18;
-static unsigned char twi_sda, twi_scl;
-
-#define SDA_LOW() (GPES = (1 << twi_sda)) //Enable SDA (becomes output and since GPO is 0 for the pin, it will pull the line low)
-#define SDA_HIGH() (GPEC = (1 << twi_sda)) //Disable SDA (becomes input and since it has pullup it will go high)
-#define SDA_READ() ((GPI & (1 << twi_sda)) != 0)
-#define SCL_LOW() (GPES = (1 << twi_scl))
-#define SCL_HIGH() (GPEC = (1 << twi_scl))
-#define SCL_READ() ((GPI & (1 << twi_scl)) != 0)
-
-#ifndef FCPU80
-#define FCPU80 80000000L
-#endif
-
-#if F_CPU == FCPU80
-#define TWI_CLOCK_STRETCH 200
-#else
-#define TWI_CLOCK_STRETCH 400
-#endif
-
-void twi_setClock(unsigned int freq){
-#if F_CPU == FCPU80
- if(freq <= 100000) twi_dcount = 18;//about 100KHz
- else if(freq <= 200000) twi_dcount = 8;//about 200KHz
- else if(freq <= 300000) twi_dcount = 4;//about 300KHz
- else if(freq <= 400000) twi_dcount = 2;//about 370KHz
- else twi_dcount = 1;//about 450KHz
-#else
- if(freq <= 100000) twi_dcount = 32;//about 100KHz
- else if(freq <= 200000) twi_dcount = 16;//about 200KHz
- else if(freq <= 300000) twi_dcount = 8;//about 300KHz
- else if(freq <= 400000) twi_dcount = 4;//about 370KHz
- else twi_dcount = 2;//about 450KHz
-#endif
-}
-
-void twi_init(unsigned char sda, unsigned char scl){
- twi_sda = sda;
- twi_scl = scl;
- pinMode(twi_sda, INPUT_PULLUP);
- pinMode(twi_scl, INPUT_PULLUP);
- twi_setClock(100000);
-}
-
-void twi_stop(void){
- pinMode(twi_sda, INPUT);
- pinMode(twi_scl, INPUT);
-}
-
-static void twi_delay(unsigned char v){
- unsigned int i;
- unsigned int reg;
- for(i=0;i> GPIO_SIGMA_DELTA_LSB)
-#define GPIO_SIGMA_DELTA_SET(x) (((x) << GPIO_SIGMA_DELTA_LSB) & GPIO_SIGMA_DELTA_MASK)
-
-
-#define GPIO_SIGMA_DELTA_TARGET_MSB 7
-#define GPIO_SIGMA_DELTA_TARGET_LSB 0
-#define GPIO_SIGMA_DELTA_TARGET_MASK (0x000000FF<> GPIO_SIGMA_DELTA_TARGET_LSB)
-#define GPIO_SIGMA_DELTA_TARGET_SET(x) (((x) << GPIO_SIGMA_DELTA_TARGET_LSB) & GPIO_SIGMA_DELTA_TARGET_MASK)
-
-
-#define GPIO_SIGMA_DELTA_PRESCALE_MSB 15
-#define GPIO_SIGMA_DELTA_PRESCALE_LSB 8
-#define GPIO_SIGMA_DELTA_PRESCALE_MASK (0x000000FF<> GPIO_SIGMA_DELTA_PRESCALE_LSB)
-#define GPIO_SIGMA_DELTA_PRESCALE_SET(x) (((x) << GPIO_SIGMA_DELTA_PRESCALE_LSB) & GPIO_SIGMA_DELTA_PRESCALE_MASK)
-
-
-/******************************************************************************
- * FunctionName : sigma_delta_setup
- * Description : Init Pin Config for Sigma_delta , change pin source to sigma-delta
- * Parameters : uint32 GPIO_MUX, GPIO MUX REG ,DEFINED IN EAGLE_SOC.H, e.g.: PERIPHS_IO_MUX_MTCK_U
- uint32 GPIO_NUM, GPIO NUM ACCORDING TO THE MUX NUM , e.g.: 13 for MTCK
- uint32 GPIO_FUNC, GPIO PIN FUNC , DEFINED IN EAGLE_SOC.H , e.g.: FUNC_GPIO13
- * Returns : none
-*******************************************************************************/
-void ICACHE_FLASH_ATTR
-sigma_delta_setup(uint32 GPIO_MUX,uint32 GPIO_NUM,uint32 GPIO_FUNC)
-{
- //============================================================================
- //STEP 1: SIGMA-DELTA CONFIG;REG SETUP
- GPIO_REG_WRITE(GPIO_SIGMA_DELTA,
- (GPIO_REG_READ(GPIO_PIN_ADDR(GPIO_ID_PIN(GPIO_SIGMA_DELTA_NUM))) &(~GPIO_SIGMA_DELTA_SETTING_MASK))|
- GPIO_SIGMA_DELTA_SET(GPIO_SIGMA_DELTA_ENABLE)|
- GPIO_SIGMA_DELTA_TARGET_SET(0x00)|
- GPIO_SIGMA_DELTA_PRESCALE_SET(0x00) );
-
- //============================================================================
-
- //STEP 2: PIN FUNC CONFIG :SET PIN TO GPIO MODE AND ENABLE OUTPUT
- PIN_FUNC_SELECT(GPIO_MUX, GPIO_FUNC);
- gpio_output_set(0,0,0x1<128)?(256-duty):duty;
- prescale = (target==0)?0:(target-1);
-
- //freq = 80000 (khz) /256 /duty_target * (prescale+1)
- set_sigma_target(duty);//SET DUTY TARGET
- set_sigma_prescale(prescale);//SET CLK DIV
-
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_timer.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_timer.c
deleted file mode 100644
index bfdd3692..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_timer.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- timer.c - Timer1 library for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include "wiring_private.h"
-#include "pins_arduino.h"
-#include "c_types.h"
-
-void (*timer1_user_cb)(void);
-
-void timer1_isr_handler(void *para){
- if((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
- T1I = 0;
- if(timer1_user_cb) timer1_user_cb();
-}
-
-void timer1_isr_init(){
- ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler, NULL);
-}
-
-void timer1_attachInterrupt(void (*userFunc)(void)) {
- timer1_user_cb = userFunc;
- ETS_FRC1_INTR_ENABLE();
-}
-
-void timer1_detachInterrupt() {
- timer1_user_cb = 0;
- TEIE &= ~TEIE1;//edge int disable
- ETS_FRC1_INTR_DISABLE();
-}
-
-void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
- T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
- T1I = 0;
-}
-
-void timer1_write(uint32_t ticks){
- T1L = ((ticks) & 0x7FFFFF);
- if((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
-}
-
-void timer1_disable(){
- T1C = 0;
- T1I = 0;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring.c
deleted file mode 100644
index 0170b4bc..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- core_esp8266_wiring.c - implementation of Wiring API for esp8266
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "wiring_private.h"
-#include "ets_sys.h"
-#include "osapi.h"
-#include "user_interface.h"
-#include "cont.h"
-
-extern void esp_schedule();
-extern void esp_yield();
-
-static os_timer_t delay_timer;
-static os_timer_t micros_overflow_timer;
-static uint32_t micros_at_last_overflow_tick = 0;
-static uint32_t micros_overflow_count = 0;
-#define ONCE 0
-#define REPEAT 1
-
-void delay_end(void* arg) {
- esp_schedule();
-}
-
-void delay(unsigned long ms) {
- if(ms) {
- os_timer_setfn(&delay_timer, (os_timer_func_t*) &delay_end, 0);
- os_timer_arm(&delay_timer, ms, ONCE);
- } else {
- esp_schedule();
- }
- esp_yield();
- if(ms) {
- os_timer_disarm(&delay_timer);
- }
-}
-
-void micros_overflow_tick(void* arg) {
- uint32_t m = system_get_time();
- if(m < micros_at_last_overflow_tick)
- ++micros_overflow_count;
- micros_at_last_overflow_tick = m;
-}
-
-unsigned long millis() {
- uint32_t m = system_get_time();
- uint32_t c = micros_overflow_count + ((m < micros_at_last_overflow_tick) ? 1 : 0);
- return c * 4294967 + m / 1000;
-}
-
-unsigned long micros() {
- return system_get_time();
-}
-
-void delayMicroseconds(unsigned int us) {
- os_delay_us(us);
-}
-
-void init() {
- initPins();
- timer1_isr_init();
- os_timer_setfn(µs_overflow_timer, (os_timer_func_t*) µs_overflow_tick, 0);
- os_timer_arm(µs_overflow_timer, 60000, REPEAT);
-}
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_analog.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_analog.c
deleted file mode 100644
index bb515101..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_analog.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- analog.c - analogRead implementation for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include "wiring_private.h"
-#include "pins_arduino.h"
-
-void analogReference(uint8_t mode) {}
-
-extern int __analogRead(uint8_t pin) {
- if(pin == 17){
- //return system_adc_read();
- uint8_t i;
- uint16_t data[8];
-
- rom_i2c_writeReg_Mask(0x6C,2,0,5,5,1);
-
- ESP8266_REG(0xD5C) |= (1 << 21);
- while ((ESP8266_REG(0xD50) & (7 << 24)) > 0);
- ESP8266_REG(0xD50) &= ~(1 << 1);
- ESP8266_REG(0xD50) |= (1 << 1);
- delayMicroseconds(2);
- while ((ESP8266_REG(0xD50) & (7 << 24)) > 0);
-
- read_sar_dout(data);
- rom_i2c_writeReg_Mask(0x6C,2,0,5,5,1);
-
- while ((ESP8266_REG(0xD50) & (7 << 24)) > 0);
- ESP8266_REG(0xD5C) &= ~(1 << 21);
- ESP8266_REG(0xD60) |= (1 << 0);
- ESP8266_REG(0xD60) &= ~(1 << 0);
-
- uint16_t tout = 0;
- for (i = 0; i < 8; i++) tout += data[i];
- return tout >> 4;//tout is 10 bits fraction
- }
- return digitalRead(pin) * 1023;
-}
-
-extern int analogRead(uint8_t pin) __attribute__ ((weak, alias("__analogRead")));
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_digital.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_digital.c
deleted file mode 100644
index 54c2b557..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_digital.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- digital.c - wiring digital implementation for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#define ARDUINO_MAIN
-#include "wiring_private.h"
-#include "pins_arduino.h"
-#include "c_types.h"
-#include "eagle_soc.h"
-#include "ets_sys.h"
-
-extern void __pinMode(uint8_t pin, uint8_t mode) {
- if(pin < 16){
- if(mode == SPECIAL){
- GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
- GPEC = (1 << pin); //Disable
- GPF(pin) = GPFFS(GPFFS_BUS(pin));//Set mode to BUS (RX0, TX0, TX1, SPI, HSPI or CLK depending in the pin)
- if(pin == 3) GPF(pin) |= (1 << GPFPU);//enable pullup on RX
- } else if(mode & FUNCTION_0){
- GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
- GPEC = (1 << pin); //Disable
- GPF(pin) = GPFFS((mode >> 4) & 0x07);
- if(pin == 13 && mode == FUNCTION_4) GPF(pin) |= (1 << GPFPU);//enable pullup on RX
- } else if(mode == OUTPUT || mode == OUTPUT_OPEN_DRAIN){
- GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO
- GPC(pin) = (GPC(pin) & (0xF << GPCI)); //SOURCE(GPIO) | DRIVER(NORMAL) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
- if(mode == OUTPUT_OPEN_DRAIN) GPC(pin) |= (1 << GPCD);
- GPES = (1 << pin); //Enable
- } else if(mode == INPUT || mode == INPUT_PULLUP || mode == INPUT_PULLDOWN){
- GPF(pin) = GPFFS(GPFFS_GPIO(pin));//Set mode to GPIO
- GPEC = (1 << pin); //Disable
- GPC(pin) = (GPC(pin) & (0xF << GPCI)) | (1 << GPCD); //SOURCE(GPIO) | DRIVER(OPEN_DRAIN) | INT_TYPE(UNCHANGED) | WAKEUP_ENABLE(DISABLED)
- if(mode == INPUT_PULLUP) {
- GPF(pin) |= (1 << GPFPU); // Enable Pullup
- } else if(mode == INPUT_PULLDOWN) {
- GPF(pin) |= (1 << GPFPD); // Enable Pulldown
- }
- }
- } else if(pin == 16){
- GPF16 = GP16FFS(GPFFS_GPIO(pin));//Set mode to GPIO
- GPC16 = 0;
- if(mode == INPUT || mode == INPUT_PULLDOWN){
- if(mode == INPUT_PULLDOWN){
- GPF16 |= (1 << GP16FPD);//Enable Pulldown
- }
- GP16E &= ~1;
- } else if(mode == OUTPUT){
- GP16E |= 1;
- }
- }
-}
-
-extern void ICACHE_RAM_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
- val &= 0x01;
- if(pin < 16){
- if(val) GPOS = (1 << pin);
- else GPOC = (1 << pin);
- } else if(pin == 16){
- if(val) GP16O |= 1;
- else GP16O &= ~1;
- }
-}
-
-extern int ICACHE_RAM_ATTR __digitalRead(uint8_t pin) {
- if(pin < 16){
- return GPIP(pin);
- } else if(pin == 16){
- return GP16I & 0x01;
- }
- return 0;
-}
-
-/*
- GPIO INTERRUPTS
-*/
-
-typedef void (*voidFuncPtr)(void);
-
-typedef struct {
- uint8_t mode;
- void (*fn)(void);
-} interrupt_handler_t;
-
-static interrupt_handler_t interrupt_handlers[16];
-static uint32_t interrupt_reg = 0;
-
-void interrupt_handler(void *arg) {
- uint32_t status = GPIE;
- GPIEC = status;//clear them interrupts
- if(status == 0 || interrupt_reg == 0) return;
- ETS_GPIO_INTR_DISABLE();
- int i = 0;
- uint32_t changedbits = status & interrupt_reg;
- while(changedbits){
- while(!(changedbits & (1 << i))) i++;
- changedbits &= ~(1 << i);
- interrupt_handler_t *handler = &interrupt_handlers[i];
- if(((handler->mode & 1) == digitalRead(i)) && handler->fn) handler->fn();
- }
- ETS_GPIO_INTR_ENABLE();
-}
-
-extern void __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int mode) {
- if(pin < 16) {
- interrupt_handler_t *handler = &interrupt_handlers[pin];
- handler->mode = mode;
- handler->fn = userFunc;
- interrupt_reg |= (1 << pin);
- GPC(pin) &= ~(0xF << GPCI);//INT mode disabled
- GPIEC = (1 << pin); //Clear Interrupt for this pin
- GPC(pin) |= ((mode & 0xF) << GPCI);//INT mode "mode"
- }
-}
-
-extern void __detachInterrupt(uint8_t pin) {
- if(pin < 16) {
- GPC(pin) &= ~(0xF << GPCI);//INT mode disabled
- GPIEC = (1 << pin); //Clear Interrupt for this pin
- interrupt_reg &= ~(1 << pin);
- interrupt_handler_t *handler = &interrupt_handlers[pin];
- handler->mode = 0;
- handler->fn = 0;
- }
-}
-
-// stored state for the noInterrupts/interrupts methods
-uint32_t interruptsState = 0;
-
-void initPins() {
- //Disable UART interrupts
- system_set_os_print(0);
- U0IE = 0;
- U1IE = 0;
-
- for (int i = 0; i <= 5; ++i) {
- pinMode(i, INPUT);
- }
- // pins 6-11 are used for the SPI flash interface
- for (int i = 12; i <= 16; ++i) {
- pinMode(i, INPUT);
- }
-
- ETS_GPIO_INTR_ATTACH(interrupt_handler, &interrupt_reg);
- ETS_GPIO_INTR_ENABLE();
-}
-
-extern void pinMode(uint8_t pin, uint8_t mode) __attribute__ ((weak, alias("__pinMode")));
-extern void digitalWrite(uint8_t pin, uint8_t val) __attribute__ ((weak, alias("__digitalWrite")));
-extern int digitalRead(uint8_t pin) __attribute__ ((weak, alias("__digitalRead")));
-extern void attachInterrupt(uint8_t pin, voidFuncPtr handler, int mode) __attribute__ ((weak, alias("__attachInterrupt")));
-extern void detachInterrupt(uint8_t pin) __attribute__ ((weak, alias("__detachInterrupt")));
-
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_pwm.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_pwm.c
deleted file mode 100644
index b175f6e5..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_pwm.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- pwm.c - analogWrite implementation for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include "wiring_private.h"
-#include "pins_arduino.h"
-#include "c_types.h"
-#include "eagle_soc.h"
-#include "ets_sys.h"
-
-uint32_t pwm_mask = 0;
-uint16_t pwm_values[17] = {0,};
-uint32_t pwm_freq = 1000;
-
-uint32_t pwm_multiplier = 0;
-uint16_t pwm_steps[17];
-uint8_t pwm_steps_len = 0;
-uint32_t pwm_steps_mask[17];
-
-int pwm_sort_array(uint16_t a[], uint16_t al){
- uint16_t i, j;
- for (i = 1; i < al; i++) {
- uint16_t tmp = a[i];
- for (j = i; j >= 1 && tmp < a[j-1]; j--)
- a[j] = a[j-1];
- a[j] = tmp;
- }
- int bl = 1;
- for(i = 1; i < al; i++){
- if(a[i] != a[i-1]) a[bl++] = a[i];
- }
- return bl;
-}
-
-uint32_t pwm_get_mask(uint16_t value){
- uint32_t mask = 0;
- int i;
- for(i=0; i<17; i++){
- if((pwm_mask & (1 << i)) != 0 && pwm_values[i] == value) mask |= (1 << i);
- }
- return mask;
-}
-
-void prep_pwm_steps(){
- if(pwm_mask == 0){
- pwm_steps_len = 0;
- return;
- }
-
- int pwm_temp_steps_len = 0;
- uint16_t pwm_temp_steps[17];
- uint32_t pwm_temp_masks[17];
-
- int i;
- for(i=0; i<17; i++){
- if((pwm_mask & (1 << i)) != 0 && pwm_values[i] != 0) pwm_temp_steps[pwm_temp_steps_len++] = pwm_values[i];
- }
- pwm_temp_steps[pwm_temp_steps_len++] = PWMRANGE;
- pwm_temp_steps_len = pwm_sort_array(pwm_temp_steps, pwm_temp_steps_len) - 1;
- for(i=0; i0; i--){
- pwm_temp_steps[i] = pwm_temp_steps[i] - pwm_temp_steps[i-1];
- }
- ETS_FRC1_INTR_DISABLE();
- pwm_steps_len = pwm_temp_steps_len;
- os_memcpy(pwm_steps, pwm_temp_steps, (pwm_temp_steps_len + 1) * 2);
- os_memcpy(pwm_steps_mask, pwm_temp_masks, pwm_temp_steps_len * 4);
- pwm_multiplier = F_CPU/(PWMRANGE * pwm_freq);
- ETS_FRC1_INTR_ENABLE();
-}
-
-void pwm_timer_isr(){
- static uint8_t current_step = 0;
- static uint8_t stepcount = 0;
- static uint16_t steps[17];
- static uint32_t masks[17];
- if(current_step < stepcount){
- GPOC = masks[current_step] & 0xFFFF;
- if(masks[current_step] & 0x10000) GP16O &= ~1;
- current_step++;
- timer1_write(pwm_steps[current_step] * pwm_multiplier);
- } else {
-
- current_step = 0;
- stepcount = 0;
- if(pwm_mask == 0) return;
- GPOS = pwm_mask & 0xFFFF;
- if(pwm_mask & 0x10000) GP16O |= 1;
- timer1_write(pwm_steps[0] * pwm_multiplier);
- stepcount = pwm_steps_len;
- memcpy(steps, pwm_steps, (stepcount + 1) * 2);
- memcpy(masks, pwm_steps_mask, stepcount * 4);
- }
-}
-
-void pwm_start_timer(){
- timer1_disable();
- timer1_attachInterrupt(pwm_timer_isr);
- timer1_enable(TIM_DIV1, TIM_EDGE, TIM_SINGLE);
- timer1_write(1);
-}
-
-extern void __analogWrite(uint8_t pin, int value) {
- bool start_timer = false;
- if(value == 0){
- pwm_mask &= ~(1 << pin);
- prep_pwm_steps();
- digitalWrite(pin, LOW);
- if(pwm_mask == 0) timer1_disable();
- return;
- }
- if((pwm_mask & (1 << pin)) == 0){
- if(pwm_mask == 0) start_timer = true;
- pwm_mask |= (1 << pin);
- pinMode(pin, OUTPUT);
- digitalWrite(pin, LOW);
- }
- pwm_values[pin] = value % (PWMRANGE + 1);
- prep_pwm_steps();
- if(start_timer){
- pwm_start_timer();
- }
-}
-
-extern void __analogWriteFreq(uint32_t freq){
- pwm_freq = freq;
- prep_pwm_steps();
-}
-
-extern void analogWrite(uint8_t pin, int val) __attribute__ ((weak, alias("__analogWrite")));
-extern void analogWriteFreq(uint32_t freq) __attribute__ ((weak, alias("__analogWriteFreq")));
diff --git a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_shift.c b/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_shift.c
deleted file mode 100644
index 673db906..00000000
--- a/sparkfun/esp8266/cores/esp8266/core_esp8266_wiring_shift.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- wiring_shift.c - shiftOut() function
- Part of Arduino - http://www.arduino.cc/
-
- Copyright (c) 2005-2006 David A. Mellis
-
- Note: file renamed with a core_esp8266_ prefix to simplify linker
- script rules for moving code into irom0_text section.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA
-
- $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
- */
-
-#include "wiring_private.h"
-
-uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
- uint8_t value = 0;
- uint8_t i;
-
- for(i = 0; i < 8; ++i) {
- digitalWrite(clockPin, HIGH);
- if(bitOrder == LSBFIRST)
- value |= digitalRead(dataPin) << i;
- else
- value |= digitalRead(dataPin) << (7 - i);
- digitalWrite(clockPin, LOW);
- }
- return value;
-}
-
-void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) {
- uint8_t i;
-
- for(i = 0; i < 8; i++) {
- if(bitOrder == LSBFIRST)
- digitalWrite(dataPin, !!(val & (1 << i)));
- else
- digitalWrite(dataPin, !!(val & (1 << (7 - i))));
-
- digitalWrite(clockPin, HIGH);
- digitalWrite(clockPin, LOW);
- }
-}
diff --git a/sparkfun/esp8266/cores/esp8266/debug.cpp b/sparkfun/esp8266/cores/esp8266/debug.cpp
deleted file mode 100644
index 804d8fb8..00000000
--- a/sparkfun/esp8266/cores/esp8266/debug.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- debug.cpp - debug helper functions
- Copyright (c) 2015 Markus Sattler. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "Arduino.h"
-#include "debug.h"
-
-void ICACHE_RAM_ATTR hexdump(uint8_t *mem, uint32_t len, uint8_t cols) {
- os_printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", mem, len, len);
- for(uint32_t i = 0; i < len; i++) {
- if(i % cols == 0) {
- os_printf("\n[0x%08X] 0x%08X: ", mem, i);
- }
- os_printf("%02X ", *mem);
- mem++;
- }
- os_printf("\n");
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/debug.h b/sparkfun/esp8266/cores/esp8266/debug.h
deleted file mode 100644
index cf0830d3..00000000
--- a/sparkfun/esp8266/cores/esp8266/debug.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef ARD_DEBUG_H
-#define ARD_DEBUG_H
-
-#include
-// #define DEBUGV(...) ets_printf(__VA_ARGS__)
-#define DEBUGV(...)
-
-void hexdump(uint8_t *mem, uint32_t len, uint8_t cols = 16);
-
-
-#endif//ARD_DEBUG_H
diff --git a/sparkfun/esp8266/cores/esp8266/esp8266_peri.h b/sparkfun/esp8266/cores/esp8266/esp8266_peri.h
deleted file mode 100644
index d3841740..00000000
--- a/sparkfun/esp8266/cores/esp8266/esp8266_peri.h
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- esp8266_peri.h - Peripheral registers exposed in more AVR style for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef ESP8266_PERI_H_INCLUDED
-#define ESP8266_PERI_H_INCLUDED
-
-#include "c_types.h"
-
-#define ESP8266_REG(addr) *((volatile uint32_t *)(0x60000000+(addr)))
-#define ESP8266_DREG(addr) *((volatile uint32_t *)(0x3FF00000+(addr)))
-
-//GPIO (0-15) Control Registers
-#define GPO ESP8266_REG(0x300) //GPIO_OUT R/W (Output Level)
-#define GPOS ESP8266_REG(0x304) //GPIO_OUT_SET WO
-#define GPOC ESP8266_REG(0x308) //GPIO_OUT_CLR WO
-#define GPE ESP8266_REG(0x30C) //GPIO_ENABLE R/W (Enable)
-#define GPES ESP8266_REG(0x310) //GPIO_ENABLE_SET WO
-#define GPEC ESP8266_REG(0x314) //GPIO_ENABLE_CLR WO
-#define GPI ESP8266_REG(0x318) //GPIO_IN RO (Read Input Level)
-#define GPIE ESP8266_REG(0x31C) //GPIO_STATUS R/W (Interrupt Enable)
-#define GPIES ESP8266_REG(0x320) //GPIO_STATUS_SET WO
-#define GPIEC ESP8266_REG(0x324) //GPIO_STATUS_CLR WO
-
-#define GPOP(p) ((GPO & (1 << ((p) & 0xF))) != 0)
-#define GPEP(p) ((GPE & (1 << ((p) & 0xF))) != 0)
-#define GPIP(p) ((GPI & (1 << ((p) & 0xF))) != 0)
-#define GPIEP(p) ((GPIE & (1 << ((p) & 0xF))) != 0)
-
-//GPIO (0-15) PIN Control Registers
-#define GPC(p) ESP8266_REG(0x328 + ((p & 0xF) * 4))
-#define GPC0 ESP8266_REG(0x328) //GPIO_PIN0
-#define GPC1 ESP8266_REG(0x32C) //GPIO_PIN1
-#define GPC2 ESP8266_REG(0x330) //GPIO_PIN2
-#define GPC3 ESP8266_REG(0x334) //GPIO_PIN3
-#define GPC4 ESP8266_REG(0x338) //GPIO_PIN4
-#define GPC5 ESP8266_REG(0x33C) //GPIO_PIN5
-#define GPC6 ESP8266_REG(0x340) //GPIO_PIN6
-#define GPC7 ESP8266_REG(0x344) //GPIO_PIN7
-#define GPC8 ESP8266_REG(0x348) //GPIO_PIN8
-#define GPC9 ESP8266_REG(0x34C) //GPIO_PIN9
-#define GPC10 ESP8266_REG(0x350) //GPIO_PIN10
-#define GPC11 ESP8266_REG(0x354) //GPIO_PIN11
-#define GPC12 ESP8266_REG(0x358) //GPIO_PIN12
-#define GPC13 ESP8266_REG(0x35C) //GPIO_PIN13
-#define GPC14 ESP8266_REG(0x360) //GPIO_PIN14
-#define GPC15 ESP8266_REG(0x364) //GPIO_PIN15
-
-//GPIO (0-15) PIN Control Bits
-#define GPCWE 10 //WAKEUP_ENABLE (can be 1 only when INT_TYPE is high or low)
-#define GPCI 7 //INT_TYPE (3bits) 0:disable,1:rising,2:falling,3:change,4:low,5:high
-#define GPCD 2 //DRIVER 0:normal,1:open drain
-#define GPCS 0 //SOURCE 0:GPIO_DATA,1:SigmaDelta
-
-static uint8_t esp8266_gpioToFn[16] = {0x34, 0x18, 0x38, 0x14, 0x3C, 0x40, 0x1C, 0x20, 0x24, 0x28, 0x2C, 0x30, 0x04, 0x08, 0x0C, 0x10};
-#define GPF(p) ESP8266_REG(0x800 + esp8266_gpioToFn[(p & 0xF)])
-
-#define GPMUX ESP8266_REG(0x800)
-//GPIO (0-15) PIN Function Registers
-#define GPF0 ESP8266_REG(0x834)
-#define GPF1 ESP8266_REG(0x818)
-#define GPF2 ESP8266_REG(0x838)
-#define GPF3 ESP8266_REG(0x814)
-#define GPF4 ESP8266_REG(0x83C)
-#define GPF5 ESP8266_REG(0x840)
-#define GPF6 ESP8266_REG(0x81C)
-#define GPF7 ESP8266_REG(0x820)
-#define GPF8 ESP8266_REG(0x824)
-#define GPF9 ESP8266_REG(0x828)
-#define GPF10 ESP8266_REG(0x82C)
-#define GPF11 ESP8266_REG(0x830)
-#define GPF12 ESP8266_REG(0x804)
-#define GPF13 ESP8266_REG(0x808)
-#define GPF14 ESP8266_REG(0x80C)
-#define GPF15 ESP8266_REG(0x810)
-
-//GPIO (0-15) PIN Function Bits
-#define GPFSOE 0 //Sleep OE
-#define GPFSS 1 //Sleep Sel
-#define GPFSPD 2 //Sleep Pulldown
-#define GPFSPU 3 //Sleep Pullup
-#define GPFFS0 4 //Function Select bit 0
-#define GPFFS1 5 //Function Select bit 1
-#define GPFPD 6 //Pulldown
-#define GPFPU 7 //Pullup
-#define GPFFS2 8 //Function Select bit 2
-#define GPFFS(f) (((((f) & 4) != 0) << GPFFS2) | ((((f) & 2) != 0) << GPFFS1) | ((((f) & 1) != 0) << GPFFS0))
-#define GPFFS_GPIO(p) (((p)==0||(p)==2||(p)==4||(p)==5)?0:((p)==16)?1:3)
-#define GPFFS_BUS(p) (((p)==1||(p)==3)?0:((p)==2||(p)==12||(p)==13||(p)==14||(p)==15)?2:((p)==0)?4:1)
-
-//GPIO 16 Control Registers
-#define GP16O ESP8266_REG(0x768)
-#define GP16E ESP8266_REG(0x774)
-#define GP16I ESP8266_REG(0x78C)
-
-//GPIO 16 PIN Control Register
-#define GP16C ESP8266_REG(0x790)
-#define GPC16 GP16C
-
-//GPIO 16 PIN Function Register
-#define GP16F ESP8266_REG(0x7A0)
-#define GPF16 GP16F
-
-//GPIO 16 PIN Function Bits
-#define GP16FFS0 0 //Function Select bit 0
-#define GP16FFS1 1 //Function Select bit 1
-#define GP16FPD 3 //Pulldown
-#define GP16FSPD 5 //Sleep Pulldown
-#define GP16FFS2 6 //Function Select bit 2
-#define GP16FFS(f) (((f) & 0x03) | (((f) & 0x04) << 4))
-
-//Timer 1 Registers (23bit CountDown Timer)
-#define T1L ESP8266_REG(0x600) //Load Value (Starting Value of Counter) 23bit (0-8388607)
-#define T1V ESP8266_REG(0x604) //(RO) Current Value
-#define T1C ESP8266_REG(0x608) //Control Register
-#define T1I ESP8266_REG(0x60C) //Interrupt Status Register (1bit) write to clear
-//edge interrupt enable register
-#define TEIE ESP8266_DREG(0x04)
-#define TEIE1 0x02 //bit for timer 1
-
-//Timer 2 Registers (32bit CountUp Timer)
-#define T2L ESP8266_REG(0x620) //Load Value (Starting Value of Counter)
-#define T2V ESP8266_REG(0x624) //(RO) Current Value
-#define T2C ESP8266_REG(0x628) //Control Register
-#define T2I ESP8266_REG(0x62C) //Interrupt Status Register (1bit) write to clear
-#define T2A ESP8266_REG(0x630) //Alarm Value
-
-//Timer Control Bits
-#define TCIS 8 //Interrupt Status
-#define TCTE 7 //Timer Enable
-#define TCAR 6 //AutoReload (restart timer when condition is reached)
-#define TCPD 2 //Prescale Devider (2bit) 0:1(12.5ns/tick), 1:16(0.2us/tick), 2/3:256(3.2us/tick)
-#define TCIT 0 //Interrupt Type 0:edge, 1:level
-
-
-//UART SWAP Register
-#define USWAP ESP8266_DREG(0x28)
-#define USWAP0 2 //BIT 2 swaps UART 0
-
-//UART 0 Registers
-#define U0F ESP8266_REG(0x000) //UART FIFO
-#define U0IR ESP8266_REG(0x004) //INT_RAW
-#define U0IS ESP8266_REG(0x008) //INT_STATUS
-#define U0IE ESP8266_REG(0x00c) //INT_ENABLE
-#define U0IC ESP8266_REG(0x010) //INT_CLEAR
-#define U0D ESP8266_REG(0x014) //CLKDIV
-#define U0A ESP8266_REG(0x018) //AUTOBAUD
-#define U0S ESP8266_REG(0x01C) //STATUS
-#define U0C0 ESP8266_REG(0x020) //CONF0
-#define U0C1 ESP8266_REG(0x024) //CONF1
-#define U0LP ESP8266_REG(0x028) //LOW_PULSE
-#define U0HP ESP8266_REG(0x02C) //HIGH_PULSE
-#define U0PN ESP8266_REG(0x030) //PULSE_NUM
-#define U0DT ESP8266_REG(0x078) //DATE
-#define U0ID ESP8266_REG(0x07C) //ID
-
-//UART 1 Registers
-#define U1F ESP8266_REG(0xF00) //UART FIFO
-#define U1IR ESP8266_REG(0xF04) //INT_RAW
-#define U1IS ESP8266_REG(0xF08) //INT_STATUS
-#define U1IE ESP8266_REG(0xF0c) //INT_ENABLE
-#define U1IC ESP8266_REG(0xF10) //INT_CLEAR
-#define U1D ESP8266_REG(0xF14) //CLKDIV
-#define U1A ESP8266_REG(0xF18) //AUTOBAUD
-#define U1S ESP8266_REG(0xF1C) //STATUS
-#define U1C0 ESP8266_REG(0xF20) //CONF0
-#define U1C1 ESP8266_REG(0xF24) //CONF1
-#define U1LP ESP8266_REG(0xF28) //LOW_PULSE
-#define U1HP ESP8266_REG(0xF2C) //HIGH_PULSE
-#define U1PN ESP8266_REG(0xF30) //PULSE_NUM
-#define U1DT ESP8266_REG(0xF78) //DATE
-#define U1ID ESP8266_REG(0xF7C) //ID
-
-//UART(uart) Registers
-#define USF(u) ESP8266_REG(0x000+(0xF00*(u&1))) //UART FIFO
-#define USIR(u) ESP8266_REG(0x004+(0xF00*(u&1))) //INT_RAW
-#define USIS(u) ESP8266_REG(0x008+(0xF00*(u&1))) //INT_STATUS
-#define USIE(u) ESP8266_REG(0x00c+(0xF00*(u&1))) //INT_ENABLE
-#define USIC(u) ESP8266_REG(0x010+(0xF00*(u&1))) //INT_CLEAR
-#define USD(u) ESP8266_REG(0x014+(0xF00*(u&1))) //CLKDIV
-#define USA(u) ESP8266_REG(0x018+(0xF00*(u&1))) //AUTOBAUD
-#define USS(u) ESP8266_REG(0x01C+(0xF00*(u&1))) //STATUS
-#define USC0(u) ESP8266_REG(0x020+(0xF00*(u&1))) //CONF0
-#define USC1(u) ESP8266_REG(0x024+(0xF00*(u&1))) //CONF1
-#define USLP(u) ESP8266_REG(0x028+(0xF00*(u&1))) //LOW_PULSE
-#define USHP(u) ESP8266_REG(0x02C+(0xF00*(u&1))) //HIGH_PULSE
-#define USPN(u) ESP8266_REG(0x030+(0xF00*(u&1))) //PULSE_NUM
-#define USDT(u) ESP8266_REG(0x078+(0xF00*(u&1))) //DATE
-#define USID(u) ESP8266_REG(0x07C+(0xF00*(u&1))) //ID
-
-//UART INT Registers Bits
-#define UITO 8 //RX FIFO TimeOut
-#define UIBD 7 //Break Detected
-#define UICTS 6 //CTS Changed
-#define UIDSR 5 //DSR Change
-#define UIOF 4 //RX FIFO OverFlow
-#define UIFR 3 //Frame Error
-#define UIPE 2 //Parity Error
-#define UIFE 1 //TX FIFO Empty
-#define UIFF 0 //RX FIFO Full
-
-//UART STATUS Registers Bits
-#define USTX 31 //TX PIN Level
-#define USRTS 30 //RTS PIN Level
-#define USDTR 39 //DTR PIN Level
-#define USTXC 16 //TX FIFO COUNT (8bit)
-#define USRXD 15 //RX PIN Level
-#define USCTS 14 //CTS PIN Level
-#define USDSR 13 //DSR PIN Level
-#define USRXC 0 //RX FIFO COUNT (8bit)
-
-//UART CONF0 Registers Bits
-#define UCDTRI 24 //Invert DTR
-#define UCRTSI 23 //Invert RTS
-#define UCTXI 22 //Invert TX
-#define UCDSRI 21 //Invert DSR
-#define UCCTSI 20 //Invert CTS
-#define UCRXI 19 //Invert RX
-#define UCTXRST 18 //Reset TX FIFO
-#define UCRXRST 17 //Reset RX FIFO
-#define UCTXHFE 15 //TX Harware Flow Enable
-#define UCLBE 14 //LoopBack Enable
-#define UCBRK 8 //Send Break on the TX line
-#define UCSWDTR 7 //Set this bit to assert DTR
-#define UCSWRTS 6 //Set this bit to assert RTS
-#define UCSBN 4 //StopBits Count (2bit) 0:disable, 1:1bit, 2:1.5bit, 3:2bit
-#define UCBN 2 //DataBits Count (2bin) 0:5bit, 1:6bit, 2:7bit, 3:8bit
-#define UCPAE 1 //Parity Enable
-#define UCPA 0 //Parity 0:even, 1:odd
-
-//UART CONF1 Registers Bits
-#define UCTOE 31 //RX TimeOut Enable
-#define UCTOT 24 //RX TimeOut Treshold (7bit)
-#define UCRXHFE 23 //RX Harware Flow Enable
-#define UCRXHFT 16 //RX Harware Flow Treshold (7bit)
-#define UCFET 8 //TX FIFO Empty Treshold (7bit)
-#define UCFFT 0 //RX FIFO Full Treshold (7bit)
-
-//WDT Register used for UART
-#define WDTRST ESP8266_REG(0x914)
-#define WDT_RESET() (WDTRST = 0x73)
-
-//SPI0 Registers (SPI0 is used for the flash)
-#define SPI0CMD ESP8266_REG(0x200)
-#define SPI0A ESP8266_REG(0x204)
-#define SPI0C ESP8266_REG(0x208)
-#define SPI0C1 ESP8266_REG(0x20C)
-#define SPI0RS ESP8266_REG(0x210)
-#define SPI0C2 ESP8266_REG(0x214)
-#define SPI0CLK ESP8266_REG(0x218)
-#define SPI0U ESP8266_REG(0x21C)
-#define SPI0U1 ESP8266_REG(0x220)
-#define SPI0U2 ESP8266_REG(0x224)
-#define SPI0WS ESP8266_REG(0x228)
-#define SPI0P ESP8266_REG(0x22C)
-#define SPI0S ESP8266_REG(0x230)
-#define SPI0S1 ESP8266_REG(0x234)
-#define SPI0S2 ESP8266_REG(0x238)
-#define SPI0S3 ESP8266_REG(0x23C)
-#define SPI0W0 ESP8266_REG(0x240)
-#define SPI0W1 ESP8266_REG(0x244)
-#define SPI0W2 ESP8266_REG(0x248)
-#define SPI0W3 ESP8266_REG(0x24C)
-#define SPI0W4 ESP8266_REG(0x250)
-#define SPI0W5 ESP8266_REG(0x254)
-#define SPI0W6 ESP8266_REG(0x258)
-#define SPI0W7 ESP8266_REG(0x25C)
-#define SPI0W8 ESP8266_REG(0x260)
-#define SPI0W9 ESP8266_REG(0x264)
-#define SPI0W10 ESP8266_REG(0x268)
-#define SPI0W11 ESP8266_REG(0x26C)
-#define SPI0W12 ESP8266_REG(0x270)
-#define SPI0W13 ESP8266_REG(0x274)
-#define SPI0W14 ESP8266_REG(0x278)
-#define SPI0W15 ESP8266_REG(0x27C)
-#define SPI0E3 ESP8266_REG(0x2FC)
-#define SPI0W(p) ESP8266_REG(0x240 + ((p & 0xF) * 4))
-
-//SPI1 Registers
-#define SPI1CMD ESP8266_REG(0x100)
-#define SPI1A ESP8266_REG(0x104)
-#define SPI1C ESP8266_REG(0x108)
-#define SPI1C1 ESP8266_REG(0x10C)
-#define SPI1RS ESP8266_REG(0x110)
-#define SPI1C2 ESP8266_REG(0x114)
-#define SPI1CLK ESP8266_REG(0x118)
-#define SPI1U ESP8266_REG(0x11C)
-#define SPI1U1 ESP8266_REG(0x120)
-#define SPI1U2 ESP8266_REG(0x124)
-#define SPI1WS ESP8266_REG(0x128)
-#define SPI1P ESP8266_REG(0x12C)
-#define SPI1S ESP8266_REG(0x130)
-#define SPI1S1 ESP8266_REG(0x134)
-#define SPI1S2 ESP8266_REG(0x138)
-#define SPI1S3 ESP8266_REG(0x13C)
-#define SPI1W0 ESP8266_REG(0x140)
-#define SPI1W1 ESP8266_REG(0x144)
-#define SPI1W2 ESP8266_REG(0x148)
-#define SPI1W3 ESP8266_REG(0x14C)
-#define SPI1W4 ESP8266_REG(0x150)
-#define SPI1W5 ESP8266_REG(0x154)
-#define SPI1W6 ESP8266_REG(0x158)
-#define SPI1W7 ESP8266_REG(0x15C)
-#define SPI1W8 ESP8266_REG(0x160)
-#define SPI1W9 ESP8266_REG(0x164)
-#define SPI1W10 ESP8266_REG(0x168)
-#define SPI1W11 ESP8266_REG(0x16C)
-#define SPI1W12 ESP8266_REG(0x170)
-#define SPI1W13 ESP8266_REG(0x174)
-#define SPI1W14 ESP8266_REG(0x178)
-#define SPI1W15 ESP8266_REG(0x17C)
-#define SPI1E0 ESP8266_REG(0x1F0)
-#define SPI1E1 ESP8266_REG(0x1F4)
-#define SPI1E2 ESP8266_REG(0x1F8)
-#define SPI1E3 ESP8266_REG(0x1FC)
-#define SPI1W(p) ESP8266_REG(0x140 + ((p & 0xF) * 4))
-
-//SPI0, SPI1 & I2S Interupt Register
-#define SPIIR ESP8266_DREG(0x20)
-#define SPII0 4 //SPI0 Interrupt
-#define SPII1 7 //SPI1 Interrupt
-#define SPII2 9 //I2S Interrupt
-
-//SPI CMD
-#define SPICMDREAD (1 << 31) //SPI_FLASH_READ
-#define SPICMDWREN (1 << 30) //SPI_FLASH_WREN
-#define SPICMDWRDI (1 << 29) //SPI_FLASH_WRDI
-#define SPICMDRDID (1 << 28) //SPI_FLASH_RDID
-#define SPICMDRDSR (1 << 27) //SPI_FLASH_RDSR
-#define SPICMDWRSR (1 << 26) //SPI_FLASH_WRSR
-#define SPICMDPP (1 << 25) //SPI_FLASH_PP
-#define SPICMDSE (1 << 24) //SPI_FLASH_SE
-#define SPICMDBE (1 << 23) //SPI_FLASH_BE
-#define SPICMDCE (1 << 22) //SPI_FLASH_CE
-#define SPICMDDP (1 << 21) //SPI_FLASH_DP
-#define SPICMDRES (1 << 20) //SPI_FLASH_RES
-#define SPICMDHPM (1 << 19) //SPI_FLASH_HPM
-#define SPICMDUSR (1 << 18) //SPI_FLASH_USR
-#define SPIBUSY (1 << 18) //SPI_USR
-
-//SPI CTRL (SPIxC)
-#define SPICWBO (1 << 26) //SPI_WR_BIT_ODER
-#define SPICRBO (1 << 25) //SPI_RD_BIT_ODER
-#define SPICQIO (1 << 24) //SPI_QIO_MODE
-#define SPICDIO (1 << 23) //SPI_DIO_MODE
-#define SPIC2BSE (1 << 22) //SPI_TWO_BYTE_STATUS_EN
-#define SPICWPR (1 << 21) //SPI_WP_REG
-#define SPICQOUT (1 << 20) //SPI_QOUT_MODE
-#define SPICSHARE (1 << 19) //SPI_SHARE_BUS
-#define SPICHOLD (1 << 18) //SPI_HOLD_MODE
-#define SPICAHB (1 << 17) //SPI_ENABLE_AHB
-#define SPICSSTAAI (1 << 16) //SPI_SST_AAI
-#define SPICRESANDRES (1 << 15) //SPI_RESANDRES
-#define SPICDOUT (1 << 14) //SPI_DOUT_MODE
-#define SPICFASTRD (1 << 13) //SPI_FASTRD_MODE
-
-//SPI CTRL1 (SPIxC1)
-#define SPIC1TCSH 0xF //SPI_T_CSH
-#define SPIC1TCSH_S 28 //SPI_T_CSH_S
-#define SPIC1TRES 0xFFF //SPI_T_RES
-#define SPIC1TRES_S 16 //SPI_T_RES_S
-#define SPIC1BTL 0xFFFF //SPI_BUS_TIMER_LIMIT
-#define SPIC1BTL_S 0 //SPI_BUS_TIMER_LIMIT_S
-
-//SPI Status (SPIxRS)
-#define SPIRSEXT 0xFF //SPI_STATUS_EXT
-#define SPIRSEXT_S 24 //SPI_STATUS_EXT_S
-#define SPIRSWB 0xFF //SPI_WB_MODE
-#define SPIRSWB_S 16 //SPI_WB_MODE_S
-#define SPIRSSP (1 << 7) //SPI_FLASH_STATUS_PRO_FLAG
-#define SPIRSTBP (1 << 5) //SPI_FLASH_TOP_BOT_PRO_FLAG
-#define SPIRSBP2 (1 << 4) //SPI_FLASH_BP2
-#define SPIRSBP1 (1 << 3) //SPI_FLASH_BP1
-#define SPIRSBP0 (1 << 2) //SPI_FLASH_BP0
-#define SPIRSWRE (1 << 1) //SPI_FLASH_WRENABLE_FLAG
-#define SPIRSBUSY (1 << 0) //SPI_FLASH_BUSY_FLAG
-
-//SPI CTRL2 (SPIxC2)
-#define SPIC2CSDN 0xF //SPI_CS_DELAY_NUM
-#define SPIC2CSDN_S 28 //SPI_CS_DELAY_NUM_S
-#define SPIC2CSDM 0x3 //SPI_CS_DELAY_MODE
-#define SPIC2CSDM_S 26 //SPI_CS_DELAY_MODE_S
-#define SPIC2MOSIDN 0x7 //SPI_MOSI_DELAY_NUM
-#define SPIC2MOSIDN_S 23 //SPI_MOSI_DELAY_NUM_S
-#define SPIC2MOSIDM 0x3 //SPI_MOSI_DELAY_MODE
-#define SPIC2MOSIDM_S 21 //SPI_MOSI_DELAY_MODE_S
-#define SPIC2MISODN 0x7 //SPI_MISO_DELAY_NUM
-#define SPIC2MISODN_S 18 //SPI_MISO_DELAY_NUM_S
-#define SPIC2MISODM 0x3 //SPI_MISO_DELAY_MODE
-#define SPIC2MISODM_S 16 //SPI_MISO_DELAY_MODE_S
-#define SPIC2CKOHM 0xF //SPI_CK_OUT_HIGH_MODE
-#define SPIC2CKOHM_S 12 //SPI_CK_OUT_HIGH_MODE_S
-#define SPIC2CKOLM 0xF //SPI_CK_OUT_LOW_MODE
-#define SPIC2CKOLM_S 8 //SPI_CK_OUT_LOW_MODE_S
-#define SPIC2HT 0xF //SPI_HOLD_TIME
-#define SPIC2HT_S 4 //SPI_HOLD_TIME_S
-#define SPIC2ST 0xF //SPI_SETUP_TIME
-#define SPIC2ST_S 0 //SPI_SETUP_TIME_S
-
-//SPI CLK (SPIxCLK)
-#define SPICLK_EQU_SYSCLK (1 << 31) //SPI_CLK_EQU_SYSCLK
-#define SPICLKDIVPRE 0x1FFF //SPI_CLKDIV_PRE
-#define SPICLKDIVPRE_S 18 //SPI_CLKDIV_PRE_S
-#define SPICLKCN 0x3F //SPI_CLKCNT_N
-#define SPICLKCN_S 12 //SPI_CLKCNT_N_S
-#define SPICLKCH 0x3F //SPI_CLKCNT_H
-#define SPICLKCH_S 6 //SPI_CLKCNT_H_S
-#define SPICLKCL 0x3F //SPI_CLKCNT_L
-#define SPICLKCL_S 0 //SPI_CLKCNT_L_S
-
-//SPI Phases (SPIxU)
-#define SPIUCOMMAND (1 << 31) //COMMAND pahse, SPI_USR_COMMAND
-#define SPIUADDR (1 << 30) //ADDRESS phase, SPI_FLASH_USR_ADDR
-#define SPIUDUMMY (1 << 29) //DUMMY phase, SPI_FLASH_USR_DUMMY
-#define SPIUMISO (1 << 28) //MISO phase, SPI_FLASH_USR_DIN
-#define SPIUMOSI (1 << 27) //MOSI phase, SPI_FLASH_DOUT
-#define SPIUDUMMYIDLE (1 << 26) //SPI_USR_DUMMY_IDLE
-#define SPIUMOSIH (1 << 25) //MOSI phase uses W8-W15, SPI_USR_DOUT_HIGHPART
-#define SPIUMISOH (1 << 24) //MISO pahse uses W8-W15, SPI_USR_DIN_HIGHPART
-#define SPIUPREPHOLD (1 << 23) //SPI_USR_PREP_HOLD
-#define SPIUCMDHOLD (1 << 22) //SPI_USR_CMD_HOLD
-#define SPIUADDRHOLD (1 << 21) //SPI_USR_ADDR_HOLD
-#define SPIUDUMMYHOLD (1 << 20) //SPI_USR_DUMMY_HOLD
-#define SPIUMISOHOLD (1 << 19) //SPI_USR_DIN_HOLD
-#define SPIUMOSIHOLD (1 << 18) //SPI_USR_DOUT_HOLD
-#define SPIUHOLDPOL (1 << 17) //SPI_USR_HOLD_POL
-#define SPIUSIO (1 << 16) //SPI_SIO
-#define SPIUFWQIO (1 << 15) //SPI_FWRITE_QIO
-#define SPIUFWDIO (1 << 14) //SPI_FWRITE_DIO
-#define SPIUFWQUAD (1 << 13) //SPI_FWRITE_QUAD
-#define SPIUFWDUAL (1 << 12) //SPI_FWRITE_DUAL
-#define SPIUWRBYO (1 << 11) //SPI_WR_BYTE_ORDER
-#define SPIURDBYO (1 << 10) //SPI_RD_BYTE_ORDER
-#define SPIUAHBEM 0x3 //SPI_AHB_ENDIAN_MODE
-#define SPIUAHBEM_S 8 //SPI_AHB_ENDIAN_MODE_S
-#define SPIUSME (1 << 7) //SPI Master Edge (0:falling, 1:rising), SPI_CK_OUT_EDGE
-#define SPIUSSE (1 << 6) //SPI Slave Edge (0:falling, 1:rising), SPI_CK_I_EDGE
-#define SPIUCSSETUP (1 << 5) //SPI_CS_SETUP
-#define SPIUCSHOLD (1 << 4) //SPI_CS_HOLD
-#define SPIUAHBUCMD (1 << 3) //SPI_AHB_USR_COMMAND
-#define SPIUAHBUCMD4B (1 << 1) //SPI_AHB_USR_COMMAND_4BYTE
-#define SPIUDUPLEX (1 << 0) //SPI_DOUTDIN
-
-//SPI Phase Length Locations
-#define SPILCOMMAND 28 //4 bit in SPIxU2 default 7 (8bit)
-#define SPILADDR 16 //6 bit in SPIxU1 default:23 (24bit)
-#define SPILDUMMY 0 //8 bit in SPIxU1 default:0 (0 cycles)
-#define SPILMISO 8 //9 bit in SPIxU1 default:0 (1bit)
-#define SPILMOSI 17 //9 bit in SPIxU1 default:0 (1bit)
-//SPI Phase Length Masks
-#define SPIMCOMMAND 0xF
-#define SPIMADDR 0x3F
-#define SPIMDUMMY 0xFF
-#define SPIMMISO 0x1FF
-#define SPIMMOSI 0x1FF
-
-//SPI Slave (SPIxS)
-#define SPISSRES (1 << 31) //SYNC RESET, SPI_SYNC_RESET
-#define SPISE (1 << 30) //Slave Enable, SPI_SLAVE_MODE
-#define SPISBE (1 << 29) //WR/RD BUF enable, SPI_SLV_WR_RD_BUF_EN
-#define SPISSE (1 << 28) //STA enable, SPI_SLV_WR_RD_STA_EN
-#define SPISCD (1 << 27) //CMD define, SPI_SLV_CMD_DEFINE
-#define SPISTRCNT 0xF //SPI_TRANS_CNT
-#define SPISTRCNT_S 23 //SPI_TRANS_CNT_S
-#define SPISSLS 0x7 //SPI_SLV_LAST_STATE
-#define SPISSLS_S 20 //SPI_SLV_LAST_STATE_S
-#define SPISSLC 0x7 //SPI_SLV_LAST_COMMAND
-#define SPISSLC_S 17 //SPI_SLV_LAST_COMMAND_S
-#define SPISCSIM 0x3 //SPI_CS_I_MODE
-#define SPIDCSIM_S 10 //SPI_CS_I_MODE_S
-#define SPISTRIE (1 << 9) //TRANS interrupt enable
-#define SPISWSIE (1 << 8) //WR_STA interrupt enable
-#define SPISRSIE (1 << 7) //RD_STA interrupt enable
-#define SPISWBIE (1 << 6) //WR_BUF interrupt enable
-#define SPISRBIE (1 << 5) //RD_BUF interrupt enable
-#define SPISTRIS (1 << 4) //TRANS interrupt status
-#define SPISWSIS (1 << 3) //WR_STA interrupt status
-#define SPISRSIS (1 << 2) //RD_STA interrupt status
-#define SPISWBIS (1 << 1) //WR_BUF interrupt status
-#define SPISRBIS (1 << 0) //RD_BUF interrupt status
-
-//SPI Slave1 (SPIxS1)
-#define SPIS1LSTA 27 //5 bit in SPIxS1 default:0 (1bit), SPI_SLV_STATUS_BITLEN
-#define SPIS1FE (1 << 26) //SPI_SLV_STATUS_FAST_EN
-#define SPIS1RSTA (1 << 25) //default:0 enable STA read from Master, SPI_SLV_STATUS_READBACK
-#define SPIS1LBUF 16 //9 bit in SPIxS1 default:0 (1bit), SPI_SLV_BUF_BITLEN
-#define SPIS1LRBA 10 //6 bit in SPIxS1 default:0 (1bit), SPI_SLV_RD_ADDR_BITLEN
-#define SPIS1LWBA 4 //6 bit in SPIxS1 default:0 (1bit), SPI_SLV_WR_ADDR_BITLEN
-#define SPIS1WSDE (1 << 3) //SPI_SLV_WRSTA_DUMMY_EN
-#define SPIS1RSDE (1 << 2) //SPI_SLV_RDSTA_DUMMY_EN
-#define SPIS1WBDE (1 << 1) //SPI_SLV_WRBUF_DUMMY_EN
-#define SPIS1RBDE (1 << 0) //SPI_SLV_RDBUF_DUMMY_EN
-
-//SPI Slave2 (SPIxS2)
-#define SPIS2WBDL 0xFF //SPI_SLV_WRBUF_DUMMY_CYCLELEN
-#define SPIS2WBDL_S 24 //SPI_SLV_WRBUF_DUMMY_CYCLELEN_S
-#define SPIS2RBDL 0xFF //SPI_SLV_RDBUF_DUMMY_CYCLELEN
-#define SPIS2RBDL_S 16 //SPI_SLV_RDBUF_DUMMY_CYCLELEN_S
-#define SPIS2WSDL 0xFF //SPI_SLV_WRSTA_DUMMY_CYCLELEN
-#define SPIS2WSDL_S 8 //SPI_SLV_WRSTA_DUMMY_CYCLELEN_S
-#define SPIS2RSDL 0xFF //SPI_SLV_RDSTA_DUMMY_CYCLELEN
-#define SPIS2RSDL_S 0 //SPI_SLV_RDSTA_DUMMY_CYCLELEN_S
-
-//SPI Slave3 (SPIxS3)
-#define SPIS3WSCV 0xFF //SPI_SLV_WRSTA_CMD_VALUE
-#define SPIS3WSCV_S 24 //SPI_SLV_WRSTA_CMD_VALUE_S
-#define SPIS3RSCV 0xFF //SPI_SLV_RDSTA_CMD_VALUE
-#define SPIS3RSCV_S 16 //SPI_SLV_RDSTA_CMD_VALUE_S
-#define SPIS3WBCV 0xFF //SPI_SLV_WRBUF_CMD_VALUE
-#define SPIS3WBCV_S 8 //SPI_SLV_WRBUF_CMD_VALUE_S
-#define SPIS3RBCV 0xFF //SPI_SLV_RDBUF_CMD_VALUE
-#define SPIS3RBCV_S 0 //SPI_SLV_RDBUF_CMD_VALUE_S
-
-//SPI EXT0 (SPIxE0)
-#define SPIE0TPPEN (1 << 31) //SPI_T_PP_ENA
-#define SPIE0TPPS 0xF //SPI_T_PP_SHIFT
-#define SPIE0TPPS_S 16 //SPI_T_PP_SHIFT_S
-#define SPIE0TPPT 0xFFF //SPI_T_PP_TIME
-#define SPIE0TPPT_S 0 //SPI_T_PP_TIME_S
-
-//SPI EXT1 (SPIxE1)
-#define SPIE1TEREN (1 << 31) //SPI_T_ERASE_ENA
-#define SPIE1TERS 0xF //SPI_T_ERASE_SHIFT
-#define SPIE1TERS_S 16 //SPI_T_ERASE_SHIFT_S
-#define SPIE1TERT 0xFFF //SPI_T_ERASE_TIME
-#define SPIE1TERT_S 0 //SPI_T_ERASE_TIME_S
-
-//SPI EXT2 (SPIxE2)
-#define SPIE2ST 0x7 //SPI_ST
-#define SPIE2ST_S 0 //SPI_ST_S
-
-//SPI EXT3 (SPIxE3)
-#define SPIE2IHEN 0x3 //SPI_INT_HOLD_ENA
-#define SPIE2IHEN_S 0 //SPI_INT_HOLD_ENA_S
-
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/libc_replacements.c b/sparkfun/esp8266/cores/esp8266/libc_replacements.c
deleted file mode 100644
index 519ea233..00000000
--- a/sparkfun/esp8266/cores/esp8266/libc_replacements.c
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- libc_replacements.c - replaces libc functions with functions
- from Espressif SDK
-
- Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Modified 03 April 2015 by Markus Sattler
-
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "ets_sys.h"
-#include "os_type.h"
-#include "osapi.h"
-#include "mem.h"
-#include "user_interface.h"
-
-void* malloc(size_t size) {
- size = ((size + 3) & ~((size_t)0x3));
- return os_malloc(size);
-}
-
-void free(void* ptr) {
- os_free(ptr);
-}
-
-void* realloc(void* ptr, size_t size) {
- size = ((size + 3) & ~((size_t)0x3));
- return os_realloc(ptr, size);
-}
-
-int puts(const char * str) {
- return os_printf("%s", str);
-}
-
-int printf(const char* format, ...) {
- int ret;
- va_list arglist;
- va_start(arglist, format);
- ret = ets_vprintf(format, arglist);
- va_end(arglist);
- return ret;
-}
-
-int sprintf(char* buffer, const char* format, ...) {
- int ret;
- va_list arglist;
- va_start(arglist, format);
- ret = ets_vsprintf(buffer, format, arglist);
- va_end(arglist);
- return ret;
-}
-
-int snprintf(char* buffer, size_t size, const char* format, ...) {
- int ret;
- va_list arglist;
- va_start(arglist, format);
- ret = ets_vsnprintf(buffer, size, format, arglist);
- va_end(arglist);
- return ret;
-}
-
-int vsnprintf(char * buffer, size_t size, const char * format, va_list arg) {
- return ets_vsnprintf(buffer, size, format, arg);
-}
-
-int memcmp(const void *s1, const void *s2, size_t n) {
- return ets_memcmp(s1, s2, n);
-}
-
-void* memcpy(void *dest, const void *src, size_t n) {
- return ets_memcpy(dest, src, n);
-}
-
-void* memset(void *s, int c, size_t n) {
- return ets_memset(s, c, n);
-}
-
-int strcmp(const char *s1, const char *s2) {
- return ets_strcmp(s1, s2);
-}
-
-char* strcpy(char *dest, const char *src) {
- return ets_strcpy(dest, src);
-}
-
-size_t strlen(const char *s) {
- return ets_strlen(s);
-}
-
-int strncmp(const char *s1, const char *s2, size_t len) {
- return ets_strncmp(s1, s2, len);
-}
-
-char* strncpy(char * dest, const char * src, size_t n) {
- return ets_strncpy(dest, src, n);
-}
-
-size_t ICACHE_FLASH_ATTR strnlen(const char *s, size_t len) {
- // there is no ets_strnlen
- const char *cp;
- for (cp = s; len != 0 && *cp != '\0'; cp++, len--);
- return (size_t)(cp - s);
-}
-
-char* strstr(const char *haystack, const char *needle) {
- return ets_strstr(haystack, needle);
-}
-
-char* ICACHE_FLASH_ATTR strchr(const char * str, int character) {
- while(1) {
- if(*str == 0x00) {
- return NULL;
- }
- if(*str == (char) character) {
- return (char *) str;
- }
- str++;
- }
-}
-
-char * ICACHE_FLASH_ATTR strrchr(const char * str, int character) {
- char * ret = NULL;
- while(1) {
- if(*str == 0x00) {
- return ret;
- }
- if(*str == (char) character) {
- ret = (char *) str;
- }
- str++;
- }
-}
-
-char* ICACHE_FLASH_ATTR strcat(char * dest, const char * src) {
- return strncat(dest, src, strlen(src));
-}
-
-char* ICACHE_FLASH_ATTR strncat(char * dest, const char * src, size_t n) {
- uint32_t offset = strlen(dest);
- for(uint32_t i = 0; i < n; i++) {
- *(dest + i + offset) = *(src + i);
- if(*(src + i) == 0x00) {
- break;
- }
- }
- return dest;
-}
-
-
-char* ICACHE_FLASH_ATTR strtok_r(char * str, const char * delimiters, char ** temp) {
- static char * ret = NULL;
- char * start = NULL;
- char * end = NULL;
- uint32_t size = 0;
-
- if(str == NULL) {
- if(temp == NULL) {
- return NULL;
- }
- start = *temp;
- } else {
- start = str;
- }
-
- if(start == NULL) {
- return NULL;
- }
-
- if(delimiters == NULL) {
- return NULL;
- }
-
- end = start;
-
- while(1) {
- for(uint16_t i = 0; i < strlen(delimiters); i++) {
- if(*end == *(delimiters + i)) {
- break;
- }
- }
- end++;
- if(*end == 0x00) {
- break;
- }
- }
-
- *temp = end;
-
- if(ret != NULL) {
- free(ret);
- }
-
- size = (end - start);
- ret = (char *) malloc(size);
- strncpy(ret, start, size);
- return ret;
-}
-
-char* ICACHE_FLASH_ATTR strtok(char * str, const char * delimiters) {
- static char * ret = NULL;
- ret = strtok_r(str, delimiters, &ret);
- return ret;
-}
-
-int ICACHE_FLASH_ATTR strcasecmp(const char * str1, const char * str2) {
- int d = 0;
- while(1) {
- int c1 = tolower(*str1++);
- int c2 = tolower(*str2++);
- if(((d = c1 - c2) != 0) || (c2 == '\0')) {
- break;
- }
- }
- return d;
-}
-
-char* ICACHE_FLASH_ATTR strdup(const char *str) {
- size_t len = strlen(str) + 1;
- char *cstr = malloc(len);
- if(cstr) {
- memcpy(cstr, str, len);
- }
- return cstr;
-}
-
-long int ICACHE_FLASH_ATTR strtol(const char* str, char** endptr, int base) {
- long int result = 0;
- int sign = 1;
-
- while(isspace(*str)) {
- str++;
- }
-
- if(*str == 0x00) {
- // only space in str?
- *endptr = (char*) str;
- return result;
- }
-
- switch(base) {
- case 10:
-
- if(*str == '-') {
- sign = -1;
- str++;
- } else if(*str == '+') {
- str++;
- }
-
- for(uint8_t i = 0; *str; i++, str++) {
- int x = *str - '0';
- if(x < 0 || x > 9) {
- break;
- }
- result = result * 10 + x;
- }
- break;
- case 2:
- for(uint8_t i = 0; *str; i++, str++) {
- int x = *str - '0';
- if(x < 0 || x > 1) {
- break;
- }
- result = result * 2 + x;
- }
- break;
- case 16:
- default:
- os_printf("fnk: strtol() only supports base 10 and 2 ATM!\n");
- break;
-
- }
- *endptr = (char*) str;
- return sign * result;
-}
-
-// based on Source:
-// https://github.com/anakod/Sming/blob/master/Sming/system/stringconversion.cpp#L93
-double ICACHE_FLASH_ATTR strtod(const char* str, char** endptr) {
- double result = 0.0;
- double factor = 1.0;
- bool decimals = false;
- char c;
-
- while(isspace(*str)) {
- str++;
- }
-
- if(*str == 0x00) {
- // only space in str?
- *endptr = (char*) str;
- return result;
- }
-
- if(*str == '-') {
- factor = -1;
- str++;
- } else if(*str == '+') {
- str++;
- }
-
- while((c = *str)) {
- if(c == '.') {
- decimals = true;
- str++;
- continue;
- }
-
- int d = c - '0';
- if(d < 0 || d > 9) {
- break;
- }
-
- result = 10.0 * result + d;
- if(decimals) {
- factor *= 0.1;
- }
-
- str++;
- }
- *endptr = (char*) str;
- return result * factor;
-}
-
-// ##########################################################################
-// ctype functions
-// ##########################################################################
-
-int isalnum(int c) {
- if(isalpha(c) || isdigit(c)) {
- return 1;
- }
- return 0;
-}
-
-int isalpha(int c) {
- if(islower(c) || isupper(c)) {
- return 1;
- }
- return 0;
-}
-
-int iscntrl(int c) {
- if(c <= 0x1F || c == 0x7F) {
- return 1;
- }
- return 0;
-}
-
-int isdigit(int c) {
- if(c >= '0' && c <= '9') {
- return 1;
- }
- return 0;
-}
-
-int isgraph(int c) {
- if(isprint(c) && c != ' ') {
- return 1;
- }
- return 0;
-}
-
-int islower(int c) {
- if(c >= 'a' && c <= 'z') {
- return 1;
- }
- return 0;
-}
-
-int isprint(int c) {
- if(!iscntrl(c)) {
- return 1;
- }
- return 0;
-}
-
-int ispunct(int c) {
- if(isgraph(c) && !isalnum(c)) {
- return 1;
- }
- return 0;
-}
-
-int isspace(int c) {
- switch(c) {
- case 0x20: // ' '
- case 0x09: // '\t'
- case 0x0a: // '\n'
- case 0x0b: // '\v'
- case 0x0c: // '\f'
- case 0x0d: // '\r'
- return 1;
- }
- return 0;
-}
-
-int isupper(int c) {
- if(c >= 'A' && c <= 'Z') {
- return 1;
- }
- return 0;
-}
-
-int isxdigit(int c) {
- if(c >= 'A' && c <= 'F') {
- return 1;
- }
- if(c >= 'a' && c <= 'f') {
- return 1;
- }
- if(isdigit(c)) {
- return 1;
- }
- return 0;
-}
-
-int tolower(int c) {
- if(isupper(c)) {
- c += 0x20;
- }
- return c;
-}
-
-int toupper(int c) {
- if(islower(c)) {
- c -= 0x20;
- }
- return c;
-}
-
-int isblank(int c) {
- switch(c) {
- case 0x20: // ' '
- case 0x09: // '\t'
- return 1;
- }
- return 0;
-}
-
-// ##########################################################################
-
-static int errno_var = 0;
-
-int* ICACHE_FLASH_ATTR __errno(void) {
- os_printf("__errno is called last error: %d (not current)\n", errno_var);
- return &errno_var;
-}
-
-// ##########################################################################
-// __ieee754 functions
-// ##########################################################################
-
-double ICACHE_FLASH_ATTR __ieee754_sinh(double x) {
- return sinh(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_hypot(double x, double y) {
- return hypot(x, y);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_hypotf(float x, float y) {
- return hypotf(x, y);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_logf(float x) {
- return logf(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_log10(double x) {
- return log10(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_exp(double x) {
- return exp(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_cosh(double x) {
- return cosh(x);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_expf(float x) {
- return expf(x);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_log10f(float x) {
- return log10f(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_atan2(double x, double y) {
- return atan2(x, y);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_sqrtf(float x) {
- return sqrtf(x);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_sinhf(float x) {
- return sinhf(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_log(double x) {
- return log(x);
-}
-
-double ICACHE_FLASH_ATTR __ieee754_sqrt(double x) {
- return sqrt(x);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_coshf(float x) {
- return coshf(x);
-}
-
-float ICACHE_FLASH_ATTR __ieee754_atan2f(float x, float y) {
- return atan2f(x, y);
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/pgmspace.cpp b/sparkfun/esp8266/cores/esp8266/pgmspace.cpp
deleted file mode 100644
index 84af6264..00000000
--- a/sparkfun/esp8266/cores/esp8266/pgmspace.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-pgmspace.cpp - string functions that support PROGMEM
-Copyright (c) 2015 Michael C. Miller. All right reserved.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include
-#include "pgmspace.h"
-
-size_t ICACHE_FLASH_ATTR strnlen_P(const char* s, size_t size) {
- const char* cp;
- for (cp = s; size != 0 && pgm_read_byte(cp) != '\0'; cp++, size--);
- return (size_t)(cp - s);
-}
-
-void* ICACHE_FLASH_ATTR memcpy_P(void* dest, const void* src, size_t count) {
- const uint8_t* read = reinterpret_cast(src);
- uint8_t* write = reinterpret_cast(dest);
-
- while (count)
- {
- *write++ = pgm_read_byte(read++);
- count--;
- }
-
- return dest;
-}
-
-char* ICACHE_FLASH_ATTR strncpy_P(char* dest, const char* src, size_t size) {
- const char* read = src;
- char* write = dest;
- char ch = '.';
- while (size > 0 && ch != '\0')
- {
- ch = pgm_read_byte(read++);
- *write++ = ch;
- size--;
- }
-
- return dest;
-}
-
-char* ICACHE_FLASH_ATTR strncat_P(char* dest, const char* src, size_t size) {
- char* write = dest;
-
- while (*write != '\0')
- {
- write++;
- }
-
- const char* read = src;
- char ch = '.';
-
- while (size > 0 && ch != '\0')
- {
- ch = pgm_read_byte(read++);
- *write++ = ch;
-
- size--;
- }
-
- if (ch != '\0')
- {
- *write = '\0';
- }
-
- return dest;
-}
-
-int ICACHE_FLASH_ATTR strncmp_P(const char* str1, const char* str2P, size_t size) {
- int result = 0;
-
- while (size > 0)
- {
- char ch1 = *str1++;
- char ch2 = pgm_read_byte(str2P++);
- result = ch1 - ch2;
- if (result != 0 || ch2 == '\0')
- {
- break;
- }
-
- size--;
- }
-
- return result;
-}
-
-int ICACHE_FLASH_ATTR strncasecmp_P(const char* str1, const char* str2P, size_t size) {
- int result = 0;
-
- while (size > 0)
- {
- char ch1 = tolower(*str1++);
- char ch2 = tolower(pgm_read_byte(str2P++));
- result = ch1 - ch2;
- if (result != 0 || ch2 == '\0')
- {
- break;
- }
-
- size--;
- }
-
- return result;
-}
-
-int ICACHE_FLASH_ATTR printf_P(const char* formatP, ...) {
- int ret;
- va_list arglist;
- va_start(arglist, formatP);
-
- size_t fmtLen = strlen_P(formatP);
- char* format = new char[fmtLen + 1];
- strcpy_P(format, formatP);
-
- ret = os_printf(format, arglist);
-
- delete [] format;
-
- va_end(arglist);
- return ret;
-}
-
-int ICACHE_FLASH_ATTR snprintf_P(char* str, size_t strSize, const char* formatP, ...) {
- int ret;
- va_list arglist;
- va_start(arglist, formatP);
-
- ret = vsnprintf_P(str, strSize, formatP, arglist);
-
- va_end(arglist);
- return ret;
-}
-
-int ICACHE_FLASH_ATTR vsnprintf_P(char* str, size_t strSize, const char* formatP, va_list ap) {
- int ret;
-
- size_t fmtLen = strlen_P(formatP);
- char* format = new char[fmtLen + 1];
- strcpy_P(format, formatP);
-
- ret = ets_vsnprintf(str, strSize, format, ap);
-
- delete [] format;
-
- return ret;
-}
\ No newline at end of file
diff --git a/sparkfun/esp8266/cores/esp8266/pgmspace.h b/sparkfun/esp8266/cores/esp8266/pgmspace.h
deleted file mode 100644
index 695f2a50..00000000
--- a/sparkfun/esp8266/cores/esp8266/pgmspace.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __PGMSPACE_H_
-#define __PGMSPACE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include
-#include
-#include "ets_sys.h"
-#include "osapi.h"
-#ifdef __cplusplus
-}
-#endif
-
-#define PROGMEM ICACHE_RODATA_ATTR
-#define PGM_P const char *
-#define PGM_VOID_P const void *
-#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
-
-
-#define _SFR_BYTE(n) (n)
-
-typedef void prog_void;
-typedef char prog_char;
-typedef unsigned char prog_uchar;
-typedef int8_t prog_int8_t;
-typedef uint8_t prog_uint8_t;
-typedef int16_t prog_int16_t;
-typedef uint16_t prog_uint16_t;
-typedef int32_t prog_int32_t;
-typedef uint32_t prog_uint32_t;
-
-#define SIZE_IRRELEVANT 0x7fffffff
-
-extern void* memcpy_P(void* dest, const void* src, size_t count);
-
-extern char* strncpy_P(char* dest, const char* src, size_t size);
-#define strcpy_P(dest, src) strncpy_P((dest), (src), SIZE_IRRELEVANT)
-
-extern char* strncat_P(char* dest, const char* src, size_t size);
-#define strcat_P(dest, src) strncat_P((dest), (src), SIZE_IRRELEVANT)
-
-extern int strncmp_P(const char* str1, const char* str2P, size_t size);
-#define strcmp_P(str1, str2P) strncmp_P((str1), (str2P), SIZE_IRRELEVANT)
-
-extern int strncasecmp_P(const char* str1, const char* str2P, size_t size);
-#define strcasecmp_P(str1, str2P) strncasecmp_P((str1), (str2P), SIZE_IRRELEVANT)
-
-extern size_t strnlen_P(const char *s, size_t size);
-#define strlen_P(strP) strnlen_P((strP), SIZE_IRRELEVANT)
-
-extern int printf_P(const char *formatP, ...);
-extern int snprintf_P(char *str, size_t strSize, const char *formatP, ...);
-extern int vsnprintf_P(char *str, size_t strSize, const char *formatP, va_list ap);
-
-// flash memory must be read using 32 bit aligned addresses else a processor
-// exception will be triggered
-// order within the 32 bit values are
-// --------------
-// b3, b2, b1, b0
-// w1, w0
-
-#define pgm_read_byte(addr) \
-(__extension__({ \
- PGM_P __local = (PGM_P)(addr); /* isolate varible for macro expansion */ \
- ptrdiff_t __offset = ((uint32_t)__local & 0x00000003); /* byte aligned mask */ \
- const uint32_t* __addr32 = reinterpret_cast(reinterpret_cast(__local)-__offset); \
- uint8_t __result = ((*__addr32) >> (__offset * 8)); \
- __result; \
-}))
-
-#define pgm_read_word(addr) \
-(__extension__({ \
- PGM_P __local = (PGM_P)(addr); /* isolate varible for macro expansion */ \
- ptrdiff_t __offset = ((uint32_t)__local & 0x00000002); /* word aligned mask */ \
- const uint32_t* __addr32 = reinterpret_cast(reinterpret_cast(__local) - __offset); \
- uint16_t __result = ((*__addr32) >> (__offset * 8)); \
- __result; \
-}))
-
-#define pgm_read_dword(addr) (*reinterpret_cast(addr))
-#define pgm_read_float(addr) (*reinterpret_cast(addr))
-
-#define pgm_read_byte_near(addr) pgm_read_byte(addr)
-#define pgm_read_word_near(addr) pgm_read_word(addr)
-#define pgm_read_dword_near(addr) pgm_read_dword(addr)
-#define pgm_read_float_near(addr) pgm_read_float(addr)
-#define pgm_read_byte_far(addr) pgm_read_byte(addr)
-#define pgm_read_word_far(addr) pgm_read_word(addr)
-#define pgm_read_dword_far(addr) pgm_read_dword(addr)
-#define pgm_read_float_far(addr) pgm_read_float(addr)
-
-#endif //__PGMSPACE_H_
diff --git a/sparkfun/esp8266/cores/esp8266/sigma_delta.h b/sparkfun/esp8266/cores/esp8266/sigma_delta.h
deleted file mode 100644
index 2e8bdc09..00000000
--- a/sparkfun/esp8266/cores/esp8266/sigma_delta.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- sigma_delta.h - esp8266 sigma-delta source
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SIGMA_DELTA_H
-#define SIGMA_DELTA_H
-
-#include
-
-void sigma_delta_close(uint32_t gpio);
-void set_sigma_target(uint8_t target);
-void set_sigma_prescale(uint8_t prescale);
-void set_sigma_duty_312KHz(uint8_t duty);
-
-#endif//SIGMA_DELTA_H
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/INTEGRATION b/sparkfun/esp8266/cores/esp8266/spiffs/INTEGRATION
deleted file mode 100644
index 20ff70d0..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/INTEGRATION
+++ /dev/null
@@ -1,306 +0,0 @@
-* QUICK AND DIRTY INTEGRATION EXAMPLE
-
-So, assume you're running a Cortex-M3 board with a 2 MB SPI flash on it. The
-SPI flash has 64kB blocks. Your project is built using gnumake, and now you
-want to try things out.
-
-First, you simply copy the files in src/ to your own source folder. Exclude
-all files in test folder. Then you point out these files in your make script
-for compilation.
-
-Also copy the spiffs_config.h over from the src/default/ folder.
-
-Try building. This fails, nagging about inclusions and u32_t and whatnot. Open
-the spiffs_config.h and delete the bad inclusions. Also, add following
-typedefs:
-
- typedef signed int s32_t;
- typedef unsigned int u32_t;
- typedef signed short s16_t;
- typedef unsigned short u16_t;
- typedef signed char s8_t;
- typedef unsigned char u8_t;
-
-Now it should build. Over to the mounting business. Assume you already
-implemented the read, write and erase functions to your SPI flash:
-
- void my_spi_read(int addr, int size, char *buf)
- void my_spi_write(int addr, int size, char *buf)
- void my_spi_erase(int addr, int size)
-
-In your main.c or similar, include the spiffs.h and do that spiffs struct:
-
- #include
-
- static spiffs fs;
-
-Also, toss up some of the needed buffers:
-
- #define LOG_PAGE_SIZE 256
-
- static u8_t spiffs_work_buf[LOG_PAGE_SIZE*2];
- static u8_t spiffs_fds[32*4];
- static u8_t spiffs_cache_buf[(LOG_PAGE_SIZE+32)*4];
-
-Now, write the my_spiffs_mount function:
-
- void my_spiffs_mount() {
- spiffs_config cfg;
- cfg.phys_size = 2*1024*1024; // use all spi flash
- cfg.phys_addr = 0; // start spiffs at start of spi flash
- cfg.phys_erase_block = 65536; // according to datasheet
- cfg.log_block_size = 65536; // let us not complicate things
- cfg.log_page_size = LOG_PAGE_SIZE; // as we said
-
- cfg.hal_read_f = my_spi_read;
- cfg.hal_write_f = my_spi_write;
- cfg.hal_erase_f = my_spi_erase;
-
- int res = SPIFFS_mount(&fs,
- &cfg,
- spiffs_work_buf,
- spiffs_fds,
- sizeof(spiffs_fds),
- spiffs_cache_buf,
- sizeof(spiffs_cache_buf),
- 0);
- printf("mount res: %i\n", res);
- }
-
-Now, build warns about the my_spi_read, write and erase functions. Wrong
-signatures, so go wrap them:
-
- static s32_t my_spiffs_read(u32_t addr, u32_t size, u8_t *dst) {
- my_spi_read(addr, size, dst);
- return SPIFFS_OK;
- }
-
- static s32_t my_spiffs_write(u32_t addr, u32_t size, u8_t *src) {
- my_spi_write(addr, size, dst);
- return SPIFFS_OK;
- }
-
- static s32_t my_spiffs_erase(u32_t addr, u32_t size) {
- my_spi_erase(addr, size);
- return SPIFFS_OK;
- }
-
-Redirect the config in my_spiffs_mount to the wrappers instead:
-
- cfg.hal_read_f = my_spiffs_read;
- cfg.hal_write_f = my_spiffs_write;
- cfg.hal_erase_f = my_spiffs_erase;
-
-Ok, now you should be able to build and run. However, you get this output:
-
- mount res: -1
-
-but you wanted
-
- mount res: 0
-
-This is probably due to you having experimented with your SPI flash, so it
-contains rubbish from spiffs's point of view. Do a mass erase and run again.
-
-If all is ok now, you're good to go. Try creating a file and read it back:
-
- static void test_spiffs() {
- char buf[12];
-
- // Surely, I've mounted spiffs before entering here
-
- spiffs_file fd = SPIFFS_open(&fs, "my_file", SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0);
- if (SPIFFS_write(&fs, fd, (u8_t *)"Hello world", 12) < 0) printf("errno %i\n", SPIFFS_errno(&fs));
- SPIFFS_close(&fs, fd);
-
- fd = SPIFFS_open(&fs, "my_file", SPIFFS_RDWR, 0);
- if (SPIFFS_read(&fs, fd, (u8_t *)buf, 12) < 0) printf("errno %i\n", SPIFFS_errno(&fs));
- SPIFFS_close(&fs, fd);
-
- printf("--> %s <--\n", buf);
- }
-
-Compile, run, cross fingers hard, and you'll get the output:
-
- --> Hello world <--
-
-Got errors? Check spiffs.h for error definitions to get a clue what went voodoo.
-
-
-* THINGS TO CHECK
-
-When you alter the spiffs_config values, make sure you also check the typedefs
-in spiffs_config.h:
-
- - spiffs_block_ix
- - spiffs_page_ix
- - spiffs_obj_id
- - spiffs_span_ix
-
-The sizes of these typedefs must not underflow, else spiffs might end up in
-eternal loops. Each typedef is commented what check for.
-
-Also, if you alter the code or just want to verify your configuration, you can
-run
-
- > make test
-
-in the spiffs folder. This will run all testcases using the configuration in
-default/spiffs_config.h and test/params_test.h. The tests are written for linux
-but should run under cygwin also.
-
-
-* INTEGRATING SPIFFS
-
-In order to integrate spiffs to your embedded target, you will basically need:
- - A SPI flash device which your processor can communicate with
- - An implementation for reading, writing and erasing the flash
- - Memory (flash or ram) for the code
- - Memory (ram) for the stack
-
-Other stuff may be needed, threaded systems might need mutexes and so on.
-
-** Logical structure
-
-First and foremost, one must decide how to divide up the SPI flash for spiffs.
-Having the datasheet for the actual SPI flash in hand will help. Spiffs can be
-defined to use all or only parts of the SPI flash.
-
-If following seems arcane, read the "HOW TO CONFIG" chapter first.
-
- - Decide the logical size of blocks. This must be a multiple of the biggest
- physical SPI flash block size. To go safe, use the physical block size -
- which in many cases is 65536 bytes.
- - Decide the logical size of pages. This must be a 2nd logarithm part of the
- logical block size. To go safe, use 256 bytes to start with.
- - Decide how much of the SPI flash memory to be used for spiffs. This must be
- on logical block boundary. If unsafe, use 1 megabyte to start with.
- - Decide where on the SPI flash memory the spiffs area should start. This must
- be on physical block/sector boundary. If unsafe, use address 0.
-
-** SPI flash API
-
-The target must provide three functions to spiffs:
-
- - s32_t (*spiffs_read)(u32_t addr, u32_t size, u8_t *dst)
- - s32_t (*spiffs_write)(u32_t addr, u32_t size, u8_t *src)
- - s32_t (*spiffs_erase)(u32_t addr, u32_t size)
-
-These functions define the only communication between the SPI flash and the
-spiffs stack.
-
-On success these must return 0 (or SPIFFS_OK). Anything else will be considered
-an error.
-
-The size for read and write requests will never exceed the logical page size,
-but it may be less.
-
-The address and size on erase requests will always be on physical block size
-boundaries.
-
-** Mount specification
-
-In spiffs.h, there is a SPIFFS_mount function defined, used to mount spiffs on
-the SPI flash.
-
-s32_t SPIFFS_mount(
- spiffs *fs,
- spiffs_config *config,
- u8_t *work,
- u8_t *fd_space,
- u32_t fd_space_size,
- void *cache,
- u32_t cache_size,
- spiffs_check_callback check_cb_f)
-
- - fs Points to a spiffs struct. This may be totally uninitialized.
- - config Points to a spiffs_config struct. This struct must be
- initialized when mounting. See below.
- - work A ram memory buffer being double the size of the logical page
- size. This buffer is used excessively by the spiffs stack. If
- logical page size is 256, this buffer must be 512 bytes.
- - fd_space A ram memory buffer used for file descriptors.
- - fd_space_size The size of the file descriptor buffer. A file descriptor
- normally is around 32 bytes depending on the build config -
- the bigger the buffer, the more file descriptors are
- available.
- - cache A ram memory buffer used for cache. Ignored if cache is
- disabled in build config.
- - cache_size The size of the cache buffer. Ignored if cache is disabled in
- build config. One cache page will be slightly larger than the
- logical page size. The more ram, the more cache pages, the
- quicker the system.
- - check_cb_f Callback function for monitoring spiffs consistency checks and
- mending operations. May be null.
-
-The config struct must be initialized prior to mounting. One must always
-define the SPI flash access functions:
-
- spiffs_config.hal_read_f - pointing to the function reading the SPI flash
-
- spiffs_config.hal_write_f - pointing to the function writing the SPI flash
-
- spiffs_config.hal_erase_f - pointing to the function erasing the SPI flash
-
-Depending on the build config - if SPIFFS_SINGLETON is set to zero - following
-parameters must be defined:
-
- spiffs_config.phys_size - the physical number of bytes accounted for
- spiffs on the SPI flash
-
- spiffs_config.phys_addr - the physical starting address on the SPI flash
-
- spiffs_config.phys_erase_block - the physical size of the largest block/sector
- on the SPI flash found within the spiffs
- usage address space
-
- spiffs_config.log_block_size - the logical size of a spiffs block
-
- spiffs_config.log_page_size - the logical size of a spiffs page
-
-If SPIFFS_SINGLETON is set to one, above parameters must be set ny defines in
-the config header file, spiffs_config.h.
-
-
-** Build config
-
-makefile: The files needed to be compiled to your target resides in files.mk to
-be included in your makefile, either by cut and paste or by inclusion.
-
-Types: spiffs uses the types u8_t, s8_t, u16_t, s16_t, u32_t, s32_t; these must
-be typedeffed.
-
-spiffs_config.h: you also need to define a spiffs_config.h header. Example of
-this is found in the default/ directory.
-
-
-** RAM
-
-Spiffs needs ram. It needs a working buffer being double the size of the
-logical page size. It also needs at least one file descriptor. If cache is
-enabled (highly recommended), it will also need a bunch of cache pages.
-
-Say you have a logical page size of 256 bytes. You want to be able to have four
-files open simultaneously, and you can give spiffs four cache pages. This
-roughly sums up to:
-
-256*2 (work buffer) +
-32*4 (file descriptors) +
-(256+32)*4 (cache pages) + 40 (cache metadata)
-
-i.e. 1832 bytes.
-
-This is apart from call stack usage.
-
-To get the exact amount of bytes needed on your specific target, enable
-SPIFFS_BUFFER_HELP in spiffs_config.h, rebuild and call:
-
- SPIFFS_buffer_bytes_for_filedescs
- SPIFFS_buffer_bytes_for_cache
-
-Having these figures you can disable SPIFFS_BUFFER_HELP again to save flash.
-
-
-* HOW TO CONFIG
-
-TODO
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/LICENSE b/sparkfun/esp8266/cores/esp8266/spiffs/LICENSE
deleted file mode 100644
index e9b0c677..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013-2015 Peter Andersson (pelleplutt1976gmail.com)
-
-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.
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/README b/sparkfun/esp8266/cores/esp8266/spiffs/README
deleted file mode 100644
index 6efd656c..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/README
+++ /dev/null
@@ -1,86 +0,0 @@
-SPIFFS (SPI Flash File System)
-V0.3.0
-
-Copyright (c) 2013-2015 Peter Andersson (pelleplutt1976gmail.com)
-
-For legal stuff, see LICENCE in this directory. Basically, you may do whatever
-you want with the source. Use, modify, sell, print it out, roll it and smoke it
- - as long as I won't be held responsible.
-
-Love to hear feedback though!
-
-
-* INTRODUCTION
-
-Spiffs is a file system intended for SPI NOR flash devices on embedded targets.
-
-Spiffs is designed with following characteristics in mind:
- - Small (embedded) targets, sparse RAM without heap
- - Only big areas of data (blocks) can be erased
- - An erase will reset all bits in block to ones
- - Writing pulls one to zeroes
- - Zeroes can only be pulled to ones by erase
- - Wear leveling
-
-
-* FEATURES
-
-What spiffs does:
- - Specifically designed for low ram usage
- - Uses statically sized ram buffers, independent of number of files
- - Posix-like api: open, close, read, write, seek, stat, etc
- - It can be run on any NOR flash, not only SPI flash - theoretically also on
- embedded flash of an microprocessor
- - Multiple spiffs configurations can be run on same target - and even on same
- SPI flash device
- - Implements static wear leveling
- - Built in file system consistency checks
-
-What spiffs does not:
- - Presently, spiffs does not support directories. It produces a flat
- structure. Creating a file with path "tmp/myfile.txt" will create a file
- called "tmp/myfile.txt" instead of a "myfile.txt" under directory "tmp".
- - It is not a realtime stack. One write operation might take much longer than
- another.
- - Poor scalability. Spiffs is intended for small memory devices - the normal
- sizes for SPI flashes. Going beyond ~128MB is probably a bad idea. This is
- a side effect of the design goal to use as little ram as possible.
- - Presently, it does not detect or handle bad blocks.
-
-
-* MORE INFO
-
-For integration, see the docs/INTEGRATION file.
-
-For use and design, see the docs/TECH_SPEC file.
-
-For testing and contributions, see the docs/IMPLEMENTING file.
-
-* HISTORY
-
-0.3.0
- Added existing namecheck when creating files
- Lots of static analysis bugs #6
- Added rename func
- Fix SPIFFS_read length when reading beyond file size
- Added reading beyond file length testcase
- Made build a bit more configurable
- Changed name in spiffs from "errno" to "err_code" due to conflicts compiling
- in mingw
- Improved GC checks, fixed an append bug, more robust truncate for very special
- case
- GC checks preempts GC, truncate even less picky
- Struct alignment needed for some targets, define in spiffs config #10
- Spiffs filesystem magic, definable in config
-
- New config defines:
- SPIFFS_USE_MAGIC - enable or disable magic check upon mount
- SPIFFS_ALIGNED_OBJECT_INDEX_TABLES - alignment for certain targets
- New API functions:
- SPIFFS_rename - rename files
- SPIFFS_clearerr - clears last errno
- SPIFFS_info - returns info on used and total bytes in fs
- SPIFFS_format - formats the filesystem
- SPIFFS_mounted - checks if filesystem is mounted
-
-
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/TECH_SPEC b/sparkfun/esp8266/cores/esp8266/spiffs/TECH_SPEC
deleted file mode 100644
index b4755a6d..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/TECH_SPEC
+++ /dev/null
@@ -1,239 +0,0 @@
-* USING SPIFFS
-
-TODO
-
-
-* SPIFFS DESIGN
-
-Spiffs is inspired by YAFFS. However, YAFFS is designed for NAND flashes, and
-for bigger targets with much more ram. Nevertheless, many wise thoughts have
-been borrowed from YAFFS when writing spiffs. Kudos!
-
-The main complication writing spiffs was that it cannot be assumed the target
-has a heap. Spiffs must go along only with the work ram buffer given to it.
-This forces extra implementation on many areas of spiffs.
-
-
-** SPI flash devices using NOR technology
-
-Below is a small description of how SPI flashes work internally. This is to
-give an understanding of the design choices made in spiffs.
-
-SPI flash devices are physically divided in blocks. On some SPI flash devices,
-blocks are further divided into sectors. Datasheets sometimes name blocks as
-sectors and vice versa.
-
-Common memory capacaties for SPI flashes are 512kB up to 8MB of data, where
-blocks may be 64kB. Sectors can be e.g. 4kB, if supported. Many SPI flashes
-have uniform block sizes, whereas others have non-uniform - the latter meaning
-that e.g. the first 16 blocks are 4kB big, and the rest are 64kB.
-
-The entire memory is linear and can be read and written in random access.
-Erasing can only be done block- or sectorwise; or by mass erase.
-
-SPI flashes can normally be erased from 100.000 up to 1.000.000 cycles before
-they fail.
-
-A clean SPI flash from factory have all bits in entire memory set to one. A
-mass erase will reset the device to this state. Block or sector erasing will
-put the all bits in the area given by the sector or block to ones. Writing to a
-NOR flash pulls ones to zeroes. Writing 0xFF to an address is simply a no-op.
-
-Writing 0b10101010 to a flash address holding 0b00001111 will yield 0b00001010.
-
-This way of "write by nand" is used considerably in spiffs.
-
-Common characteristics of NOR flashes are quick reads, but slow writes.
-
-And finally, unlike NAND flashes, NOR flashes seem to not need any error
-correction. They always write correctly I gather.
-
-
-** Spiffs logical structure
-
-Some terminology before proceeding. Physical blocks/sectors means sizes stated
-in the datasheet. Logical blocks and pages is something the integrator choose.
-
-
-** Blocks and pages
-
-Spiffs is allocated to a part or all of the memory of the SPI flash device.
-This area is divided into logical blocks, which in turn are divided into
-logical pages. The boundary of a logical block must coincide with one or more
-physical blocks. The sizes for logical blocks and logical pages always remain
-the same, they are uniform.
-
-Example: non-uniform flash mapped to spiffs with 128kB logical blocks
-
-PHYSICAL FLASH BLOCKS SPIFFS LOGICAL BLOCKS: 128kB
-
-+-----------------------+ - - - +-----------------------+
-| Block 1 : 16kB | | Block 1 : 128kB |
-+-----------------------+ | |
-| Block 2 : 16kB | | |
-+-----------------------+ | |
-| Block 3 : 16kB | | |
-+-----------------------+ | |
-| Block 4 : 16kB | | |
-+-----------------------+ | |
-| Block 5 : 64kB | | |
-+-----------------------+ - - - +-----------------------+
-| Block 6 : 64kB | | Block 2 : 128kB |
-+-----------------------+ | |
-| Block 7 : 64kB | | |
-+-----------------------+ - - - +-----------------------+
-| Block 8 : 64kB | | Block 3 : 128kB |
-+-----------------------+ | |
-| Block 9 : 64kB | | |
-+-----------------------+ - - - +-----------------------+
-| ... | | ... |
-
-A logical block is divided further into a number of logical pages. A page
-defines the smallest data holding element known to spiffs. Hence, if a file
-is created being one byte big, it will occupy one page for index and one page
-for data - it will occupy 2 x size of a logical page on flash.
-So it seems it is good to select a small page size.
-
-Each page has a metadata header being normally 5 to 9 bytes. This said, a very
-small page size will make metadata occupy a lot of the memory on the flash. A
-page size of 64 bytes will waste 8-14% on metadata, while 256 bytes 2-4%.
-So it seems it is good to select a big page size.
-
-Also, spiffs uses a ram buffer being two times the page size. This ram buffer
-is used for loading and manipulating pages, but it is also used for algorithms
-to find free file ids, scanning the file system, etc. Having too small a page
-size means less work buffer for spiffs, ending up in more reads operations and
-eventually gives a slower file system.
-
-Choosing the page size for the system involves many factors:
- - How big is the logical block size
- - What is the normal size of most files
- - How much ram can be spent
- - How much data (vs metadata) must be crammed into the file system
- - How fast must spiffs be
- - Other things impossible to find out
-
-So, chosing the Optimal Page Size (tm) seems tricky, to say the least. Don't
-fret - there is no optimal page size. This varies from how the target will use
-spiffs. Use the golden rule:
-
- ~~~ Logical Page Size = Logical Block Size / 256 ~~~
-
-This is a good starting point. The final page size can then be derived through
-heuristical experimenting for us non-analytical minds.
-
-
-** Objects, indices and look-ups
-
-A file, or an object as called in spiffs, is identified by an object id.
-Another YAFFS rip-off. This object id is a part of the page header. So, all
-pages know to which object/file they belong - not counting the free pages.
-
-An object is made up of two types of pages: object index pages and data pages.
-Data pages contain the data written by user. Index pages contain metadata about
-the object, more specifically what data pages are part of the object.
-
-The page header also includes something called a span index. Let's say a file
-is written covering three data pages. The first data page will then have span
-index 0, the second span index 1, and the last data page will have span index
-2. Simple as that.
-
-Finally, each page header contain flags, telling if the page is used,
-deleted, finalized, holds index or data, and more.
-
-Object indices also have span indices, where an object index with span index 0
-is referred to as the object index header. This page does not only contain
-references to data pages, but also extra info such as object name, object size
-in bytes, flags for file or directory, etc.
-
-If one were to create a file covering three data pages, named e.g.
-"spandex-joke.txt", given object id 12, it could look like this:
-
-PAGE 0
-
-PAGE 1 page header: [obj_id:12 span_ix:0 flags:USED|DATA]
-
-
-PAGE 2 page header: [obj_id:12 span_ix:1 flags:USED|DATA]
-
-
-PAGE 3 page header: [obj_id:545 span_ix:13 flags:USED|DATA]
-
-
-PAGE 4 page header: [obj_id:12 span_ix:2 flags:USED|DATA]
-
-
-PAGE 5 page header: [obj_id:12 span_ix:0 flags:USED|INDEX]
- obj ix header: [name:spandex-joke.txt size:600 bytes flags:FILE]
- obj ix: [1 2 4]
-
-Looking in detail at page 5, the object index header page, the object index
-array refers to each data page in order, as mentioned before. The index of the
-object index array correlates with the data page span index.
-
- entry ix: 0 1 2
- obj ix: [1 2 4]
- | | |
- PAGE 1, DATA, SPAN_IX 0 --------/ | |
- PAGE 2, DATA, SPAN_IX 1 --------/ |
- PAGE 4, DATA, SPAN_IX 2 --------/
-
-Things to be unveiled in page 0 - well.. Spiffs is designed for systems low on
-ram. We cannot keep a dynamic list on the whereabouts of each object index
-header so we can find a file fast. There might not even be a heap! But, we do
-not want to scan all page headers on the flash to find the object index header.
-
-The first page(s) of each block contains the so called object look-up. These
-are not normal pages, they do not have a header. Instead, they are arrays
-pointing out what object-id the rest of all pages in the block belongs to.
-
-By this look-up, only the first page(s) in each block must to scanned to find
-the actual page which contains the object index header of the desired object.
-
-The object lookup is redundant metadata. The assumption is that it presents
-less overhead reading a full page of data to memory from each block and search
-that, instead of reading a small amount of data from each page (i.e. the page
-header) in all blocks. Each read operation from SPI flash normally contains
-extra data as the read command itself and the flash address. Also, depending on
-the underlying implementation, other criterions may need to be passed for each
-read transaction, like mutexes and such.
-
-The veiled example unveiled would look like this, with some extra pages:
-
-PAGE 0 [ 12 12 545 12 12 34 34 4 0 0 0 0 ...]
-PAGE 1 page header: [obj_id:12 span_ix:0 flags:USED|DATA] ...
-PAGE 2 page header: [obj_id:12 span_ix:1 flags:USED|DATA] ...
-PAGE 3 page header: [obj_id:545 span_ix:13 flags:USED|DATA] ...
-PAGE 4 page header: [obj_id:12 span_ix:2 flags:USED|DATA] ...
-PAGE 5 page header: [obj_id:12 span_ix:0 flags:USED|INDEX] ...
-PAGE 6 page header: [obj_id:34 span_ix:0 flags:USED|DATA] ...
-PAGE 7 page header: [obj_id:34 span_ix:1 flags:USED|DATA] ...
-PAGE 8 page header: [obj_id:4 span_ix:1 flags:USED|INDEX] ...
-PAGE 9 page header: [obj_id:23 span_ix:0 flags:DELETED|INDEX] ...
-PAGE 10 page header: [obj_id:23 span_ix:0 flags:DELETED|DATA] ...
-PAGE 11 page header: [obj_id:23 span_ix:1 flags:DELETED|DATA] ...
-PAGE 12 page header: [obj_id:23 span_ix:2 flags:DELETED|DATA] ...
-...
-
-Ok, so why are page 9 to 12 marked as 0 when they belong to object id 23? These
-pages are deleted, so this is marked both in page header flags and in the look
-up. This is an example where spiffs uses NOR flashes "nand-way" of writing.
-
-As a matter of fact, there are two object id's which are special:
-
-obj id 0 (all bits zeroes) - indicates a deleted page in object look up
-obj id 0xff.. (all bits ones) - indicates a free page in object look up
-
-Actually, the object id's have another quirk: if the most significant bit is
-set, this indicates an object index page. If the most significant bit is zero,
-this indicates a data page. So to be fully correct, page 0 in above example
-would look like this:
-
-PAGE 0 [ 12 12 545 12 *12 34 34 *4 0 0 0 0 ...]
-
-where the asterisk means the msb of the object id is set.
-
-This is another way to speed up the searches when looking for object indices.
-By looking on the object id's msb in the object lookup, it is also possible
-to find out whether the page is an object index page or a data page.
-
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/TODO b/sparkfun/esp8266/cores/esp8266/spiffs/TODO
deleted file mode 100644
index c947316a..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/TODO
+++ /dev/null
@@ -1,15 +0,0 @@
-* When mending lost pages, also see if they fit into length specified in object index header
-
-SPIFFS2 thoughts
-
-* Instead of exact object id:s in the object lookup tables, use a hash of span index and object id.
- Eg. object id xor:ed with bit-reversed span index.
- This should decrease number of actual pages that needs to be visited when looking thru the obj lut.
-
-* Logical number of each block. When moving stuff in a garbage collected page, the free
- page is assigned the same number as the garbage collected. Thus, object index pages do not have to
- be rewritten.
-
-* Steal one page, use as a bit parity page. When starting an fs modification operation, write one bit
- as zero. When ending, write another bit as zero. On mount, if number of zeroes in page is uneven, a
- check is automatically run.
\ No newline at end of file
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs.h b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs.h
deleted file mode 100644
index 7df7ae04..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs.h
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * spiffs.h
- *
- * Created on: May 26, 2013
- * Author: petera
- */
-
-
-
-#ifndef SPIFFS_H_
-#define SPIFFS_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "spiffs_config.h"
-
-#define SPIFFS_OK 0
-#define SPIFFS_ERR_NOT_MOUNTED -10000
-#define SPIFFS_ERR_FULL -10001
-#define SPIFFS_ERR_NOT_FOUND -10002
-#define SPIFFS_ERR_END_OF_OBJECT -10003
-#define SPIFFS_ERR_DELETED -10004
-#define SPIFFS_ERR_NOT_FINALIZED -10005
-#define SPIFFS_ERR_NOT_INDEX -10006
-#define SPIFFS_ERR_OUT_OF_FILE_DESCS -10007
-#define SPIFFS_ERR_FILE_CLOSED -10008
-#define SPIFFS_ERR_FILE_DELETED -10009
-#define SPIFFS_ERR_BAD_DESCRIPTOR -10010
-#define SPIFFS_ERR_IS_INDEX -10011
-#define SPIFFS_ERR_IS_FREE -10012
-#define SPIFFS_ERR_INDEX_SPAN_MISMATCH -10013
-#define SPIFFS_ERR_DATA_SPAN_MISMATCH -10014
-#define SPIFFS_ERR_INDEX_REF_FREE -10015
-#define SPIFFS_ERR_INDEX_REF_LU -10016
-#define SPIFFS_ERR_INDEX_REF_INVALID -10017
-#define SPIFFS_ERR_INDEX_FREE -10018
-#define SPIFFS_ERR_INDEX_LU -10019
-#define SPIFFS_ERR_INDEX_INVALID -10020
-#define SPIFFS_ERR_NOT_WRITABLE -10021
-#define SPIFFS_ERR_NOT_READABLE -10022
-#define SPIFFS_ERR_CONFLICTING_NAME -10023
-#define SPIFFS_ERR_NOT_CONFIGURED -10024
-
-#define SPIFFS_ERR_NOT_A_FS -10025
-#define SPIFFS_ERR_MOUNTED -10026
-#define SPIFFS_ERR_ERASE_FAIL -10027
-#define SPIFFS_ERR_MAGIC_NOT_POSSIBLE -10028
-
-
-#define SPIFFS_ERR_INTERNAL -10050
-
-#define SPIFFS_ERR_TEST -10100
-
-
-// spiffs file descriptor index type. must be signed
-typedef s16_t spiffs_file;
-// spiffs file descriptor flags
-typedef u16_t spiffs_flags;
-// spiffs file mode
-typedef u16_t spiffs_mode;
-// object type
-typedef u8_t spiffs_obj_type;
-
-/* spi read call function type */
-typedef s32_t (*spiffs_read)(u32_t addr, u32_t size, u8_t *dst);
-/* spi write call function type */
-typedef s32_t (*spiffs_write)(u32_t addr, u32_t size, u8_t *src);
-/* spi erase call function type */
-typedef s32_t (*spiffs_erase)(u32_t addr, u32_t size);
-
-/* file system check callback report operation */
-typedef enum {
- SPIFFS_CHECK_LOOKUP = 0,
- SPIFFS_CHECK_INDEX,
- SPIFFS_CHECK_PAGE
-} spiffs_check_type;
-
-/* file system check callback report type */
-typedef enum {
- SPIFFS_CHECK_PROGRESS = 0,
- SPIFFS_CHECK_ERROR,
- SPIFFS_CHECK_FIX_INDEX,
- SPIFFS_CHECK_FIX_LOOKUP,
- SPIFFS_CHECK_DELETE_ORPHANED_INDEX,
- SPIFFS_CHECK_DELETE_PAGE,
- SPIFFS_CHECK_DELETE_BAD_FILE,
-} spiffs_check_report;
-
-/* file system check callback function */
-typedef void (*spiffs_check_callback)(spiffs_check_type type, spiffs_check_report report,
- u32_t arg1, u32_t arg2);
-
-#ifndef SPIFFS_DBG
-#define SPIFFS_DBG(...) \
- print(__VA_ARGS__)
-#endif
-#ifndef SPIFFS_GC_DBG
-#define SPIFFS_GC_DBG(...) c_printf(__VA_ARGS__)
-#endif
-#ifndef SPIFFS_CACHE_DBG
-#define SPIFFS_CACHE_DBG(...) c_printf(__VA_ARGS__)
-#endif
-#ifndef SPIFFS_CHECK_DBG
-#define SPIFFS_CHECK_DBG(...) c_printf(__VA_ARGS__)
-#endif
-
-/* Any write to the filehandle is appended to end of the file */
-#define SPIFFS_APPEND (1<<0)
-/* If the opened file exists, it will be truncated to zero length before opened */
-#define SPIFFS_TRUNC (1<<1)
-/* If the opened file does not exist, it will be created before opened */
-#define SPIFFS_CREAT (1<<2)
-/* The opened file may only be read */
-#define SPIFFS_RDONLY (1<<3)
-/* The opened file may only be writted */
-#define SPIFFS_WRONLY (1<<4)
-/* The opened file may be both read and writted */
-#define SPIFFS_RDWR (SPIFFS_RDONLY | SPIFFS_WRONLY)
-/* Any writes to the filehandle will never be cached */
-#define SPIFFS_DIRECT (1<<5)
-
-#define SPIFFS_SEEK_SET (0)
-#define SPIFFS_SEEK_CUR (1)
-#define SPIFFS_SEEK_END (2)
-
-#define SPIFFS_TYPE_FILE (1)
-#define SPIFFS_TYPE_DIR (2)
-#define SPIFFS_TYPE_HARD_LINK (3)
-#define SPIFFS_TYPE_SOFT_LINK (4)
-
-#ifndef SPIFFS_LOCK
-#define SPIFFS_LOCK(fs)
-#endif
-
-#ifndef SPIFFS_UNLOCK
-#define SPIFFS_UNLOCK(fs)
-#endif
-
-// phys structs
-
-// spiffs spi configuration struct
-typedef struct {
- // physical read function
- spiffs_read hal_read_f;
- // physical write function
- spiffs_write hal_write_f;
- // physical erase function
- spiffs_erase hal_erase_f;
-#if SPIFFS_SINGLETON == 0
- // physical size of the spi flash
- u32_t phys_size;
- // physical offset in spi flash used for spiffs,
- // must be on block boundary
- u32_t phys_addr;
- // physical size when erasing a block
- u32_t phys_erase_block;
-
- // logical size of a block, must be on physical
- // block size boundary and must never be less than
- // a physical block
- u32_t log_block_size;
- // logical size of a page, must be at least
- // log_block_size / 8
- u32_t log_page_size;
-#endif
-} spiffs_config;
-
-typedef struct {
- // file system configuration
- spiffs_config cfg;
- // number of logical blocks
- u32_t block_count;
-
- // cursor for free blocks, block index
- spiffs_block_ix free_cursor_block_ix;
- // cursor for free blocks, entry index
- int free_cursor_obj_lu_entry;
- // cursor when searching, block index
- spiffs_block_ix cursor_block_ix;
- // cursor when searching, entry index
- int cursor_obj_lu_entry;
-
- // primary work buffer, size of a logical page
- u8_t *lu_work;
- // secondary work buffer, size of a logical page
- u8_t *work;
- // file descriptor memory area
- u8_t *fd_space;
- // available file descriptors
- u32_t fd_count;
-
- // last error
- s32_t err_code;
-
- // current number of free blocks
- u32_t free_blocks;
- // current number of busy pages
- u32_t stats_p_allocated;
- // current number of deleted pages
- u32_t stats_p_deleted;
- // flag indicating that garbage collector is cleaning
- u8_t cleaning;
- // max erase count amongst all blocks
- spiffs_obj_id max_erase_count;
-
-#if SPIFFS_GC_STATS
- u32_t stats_gc_runs;
-#endif
-
-#if SPIFFS_CACHE
- // cache memory
- void *cache;
- // cache size
- u32_t cache_size;
-#if SPIFFS_CACHE_STATS
- u32_t cache_hits;
- u32_t cache_misses;
-#endif
-#endif
-
- // check callback function
- spiffs_check_callback check_cb_f;
-
- // mounted flag
- u8_t mounted;
- // config magic
- u32_t config_magic;
-} spiffs;
-
-/* spiffs file status struct */
-typedef struct {
- spiffs_obj_id obj_id;
- u32_t size;
- spiffs_obj_type type;
- u8_t name[SPIFFS_OBJ_NAME_LEN];
-} spiffs_stat;
-
-struct spiffs_dirent {
- spiffs_obj_id obj_id;
- u8_t name[SPIFFS_OBJ_NAME_LEN];
- spiffs_obj_type type;
- u32_t size;
- spiffs_page_ix pix;
-};
-
-typedef struct {
- spiffs *fs;
- spiffs_block_ix block;
- int entry;
-} spiffs_DIR;
-
-// functions
-
-/**
- * Initializes the file system dynamic parameters and mounts the filesystem.
- * If SPIFFS_USE_MAGIC is enabled the mounting may fail with SPIFFS_ERR_NOT_A_FS
- * if the flash does not contain a recognizable file system.
- * In this case, SPIFFS_format must be called prior to remounting.
- * @param fs the file system struct
- * @param config the physical and logical configuration of the file system
- * @param work a memory work buffer comprising 2*config->log_page_size
- * bytes used throughout all file system operations
- * @param fd_space memory for file descriptors
- * @param fd_space_size memory size of file descriptors
- * @param cache memory for cache, may be null
- * @param cache_size memory size of cache
- * @param check_cb_f callback function for reporting during consistency checks
- */
-s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
- u8_t *fd_space, u32_t fd_space_size,
- void *cache, u32_t cache_size,
- spiffs_check_callback check_cb_f);
-
-/**
- * Unmounts the file system. All file handles will be flushed of any
- * cached writes and closed.
- * @param fs the file system struct
- */
-void SPIFFS_unmount(spiffs *fs);
-
-/**
- * Creates a new file.
- * @param fs the file system struct
- * @param path the path of the new file
- * @param mode ignored, for posix compliance
- */
-s32_t SPIFFS_creat(spiffs *fs, char *path, spiffs_mode mode);
-
-/**
- * Opens/creates a file.
- * @param fs the file system struct
- * @param path the path of the new file
- * @param flags the flags for the open command, can be combinations of
- * SPIFFS_APPEND, SPIFFS_TRUNC, SPIFFS_CREAT, SPIFFS_RD_ONLY,
- * SPIFFS_WR_ONLY, SPIFFS_RDWR, SPIFFS_DIRECT
- * @param mode ignored, for posix compliance
- */
-spiffs_file SPIFFS_open(spiffs *fs, char *path, spiffs_flags flags, spiffs_mode mode);
-
-
-/**
- * Opens a file by given dir entry.
- * Optimization purposes, when traversing a file system with SPIFFS_readdir
- * a normal SPIFFS_open would need to traverse the filesystem again to find
- * the file, whilst SPIFFS_open_by_dirent already knows where the file resides.
- * @param fs the file system struct
- * @param path the dir entry to the file
- * @param flags the flags for the open command, can be combinations of
- * SPIFFS_APPEND, SPIFFS_TRUNC, SPIFFS_CREAT, SPIFFS_RD_ONLY,
- * SPIFFS_WR_ONLY, SPIFFS_RDWR, SPIFFS_DIRECT.
- * SPIFFS_CREAT will have no effect in this case.
- * @param mode ignored, for posix compliance
- */
-spiffs_file SPIFFS_open_by_dirent(spiffs *fs, struct spiffs_dirent *e, spiffs_flags flags, spiffs_mode mode);
-
-/**
- * Reads from given filehandle.
- * @param fs the file system struct
- * @param fh the filehandle
- * @param buf where to put read data
- * @param len how much to read
- * @returns number of bytes read, or -1 if error
- */
-s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len);
-
-/**
- * Writes to given filehandle.
- * @param fs the file system struct
- * @param fh the filehandle
- * @param buf the data to write
- * @param len how much to write
- * @returns number of bytes written, or -1 if error
- */
-s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len);
-
-/**
- * Moves the read/write file offset
- * @param fs the file system struct
- * @param fh the filehandle
- * @param offs how much/where to move the offset
- * @param whence if SPIFFS_SEEK_SET, the file offset shall be set to offset bytes
- * if SPIFFS_SEEK_CUR, the file offset shall be set to its current location plus offset
- * if SPIFFS_SEEK_END, the file offset shall be set to the size of the file plus offset
- */
-s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence);
-
-/**
- * Removes a file by path
- * @param fs the file system struct
- * @param path the path of the file to remove
- */
-s32_t SPIFFS_remove(spiffs *fs, char *path);
-
-/**
- * Removes a file by filehandle
- * @param fs the file system struct
- * @param fh the filehandle of the file to remove
- */
-s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh);
-
-/**
- * Gets file status by path
- * @param fs the file system struct
- * @param path the path of the file to stat
- * @param s the stat struct to populate
- */
-s32_t SPIFFS_stat(spiffs *fs, char *path, spiffs_stat *s);
-
-/**
- * Gets file status by filehandle
- * @param fs the file system struct
- * @param fh the filehandle of the file to stat
- * @param s the stat struct to populate
- */
-s32_t SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s);
-
-/**
- * Flushes all pending write operations from cache for given file
- * @param fs the file system struct
- * @param fh the filehandle of the file to flush
- */
-s32_t SPIFFS_fflush(spiffs *fs, spiffs_file fh);
-
-/**
- * Closes a filehandle. If there are pending write operations, these are finalized before closing.
- * @param fs the file system struct
- * @param fh the filehandle of the file to close
- */
-void SPIFFS_close(spiffs *fs, spiffs_file fh);
-
-/**
- * Renames a file
- * @param fs the file system struct
- * @param old path of file to rename
- * @param newPath new path of file
- */
-s32_t SPIFFS_rename(spiffs *fs, char *old, char *newPath);
-
-/**
- * Returns last error of last file operation.
- * @param fs the file system struct
- */
-s32_t SPIFFS_errno(spiffs *fs);
-
-/**
- * Clears last error.
- * @param fs the file system struct
- */
-void SPIFFS_clearerr(spiffs *fs);
-
-/**
- * Opens a directory stream corresponding to the given name.
- * The stream is positioned at the first entry in the directory.
- * On hydrogen builds the name argument is ignored as hydrogen builds always correspond
- * to a flat file structure - no directories.
- * @param fs the file system struct
- * @param name the name of the directory
- * @param d pointer the directory stream to be populated
- */
-spiffs_DIR *SPIFFS_opendir(spiffs *fs, char *name, spiffs_DIR *d);
-
-/**
- * Closes a directory stream
- * @param d the directory stream to close
- */
-s32_t SPIFFS_closedir(spiffs_DIR *d);
-
-/**
- * Reads a directory into given spifs_dirent struct.
- * @param d pointer to the directory stream
- * @param e the dirent struct to be populated
- * @returns null if error or end of stream, else given dirent is returned
- */
-struct spiffs_dirent *SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e);
-
-/**
- * Runs a consistency check on given filesystem.
- * @param fs the file system struct
- */
-s32_t SPIFFS_check(spiffs *fs);
-
-
-/**
- * Returns number of total bytes available and number of used bytes.
- * This is an estimation, and depends on if there a many files with little
- * data or few files with much data.
- * NB: If used number of bytes exceeds total bytes, a SPIFFS_check should
- * run. This indicates a power loss in midst of things. In worst case
- * (repeated powerlosses in mending or gc) you might have to delete some files.
- *
- * @param fs the file system struct
- * @param total total number of bytes in filesystem
- * @param used used number of bytes in filesystem
- */
-s32_t SPIFFS_info(spiffs *fs, u32_t *total, u32_t *used);
-
-/**
- * Formats the entire file system. All data will be lost.
- * The filesystem must not be mounted when calling this.
- *
- * NB: formatting is awkward. Due to backwards compatibility, SPIFFS_mount
- * MUST be called prior to formatting in order to configure the filesystem.
- * If SPIFFS_mount succeeds, SPIFFS_unmount must be called before calling
- * SPIFFS_format.
- * If SPIFFS_mount fails, SPIFFS_format can be called directly without calling
- * SPIFFS_unmount first.
- */
-s32_t SPIFFS_format(spiffs *fs);
-
-/**
- * Returns nonzero if spiffs is mounted, or zero if unmounted.
- */
-u8_t SPIFFS_mounted(spiffs *fs);
-
-/**
- * Check if EOF reached.
- * @param fs the file system struct
- * @param fh the filehandle of the file to check
- */
-s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh);
-
-/**
- * Get the current position of the data pointer.
- * @param fs the file system struct
- * @param fh the filehandle of the open file
- */
-s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh);
-
-#if SPIFFS_TEST_VISUALISATION
-/**
- * Prints out a visualization of the filesystem.
- * @param fs the file system struct
- */
-s32_t SPIFFS_vis(spiffs *fs);
-#endif
-
-#if SPIFFS_BUFFER_HELP
-/**
- * Returns number of bytes needed for the filedescriptor buffer given
- * amount of file descriptors.
- */
-u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs);
-
-#if SPIFFS_CACHE
-/**
- * Returns number of bytes needed for the cache buffer given
- * amount of cache pages.
- */
-u32_t SPIFFS_buffer_bytes_for_cache(spiffs *fs, u32_t num_pages);
-#endif
-#endif
-
-#include "spiffs_esp8266.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SPIFFS_H_ */
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_cache.c b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_cache.c
deleted file mode 100644
index 5bfe51e8..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_cache.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * spiffs_cache.c
- *
- * Created on: Jun 23, 2013
- * Author: petera
- */
-
-#include "spiffs.h"
-#include "spiffs_nucleus.h"
-
-#if SPIFFS_CACHE
-
-// returns cached page for give page index, or null if no such cached page
-static spiffs_cache_page *spiffs_cache_page_get(spiffs *fs, spiffs_page_ix pix) {
- spiffs_cache *cache = spiffs_get_cache(fs);
- if ((cache->cpage_use_map & cache->cpage_use_mask) == 0) return 0;
- int i;
- for (i = 0; i < cache->cpage_count; i++) {
- spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i);
- if ((cache->cpage_use_map & (1<flags & SPIFFS_CACHE_FLAG_TYPE_WR) == 0 &&
- cp->pix == pix ) {
- SPIFFS_CACHE_DBG("CACHE_GET: have cache page %d for %04x\n", i, pix);
- cp->last_access = cache->last_access;
- return cp;
- }
- }
- //SPIFFS_CACHE_DBG("CACHE_GET: no cache for %04x\n", pix);
- return 0;
-}
-
-// frees cached page
-static s32_t spiffs_cache_page_free(spiffs *fs, int ix, u8_t write_back) {
- s32_t res = SPIFFS_OK;
- spiffs_cache *cache = spiffs_get_cache(fs);
- spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, ix);
- if (cache->cpage_use_map & (1<flags & SPIFFS_CACHE_FLAG_TYPE_WR) == 0 &&
- (cp->flags & SPIFFS_CACHE_FLAG_DIRTY)) {
- u8_t *mem = spiffs_get_cache_page(fs, cache, ix);
- res = fs->cfg.hal_write_f(SPIFFS_PAGE_TO_PADDR(fs, cp->pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), mem);
- }
-
- cp->flags = 0;
- cache->cpage_use_map &= ~(1 << ix);
-
- if (cp->flags & SPIFFS_CACHE_FLAG_TYPE_WR) {
- SPIFFS_CACHE_DBG("CACHE_FREE: free cache page %d objid %04x\n", ix, cp->obj_id);
- } else {
- SPIFFS_CACHE_DBG("CACHE_FREE: free cache page %d pix %04x\n", ix, cp->pix);
- }
- }
-
- return res;
-}
-
-// removes the oldest accessed cached page
-static s32_t spiffs_cache_page_remove_oldest(spiffs *fs, u8_t flag_mask, u8_t flags) {
- s32_t res = SPIFFS_OK;
- spiffs_cache *cache = spiffs_get_cache(fs);
-
- if ((cache->cpage_use_map & cache->cpage_use_mask) != cache->cpage_use_mask) {
- // at least one free cpage
- return SPIFFS_OK;
- }
-
- // all busy, scan thru all to find the cpage which has oldest access
- int i;
- int cand_ix = -1;
- u32_t oldest_val = 0;
- for (i = 0; i < cache->cpage_count; i++) {
- spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i);
- if ((cache->last_access - cp->last_access) > oldest_val &&
- (cp->flags & flag_mask) == flags) {
- oldest_val = cache->last_access - cp->last_access;
- cand_ix = i;
- }
- }
-
- if (cand_ix >= 0) {
- res = spiffs_cache_page_free(fs, cand_ix, 1);
- }
-
- return res;
-}
-
-// allocates a new cached page and returns it, or null if all cache pages are busy
-static spiffs_cache_page *spiffs_cache_page_allocate(spiffs *fs) {
- spiffs_cache *cache = spiffs_get_cache(fs);
- if (cache->cpage_use_map == 0xffffffff) {
- // out of cache memory
- return 0;
- }
- int i;
- for (i = 0; i < cache->cpage_count; i++) {
- if ((cache->cpage_use_map & (1<cpage_use_map |= (1<last_access = cache->last_access;
- SPIFFS_CACHE_DBG("CACHE_ALLO: allocated cache page %d\n", i);
- return cp;
- }
- }
- // out of cache entries
- return 0;
-}
-
-// drops the cache page for give page index
-void spiffs_cache_drop_page(spiffs *fs, spiffs_page_ix pix) {
- spiffs_cache_page *cp = spiffs_cache_page_get(fs, pix);
- if (cp) {
- spiffs_cache_page_free(fs, cp->ix, 0);
- }
-}
-
-// ------------------------------
-
-// reads from spi flash or the cache
-s32_t spiffs_phys_rd(
- spiffs *fs,
- u8_t op,
- spiffs_file fh,
- u32_t addr,
- u32_t len,
- u8_t *dst) {
- (void)fh;
- s32_t res = SPIFFS_OK;
- spiffs_cache *cache = spiffs_get_cache(fs);
- spiffs_cache_page *cp = spiffs_cache_page_get(fs, SPIFFS_PADDR_TO_PAGE(fs, addr));
- cache->last_access++;
- if (cp) {
-#if SPIFFS_CACHE_STATS
- fs->cache_hits++;
-#endif
- cp->last_access = cache->last_access;
- } else {
- if ((op & SPIFFS_OP_TYPE_MASK) == SPIFFS_OP_T_OBJ_LU2) {
- // for second layer lookup functions, we do not cache in order to prevent shredding
- return fs->cfg.hal_read_f(
- addr ,
- len,
- dst);
- }
-#if SPIFFS_CACHE_STATS
- fs->cache_misses++;
-#endif
- res = spiffs_cache_page_remove_oldest(fs, SPIFFS_CACHE_FLAG_TYPE_WR, 0);
- cp = spiffs_cache_page_allocate(fs);
- if (cp) {
- cp->flags = SPIFFS_CACHE_FLAG_WRTHRU;
- cp->pix = SPIFFS_PADDR_TO_PAGE(fs, addr);
- }
-
- s32_t res2 = fs->cfg.hal_read_f(
- addr - SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr),
- SPIFFS_CFG_LOG_PAGE_SZ(fs),
- spiffs_get_cache_page(fs, cache, cp->ix));
- if (res2 != SPIFFS_OK) {
- res = res2;
- }
- }
- u8_t *mem = spiffs_get_cache_page(fs, cache, cp->ix);
- c_memcpy(dst, &mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], len);
- return res;
-}
-
-// writes to spi flash and/or the cache
-s32_t spiffs_phys_wr(
- spiffs *fs,
- u8_t op,
- spiffs_file fh,
- u32_t addr,
- u32_t len,
- u8_t *src) {
- (void)fh;
- spiffs_page_ix pix = SPIFFS_PADDR_TO_PAGE(fs, addr);
- spiffs_cache *cache = spiffs_get_cache(fs);
- spiffs_cache_page *cp = spiffs_cache_page_get(fs, pix);
-
- if (cp && (op & SPIFFS_OP_COM_MASK) != SPIFFS_OP_C_WRTHRU) {
- // have a cache page
- // copy in data to cache page
-
- if ((op & SPIFFS_OP_COM_MASK) == SPIFFS_OP_C_DELE &&
- (op & SPIFFS_OP_TYPE_MASK) != SPIFFS_OP_T_OBJ_LU) {
- // page is being deleted, wipe from cache - unless it is a lookup page
- spiffs_cache_page_free(fs, cp->ix, 0);
- return fs->cfg.hal_write_f(addr, len, src);
- }
-
- u8_t *mem = spiffs_get_cache_page(fs, cache, cp->ix);
- c_memcpy(&mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], src, len);
-
- cache->last_access++;
- cp->last_access = cache->last_access;
-
- if (cp->flags && SPIFFS_CACHE_FLAG_WRTHRU) {
- // page is being updated, no write-cache, just pass thru
- return fs->cfg.hal_write_f(addr, len, src);
- } else {
- return SPIFFS_OK;
- }
- } else {
- // no cache page, no write cache - just write thru
- return fs->cfg.hal_write_f(addr, len, src);
- }
-}
-
-#if SPIFFS_CACHE_WR
-// returns the cache page that this fd refers, or null if no cache page
-spiffs_cache_page *spiffs_cache_page_get_by_fd(spiffs *fs, spiffs_fd *fd) {
- spiffs_cache *cache = spiffs_get_cache(fs);
-
- if ((cache->cpage_use_map & cache->cpage_use_mask) == 0) {
- // all cpages free, no cpage cannot be assigned to obj_id
- return 0;
- }
-
- int i;
- for (i = 0; i < cache->cpage_count; i++) {
- spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i);
- if ((cache->cpage_use_map & (1<flags & SPIFFS_CACHE_FLAG_TYPE_WR) &&
- cp->obj_id == fd->obj_id) {
- return cp;
- }
- }
-
- return 0;
-}
-
-// allocates a new cache page and refers this to given fd - flushes an old cache
-// page if all cache is busy
-spiffs_cache_page *spiffs_cache_page_allocate_by_fd(spiffs *fs, spiffs_fd *fd) {
- // before this function is called, it is ensured that there is no already existing
- // cache page with same object id
- spiffs_cache_page_remove_oldest(fs, SPIFFS_CACHE_FLAG_TYPE_WR, 0);
- spiffs_cache_page *cp = spiffs_cache_page_allocate(fs);
- if (cp == 0) {
- // could not get cache page
- return 0;
- }
-
- cp->flags = SPIFFS_CACHE_FLAG_TYPE_WR;
- cp->obj_id = fd->obj_id;
- fd->cache_page = cp;
- return cp;
-}
-
-// unrefers all fds that this cache page refers to and releases the cache page
-void spiffs_cache_fd_release(spiffs *fs, spiffs_cache_page *cp) {
- if (cp == 0) return;
- u32_t i;
- spiffs_fd *fds = (spiffs_fd *)fs->fd_space;
- for (i = 0; i < fs->fd_count; i++) {
- spiffs_fd *cur_fd = &fds[i];
- if (cur_fd->file_nbr != 0 && cur_fd->cache_page == cp) {
- cur_fd->cache_page = 0;
- }
- }
- spiffs_cache_page_free(fs, cp->ix, 0);
-
- cp->obj_id = 0;
-}
-
-#endif
-
-// initializes the cache
-void spiffs_cache_init(spiffs *fs) {
- if (fs->cache == 0) return;
- u32_t sz = fs->cache_size;
- u32_t cache_mask = 0;
- int i;
- int cache_entries =
- (sz - sizeof(spiffs_cache)) / (SPIFFS_CACHE_PAGE_SIZE(fs));
- if (cache_entries <= 0) return;
-
- for (i = 0; i < cache_entries; i++) {
- cache_mask <<= 1;
- cache_mask |= 1;
- }
-
- spiffs_cache cache;
- c_memset(&cache, 0, sizeof(spiffs_cache));
- cache.cpage_count = cache_entries;
- cache.cpages = (u8_t *)((u8_t *)fs->cache + sizeof(spiffs_cache));
-
- cache.cpage_use_map = 0xffffffff;
- cache.cpage_use_mask = cache_mask;
- c_memcpy(fs->cache, &cache, sizeof(spiffs_cache));
-
- spiffs_cache *c = spiffs_get_cache(fs);
-
- c_memset(c->cpages, 0, c->cpage_count * SPIFFS_CACHE_PAGE_SIZE(fs));
-
- c->cpage_use_map &= ~(c->cpage_use_mask);
- for (i = 0; i < cache.cpage_count; i++) {
- spiffs_get_cache_page_hdr(fs, c, i)->ix = i;
- }
-}
-
-#endif // SPIFFS_CACHE
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_check.c b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_check.c
deleted file mode 100644
index 50bbb5c8..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_check.c
+++ /dev/null
@@ -1,973 +0,0 @@
-/*
- * spiffs_check.c
- *
- * Contains functionality for checking file system consistency
- * and mending problems.
- * Three levels of consistency checks are implemented:
- *
- * Look up consistency
- * Checks if indices in lookup pages are coherent with page headers
- * Object index consistency
- * Checks if there are any orphaned object indices (missing object index headers).
- * If an object index is found but not its header, the object index is deleted.
- * This is critical for the following page consistency check.
- * Page consistency
- * Checks for pages that ought to be indexed, ought not to be indexed, are multiple indexed
- *
- *
- * Created on: Jul 7, 2013
- * Author: petera
- */
-
-#include "spiffs.h"
-#include "spiffs_nucleus.h"
-
-//---------------------------------------
-// Look up consistency
-
-// searches in the object indices and returns the referenced page index given
-// the object id and the data span index
-// destroys fs->lu_work
-static s32_t spiffs_object_get_data_page_index_reference(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_span_ix data_spix,
- spiffs_page_ix *pix,
- spiffs_page_ix *objix_pix) {
- s32_t res;
-
- // calculate object index span index for given data page span index
- spiffs_span_ix objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
-
- // find obj index for obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, obj_id | SPIFFS_OBJ_ID_IX_FLAG, objix_spix, 0, objix_pix);
- SPIFFS_CHECK_RES(res);
-
- // load obj index entry
- u32_t addr = SPIFFS_PAGE_TO_PADDR(fs, *objix_pix);
- if (objix_spix == 0) {
- // get referenced page from object index header
- addr += sizeof(spiffs_page_object_ix_header) + data_spix * sizeof(spiffs_page_ix);
- } else {
- // get referenced page from object index
- addr += sizeof(spiffs_page_object_ix) + SPIFFS_OBJ_IX_ENTRY(fs, data_spix) * sizeof(spiffs_page_ix);
- }
-
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ, 0, addr, sizeof(spiffs_page_ix), (u8_t *)pix);
-
- return res;
-}
-
-// copies page contents to a new page
-static s32_t spiffs_rewrite_page(spiffs *fs, spiffs_page_ix cur_pix, spiffs_page_header *p_hdr, spiffs_page_ix *new_pix) {
- s32_t res;
- res = spiffs_page_allocate_data(fs, p_hdr->obj_id, p_hdr, 0,0,0,0, new_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_phys_cpy(fs, 0,
- SPIFFS_PAGE_TO_PADDR(fs, *new_pix) + sizeof(spiffs_page_header),
- SPIFFS_PAGE_TO_PADDR(fs, cur_pix) + sizeof(spiffs_page_header),
- SPIFFS_DATA_PAGE_SIZE(fs));
- SPIFFS_CHECK_RES(res);
- return res;
-}
-
-// rewrites the object index for given object id and replaces the
-// data page index to a new page index
-static s32_t spiffs_rewrite_index(spiffs *fs, spiffs_obj_id obj_id, spiffs_span_ix data_spix, spiffs_page_ix new_data_pix, spiffs_page_ix objix_pix) {
- s32_t res;
- spiffs_block_ix bix;
- int entry;
- spiffs_page_ix free_pix;
- obj_id |= SPIFFS_OBJ_ID_IX_FLAG;
-
- // find free entry
- res = spiffs_obj_lu_find_free(fs, fs->free_cursor_block_ix, fs->free_cursor_obj_lu_entry, &bix, &entry);
- SPIFFS_CHECK_RES(res);
- free_pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
-
- // calculate object index span index for given data page span index
- spiffs_span_ix objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
- if (objix_spix == 0) {
- // calc index in index header
- entry = data_spix;
- } else {
- // calc entry in index
- entry = SPIFFS_OBJ_IX_ENTRY(fs, data_spix);
- }
- // load index
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- SPIFFS_CHECK_RES(res);
- spiffs_page_header *objix_p_hdr = (spiffs_page_header *)fs->lu_work;
-
- // be ultra safe, double check header against provided data
- if (objix_p_hdr->obj_id != obj_id) {
- spiffs_page_delete(fs, free_pix);
- return SPIFFS_ERR_CHECK_OBJ_ID_MISM;
- }
- if (objix_p_hdr->span_ix != objix_spix) {
- spiffs_page_delete(fs, free_pix);
- return SPIFFS_ERR_CHECK_SPIX_MISM;
- }
- if ((objix_p_hdr->flags & (SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_IXDELE | SPIFFS_PH_FLAG_INDEX |
- SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_DELET)) !=
- (SPIFFS_PH_FLAG_IXDELE | SPIFFS_PH_FLAG_DELET)) {
- spiffs_page_delete(fs, free_pix);
- return SPIFFS_ERR_CHECK_FLAGS_BAD;
- }
-
- // rewrite in mem
- if (objix_spix == 0) {
- ((spiffs_page_ix*)((u8_t *)fs->lu_work + sizeof(spiffs_page_object_ix_header)))[data_spix] = new_data_pix;
- } else {
- ((spiffs_page_ix*)((u8_t *)fs->lu_work + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)] = new_data_pix;
- }
-
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_PAGE_TO_PADDR(fs, free_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- SPIFFS_CHECK_RES(res);
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_BLOCK_TO_PADDR(fs, SPIFFS_BLOCK_FOR_PAGE(fs, free_pix)) + SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, free_pix) * sizeof(spiffs_page_ix),
- sizeof(spiffs_obj_id),
- (u8_t *)&obj_id);
- SPIFFS_CHECK_RES(res);
- res = spiffs_page_delete(fs, objix_pix);
-
- return res;
-}
-
-// deletes an object just by marking object index header as deleted
-static s32_t spiffs_delete_obj_lazy(spiffs *fs, spiffs_obj_id obj_id) {
- spiffs_page_ix objix_hdr_pix;
- s32_t res;
- res = spiffs_obj_lu_find_id_and_span(fs, obj_id, 0, 0, &objix_hdr_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- return SPIFFS_OK;
- }
- SPIFFS_CHECK_RES(res);
- u8_t flags = 0xff & ~SPIFFS_PH_FLAG_IXDELE;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_PAGE_TO_PADDR(fs, objix_hdr_pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&flags);
- return res;
-}
-
-// validates the given look up entry
-static s32_t spiffs_lookup_check_validate(spiffs *fs, spiffs_obj_id lu_obj_id, spiffs_page_header *p_hdr,
- spiffs_page_ix cur_pix, spiffs_block_ix cur_block, int cur_entry, int *reload_lu) {
- (void)cur_block;
- (void)cur_entry;
- u8_t delete_page = 0;
- s32_t res = SPIFFS_OK;
- spiffs_page_ix objix_pix;
- spiffs_page_ix ref_pix;
- // check validity, take actions
- if (((lu_obj_id == SPIFFS_OBJ_ID_DELETED) && (p_hdr->flags & SPIFFS_PH_FLAG_DELET)) ||
- ((lu_obj_id == SPIFFS_OBJ_ID_FREE) && (p_hdr->flags & SPIFFS_PH_FLAG_USED) == 0)) {
- // look up entry deleted / free but used in page header
- SPIFFS_CHECK_DBG("LU: pix %04x deleted/free in lu but not on page\n", cur_pix);
- *reload_lu = 1;
- delete_page = 1;
- if (p_hdr->flags & SPIFFS_PH_FLAG_INDEX) {
- // header says data page
- // data page can be removed if not referenced by some object index
- res = spiffs_object_get_data_page_index_reference(fs, p_hdr->obj_id, p_hdr->span_ix, &ref_pix, &objix_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- // no object with this id, so remove page safely
- res = SPIFFS_OK;
- } else {
- SPIFFS_CHECK_RES(res);
- if (ref_pix == cur_pix) {
- // data page referenced by object index but deleted in lu
- // copy page to new place and re-write the object index to new place
- spiffs_page_ix new_pix;
- res = spiffs_rewrite_page(fs, cur_pix, p_hdr, &new_pix);
- SPIFFS_CHECK_DBG("LU: FIXUP: data page not found elsewhere, rewriting %04x to new page %04x\n", cur_pix, new_pix);
- SPIFFS_CHECK_RES(res);
- *reload_lu = 1;
- SPIFFS_CHECK_DBG("LU: FIXUP: %04x rewritten to %04x, affected objix_pix %04x\n", cur_pix, new_pix, objix_pix);
- res = spiffs_rewrite_index(fs, p_hdr->obj_id, p_hdr->span_ix, new_pix, objix_pix);
- if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
- // index bad also, cannot mend this file
- SPIFFS_CHECK_DBG("LU: FIXUP: index bad %d, cannot mend!\n", res);
- res = spiffs_page_delete(fs, new_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_delete_obj_lazy(fs, p_hdr->obj_id);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr->obj_id, 0);
- } else {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_INDEX, p_hdr->obj_id, p_hdr->span_ix);
- }
- SPIFFS_CHECK_RES(res);
- }
- }
- } else {
- // header says index page
- // index page can be removed if other index with same obj_id and spanix is found
- res = spiffs_obj_lu_find_id_and_span(fs, p_hdr->obj_id | SPIFFS_OBJ_ID_IX_FLAG, p_hdr->span_ix, cur_pix, 0);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- // no such index page found, check for a data page amongst page headers
- // lu cannot be trusted
- res = spiffs_obj_lu_find_id_and_span_by_phdr(fs, p_hdr->obj_id | SPIFFS_OBJ_ID_IX_FLAG, 0, 0, 0);
- if (res == SPIFFS_OK) { // ignore other errors
- // got a data page also, assume lu corruption only, rewrite to new page
- spiffs_page_ix new_pix;
- res = spiffs_rewrite_page(fs, cur_pix, p_hdr, &new_pix);
- SPIFFS_CHECK_DBG("LU: FIXUP: ix page with data not found elsewhere, rewriting %04x to new page %04x\n", cur_pix, new_pix);
- SPIFFS_CHECK_RES(res);
- *reload_lu = 1;
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_LOOKUP, p_hdr->obj_id, p_hdr->span_ix);
- }
- } else {
- SPIFFS_CHECK_RES(res);
- }
- }
- }
- if (lu_obj_id != SPIFFS_OBJ_ID_FREE && lu_obj_id != SPIFFS_OBJ_ID_DELETED) {
- // look up entry used
- if ((p_hdr->obj_id | SPIFFS_OBJ_ID_IX_FLAG) != (lu_obj_id | SPIFFS_OBJ_ID_IX_FLAG)) {
- SPIFFS_CHECK_DBG("LU: pix %04x differ in obj_id lu:%04x ph:%04x\n", cur_pix, lu_obj_id, p_hdr->obj_id);
- delete_page = 1;
- if ((p_hdr->flags & SPIFFS_PH_FLAG_DELET) == 0 ||
- (p_hdr->flags & SPIFFS_PH_FLAG_FINAL) ||
- (p_hdr->flags & (SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_IXDELE)) == 0) {
- // page deleted or not finalized, just remove it
- } else {
- if (p_hdr->flags & SPIFFS_PH_FLAG_INDEX) {
- // if data page, check for reference to this page
- res = spiffs_object_get_data_page_index_reference(fs, p_hdr->obj_id, p_hdr->span_ix, &ref_pix, &objix_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- // no object with this id, so remove page safely
- res = SPIFFS_OK;
- } else {
- SPIFFS_CHECK_RES(res);
- // if found, rewrite page with object id, update index, and delete current
- if (ref_pix == cur_pix) {
- spiffs_page_ix new_pix;
- res = spiffs_rewrite_page(fs, cur_pix, p_hdr, &new_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_rewrite_index(fs, p_hdr->obj_id, p_hdr->span_ix, new_pix, objix_pix);
- if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
- // index bad also, cannot mend this file
- SPIFFS_CHECK_DBG("LU: FIXUP: index bad %d, cannot mend!\n", res);
- res = spiffs_page_delete(fs, new_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_delete_obj_lazy(fs, p_hdr->obj_id);
- *reload_lu = 1;
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr->obj_id, 0);
- }
- SPIFFS_CHECK_RES(res);
- }
- }
- } else {
- // else if index, check for other pages with both obj_id's and spanix
- spiffs_page_ix objix_pix_lu, objix_pix_ph;
- // see if other object index page exists for lookup obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, lu_obj_id | SPIFFS_OBJ_ID_IX_FLAG, p_hdr->span_ix, 0, &objix_pix_lu);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- objix_pix_lu = 0;
- }
- SPIFFS_CHECK_RES(res);
- // see if other object index exists for page header obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, p_hdr->obj_id | SPIFFS_OBJ_ID_IX_FLAG, p_hdr->span_ix, 0, &objix_pix_ph);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- objix_pix_ph = 0;
- }
- SPIFFS_CHECK_RES(res);
- // if both obj_id's found, just delete current
- if (objix_pix_ph == 0 || objix_pix_lu == 0) {
- // otherwise try finding first corresponding data pages
- spiffs_page_ix data_pix_lu, data_pix_ph;
- // see if other data page exists for look up obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, lu_obj_id & ~SPIFFS_OBJ_ID_IX_FLAG, 0, 0, &data_pix_lu);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- objix_pix_lu = 0;
- }
- SPIFFS_CHECK_RES(res);
- // see if other data page exists for page header obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, p_hdr->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG, 0, 0, &data_pix_ph);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- objix_pix_ph = 0;
- }
- SPIFFS_CHECK_RES(res);
-
- spiffs_page_header new_ph;
- new_ph.flags = 0xff & ~(SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_FINAL);
- new_ph.span_ix = p_hdr->span_ix;
- spiffs_page_ix new_pix;
- if ((objix_pix_lu && data_pix_lu && data_pix_ph && objix_pix_ph == 0) ||
- (objix_pix_lu == 0 && data_pix_ph && objix_pix_ph == 0)) {
- // got a data page for page header obj id
- // rewrite as obj_id_ph
- new_ph.obj_id = p_hdr->obj_id | SPIFFS_OBJ_ID_IX_FLAG;
- res = spiffs_rewrite_page(fs, cur_pix, &new_ph, &new_pix);
- SPIFFS_CHECK_DBG("LU: FIXUP: rewrite page %04x as %04x to pix %04x\n", cur_pix, new_ph.obj_id, new_pix);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_LOOKUP, p_hdr->obj_id, p_hdr->span_ix);
- SPIFFS_CHECK_RES(res);
- *reload_lu = 1;
- } else if ((objix_pix_ph && data_pix_ph && data_pix_lu && objix_pix_lu == 0) ||
- (objix_pix_ph == 0 && data_pix_lu && objix_pix_lu == 0)) {
- // got a data page for look up obj id
- // rewrite as obj_id_lu
- new_ph.obj_id = lu_obj_id | SPIFFS_OBJ_ID_IX_FLAG;
- SPIFFS_CHECK_DBG("LU: FIXUP: rewrite page %04x as %04x\n", cur_pix, new_ph.obj_id);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_LOOKUP, p_hdr->obj_id, p_hdr->span_ix);
- res = spiffs_rewrite_page(fs, cur_pix, &new_ph, &new_pix);
- SPIFFS_CHECK_RES(res);
- *reload_lu = 1;
- } else {
- // cannot safely do anything
- SPIFFS_CHECK_DBG("LU: FIXUP: nothing to do, just delete\n");
- }
- }
- }
- }
- } else if (((lu_obj_id & SPIFFS_OBJ_ID_IX_FLAG) && (p_hdr->flags & SPIFFS_PH_FLAG_INDEX)) ||
- ((lu_obj_id & SPIFFS_OBJ_ID_IX_FLAG) == 0 && (p_hdr->flags & SPIFFS_PH_FLAG_INDEX) == 0)) {
- SPIFFS_CHECK_DBG("LU: %04x lu/page index marking differ\n", cur_pix);
- spiffs_page_ix data_pix, objix_pix_d;
- // see if other data page exists for given obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, lu_obj_id & ~SPIFFS_OBJ_ID_IX_FLAG, p_hdr->span_ix, cur_pix, &data_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- data_pix = 0;
- }
- SPIFFS_CHECK_RES(res);
- // see if other object index exists for given obj id and span index
- res = spiffs_obj_lu_find_id_and_span(fs, lu_obj_id | SPIFFS_OBJ_ID_IX_FLAG, p_hdr->span_ix, cur_pix, &objix_pix_d);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- objix_pix_d = 0;
- }
- SPIFFS_CHECK_RES(res);
-
- delete_page = 1;
- // if other data page exists and object index exists, just delete page
- if (data_pix && objix_pix_d) {
- SPIFFS_CHECK_DBG("LU: FIXUP: other index and data page exists, simply remove\n");
- } else
- // if only data page exists, make this page index
- if (data_pix && objix_pix_d == 0) {
- SPIFFS_CHECK_DBG("LU: FIXUP: other data page exists, make this index\n");
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_INDEX, lu_obj_id, p_hdr->span_ix);
- spiffs_page_header new_ph;
- spiffs_page_ix new_pix;
- new_ph.flags = 0xff & ~(SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_INDEX);
- new_ph.obj_id = lu_obj_id | SPIFFS_OBJ_ID_IX_FLAG;
- new_ph.span_ix = p_hdr->span_ix;
- res = spiffs_page_allocate_data(fs, new_ph.obj_id, &new_ph, 0, 0, 0, 1, &new_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_phys_cpy(fs, 0, SPIFFS_PAGE_TO_PADDR(fs, new_pix) + sizeof(spiffs_page_header),
- SPIFFS_PAGE_TO_PADDR(fs, cur_pix) + sizeof(spiffs_page_header),
- SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_page_header));
- SPIFFS_CHECK_RES(res);
- } else
- // if only index exists, make data page
- if (data_pix == 0 && objix_pix_d) {
- SPIFFS_CHECK_DBG("LU: FIXUP: other index page exists, make this data\n");
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_LOOKUP, lu_obj_id, p_hdr->span_ix);
- spiffs_page_header new_ph;
- spiffs_page_ix new_pix;
- new_ph.flags = 0xff & ~(SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_FINAL);
- new_ph.obj_id = lu_obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- new_ph.span_ix = p_hdr->span_ix;
- res = spiffs_page_allocate_data(fs, new_ph.obj_id, &new_ph, 0, 0, 0, 1, &new_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_phys_cpy(fs, 0, SPIFFS_PAGE_TO_PADDR(fs, new_pix) + sizeof(spiffs_page_header),
- SPIFFS_PAGE_TO_PADDR(fs, cur_pix) + sizeof(spiffs_page_header),
- SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_page_header));
- SPIFFS_CHECK_RES(res);
- } else {
- // if nothing exists, we cannot safely make a decision - delete
- }
- }
- else if ((p_hdr->flags & SPIFFS_PH_FLAG_DELET) == 0) {
- SPIFFS_CHECK_DBG("LU: pix %04x busy in lu but deleted on page\n", cur_pix);
- delete_page = 1;
- } else if ((p_hdr->flags & SPIFFS_PH_FLAG_FINAL)) {
- SPIFFS_CHECK_DBG("LU: pix %04x busy but not final\n", cur_pix);
- // page can be removed if not referenced by object index
- *reload_lu = 1;
- res = spiffs_object_get_data_page_index_reference(fs, lu_obj_id, p_hdr->span_ix, &ref_pix, &objix_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- // no object with this id, so remove page safely
- res = SPIFFS_OK;
- delete_page = 1;
- } else {
- SPIFFS_CHECK_RES(res);
- if (ref_pix != cur_pix) {
- SPIFFS_CHECK_DBG("LU: FIXUP: other finalized page is referred, just delete\n");
- delete_page = 1;
- } else {
- // page referenced by object index but not final
- // just finalize
- SPIFFS_CHECK_DBG("LU: FIXUP: unfinalized page is referred, finalizing\n");
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_FIX_LOOKUP, p_hdr->obj_id, p_hdr->span_ix);
- u8_t flags = 0xff & ~SPIFFS_PH_FLAG_FINAL;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t), (u8_t*)&flags);
- }
- }
- }
- }
-
- if (delete_page) {
- SPIFFS_CHECK_DBG("LU: FIXUP: deleting page %04x\n", cur_pix);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_DELETE_PAGE, cur_pix, 0);
- res = spiffs_page_delete(fs, cur_pix);
- SPIFFS_CHECK_RES(res);
- }
-
- return res;
-}
-
-static s32_t spiffs_lookup_check_v(spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix cur_block, int cur_entry,
- u32_t user_data, void *user_p) {
- (void)user_data;
- (void)user_p;
- s32_t res = SPIFFS_OK;
- spiffs_page_header p_hdr;
- spiffs_page_ix cur_pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, cur_block, cur_entry);
-
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_PROGRESS,
- (cur_block * 256)/fs->block_count, 0);
-
- // load header
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
-
- int reload_lu = 0;
-
- res = spiffs_lookup_check_validate(fs, obj_id, &p_hdr, cur_pix, cur_block, cur_entry, &reload_lu);
- SPIFFS_CHECK_RES(res);
-
- if (res == SPIFFS_OK) {
- return reload_lu ? SPIFFS_VIS_COUNTINUE_RELOAD : SPIFFS_VIS_COUNTINUE;
- }
- return res;
-}
-
-
-// Scans all object look up. For each entry, corresponding page header is checked for validity.
-// If an object index header page is found, this is also checked
-s32_t spiffs_lookup_consistency_check(spiffs *fs, u8_t check_all_objects) {
- (void)check_all_objects;
- s32_t res = SPIFFS_OK;
-
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_PROGRESS, 0, 0);
-
- res = spiffs_obj_lu_find_entry_visitor(fs, 0, 0, 0, 0, spiffs_lookup_check_v, 0, 0, 0, 0);
-
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_OK;
- }
-
- if (res != SPIFFS_OK) {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_ERROR, res, 0);
- }
-
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_PROGRESS, 256, 0);
-
- return res;
-}
-
-//---------------------------------------
-// Page consistency
-
-// Scans all pages (except lu pages), reserves 4 bits in working memory for each page
-// bit 0: 0 == FREE|DELETED, 1 == USED
-// bit 1: 0 == UNREFERENCED, 1 == REFERENCED
-// bit 2: 0 == NOT_INDEX, 1 == INDEX
-// bit 3: unused
-// A consistent file system will have only pages being
-// * x000 free, unreferenced, not index
-// * x011 used, referenced only once, not index
-// * x101 used, unreferenced, index
-// The working memory might not fit all pages so several scans might be needed
-static s32_t spiffs_page_consistency_check_i(spiffs *fs) {
- const u32_t bits = 4;
- const spiffs_page_ix pages_per_scan = SPIFFS_CFG_LOG_PAGE_SZ(fs) * 8 / bits;
-
- s32_t res = SPIFFS_OK;
- spiffs_page_ix pix_offset = 0;
-
- // for each range of pages fitting into work memory
- while (pix_offset < SPIFFS_PAGES_PER_BLOCK(fs) * fs->block_count) {
- // set this flag to abort all checks and rescan the page range
- u8_t restart = 0;
- c_memset(fs->work, 0, SPIFFS_CFG_LOG_PAGE_SZ(fs));
-
- spiffs_block_ix cur_block = 0;
- // build consistency bitmap for id range traversing all blocks
- while (!restart && cur_block < fs->block_count) {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_PROGRESS,
- (pix_offset*256)/(SPIFFS_PAGES_PER_BLOCK(fs) * fs->block_count) +
- ((((cur_block * pages_per_scan * 256)/ (SPIFFS_PAGES_PER_BLOCK(fs) * fs->block_count))) / fs->block_count),
- 0);
-
- // traverse each page except for lookup pages
- spiffs_page_ix cur_pix = SPIFFS_OBJ_LOOKUP_PAGES(fs) + SPIFFS_PAGES_PER_BLOCK(fs) * cur_block;
- while (!restart && cur_pix < SPIFFS_PAGES_PER_BLOCK(fs) * (cur_block+1)) {
- // read header
- spiffs_page_header p_hdr;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
-
- u8_t within_range = (cur_pix >= pix_offset && cur_pix < pix_offset + pages_per_scan);
- const u32_t pix_byte_ix = (cur_pix - pix_offset) / (8/bits);
- const u8_t pix_bit_ix = (cur_pix & ((8/bits)-1)) * bits;
-
- if (within_range &&
- (p_hdr.flags & SPIFFS_PH_FLAG_DELET) && (p_hdr.flags & SPIFFS_PH_FLAG_USED) == 0) {
- // used
- fs->work[pix_byte_ix] |= (1<<(pix_bit_ix + 0));
- }
- if ((p_hdr.flags & SPIFFS_PH_FLAG_DELET) &&
- (p_hdr.flags & SPIFFS_PH_FLAG_IXDELE) &&
- (p_hdr.flags & (SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_USED)) == 0) {
- // found non-deleted index
- if (within_range) {
- fs->work[pix_byte_ix] |= (1<<(pix_bit_ix + 2));
- }
-
- // load non-deleted index
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- SPIFFS_CHECK_RES(res);
-
- // traverse index for referenced pages
- spiffs_page_ix *object_page_index;
- spiffs_page_header *objix_p_hdr = (spiffs_page_header *)fs->lu_work;
-
- int entries;
- int i;
- spiffs_span_ix data_spix_offset;
- if (p_hdr.span_ix == 0) {
- // object header page index
- entries = SPIFFS_OBJ_HDR_IX_LEN(fs);
- data_spix_offset = 0;
- object_page_index = (spiffs_page_ix *)((u8_t *)fs->lu_work + sizeof(spiffs_page_object_ix_header));
- } else {
- // object page index
- entries = SPIFFS_OBJ_IX_LEN(fs);
- data_spix_offset = SPIFFS_OBJ_HDR_IX_LEN(fs) + SPIFFS_OBJ_IX_LEN(fs) * (p_hdr.span_ix - 1);
- object_page_index = (spiffs_page_ix *)((u8_t *)fs->lu_work + sizeof(spiffs_page_object_ix));
- }
-
- // for all entries in index
- for (i = 0; !restart && i < entries; i++) {
- spiffs_page_ix rpix = object_page_index[i];
- u8_t rpix_within_range = rpix >= pix_offset && rpix < pix_offset + pages_per_scan;
-
- if ((rpix != (spiffs_page_ix)-1 && rpix > SPIFFS_MAX_PAGES(fs))
- || (rpix_within_range && SPIFFS_IS_LOOKUP_PAGE(fs, rpix))) {
-
- // bad reference
- SPIFFS_CHECK_DBG("PA: pix %04x bad pix / LU referenced from page %04x\n",
- rpix, cur_pix);
- // check for data page elsewhere
- spiffs_page_ix data_pix;
- res = spiffs_obj_lu_find_id_and_span(fs, objix_p_hdr->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG,
- data_spix_offset + i, 0, &data_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- data_pix = 0;
- }
- SPIFFS_CHECK_RES(res);
- if (data_pix == 0) {
- // if not, allocate free page
- spiffs_page_header new_ph;
- new_ph.flags = 0xff & ~(SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_FINAL);
- new_ph.obj_id = objix_p_hdr->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- new_ph.span_ix = data_spix_offset + i;
- res = spiffs_page_allocate_data(fs, new_ph.obj_id, &new_ph, 0, 0, 0, 1, &data_pix);
- SPIFFS_CHECK_RES(res);
- SPIFFS_CHECK_DBG("PA: FIXUP: found no existing data page, created new @ %04x\n", data_pix);
- }
- // remap index
- SPIFFS_CHECK_DBG("PA: FIXUP: rewriting index pix %04x\n", cur_pix);
- res = spiffs_rewrite_index(fs, objix_p_hdr->obj_id | SPIFFS_OBJ_ID_IX_FLAG,
- data_spix_offset + i, data_pix, cur_pix);
- if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
- // index bad also, cannot mend this file
- SPIFFS_CHECK_DBG("PA: FIXUP: index bad %d, cannot mend - delete object\n", res);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, objix_p_hdr->obj_id, 0);
- // delete file
- res = spiffs_page_delete(fs, cur_pix);
- } else {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_FIX_INDEX, objix_p_hdr->obj_id, objix_p_hdr->span_ix);
- }
- SPIFFS_CHECK_RES(res);
- restart = 1;
-
- } else if (rpix_within_range) {
-
- // valid reference
- // read referenced page header
- spiffs_page_header rp_hdr;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, rpix), sizeof(spiffs_page_header), (u8_t*)&rp_hdr);
- SPIFFS_CHECK_RES(res);
-
- // cross reference page header check
- if (rp_hdr.obj_id != (p_hdr.obj_id & ~SPIFFS_OBJ_ID_IX_FLAG) ||
- rp_hdr.span_ix != data_spix_offset + i ||
- (rp_hdr.flags & (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_USED)) !=
- (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_INDEX)) {
- SPIFFS_CHECK_DBG("PA: pix %04x has inconsistent page header ix id/span:%04x/%04x, ref id/span:%04x/%04x flags:%02x\n",
- rpix, p_hdr.obj_id & ~SPIFFS_OBJ_ID_IX_FLAG, data_spix_offset + i,
- rp_hdr.obj_id, rp_hdr.span_ix, rp_hdr.flags);
- // try finding correct page
- spiffs_page_ix data_pix;
- res = spiffs_obj_lu_find_id_and_span(fs, p_hdr.obj_id & ~SPIFFS_OBJ_ID_IX_FLAG,
- data_spix_offset + i, rpix, &data_pix);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- data_pix = 0;
- }
- SPIFFS_CHECK_RES(res);
- if (data_pix == 0) {
- // not found, this index is badly borked
- SPIFFS_CHECK_DBG("PA: FIXUP: index bad, delete object id %04x\n", p_hdr.obj_id);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr.obj_id, 0);
- res = spiffs_delete_obj_lazy(fs, p_hdr.obj_id);
- SPIFFS_CHECK_RES(res);
- break;
- } else {
- // found it, so rewrite index
- SPIFFS_CHECK_DBG("PA: FIXUP: found correct data pix %04x, rewrite ix pix %04x id %04x\n",
- data_pix, cur_pix, p_hdr.obj_id);
- res = spiffs_rewrite_index(fs, p_hdr.obj_id, data_spix_offset + i, data_pix, cur_pix);
- if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
- // index bad also, cannot mend this file
- SPIFFS_CHECK_DBG("PA: FIXUP: index bad %d, cannot mend!\n", res);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr.obj_id, 0);
- res = spiffs_delete_obj_lazy(fs, p_hdr.obj_id);
- } else {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_FIX_INDEX, p_hdr.obj_id, p_hdr.span_ix);
- }
- SPIFFS_CHECK_RES(res);
- restart = 1;
- }
- }
- else {
- // mark rpix as referenced
- const u32_t rpix_byte_ix = (rpix - pix_offset) / (8/bits);
- const u8_t rpix_bit_ix = (rpix & ((8/bits)-1)) * bits;
- if (fs->work[rpix_byte_ix] & (1<<(rpix_bit_ix + 1))) {
- SPIFFS_CHECK_DBG("PA: pix %04x multiple referenced from page %04x\n",
- rpix, cur_pix);
- // Here, we should have fixed all broken references - getting this means there
- // must be multiple files with same object id. Only solution is to delete
- // the object which is referring to this page
- SPIFFS_CHECK_DBG("PA: FIXUP: removing object %04x and page %04x\n",
- p_hdr.obj_id, cur_pix);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr.obj_id, 0);
- res = spiffs_delete_obj_lazy(fs, p_hdr.obj_id);
- SPIFFS_CHECK_RES(res);
- // extra precaution, delete this page also
- res = spiffs_page_delete(fs, cur_pix);
- SPIFFS_CHECK_RES(res);
- restart = 1;
- }
- fs->work[rpix_byte_ix] |= (1<<(rpix_bit_ix + 1));
- }
- }
- } // for all index entries
- } // found index
-
- // next page
- cur_pix++;
- }
- // next block
- cur_block++;
- }
- // check consistency bitmap
- if (!restart) {
- spiffs_page_ix objix_pix;
- spiffs_page_ix rpix;
-
- u32_t byte_ix;
- u8_t bit_ix;
- for (byte_ix = 0; !restart && byte_ix < SPIFFS_CFG_LOG_PAGE_SZ(fs); byte_ix++) {
- for (bit_ix = 0; !restart && bit_ix < 8/bits; bit_ix ++) {
- u8_t bitmask = (fs->work[byte_ix] >> (bit_ix * bits)) & 0x7;
- spiffs_page_ix cur_pix = pix_offset + byte_ix * (8/bits) + bit_ix;
-
- // 000 ok - free, unreferenced, not index
-
- if (bitmask == 0x1) {
-
- // 001
- SPIFFS_CHECK_DBG("PA: pix %04x USED, UNREFERENCED, not index\n", cur_pix);
-
- u8_t rewrite_ix_to_this = 0;
- u8_t delete_page = 0;
- // check corresponding object index entry
- spiffs_page_header p_hdr;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_object_get_data_page_index_reference(fs, p_hdr.obj_id, p_hdr.span_ix,
- &rpix, &objix_pix);
- if (res == SPIFFS_OK) {
- if (((rpix == (spiffs_page_ix)-1 || rpix > SPIFFS_MAX_PAGES(fs)) || (SPIFFS_IS_LOOKUP_PAGE(fs, rpix)))) {
- // pointing to a bad page altogether, rewrite index to this
- rewrite_ix_to_this = 1;
- SPIFFS_CHECK_DBG("PA: corresponding ref is bad: %04x, rewrite to this %04x\n", rpix, cur_pix);
- } else {
- // pointing to something else, check what
- spiffs_page_header rp_hdr;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, rpix), sizeof(spiffs_page_header), (u8_t*)&rp_hdr);
- SPIFFS_CHECK_RES(res);
- if (((p_hdr.obj_id & ~SPIFFS_OBJ_ID_IX_FLAG) == rp_hdr.obj_id) &&
- ((rp_hdr.flags & (SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_FINAL)) ==
- (SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_DELET))) {
- // pointing to something else valid, just delete this page then
- SPIFFS_CHECK_DBG("PA: corresponding ref is good but different: %04x, delete this %04x\n", rpix, cur_pix);
- delete_page = 1;
- } else {
- // pointing to something weird, update index to point to this page instead
- if (rpix != cur_pix) {
- SPIFFS_CHECK_DBG("PA: corresponding ref is weird: %04x %s%s%s%s, rewrite this %04x\n", rpix,
- (rp_hdr.flags & SPIFFS_PH_FLAG_INDEX) ? "" : "INDEX ",
- (rp_hdr.flags & SPIFFS_PH_FLAG_DELET) ? "" : "DELETED ",
- (rp_hdr.flags & SPIFFS_PH_FLAG_USED) ? "NOTUSED " : "",
- (rp_hdr.flags & SPIFFS_PH_FLAG_FINAL) ? "NOTFINAL " : "",
- cur_pix);
- rewrite_ix_to_this = 1;
- } else {
- // should not happen, destined for fubar
- }
- }
- }
- } else if (res == SPIFFS_ERR_NOT_FOUND) {
- SPIFFS_CHECK_DBG("PA: corresponding ref not found, delete %04x\n", cur_pix);
- delete_page = 1;
- res = SPIFFS_OK;
- }
-
- if (rewrite_ix_to_this) {
- // if pointing to invalid page, redirect index to this page
- SPIFFS_CHECK_DBG("PA: FIXUP: rewrite index id %04x data spix %04x to point to this pix: %04x\n",
- p_hdr.obj_id, p_hdr.span_ix, cur_pix);
- res = spiffs_rewrite_index(fs, p_hdr.obj_id, p_hdr.span_ix, cur_pix, objix_pix);
- if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
- // index bad also, cannot mend this file
- SPIFFS_CHECK_DBG("PA: FIXUP: index bad %d, cannot mend!\n", res);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr.obj_id, 0);
- res = spiffs_page_delete(fs, cur_pix);
- SPIFFS_CHECK_RES(res);
- res = spiffs_delete_obj_lazy(fs, p_hdr.obj_id);
- } else {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_FIX_INDEX, p_hdr.obj_id, p_hdr.span_ix);
- }
- SPIFFS_CHECK_RES(res);
- restart = 1;
- continue;
- } else if (delete_page) {
- SPIFFS_CHECK_DBG("PA: FIXUP: deleting page %04x\n", cur_pix);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_PAGE, cur_pix, 0);
- res = spiffs_page_delete(fs, cur_pix);
- }
- SPIFFS_CHECK_RES(res);
- }
- if (bitmask == 0x2) {
-
- // 010
- SPIFFS_CHECK_DBG("PA: pix %04x FREE, REFERENCED, not index\n", cur_pix);
-
- // no op, this should be taken care of when checking valid references
- }
-
- // 011 ok - busy, referenced, not index
-
- if (bitmask == 0x4) {
-
- // 100
- SPIFFS_CHECK_DBG("PA: pix %04x FREE, unreferenced, INDEX\n", cur_pix);
-
- // this should never happen, major fubar
- }
-
- // 101 ok - busy, unreferenced, index
-
- if (bitmask == 0x6) {
-
- // 110
- SPIFFS_CHECK_DBG("PA: pix %04x FREE, REFERENCED, INDEX\n", cur_pix);
-
- // no op, this should be taken care of when checking valid references
- }
- if (bitmask == 0x7) {
-
- // 111
- SPIFFS_CHECK_DBG("PA: pix %04x USED, REFERENCED, INDEX\n", cur_pix);
-
- // no op, this should be taken care of when checking valid references
- }
- }
- }
- }
- // next page range
- if (!restart) {
- pix_offset += pages_per_scan;
- }
- } // while page range not reached end
- return res;
-}
-
-// Checks consistency amongst all pages and fixes irregularities
-s32_t spiffs_page_consistency_check(spiffs *fs) {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_PROGRESS, 0, 0);
- s32_t res = spiffs_page_consistency_check_i(fs);
- if (res != SPIFFS_OK) {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_ERROR, res, 0);
- }
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_PROGRESS, 256, 0);
- return res;
-}
-
-//---------------------------------------
-// Object index consistency
-
-// searches for given object id in temporary object id index,
-// returns the index or -1
-static int spiffs_object_index_search(spiffs *fs, spiffs_obj_id obj_id) {
- u32_t i;
- spiffs_obj_id *obj_table = (spiffs_obj_id *)fs->work;
- obj_id &= ~SPIFFS_OBJ_ID_IX_FLAG;
- for (i = 0; i < SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id); i++) {
- if ((obj_table[i] & ~SPIFFS_OBJ_ID_IX_FLAG) == obj_id) {
- return i;
- }
- }
- return -1;
-}
-
-static s32_t spiffs_object_index_consistency_check_v(spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix cur_block,
- int cur_entry, u32_t user_data, void *user_p) {
- (void)user_data;
- s32_t res_c = SPIFFS_VIS_COUNTINUE;
- s32_t res = SPIFFS_OK;
- u32_t *log_ix = (u32_t *)user_p;
- spiffs_obj_id *obj_table = (spiffs_obj_id *)fs->work;
-
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_INDEX, SPIFFS_CHECK_PROGRESS,
- (cur_block * 256)/fs->block_count, 0);
-
- if (obj_id != SPIFFS_OBJ_ID_FREE && obj_id != SPIFFS_OBJ_ID_DELETED && (obj_id & SPIFFS_OBJ_ID_IX_FLAG)) {
- spiffs_page_header p_hdr;
- spiffs_page_ix cur_pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, cur_block, cur_entry);
-
- // load header
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
-
- if (p_hdr.span_ix == 0 &&
- (p_hdr.flags & (SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_IXDELE)) ==
- (SPIFFS_PH_FLAG_DELET)) {
- SPIFFS_CHECK_DBG("IX: pix %04x, obj id:%04x spix:%04x header not fully deleted - deleting\n",
- cur_pix, obj_id, p_hdr.span_ix);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_INDEX, SPIFFS_CHECK_DELETE_PAGE, cur_pix, obj_id);
- res = spiffs_page_delete(fs, cur_pix);
- SPIFFS_CHECK_RES(res);
- return res_c;
- }
-
- if ((p_hdr.flags & (SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_IXDELE)) ==
- (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_IXDELE)) {
- return res_c;
- }
-
- if (p_hdr.span_ix == 0) {
- // objix header page, register objid as reachable
- int r = spiffs_object_index_search(fs, obj_id);
- if (r == -1) {
- // not registered, do it
- obj_table[*log_ix] = obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- (*log_ix)++;
- if (*log_ix >= SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id)) {
- *log_ix = 0;
- }
- }
- } else { // span index
- // objix page, see if header can be found
- int r = spiffs_object_index_search(fs, obj_id);
- u8_t delete = 0;
- if (r == -1) {
- // not in temporary index, try finding it
- spiffs_page_ix objix_hdr_pix;
- res = spiffs_obj_lu_find_id_and_span(fs, obj_id | SPIFFS_OBJ_ID_IX_FLAG, 0, 0, &objix_hdr_pix);
- res_c = SPIFFS_VIS_COUNTINUE_RELOAD;
- if (res == SPIFFS_OK) {
- // found, register as reachable
- obj_table[*log_ix] = obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- } else if (res == SPIFFS_ERR_NOT_FOUND) {
- // not found, register as unreachable
- delete = 1;
- obj_table[*log_ix] = obj_id | SPIFFS_OBJ_ID_IX_FLAG;
- } else {
- SPIFFS_CHECK_RES(res);
- }
- (*log_ix)++;
- if (*log_ix >= SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id)) {
- *log_ix = 0;
- }
- } else {
- // in temporary index, check reachable flag
- if ((obj_table[r] & SPIFFS_OBJ_ID_IX_FLAG)) {
- // registered as unreachable
- delete = 1;
- }
- }
-
- if (delete) {
- SPIFFS_CHECK_DBG("IX: FIXUP: pix %04x, obj id:%04x spix:%04x is orphan index - deleting\n",
- cur_pix, obj_id, p_hdr.span_ix);
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_INDEX, SPIFFS_CHECK_DELETE_ORPHANED_INDEX, cur_pix, obj_id);
- res = spiffs_page_delete(fs, cur_pix);
- SPIFFS_CHECK_RES(res);
- }
- } // span index
- } // valid object index id
-
- return res_c;
-}
-
-// Removes orphaned and partially deleted index pages.
-// Scans for index pages. When an index page is found, corresponding index header is searched for.
-// If no such page exists, the index page cannot be reached as no index header exists and must be
-// deleted.
-s32_t spiffs_object_index_consistency_check(spiffs *fs) {
- s32_t res = SPIFFS_OK;
- // impl note:
- // fs->work is used for a temporary object index memory, listing found object ids and
- // indicating whether they can be reached or not. Acting as a fifo if object ids cannot fit.
- // In the temporary object index memory, SPIFFS_OBJ_ID_IX_FLAG bit is used to indicate
- // a reachable/unreachable object id.
- c_memset(fs->work, 0, SPIFFS_CFG_LOG_PAGE_SZ(fs));
- u32_t obj_id_log_ix = 0;
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_INDEX, SPIFFS_CHECK_PROGRESS, 0, 0);
- res = spiffs_obj_lu_find_entry_visitor(fs, 0, 0, 0, 0, spiffs_object_index_consistency_check_v, 0, &obj_id_log_ix,
- 0, 0);
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_OK;
- }
- if (res != SPIFFS_OK) {
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_INDEX, SPIFFS_CHECK_ERROR, res, 0);
- }
- if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_INDEX, SPIFFS_CHECK_PROGRESS, 256, 0);
- return res;
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_config.h b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_config.h
deleted file mode 100644
index d59ac80b..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_config.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * spiffs_config.h
- *
- * Created on: Jul 3, 2013
- * Author: petera
- */
-
-#ifndef SPIFFS_CONFIG_H_
-#define SPIFFS_CONFIG_H_
-
-#include "mem.h"
-#include "c_types.h"
-#include "stddef.h"
-#include "osapi.h"
-#include "ets_sys.h"
-
-#define c_memcpy os_memcpy
-#define c_printf os_printf
-#define c_memset os_memset
-
-typedef signed short file_t;
-typedef long int s32_t;
-typedef long unsigned int u32_t;
-typedef int16_t s16_t;
-typedef uint16_t u16_t;
-typedef int8_t s8_t;
-typedef uint8_t u8_t;
-
-#ifndef SEEK_SET
-#define SEEK_SET 0 /* set file offset to offset */
-#endif
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1 /* set file offset to current plus offset */
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2 /* set file offset to EOF plus offset */
-#endif
-
-#ifndef EOF
-#define EOF (-1)
-#endif
-
-// compile time switches
-
-// Set generic spiffs debug output call.
-#ifndef SPIFFS_DGB
-#define SPIFFS_DBG(...) //c_printf(__VA_ARGS__)
-#endif
-// Set spiffs debug output call for garbage collecting.
-#ifndef SPIFFS_GC_DGB
-#define SPIFFS_GC_DBG(...) //c_printf(__VA_ARGS__)
-#endif
-// Set spiffs debug output call for caching.
-#ifndef SPIFFS_CACHE_DGB
-#define SPIFFS_CACHE_DBG(...) //c_printf(__VA_ARGS__)
-#endif
-// Set spiffs debug output call for system consistency checks.
-#ifndef SPIFFS_CHECK_DGB
-#define SPIFFS_CHECK_DBG(...) //c_printf(__VA_ARGS__)
-#endif
-
-// Enable/disable API functions to determine exact number of bytes
-// for filedescriptor and cache buffers. Once decided for a configuration,
-// this can be disabled to reduce flash.
-#ifndef SPIFFS_BUFFER_HELP
-#define SPIFFS_BUFFER_HELP 0
-#endif
-
-// Enables/disable memory read caching of nucleus file system operations.
-// If enabled, memory area must be provided for cache in SPIFFS_mount.
-#ifndef SPIFFS_CACHE
-#define SPIFFS_CACHE 1
-#endif
-#if SPIFFS_CACHE
-// Enables memory write caching for file descriptors in hydrogen
-#ifndef SPIFFS_CACHE_WR
-#define SPIFFS_CACHE_WR 1
-#endif
-
-// Enable/disable statistics on caching. Debug/test purpose only.
-#ifndef SPIFFS_CACHE_STATS
-#define SPIFFS_CACHE_STATS 0
-#endif
-#endif
-
-// Always check header of each accessed page to ensure consistent state.
-// If enabled it will increase number of reads, will increase flash.
-#ifndef SPIFFS_PAGE_CHECK
-#define SPIFFS_PAGE_CHECK 1
-#endif
-
-// Define maximum number of gc runs to perform to reach desired free pages.
-#ifndef SPIFFS_GC_MAX_RUNS
-#define SPIFFS_GC_MAX_RUNS 5
-#endif
-
-// Enable/disable statistics on gc. Debug/test purpose only.
-#ifndef SPIFFS_GC_STATS
-#define SPIFFS_GC_STATS 0
-#endif
-
-// Garbage collecting examines all pages in a block which and sums up
-// to a block score. Deleted pages normally gives positive score and
-// used pages normally gives a negative score (as these must be moved).
-// To have a fair wear-leveling, the erase age is also included in score,
-// whose factor normally is the most positive.
-// The larger the score, the more likely it is that the block will
-// picked for garbage collection.
-
-// Garbage collecting heuristics - weight used for deleted pages.
-#ifndef SPIFFS_GC_HEUR_W_DELET
-#define SPIFFS_GC_HEUR_W_DELET (5)
-#endif
-// Garbage collecting heuristics - weight used for used pages.
-#ifndef SPIFFS_GC_HEUR_W_USED
-#define SPIFFS_GC_HEUR_W_USED (-1)
-#endif
-// Garbage collecting heuristics - weight used for time between
-// last erased and erase of this block.
-#ifndef SPIFFS_GC_HEUR_W_ERASE_AGE
-#define SPIFFS_GC_HEUR_W_ERASE_AGE (50)
-#endif
-
-// Object name maximum length.
-#ifndef SPIFFS_OBJ_NAME_LEN
-#define SPIFFS_OBJ_NAME_LEN (32)
-#endif
-
-// Size of buffer allocated on stack used when copying data.
-// Lower value generates more read/writes. No meaning having it bigger
-// than logical page size.
-#ifndef SPIFFS_COPY_BUFFER_STACK
-#define SPIFFS_COPY_BUFFER_STACK (64)
-#endif
-
-// Enable this to have an identifiable spiffs filesystem. This will look for
-// a magic in all sectors to determine if this is a valid spiffs system or
-// not on mount point. If not, SPIFFS_format must be called prior to mounting
-// again.
-#ifndef SPIFFS_USE_MAGIC
-#define SPIFFS_USE_MAGIC (0)
-#endif
-
-// SPIFFS_LOCK and SPIFFS_UNLOCK protects spiffs from reentrancy on api level
-// These should be defined on a multithreaded system
-
-// define this to enter a mutex if you're running on a multithreaded system
-#ifndef SPIFFS_LOCK
-#define SPIFFS_LOCK(fs)
-#endif
-// define this to exit a mutex if you're running on a multithreaded system
-#ifndef SPIFFS_UNLOCK
-#define SPIFFS_UNLOCK(fs)
-#endif
-
-
-// Enable if only one spiffs instance with constant configuration will exist
-// on the target. This will reduce calculations, flash and memory accesses.
-// Parts of configuration must be defined below instead of at time of mount.
-#ifndef SPIFFS_SINGLETON
-#define SPIFFS_SINGLETON 0
-#endif
-
-#if SPIFFS_SINGLETON
-// Instead of giving parameters in config struct, singleton build must
-// give parameters in defines below.
-#ifndef SPIFFS_CFG_PHYS_SZ
-#define SPIFFS_CFG_PHYS_SZ(ignore) (1024*1024*2)
-#endif
-#ifndef SPIFFS_CFG_PHYS_ERASE_SZ
-#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (65536)
-#endif
-#ifndef SPIFFS_CFG_PHYS_ADDR
-#define SPIFFS_CFG_PHYS_ADDR(ignore) (0)
-#endif
-#ifndef SPIFFS_CFG_LOG_PAGE_SZ
-#define SPIFFS_CFG_LOG_PAGE_SZ(ignore) (256)
-#endif
-#ifndef SPIFFS_CFG_LOG_BLOCK_SZ
-#define SPIFFS_CFG_LOG_BLOCK_SZ(ignore) (65536)
-#endif
-#endif
-
-// Enable this if your target needs aligned data for index tables
-#ifndef SPIFFS_ALIGNED_OBJECT_INDEX_TABLES
-#define SPIFFS_ALIGNED_OBJECT_INDEX_TABLES 1
-#endif
-
-// Set SPIFFS_TEST_VISUALISATION to non-zero to enable SPIFFS_vis function
-// in the api. This function will visualize all filesystem using given printf
-// function.
-#ifndef SPIFFS_TEST_VISUALISATION
-#define SPIFFS_TEST_VISUALISATION 1
-#endif
-#if SPIFFS_TEST_VISUALISATION
-#ifndef spiffs_printf
-#define spiffs_printf(...) c_printf(__VA_ARGS__)
-#endif
-// spiffs_printf argument for a free page
-#ifndef SPIFFS_TEST_VIS_FREE_STR
-#define SPIFFS_TEST_VIS_FREE_STR "_"
-#endif
-// spiffs_printf argument for a deleted page
-#ifndef SPIFFS_TEST_VIS_DELE_STR
-#define SPIFFS_TEST_VIS_DELE_STR "/"
-#endif
-// spiffs_printf argument for an index page for given object id
-#ifndef SPIFFS_TEST_VIS_INDX_STR
-#define SPIFFS_TEST_VIS_INDX_STR(id) "i"
-#endif
-// spiffs_printf argument for a data page for given object id
-#ifndef SPIFFS_TEST_VIS_DATA_STR
-#define SPIFFS_TEST_VIS_DATA_STR(id) "d"
-#endif
-#endif
-
-// Types depending on configuration such as the amount of flash bytes
-// given to spiffs file system in total (spiffs_file_system_size),
-// the logical block size (log_block_size), and the logical page size
-// (log_page_size)
-
-// Block index type. Make sure the size of this type can hold
-// the highest number of all blocks - i.e. spiffs_file_system_size / log_block_size
-typedef u16_t spiffs_block_ix;
-// Page index type. Make sure the size of this type can hold
-// the highest page number of all pages - i.e. spiffs_file_system_size / log_page_size
-typedef u16_t spiffs_page_ix;
-// Object id type - most significant bit is reserved for index flag. Make sure the
-// size of this type can hold the highest object id on a full system,
-// i.e. 2 + (spiffs_file_system_size / (2*log_page_size))*2
-typedef u16_t spiffs_obj_id;
-// Object span index type. Make sure the size of this type can
-// hold the largest possible span index on the system -
-// i.e. (spiffs_file_system_size / log_page_size) - 1
-typedef u16_t spiffs_span_ix;
-
-#endif /* SPIFFS_CONFIG_H_ */
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_esp8266.c b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_esp8266.c
deleted file mode 100644
index e0a79d50..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_esp8266.c
+++ /dev/null
@@ -1,157 +0,0 @@
-#include "spiffs_esp8266.h"
-#include "spi_flash.h"
-#include "esp8266_peri.h"
-#include "Arduino.h"
-
-/*
- FLASH ACCESS FUNCTIONS
-*/
-
-//lowest level sector erase method
-bool flashmem_erase_sector( uint32_t sector_id ){
- WDT_RESET();
- noInterrupts();
- uint32_t chip_size = flashchip->chip_size;
- flashchip->chip_size = 0x01000000;
- bool erased = spi_flash_erase_sector( sector_id ) == SPI_FLASH_RESULT_OK;
- flashchip->chip_size = chip_size;
- interrupts();
- return erased;
-}
-
-//lowest level data write method
-uint32_t flashmem_write_internal( const void *from, uint32_t toaddr, uint32_t size ){
- toaddr -= INTERNAL_FLASH_START_ADDRESS;
- SpiFlashOpResult r;
- const uint32_t blkmask = INTERNAL_FLASH_WRITE_UNIT_SIZE - 1;
- uint32_t *apbuf = NULL;
- if(((uint32_t)from) & blkmask){
- apbuf = (uint32_t *)os_malloc(size);
- if(!apbuf)
- return 0;
- os_memcpy(apbuf, from, size);
- }
- WDT_RESET();
- noInterrupts();
- uint32_t chip_size = flashchip->chip_size;
- flashchip->chip_size = 0x01000000;
- r = spi_flash_write(toaddr, apbuf?(uint32 *)apbuf:(uint32 *)from, size);
- flashchip->chip_size = chip_size;
- interrupts();
- if(apbuf)
- os_free(apbuf);
- if(SPI_FLASH_RESULT_OK == r)
- return size;
- else{
- SPIFFS_API_DBG_E( "ERROR in flash_write: r=%d at %08X\n", ( int )r, ( unsigned )toaddr+INTERNAL_FLASH_START_ADDRESS );
- return 0;
- }
-}
-
-//lowest level data read method
-uint32_t flashmem_read_internal( void *to, uint32_t fromaddr, uint32_t size ){
- fromaddr -= INTERNAL_FLASH_START_ADDRESS;
- SpiFlashOpResult r;
- WDT_RESET();
- noInterrupts();
- uint32_t chip_size = flashchip->chip_size;
- flashchip->chip_size = 0x01000000;
- r = spi_flash_read(fromaddr, (uint32 *)to, size);
- flashchip->chip_size = chip_size;
- interrupts();
- if(SPI_FLASH_RESULT_OK == r)
- return size;
- else{
- SPIFFS_API_DBG_E( "ERROR in flash_read: r=%d at %08X\n", ( int )r, ( unsigned )fromaddr+INTERNAL_FLASH_START_ADDRESS );
- return 0;
- }
-}
-
-//mid level data write method
-uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size ){
- uint32_t temp, rest, ssize = size;
- unsigned i;
- char tmpdata[ INTERNAL_FLASH_WRITE_UNIT_SIZE ];
- const uint8_t *pfrom = ( const uint8_t* )from;
- const uint32_t blksize = INTERNAL_FLASH_WRITE_UNIT_SIZE;
- const uint32_t blkmask = INTERNAL_FLASH_WRITE_UNIT_SIZE - 1;
-
- // Align the start
- if(toaddr & blkmask){
- rest = toaddr & blkmask;
- temp = toaddr & ~blkmask; // this is the actual aligned address
- // c_memcpy( tmpdata, ( const void* )temp, blksize );
- flashmem_read_internal( tmpdata, temp, blksize );
- for( i = rest; size && ( i < blksize ); i ++, size --, pfrom ++ )
- tmpdata[ i ] = *pfrom;
- flashmem_write_internal( tmpdata, temp, blksize );
- if( size == 0 )
- return ssize;
- toaddr = temp + blksize;
- }
- // The start address is now a multiple of blksize
- // Compute how many bytes we can write as multiples of blksize
- rest = size & blkmask;
- temp = size & ~blkmask;
- // Program the blocks now
- if(temp){
- flashmem_write_internal( pfrom, toaddr, temp );
- toaddr += temp;
- pfrom += temp;
- }
- // And the final part of a block if needed
- if(rest){
- // c_memcpy( tmpdata, ( const void* )toaddr, blksize );
- flashmem_read_internal( tmpdata, toaddr, blksize );
- for( i = 0; size && ( i < rest ); i ++, size --, pfrom ++ )
- tmpdata[ i ] = *pfrom;
- flashmem_write_internal( tmpdata, toaddr, blksize );
- }
- return ssize;
-}
-
-//mid level data write method
-uint32_t flashmem_read( void *to, uint32_t fromaddr, uint32_t size ){
- uint32_t temp, rest, ssize = size;
- unsigned i;
- char tmpdata[ INTERNAL_FLASH_READ_UNIT_SIZE ];
- uint8_t *pto = ( uint8_t* )to;
- const uint32_t blksize = INTERNAL_FLASH_READ_UNIT_SIZE;
- const uint32_t blkmask = INTERNAL_FLASH_READ_UNIT_SIZE - 1;
-
- // Align the start
- if(fromaddr & blkmask){
- rest = fromaddr & blkmask;
- temp = fromaddr & ~blkmask; // this is the actual aligned address
- flashmem_read_internal( tmpdata, temp, blksize );
- for( i = rest; size && ( i < blksize ); i ++, size --, pto ++ )
- *pto = tmpdata[ i ];
-
- if( size == 0 )
- return ssize;
- fromaddr = temp + blksize;
- }
- // The start address is now a multiple of blksize
- // Compute how many bytes we can read as multiples of blksize
- rest = size & blkmask;
- temp = size & ~blkmask;
- // Program the blocks now
- if(temp){
- flashmem_read_internal( pto, fromaddr, temp );
- fromaddr += temp;
- pto += temp;
- }
- // And the final part of a block if needed
- if(rest){
- flashmem_read_internal( tmpdata, fromaddr, blksize );
- for( i = 0; size && ( i < rest ); i ++, size --, pto ++ )
- *pto = tmpdata[ i ];
- }
- return ssize;
-}
-
-//shorthand when start and end addresses of the sector are not needed
-uint32_t flashmem_get_sector_of_address( uint32_t addr ){
- return (addr - INTERNAL_FLASH_START_ADDRESS) / INTERNAL_FLASH_SECTOR_SIZE;;
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_esp8266.h b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_esp8266.h
deleted file mode 100644
index d97f3e3e..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_esp8266.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef SYSTEM_FLASHMEM_H_
-#define SYSTEM_FLASHMEM_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "spiffs.h"
-
-/*******************
-The W25Q32BV array is organized into 16,384 programmable pages of 256-bytes each. Up to 256 bytes can be programmed at a time.
-Pages can be erased in groups of 16 (4KB sector erase), groups of 128 (32KB block erase), groups of 256 (64KB block erase) or
-the entire chip (chip erase). The W25Q32BV has 1,024 erasable sectors and 64 erasable blocks respectively.
-The small 4KB sectors allow for greater flexibility in applications that require data and parameter storage.
-********************/
-
-#define SPIFFS_API_DBG_V(fmt, ...) //os_printf(fmt, ##__VA_ARGS__)
-#define SPIFFS_API_DBG_E(fmt, ...) //os_printf("ERROR: " fmt , ##__VA_ARGS__)
-
-#define INTERNAL_FLASH_PAGE_SIZE 256
-#define INTERNAL_FLASH_SECTOR_SIZE 4096
-#define INTERNAL_FLASH_START_ADDRESS 0x40200000
-
-#define INTERNAL_FLASH_WRITE_UNIT_SIZE 4
-#define INTERNAL_FLASH_READ_UNIT_SIZE 4
-
-extern uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size );
-extern uint32_t flashmem_read( void *to, uint32_t fromaddr, uint32_t size );
-extern bool flashmem_erase_sector( uint32_t sector_id );
-uint32_t flashmem_find_sector( uint32_t address, uint32_t *pstart, uint32_t *pend );
-uint32_t flashmem_get_sector_of_address( uint32_t addr );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SYSTEM_FLASHMEM_H_ */
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_gc.c b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_gc.c
deleted file mode 100644
index 87e4faf9..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_gc.c
+++ /dev/null
@@ -1,559 +0,0 @@
-#include "spiffs.h"
-#include "spiffs_nucleus.h"
-
-// Erases a logical block and updates the erase counter.
-// If cache is enabled, all pages that might be cached in this block
-// is dropped.
-static s32_t spiffs_gc_erase_block(
- spiffs *fs,
- spiffs_block_ix bix) {
- s32_t res;
-
- SPIFFS_GC_DBG("gc: erase block %d\n", bix);
- res = spiffs_erase_block(fs, bix);
- SPIFFS_CHECK_RES(res);
-
-#if SPIFFS_CACHE
- {
- u32_t i;
- for (i = 0; i < SPIFFS_PAGES_PER_BLOCK(fs); i++) {
- spiffs_cache_drop_page(fs, SPIFFS_PAGE_FOR_BLOCK(fs, bix) + i);
- }
- }
-#endif
- return res;
-}
-
-// Searches for blocks where all entries are deleted - if one is found,
-// the block is erased. Compared to the non-quick gc, the quick one ensures
-// that no updates are needed on existing objects on pages that are erased.
-s32_t spiffs_gc_quick(
- spiffs *fs) {
- s32_t res = SPIFFS_OK;
- u32_t blocks = fs->block_count;
- spiffs_block_ix cur_block = 0;
- u32_t cur_block_addr = 0;
- int cur_entry = 0;
- spiffs_obj_id *obj_lu_buf = (spiffs_obj_id *)fs->lu_work;
-
- SPIFFS_GC_DBG("gc_quick: running\n", cur_block);
-#if SPIFFS_GC_STATS
- fs->stats_gc_runs++;
-#endif
-
- int entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id));
-
- // find fully deleted blocks
- // check each block
- while (res == SPIFFS_OK && blocks--) {
- u16_t deleted_pages_in_block = 0;
-
- int obj_lookup_page = 0;
- // check each object lookup page
- while (res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- int entry_offset = obj_lookup_page * entries_per_page;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, cur_block_addr + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- // check each entry
- while (res == SPIFFS_OK &&
- cur_entry - entry_offset < entries_per_page &&
- cur_entry < (int)(SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs))) {
- spiffs_obj_id obj_id = obj_lu_buf[cur_entry-entry_offset];
- if (obj_id == SPIFFS_OBJ_ID_DELETED) {
- deleted_pages_in_block++;
- } else if (obj_id == SPIFFS_OBJ_ID_FREE) {
- // kill scan, go for next block
- obj_lookup_page = SPIFFS_OBJ_LOOKUP_PAGES(fs);
- res = 1; // kill object lu loop
- break;
- } else {
- // kill scan, go for next block
- obj_lookup_page = SPIFFS_OBJ_LOOKUP_PAGES(fs);
- res = 1; // kill object lu loop
- break;
- }
- cur_entry++;
- } // per entry
- obj_lookup_page++;
- } // per object lookup page
- if (res == 1) res = SPIFFS_OK;
-
- if (res == SPIFFS_OK && deleted_pages_in_block == SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- // found a fully deleted block
- fs->stats_p_deleted -= deleted_pages_in_block;
- res = spiffs_gc_erase_block(fs, cur_block);
- return res;
- }
-
- cur_entry = 0;
- cur_block++;
- cur_block_addr += SPIFFS_CFG_LOG_BLOCK_SZ(fs);
- } // per block
-
- return res;
-}
-
-// Checks if garbaga collecting is necessary. If so a candidate block is found,
-// cleansed and erased
-s32_t spiffs_gc_check(
- spiffs *fs,
- u32_t len) {
- s32_t res;
- s32_t free_pages =
- (SPIFFS_PAGES_PER_BLOCK(fs) - SPIFFS_OBJ_LOOKUP_PAGES(fs)) * (fs->block_count-2)
- - fs->stats_p_allocated - fs->stats_p_deleted;
- int tries = 0;
-
- if (fs->free_blocks > 3 &&
- (s32_t)len < free_pages * (s32_t)SPIFFS_DATA_PAGE_SIZE(fs)) {
- return SPIFFS_OK;
- }
-
- u32_t needed_pages = (len + SPIFFS_DATA_PAGE_SIZE(fs) - 1) / SPIFFS_DATA_PAGE_SIZE(fs);
-// if (fs->free_blocks <= 2 && (s32_t)needed_pages > free_pages) {
-// SPIFFS_GC_DBG("gc: full freeblk:%d needed:%d free:%d dele:%d\n", fs->free_blocks, needed_pages, free_pages, fs->stats_p_deleted);
-// return SPIFFS_ERR_FULL;
-// }
- if ((s32_t)needed_pages > (s32_t)(free_pages + fs->stats_p_deleted)) {
- SPIFFS_GC_DBG("gc_check: full freeblk:%d needed:%d free:%d dele:%d\n", fs->free_blocks, needed_pages, free_pages, fs->stats_p_deleted);
- return SPIFFS_ERR_FULL;
- }
-
- do {
- SPIFFS_GC_DBG("\ngc_check #%d: run gc free_blocks:%d pfree:%d pallo:%d pdele:%d [%d] len:%d of %d\n",
- tries,
- fs->free_blocks, free_pages, fs->stats_p_allocated, fs->stats_p_deleted, (free_pages+fs->stats_p_allocated+fs->stats_p_deleted),
- len, free_pages*SPIFFS_DATA_PAGE_SIZE(fs));
-
- spiffs_block_ix *cands;
- int count;
- spiffs_block_ix cand;
- s32_t prev_free_pages = free_pages;
- // if the fs is crammed, ignore block age when selecting candidate - kind of a bad state
- res = spiffs_gc_find_candidate(fs, &cands, &count, free_pages <= 0);
- SPIFFS_CHECK_RES(res);
- if (count == 0) {
- SPIFFS_GC_DBG("gc_check: no candidates, return\n");
- return (s32_t)needed_pages < free_pages ? SPIFFS_OK : SPIFFS_ERR_FULL;
- }
-#if SPIFFS_GC_STATS
- fs->stats_gc_runs++;
-#endif
- cand = cands[0];
- fs->cleaning = 1;
- //c_printf("gcing: cleaning block %d\n", cand);
- res = spiffs_gc_clean(fs, cand);
- fs->cleaning = 0;
- if (res < 0) {
- SPIFFS_GC_DBG("gc_check: cleaning block %d, result %d\n", cand, res);
- } else {
- SPIFFS_GC_DBG("gc_check: cleaning block %d, result %d\n", cand, res);
- }
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_gc_erase_page_stats(fs, cand);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_gc_erase_block(fs, cand);
- SPIFFS_CHECK_RES(res);
-
- free_pages =
- (SPIFFS_PAGES_PER_BLOCK(fs) - SPIFFS_OBJ_LOOKUP_PAGES(fs)) * (fs->block_count - 2)
- - fs->stats_p_allocated - fs->stats_p_deleted;
-
- if (prev_free_pages <= 0 && prev_free_pages == free_pages) {
- // abort early to reduce wear, at least tried once
- SPIFFS_GC_DBG("gc_check: early abort, no result on gc when fs crammed\n");
- break;
- }
-
- } while (++tries < SPIFFS_GC_MAX_RUNS && (fs->free_blocks <= 2 ||
- (s32_t)len > free_pages*(s32_t)SPIFFS_DATA_PAGE_SIZE(fs)));
-
- free_pages =
- (SPIFFS_PAGES_PER_BLOCK(fs) - SPIFFS_OBJ_LOOKUP_PAGES(fs)) * (fs->block_count - 2)
- - fs->stats_p_allocated - fs->stats_p_deleted;
- if ((s32_t)len > free_pages*(s32_t)SPIFFS_DATA_PAGE_SIZE(fs)) {
- res = SPIFFS_ERR_FULL;
- }
-
- SPIFFS_GC_DBG("gc_check: finished, %d dirty, blocks %d free, %d pages free, %d tries, res %d\n",
- fs->stats_p_allocated + fs->stats_p_deleted,
- fs->free_blocks, free_pages, tries, res);
-
- return res;
-}
-
-// Updates page statistics for a block that is about to be erased
-s32_t spiffs_gc_erase_page_stats(
- spiffs *fs,
- spiffs_block_ix bix) {
- s32_t res = SPIFFS_OK;
- int obj_lookup_page = 0;
- int entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id));
- spiffs_obj_id *obj_lu_buf = (spiffs_obj_id *)fs->lu_work;
- int cur_entry = 0;
- u32_t dele = 0;
- u32_t allo = 0;
-
- // check each object lookup page
- while (res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- int entry_offset = obj_lookup_page * entries_per_page;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, bix * SPIFFS_CFG_LOG_BLOCK_SZ(fs) + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- // check each entry
- while (res == SPIFFS_OK &&
- cur_entry - entry_offset < entries_per_page && cur_entry < (int)(SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs))) {
- spiffs_obj_id obj_id = obj_lu_buf[cur_entry-entry_offset];
- if (obj_id == SPIFFS_OBJ_ID_FREE) {
- } else if (obj_id == SPIFFS_OBJ_ID_DELETED) {
- dele++;
- } else {
- allo++;
- }
- cur_entry++;
- } // per entry
- obj_lookup_page++;
- } // per object lookup page
- SPIFFS_GC_DBG("gc_check: wipe pallo:%d pdele:%d\n", allo, dele);
- fs->stats_p_allocated -= allo;
- fs->stats_p_deleted -= dele;
- return res;
-}
-
-// Finds block candidates to erase
-s32_t spiffs_gc_find_candidate(
- spiffs *fs,
- spiffs_block_ix **block_candidates,
- int *candidate_count,
- char fs_crammed) {
- s32_t res = SPIFFS_OK;
- u32_t blocks = fs->block_count;
- spiffs_block_ix cur_block = 0;
- u32_t cur_block_addr = 0;
- spiffs_obj_id *obj_lu_buf = (spiffs_obj_id *)fs->lu_work;
- int cur_entry = 0;
-
- // using fs->work area as sorted candidate memory, (spiffs_block_ix)cand_bix/(s32_t)score
- int max_candidates = MIN(fs->block_count, (SPIFFS_CFG_LOG_PAGE_SZ(fs)-8)/(sizeof(spiffs_block_ix) + sizeof(s32_t)));
- *candidate_count = 0;
- c_memset(fs->work, 0xff, SPIFFS_CFG_LOG_PAGE_SZ(fs));
-
- // divide up work area into block indices and scores
- // todo alignment?
- spiffs_block_ix *cand_blocks = (spiffs_block_ix *)fs->work;
- s32_t *cand_scores = (s32_t *)(fs->work + max_candidates * sizeof(spiffs_block_ix));
-
- *block_candidates = cand_blocks;
-
- int entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id));
-
- // check each block
- while (res == SPIFFS_OK && blocks--) {
- u16_t deleted_pages_in_block = 0;
- u16_t used_pages_in_block = 0;
-
- int obj_lookup_page = 0;
- // check each object lookup page
- while (res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- int entry_offset = obj_lookup_page * entries_per_page;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, cur_block_addr + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- // check each entry
- while (res == SPIFFS_OK &&
- cur_entry - entry_offset < entries_per_page &&
- cur_entry < (int)(SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs))) {
- spiffs_obj_id obj_id = obj_lu_buf[cur_entry-entry_offset];
- if (obj_id == SPIFFS_OBJ_ID_FREE) {
- // when a free entry is encountered, scan logic ensures that all following entries are free also
- res = 1; // kill object lu loop
- break;
- } else if (obj_id == SPIFFS_OBJ_ID_DELETED) {
- deleted_pages_in_block++;
- } else {
- used_pages_in_block++;
- }
- cur_entry++;
- } // per entry
- obj_lookup_page++;
- } // per object lookup page
- if (res == 1) res = SPIFFS_OK;
-
- // calculate score and insert into candidate table
- // stoneage sort, but probably not so many blocks
- if (res == SPIFFS_OK && deleted_pages_in_block > 0) {
- // read erase count
- spiffs_obj_id erase_count;
- res = _spiffs_rd(fs, SPIFFS_OP_C_READ | SPIFFS_OP_T_OBJ_LU2, 0,
- SPIFFS_ERASE_COUNT_PADDR(fs, cur_block),
- sizeof(spiffs_obj_id), (u8_t *)&erase_count);
- SPIFFS_CHECK_RES(res);
-
- spiffs_obj_id erase_age;
- if (fs->max_erase_count > erase_count) {
- erase_age = fs->max_erase_count - erase_count;
- } else {
- erase_age = SPIFFS_OBJ_ID_FREE - (erase_count - fs->max_erase_count);
- }
-
- s32_t score =
- deleted_pages_in_block * SPIFFS_GC_HEUR_W_DELET +
- used_pages_in_block * SPIFFS_GC_HEUR_W_USED +
- erase_age * (fs_crammed ? 0 : SPIFFS_GC_HEUR_W_ERASE_AGE);
- int cand_ix = 0;
- SPIFFS_GC_DBG("gc_check: bix:%d del:%d use:%d score:%d\n", cur_block, deleted_pages_in_block, used_pages_in_block, score);
- while (cand_ix < max_candidates) {
- if (cand_blocks[cand_ix] == (spiffs_block_ix)-1) {
- cand_blocks[cand_ix] = cur_block;
- cand_scores[cand_ix] = score;
- break;
- } else if (cand_scores[cand_ix] < score) {
- int reorder_cand_ix = max_candidates - 2;
- while (reorder_cand_ix >= cand_ix) {
- cand_blocks[reorder_cand_ix + 1] = cand_blocks[reorder_cand_ix];
- cand_scores[reorder_cand_ix + 1] = cand_scores[reorder_cand_ix];
- reorder_cand_ix--;
- }
- cand_blocks[cand_ix] = cur_block;
- cand_scores[cand_ix] = score;
- break;
- }
- cand_ix++;
- }
- (*candidate_count)++;
- }
-
- cur_entry = 0;
- cur_block++;
- cur_block_addr += SPIFFS_CFG_LOG_BLOCK_SZ(fs);
- } // per block
-
- return res;
-}
-
-typedef enum {
- FIND_OBJ_DATA,
- MOVE_OBJ_DATA,
- MOVE_OBJ_IX,
- FINISHED
-} spiffs_gc_clean_state;
-
-typedef struct {
- spiffs_gc_clean_state state;
- spiffs_obj_id cur_obj_id;
- spiffs_span_ix cur_objix_spix;
- spiffs_page_ix cur_objix_pix;
- int stored_scan_entry_index;
- u8_t obj_id_found;
-} spiffs_gc;
-
-// Empties given block by moving all data into free pages of another block
-// Strategy:
-// loop:
-// scan object lookup for object data pages
-// for first found id, check spix and load corresponding object index page to memory
-// push object scan lookup entry index
-// rescan object lookup, find data pages with same id and referenced by same object index
-// move data page, update object index in memory
-// when reached end of lookup, store updated object index
-// pop object scan lookup entry index
-// repeat loop until end of object lookup
-// scan object lookup again for remaining object index pages, move to new page in other block
-//
-s32_t spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) {
- s32_t res = SPIFFS_OK;
- int entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id));
- int cur_entry = 0;
- spiffs_obj_id *obj_lu_buf = (spiffs_obj_id *)fs->lu_work;
- spiffs_gc gc;
- spiffs_page_ix cur_pix = 0;
- spiffs_page_object_ix_header *objix_hdr = (spiffs_page_object_ix_header *)fs->work;
- spiffs_page_object_ix *objix = (spiffs_page_object_ix *)fs->work;
-
- SPIFFS_GC_DBG("gc_clean: cleaning block %d\n", bix);
-
- c_memset(&gc, 0, sizeof(spiffs_gc));
- gc.state = FIND_OBJ_DATA;
-
- if (fs->free_cursor_block_ix == bix) {
- // move free cursor to next block, cannot use free pages from the block we want to clean
- fs->free_cursor_block_ix = (bix+1)%fs->block_count;
- fs->free_cursor_obj_lu_entry = 0;
- SPIFFS_GC_DBG("gc_clean: move free cursor to block %d\n", fs->free_cursor_block_ix);
- }
-
- while (res == SPIFFS_OK && gc.state != FINISHED) {
- SPIFFS_GC_DBG("gc_clean: state = %d entry:%d\n", gc.state, cur_entry);
- gc.obj_id_found = 0;
-
- // scan through lookup pages
- int obj_lookup_page = cur_entry / entries_per_page;
- u8_t scan = 1;
- // check each object lookup page
- while (scan && res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- int entry_offset = obj_lookup_page * entries_per_page;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, bix * SPIFFS_CFG_LOG_BLOCK_SZ(fs) + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page),
- SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- // check each entry
- while (scan && res == SPIFFS_OK &&
- cur_entry - entry_offset < entries_per_page && cur_entry < (int)(SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs))) {
- spiffs_obj_id obj_id = obj_lu_buf[cur_entry-entry_offset];
- cur_pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, cur_entry);
-
- // act upon object id depending on gc state
- switch (gc.state) {
- case FIND_OBJ_DATA:
- if (obj_id != SPIFFS_OBJ_ID_DELETED && obj_id != SPIFFS_OBJ_ID_FREE &&
- ((obj_id & SPIFFS_OBJ_ID_IX_FLAG) == 0)) {
- SPIFFS_GC_DBG("gc_clean: FIND_DATA state:%d - found obj id %04x\n", gc.state, obj_id);
- gc.obj_id_found = 1;
- gc.cur_obj_id = obj_id;
- scan = 0;
- }
- break;
- case MOVE_OBJ_DATA:
- if (obj_id == gc.cur_obj_id) {
- spiffs_page_header p_hdr;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA found data page %04x:%04x @ %04x\n", gc.cur_obj_id, p_hdr.span_ix, cur_pix);
- if (SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, p_hdr.span_ix) != gc.cur_objix_spix) {
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA no objix spix match, take in another run\n");
- } else {
- spiffs_page_ix new_data_pix;
- if (p_hdr.flags & SPIFFS_PH_FLAG_DELET) {
- // move page
- res = spiffs_page_move(fs, 0, 0, obj_id, &p_hdr, cur_pix, &new_data_pix);
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA move objix %04x:%04x page %04x to %04x\n", gc.cur_obj_id, p_hdr.span_ix, cur_pix, new_data_pix);
- SPIFFS_CHECK_RES(res);
- // move wipes obj_lu, reload it
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, bix * SPIFFS_CFG_LOG_BLOCK_SZ(fs) + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page),
- SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- SPIFFS_CHECK_RES(res);
- } else {
- // page is deleted but not deleted in lookup, scrap it
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA wipe objix %04x:%04x page %04x\n", obj_id, p_hdr.span_ix, cur_pix);
- res = spiffs_page_delete(fs, cur_pix);
- SPIFFS_CHECK_RES(res);
- new_data_pix = SPIFFS_OBJ_ID_FREE;
- }
- // update memory representation of object index page with new data page
- if (gc.cur_objix_spix == 0) {
- // update object index header page
- ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[p_hdr.span_ix] = new_data_pix;
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA wrote page %04x to objix_hdr entry %02x in mem\n", new_data_pix, SPIFFS_OBJ_IX_ENTRY(fs, p_hdr.span_ix));
- } else {
- // update object index page
- ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, p_hdr.span_ix)] = new_data_pix;
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA wrote page %04x to objix entry %02x in mem\n", new_data_pix, SPIFFS_OBJ_IX_ENTRY(fs, p_hdr.span_ix));
- }
- }
- }
- break;
- case MOVE_OBJ_IX:
- if (obj_id != SPIFFS_OBJ_ID_DELETED && obj_id != SPIFFS_OBJ_ID_FREE &&
- (obj_id & SPIFFS_OBJ_ID_IX_FLAG)) {
- // found an index object id
- spiffs_page_header p_hdr;
- spiffs_page_ix new_pix;
- // load header
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
- if (p_hdr.flags & SPIFFS_PH_FLAG_DELET) {
- // move page
- res = spiffs_page_move(fs, 0, 0, obj_id, &p_hdr, cur_pix, &new_pix);
- SPIFFS_GC_DBG("gc_clean: MOVE_OBJIX move objix %04x:%04x page %04x to %04x\n", obj_id, p_hdr.span_ix, cur_pix, new_pix);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, 0, SPIFFS_EV_IX_UPD, obj_id, p_hdr.span_ix, new_pix, 0);
- // move wipes obj_lu, reload it
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, bix * SPIFFS_CFG_LOG_BLOCK_SZ(fs) + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page),
- SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- SPIFFS_CHECK_RES(res);
- } else {
- // page is deleted but not deleted in lookup, scrap it
- SPIFFS_GC_DBG("gc_clean: MOVE_OBJIX wipe objix %04x:%04x page %04x\n", obj_id, p_hdr.span_ix, cur_pix);
- res = spiffs_page_delete(fs, cur_pix);
- if (res == SPIFFS_OK) {
- spiffs_cb_object_event(fs, 0, SPIFFS_EV_IX_DEL, obj_id, p_hdr.span_ix, cur_pix, 0);
- }
- }
- SPIFFS_CHECK_RES(res);
- }
- break;
- default:
- scan = 0;
- break;
- }
- cur_entry++;
- } // per entry
- obj_lookup_page++;
- } // per object lookup page
-
- if (res != SPIFFS_OK) break;
-
- // state finalization and switch
- switch (gc.state) {
- case FIND_OBJ_DATA:
- if (gc.obj_id_found) {
- // find out corresponding obj ix page and load it to memory
- spiffs_page_header p_hdr;
- spiffs_page_ix objix_pix;
- gc.stored_scan_entry_index = cur_entry;
- cur_entry = 0;
- gc.state = MOVE_OBJ_DATA;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, cur_pix), sizeof(spiffs_page_header), (u8_t*)&p_hdr);
- SPIFFS_CHECK_RES(res);
- gc.cur_objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, p_hdr.span_ix);
- SPIFFS_GC_DBG("gc_clean: FIND_DATA find objix span_ix:%04x\n", gc.cur_objix_spix);
- res = spiffs_obj_lu_find_id_and_span(fs, gc.cur_obj_id | SPIFFS_OBJ_ID_IX_FLAG, gc.cur_objix_spix, 0, &objix_pix);
- SPIFFS_CHECK_RES(res);
- SPIFFS_GC_DBG("gc_clean: FIND_DATA found object index at page %04x\n", objix_pix);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix->p_hdr, gc.cur_obj_id | SPIFFS_OBJ_ID_IX_FLAG, gc.cur_objix_spix);
- gc.cur_objix_pix = objix_pix;
- } else {
- gc.state = MOVE_OBJ_IX;
- cur_entry = 0; // restart entry scan index
- }
- break;
- case MOVE_OBJ_DATA: {
- // store modified objix (hdr) page
- spiffs_page_ix new_objix_pix;
- gc.state = FIND_OBJ_DATA;
- cur_entry = gc.stored_scan_entry_index;
- if (gc.cur_objix_spix == 0) {
- // store object index header page
- res = spiffs_object_update_index_hdr(fs, 0, gc.cur_obj_id | SPIFFS_OBJ_ID_IX_FLAG, gc.cur_objix_pix, fs->work, 0, 0, &new_objix_pix);
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA store modified objix_hdr page, %04x:%04x\n", new_objix_pix, 0);
- SPIFFS_CHECK_RES(res);
- } else {
- // store object index page
- res = spiffs_page_move(fs, 0, fs->work, gc.cur_obj_id | SPIFFS_OBJ_ID_IX_FLAG, 0, gc.cur_objix_pix, &new_objix_pix);
- SPIFFS_GC_DBG("gc_clean: MOVE_DATA store modified objix page, %04x:%04x\n", new_objix_pix, objix->p_hdr.span_ix);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, 0, SPIFFS_EV_IX_UPD, gc.cur_obj_id, objix->p_hdr.span_ix, new_objix_pix, 0);
- }
- }
- break;
- case MOVE_OBJ_IX:
- gc.state = FINISHED;
- break;
- default:
- cur_entry = 0;
- break;
- }
- SPIFFS_GC_DBG("gc_clean: state-> %d\n", gc.state);
- } // while state != FINISHED
-
-
- return res;
-}
-
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c
deleted file mode 100644
index 6601b61a..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c
+++ /dev/null
@@ -1,973 +0,0 @@
-/*
- * spiffs_hydrogen.c
- *
- * Created on: Jun 16, 2013
- * Author: petera
- */
-
-#include "spiffs.h"
-#include "spiffs_nucleus.h"
-
-static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh);
-
-#if SPIFFS_BUFFER_HELP
-u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) {
- return num_descs * sizeof(spiffs_fd);
-}
-#if SPIFFS_CACHE
-u32_t SPIFFS_buffer_bytes_for_cache(spiffs *fs, u32_t num_pages) {
- return sizeof(spiffs_cache) + num_pages * (sizeof(spiffs_cache_page) + SPIFFS_CFG_LOG_PAGE_SZ(fs));
-}
-#endif
-#endif
-
-u8_t SPIFFS_mounted(spiffs *fs) {
- return SPIFFS_CHECK_MOUNT(fs);
-}
-
-s32_t SPIFFS_format(spiffs *fs) {
- SPIFFS_API_CHECK_CFG(fs);
- if (SPIFFS_CHECK_MOUNT(fs)) {
- fs->err_code = SPIFFS_ERR_MOUNTED;
- return -1;
- }
-
- s32_t res;
- SPIFFS_LOCK(fs);
-
- spiffs_block_ix bix = 0;
- while (bix < fs->block_count) {
- fs->max_erase_count = 0;
- res = spiffs_erase_block(fs, bix);
- if (res != SPIFFS_OK) {
- res = SPIFFS_ERR_ERASE_FAIL;
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- bix++;
- }
-
- SPIFFS_UNLOCK(fs);
-
- return 0;
-}
-
-s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
- u8_t *fd_space, u32_t fd_space_size,
- void *cache, u32_t cache_size,
- spiffs_check_callback check_cb_f) {
- SPIFFS_LOCK(fs);
- c_memset(fs, 0, sizeof(spiffs));
- c_memcpy(&fs->cfg, config, sizeof(spiffs_config));
- fs->block_count = SPIFFS_CFG_PHYS_SZ(fs) / SPIFFS_CFG_LOG_BLOCK_SZ(fs);
- fs->work = &work[0];
- fs->lu_work = &work[SPIFFS_CFG_LOG_PAGE_SZ(fs)];
- c_memset(fd_space, 0, fd_space_size);
- // align fd_space pointer to pointer size byte boundary, below is safe
- u8_t ptr_size = sizeof(void*);
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
- u8_t addr_lsb = ((u8_t)fd_space) & (ptr_size-1);
-#pragma GCC diagnostic pop
- if (addr_lsb) {
- fd_space += (ptr_size-addr_lsb);
- fd_space_size -= (ptr_size-addr_lsb);
- }
- fs->fd_space = fd_space;
- fs->fd_count = (fd_space_size/sizeof(spiffs_fd));
-
- // align cache pointer to 4 byte boundary, below is safe
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
- addr_lsb = ((u8_t)cache) & (ptr_size-1);
-#pragma GCC diagnostic pop
- if (addr_lsb) {
- u8_t *cache_8 = (u8_t *)cache;
- cache_8 += (ptr_size-addr_lsb);
- cache = cache_8;
- cache_size -= (ptr_size-addr_lsb);
- }
- if (cache_size & (ptr_size-1)) {
- cache_size -= (cache_size & (ptr_size-1));
- }
-#if SPIFFS_CACHE
- fs->cache = cache;
- fs->cache_size = cache_size;
- spiffs_cache_init(fs);
-#endif
-
- s32_t res;
-
-#if SPIFFS_USE_MAGIC
- res = SPIFFS_CHECK_MAGIC_POSSIBLE(fs) ? SPIFFS_OK : SPIFFS_ERR_MAGIC_NOT_POSSIBLE;
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-#endif
-
- fs->config_magic = SPIFFS_CONFIG_MAGIC;
-
- res = spiffs_obj_lu_scan(fs);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- SPIFFS_DBG("page index byte len: %d\n", SPIFFS_CFG_LOG_PAGE_SZ(fs));
- SPIFFS_DBG("object lookup pages: %d\n", SPIFFS_OBJ_LOOKUP_PAGES(fs));
- SPIFFS_DBG("page pages per block: %d\n", SPIFFS_PAGES_PER_BLOCK(fs));
- SPIFFS_DBG("page header length: %d\n", sizeof(spiffs_page_header));
- SPIFFS_DBG("object header index entries: %d\n", SPIFFS_OBJ_HDR_IX_LEN(fs));
- SPIFFS_DBG("object index entries: %d\n", SPIFFS_OBJ_IX_LEN(fs));
- SPIFFS_DBG("available file descriptors: %d\n", fs->fd_count);
- SPIFFS_DBG("free blocks: %d\n", fs->free_blocks);
-
- fs->check_cb_f = check_cb_f;
-
- fs->mounted = 1;
-
- SPIFFS_UNLOCK(fs);
-
- return 0;
-}
-
-void SPIFFS_unmount(spiffs *fs) {
- if (!SPIFFS_CHECK_CFG(fs) || !SPIFFS_CHECK_MOUNT(fs)) return;
- SPIFFS_LOCK(fs);
- u32_t i;
- spiffs_fd *fds = (spiffs_fd *)fs->fd_space;
- for (i = 0; i < fs->fd_count; i++) {
- spiffs_fd *cur_fd = &fds[i];
- if (cur_fd->file_nbr != 0) {
-#if SPIFFS_CACHE
- (void)spiffs_fflush_cache(fs, cur_fd->file_nbr);
-#endif
- spiffs_fd_return(fs, cur_fd->file_nbr);
- }
- }
- fs->mounted = 0;
-
- SPIFFS_UNLOCK(fs);
-}
-
-s32_t SPIFFS_errno(spiffs *fs) {
- return fs->err_code;
-}
-
-void SPIFFS_clearerr(spiffs *fs) {
- fs->err_code = SPIFFS_OK;
-}
-
-s32_t SPIFFS_creat(spiffs *fs, char *path, spiffs_mode mode) {
- (void)mode;
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
- spiffs_obj_id obj_id;
- s32_t res;
-
- res = spiffs_obj_lu_find_free_obj_id(fs, &obj_id, (u8_t *)path);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- res = spiffs_object_create(fs, obj_id, (u8_t *)path, SPIFFS_TYPE_FILE, 0);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- SPIFFS_UNLOCK(fs);
- return 0;
-}
-
-spiffs_file SPIFFS_open(spiffs *fs, char *path, spiffs_flags flags, spiffs_mode mode) {
- (void)mode;
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- spiffs_page_ix pix;
-
- s32_t res = spiffs_fd_find_new(fs, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_find_object_index_header_by_name(fs, (u8_t*)path, &pix);
- if ((flags & SPIFFS_CREAT) == 0) {
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
-
- if ((flags & SPIFFS_CREAT) && res == SPIFFS_ERR_NOT_FOUND) {
- spiffs_obj_id obj_id;
- // no need to enter conflicting name here, already looked for it above
- res = spiffs_obj_lu_find_free_obj_id(fs, &obj_id, 0);
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- res = spiffs_object_create(fs, obj_id, (u8_t*)path, SPIFFS_TYPE_FILE, &pix);
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- flags &= ~SPIFFS_TRUNC;
- } else {
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
- res = spiffs_object_open_by_page(fs, pix, fd, flags, mode);
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- if (flags & SPIFFS_TRUNC) {
- res = spiffs_object_truncate(fd, 0, 0);
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
-
- fd->fdoffset = 0;
-
- SPIFFS_UNLOCK(fs);
-
- return fd->file_nbr;
-}
-
-spiffs_file SPIFFS_open_by_dirent(spiffs *fs, struct spiffs_dirent *e, spiffs_flags flags, spiffs_mode mode) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
-
- s32_t res = spiffs_fd_find_new(fs, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_open_by_page(fs, e->pix, fd, flags, mode);
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- if (flags & SPIFFS_TRUNC) {
- res = spiffs_object_truncate(fd, 0, 0);
- if (res < SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
-
- fd->fdoffset = 0;
-
- SPIFFS_UNLOCK(fs);
-
- return fd->file_nbr;
-}
-
-s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
-
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- if ((fd->flags & SPIFFS_RDONLY) == 0) {
- res = SPIFFS_ERR_NOT_READABLE;
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
-
-#if SPIFFS_CACHE_WR
- spiffs_fflush_cache(fs, fh);
-#endif
-
- if (fd->fdoffset + len >= fd->size) {
- // reading beyond file size
- s32_t avail = fd->size - fd->fdoffset;
- if (avail <= 0) {
- SPIFFS_API_CHECK_RES_UNLOCK(fs, SPIFFS_ERR_END_OF_OBJECT);
- }
- res = spiffs_object_read(fd, fd->fdoffset, avail, (u8_t*)buf);
- if (res == SPIFFS_ERR_END_OF_OBJECT) {
- fd->fdoffset += avail;
- SPIFFS_UNLOCK(fs);
- return avail;
- } else {
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- len = avail;
- }
- } else {
- // reading within file size
- res = spiffs_object_read(fd, fd->fdoffset, len, (u8_t*)buf);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
- fd->fdoffset += len;
-
- SPIFFS_UNLOCK(fs);
-
- return len;
-}
-
-static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offset, s32_t len) {
- (void)fs;
- s32_t res = SPIFFS_OK;
- s32_t remaining = len;
- if (fd->size != SPIFFS_UNDEFINED_LEN && offset < fd->size) {
- s32_t m_len = MIN((s32_t)(fd->size - offset), len);
- res = spiffs_object_modify(fd, offset, (u8_t *)buf, m_len);
- SPIFFS_CHECK_RES(res);
- remaining -= m_len;
- u8_t *buf_8 = (u8_t *)buf;
- buf_8 += m_len;
- buf = buf_8;
- offset += m_len;
- }
- if (remaining > 0) {
- res = spiffs_object_append(fd, offset, (u8_t *)buf, remaining);
- SPIFFS_CHECK_RES(res);
- }
- return len;
-
-}
-
-s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, s32_t len) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
- u32_t offset;
-
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- if ((fd->flags & SPIFFS_WRONLY) == 0) {
- res = SPIFFS_ERR_NOT_WRITABLE;
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
-
- offset = fd->fdoffset;
-
-#if SPIFFS_CACHE_WR
- if (fd->cache_page == 0) {
- // see if object id is associated with cache already
- fd->cache_page = spiffs_cache_page_get_by_fd(fs, fd);
- }
-#endif
- if (fd->flags & SPIFFS_APPEND) {
- if (fd->size == SPIFFS_UNDEFINED_LEN) {
- offset = 0;
- } else {
- offset = fd->size;
- }
-#if SPIFFS_CACHE_WR
- if (fd->cache_page) {
- offset = MAX(offset, fd->cache_page->offset + fd->cache_page->size);
- }
-#endif
- }
-
-#if SPIFFS_CACHE_WR
- if ((fd->flags & SPIFFS_DIRECT) == 0) {
- if (len < (s32_t)SPIFFS_CFG_LOG_PAGE_SZ(fs)) {
- // small write, try to cache it
- u8_t alloc_cpage = 1;
- if (fd->cache_page) {
- // have a cached page for this fd already, check cache page boundaries
- if (offset < fd->cache_page->offset || // writing before cache
- offset > fd->cache_page->offset + fd->cache_page->size || // writing after cache
- offset + len > fd->cache_page->offset + SPIFFS_CFG_LOG_PAGE_SZ(fs)) // writing beyond cache page
- {
- // boundary violation, write back cache first and allocate new
- SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %d for fd %d:%04x, boundary viol, offs:%d size:%d\n",
- fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
- res = spiffs_hydro_write(fs, fd,
- spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
- fd->cache_page->offset, fd->cache_page->size);
- spiffs_cache_fd_release(fs, fd->cache_page);
- SPIFFS_API_CHECK_RES(fs, res);
- } else {
- // writing within cache
- alloc_cpage = 0;
- }
- }
-
- if (alloc_cpage) {
- fd->cache_page = spiffs_cache_page_allocate_by_fd(fs, fd);
- if (fd->cache_page) {
- fd->cache_page->offset = offset;
- fd->cache_page->size = 0;
- SPIFFS_CACHE_DBG("CACHE_WR_ALLO: allocating cache page %d for fd %d:%04x\n",
- fd->cache_page->ix, fd->file_nbr, fd->obj_id);
- }
- }
-
- if (fd->cache_page) {
- u32_t offset_in_cpage = offset - fd->cache_page->offset;
- SPIFFS_CACHE_DBG("CACHE_WR_WRITE: storing to cache page %d for fd %d:%04x, offs %d:%d len %d\n",
- fd->cache_page->ix, fd->file_nbr, fd->obj_id,
- offset, offset_in_cpage, len);
- spiffs_cache *cache = spiffs_get_cache(fs);
- u8_t *cpage_data = spiffs_get_cache_page(fs, cache, fd->cache_page->ix);
- c_memcpy(&cpage_data[offset_in_cpage], buf, len);
- fd->cache_page->size = MAX(fd->cache_page->size, offset_in_cpage + len);
- fd->fdoffset += len;
- SPIFFS_UNLOCK(fs);
- return len;
- } else {
- res = spiffs_hydro_write(fs, fd, buf, offset, len);
- SPIFFS_API_CHECK_RES(fs, res);
- fd->fdoffset += len;
- SPIFFS_UNLOCK(fs);
- return res;
- }
- } else {
- // big write, no need to cache it - but first check if there is a cached write already
- if (fd->cache_page) {
- // write back cache first
- SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %d for fd %d:%04x, big write, offs:%d size:%d\n",
- fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
- res = spiffs_hydro_write(fs, fd,
- spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
- fd->cache_page->offset, fd->cache_page->size);
- spiffs_cache_fd_release(fs, fd->cache_page);
- SPIFFS_API_CHECK_RES(fs, res);
- res = spiffs_hydro_write(fs, fd, buf, offset, len);
- SPIFFS_API_CHECK_RES(fs, res);
- }
- }
- }
-#endif
-
- res = spiffs_hydro_write(fs, fd, buf, offset, len);
- SPIFFS_API_CHECK_RES(fs, res);
- fd->fdoffset += len;
-
- SPIFFS_UNLOCK(fs);
-
- return res;
-}
-
-s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES(fs, res);
-
-#if SPIFFS_CACHE_WR
- spiffs_fflush_cache(fs, fh);
-#endif
-
- switch (whence) {
- case SPIFFS_SEEK_CUR:
- offs = fd->fdoffset+offs;
- break;
- case SPIFFS_SEEK_END:
- offs = (fd->size == SPIFFS_UNDEFINED_LEN ? 0 : fd->size) + offs;
- break;
- }
-
- if (offs > (s32_t)fd->size) {
- res = SPIFFS_ERR_END_OF_OBJECT;
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- spiffs_span_ix data_spix = offs / SPIFFS_DATA_PAGE_SIZE(fs);
- spiffs_span_ix objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
- if (fd->cursor_objix_spix != objix_spix) {
- spiffs_page_ix pix;
- res = spiffs_obj_lu_find_id_and_span(
- fs, fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG, objix_spix, 0, &pix);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- fd->cursor_objix_spix = objix_spix;
- fd->cursor_objix_pix = pix;
- }
- fd->fdoffset = offs;
-
- SPIFFS_UNLOCK(fs);
-
- return 0;
-}
-
-s32_t SPIFFS_remove(spiffs *fs, char *path) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- spiffs_page_ix pix;
- s32_t res;
-
- res = spiffs_fd_find_new(fs, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_find_object_index_header_by_name(fs, (u8_t *)path, &pix);
- if (res != SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_open_by_page(fs, pix, fd, 0,0);
- if (res != SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_truncate(fd, 0, 1);
- if (res != SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- SPIFFS_UNLOCK(fs);
- return 0;
-}
-
-s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- if ((fd->flags & SPIFFS_WRONLY) == 0) {
- res = SPIFFS_ERR_NOT_WRITABLE;
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
- }
-
-#if SPIFFS_CACHE_WR
- spiffs_cache_fd_release(fs, fd->cache_page);
-#endif
-
- res = spiffs_object_truncate(fd, 0, 1);
-
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- SPIFFS_UNLOCK(fs);
-
- return 0;
-}
-
-static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spiffs_stat *s) {
- spiffs_page_object_ix_header objix_hdr;
- spiffs_obj_id obj_id;
- s32_t res =_spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ, fh,
- SPIFFS_PAGE_TO_PADDR(fs, pix), sizeof(spiffs_page_object_ix_header), (u8_t *)&objix_hdr);
- SPIFFS_API_CHECK_RES(fs, res);
-
- u32_t obj_id_addr = SPIFFS_BLOCK_TO_PADDR(fs, SPIFFS_BLOCK_FOR_PAGE(fs , pix)) +
- SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, pix) * sizeof(spiffs_obj_id);
- res =_spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ, fh,
- obj_id_addr, sizeof(spiffs_obj_id), (u8_t *)&obj_id);
- SPIFFS_API_CHECK_RES(fs, res);
-
- s->obj_id = obj_id;
- s->type = objix_hdr.type;
- s->size = objix_hdr.size == SPIFFS_UNDEFINED_LEN ? 0 : objix_hdr.size;
- strncpy((char *)s->name, (char *)objix_hdr.name, SPIFFS_OBJ_NAME_LEN);
-
- return res;
-}
-
-s32_t SPIFFS_stat(spiffs *fs, char *path, spiffs_stat *s) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- s32_t res;
- spiffs_page_ix pix;
-
- res = spiffs_object_find_object_index_header_by_name(fs, (u8_t*)path, &pix);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_stat_pix(fs, pix, 0, s);
-
- SPIFFS_UNLOCK(fs);
-
- return res;
-}
-
-s32_t SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
-
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
-#if SPIFFS_CACHE_WR
- spiffs_fflush_cache(fs, fh);
-#endif
-
- res = spiffs_stat_pix(fs, fd->objix_hdr_pix, fh, s);
-
- SPIFFS_UNLOCK(fs);
-
- return res;
-}
-
-// Checks if there are any cached writes for the object id associated with
-// given filehandle. If so, these writes are flushed.
-static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh) {
- s32_t res = SPIFFS_OK;
-#if SPIFFS_CACHE_WR
-
- spiffs_fd *fd;
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES(fs, res);
-
- if ((fd->flags & SPIFFS_DIRECT) == 0) {
- if (fd->cache_page == 0) {
- // see if object id is associated with cache already
- fd->cache_page = spiffs_cache_page_get_by_fd(fs, fd);
- }
- if (fd->cache_page) {
- SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %d for fd %d:%04x, flush, offs:%d size:%d\n",
- fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
- res = spiffs_hydro_write(fs, fd,
- spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
- fd->cache_page->offset, fd->cache_page->size);
- if (res < SPIFFS_OK) {
- fs->err_code = res;
- }
- spiffs_cache_fd_release(fs, fd->cache_page);
- }
- }
-#endif
-
- return res;
-}
-
-s32_t SPIFFS_fflush(spiffs *fs, spiffs_file fh) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- s32_t res = SPIFFS_OK;
-#if SPIFFS_CACHE_WR
- SPIFFS_LOCK(fs);
- res = spiffs_fflush_cache(fs, fh);
- SPIFFS_API_CHECK_RES_UNLOCK(fs,res);
- SPIFFS_UNLOCK(fs);
-#endif
-
- return res;
-}
-
-void SPIFFS_close(spiffs *fs, spiffs_file fh) {
- if (!SPIFFS_CHECK_CFG((fs))) {
- (fs)->err_code = SPIFFS_ERR_NOT_CONFIGURED;
- return;
- }
-
- if (!SPIFFS_CHECK_MOUNT(fs)) {
- fs->err_code = SPIFFS_ERR_NOT_MOUNTED;
- return;
- }
- SPIFFS_LOCK(fs);
-
-#if SPIFFS_CACHE
- spiffs_fflush_cache(fs, fh);
-#endif
- spiffs_fd_return(fs, fh);
-
- SPIFFS_UNLOCK(fs);
-}
-
-s32_t SPIFFS_rename(spiffs *fs, char *old, char *new) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_page_ix pix_old, pix_dummy;
- spiffs_fd *fd;
-
- s32_t res = spiffs_object_find_object_index_header_by_name(fs, (u8_t*)old, &pix_old);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_find_object_index_header_by_name(fs, (u8_t*)new, &pix_dummy);
- if (res == SPIFFS_ERR_NOT_FOUND) {
- res = SPIFFS_OK;
- } else if (res == SPIFFS_OK) {
- res = SPIFFS_ERR_CONFLICTING_NAME;
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_fd_find_new(fs, &fd);
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_open_by_page(fs, pix_old, fd, 0, 0);
- if (res != SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id, fd->objix_hdr_pix, 0, (u8_t*)new,
- 0, &pix_dummy);
-
- if (res != SPIFFS_OK) {
- spiffs_fd_return(fs, fd->file_nbr);
- }
- SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
-
- SPIFFS_UNLOCK(fs);
-
- return res;
-}
-
-spiffs_DIR *SPIFFS_opendir(spiffs *fs, char *name, spiffs_DIR *d) {
- (void)name;
-
- if (!SPIFFS_CHECK_CFG((fs))) {
- (fs)->err_code = SPIFFS_ERR_NOT_CONFIGURED;
- return 0;
- }
-
- if (!SPIFFS_CHECK_MOUNT(fs)) {
- fs->err_code = SPIFFS_ERR_NOT_MOUNTED;
- return 0;
- }
-
- d->fs = fs;
- d->block = 0;
- d->entry = 0;
- return d;
-}
-
-static s32_t spiffs_read_dir_v(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_block_ix bix,
- int ix_entry,
- u32_t user_data,
- void *user_p) {
- (void)user_data;
- s32_t res;
- spiffs_page_object_ix_header objix_hdr;
- if (obj_id == SPIFFS_OBJ_ID_FREE || obj_id == SPIFFS_OBJ_ID_DELETED ||
- (obj_id & SPIFFS_OBJ_ID_IX_FLAG) == 0) {
- return SPIFFS_VIS_COUNTINUE;
- }
-
- spiffs_page_ix pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, ix_entry);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, pix), sizeof(spiffs_page_object_ix_header), (u8_t *)&objix_hdr);
- if (res != SPIFFS_OK) return res;
- if ((obj_id & SPIFFS_OBJ_ID_IX_FLAG) &&
- objix_hdr.p_hdr.span_ix == 0 &&
- (objix_hdr.p_hdr.flags& (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_IXDELE)) ==
- (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_IXDELE)) {
- struct spiffs_dirent *e = (struct spiffs_dirent *)user_p;
- e->obj_id = obj_id;
- strcpy((char *)e->name, (char *)objix_hdr.name);
- e->type = objix_hdr.type;
- e->size = objix_hdr.size == SPIFFS_UNDEFINED_LEN ? 0 : objix_hdr.size;
- e->pix = pix;
- return SPIFFS_OK;
- }
-
- return SPIFFS_VIS_COUNTINUE;
-}
-
-struct spiffs_dirent *SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e) {
- if (!SPIFFS_CHECK_MOUNT(d->fs)) {
- d->fs->err_code = SPIFFS_ERR_NOT_MOUNTED;
- return 0;
- }
- SPIFFS_LOCK(fs);
-
- spiffs_block_ix bix;
- int entry;
- s32_t res;
- struct spiffs_dirent *ret = 0;
-
- res = spiffs_obj_lu_find_entry_visitor(d->fs,
- d->block,
- d->entry,
- SPIFFS_VIS_NO_WRAP,
- 0,
- spiffs_read_dir_v,
- 0,
- e,
- &bix,
- &entry);
- if (res == SPIFFS_OK) {
- d->block = bix;
- d->entry = entry + 1;
- ret = e;
- } else {
- d->fs->err_code = res;
- }
- SPIFFS_UNLOCK(fs);
- return ret;
-}
-
-s32_t SPIFFS_closedir(spiffs_DIR *d) {
- SPIFFS_API_CHECK_CFG(d->fs);
- SPIFFS_API_CHECK_MOUNT(d->fs);
- return 0;
-}
-
-s32_t SPIFFS_check(spiffs *fs) {
- s32_t res;
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- res = spiffs_lookup_consistency_check(fs, 0);
-
- res = spiffs_object_index_consistency_check(fs);
-
- res = spiffs_page_consistency_check(fs);
-
- res = spiffs_obj_lu_scan(fs);
-
- SPIFFS_UNLOCK(fs);
- return res;
-}
-
-s32_t SPIFFS_info(spiffs *fs, u32_t *total, u32_t *used) {
- s32_t res = SPIFFS_OK;
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- u32_t pages_per_block = SPIFFS_PAGES_PER_BLOCK(fs);
- u32_t blocks = fs->block_count;
- u32_t obj_lu_pages = SPIFFS_OBJ_LOOKUP_PAGES(fs);
- u32_t data_page_size = SPIFFS_DATA_PAGE_SIZE(fs);
- u32_t total_data_pages = (blocks - 2) * (pages_per_block - obj_lu_pages) + 1; // -2 for spare blocks, +1 for emergency page
-
- if (total) {
- *total = total_data_pages * data_page_size;
- }
-
- if (used) {
- *used = fs->stats_p_allocated * data_page_size;
- }
-
- SPIFFS_UNLOCK(fs);
- return res;
-}
-
-s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES(fs, res);
-
-#if SPIFFS_CACHE_WR
- spiffs_fflush_cache(fs, fh);
-#endif
-
- res = (fd->fdoffset == fd->size);
-
- SPIFFS_UNLOCK(fs);
- return res;
-}
-
-s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) {
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- spiffs_fd *fd;
- s32_t res;
- res = spiffs_fd_get(fs, fh, &fd);
- SPIFFS_API_CHECK_RES(fs, res);
-
-#if SPIFFS_CACHE_WR
- spiffs_fflush_cache(fs, fh);
-#endif
-
- res = fd->fdoffset;
-
- SPIFFS_UNLOCK(fs);
- return res;
-}
-
-#if SPIFFS_TEST_VISUALISATION
-s32_t SPIFFS_vis(spiffs *fs) {
- s32_t res = SPIFFS_OK;
- SPIFFS_API_CHECK_CFG(fs);
- SPIFFS_API_CHECK_MOUNT(fs);
- SPIFFS_LOCK(fs);
-
- int entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id));
- spiffs_obj_id *obj_lu_buf = (spiffs_obj_id *)fs->lu_work;
- spiffs_block_ix bix = 0;
-
- while (bix < fs->block_count) {
- // check each object lookup page
- int obj_lookup_page = 0;
- int cur_entry = 0;
-
- while (res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- int entry_offset = obj_lookup_page * entries_per_page;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, bix * SPIFFS_CFG_LOG_BLOCK_SZ(fs) + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- // check each entry
- while (res == SPIFFS_OK &&
- cur_entry - entry_offset < entries_per_page && cur_entry < (int)(SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs))) {
- spiffs_obj_id obj_id = obj_lu_buf[cur_entry-entry_offset];
- if (cur_entry == 0) {
- spiffs_printf("%4i ", bix);
- } else if ((cur_entry & 0x3f) == 0) {
- spiffs_printf(" ");
- }
- if (obj_id == SPIFFS_OBJ_ID_FREE) {
- spiffs_printf(SPIFFS_TEST_VIS_FREE_STR);
- } else if (obj_id == SPIFFS_OBJ_ID_DELETED) {
- spiffs_printf(SPIFFS_TEST_VIS_DELE_STR);
- } else if (obj_id & SPIFFS_OBJ_ID_IX_FLAG){
- spiffs_printf(SPIFFS_TEST_VIS_INDX_STR(obj_id));
- } else {
- spiffs_printf(SPIFFS_TEST_VIS_DATA_STR(obj_id));
- }
- cur_entry++;
- if ((cur_entry & 0x3f) == 0) {
- spiffs_printf("\n");
- }
- } // per entry
- obj_lookup_page++;
- } // per object lookup page
-
- spiffs_obj_id erase_count;
- res = _spiffs_rd(fs, SPIFFS_OP_C_READ | SPIFFS_OP_T_OBJ_LU2, 0,
- SPIFFS_ERASE_COUNT_PADDR(fs, bix),
- sizeof(spiffs_obj_id), (u8_t *)&erase_count);
- SPIFFS_CHECK_RES(res);
-
- if (erase_count != (spiffs_obj_id)-1) {
- spiffs_printf("\tera_cnt: %d\n", erase_count);
- } else {
- spiffs_printf("\tera_cnt: N/A\n");
- }
-
- bix++;
- } // per block
-
- spiffs_printf("era_cnt_max: %d\n", fs->max_erase_count);
- spiffs_printf("last_errno: %d\n", fs->err_code);
- spiffs_printf("blocks: %d\n", fs->block_count);
- spiffs_printf("free_blocks: %d\n", fs->free_blocks);
- spiffs_printf("page_alloc: %d\n", fs->stats_p_allocated);
- spiffs_printf("page_delet: %d\n", fs->stats_p_deleted);
- u32_t total, used;
- SPIFFS_info(fs, &total, &used);
- spiffs_printf("used: %d of %d\n", used, total);
-
- SPIFFS_UNLOCK(fs);
- return res;
-}
-#endif
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_nucleus.c b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_nucleus.c
deleted file mode 100644
index fa75fd8e..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_nucleus.c
+++ /dev/null
@@ -1,1896 +0,0 @@
-#include "spiffs.h"
-#include "spiffs_nucleus.h"
-
-static s32_t spiffs_page_data_check(spiffs *fs, spiffs_fd *fd, spiffs_page_ix pix, spiffs_span_ix spix) {
- s32_t res = SPIFFS_OK;
- if (pix == (spiffs_page_ix)-1) {
- // referring to page 0xffff...., bad object index
- return SPIFFS_ERR_INDEX_REF_FREE;
- }
- if (pix % SPIFFS_PAGES_PER_BLOCK(fs) < SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- // referring to an object lookup page, bad object index
- return SPIFFS_ERR_INDEX_REF_LU;
- }
- if (pix > SPIFFS_MAX_PAGES(fs)) {
- // referring to a bad page
- return SPIFFS_ERR_INDEX_REF_INVALID;
- }
-#if SPIFFS_PAGE_CHECK
- spiffs_page_header ph;
- res = _spiffs_rd(
- fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_READ,
- fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, pix),
- sizeof(spiffs_page_header),
- (u8_t *)&ph);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_DATA(ph, fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG, spix);
-#endif
- return res;
-}
-
-static s32_t spiffs_page_index_check(spiffs *fs, spiffs_fd *fd, spiffs_page_ix pix, spiffs_span_ix spix) {
- s32_t res = SPIFFS_OK;
- if (pix == (spiffs_page_ix)-1) {
- // referring to page 0xffff...., bad object index
- return SPIFFS_ERR_INDEX_FREE;
- }
- if (pix % SPIFFS_PAGES_PER_BLOCK(fs) < SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- // referring to an object lookup page, bad object index
- return SPIFFS_ERR_INDEX_LU;
- }
- if (pix > SPIFFS_MAX_PAGES(fs)) {
- // referring to a bad page
- return SPIFFS_ERR_INDEX_INVALID;
- }
-#if SPIFFS_PAGE_CHECK
- spiffs_page_header ph;
- res = _spiffs_rd(
- fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, pix),
- sizeof(spiffs_page_header),
- (u8_t *)&ph);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(ph, fd->obj_id, spix);
-#endif
- return res;
-}
-
-#if !SPIFFS_CACHE
-
-s32_t spiffs_phys_rd(
- spiffs *fs,
- u32_t addr,
- u32_t len,
- u8_t *dst) {
- return fs->cfg.hal_read_f(addr, len, dst);
-}
-
-s32_t spiffs_phys_wr(
- spiffs *fs,
- u32_t addr,
- u32_t len,
- u8_t *src) {
- return fs->cfg.hal_write_f(addr, len, src);
-}
-
-#endif
-
-s32_t spiffs_phys_cpy(
- spiffs *fs,
- spiffs_file fh,
- u32_t dst,
- u32_t src,
- u32_t len) {
- s32_t res;
- u8_t b[SPIFFS_COPY_BUFFER_STACK];
- while (len > 0) {
- u32_t chunk_size = MIN(SPIFFS_COPY_BUFFER_STACK, len);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_MOVS, fh, src, chunk_size, b);
- SPIFFS_CHECK_RES(res);
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_MOVD, fh, dst, chunk_size, b);
- SPIFFS_CHECK_RES(res);
- len -= chunk_size;
- src += chunk_size;
- dst += chunk_size;
- }
- return SPIFFS_OK;
-}
-
-// Find object lookup entry containing given id with visitor.
-// Iterate over object lookup pages in each block until a given object id entry is found.
-// When found, the visitor function is called with block index, entry index and user_data.
-// If visitor returns SPIFFS_VIS_CONTINUE, the search goes on. Otherwise, the search will be
-// ended and visitor's return code is returned to caller.
-// If no visitor is given (0) the search returns on first entry with matching object id.
-// If no match is found in all look up, SPIFFS_VIS_END is returned.
-// @param fs the file system
-// @param starting_block the starting block to start search in
-// @param starting_lu_entry the look up index entry to start search in
-// @param flags ored combination of SPIFFS_VIS_CHECK_ID, SPIFFS_VIS_CHECK_PH,
-// SPIFFS_VIS_NO_WRAP
-// @param obj_id argument object id
-// @param v visitor callback function
-// @param user_data any data, passed to the callback visitor function
-// @param user_p any pointer, passed to the callback visitor function
-// @param block_ix reported block index where match was found
-// @param lu_entry reported look up index where match was found
-s32_t spiffs_obj_lu_find_entry_visitor(
- spiffs *fs,
- spiffs_block_ix starting_block,
- int starting_lu_entry,
- u8_t flags,
- spiffs_obj_id obj_id,
- spiffs_visitor_f v,
- u32_t user_data,
- void *user_p,
- spiffs_block_ix *block_ix,
- int *lu_entry) {
- s32_t res = SPIFFS_OK;
- s32_t entry_count = fs->block_count * SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs);
- spiffs_block_ix cur_block = starting_block;
- u32_t cur_block_addr = starting_block * SPIFFS_CFG_LOG_BLOCK_SZ(fs);
-
- spiffs_obj_id *obj_lu_buf = (spiffs_obj_id *)fs->lu_work;
- int cur_entry = starting_lu_entry;
- int entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id));
-
- // wrap initial
- if (cur_entry >= (int)SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs) - 1) {
- cur_entry = 0;
- cur_block++;
- cur_block_addr = cur_block * SPIFFS_CFG_LOG_BLOCK_SZ(fs);
- if (cur_block >= fs->block_count) {
- if (flags & SPIFFS_VIS_NO_WRAP) {
- return SPIFFS_VIS_END;
- } else {
- // block wrap
- cur_block = 0;
- cur_block_addr = 0;
- }
- }
- }
-
- // check each block
- while (res == SPIFFS_OK && entry_count > 0) {
- int obj_lookup_page = cur_entry / entries_per_page;
- // check each object lookup page
- while (res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
- int entry_offset = obj_lookup_page * entries_per_page;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, cur_block_addr + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- // check each entry
- while (res == SPIFFS_OK &&
- cur_entry - entry_offset < entries_per_page && // for non-last obj lookup pages
- cur_entry < (int)SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs)) // for last obj lookup page
- {
- if ((flags & SPIFFS_VIS_CHECK_ID) == 0 || obj_lu_buf[cur_entry-entry_offset] == obj_id) {
- if (block_ix) *block_ix = cur_block;
- if (lu_entry) *lu_entry = cur_entry;
- if (v) {
- res = v(
- fs,
- (flags & SPIFFS_VIS_CHECK_PH) ? obj_id : obj_lu_buf[cur_entry-entry_offset],
- cur_block,
- cur_entry,
- user_data,
- user_p);
- if (res == SPIFFS_VIS_COUNTINUE || res == SPIFFS_VIS_COUNTINUE_RELOAD) {
- if (res == SPIFFS_VIS_COUNTINUE_RELOAD) {
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, cur_block_addr + SPIFFS_PAGE_TO_PADDR(fs, obj_lookup_page), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->lu_work);
- SPIFFS_CHECK_RES(res);
- }
- res = SPIFFS_OK;
- cur_entry++;
- entry_count--;
- continue;
- } else {
- return res;
- }
- } else {
- return SPIFFS_OK;
- }
- }
- entry_count--;
- cur_entry++;
- } // per entry
- obj_lookup_page++;
- } // per object lookup page
- cur_entry = 0;
- cur_block++;
- cur_block_addr += SPIFFS_CFG_LOG_BLOCK_SZ(fs);
- if (cur_block >= fs->block_count) {
- if (flags & SPIFFS_VIS_NO_WRAP) {
- return SPIFFS_VIS_END;
- } else {
- // block wrap
- cur_block = 0;
- cur_block_addr = 0;
- }
- }
- } // per block
-
- SPIFFS_CHECK_RES(res);
-
- return SPIFFS_VIS_END;
-}
-
-s32_t spiffs_erase_block(
- spiffs *fs,
- spiffs_block_ix bix) {
- s32_t res;
- u32_t addr = SPIFFS_BLOCK_TO_PADDR(fs, bix);
- s32_t size = SPIFFS_CFG_LOG_BLOCK_SZ(fs);
-
- // here we ignore res, just try erasing the block
- while (size > 0) {
- SPIFFS_DBG("erase %08x:%08x\n", addr, SPIFFS_CFG_PHYS_ERASE_SZ(fs));
- (void)fs->cfg.hal_erase_f(addr, SPIFFS_CFG_PHYS_ERASE_SZ(fs));
- addr += SPIFFS_CFG_PHYS_ERASE_SZ(fs);
- size -= SPIFFS_CFG_PHYS_ERASE_SZ(fs);
- }
- fs->free_blocks++;
-
- // register erase count for this block
- res = _spiffs_wr(fs, SPIFFS_OP_C_WRTHRU | SPIFFS_OP_T_OBJ_LU2, 0,
- SPIFFS_ERASE_COUNT_PADDR(fs, bix),
- sizeof(spiffs_obj_id), (u8_t *)&fs->max_erase_count);
- SPIFFS_CHECK_RES(res);
-
-#if SPIFFS_USE_MAGIC
- // finally, write magic
- spiffs_obj_id magic = SPIFFS_MAGIC(fs);
- res = _spiffs_wr(fs, SPIFFS_OP_C_WRTHRU | SPIFFS_OP_T_OBJ_LU2, 0,
- SPIFFS_MAGIC_PADDR(fs, bix),
- sizeof(spiffs_obj_id), (u8_t *)&magic);
- SPIFFS_CHECK_RES(res);
-#endif
-
- fs->max_erase_count++;
- if (fs->max_erase_count == SPIFFS_OBJ_ID_IX_FLAG) {
- fs->max_erase_count = 0;
- }
-
- return res;
-}
-
-
-static s32_t spiffs_obj_lu_scan_v(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_block_ix bix,
- int ix_entry,
- u32_t user_data,
- void *user_p) {
- (void)bix;
- (void)user_data;
- (void)user_p;
- if (obj_id == SPIFFS_OBJ_ID_FREE) {
- if (ix_entry == 0) {
- fs->free_blocks++;
- // todo optimize further, return SPIFFS_NEXT_BLOCK
- }
- } else if (obj_id == SPIFFS_OBJ_ID_DELETED) {
- fs->stats_p_deleted++;
- } else {
- fs->stats_p_allocated++;
- }
-
- return SPIFFS_VIS_COUNTINUE;
-}
-
-
-// Scans thru all obj lu and counts free, deleted and used pages
-// Find the maximum block erase count
-// Checks magic if enabled
-s32_t spiffs_obj_lu_scan(
- spiffs *fs) {
- s32_t res;
- spiffs_block_ix bix;
- int entry;
-#if SPIFFS_USE_MAGIC
- spiffs_block_ix unerased_bix = (spiffs_block_ix)-1;
-#endif
-
- // find out erase count
- // if enabled, check magic
- bix = 0;
- spiffs_obj_id erase_count_final;
- spiffs_obj_id erase_count_min = SPIFFS_OBJ_ID_FREE;
- spiffs_obj_id erase_count_max = 0;
- while (bix < fs->block_count) {
-#if SPIFFS_USE_MAGIC
- spiffs_obj_id magic;
- res = _spiffs_rd(fs,
- SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_MAGIC_PADDR(fs, bix) ,
- sizeof(spiffs_obj_id), (u8_t *)&magic);
-
- SPIFFS_CHECK_RES(res);
- if (magic != SPIFFS_MAGIC(fs)) {
- if (unerased_bix == (spiffs_block_ix)-1) {
- // allow one unerased block as it might be powered down during an erase
- unerased_bix = bix;
- } else {
- // more than one unerased block, bail out
- SPIFFS_CHECK_RES(SPIFFS_ERR_NOT_A_FS);
- }
- }
-#endif
- spiffs_obj_id erase_count;
- res = _spiffs_rd(fs,
- SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_ERASE_COUNT_PADDR(fs, bix) ,
- sizeof(spiffs_obj_id), (u8_t *)&erase_count);
- SPIFFS_CHECK_RES(res);
- if (erase_count != SPIFFS_OBJ_ID_FREE) {
- erase_count_min = MIN(erase_count_min, erase_count);
- erase_count_max = MAX(erase_count_max, erase_count);
- }
- bix++;
- }
-
- if (erase_count_min == 0 && erase_count_max == SPIFFS_OBJ_ID_FREE) {
- // clean system, set counter to zero
- erase_count_final = 0;
- } else if (erase_count_max - erase_count_min > (SPIFFS_OBJ_ID_FREE)/2) {
- // wrap, take min
- erase_count_final = erase_count_min+1;
- } else {
- erase_count_final = erase_count_max+1;
- }
-
- fs->max_erase_count = erase_count_final;
-
-#if SPIFFS_USE_MAGIC
- if (unerased_bix != (spiffs_block_ix)-1) {
- // found one unerased block, remedy
- SPIFFS_DBG("mount: erase block %d\n", bix);
- res = spiffs_erase_block(fs, unerased_bix);
- SPIFFS_CHECK_RES(res);
- }
-#endif
-
- // count blocks
-
- fs->free_blocks = 0;
- fs->stats_p_allocated = 0;
- fs->stats_p_deleted = 0;
-
- res = spiffs_obj_lu_find_entry_visitor(fs,
- 0,
- 0,
- 0,
- 0,
- spiffs_obj_lu_scan_v,
- 0,
- 0,
- &bix,
- &entry);
-
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_OK;
- }
-
- SPIFFS_CHECK_RES(res);
-
- return res;
-}
-
-// Find free object lookup entry
-// Iterate over object lookup pages in each block until a free object id entry is found
-s32_t spiffs_obj_lu_find_free(
- spiffs *fs,
- spiffs_block_ix starting_block,
- int starting_lu_entry,
- spiffs_block_ix *block_ix,
- int *lu_entry) {
- s32_t res;
- if (!fs->cleaning && fs->free_blocks < 2) {
- res = spiffs_gc_quick(fs);
- SPIFFS_CHECK_RES(res);
- if (fs->free_blocks < 2) {
- return SPIFFS_ERR_FULL;
- }
- }
- res = spiffs_obj_lu_find_id(fs, starting_block, starting_lu_entry,
- SPIFFS_OBJ_ID_FREE, block_ix, lu_entry);
- if (res == SPIFFS_OK) {
- fs->free_cursor_block_ix = *block_ix;
- fs->free_cursor_obj_lu_entry = *lu_entry;
- if (*lu_entry == 0) {
- fs->free_blocks--;
- }
- }
- if (res == SPIFFS_VIS_END) {
- SPIFFS_DBG("fs full\n");
- }
-
- return res == SPIFFS_VIS_END ? SPIFFS_ERR_FULL : res;
-}
-
-// Find object lookup entry containing given id
-// Iterate over object lookup pages in each block until a given object id entry is found
-s32_t spiffs_obj_lu_find_id(
- spiffs *fs,
- spiffs_block_ix starting_block,
- int starting_lu_entry,
- spiffs_obj_id obj_id,
- spiffs_block_ix *block_ix,
- int *lu_entry) {
- s32_t res = spiffs_obj_lu_find_entry_visitor(
- fs, starting_block, starting_lu_entry, SPIFFS_VIS_CHECK_ID, obj_id, 0, 0, 0, block_ix, lu_entry);
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_ERR_NOT_FOUND;
- }
- return res;
-}
-
-
-static s32_t spiffs_obj_lu_find_id_and_span_v(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_block_ix bix,
- int ix_entry,
- u32_t user_data,
- void *user_p) {
- s32_t res;
- spiffs_page_header ph;
- spiffs_page_ix pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, ix_entry);
- res = _spiffs_rd(fs, 0, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- SPIFFS_PAGE_TO_PADDR(fs, pix), sizeof(spiffs_page_header), (u8_t *)&ph);
- SPIFFS_CHECK_RES(res);
- if (ph.obj_id == obj_id &&
- ph.span_ix == (spiffs_span_ix)user_data &&
- (ph.flags & (SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_USED)) == SPIFFS_PH_FLAG_DELET &&
- !((obj_id & SPIFFS_OBJ_ID_IX_FLAG) && (ph.flags & SPIFFS_PH_FLAG_IXDELE) == 0 && ph.span_ix == 0) &&
- (user_p == 0 || *((spiffs_page_ix *)user_p) != pix)) {
- return SPIFFS_OK;
- } else {
- return SPIFFS_VIS_COUNTINUE;
- }
-}
-
-// Find object lookup entry containing given id and span index
-// Iterate over object lookup pages in each block until a given object id entry is found
-s32_t spiffs_obj_lu_find_id_and_span(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_span_ix spix,
- spiffs_page_ix exclusion_pix,
- spiffs_page_ix *pix) {
- s32_t res;
- spiffs_block_ix bix;
- int entry;
-
- res = spiffs_obj_lu_find_entry_visitor(fs,
- fs->cursor_block_ix,
- fs->cursor_obj_lu_entry,
- SPIFFS_VIS_CHECK_ID,
- obj_id,
- spiffs_obj_lu_find_id_and_span_v,
- (u32_t)spix,
- exclusion_pix ? &exclusion_pix : 0,
- &bix,
- &entry);
-
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_ERR_NOT_FOUND;
- }
-
- SPIFFS_CHECK_RES(res);
-
- if (pix) {
- *pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
- }
-
- fs->cursor_block_ix = bix;
- fs->cursor_obj_lu_entry = entry;
-
- return res;
-}
-
-// Find object lookup entry containing given id and span index in page headers only
-// Iterate over object lookup pages in each block until a given object id entry is found
-s32_t spiffs_obj_lu_find_id_and_span_by_phdr(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_span_ix spix,
- spiffs_page_ix exclusion_pix,
- spiffs_page_ix *pix) {
- s32_t res;
- spiffs_block_ix bix;
- int entry;
-
- res = spiffs_obj_lu_find_entry_visitor(fs,
- fs->cursor_block_ix,
- fs->cursor_obj_lu_entry,
- SPIFFS_VIS_CHECK_PH,
- obj_id,
- spiffs_obj_lu_find_id_and_span_v,
- (u32_t)spix,
- exclusion_pix ? &exclusion_pix : 0,
- &bix,
- &entry);
-
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_ERR_NOT_FOUND;
- }
-
- SPIFFS_CHECK_RES(res);
-
- if (pix) {
- *pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
- }
-
- fs->cursor_block_ix = bix;
- fs->cursor_obj_lu_entry = entry;
-
- return res;
-}
-
-// Allocates a free defined page with given obj_id
-// Occupies object lookup entry and page
-// data may be NULL; where only page header is stored, len and page_offs is ignored
-s32_t spiffs_page_allocate_data(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_page_header *ph,
- u8_t *data,
- u32_t len,
- u32_t page_offs,
- u8_t finalize,
- spiffs_page_ix *pix) {
- s32_t res = SPIFFS_OK;
- spiffs_block_ix bix;
- int entry;
-
- // find free entry
- res = spiffs_obj_lu_find_free(fs, fs->free_cursor_block_ix, fs->free_cursor_obj_lu_entry, &bix, &entry);
- SPIFFS_CHECK_RES(res);
-
- // occupy page in object lookup
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_BLOCK_TO_PADDR(fs, bix) + entry * sizeof(spiffs_obj_id), sizeof(spiffs_obj_id), (u8_t*)&obj_id);
- SPIFFS_CHECK_RES(res);
-
- fs->stats_p_allocated++;
-
- // write page header
- ph->flags &= ~SPIFFS_PH_FLAG_USED;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_OBJ_LOOKUP_ENTRY_TO_PADDR(fs, bix, entry), sizeof(spiffs_page_header), (u8_t*)ph);
- SPIFFS_CHECK_RES(res);
-
- // write page data
- if (data) {
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0,SPIFFS_OBJ_LOOKUP_ENTRY_TO_PADDR(fs, bix, entry) + sizeof(spiffs_page_header) + page_offs, len, data);
- SPIFFS_CHECK_RES(res);
- }
-
- // finalize header if necessary
- if (finalize && (ph->flags & SPIFFS_PH_FLAG_FINAL)) {
- ph->flags &= ~SPIFFS_PH_FLAG_FINAL;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_OBJ_LOOKUP_ENTRY_TO_PADDR(fs, bix, entry) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&ph->flags);
- SPIFFS_CHECK_RES(res);
- }
-
- // return written page
- if (pix) {
- *pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
- }
-
- return res;
-}
-
-// Moves a page from src to a free page and finalizes it. Updates page index. Page data is given in param page.
-// If page data is null, provided header is used for metainfo and page data is physically copied.
-s32_t spiffs_page_move(
- spiffs *fs,
- spiffs_file fh,
- u8_t *page_data,
- spiffs_obj_id obj_id,
- spiffs_page_header *page_hdr,
- spiffs_page_ix src_pix,
- spiffs_page_ix *dst_pix) {
- s32_t res;
- u8_t was_final = 0;
- spiffs_page_header *p_hdr;
- spiffs_block_ix bix;
- int entry;
- spiffs_page_ix free_pix;
-
- // find free entry
- res = spiffs_obj_lu_find_free(fs, fs->free_cursor_block_ix, fs->free_cursor_obj_lu_entry, &bix, &entry);
- SPIFFS_CHECK_RES(res);
- free_pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
-
- if (dst_pix) *dst_pix = free_pix;
-
- p_hdr = page_data ? (spiffs_page_header *)page_data : page_hdr;
- if (page_data) {
- // got page data
- was_final = (p_hdr->flags & SPIFFS_PH_FLAG_FINAL) == 0;
- // write unfinalized page
- p_hdr->flags |= SPIFFS_PH_FLAG_FINAL;
- p_hdr->flags &= ~SPIFFS_PH_FLAG_USED;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_PAGE_TO_PADDR(fs, free_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), page_data);
- } else {
- // copy page data
- res = spiffs_phys_cpy(fs, fh, SPIFFS_PAGE_TO_PADDR(fs, free_pix), SPIFFS_PAGE_TO_PADDR(fs, src_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs));
- }
- SPIFFS_CHECK_RES(res);
-
- // mark entry in destination object lookup
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_BLOCK_TO_PADDR(fs, SPIFFS_BLOCK_FOR_PAGE(fs, free_pix)) + SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, free_pix) * sizeof(spiffs_page_ix),
- sizeof(spiffs_obj_id),
- (u8_t *)&obj_id);
- SPIFFS_CHECK_RES(res);
-
- fs->stats_p_allocated++;
-
- if (was_final) {
- // mark finalized in destination page
- p_hdr->flags &= ~(SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_USED);
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- fh,
- SPIFFS_PAGE_TO_PADDR(fs, free_pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&p_hdr->flags);
- SPIFFS_CHECK_RES(res);
- }
- // mark source deleted
- res = spiffs_page_delete(fs, src_pix);
- return res;
-}
-
-// Deletes a page and removes it from object lookup.
-s32_t spiffs_page_delete(
- spiffs *fs,
- spiffs_page_ix pix) {
- s32_t res;
- spiffs_page_header hdr;
- hdr.flags = 0xff & ~(SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_USED);
- // mark deleted entry in source object lookup
- spiffs_obj_id d_obj_id = SPIFFS_OBJ_ID_DELETED;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_DELE,
- 0,
- SPIFFS_BLOCK_TO_PADDR(fs, SPIFFS_BLOCK_FOR_PAGE(fs, pix)) + SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, pix) * sizeof(spiffs_page_ix),
- sizeof(spiffs_obj_id),
- (u8_t *)&d_obj_id);
- SPIFFS_CHECK_RES(res);
-
- fs->stats_p_deleted++;
- fs->stats_p_allocated--;
-
- // mark deleted in source page
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_DELE,
- 0,
- SPIFFS_PAGE_TO_PADDR(fs, pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&hdr.flags);
-
- return res;
-}
-
-// Create an object index header page with empty index and undefined length
-s32_t spiffs_object_create(
- spiffs *fs,
- spiffs_obj_id obj_id,
- u8_t name[SPIFFS_OBJ_NAME_LEN],
- spiffs_obj_type type,
- spiffs_page_ix *objix_hdr_pix) {
- s32_t res = SPIFFS_OK;
- spiffs_block_ix bix;
- spiffs_page_object_ix_header oix_hdr;
- int entry;
-
- res = spiffs_gc_check(fs, SPIFFS_DATA_PAGE_SIZE(fs));
- SPIFFS_CHECK_RES(res);
-
- obj_id |= SPIFFS_OBJ_ID_IX_FLAG;
-
- // find free entry
- res = spiffs_obj_lu_find_free(fs, fs->free_cursor_block_ix, fs->free_cursor_obj_lu_entry, &bix, &entry);
- SPIFFS_CHECK_RES(res);
- SPIFFS_DBG("create: found free page @ %04x bix:%d entry:%d\n", SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry), bix, entry);
-
- // occupy page in object lookup
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_BLOCK_TO_PADDR(fs, bix) + entry * sizeof(spiffs_obj_id), sizeof(spiffs_obj_id), (u8_t*)&obj_id);
- SPIFFS_CHECK_RES(res);
-
- fs->stats_p_allocated++;
-
- // write empty object index page
- oix_hdr.p_hdr.obj_id = obj_id;
- oix_hdr.p_hdr.span_ix = 0;
- oix_hdr.p_hdr.flags = 0xff & ~(SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_USED);
- oix_hdr.type = type;
- oix_hdr.size = SPIFFS_UNDEFINED_LEN; // keep ones so we can update later without wasting this page
- strncpy((char *)&oix_hdr.name, (char *)name, SPIFFS_OBJ_NAME_LEN);
-
-
- // update page
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- 0, SPIFFS_OBJ_LOOKUP_ENTRY_TO_PADDR(fs, bix, entry), sizeof(spiffs_page_object_ix_header), (u8_t*)&oix_hdr);
-
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, 0, SPIFFS_EV_IX_NEW, obj_id, 0, SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry), SPIFFS_UNDEFINED_LEN);
-
- if (objix_hdr_pix) {
- *objix_hdr_pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
- }
-
- return res;
-}
-
-// update object index header with any combination of name/size/index
-// new_objix_hdr_data may be null, if so the object index header page is loaded
-// name may be null, if so name is not changed
-// size may be null, if so size is not changed
-s32_t spiffs_object_update_index_hdr(
- spiffs *fs,
- spiffs_fd *fd,
- spiffs_obj_id obj_id,
- spiffs_page_ix objix_hdr_pix,
- u8_t *new_objix_hdr_data,
- u8_t name[SPIFFS_OBJ_NAME_LEN],
- u32_t size,
- spiffs_page_ix *new_pix) {
- s32_t res = SPIFFS_OK;
- spiffs_page_object_ix_header *objix_hdr;
- spiffs_page_ix new_objix_hdr_pix;
-
- obj_id |= SPIFFS_OBJ_ID_IX_FLAG;
-
- if (new_objix_hdr_data) {
- // object index header page already given to us, no need to load it
- objix_hdr = (spiffs_page_object_ix_header *)new_objix_hdr_data;
- } else {
- // read object index header page
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, objix_hdr_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- objix_hdr = (spiffs_page_object_ix_header *)fs->work;
- }
-
- SPIFFS_VALIDATE_OBJIX(objix_hdr->p_hdr, obj_id, 0);
-
- // change name
- if (name) {
- strncpy((char *)objix_hdr->name, (char *)name, SPIFFS_OBJ_NAME_LEN);
- }
- if (size) {
- objix_hdr->size = size;
- }
-
- // move and update page
- res = spiffs_page_move(fs, fd == 0 ? 0 : fd->file_nbr, (u8_t*)objix_hdr, obj_id, 0, objix_hdr_pix, &new_objix_hdr_pix);
-
- if (res == SPIFFS_OK) {
- if (new_pix) {
- *new_pix = new_objix_hdr_pix;
- }
- // callback on object index update
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD, obj_id, objix_hdr->p_hdr.span_ix, new_objix_hdr_pix, objix_hdr->size);
- if (fd) fd->objix_hdr_pix = new_objix_hdr_pix; // if this is not in the registered cluster
- }
-
- return res;
-}
-
-void spiffs_cb_object_event(
- spiffs *fs,
- spiffs_fd *fd,
- int ev,
- spiffs_obj_id obj_id,
- spiffs_span_ix spix,
- spiffs_page_ix new_pix,
- u32_t new_size) {
- (void)fd;
- // update index caches in all file descriptors
- obj_id &= ~SPIFFS_OBJ_ID_IX_FLAG;
- u32_t i;
- spiffs_fd *fds = (spiffs_fd *)fs->fd_space;
- for (i = 0; i < fs->fd_count; i++) {
- spiffs_fd *cur_fd = &fds[i];
- if (cur_fd->file_nbr == 0 || (cur_fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG) != obj_id) continue;
- if (spix == 0) {
- if (ev == SPIFFS_EV_IX_NEW || ev == SPIFFS_EV_IX_UPD) {
- SPIFFS_DBG(" callback: setting fd %d:%04x objix_hdr_pix to %04x, size:%d\n", cur_fd->file_nbr, cur_fd->obj_id, new_pix, new_size);
- cur_fd->objix_hdr_pix = new_pix;
- if (new_size != 0) {
- cur_fd->size = new_size;
- }
- } else if (ev == SPIFFS_EV_IX_DEL) {
- cur_fd->file_nbr = 0;
- cur_fd->obj_id = SPIFFS_OBJ_ID_DELETED;
- }
- }
- if (cur_fd->cursor_objix_spix == spix) {
- if (ev == SPIFFS_EV_IX_NEW || ev == SPIFFS_EV_IX_UPD) {
- SPIFFS_DBG(" callback: setting fd %d:%04x span:%04x objix_pix to %04x\n", cur_fd->file_nbr, cur_fd->obj_id, spix, new_pix);
- cur_fd->cursor_objix_pix = new_pix;
- } else {
- cur_fd->cursor_objix_pix = 0;
- }
- }
- }
-}
-
-// Open object by id
-s32_t spiffs_object_open_by_id(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_fd *fd,
- spiffs_flags flags,
- spiffs_mode mode) {
- s32_t res = SPIFFS_OK;
- spiffs_page_ix pix;
-
- res = spiffs_obj_lu_find_id_and_span(fs, obj_id | SPIFFS_OBJ_ID_IX_FLAG, 0, 0, &pix);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_object_open_by_page(fs, pix, fd, flags, mode);
-
- return res;
-}
-
-// Open object by page index
-s32_t spiffs_object_open_by_page(
- spiffs *fs,
- spiffs_page_ix pix,
- spiffs_fd *fd,
- spiffs_flags flags,
- spiffs_mode mode) {
- (void)mode;
- s32_t res = SPIFFS_OK;
- spiffs_page_object_ix_header oix_hdr;
- spiffs_obj_id obj_id;
-
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, pix), sizeof(spiffs_page_object_ix_header), (u8_t *)&oix_hdr);
- SPIFFS_CHECK_RES(res);
-
- spiffs_block_ix bix = SPIFFS_BLOCK_FOR_PAGE(fs, pix);
- int entry = SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, pix);
-
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU | SPIFFS_OP_C_READ,
- 0, SPIFFS_BLOCK_TO_PADDR(fs, bix) + entry * sizeof(spiffs_obj_id), sizeof(spiffs_obj_id), (u8_t *)&obj_id);
-
- fd->fs = fs;
- fd->objix_hdr_pix = pix;
- fd->size = oix_hdr.size;
- fd->offset = 0;
- fd->cursor_objix_pix = pix;
- fd->cursor_objix_spix = 0;
- fd->obj_id = obj_id;
- fd->flags = flags;
-
- SPIFFS_VALIDATE_OBJIX(oix_hdr.p_hdr, fd->obj_id, 0);
-
- SPIFFS_DBG("open: fd %d is obj id %04x\n", fd->file_nbr, fd->obj_id);
-
- return res;
-}
-
-// Append to object
-// keep current object index (header) page in fs->work buffer
-s32_t spiffs_object_append(spiffs_fd *fd, u32_t offset, u8_t *data, u32_t len) {
- spiffs *fs = fd->fs;
- s32_t res = SPIFFS_OK;
- u32_t written = 0;
-
- SPIFFS_DBG("append: %d bytes @ offs %d of size %d\n", len, offset, fd->size);
-
- if (offset > fd->size) {
- SPIFFS_DBG("append: offset reversed to size\n");
- offset = fd->size;
- }
-
- res = spiffs_gc_check(fs, len + SPIFFS_DATA_PAGE_SIZE(fs)); // add an extra page of data worth for meta
- if (res != SPIFFS_OK) {
- SPIFFS_DBG("append: gc check fail %d\n", res);
- }
- SPIFFS_CHECK_RES(res);
-
- spiffs_page_object_ix_header *objix_hdr = (spiffs_page_object_ix_header *)fs->work;
- spiffs_page_object_ix *objix = (spiffs_page_object_ix *)fs->work;
- spiffs_page_header p_hdr;
-
- spiffs_span_ix cur_objix_spix = 0;
- spiffs_span_ix prev_objix_spix = (spiffs_span_ix)-1;
- spiffs_page_ix cur_objix_pix = fd->objix_hdr_pix;
- spiffs_page_ix new_objix_hdr_page;
-
- spiffs_span_ix data_spix = offset / SPIFFS_DATA_PAGE_SIZE(fs);
- spiffs_page_ix data_page;
- u32_t page_offs = offset % SPIFFS_DATA_PAGE_SIZE(fs);
-
- // write all data
- while (res == SPIFFS_OK && written < len) {
- // calculate object index page span index
- cur_objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
-
- // handle storing and loading of object indices
- if (cur_objix_spix != prev_objix_spix) {
- // new object index page
- // within this clause we return directly if something fails, object index mess-up
- if (written > 0) {
- // store previous object index page, unless first pass
- SPIFFS_DBG("append: %04x store objix %04x:%04x, written %d\n", fd->obj_id,
- cur_objix_pix, prev_objix_spix, written);
- if (prev_objix_spix == 0) {
- // this is an update to object index header page
- objix_hdr->size = offset+written;
- if (offset == 0) {
- // was an empty object, update same page (size was 0xffffffff)
- res = spiffs_page_index_check(fs, fd, cur_objix_pix, 0);
- SPIFFS_CHECK_RES(res);
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_UPDT,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, cur_objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- } else {
- // was a nonempty object, update to new page
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, fs->work, 0, offset+written, &new_objix_hdr_page);
- SPIFFS_CHECK_RES(res);
- SPIFFS_DBG("append: %04x store new objix_hdr, %04x:%04x, written %d\n", fd->obj_id,
- new_objix_hdr_page, 0, written);
- }
- } else {
- // this is an update to an object index page
- res = spiffs_page_index_check(fs, fd, cur_objix_pix, prev_objix_spix);
- SPIFFS_CHECK_RES(res);
-
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_UPDT,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, cur_objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD,fd->obj_id, objix->p_hdr.span_ix, cur_objix_pix, 0);
- // update length in object index header page
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, 0, 0, offset+written, &new_objix_hdr_page);
- SPIFFS_CHECK_RES(res);
- SPIFFS_DBG("append: %04x store new size I %d in objix_hdr, %04x:%04x, written %d\n", fd->obj_id,
- offset+written, new_objix_hdr_page, 0, written);
- }
- fd->size = offset+written;
- fd->offset = offset+written;
- }
-
- // create or load new object index page
- if (cur_objix_spix == 0) {
- // load object index header page, must always exist
- SPIFFS_DBG("append: %04x load objixhdr page %04x:%04x\n", fd->obj_id, cur_objix_pix, cur_objix_spix);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, cur_objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix_hdr->p_hdr, fd->obj_id, cur_objix_spix);
- } else {
- spiffs_span_ix len_objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, (fd->size-1)/SPIFFS_DATA_PAGE_SIZE(fs));
- // on subsequent passes, create a new object index page
- if (written > 0 || cur_objix_spix > len_objix_spix) {
- p_hdr.obj_id = fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG;
- p_hdr.span_ix = cur_objix_spix;
- p_hdr.flags = 0xff & ~(SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_INDEX);
- res = spiffs_page_allocate_data(fs, fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG,
- &p_hdr, 0, 0, 0, 1, &cur_objix_pix);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_NEW, fd->obj_id, cur_objix_spix, cur_objix_pix, 0);
- // quick "load" of new object index page
- c_memset(fs->work, 0xff, SPIFFS_CFG_LOG_PAGE_SZ(fs));
- c_memcpy(fs->work, &p_hdr, sizeof(spiffs_page_header));
- SPIFFS_DBG("append: %04x create objix page, %04x:%04x, written %d\n", fd->obj_id
- , cur_objix_pix, cur_objix_spix, written);
- } else {
- // on first pass, we load existing object index page
- spiffs_page_ix pix;
- SPIFFS_DBG("append: %04x find objix span_ix:%04x\n", fd->obj_id, cur_objix_spix);
- if (fd->cursor_objix_spix == cur_objix_spix) {
- pix = fd->cursor_objix_pix;
- } else {
- res = spiffs_obj_lu_find_id_and_span(fs, fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG, cur_objix_spix, 0, &pix);
- SPIFFS_CHECK_RES(res);
- }
- SPIFFS_DBG("append: %04x found object index at page %04x [fd size %d]\n", fd->obj_id, pix, fd->size);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix_hdr->p_hdr, fd->obj_id, cur_objix_spix);
- cur_objix_pix = pix;
- }
- fd->cursor_objix_pix = cur_objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
- fd->offset = offset+written;
- fd->size = offset+written;
- }
- prev_objix_spix = cur_objix_spix;
- }
-
- // write data
- u32_t to_write = MIN(len-written, SPIFFS_DATA_PAGE_SIZE(fs) - page_offs);
- if (page_offs == 0) {
- // at beginning of a page, allocate and write a new page of data
- p_hdr.obj_id = fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- p_hdr.span_ix = data_spix;
- p_hdr.flags = 0xff & ~(SPIFFS_PH_FLAG_FINAL); // finalize immediately
- res = spiffs_page_allocate_data(fs, fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG,
- &p_hdr, &data[written], to_write, page_offs, 1, &data_page);
- SPIFFS_DBG("append: %04x store new data page, %04x:%04x offset:%d, len %d, written %d\n", fd->obj_id,
- data_page, data_spix, page_offs, to_write, written);
- } else {
- // append to existing page, fill out free data in existing page
- if (cur_objix_spix == 0) {
- // get data page from object index header page
- data_page = ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix];
- } else {
- // get data page from object index page
- data_page = ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)];
- }
-
- res = spiffs_page_data_check(fs, fd, data_page, data_spix);
- SPIFFS_CHECK_RES(res);
-
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, data_page) + sizeof(spiffs_page_header) + page_offs, to_write, &data[written]);
- SPIFFS_DBG("append: %04x store to existing data page, %04x:%04x offset:%d, len %d, written %d\n", fd->obj_id
- , data_page, data_spix, page_offs, to_write, written);
- }
-
- if (res != SPIFFS_OK) break;
-
- // update memory representation of object index page with new data page
- if (cur_objix_spix == 0) {
- // update object index header page
- ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix] = data_page;
- SPIFFS_DBG("append: %04x wrote page %04x to objix_hdr entry %02x in mem\n", fd->obj_id
- , data_page, data_spix);
- objix_hdr->size = offset+written;
- } else {
- // update object index page
- ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)] = data_page;
- SPIFFS_DBG("append: %04x wrote page %04x to objix entry %02x in mem\n", fd->obj_id
- , data_page, SPIFFS_OBJ_IX_ENTRY(fs, data_spix));
- }
-
- // update internals
- page_offs = 0;
- data_spix++;
- written += to_write;
- } // while all data
-
- fd->size = offset+written;
- fd->offset = offset+written;
- fd->cursor_objix_pix = cur_objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
-
- // finalize updated object indices
- s32_t res2 = SPIFFS_OK;
- if (cur_objix_spix != 0) {
- // wrote beyond object index header page
- // write last modified object index page, unless object header index page
- SPIFFS_DBG("append: %04x store objix page, %04x:%04x, written %d\n", fd->obj_id,
- cur_objix_pix, cur_objix_spix, written);
-
- res2 = spiffs_page_index_check(fs, fd, cur_objix_pix, cur_objix_spix);
- SPIFFS_CHECK_RES(res2);
-
- res2 = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_UPDT,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, cur_objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res2);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD, fd->obj_id, objix->p_hdr.span_ix, cur_objix_pix, 0);
-
- // update size in object header index page
- res2 = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, 0, 0, offset+written, &new_objix_hdr_page);
- SPIFFS_DBG("append: %04x store new size II %d in objix_hdr, %04x:%04x, written %d, res %d\n", fd->obj_id
- , offset+written, new_objix_hdr_page, 0, written, res2);
- SPIFFS_CHECK_RES(res2);
- } else {
- // wrote within object index header page
- if (offset == 0) {
- // wrote to empty object - simply update size and write whole page
- objix_hdr->size = offset+written;
- SPIFFS_DBG("append: %04x store fresh objix_hdr page, %04x:%04x, written %d\n", fd->obj_id
- , cur_objix_pix, cur_objix_spix, written);
-
- res2 = spiffs_page_index_check(fs, fd, cur_objix_pix, cur_objix_spix);
- SPIFFS_CHECK_RES(res2);
-
- res2 = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_UPDT,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, cur_objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res2);
- // callback on object index update
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD, fd->obj_id, objix_hdr->p_hdr.span_ix, cur_objix_pix, objix_hdr->size);
- } else {
- // modifying object index header page, update size and make new copy
- res2 = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, fs->work, 0, offset+written, &new_objix_hdr_page);
- SPIFFS_DBG("append: %04x store modified objix_hdr page, %04x:%04x, written %d\n", fd->obj_id
- , new_objix_hdr_page, 0, written);
- SPIFFS_CHECK_RES(res2);
- }
- }
-
- return res;
-}
-
-// Modify object
-// keep current object index (header) page in fs->work buffer
-s32_t spiffs_object_modify(spiffs_fd *fd, u32_t offset, u8_t *data, u32_t len) {
- spiffs *fs = fd->fs;
- s32_t res = SPIFFS_OK;
- u32_t written = 0;
-
- res = spiffs_gc_check(fs, len + SPIFFS_DATA_PAGE_SIZE(fs));
- SPIFFS_CHECK_RES(res);
-
- spiffs_page_object_ix_header *objix_hdr = (spiffs_page_object_ix_header *)fs->work;
- spiffs_page_object_ix *objix = (spiffs_page_object_ix *)fs->work;
- spiffs_page_header p_hdr;
-
- spiffs_span_ix cur_objix_spix = 0;
- spiffs_span_ix prev_objix_spix = (spiffs_span_ix)-1;
- spiffs_page_ix cur_objix_pix = fd->objix_hdr_pix;
- spiffs_page_ix new_objix_hdr_pix;
-
- spiffs_span_ix data_spix = offset / SPIFFS_DATA_PAGE_SIZE(fs);
- spiffs_page_ix data_pix;
- u32_t page_offs = offset % SPIFFS_DATA_PAGE_SIZE(fs);
-
-
- // write all data
- while (res == SPIFFS_OK && written < len) {
- // calculate object index page span index
- cur_objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
-
- // handle storing and loading of object indices
- if (cur_objix_spix != prev_objix_spix) {
- // new object index page
- // within this clause we return directly if something fails, object index mess-up
- if (written > 0) {
- // store previous object index (header) page, unless first pass
- if (prev_objix_spix == 0) {
- // store previous object index header page
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, fs->work, 0, 0, &new_objix_hdr_pix);
- SPIFFS_DBG("modify: store modified objix_hdr page, %04x:%04x, written %d\n", new_objix_hdr_pix, 0, written);
- SPIFFS_CHECK_RES(res);
- } else {
- // store new version of previous object index page
- spiffs_page_ix new_objix_pix;
-
- res = spiffs_page_index_check(fs, fd, cur_objix_pix, prev_objix_spix);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_page_move(fs, fd->file_nbr, (u8_t*)objix, fd->obj_id, 0, cur_objix_pix, &new_objix_pix);
- SPIFFS_DBG("modify: store previous modified objix page, %04x:%04x, written %d\n", new_objix_pix, objix->p_hdr.span_ix, written);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD, fd->obj_id, objix->p_hdr.span_ix, new_objix_pix, 0);
- }
- }
-
- // load next object index page
- if (cur_objix_spix == 0) {
- // load object index header page, must exist
- SPIFFS_DBG("modify: load objixhdr page %04x:%04x\n", cur_objix_pix, cur_objix_spix);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, cur_objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix_hdr->p_hdr, fd->obj_id, cur_objix_spix);
- } else {
- // load existing object index page on first pass
- spiffs_page_ix pix;
- SPIFFS_DBG("modify: find objix span_ix:%04x\n", cur_objix_spix);
- if (fd->cursor_objix_spix == cur_objix_spix) {
- pix = fd->cursor_objix_pix;
- } else {
- res = spiffs_obj_lu_find_id_and_span(fs, fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG, cur_objix_spix, 0, &pix);
- SPIFFS_CHECK_RES(res);
- }
- SPIFFS_DBG("modify: found object index at page %04x\n", pix);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix_hdr->p_hdr, fd->obj_id, cur_objix_spix);
- cur_objix_pix = pix;
- }
- fd->cursor_objix_pix = cur_objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
- fd->offset = offset+written;
- prev_objix_spix = cur_objix_spix;
- }
-
- // write partial data
- u32_t to_write = MIN(len-written, SPIFFS_DATA_PAGE_SIZE(fs) - page_offs);
- spiffs_page_ix orig_data_pix;
- if (cur_objix_spix == 0) {
- // get data page from object index header page
- orig_data_pix = ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix];
- } else {
- // get data page from object index page
- orig_data_pix = ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)];
- }
-
- p_hdr.obj_id = fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- p_hdr.span_ix = data_spix;
- p_hdr.flags = 0xff;
- if (page_offs == 0 && to_write == SPIFFS_DATA_PAGE_SIZE(fs)) {
- // a full page, allocate and write a new page of data
- res = spiffs_page_allocate_data(fs, fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG,
- &p_hdr, &data[written], to_write, page_offs, 1, &data_pix);
- SPIFFS_DBG("modify: store new data page, %04x:%04x offset:%d, len %d, written %d\n", data_pix, data_spix, page_offs, to_write, written);
- } else {
- // write to existing page, allocate new and copy unmodified data
-
- res = spiffs_page_data_check(fs, fd, orig_data_pix, data_spix);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_page_allocate_data(fs, fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG,
- &p_hdr, 0, 0, 0, 0, &data_pix);
- if (res != SPIFFS_OK) break;
-
- // copy unmodified data
- if (page_offs > 0) {
- // before modification
- res = spiffs_phys_cpy(fs, fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + sizeof(spiffs_page_header),
- SPIFFS_PAGE_TO_PADDR(fs, orig_data_pix) + sizeof(spiffs_page_header),
- page_offs);
- if (res != SPIFFS_OK) break;
- }
- if (page_offs + to_write < SPIFFS_DATA_PAGE_SIZE(fs)) {
- // after modification
- res = spiffs_phys_cpy(fs, fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + sizeof(spiffs_page_header) + page_offs + to_write,
- SPIFFS_PAGE_TO_PADDR(fs, orig_data_pix) + sizeof(spiffs_page_header) + page_offs + to_write,
- SPIFFS_DATA_PAGE_SIZE(fs) - (page_offs + to_write));
- if (res != SPIFFS_OK) break;
- }
-
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + sizeof(spiffs_page_header) + page_offs, to_write, &data[written]);
- if (res != SPIFFS_OK) break;
- p_hdr.flags &= ~SPIFFS_PH_FLAG_FINAL;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&p_hdr.flags);
- if (res != SPIFFS_OK) break;
-
- SPIFFS_DBG("modify: store to existing data page, src:%04x, dst:%04x:%04x offset:%d, len %d, written %d\n", orig_data_pix, data_pix, data_spix, page_offs, to_write, written);
- }
-
- // delete original data page
- res = spiffs_page_delete(fs, orig_data_pix);
- if (res != SPIFFS_OK) break;
- // update memory representation of object index page with new data page
- if (cur_objix_spix == 0) {
- // update object index header page
- ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix] = data_pix;
- SPIFFS_DBG("modify: wrote page %04x to objix_hdr entry %02x in mem\n", data_pix, data_spix);
- } else {
- // update object index page
- ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)] = data_pix;
- SPIFFS_DBG("modify: wrote page %04x to objix entry %02x in mem\n", data_pix, SPIFFS_OBJ_IX_ENTRY(fs, data_spix));
- }
-
- // update internals
- page_offs = 0;
- data_spix++;
- written += to_write;
- } // while all data
-
- fd->offset = offset+written;
- fd->cursor_objix_pix = cur_objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
-
- // finalize updated object indices
- s32_t res2 = SPIFFS_OK;
- if (cur_objix_spix != 0) {
- // wrote beyond object index header page
- // write last modified object index page
- // move and update page
- spiffs_page_ix new_objix_pix;
-
- res2 = spiffs_page_index_check(fs, fd, cur_objix_pix, cur_objix_spix);
- SPIFFS_CHECK_RES(res2);
-
- res2 = spiffs_page_move(fs, fd->file_nbr, (u8_t*)objix, fd->obj_id, 0, cur_objix_pix, &new_objix_pix);
- SPIFFS_DBG("modify: store modified objix page, %04x:%04x, written %d\n", new_objix_pix, cur_objix_spix, written);
- fd->cursor_objix_pix = new_objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
- SPIFFS_CHECK_RES(res2);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD, fd->obj_id, objix->p_hdr.span_ix, new_objix_pix, 0);
-
- } else {
- // wrote within object index header page
- res2 = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, fs->work, 0, 0, &new_objix_hdr_pix);
- SPIFFS_DBG("modify: store modified objix_hdr page, %04x:%04x, written %d\n", new_objix_hdr_pix, 0, written);
- SPIFFS_CHECK_RES(res2);
- }
-
- return res;
-}
-
-static s32_t spiffs_object_find_object_index_header_by_name_v(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_block_ix bix,
- int ix_entry,
- u32_t user_data,
- void *user_p) {
- (void)user_data;
- s32_t res;
- spiffs_page_object_ix_header objix_hdr;
- spiffs_page_ix pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, ix_entry);
- if (obj_id == SPIFFS_OBJ_ID_FREE || obj_id == SPIFFS_OBJ_ID_DELETED ||
- (obj_id & SPIFFS_OBJ_ID_IX_FLAG) == 0) {
- return SPIFFS_VIS_COUNTINUE;
- }
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, pix), sizeof(spiffs_page_object_ix_header), (u8_t *)&objix_hdr);
- SPIFFS_CHECK_RES(res);
- if (objix_hdr.p_hdr.span_ix == 0 &&
- (objix_hdr.p_hdr.flags & (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_IXDELE)) ==
- (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_IXDELE)) {
- if (strcmp((char *)user_p, (char *)objix_hdr.name) == 0) {
- return SPIFFS_OK;
- }
- }
-
- return SPIFFS_VIS_COUNTINUE;
-}
-
-// Finds object index header page by name
-s32_t spiffs_object_find_object_index_header_by_name(
- spiffs *fs,
- u8_t name[SPIFFS_OBJ_NAME_LEN],
- spiffs_page_ix *pix) {
- s32_t res;
- spiffs_block_ix bix;
- int entry;
-
- res = spiffs_obj_lu_find_entry_visitor(fs,
- fs->cursor_block_ix,
- fs->cursor_obj_lu_entry,
- 0,
- 0,
- spiffs_object_find_object_index_header_by_name_v,
- 0,
- name,
- &bix,
- &entry);
-
- if (res == SPIFFS_VIS_END) {
- res = SPIFFS_ERR_NOT_FOUND;
- }
- SPIFFS_CHECK_RES(res);
-
- if (pix) {
- *pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, entry);
- }
-
- fs->cursor_block_ix = bix;
- fs->cursor_obj_lu_entry = entry;
-
- return res;
-}
-
-// Truncates object to new size. If new size is null, object may be removed totally
-s32_t spiffs_object_truncate(
- spiffs_fd *fd,
- u32_t new_size,
- u8_t remove) {
- s32_t res = SPIFFS_OK;
- spiffs *fs = fd->fs;
-
- res = spiffs_gc_check(fs, remove ? 0 : SPIFFS_DATA_PAGE_SIZE(fs));
- SPIFFS_CHECK_RES(res);
-
- spiffs_page_ix objix_pix = fd->objix_hdr_pix;
- spiffs_span_ix data_spix = (fd->size > 0 ? fd->size-1 : 0) / SPIFFS_DATA_PAGE_SIZE(fs);
- u32_t cur_size = fd->size == (u32_t)SPIFFS_UNDEFINED_LEN ? 0 : fd->size ;
- spiffs_span_ix cur_objix_spix = 0;
- spiffs_span_ix prev_objix_spix = (spiffs_span_ix)-1;
- spiffs_page_object_ix_header *objix_hdr = (spiffs_page_object_ix_header *)fs->work;
- spiffs_page_object_ix *objix = (spiffs_page_object_ix *)fs->work;
- spiffs_page_ix data_pix;
- spiffs_page_ix new_objix_hdr_pix;
-
- // before truncating, check if object is to be fully removed and mark this
- if (remove && new_size == 0) {
- u8_t flags = ~( SPIFFS_PH_FLAG_USED | SPIFFS_PH_FLAG_INDEX | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_IXDELE);
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_UPDT,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, fd->objix_hdr_pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&flags);
- SPIFFS_CHECK_RES(res);
- }
-
- // delete from end of object until desired len is reached
- while (cur_size > new_size) {
- cur_objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
-
- // put object index for current data span index in work buffer
- if (prev_objix_spix != cur_objix_spix) {
- if (prev_objix_spix != (spiffs_span_ix)-1) {
- // remove previous object index page
- SPIFFS_DBG("truncate: delete objix page %04x:%04x\n", objix_pix, prev_objix_spix);
-
- res = spiffs_page_index_check(fs, fd, objix_pix, prev_objix_spix);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_page_delete(fs, objix_pix);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_DEL, fd->obj_id, objix->p_hdr.span_ix, objix_pix, 0);
- if (prev_objix_spix > 0) {
- // update object index header page
- SPIFFS_DBG("truncate: update objix hdr page %04x:%04x to size %d\n", fd->objix_hdr_pix, prev_objix_spix, cur_size);
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, 0, 0, cur_size, &new_objix_hdr_pix);
- SPIFFS_CHECK_RES(res);
- fd->size = cur_size;
- }
- }
- // load current object index (header) page
- if (cur_objix_spix == 0) {
- objix_pix = fd->objix_hdr_pix;
- } else {
- res = spiffs_obj_lu_find_id_and_span(fs, fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG, cur_objix_spix, 0, &objix_pix);
- SPIFFS_CHECK_RES(res);
- }
-
- SPIFFS_DBG("truncate: load objix page %04x:%04x for data spix:%04x\n", objix_pix, cur_objix_spix, data_spix);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix_hdr->p_hdr, fd->obj_id, cur_objix_spix);
- fd->cursor_objix_pix = objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
- fd->offset = cur_size;
-
- prev_objix_spix = cur_objix_spix;
- }
-
- if (cur_objix_spix == 0) {
- // get data page from object index header page
- data_pix = ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix];
- ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix] = SPIFFS_OBJ_ID_FREE;
- } else {
- // get data page from object index page
- data_pix = ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)];
- ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)] = SPIFFS_OBJ_ID_FREE;
- }
-
- SPIFFS_DBG("truncate: got data pix %04x\n", data_pix);
-
- if (cur_size - SPIFFS_DATA_PAGE_SIZE(fs) >= new_size) {
- // delete full data page
- res = spiffs_page_data_check(fs, fd, data_pix, data_spix);
- if (res != SPIFFS_ERR_DELETED && res != SPIFFS_OK && res != SPIFFS_ERR_INDEX_REF_FREE) {
- SPIFFS_DBG("truncate: err validating data pix %d\n", res);
- break;
- }
-
- if (res == SPIFFS_OK) {
- res = spiffs_page_delete(fs, data_pix);
- if (res != SPIFFS_OK) {
- SPIFFS_DBG("truncate: err deleting data pix %d\n", res);
- break;
- }
- } else if (res == SPIFFS_ERR_DELETED || res == SPIFFS_ERR_INDEX_REF_FREE) {
- res = SPIFFS_OK;
- }
-
- // update current size
- if (cur_size % SPIFFS_DATA_PAGE_SIZE(fs) == 0) {
- cur_size -= SPIFFS_DATA_PAGE_SIZE(fs);
- } else {
- cur_size -= cur_size % SPIFFS_DATA_PAGE_SIZE(fs);
- }
- fd->size = cur_size;
- fd->offset = cur_size;
- SPIFFS_DBG("truncate: delete data page %04x for data spix:%04x, cur_size:%d\n", data_pix, data_spix, cur_size);
- } else {
- // delete last page, partially
- spiffs_page_header p_hdr;
- spiffs_page_ix new_data_pix;
- u32_t bytes_to_remove = SPIFFS_DATA_PAGE_SIZE(fs) - (new_size % SPIFFS_DATA_PAGE_SIZE(fs));
- SPIFFS_DBG("truncate: delete %d bytes from data page %04x for data spix:%04x, cur_size:%d\n", bytes_to_remove, data_pix, data_spix, cur_size);
-
- res = spiffs_page_data_check(fs, fd, data_pix, data_spix);
- if (res != SPIFFS_OK) break;
-
- p_hdr.obj_id = fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG;
- p_hdr.span_ix = data_spix;
- p_hdr.flags = 0xff;
- // allocate new page and copy unmodified data
- res = spiffs_page_allocate_data(fs, fd->obj_id & ~SPIFFS_OBJ_ID_IX_FLAG,
- &p_hdr, 0, 0, 0, 0, &new_data_pix);
- if (res != SPIFFS_OK) break;
- res = spiffs_phys_cpy(fs, 0,
- SPIFFS_PAGE_TO_PADDR(fs, new_data_pix) + sizeof(spiffs_page_header),
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + sizeof(spiffs_page_header),
- SPIFFS_DATA_PAGE_SIZE(fs) - bytes_to_remove);
- if (res != SPIFFS_OK) break;
- // delete original data page
- res = spiffs_page_delete(fs, data_pix);
- if (res != SPIFFS_OK) break;
- p_hdr.flags &= ~SPIFFS_PH_FLAG_FINAL;
- res = _spiffs_wr(fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_UPDT,
- fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, new_data_pix) + offsetof(spiffs_page_header, flags),
- sizeof(u8_t),
- (u8_t *)&p_hdr.flags);
- if (res != SPIFFS_OK) break;
-
- // update memory representation of object index page with new data page
- if (cur_objix_spix == 0) {
- // update object index header page
- ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix] = new_data_pix;
- SPIFFS_DBG("truncate: wrote page %04x to objix_hdr entry %02x in mem\n", new_data_pix, SPIFFS_OBJ_IX_ENTRY(fs, data_spix));
- } else {
- // update object index page
- ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)] = new_data_pix;
- SPIFFS_DBG("truncate: wrote page %04x to objix entry %02x in mem\n", new_data_pix, SPIFFS_OBJ_IX_ENTRY(fs, data_spix));
- }
- cur_size = new_size;
- fd->size = new_size;
- fd->offset = cur_size;
- break;
- }
- data_spix--;
- } // while all data
-
- // update object indices
- if (cur_objix_spix == 0) {
- // update object index header page
- if (cur_size == 0) {
- if (remove) {
- // remove object altogether
- SPIFFS_DBG("truncate: remove object index header page %04x\n", objix_pix);
-
- res = spiffs_page_index_check(fs, fd, objix_pix, 0);
- SPIFFS_CHECK_RES(res);
-
- res = spiffs_page_delete(fs, objix_pix);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_DEL, fd->obj_id, 0, objix_pix, 0);
- } else {
- // make uninitialized object
- SPIFFS_DBG("truncate: reset objix_hdr page %04x\n", objix_pix);
- c_memset(fs->work + sizeof(spiffs_page_object_ix_header), 0xff,
- SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_page_object_ix_header));
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- objix_pix, fs->work, 0, SPIFFS_UNDEFINED_LEN, &new_objix_hdr_pix);
- SPIFFS_CHECK_RES(res);
- }
- } else {
- // update object index header page
- SPIFFS_DBG("truncate: update object index header page with indices and size\n");
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- objix_pix, fs->work, 0, cur_size, &new_objix_hdr_pix);
- SPIFFS_CHECK_RES(res);
- }
- } else {
- // update both current object index page and object index header page
- spiffs_page_ix new_objix_pix;
-
- res = spiffs_page_index_check(fs, fd, objix_pix, cur_objix_spix);
- SPIFFS_CHECK_RES(res);
-
- // move and update object index page
- res = spiffs_page_move(fs, fd->file_nbr, (u8_t*)objix_hdr, fd->obj_id, 0, objix_pix, &new_objix_pix);
- SPIFFS_CHECK_RES(res);
- spiffs_cb_object_event(fs, fd, SPIFFS_EV_IX_UPD, fd->obj_id, objix->p_hdr.span_ix, new_objix_pix, 0);
- SPIFFS_DBG("truncate: store modified objix page, %04x:%04x\n", new_objix_pix, cur_objix_spix);
- fd->cursor_objix_pix = new_objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
- fd->offset = cur_size;
- // update object index header page with new size
- res = spiffs_object_update_index_hdr(fs, fd, fd->obj_id,
- fd->objix_hdr_pix, 0, 0, cur_size, &new_objix_hdr_pix);
- SPIFFS_CHECK_RES(res);
- }
- fd->size = cur_size;
-
- return res;
-}
-
-s32_t spiffs_object_read(
- spiffs_fd *fd,
- u32_t offset,
- u32_t len,
- u8_t *dst) {
- s32_t res = SPIFFS_OK;
- spiffs *fs = fd->fs;
- spiffs_page_ix objix_pix;
- spiffs_page_ix data_pix;
- spiffs_span_ix data_spix = offset / SPIFFS_DATA_PAGE_SIZE(fs);
- u32_t cur_offset = offset;
- spiffs_span_ix cur_objix_spix;
- spiffs_span_ix prev_objix_spix = (spiffs_span_ix)-1;
- spiffs_page_object_ix_header *objix_hdr = (spiffs_page_object_ix_header *)fs->work;
- spiffs_page_object_ix *objix = (spiffs_page_object_ix *)fs->work;
-
- while (cur_offset < offset + len) {
- cur_objix_spix = SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, data_spix);
- if (prev_objix_spix != cur_objix_spix) {
- // load current object index (header) page
- if (cur_objix_spix == 0) {
- objix_pix = fd->objix_hdr_pix;
- } else {
- SPIFFS_DBG("read: find objix %04x:%04x\n", fd->obj_id, cur_objix_spix);
- res = spiffs_obj_lu_find_id_and_span(fs, fd->obj_id | SPIFFS_OBJ_ID_IX_FLAG, cur_objix_spix, 0, &objix_pix);
- SPIFFS_CHECK_RES(res);
- }
- SPIFFS_DBG("read: load objix page %04x:%04x for data spix:%04x\n", objix_pix, cur_objix_spix, data_spix);
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ,
- fd->file_nbr, SPIFFS_PAGE_TO_PADDR(fs, objix_pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), fs->work);
- SPIFFS_CHECK_RES(res);
- SPIFFS_VALIDATE_OBJIX(objix->p_hdr, fd->obj_id, cur_objix_spix);
-
- fd->offset = cur_offset;
- fd->cursor_objix_pix = objix_pix;
- fd->cursor_objix_spix = cur_objix_spix;
-
- prev_objix_spix = cur_objix_spix;
- }
-
- if (cur_objix_spix == 0) {
- // get data page from object index header page
- data_pix = ((spiffs_page_ix*)((u8_t *)objix_hdr + sizeof(spiffs_page_object_ix_header)))[data_spix];
- } else {
- // get data page from object index page
- data_pix = ((spiffs_page_ix*)((u8_t *)objix + sizeof(spiffs_page_object_ix)))[SPIFFS_OBJ_IX_ENTRY(fs, data_spix)];
- }
-
- // all remaining data
- u32_t len_to_read = offset + len - cur_offset;
- // remaining data in page
- len_to_read = MIN(len_to_read, SPIFFS_DATA_PAGE_SIZE(fs) - (cur_offset % SPIFFS_DATA_PAGE_SIZE(fs)));
- // remaining data in file
- len_to_read = MIN(len_to_read, fd->size);
- SPIFFS_DBG("read: offset:%d rd:%d data spix:%04x is data_pix:%04x addr:%08x\n", cur_offset, len_to_read, data_spix, data_pix,
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + sizeof(spiffs_page_header) + (cur_offset % SPIFFS_DATA_PAGE_SIZE(fs)));
- if (len_to_read <= 0) {
- res = SPIFFS_ERR_END_OF_OBJECT;
- break;
- }
- res = spiffs_page_data_check(fs, fd, data_pix, data_spix);
- SPIFFS_CHECK_RES(res);
- res = _spiffs_rd(
- fs, SPIFFS_OP_T_OBJ_DA | SPIFFS_OP_C_READ,
- fd->file_nbr,
- SPIFFS_PAGE_TO_PADDR(fs, data_pix) + sizeof(spiffs_page_header) + (cur_offset % SPIFFS_DATA_PAGE_SIZE(fs)),
- len_to_read,
- dst);
- SPIFFS_CHECK_RES(res);
- dst += len_to_read;
- cur_offset += len_to_read;
- fd->offset = cur_offset;
- data_spix++;
- }
-
- return res;
-}
-
-typedef struct {
- spiffs_obj_id min_obj_id;
- spiffs_obj_id max_obj_id;
- u32_t compaction;
- const u8_t *conflicting_name;
-} spiffs_free_obj_id_state;
-
-static s32_t spiffs_obj_lu_find_free_obj_id_bitmap_v(spiffs *fs, spiffs_obj_id id, spiffs_block_ix bix, int ix_entry,
- u32_t user_data, void *user_p) {
- if (id != SPIFFS_OBJ_ID_FREE && id != SPIFFS_OBJ_ID_DELETED) {
- spiffs_obj_id min_obj_id = user_data;
- u8_t *conflicting_name = (u8_t *)user_p;
-
- // if conflicting name parameter is given, also check if this name is found in object index hdrs
- if (conflicting_name && (id & SPIFFS_OBJ_ID_IX_FLAG)) {
- spiffs_page_ix pix = SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, bix, ix_entry);
- int res;
- spiffs_page_object_ix_header objix_hdr;
- res = _spiffs_rd(fs, SPIFFS_OP_T_OBJ_LU2 | SPIFFS_OP_C_READ,
- 0, SPIFFS_PAGE_TO_PADDR(fs, pix), sizeof(spiffs_page_object_ix_header), (u8_t *)&objix_hdr);
- SPIFFS_CHECK_RES(res);
- if (objix_hdr.p_hdr.span_ix == 0 &&
- (objix_hdr.p_hdr.flags & (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_FINAL | SPIFFS_PH_FLAG_IXDELE)) ==
- (SPIFFS_PH_FLAG_DELET | SPIFFS_PH_FLAG_IXDELE)) {
- if (strcmp((char *)user_p, (char *)objix_hdr.name) == 0) {
- return SPIFFS_ERR_CONFLICTING_NAME;
- }
- }
- }
-
- id &= ~SPIFFS_OBJ_ID_IX_FLAG;
- u32_t bit_ix = (id-min_obj_id) & 7;
- int byte_ix = (id-min_obj_id) >> 3;
- if (byte_ix >= 0 && (u32_t)byte_ix < SPIFFS_CFG_LOG_PAGE_SZ(fs)) {
- fs->work[byte_ix] |= (1<conflicting_name && strcmp((const char *)state->conflicting_name, (char *)objix_hdr.name) == 0) {
- return SPIFFS_ERR_CONFLICTING_NAME;
- }
-
- id &= ~SPIFFS_OBJ_ID_IX_FLAG;
- if (id >= state->min_obj_id && id <= state->max_obj_id) {
- u8_t *map = (u8_t *)fs->work;
- int ix = (id - state->min_obj_id) / state->compaction;
- //SPIFFS_DBG("free_obj_id: add ix %d for id %04x min:%04x max%04x comp:%d\n", ix, id, state->min_obj_id, state->max_obj_id, state->compaction);
- map[ix]++;
- }
- }
- }
- return SPIFFS_VIS_COUNTINUE;
-}
-
-// Scans thru all object lookup for object index header pages. If total possible number of
-// object ids cannot fit into a work buffer, these are grouped. When a group containing free
-// object ids is found, the object lu is again scanned for object ids within group and bitmasked.
-// Finally, the bitmasked is searched for a free id
-s32_t spiffs_obj_lu_find_free_obj_id(spiffs *fs, spiffs_obj_id *obj_id, u8_t *conflicting_name) {
- s32_t res = SPIFFS_OK;
- u32_t max_objects = (SPIFFS_CFG_PHYS_SZ(fs) / (u32_t)SPIFFS_CFG_LOG_PAGE_SZ(fs)) / 2;
- spiffs_free_obj_id_state state;
- spiffs_obj_id free_obj_id = SPIFFS_OBJ_ID_FREE;
- state.min_obj_id = 1;
- state.max_obj_id = max_objects + 1;
- if (state.max_obj_id & SPIFFS_OBJ_ID_IX_FLAG) {
- state.max_obj_id = ((spiffs_obj_id)-1) & ~SPIFFS_OBJ_ID_IX_FLAG;
- }
- state.compaction = 0;
- state.conflicting_name = conflicting_name;
- while (res == SPIFFS_OK && free_obj_id == SPIFFS_OBJ_ID_FREE) {
- if (state.max_obj_id - state.min_obj_id <= (spiffs_obj_id)SPIFFS_CFG_LOG_PAGE_SZ(fs)*8) {
- // possible to represent in bitmap
- u32_t i, j;
- SPIFFS_DBG("free_obj_id: BITM min:%04x max:%04x\n", state.min_obj_id, state.max_obj_id);
-
- c_memset(fs->work, 0, SPIFFS_CFG_LOG_PAGE_SZ(fs));
- res = spiffs_obj_lu_find_entry_visitor(fs, 0, 0, 0, 0, spiffs_obj_lu_find_free_obj_id_bitmap_v, state.min_obj_id,
- conflicting_name, 0, 0);
- if (res == SPIFFS_VIS_END) res = SPIFFS_OK;
- SPIFFS_CHECK_RES(res);
- // traverse bitmask until found free obj_id
- for (i = 0; i < SPIFFS_CFG_LOG_PAGE_SZ(fs); i++) {
- u8_t mask = fs->work[i];
- if (mask == 0xff) {
- continue;
- }
- for (j = 0; j < 8; j++) {
- if ((mask & (1<work;
- u8_t min_count = 0xff;
-
- for (i = 0; i < SPIFFS_CFG_LOG_PAGE_SZ(fs)/sizeof(u8_t); i++) {
- if (map[i] < min_count) {
- min_count = map[i];
- min_i = i;
- if (min_count == 0) {
- break;
- }
- }
- }
-
- if (min_count == state.compaction) {
- // there are no free objids!
- SPIFFS_DBG("free_obj_id: compacted table is full\n");
- return SPIFFS_ERR_FULL;
- }
-
- SPIFFS_DBG("free_obj_id: COMP select index:%d min_count:%d min:%04x max:%04x compact:%d\n", min_i, min_count, state.min_obj_id, state.max_obj_id, state.compaction);
-
- if (min_count == 0) {
- // no id in this range, skip compacting and use directly
- *obj_id = min_i * state.compaction + state.min_obj_id;
- return SPIFFS_OK;
- } else {
- SPIFFS_DBG("free_obj_id: COMP SEL chunk:%04x min:%04x -> %04x\n", state.compaction, state.min_obj_id, state.min_obj_id + min_i * state.compaction);
- state.min_obj_id += min_i * state.compaction;
- state.max_obj_id = state.min_obj_id + state.compaction;
- // decrease compaction
- }
- if ((state.max_obj_id - state.min_obj_id <= (spiffs_obj_id)SPIFFS_CFG_LOG_PAGE_SZ(fs)*8)) {
- // no need for compacting, use bitmap
- continue;
- }
- }
- // in a work memory of log_page_size bytes, we may fit in log_page_size ids
- // todo what if compaction is > 255 - then we cannot fit it in a byte
- state.compaction = (state.max_obj_id-state.min_obj_id) / ((SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(u8_t)));
- SPIFFS_DBG("free_obj_id: COMP min:%04x max:%04x compact:%d\n", state.min_obj_id, state.max_obj_id, state.compaction);
-
- c_memset(fs->work, 0, SPIFFS_CFG_LOG_PAGE_SZ(fs));
- res = spiffs_obj_lu_find_entry_visitor(fs, 0, 0, 0, 0, spiffs_obj_lu_find_free_obj_id_compact_v, 0, &state, 0, 0);
- if (res == SPIFFS_VIS_END) res = SPIFFS_OK;
- SPIFFS_CHECK_RES(res);
- state.conflicting_name = 0; // searched for conflicting name once, no need to do it again
- }
- }
-
- return res;
-}
-
-s32_t spiffs_fd_find_new(spiffs *fs, spiffs_fd **fd) {
- u32_t i;
- spiffs_fd *fds = (spiffs_fd *)fs->fd_space;
- for (i = 0; i < fs->fd_count; i++) {
- spiffs_fd *cur_fd = &fds[i];
- if (cur_fd->file_nbr == 0) {
- cur_fd->file_nbr = i+1;
- *fd = cur_fd;
- return SPIFFS_OK;
- }
- }
- return SPIFFS_ERR_OUT_OF_FILE_DESCS;
-}
-
-s32_t spiffs_fd_return(spiffs *fs, spiffs_file f) {
- if (f <= 0 || f > (s16_t)fs->fd_count) {
- return SPIFFS_ERR_BAD_DESCRIPTOR;
- }
- spiffs_fd *fds = (spiffs_fd *)fs->fd_space;
- spiffs_fd *fd = &fds[f-1];
- if (fd->file_nbr == 0) {
- return SPIFFS_ERR_FILE_CLOSED;
- }
- fd->file_nbr = 0;
- return SPIFFS_OK;
-}
-
-s32_t spiffs_fd_get(spiffs *fs, spiffs_file f, spiffs_fd **fd) {
- if (f <= 0 || f > (s16_t)fs->fd_count) {
- return SPIFFS_ERR_BAD_DESCRIPTOR;
- }
- spiffs_fd *fds = (spiffs_fd *)fs->fd_space;
- *fd = &fds[f-1];
- if ((*fd)->file_nbr == 0) {
- return SPIFFS_ERR_FILE_CLOSED;
- }
- return SPIFFS_OK;
-}
diff --git a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_nucleus.h b/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_nucleus.h
deleted file mode 100644
index 5d905fe9..00000000
--- a/sparkfun/esp8266/cores/esp8266/spiffs/spiffs_nucleus.h
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
- * spiffs_nucleus.h
- *
- * Created on: Jun 15, 2013
- * Author: petera
- */
-
-/* SPIFFS layout
- *
- * spiffs is designed for following spi flash characteristics:
- * - only big areas of data (blocks) can be erased
- * - erasing resets all bits in a block to ones
- * - writing pulls ones to zeroes
- * - zeroes cannot be pulled to ones, without erase
- * - wear leveling
- *
- * spiffs is also meant to be run on embedded, memory constraint devices.
- *
- * Entire area is divided in blocks. Entire area is also divided in pages.
- * Each block contains same number of pages. A page cannot be erased, but a
- * block can be erased.
- *
- * Entire area must be block_size * x
- * page_size must be block_size / (2^y) where y > 2
- *
- * ex: area = 1024*1024 bytes, block size = 65536 bytes, page size = 256 bytes
- *
- * BLOCK 0 PAGE 0 object lookup 1
- * PAGE 1 object lookup 2
- * ...
- * PAGE n-1 object lookup n
- * PAGE n object data 1
- * PAGE n+1 object data 2
- * ...
- * PAGE n+m-1 object data m
- *
- * BLOCK 1 PAGE n+m object lookup 1
- * PAGE n+m+1 object lookup 2
- * ...
- * PAGE 2n+m-1 object lookup n
- * PAGE 2n+m object data 1
- * PAGE 2n+m object data 2
- * ...
- * PAGE 2n+2m-1 object data m
- * ...
- *
- * n is number of object lookup pages, which is number of pages needed to index all pages
- * in a block by object id
- * : block_size / page_size * sizeof(obj_id) / page_size
- * m is number data pages, which is number of pages in block minus number of lookup pages
- * : block_size / page_size - block_size / page_size * sizeof(obj_id) / page_size
- * thus, n+m is total number of pages in a block
- * : block_size / page_size
- *
- * ex: n = 65536/256*2/256 = 2, m = 65536/256 - 2 = 254 => n+m = 65536/256 = 256
- *
- * Object lookup pages contain object id entries. Each entry represent the corresponding
- * data page.
- * Assuming a 16 bit object id, an object id being 0xffff represents a free page.
- * An object id being 0x0000 represents a deleted page.
- *
- * ex: page 0 : lookup : 0008 0001 0aaa ffff ffff ffff ffff ffff ..
- * page 1 : lookup : ffff ffff ffff ffff ffff ffff ffff ffff ..
- * page 2 : data : data for object id 0008
- * page 3 : data : data for object id 0001
- * page 4 : data : data for object id 0aaa
- * ...
- *
- *
- * Object data pages can be either object index pages or object content.
- * All object data pages contains a data page header, containing object id and span index.
- * The span index denotes the object page ordering amongst data pages with same object id.
- * This applies to both object index pages (when index spans more than one page of entries),
- * and object data pages.
- * An object index page contains page entries pointing to object content page. The entry index
- * in a object index page correlates to the span index in the actual object data page.
- * The first object index page (span index 0) is called object index header page, and also
- * contains object flags (directory/file), size, object name etc.
- *
- * ex:
- * BLOCK 1
- * PAGE 256: objectl lookup page 1
- * [*123] [ 123] [ 123] [ 123]
- * [ 123] [*123] [ 123] [ 123]
- * [free] [free] [free] [free] ...
- * PAGE 257: objectl lookup page 2
- * [free] [free] [free] [free] ...
- * PAGE 258: object index page (header)
- * obj.id:0123 span.ix:0000 flags:INDEX
- * size:1600 name:ex.txt type:file
- * [259] [260] [261] [262]
- * PAGE 259: object data page
- * obj.id:0123 span.ix:0000 flags:DATA
- * PAGE 260: object data page
- * obj.id:0123 span.ix:0001 flags:DATA
- * PAGE 261: object data page
- * obj.id:0123 span.ix:0002 flags:DATA
- * PAGE 262: object data page
- * obj.id:0123 span.ix:0003 flags:DATA
- * PAGE 263: object index page
- * obj.id:0123 span.ix:0001 flags:INDEX
- * [264] [265] [fre] [fre]
- * [fre] [fre] [fre] [fre]
- * PAGE 264: object data page
- * obj.id:0123 span.ix:0004 flags:DATA
- * PAGE 265: object data page
- * obj.id:0123 span.ix:0005 flags:DATA
- *
- */
-#ifndef SPIFFS_NUCLEUS_H_
-#define SPIFFS_NUCLEUS_H_
-
-#define _SPIFFS_ERR_CHECK_FIRST (SPIFFS_ERR_INTERNAL - 1)
-#define SPIFFS_ERR_CHECK_OBJ_ID_MISM (SPIFFS_ERR_INTERNAL - 1)
-#define SPIFFS_ERR_CHECK_SPIX_MISM (SPIFFS_ERR_INTERNAL - 2)
-#define SPIFFS_ERR_CHECK_FLAGS_BAD (SPIFFS_ERR_INTERNAL - 3)
-#define _SPIFFS_ERR_CHECK_LAST (SPIFFS_ERR_INTERNAL - 4)
-
-#define SPIFFS_VIS_COUNTINUE (SPIFFS_ERR_INTERNAL - 20)
-#define SPIFFS_VIS_COUNTINUE_RELOAD (SPIFFS_ERR_INTERNAL - 21)
-#define SPIFFS_VIS_END (SPIFFS_ERR_INTERNAL - 22)
-
-#define SPIFFS_EV_IX_UPD 0
-#define SPIFFS_EV_IX_NEW 1
-#define SPIFFS_EV_IX_DEL 2
-
-#define SPIFFS_OBJ_ID_IX_FLAG (1<<(8*sizeof(spiffs_obj_id)-1))
-
-#define SPIFFS_UNDEFINED_LEN (u32_t)(-1)
-
-#define SPIFFS_OBJ_ID_DELETED ((spiffs_obj_id)0)
-#define SPIFFS_OBJ_ID_FREE ((spiffs_obj_id)-1)
-
-#define SPIFFS_MAGIC(fs) ((spiffs_obj_id)(0x20140529 ^ SPIFFS_CFG_LOG_PAGE_SZ(fs)))
-
-#define SPIFFS_CONFIG_MAGIC (0x20090315)
-
-#if SPIFFS_SINGLETON == 0
-#define SPIFFS_CFG_LOG_PAGE_SZ(fs) \
- ((fs)->cfg.log_page_size)
-#define SPIFFS_CFG_LOG_BLOCK_SZ(fs) \
- ((fs)->cfg.log_block_size)
-#define SPIFFS_CFG_PHYS_SZ(fs) \
- ((fs)->cfg.phys_size)
-#define SPIFFS_CFG_PHYS_ERASE_SZ(fs) \
- ((fs)->cfg.phys_erase_block)
-#define SPIFFS_CFG_PHYS_ADDR(fs) \
- ((fs)->cfg.phys_addr)
-#endif
-
-// total number of pages
-#define SPIFFS_MAX_PAGES(fs) \
- ( SPIFFS_CFG_PHYS_SZ(fs)/SPIFFS_CFG_LOG_PAGE_SZ(fs) )
-// total number of pages per block, including object lookup pages
-#define SPIFFS_PAGES_PER_BLOCK(fs) \
- ( SPIFFS_CFG_LOG_BLOCK_SZ(fs)/SPIFFS_CFG_LOG_PAGE_SZ(fs) )
-// number of object lookup pages per block
-#define SPIFFS_OBJ_LOOKUP_PAGES(fs) \
- (MAX(1, (SPIFFS_PAGES_PER_BLOCK(fs) * sizeof(spiffs_obj_id)) / SPIFFS_CFG_LOG_PAGE_SZ(fs)) )
-// checks if page index belongs to object lookup
-#define SPIFFS_IS_LOOKUP_PAGE(fs,pix) \
- (((pix) % SPIFFS_PAGES_PER_BLOCK(fs)) < SPIFFS_OBJ_LOOKUP_PAGES(fs))
-// number of object lookup entries in all object lookup pages
-#define SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs) \
- (SPIFFS_PAGES_PER_BLOCK(fs)-SPIFFS_OBJ_LOOKUP_PAGES(fs))
-// converts a block to physical address
-#define SPIFFS_BLOCK_TO_PADDR(fs, block) \
- ( SPIFFS_CFG_PHYS_ADDR(fs) + (block)* SPIFFS_CFG_LOG_BLOCK_SZ(fs) )
-// converts a object lookup entry to page index
-#define SPIFFS_OBJ_LOOKUP_ENTRY_TO_PIX(fs, block, entry) \
- ((block)*SPIFFS_PAGES_PER_BLOCK(fs) + (SPIFFS_OBJ_LOOKUP_PAGES(fs) + entry))
-// converts a object lookup entry to physical address of corresponding page
-#define SPIFFS_OBJ_LOOKUP_ENTRY_TO_PADDR(fs, block, entry) \
- (SPIFFS_BLOCK_TO_PADDR(fs, block) + (SPIFFS_OBJ_LOOKUP_PAGES(fs) + entry) * SPIFFS_CFG_LOG_PAGE_SZ(fs) )
-// converts a page to physical address
-#define SPIFFS_PAGE_TO_PADDR(fs, page) \
- ( SPIFFS_CFG_PHYS_ADDR(fs) + (page) * SPIFFS_CFG_LOG_PAGE_SZ(fs) )
-// converts a physical address to page
-#define SPIFFS_PADDR_TO_PAGE(fs, addr) \
- ( ((addr) - SPIFFS_CFG_PHYS_ADDR(fs)) / SPIFFS_CFG_LOG_PAGE_SZ(fs) )
-// gives index in page for a physical address
-#define SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr) \
- ( ((addr) - SPIFFS_CFG_PHYS_ADDR(fs)) % SPIFFS_CFG_LOG_PAGE_SZ(fs) )
-// returns containing block for given page
-#define SPIFFS_BLOCK_FOR_PAGE(fs, page) \
- ( (page) / SPIFFS_PAGES_PER_BLOCK(fs) )
-// returns starting page for block
-#define SPIFFS_PAGE_FOR_BLOCK(fs, block) \
- ( (block) * SPIFFS_PAGES_PER_BLOCK(fs) )
-// converts page to entry in object lookup page
-#define SPIFFS_OBJ_LOOKUP_ENTRY_FOR_PAGE(fs, page) \
- ( (page) % SPIFFS_PAGES_PER_BLOCK(fs) - SPIFFS_OBJ_LOOKUP_PAGES(fs) )
-// returns data size in a data page
-#define SPIFFS_DATA_PAGE_SIZE(fs) \
- ( SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_page_header) )
-// returns physical address for block's erase count,
-// always in the physical last entry of the last object lookup page
-#define SPIFFS_ERASE_COUNT_PADDR(fs, bix) \
- ( SPIFFS_BLOCK_TO_PADDR(fs, bix) + SPIFFS_OBJ_LOOKUP_PAGES(fs) * SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_obj_id) )
-// returns physical address for block's magic,
-// always in the physical second last entry of the last object lookup page
-#define SPIFFS_MAGIC_PADDR(fs, bix) \
- ( SPIFFS_BLOCK_TO_PADDR(fs, bix) + SPIFFS_OBJ_LOOKUP_PAGES(fs) * SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_obj_id)*2 )
-// checks if there is any room for magic in the object luts
-#define SPIFFS_CHECK_MAGIC_POSSIBLE(fs) \
- ( (SPIFFS_OBJ_LOOKUP_MAX_ENTRIES(fs) % (SPIFFS_CFG_LOG_PAGE_SZ(fs)/sizeof(spiffs_obj_id))) * sizeof(spiffs_obj_id) \
- <= (SPIFFS_CFG_LOG_PAGE_SZ(fs)-sizeof(spiffs_obj_id)*2) )
-
-// define helpers object
-
-// entries in an object header page index
-#define SPIFFS_OBJ_HDR_IX_LEN(fs) \
- ((SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_page_object_ix_header))/sizeof(spiffs_page_ix))
-// entries in an object page index
-#define SPIFFS_OBJ_IX_LEN(fs) \
- ((SPIFFS_CFG_LOG_PAGE_SZ(fs) - sizeof(spiffs_page_object_ix))/sizeof(spiffs_page_ix))
-// object index entry for given data span index
-#define SPIFFS_OBJ_IX_ENTRY(fs, spix) \
- ((spix) < SPIFFS_OBJ_HDR_IX_LEN(fs) ? (spix) : (((spix)-SPIFFS_OBJ_HDR_IX_LEN(fs))%SPIFFS_OBJ_IX_LEN(fs)))
-// object index span index number for given data span index or entry
-#define SPIFFS_OBJ_IX_ENTRY_SPAN_IX(fs, spix) \
- ((spix) < SPIFFS_OBJ_HDR_IX_LEN(fs) ? 0 : (1+((spix)-SPIFFS_OBJ_HDR_IX_LEN(fs))/SPIFFS_OBJ_IX_LEN(fs)))
-
-
-#define SPIFFS_OP_T_OBJ_LU (0<<0)
-#define SPIFFS_OP_T_OBJ_LU2 (1<<0)
-#define SPIFFS_OP_T_OBJ_IX (2<<0)
-#define SPIFFS_OP_T_OBJ_DA (3<<0)
-#define SPIFFS_OP_C_DELE (0<<2)
-#define SPIFFS_OP_C_UPDT (1<<2)
-#define SPIFFS_OP_C_MOVS (2<<2)
-#define SPIFFS_OP_C_MOVD (3<<2)
-#define SPIFFS_OP_C_FLSH (4<<2)
-#define SPIFFS_OP_C_READ (5<<2)
-#define SPIFFS_OP_C_WRTHRU (6<<2)
-
-#define SPIFFS_OP_TYPE_MASK (3<<0)
-#define SPIFFS_OP_COM_MASK (7<<2)
-
-
-// if 0, this page is written to, else clean
-#define SPIFFS_PH_FLAG_USED (1<<0)
-// if 0, writing is finalized, else under modification
-#define SPIFFS_PH_FLAG_FINAL (1<<1)
-// if 0, this is an index page, else a data page
-#define SPIFFS_PH_FLAG_INDEX (1<<2)
-// if 0, page is deleted, else valid
-#define SPIFFS_PH_FLAG_DELET (1<<7)
-// if 0, this index header is being deleted
-#define SPIFFS_PH_FLAG_IXDELE (1<<6)
-
-
-#define SPIFFS_CHECK_MOUNT(fs) \
- ((fs)->mounted != 0)
-
-#define SPIFFS_CHECK_CFG(fs) \
- ((fs)->config_magic == SPIFFS_CONFIG_MAGIC)
-
-#define SPIFFS_CHECK_RES(res) \
- do { \
- if ((res) < SPIFFS_OK) return (res); \
- } while (0);
-
-#define SPIFFS_API_CHECK_MOUNT(fs) \
- if (!SPIFFS_CHECK_MOUNT((fs))) { \
- (fs)->err_code = SPIFFS_ERR_NOT_MOUNTED; \
- return -1; \
- }
-
-#define SPIFFS_API_CHECK_CFG(fs) \
- if (!SPIFFS_CHECK_CFG((fs))) { \
- (fs)->err_code = SPIFFS_ERR_NOT_CONFIGURED; \
- return -1; \
- }
-
-#define SPIFFS_API_CHECK_RES(fs, res) \
- if ((res) < SPIFFS_OK) { \
- (fs)->err_code = (res); \
- return -1; \
- }
-
-#define SPIFFS_API_CHECK_RES_UNLOCK(fs, res) \
- if ((res) < SPIFFS_OK) { \
- (fs)->err_code = (res); \
- SPIFFS_UNLOCK(fs); \
- return -1; \
- }
-
-#define SPIFFS_VALIDATE_OBJIX(ph, objid, spix) \
- if (((ph).flags & SPIFFS_PH_FLAG_USED) != 0) return SPIFFS_ERR_IS_FREE; \
- if (((ph).flags & SPIFFS_PH_FLAG_DELET) == 0) return SPIFFS_ERR_DELETED; \
- if (((ph).flags & SPIFFS_PH_FLAG_FINAL) != 0) return SPIFFS_ERR_NOT_FINALIZED; \
- if (((ph).flags & SPIFFS_PH_FLAG_INDEX) != 0) return SPIFFS_ERR_NOT_INDEX; \
- if (((objid) & SPIFFS_OBJ_ID_IX_FLAG) == 0) return SPIFFS_ERR_NOT_INDEX; \
- if ((ph).span_ix != (spix)) return SPIFFS_ERR_INDEX_SPAN_MISMATCH;
- //if ((spix) == 0 && ((ph).flags & SPIFFS_PH_FLAG_IXDELE) == 0) return SPIFFS_ERR_DELETED;
-
-#define SPIFFS_VALIDATE_DATA(ph, objid, spix) \
- if (((ph).flags & SPIFFS_PH_FLAG_USED) != 0) return SPIFFS_ERR_IS_FREE; \
- if (((ph).flags & SPIFFS_PH_FLAG_DELET) == 0) return SPIFFS_ERR_DELETED; \
- if (((ph).flags & SPIFFS_PH_FLAG_FINAL) != 0) return SPIFFS_ERR_NOT_FINALIZED; \
- if (((ph).flags & SPIFFS_PH_FLAG_INDEX) == 0) return SPIFFS_ERR_IS_INDEX; \
- if ((objid) & SPIFFS_OBJ_ID_IX_FLAG) return SPIFFS_ERR_IS_INDEX; \
- if ((ph).span_ix != (spix)) return SPIFFS_ERR_DATA_SPAN_MISMATCH;
-
-
-// check id
-#define SPIFFS_VIS_CHECK_ID (1<<0)
-// report argument object id to visitor - else object lookup id is reported
-#define SPIFFS_VIS_CHECK_PH (1<<1)
-// stop searching at end of all look up pages
-#define SPIFFS_VIS_NO_WRAP (1<<2)
-
-#if SPIFFS_CACHE
-
-#define SPIFFS_CACHE_FLAG_DIRTY (1<<0)
-#define SPIFFS_CACHE_FLAG_WRTHRU (1<<1)
-#define SPIFFS_CACHE_FLAG_OBJLU (1<<2)
-#define SPIFFS_CACHE_FLAG_OBJIX (1<<3)
-#define SPIFFS_CACHE_FLAG_DATA (1<<4)
-#define SPIFFS_CACHE_FLAG_TYPE_WR (1<<7)
-
-#define SPIFFS_CACHE_PAGE_SIZE(fs) \
- (sizeof(spiffs_cache_page) + SPIFFS_CFG_LOG_PAGE_SZ(fs))
-
-#define spiffs_get_cache(fs) \
- ((spiffs_cache *)((fs)->cache))
-
-#define spiffs_get_cache_page_hdr(fs, c, ix) \
- ((spiffs_cache_page *)(&((c)->cpages[(ix) * SPIFFS_CACHE_PAGE_SIZE(fs)])))
-
-#define spiffs_get_cache_page(fs, c, ix) \
- ((u8_t *)(&((c)->cpages[(ix) * SPIFFS_CACHE_PAGE_SIZE(fs)])) + sizeof(spiffs_cache_page))
-
-// cache page struct
-typedef struct {
- // cache flags
- u8_t flags;
- // cache page index
- u8_t ix;
- // last access of this cache page
- u32_t last_access;
- union {
- // type read cache
- struct {
- // read cache page index
- spiffs_page_ix pix;
- };
-#if SPIFFS_CACHE_WR
- // type write cache
- struct {
- // write cache
- spiffs_obj_id obj_id;
- // offset in cache page
- u32_t offset;
- // size of cache page
- u16_t size;
- };
-#endif
- };
-} spiffs_cache_page;
-
-// cache struct
-typedef struct {
- u8_t cpage_count;
- u32_t last_access;
- u32_t cpage_use_map;
- u32_t cpage_use_mask;
- u8_t *cpages;
-} spiffs_cache;
-
-#endif
-
-
-// spiffs nucleus file descriptor
-typedef struct {
- // the filesystem of this descriptor
- spiffs *fs;
- // number of file descriptor - if 0, the file descriptor is closed
- spiffs_file file_nbr;
- // object id - if SPIFFS_OBJ_ID_ERASED, the file was deleted
- spiffs_obj_id obj_id;
- // size of the file
- u32_t size;
- // cached object index header page index
- spiffs_page_ix objix_hdr_pix;
- // cached offset object index page index
- spiffs_page_ix cursor_objix_pix;
- // cached offset object index span index
- spiffs_span_ix cursor_objix_spix;
- // current absolute offset
- u32_t offset;
- // current file descriptor offset
- u32_t fdoffset;
- // fd flags
- spiffs_flags flags;
-#if SPIFFS_CACHE_WR
- spiffs_cache_page *cache_page;
-#endif
-} spiffs_fd;
-
-
-// object structs
-
-// page header, part of each page except object lookup pages
-// NB: this is always aligned when the data page is an object index,
-// as in this case struct spiffs_page_object_ix is used
-typedef struct __attribute(( packed )) {
- // object id
- spiffs_obj_id obj_id;
- // object span index
- spiffs_span_ix span_ix;
- // flags
- u8_t flags;
-} spiffs_page_header;
-
-// object index header page header
-typedef struct __attribute(( packed ))
-#if SPIFFS_ALIGNED_OBJECT_INDEX_TABLES
- __attribute(( aligned(sizeof(spiffs_page_ix)) ))
-#endif
-{
- // common page header
- spiffs_page_header p_hdr;
- // alignment
- u8_t _align[4 - (sizeof(spiffs_page_header)&3)==0 ? 4 : (sizeof(spiffs_page_header)&3)];
- // size of object
- u32_t size;
- // type of object
- spiffs_obj_type type;
- // name of object
- u8_t name[SPIFFS_OBJ_NAME_LEN];
-} spiffs_page_object_ix_header;
-
-// object index page header
-typedef struct __attribute(( packed )) {
- spiffs_page_header p_hdr;
- u8_t _align[4 - (sizeof(spiffs_page_header)&3)==0 ? 4 : (sizeof(spiffs_page_header)&3)];
-} spiffs_page_object_ix;
-
-// callback func for object lookup visitor
-typedef s32_t (*spiffs_visitor_f)(spiffs *fs, spiffs_obj_id id, spiffs_block_ix bix, int ix_entry,
- u32_t user_data, void *user_p);
-
-
-#if SPIFFS_CACHE
-#define _spiffs_rd(fs, op, fh, addr, len, dst) \
- spiffs_phys_rd((fs), (op), (fh), (addr), (len), (dst))
-#define _spiffs_wr(fs, op, fh, addr, len, src) \
- spiffs_phys_wr((fs), (op), (fh), (addr), (len), (src))
-#else
-#define _spiffs_rd(fs, op, fh, addr, len, dst) \
- spiffs_phys_rd((fs), (addr), (len), (dst))
-#define _spiffs_wr(fs, op, fh, addr, len, src) \
- spiffs_phys_wr((fs), (addr), (len), (src))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-// ---------------
-
-s32_t spiffs_phys_rd(
- spiffs *fs,
-#if SPIFFS_CACHE
- u8_t op,
- spiffs_file fh,
-#endif
- u32_t addr,
- u32_t len,
- u8_t *dst);
-
-s32_t spiffs_phys_wr(
- spiffs *fs,
-#if SPIFFS_CACHE
- u8_t op,
- spiffs_file fh,
-#endif
- u32_t addr,
- u32_t len,
- u8_t *src);
-
-s32_t spiffs_phys_cpy(
- spiffs *fs,
- spiffs_file fh,
- u32_t dst,
- u32_t src,
- u32_t len);
-
-s32_t spiffs_phys_count_free_blocks(
- spiffs *fs);
-
-s32_t spiffs_obj_lu_find_entry_visitor(
- spiffs *fs,
- spiffs_block_ix starting_block,
- int starting_lu_entry,
- u8_t flags,
- spiffs_obj_id obj_id,
- spiffs_visitor_f v,
- u32_t user_data,
- void *user_p,
- spiffs_block_ix *block_ix,
- int *lu_entry);
-
-s32_t spiffs_erase_block(
- spiffs *fs,
- spiffs_block_ix bix);
-
-// ---------------
-
-s32_t spiffs_obj_lu_scan(
- spiffs *fs);
-
-s32_t spiffs_obj_lu_find_free_obj_id(
- spiffs *fs,
- spiffs_obj_id *obj_id,
- u8_t *conflicting_name);
-
-s32_t spiffs_obj_lu_find_free(
- spiffs *fs,
- spiffs_block_ix starting_block,
- int starting_lu_entry,
- spiffs_block_ix *block_ix,
- int *lu_entry);
-
-s32_t spiffs_obj_lu_find_id(
- spiffs *fs,
- spiffs_block_ix starting_block,
- int starting_lu_entry,
- spiffs_obj_id obj_id,
- spiffs_block_ix *block_ix,
- int *lu_entry);
-
-s32_t spiffs_obj_lu_find_id_and_span(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_span_ix spix,
- spiffs_page_ix exclusion_pix,
- spiffs_page_ix *pix);
-
-s32_t spiffs_obj_lu_find_id_and_span_by_phdr(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_span_ix spix,
- spiffs_page_ix exclusion_pix,
- spiffs_page_ix *pix);
-
-// ---------------
-
-s32_t spiffs_page_allocate_data(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_page_header *ph,
- u8_t *data,
- u32_t len,
- u32_t page_offs,
- u8_t finalize,
- spiffs_page_ix *pix);
-
-s32_t spiffs_page_move(
- spiffs *fs,
- spiffs_file fh,
- u8_t *page_data,
- spiffs_obj_id obj_id,
- spiffs_page_header *page_hdr,
- spiffs_page_ix src_pix,
- spiffs_page_ix *dst_pix);
-
-s32_t spiffs_page_delete(
- spiffs *fs,
- spiffs_page_ix pix);
-
-// ---------------
-
-s32_t spiffs_object_create(
- spiffs *fs,
- spiffs_obj_id obj_id,
- u8_t name[SPIFFS_OBJ_NAME_LEN],
- spiffs_obj_type type,
- spiffs_page_ix *objix_hdr_pix);
-
-s32_t spiffs_object_update_index_hdr(
- spiffs *fs,
- spiffs_fd *fd,
- spiffs_obj_id obj_id,
- spiffs_page_ix objix_hdr_pix,
- u8_t *new_objix_hdr_data,
- u8_t name[SPIFFS_OBJ_NAME_LEN],
- u32_t size,
- spiffs_page_ix *new_pix);
-
-void spiffs_cb_object_event(
- spiffs *fs,
- spiffs_fd *fd,
- int ev,
- spiffs_obj_id obj_id,
- spiffs_span_ix spix,
- spiffs_page_ix new_pix,
- u32_t new_size);
-
-s32_t spiffs_object_open_by_id(
- spiffs *fs,
- spiffs_obj_id obj_id,
- spiffs_fd *f,
- spiffs_flags flags,
- spiffs_mode mode);
-
-s32_t spiffs_object_open_by_page(
- spiffs *fs,
- spiffs_page_ix pix,
- spiffs_fd *f,
- spiffs_flags flags,
- spiffs_mode mode);
-
-s32_t spiffs_object_append(
- spiffs_fd *fd,
- u32_t offset,
- u8_t *data,
- u32_t len);
-
-s32_t spiffs_object_modify(
- spiffs_fd *fd,
- u32_t offset,
- u8_t *data,
- u32_t len);
-
-s32_t spiffs_object_read(
- spiffs_fd *fd,
- u32_t offset,
- u32_t len,
- u8_t *dst);
-
-s32_t spiffs_object_truncate(
- spiffs_fd *fd,
- u32_t new_len,
- u8_t remove_object);
-
-s32_t spiffs_object_find_object_index_header_by_name(
- spiffs *fs,
- u8_t name[SPIFFS_OBJ_NAME_LEN],
- spiffs_page_ix *pix);
-
-// ---------------
-
-s32_t spiffs_gc_check(
- spiffs *fs,
- u32_t len);
-
-s32_t spiffs_gc_erase_page_stats(
- spiffs *fs,
- spiffs_block_ix bix);
-
-s32_t spiffs_gc_find_candidate(
- spiffs *fs,
- spiffs_block_ix **block_candidate,
- int *candidate_count,
- char fs_crammed);
-
-s32_t spiffs_gc_clean(
- spiffs *fs,
- spiffs_block_ix bix);
-
-s32_t spiffs_gc_quick(
- spiffs *fs);
-
-// ---------------
-
-s32_t spiffs_fd_find_new(
- spiffs *fs,
- spiffs_fd **fd);
-
-s32_t spiffs_fd_return(
- spiffs *fs,
- spiffs_file f);
-
-s32_t spiffs_fd_get(
- spiffs *fs,
- spiffs_file f,
- spiffs_fd **fd);
-
-#if SPIFFS_CACHE
-void spiffs_cache_init(
- spiffs *fs);
-
-void spiffs_cache_drop_page(
- spiffs *fs,
- spiffs_page_ix pix);
-
-#if SPIFFS_CACHE_WR
-spiffs_cache_page *spiffs_cache_page_allocate_by_fd(
- spiffs *fs,
- spiffs_fd *fd);
-
-void spiffs_cache_fd_release(
- spiffs *fs,
- spiffs_cache_page *cp);
-
-spiffs_cache_page *spiffs_cache_page_get_by_fd(
- spiffs *fs,
- spiffs_fd *fd);
-#endif
-#endif
-
-s32_t spiffs_lookup_consistency_check(
- spiffs *fs,
- u8_t check_all_objects);
-
-s32_t spiffs_page_consistency_check(
- spiffs *fs);
-
-s32_t spiffs_object_index_consistency_check(
- spiffs *fs);
-
-#endif /* SPIFFS_NUCLEUS_H_ */
diff --git a/sparkfun/esp8266/cores/esp8266/user_config.h b/sparkfun/esp8266/cores/esp8266/user_config.h
deleted file mode 100644
index 8b137891..00000000
--- a/sparkfun/esp8266/cores/esp8266/user_config.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/sparkfun/esp8266/cores/esp8266/wiring_private.h b/sparkfun/esp8266/cores/esp8266/wiring_private.h
deleted file mode 100644
index 2c53565a..00000000
--- a/sparkfun/esp8266/cores/esp8266/wiring_private.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- wiring_private.h - Internal header file.
- Part of Arduino - http://www.arduino.cc/
-
- Copyright (c) 2005-2006 David A. Mellis
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA
-
- $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $
- */
-
-#ifndef WiringPrivate_h
-#define WiringPrivate_h
-
-#include
-#include
-
-#include "Arduino.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*voidFuncPtr)(void);
-
-void initPins();
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif
diff --git a/sparkfun/esp8266/firmwares/loader/Makefile b/sparkfun/esp8266/firmwares/loader/Makefile
deleted file mode 100644
index 4306ac05..00000000
--- a/sparkfun/esp8266/firmwares/loader/Makefile
+++ /dev/null
@@ -1,108 +0,0 @@
-SRC_DIR := src
-OBJ_DIR := obj
-BIN_DIR := bin
-
-# todo: define path depending on the platform
-BUILT_IDE_DIR ?= ../../../../../build/macosx/work/Arduino.app/Contents/Java
-
-GIT_REV := $(shell git rev-parse --short HEAD)
-
-CPPFLAGS+=-Iinclude -Isrc/include -DREVISION_STRING=\"$(GIT_REV)\"
-CFLAGS += -std=c99
-CXXFLAGS += -std=c++0x
-
-OBJ_FILES := main.o
-
-OBJ_PATHS := $(addprefix $(SRC_DIR)/,$(OBJ_FILES))
-
-TOOLS_DIR := $(BUILT_IDE_DIR)/hardware/tools/esp8266
-
-XTENSA_TOOCHAIN := $(TOOLS_DIR)/xtensa-lx106-elf/bin
-TOOLCHAIN_PREFIX := $(XTENSA_TOOCHAIN)/xtensa-lx106-elf-
-CC := $(TOOLCHAIN_PREFIX)gcc
-CXX := $(TOOLCHAIN_PREFIX)g++
-AR := $(TOOLCHAIN_PREFIX)ar
-LD := $(TOOLCHAIN_PREFIX)gcc
-OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy
-SIZE := $(TOOLCHAIN_PREFIX)size
-STRIP := $(TOOLCHAIN_PREFIX)strip
-ESPTOOL := $(TOOLS_DIR)/esptool
-
-XTENSA_LIBS ?= $(shell $(CC) -print-sysroot)
-
-SDK_BASE ?= $(TOOLS_DIR)/sdk
-
-CPPFLAGS += -I$(XTENSA_LIBS)/include \
- -I$(SDK_BASE)/include \
- -I$(SRC_DIR)
-
-LDFLAGS += -L$(XTENSA_LIBS)/lib \
- -L$(XTENSA_LIBS)/arch/lib \
- -L$(SDK_BASE)/lib
-
-LIBS := c gcc hal phy net80211 wpa main pp lwip
-
-#-Werror
-CFLAGS += -std=c99 -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals
-CXXFLAGS += -c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD
-
-
-CPPFLAGS += -DESP_PLATFORM=1 -D__ets__ -DICACHE_FLASH
-
-LDFLAGS += -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
-
-LD_SCRIPT := loader.ld
-
-APP_AR:=$(BIN_DIR)/loader.a
-APP_OUT:=$(BIN_DIR)/loader.elf
-APP_FW_S1 := $(BIN_DIR)/_loader_segm_1.bin
-APP_FW_S2 := $(BIN_DIR)/_loader_segm_2.bin
-APP_FW := $(BIN_DIR)/loader.bin
-
-# $(LWIP_AR) : $(LWIP_OBJ_PATHS)
-# for file in $(LWIP_OBJ_PATHS); do \
-# $(OBJCOPY) \
-# --rename-section .text=.irom0.text \
-# --rename-section .literal=.irom0.literal \
-# $$file; \
-# done
-# $(AR) cru $@ $^
-
-$(APP_AR): $(OBJ_PATHS) $(SDK_DRIVER_OBJ_PATHS)
- $(AR) cru $@ $^
-
-$(APP_AR): | $(BIN_DIR)
-
-$(APP_OUT): $(APP_AR) $(LWIP_AR)
- $(LD) -T$(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(addprefix -l,$(LIBS)) $(APP_AR) -Wl,--end-group -o $@
- $(SIZE) -A -x $@ | head -n 7
-
-
-$(APP_FW_S1): $(APP_OUT)
- $(ESPTOOL) -eo $(APP_OUT) -bo $@ -bs .text -bs .data -bs .rodata -bc -ec
-
-$(APP_FW_S2): $(APP_OUT)
- $(ESPTOOL) -eo $(APP_OUT) -es .irom0.text $@ -ec
-
-$(APP_FW): $(APP_FW_S1) $(APP_FW_S2)
- dd if=/dev/zero ibs=4k count=56 | LC_ALL=C tr "\000" "\377" >$(APP_FW)
- dd if=$(APP_FW_S1) of=$(APP_FW) bs=4k seek=0 conv=notrunc
- dd if=$(APP_FW_S2) of=$(APP_FW) bs=4k seek=9 conv=notrunc
-
-firmware: $(APP_FW_S1) $(APP_FW_S2) $(APP_FW)
-
-all: firmware
-
-.PHONY: all firmware
-
-
-$(BIN_DIR):
- mkdir -p $(BIN_DIR)
-
-clean:
- rm -f $(SRC_DIR)/*.o
- rm -f $(SRC_DIR)/*.d
- rm -rf $(BIN_DIR)
-
-.PHONY: clean
-
diff --git a/sparkfun/esp8266/firmwares/loader/bin/_loader_segm_1.bin b/sparkfun/esp8266/firmwares/loader/bin/_loader_segm_1.bin
deleted file mode 100644
index 636d0b61..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/bin/_loader_segm_1.bin and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/bin/_loader_segm_2.bin b/sparkfun/esp8266/firmwares/loader/bin/_loader_segm_2.bin
deleted file mode 100644
index c874a2e2..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/bin/_loader_segm_2.bin and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/bin/loader.a b/sparkfun/esp8266/firmwares/loader/bin/loader.a
deleted file mode 100644
index e0744ada..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/bin/loader.a and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/bin/loader.bin b/sparkfun/esp8266/firmwares/loader/bin/loader.bin
deleted file mode 100644
index ab736ee1..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/bin/loader.bin and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/bin/loader.data.elf b/sparkfun/esp8266/firmwares/loader/bin/loader.data.elf
deleted file mode 100644
index d52ddbed..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/bin/loader.data.elf and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/bin/loader.elf b/sparkfun/esp8266/firmwares/loader/bin/loader.elf
deleted file mode 100644
index 206003fd..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/bin/loader.elf and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/loader.ld b/sparkfun/esp8266/firmwares/loader/loader.ld
deleted file mode 100644
index 88664734..00000000
--- a/sparkfun/esp8266/firmwares/loader/loader.ld
+++ /dev/null
@@ -1,190 +0,0 @@
-/* This linker script generated from xt-genldscripts.tpp for LSP . */
-/* Linker Script for ld -N */
-MEMORY
-{
- dport0_0_seg : org = 0x3FF00000, len = 0x10
- dram0_0_seg : org = 0x3FFE8000, len = 0x14000
- iram1_0_seg : org = 0x40100000, len = 0x8000
- irom0_0_seg : org = 0x40209000, len = 0x29000
-}
-
-PHDRS
-{
- dport0_0_phdr PT_LOAD;
- dram0_0_phdr PT_LOAD;
- dram0_0_bss_phdr PT_LOAD;
- iram1_0_phdr PT_LOAD;
- irom0_0_phdr PT_LOAD;
-}
-
-
-/* Default entry point: */
-ENTRY(call_user_start)
-PROVIDE(_memmap_vecbase_reset = 0x40000000);
-/* Various memory-map dependent cache attribute settings: */
-_memmap_cacheattr_wb_base = 0x00000110;
-_memmap_cacheattr_wt_base = 0x00000110;
-_memmap_cacheattr_bp_base = 0x00000220;
-_memmap_cacheattr_unused_mask = 0xFFFFF00F;
-_memmap_cacheattr_wb_trapnull = 0x2222211F;
-_memmap_cacheattr_wba_trapnull = 0x2222211F;
-_memmap_cacheattr_wbna_trapnull = 0x2222211F;
-_memmap_cacheattr_wt_trapnull = 0x2222211F;
-_memmap_cacheattr_bp_trapnull = 0x2222222F;
-_memmap_cacheattr_wb_strict = 0xFFFFF11F;
-_memmap_cacheattr_wt_strict = 0xFFFFF11F;
-_memmap_cacheattr_bp_strict = 0xFFFFF22F;
-_memmap_cacheattr_wb_allvalid = 0x22222112;
-_memmap_cacheattr_wt_allvalid = 0x22222112;
-_memmap_cacheattr_bp_allvalid = 0x22222222;
-PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
-
-SECTIONS
-{
-
- .dport0.rodata : ALIGN(4)
- {
- _dport0_rodata_start = ABSOLUTE(.);
- *(.dport0.rodata)
- *(.dport.rodata)
- _dport0_rodata_end = ABSOLUTE(.);
- } >dport0_0_seg :dport0_0_phdr
-
- .dport0.literal : ALIGN(4)
- {
- _dport0_literal_start = ABSOLUTE(.);
- *(.dport0.literal)
- *(.dport.literal)
- _dport0_literal_end = ABSOLUTE(.);
- } >dport0_0_seg :dport0_0_phdr
-
- .dport0.data : ALIGN(4)
- {
- _dport0_data_start = ABSOLUTE(.);
- *(.dport0.data)
- *(.dport.data)
- _dport0_data_end = ABSOLUTE(.);
- } >dport0_0_seg :dport0_0_phdr
-
- .data : ALIGN(4)
- {
- _data_start = ABSOLUTE(.);
- *(.data)
- *(.data.*)
- *(.gnu.linkonce.d.*)
- *(.data1)
- *(.sdata)
- *(.sdata.*)
- *(.gnu.linkonce.s.*)
- *(.sdata2)
- *(.sdata2.*)
- *(.gnu.linkonce.s2.*)
- *(.jcr)
- _data_end = ABSOLUTE(.);
- } >dram0_0_seg :dram0_0_phdr
-
- .rodata : ALIGN(4)
- {
- _rodata_start = ABSOLUTE(.);
- *(.rodata)
- *(.rodata.*)
- *(.gnu.linkonce.r.*)
- *(.rodata1)
- __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
- *(.xt_except_table)
- *(.gcc_except_table)
- *(.gnu.linkonce.e.*)
- *(.gnu.version_r)
- *(.eh_frame)
- . = (. + 3) & ~ 3;
- /* C++ constructor and destructor tables, properly ordered: */
- __init_array_start = ABSOLUTE(.);
- KEEP (*crtbegin.o(.ctors))
- KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
- KEEP (*(SORT(.ctors.*)))
- KEEP (*(.ctors))
- __init_array_end = ABSOLUTE(.);
- KEEP (*crtbegin.o(.dtors))
- KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
- KEEP (*(SORT(.dtors.*)))
- KEEP (*(.dtors))
- /* C++ exception handlers table: */
- __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
- *(.xt_except_desc)
- *(.gnu.linkonce.h.*)
- __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
- *(.xt_except_desc_end)
- *(.dynamic)
- *(.gnu.version_d)
- . = ALIGN(4); /* this table MUST be 4-byte aligned */
- _bss_table_start = ABSOLUTE(.);
- LONG(_bss_start)
- LONG(_bss_end)
- _bss_table_end = ABSOLUTE(.);
- _rodata_end = ABSOLUTE(.);
- } >dram0_0_seg :dram0_0_phdr
-
- .bss ALIGN(8) (NOLOAD) : ALIGN(4)
- {
- . = ALIGN (8);
- _bss_start = ABSOLUTE(.);
- *(.dynsbss)
- *(.sbss)
- *(.sbss.*)
- *(.gnu.linkonce.sb.*)
- *(.scommon)
- *(.sbss2)
- *(.sbss2.*)
- *(.gnu.linkonce.sb2.*)
- *(.dynbss)
- *(.bss)
- *(.bss.*)
- *(.gnu.linkonce.b.*)
- *(COMMON)
- . = ALIGN (8);
- _bss_end = ABSOLUTE(.);
- _heap_start = ABSOLUTE(.);
-/* _stack_sentry = ALIGN(0x8); */
- } >dram0_0_seg :dram0_0_bss_phdr
-/* __stack = 0x3ffc8000; */
-
- .irom0.text : ALIGN(4)
- {
- _irom0_text_start = ABSOLUTE(.);
- *core_esp8266_*.o(.literal*, .text*)
- *.cpp.o(.literal*, .text*)
- *libm.a:(.literal .text .literal.* .text.*)
- *libsmartconfig.a:(.literal .text .literal.* .text.*)
- *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
- _irom0_text_end = ABSOLUTE(.);
- } >irom0_0_seg :irom0_0_phdr
-
- .text : ALIGN(4)
- {
- _stext = .;
- _text_start = ABSOLUTE(.);
- *(.entry.text)
- *(.init.literal)
- *(.init)
- *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
- *(.fini.literal)
- *(.fini)
- *(.gnu.version)
- _text_end = ABSOLUTE(.);
- _etext = .;
- } >iram1_0_seg :iram1_0_phdr
-
- .lit4 : ALIGN(4)
- {
- _lit4_start = ABSOLUTE(.);
- *(*.lit4)
- *(.lit4.*)
- *(.gnu.linkonce.lit4.*)
- _lit4_end = ABSOLUTE(.);
- } >iram1_0_seg :iram1_0_phdr
-
-
-}
-
-/* get ROM code address */
-INCLUDE "../ld/eagle.rom.addr.v6.ld"
diff --git a/sparkfun/esp8266/firmwares/loader/src/Common.hpp b/sparkfun/esp8266/firmwares/loader/src/Common.hpp
deleted file mode 100644
index 3616cf4b..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/Common.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-#ifndef COMMON_HPP
-#define COMMON_HPP
-
-#include
-#include
-#include
-#include
-
-#define LWIP_INTERNAL
-
-extern "C" {
- #include "ets_sys.h"
- // #include "os_type.h"
- #include "osapi.h"
- // #include "mem.h"
- // #include "user_interface.h"
-}
-
-#include "lwip/opt.h"
-#include "lwip/tcp.h"
-#include "lwip/inet.h"
-
-
-namespace update {
-
-enum Error {
- OK = 0,
- E_ALLOC_FAIL = 1,
- E_BIND_FAIL = 2,
-};
-
-class Args {
-public:
- Args(const char* str) :
- m_Str(0), m_Keys(0), m_Values(0), m_Count(0) {
- int length = strlen(str);
- m_Str = new char[length];
-
- m_Count = 0;
- for (int i = 0; i < length; ++i) {
- if (m_Str[i] == '=') {
- ++m_Count;
- }
- }
-
- if (!m_Count)
- return;
-
- m_Keys = new const char*[m_Count];
- m_Values = new const char*[m_Count];
-
- char* start = m_Str;
- const char* end = m_Str + length;
- int iArg;
- for (iArg = 0; iArg < m_Count; ++iArg) {
- char* next = strchr(start, '=');
- if (!next)
- break;
- *next = 0;
- m_Keys[iArg] = start;
- start = next + 1;
-
- if (start >= end)
- break;
-
- next = strchr(start, '&');
- if (!next)
- break;
- *next = 0;
- m_Values[iArg] = start;
- start = next + 1;
-
- if (start >= end)
- break;
- }
-
- m_Count = iArg;
- }
-
- ~Args() {
- delete[] m_Str;
- delete[] m_Keys;
- delete[] m_Values;
- }
-
- const char* get(const char* key) {
- for (int i = 0; i < m_Count; ++i) {
- if (strcmp(key, m_Keys[i]) == 0) {
- return m_Values[i];
- }
- }
- return 0;
- }
-
-protected:
- char* m_Str;
-
- int m_Count;
- const char** m_Keys;
- const char** m_Values;
-};
-
-class Sink {
-public:
- virtual Error begin(Args& args, size_t size) { return OK; }
- virtual Error write(const uint8_t* data, size_t size) { return OK; }
- virtual Error abort() { return OK; }
- virtual Error end() { return OK; }
-};
-
-class Source {
-public:
- virtual Error begin(Args& args) = 0;
-};
-
-class AuthChecker {
-public:
- virtual Error check(Args& args, const uint8_t* contentHash, const uint8_t* hmac) {
- return OK;
- }
-};
-
-
-
-
-
-} // namespace update
-
-
-
-#endif //COMMON_HPP
\ No newline at end of file
diff --git a/sparkfun/esp8266/firmwares/loader/src/TcpServerSource.hpp b/sparkfun/esp8266/firmwares/loader/src/TcpServerSource.hpp
deleted file mode 100644
index b8e443d7..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/TcpServerSource.hpp
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef TCPSERVERSOURCE_H
-#define TCPSERVERSOURCE_H
-
-#include "Common.hpp"
-#include
-/*
- * Quick and dirty TCP server
- *
- */
-
-
-namespace update {
-
-
-
-class TcpServerSource : public Source {
-
-private:
- enum State {S_IDLE, S_WAITING, S_ACCEPTED};
-
-public:
- static const int DEFAULT_PORT = 8266;
-
- TcpServerSource(Sink& sink, AuthChecker& authChecker) :
- m_Sink(sink),
- m_AuthChecker(authChecker),
- m_State(S_IDLE),
- m_rxBuf(0),
- m_rxBufOffset(0)
- {
-
- }
-
- virtual Error begin(Args& args) {
- m_Port = 0;
- const char* portStr;
- if ((portStr = args.get("port")) != NULL) {
- m_Port = atoi(portStr);
- }
- if (!m_Port) {
- m_Port = DEFAULT_PORT;
- }
-
- err_t err;
- tcp_pcb* pcb = tcp_new();
- if (!pcb)
- return E_ALLOC_FAIL;
-
- err = tcp_bind(pcb, INADDR_ANY, m_Port);
- if (err != ERR_OK)
- {
- tcp_close(pcb);
- return E_BIND_FAIL;
- }
-
- tcp_pcb* listen_pcb = tcp_listen(pcb);
- if (!listen_pcb)
- {
- tcp_close(pcb);
- return E_ALLOC_FAIL;
- }
-
- m_Pcb = listen_pcb;
- tcp_arg(listen_pcb, (void*) this);
- tcp_accept(listen_pcb, &TcpServerSource::_s_accept);
- m_State = S_WAITING;
- return OK;
- }
-
-
-protected:
- static int8_t _s_accept(void *arg, tcp_pcb* newpcb, int8_t err) {
- return reinterpret_cast(arg)->_accept(newpcb, err);
- }
-
- static err_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err) {
- return reinterpret_cast(arg)->_recv(tpcb, pb, err);
- }
-
- static void _s_error(void *arg, err_t err) {
- reinterpret_cast(arg)->_error(err);
- }
-
- static err_t _s_poll(void *arg, struct tcp_pcb *tpcb) {
- return reinterpret_cast(arg)->_poll(tpcb);
- }
-
- static err_t _s_sent(void *arg, struct tcp_pcb *tpcb, uint16_t len) {
- return reinterpret_cast(arg)->_sent(tpcb, len);
- }
-
- int8_t _accept(tcp_pcb* apcb, int8_t err) {
- if (m_State == S_ACCEPTED) {
- tcp_abort(apcb);
- return ERR_ABRT;
- }
-
- m_State = S_ACCEPTED;
- tcp_arg(apcb, this);
- tcp_recv(apcb, &_s_recv);
- tcp_sent(apcb, &_s_sent);
- tcp_err(apcb, &_s_error);
- m_ClientPcb = apcb;
-
- tcp_accepted(m_Pcb);
-
- return ERR_OK;
- }
-
- err_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err) {
-
- if(pb == 0) // connection closed
- {
- tcp_arg(pcb, NULL);
- tcp_sent(pcb, NULL);
- tcp_recv(pcb, NULL);
- tcp_err(pcb, NULL);
- tcp_abort(pcb);
- m_Pcb = 0;
- return ERR_ABRT;
- }
-
- if(m_rxBuf) {
- // there is some unread data
- // chain the new pbuf to the existing one
- // DEBUGV(":rch %d, %d\r\n", _rx_buf->tot_len, pb->tot_len);
- pbuf_cat(m_rxBuf, pb);
- } else {
- // DEBUGV(":rn %d\r\n", pb->tot_len);
- m_rxBuf = pb;
- m_rxBufOffset = 0;
- }
- // tcp_recved(pcb, received);
- // pbuf_free(pb);
- return ERR_OK;
- }
-
- void _error(err_t err) {
- // DEBUGV(":er %d\r\n", err);
-
- if(m_ClientPcb) {
- tcp_arg(m_ClientPcb, NULL);
- tcp_sent(m_ClientPcb, NULL);
- tcp_recv(m_ClientPcb, NULL);
- tcp_err(m_ClientPcb, NULL);
- err = tcp_close(m_ClientPcb);
- if(err != ERR_OK) {
- // DEBUGV(":tc err %d\r\n", err);
- tcp_abort(m_Pcb);
- }
- }
- m_ClientPcb = 0;
- }
-
- err_t _poll(tcp_pcb* pcb) {
- return ERR_OK;
- }
-
- err_t _sent(tcp_pcb* pcb, uint16_t len) {
- // DEBUGV(":sent %d\r\n", len);
- // _size_sent -= len;
- // if(_size_sent == 0 && _send_waiting) esp_schedule();
- return ERR_OK;
- }
-
-
- Sink& m_Sink;
- AuthChecker& m_AuthChecker;
- uint32_t m_Port;
- tcp_pcb* m_Pcb;
- tcp_pcb* m_ClientPcb;
- State m_State;
- pbuf* m_rxBuf;
- size_t m_rxBufOffset;
-};
-
-
-
-} // namespace update
-
-#endif //TCPSERVERSOURCE_H
-
diff --git a/sparkfun/esp8266/firmwares/loader/src/abi.cpp b/sparkfun/esp8266/firmwares/loader/src/abi.cpp
deleted file mode 100644
index 03514b12..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/abi.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include
-#include
-#include
-
-extern "C" {
- #include "ets_sys.h"
- #include "os_type.h"
- #include "osapi.h"
- #include "mem.h"
- #include "user_interface.h"
-}
-
-extern "C" void abort() {
- while(1) {
- }
-}
-
-void *operator new(size_t size) {
- return os_malloc(size);
-}
-
-void *operator new[](size_t size) {
- return os_malloc(size);
-}
-
-void operator delete(void * ptr) {
- os_free(ptr);
-}
-
-void operator delete[](void * ptr) {
- os_free(ptr);
-}
-
-extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
-extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
-
-void __cxa_pure_virtual(void) {
- abort();
-}
-
-void __cxa_deleted_virtual(void) {
- abort();
-}
-
-namespace std {
-void __throw_bad_function_call() {
- abort();
-}
-}
diff --git a/sparkfun/esp8266/firmwares/loader/src/arch/cc.h b/sparkfun/esp8266/firmwares/loader/src/arch/cc.h
deleted file mode 100644
index ff03b307..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/arch/cc.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2001, Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __ARCH_CC_H__
-#define __ARCH_CC_H__
-
-//#include
-#include "c_types.h"
-#include "ets_sys.h"
-#include "osapi.h"
-#define EFAULT 14
-
-//#define LWIP_PROVIDE_ERRNO
-
-#if (1)
-#define BYTE_ORDER LITTLE_ENDIAN
-#else
-#define BYTE_ORDER BIG_ENDIAN
-#endif
-
-
-typedef unsigned char u8_t;
-typedef signed char s8_t;
-typedef unsigned short u16_t;
-typedef signed short s16_t;
-typedef unsigned long u32_t;
-typedef signed long s32_t;
-typedef unsigned long mem_ptr_t;
-
-#define S16_F "d"
-#define U16_F "d"
-#define X16_F "x"
-
-#define S32_F "d"
-#define U32_F "d"
-#define X32_F "x"
-
-
-
-//#define PACK_STRUCT_FIELD(x) x __attribute__((packed))
-#define PACK_STRUCT_FIELD(x) x
-#define PACK_STRUCT_STRUCT __attribute__((packed))
-#define PACK_STRUCT_BEGIN
-#define PACK_STRUCT_END
-
-//#define LWIP_DEBUG
-
-#ifdef LWIP_DEBUG
-#define LWIP_PLATFORM_DIAG(x) os_printf x
-#define LWIP_PLATFORM_ASSERT(x) ETS_ASSERT(x)
-#else
-#define LWIP_PLATFORM_DIAG(x)
-#define LWIP_PLATFORM_ASSERT(x)
-#endif
-
-#define SYS_ARCH_DECL_PROTECT(x)
-#define SYS_ARCH_PROTECT(x)
-#define SYS_ARCH_UNPROTECT(x)
-
-#define LWIP_PLATFORM_BYTESWAP 1
-#define LWIP_PLATFORM_HTONS(_n) ((u16_t)((((_n) & 0xff) << 8) | (((_n) >> 8) & 0xff)))
-#define LWIP_PLATFORM_HTONL(_n) ((u32_t)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) ))
-
-#if LWIP_RAW
-extern u8_t memp_memory_RAW_PCB_base[];
-#endif /* LWIP_RAW */
-
-#if LWIP_UDP
-extern u8_t memp_memory_UDP_PCB_base[];
-#endif /* LWIP_UDP */
-
-#if LWIP_TCP
-extern u8_t memp_memory_TCP_PCB_base[];
-extern u8_t memp_memory_TCP_PCB_LISTEN_base[];
-extern u8_t memp_memory_TCP_SEG_base[] SHMEM_ATTR;
-#endif /* LWIP_TCP */
-
-#if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
-extern u8_t memp_memory_SYS_TIMEOUT_base[];
-#endif /* LWIP_TIMERS */
-
-extern u8_t memp_memory_PBUF_base[];
-extern u8_t memp_memory_PBUF_POOL_base[];
-
-
-
-#endif /* __ARCH_CC_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/arch/perf.h b/sparkfun/esp8266/firmwares/loader/src/arch/perf.h
deleted file mode 100644
index 089facac..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/arch/perf.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2001, Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __PERF_H__
-#define __PERF_H__
-
-#define PERF_START /* null definition */
-#define PERF_STOP(x) /* null definition */
-
-#endif /* __PERF_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/arch/sys_arch.h b/sparkfun/esp8266/firmwares/loader/src/arch/sys_arch.h
deleted file mode 100644
index e69de29b..00000000
diff --git a/sparkfun/esp8266/firmwares/loader/src/include/lwipopts.h b/sparkfun/esp8266/firmwares/loader/src/include/lwipopts.h
deleted file mode 100644
index 1678a402..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/include/lwipopts.h
+++ /dev/null
@@ -1,2037 +0,0 @@
-/**
- * @file
- *
- * lwIP Options Configuration
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIPOPTS_H__
-#define __LWIPOPTS_H__
-
-
-#define EBUF_LWIP 1
-#define LWIP_ESP 1
-#define EP_OFFSET 36
-/*
- -----------------------------------------------
- ---------- Platform specific locking ----------
- -----------------------------------------------
-*/
-
-/**
- * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
- * critical regions during buffer allocation, deallocation and memory
- * allocation and deallocation.
- */
-#ifndef SYS_LIGHTWEIGHT_PROT
-#define SYS_LIGHTWEIGHT_PROT 0
-#endif
-
-/**
- * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
- * use lwIP facilities.
- */
-#ifndef NO_SYS
-#define NO_SYS 1
-#endif
-
-/**
- * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1
- * Mainly for compatibility to old versions.
- */
-#ifndef NO_SYS_NO_TIMERS
-#define NO_SYS_NO_TIMERS 0
-#endif
-
-/**
- * MEMCPY: override this if you have a faster implementation at hand than the
- * one included in your C library
- */
-#ifndef MEMCPY
-#define MEMCPY(dst,src,len) os_memcpy(dst,src,len)
-#endif
-
-/**
- * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a
- * call to memcpy() if the length is known at compile time and is small.
- */
-#ifndef SMEMCPY
-#define SMEMCPY(dst,src,len) os_memcpy(dst,src,len)
-#endif
-
-/*
- ------------------------------------
- ---------- Memory options ----------
- ------------------------------------
-*/
-/**
- * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
- * instead of the lwip internal allocator. Can save code size if you
- * already use it.
- */
-#ifndef MEM_LIBC_MALLOC
-#define MEM_LIBC_MALLOC 1
-#endif
-
-/**
-* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
-* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
-* speed and usage from interrupts!
-*/
-#ifndef MEMP_MEM_MALLOC
-#define MEMP_MEM_MALLOC 1
-#endif
-
-/**
- * MEM_ALIGNMENT: should be set to the alignment of the CPU
- * 4 byte alignment -> #define MEM_ALIGNMENT 4
- * 2 byte alignment -> #define MEM_ALIGNMENT 2
- */
-#ifndef MEM_ALIGNMENT
-#define MEM_ALIGNMENT 4
-#endif
-
-/**
- * MEM_SIZE: the size of the heap memory. If the application will send
- * a lot of data that needs to be copied, this should be set high.
- */
-#ifndef MEM_SIZE
-#define MEM_SIZE 16000
-#endif
-
-/**
- * MEMP_SEPARATE_POOLS: if defined to 1, each pool is placed in its own array.
- * This can be used to individually change the location of each pool.
- * Default is one big array for all pools
- */
-#ifndef MEMP_SEPARATE_POOLS
-#define MEMP_SEPARATE_POOLS 1
-#endif
-
-/**
- * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable
- * amount of bytes before and after each memp element in every pool and fills
- * it with a prominent default value.
- * MEMP_OVERFLOW_CHECK == 0 no checking
- * MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed
- * MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
- * memp_malloc() or memp_free() is called (useful but slow!)
- */
-#ifndef MEMP_OVERFLOW_CHECK
-#define MEMP_OVERFLOW_CHECK 0
-#endif
-
-/**
- * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make
- * sure that there are no cycles in the linked lists.
- */
-#ifndef MEMP_SANITY_CHECK
-#define MEMP_SANITY_CHECK 1
-#endif
-
-/**
- * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
- * of memory pools of various sizes. When mem_malloc is called, an element of
- * the smallest pool that can provide the length needed is returned.
- * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
- */
-#ifndef MEM_USE_POOLS
-#define MEM_USE_POOLS 0
-#endif
-
-/**
- * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next
- * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more
- * reliable. */
-#ifndef MEM_USE_POOLS_TRY_BIGGER_POOL
-#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
-#endif
-
-/**
- * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
- * that defines additional pools beyond the "standard" ones required
- * by lwIP. If you set this to 1, you must have lwippools.h in your
- * inlude path somewhere.
- */
-#ifndef MEMP_USE_CUSTOM_POOLS
-#define MEMP_USE_CUSTOM_POOLS 0
-#endif
-
-/**
- * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from
- * interrupt context (or another context that doesn't allow waiting for a
- * semaphore).
- * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT,
- * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs
- * with each loop so that mem_free can run.
- *
- * ATTENTION: As you can see from the above description, this leads to dis-/
- * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc
- * can need longer.
- *
- * If you don't want that, at least for NO_SYS=0, you can still use the following
- * functions to enqueue a deallocation call which then runs in the tcpip_thread
- * context:
- * - pbuf_free_callback(p);
- * - mem_free_callback(m);
- */
-#ifndef LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
-#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
-#endif
-
-/*
- ------------------------------------------------
- ---------- Internal Memory Pool Sizes ----------
- ------------------------------------------------
-*/
-/**
- * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
- * If the application sends a lot of data out of ROM (or other static memory),
- * this should be set high.
- */
-#ifndef MEMP_NUM_PBUF
-#define MEMP_NUM_PBUF 10
-#endif
-
-/**
- * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
- * (requires the LWIP_RAW option)
- */
-#ifndef MEMP_NUM_RAW_PCB
-#define MEMP_NUM_RAW_PCB 4
-#endif
-
-/**
- * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
- * per active UDP "connection".
- * (requires the LWIP_UDP option)
- */
-#ifndef MEMP_NUM_UDP_PCB
-#define MEMP_NUM_UDP_PCB 4
-#endif
-
-/**
- * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
- * (requires the LWIP_TCP option)
- */
-#ifndef MEMP_NUM_TCP_PCB
-#define MEMP_NUM_TCP_PCB (*((volatile uint32*)0x600011FC))
-#endif
-
-/**
- * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
- * (requires the LWIP_TCP option)
- */
-#ifndef MEMP_NUM_TCP_PCB_LISTEN
-#define MEMP_NUM_TCP_PCB_LISTEN 2
-#endif
-
-/**
- * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
- * (requires the LWIP_TCP option)
- */
-#ifndef MEMP_NUM_TCP_SEG
-#define MEMP_NUM_TCP_SEG 16
-#endif
-
-/**
- * MEMP_NUM_REASSDATA: the number of simultaneously IP packets queued for
- * reassembly (whole packets, not fragments!)
- */
-#ifndef MEMP_NUM_REASSDATA
-#define MEMP_NUM_REASSDATA 0
-#endif
-
-/**
- * MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent
- * (fragments, not whole packets!).
- * This is only used with IP_FRAG_USES_STATIC_BUF==0 and
- * LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1 with DMA-enabled MACs
- * where the packet is not yet sent when netif->output returns.
- */
-#ifndef MEMP_NUM_FRAG_PBUF
-#define MEMP_NUM_FRAG_PBUF 0
-#endif
-
-/**
- * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
- * packets (pbufs) that are waiting for an ARP request (to resolve
- * their destination address) to finish.
- * (requires the ARP_QUEUEING option)
- */
-#ifndef MEMP_NUM_ARP_QUEUE
-#define MEMP_NUM_ARP_QUEUE 10
-#endif
-
-/**
- * MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces
- * can be members et the same time (one per netif - allsystems group -, plus one
- * per netif membership).
- * (requires the LWIP_IGMP option)
- */
-#ifndef MEMP_NUM_IGMP_GROUP
-#define MEMP_NUM_IGMP_GROUP 8
-#endif
-
-/**
- * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
- * (requires NO_SYS==0)
- */
-#ifndef MEMP_NUM_SYS_TIMEOUT
-#define MEMP_NUM_SYS_TIMEOUT 6
-#endif
-
-/**
- * MEMP_NUM_NETBUF: the number of struct netbufs.
- * (only needed if you use the sequential API, like api_lib.c)
- */
-#ifndef MEMP_NUM_NETBUF
-#define MEMP_NUM_NETBUF 0
-#endif
-
-/**
- * MEMP_NUM_NETCONN: the number of struct netconns.
- * (only needed if you use the sequential API, like api_lib.c)
- */
-#ifndef MEMP_NUM_NETCONN
-#define MEMP_NUM_NETCONN 0
-#endif
-
-/**
- * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
- * for callback/timeout API communication.
- * (only needed if you use tcpip.c)
- */
-#ifndef MEMP_NUM_TCPIP_MSG_API
-#define MEMP_NUM_TCPIP_MSG_API 4
-#endif
-
-/**
- * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
- * for incoming packets.
- * (only needed if you use tcpip.c)
- */
-#ifndef MEMP_NUM_TCPIP_MSG_INPKT
-#define MEMP_NUM_TCPIP_MSG_INPKT 4
-#endif
-
-/**
- * MEMP_NUM_SNMP_NODE: the number of leafs in the SNMP tree.
- */
-#ifndef MEMP_NUM_SNMP_NODE
-#define MEMP_NUM_SNMP_NODE 0
-#endif
-
-/**
- * MEMP_NUM_SNMP_ROOTNODE: the number of branches in the SNMP tree.
- * Every branch has one leaf (MEMP_NUM_SNMP_NODE) at least!
- */
-#ifndef MEMP_NUM_SNMP_ROOTNODE
-#define MEMP_NUM_SNMP_ROOTNODE 0
-#endif
-
-/**
- * MEMP_NUM_SNMP_VARBIND: the number of concurrent requests (does not have to
- * be changed normally) - 2 of these are used per request (1 for input,
- * 1 for output)
- */
-#ifndef MEMP_NUM_SNMP_VARBIND
-#define MEMP_NUM_SNMP_VARBIND 0
-#endif
-
-/**
- * MEMP_NUM_SNMP_VALUE: the number of OID or values concurrently used
- * (does not have to be changed normally) - 3 of these are used per request
- * (1 for the value read and 2 for OIDs - input and output)
- */
-#ifndef MEMP_NUM_SNMP_VALUE
-#define MEMP_NUM_SNMP_VALUE 0
-#endif
-
-/**
- * MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls
- * (before freeing the corresponding memory using lwip_freeaddrinfo()).
- */
-#ifndef MEMP_NUM_NETDB
-#define MEMP_NUM_NETDB 0
-#endif
-
-/**
- * MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list
- * if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1.
- */
-#ifndef MEMP_NUM_LOCALHOSTLIST
-#define MEMP_NUM_LOCALHOSTLIST 0
-#endif
-
-/**
- * MEMP_NUM_PPPOE_INTERFACES: the number of concurrently active PPPoE
- * interfaces (only used with PPPOE_SUPPORT==1)
- */
-#ifndef MEMP_NUM_PPPOE_INTERFACES
-#define MEMP_NUM_PPPOE_INTERFACES 0
-#endif
-
-/**
- * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
- */
-#ifndef PBUF_POOL_SIZE
-#define PBUF_POOL_SIZE 10
-#endif
-
-/*
- ---------------------------------
- ---------- ARP options ----------
- ---------------------------------
-*/
-/**
- * LWIP_ARP==1: Enable ARP functionality.
- */
-#ifndef LWIP_ARP
-#define LWIP_ARP 1
-#endif
-
-/**
- * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached.
- */
-#ifndef ARP_TABLE_SIZE
-#define ARP_TABLE_SIZE 10
-#endif
-
-/**
- * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address
- * resolution. By default, only the most recent packet is queued per IP address.
- * This is sufficient for most protocols and mainly reduces TCP connection
- * startup time. Set this to 1 if you know your application sends more than one
- * packet in a row to an IP address that is not in the ARP cache.
- */
-#ifndef ARP_QUEUEING
-#define ARP_QUEUEING 1
-#endif
-
-/**
- * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be
- * updated with the source MAC and IP addresses supplied in the packet.
- * You may want to disable this if you do not trust LAN peers to have the
- * correct addresses, or as a limited approach to attempt to handle
- * spoofing. If disabled, lwIP will need to make a new ARP request if
- * the peer is not already in the ARP table, adding a little latency.
- * The peer *is* in the ARP table if it requested our address before.
- * Also notice that this slows down input processing of every IP packet!
- */
-#ifndef ETHARP_TRUST_IP_MAC
-#define ETHARP_TRUST_IP_MAC 1
-#endif
-
-/**
- * ETHARP_SUPPORT_VLAN==1: support receiving ethernet packets with VLAN header.
- * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check.
- * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted.
- * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted.
- */
-#ifndef ETHARP_SUPPORT_VLAN
-#define ETHARP_SUPPORT_VLAN 0
-#endif
-
-/** LWIP_ETHERNET==1: enable ethernet support for PPPoE even though ARP
- * might be disabled
- */
-#ifndef LWIP_ETHERNET
-#define LWIP_ETHERNET (LWIP_ARP || PPPOE_SUPPORT)
-#endif
-
-/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure
- * alignment of payload after that header. Since the header is 14 bytes long,
- * without this padding e.g. addresses in the IP header will not be aligned
- * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
- */
-#ifndef ETH_PAD_SIZE
-#define ETH_PAD_SIZE 0
-#endif
-
-/** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table
- * entries (using etharp_add_static_entry/etharp_remove_static_entry).
- */
-#ifndef ETHARP_SUPPORT_STATIC_ENTRIES
-#define ETHARP_SUPPORT_STATIC_ENTRIES 0
-#endif
-
-
-/*
- --------------------------------
- ---------- IP options ----------
- --------------------------------
-*/
-/**
- * IP_FORWARD==1: Enables the ability to forward IP packets across network
- * interfaces. If you are going to run lwIP on a device with only one network
- * interface, define this to 0.
- */
-#ifndef IP_FORWARD
-#define IP_FORWARD 0
-#endif
-
-/**
- * IP_OPTIONS_ALLOWED: Defines the behavior for IP options.
- * IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
- * IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
- */
-#ifndef IP_OPTIONS_ALLOWED
-#define IP_OPTIONS_ALLOWED 1
-#endif
-
-/**
- * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
- * this option does not affect outgoing packet sizes, which can be controlled
- * via IP_FRAG.
- */
-#ifndef IP_REASSEMBLY
-#define IP_REASSEMBLY 0
-#endif
-
-/**
- * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
- * that this option does not affect incoming packet sizes, which can be
- * controlled via IP_REASSEMBLY.
- */
-#ifndef IP_FRAG
-#define IP_FRAG 0
-#endif
-
-/**
- * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
- * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
- * in this time, the whole packet is discarded.
- */
-#ifndef IP_REASS_MAXAGE
-#define IP_REASS_MAXAGE 0
-#endif
-
-/**
- * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
- * Since the received pbufs are enqueued, be sure to configure
- * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
- * packets even if the maximum amount of fragments is enqueued for reassembly!
- */
-#ifndef IP_REASS_MAX_PBUFS
-#define IP_REASS_MAX_PBUFS 0
-#endif
-
-/**
- * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
- * fragmentation. Otherwise pbufs are allocated and reference the original
- * packet data to be fragmented (or with LWIP_NETIF_TX_SINGLE_PBUF==1,
- * new PBUF_RAM pbufs are used for fragments).
- * ATTENTION: IP_FRAG_USES_STATIC_BUF==1 may not be used for DMA-enabled MACs!
- */
-#ifndef IP_FRAG_USES_STATIC_BUF
-#define IP_FRAG_USES_STATIC_BUF 1
-#endif
-
-/**
- * IP_FRAG_MAX_MTU: Assumed max MTU on any interface for IP frag buffer
- * (requires IP_FRAG_USES_STATIC_BUF==1)
- */
-#if IP_FRAG_USES_STATIC_BUF && !defined(IP_FRAG_MAX_MTU)
-#define IP_FRAG_MAX_MTU 1500
-#endif
-
-/**
- * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
- */
-#ifndef IP_DEFAULT_TTL
-#define IP_DEFAULT_TTL 255
-#endif
-
-/**
- * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast
- * filter per pcb on udp and raw send operations. To enable broadcast filter
- * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1.
- */
-#ifndef IP_SOF_BROADCAST
-#define IP_SOF_BROADCAST 0
-#endif
-
-/**
- * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
- * filter on recv operations.
- */
-#ifndef IP_SOF_BROADCAST_RECV
-#define IP_SOF_BROADCAST_RECV 0
-#endif
-
-/*
- ----------------------------------
- ---------- ICMP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
- * Be careful, disable that make your product non-compliant to RFC1122
- */
-#ifndef LWIP_ICMP
-#define LWIP_ICMP 1
-#endif
-
-/**
- * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
- */
-#ifndef ICMP_TTL
-#define ICMP_TTL (IP_DEFAULT_TTL)
-#endif
-
-/**
- * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
- */
-#ifndef LWIP_BROADCAST_PING
-#define LWIP_BROADCAST_PING 0
-#endif
-
-/**
- * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
- */
-#ifndef LWIP_MULTICAST_PING
-#define LWIP_MULTICAST_PING 0
-#endif
-
-/*
- ---------------------------------
- ---------- RAW options ----------
- ---------------------------------
-*/
-/**
- * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
- */
-#ifndef LWIP_RAW
-#define LWIP_RAW 0
-#endif
-
-/**
- * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
- */
-#ifndef RAW_TTL
-#define RAW_TTL (IP_DEFAULT_TTL)
-#endif
-
-/*
- ----------------------------------
- ---------- DHCP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_DHCP==1: Enable DHCP module.
- */
-#ifndef LWIP_DHCP
-#define LWIP_DHCP 1
-#endif
-
-/**
- * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
- */
-#ifndef DHCP_DOES_ARP_CHECK
-#define DHCP_DOES_ARP_CHECK ((LWIP_DHCP) && (LWIP_ARP))
-#endif
-
-/*
- ------------------------------------
- ---------- AUTOIP options ----------
- ------------------------------------
-*/
-/**
- * LWIP_AUTOIP==1: Enable AUTOIP module.
- */
-#ifndef LWIP_AUTOIP
-#define LWIP_AUTOIP 0
-#endif
-
-/**
- * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on
- * the same interface at the same time.
- */
-#ifndef LWIP_DHCP_AUTOIP_COOP
-#define LWIP_DHCP_AUTOIP_COOP 0
-#endif
-
-/**
- * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
- * that should be sent before falling back on AUTOIP. This can be set
- * as low as 1 to get an AutoIP address very quickly, but you should
- * be prepared to handle a changing IP address when DHCP overrides
- * AutoIP.
- */
-#ifndef LWIP_DHCP_AUTOIP_COOP_TRIES
-#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
-#endif
-
-/*
- ----------------------------------
- ---------- SNMP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
- * transport.
- */
-#ifndef LWIP_SNMP
-#define LWIP_SNMP 0
-#endif
-
-/**
- * SNMP_CONCURRENT_REQUESTS: Number of concurrent requests the module will
- * allow. At least one request buffer is required.
- */
-#ifndef SNMP_CONCURRENT_REQUESTS
-#define SNMP_CONCURRENT_REQUESTS 0
-#endif
-
-/**
- * SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap
- * destination is required
- */
-#ifndef SNMP_TRAP_DESTINATIONS
-#define SNMP_TRAP_DESTINATIONS 0
-#endif
-
-/**
- * SNMP_PRIVATE_MIB:
- */
-#ifndef SNMP_PRIVATE_MIB
-#define SNMP_PRIVATE_MIB 0
-#endif
-
-/**
- * Only allow SNMP write actions that are 'safe' (e.g. disabeling netifs is not
- * a safe action and disabled when SNMP_SAFE_REQUESTS = 1).
- * Unsafe requests are disabled by default!
- */
-#ifndef SNMP_SAFE_REQUESTS
-#define SNMP_SAFE_REQUESTS 0
-#endif
-
-/**
- * The maximum length of strings used. This affects the size of
- * MEMP_SNMP_VALUE elements.
- */
-#ifndef SNMP_MAX_OCTET_STRING_LEN
-#define SNMP_MAX_OCTET_STRING_LEN 127
-#endif
-
-/**
- * The maximum depth of the SNMP tree.
- * With private MIBs enabled, this depends on your MIB!
- * This affects the size of MEMP_SNMP_VALUE elements.
- */
-#ifndef SNMP_MAX_TREE_DEPTH
-#define SNMP_MAX_TREE_DEPTH 15
-#endif
-
-/**
- * The size of the MEMP_SNMP_VALUE elements, normally calculated from
- * SNMP_MAX_OCTET_STRING_LEN and SNMP_MAX_TREE_DEPTH.
- */
-#ifndef SNMP_MAX_VALUE_SIZE
-#define SNMP_MAX_VALUE_SIZE LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN)+1, sizeof(s32_t)*(SNMP_MAX_TREE_DEPTH))
-#endif
-
-/*
- ----------------------------------
- ---------- IGMP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_IGMP==1: Turn on IGMP module.
- */
-#ifndef LWIP_IGMP
-#define LWIP_IGMP 1
-#endif
-
-/*
- ----------------------------------
- ---------- DNS options -----------
- ----------------------------------
-*/
-/**
- * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
- * transport.
- */
-#ifndef LWIP_DNS
-#define LWIP_DNS 1
-#endif
-
-/** DNS maximum number of entries to maintain locally. */
-#ifndef DNS_TABLE_SIZE
-#define DNS_TABLE_SIZE 4
-#endif
-
-/** DNS maximum host name length supported in the name table. */
-#ifndef DNS_MAX_NAME_LENGTH
-#define DNS_MAX_NAME_LENGTH 256
-#endif
-
-/** The maximum of DNS servers */
-#ifndef DNS_MAX_SERVERS
-#define DNS_MAX_SERVERS 2
-#endif
-
-/** DNS do a name checking between the query and the response. */
-#ifndef DNS_DOES_NAME_CHECK
-#define DNS_DOES_NAME_CHECK 1
-#endif
-
-/** DNS message max. size. Default value is RFC compliant. */
-#ifndef DNS_MSG_SIZE
-#define DNS_MSG_SIZE 512
-#endif
-
-/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled,
- * you have to define
- * #define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}}
- * (an array of structs name/address, where address is an u32_t in network
- * byte order).
- *
- * Instead, you can also use an external function:
- * #define DNS_LOOKUP_LOCAL_EXTERN(x) extern u32_t my_lookup_function(const char *name)
- * that returns the IP address or INADDR_NONE if not found.
- */
-#ifndef DNS_LOCAL_HOSTLIST
-#define DNS_LOCAL_HOSTLIST 0
-#endif /* DNS_LOCAL_HOSTLIST */
-
-/** If this is turned on, the local host-list can be dynamically changed
- * at runtime. */
-#ifndef DNS_LOCAL_HOSTLIST_IS_DYNAMIC
-#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
-#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
-
-/*
- ---------------------------------
- ---------- UDP options ----------
- ---------------------------------
-*/
-/**
- * LWIP_UDP==1: Turn on UDP.
- */
-#ifndef LWIP_UDP
-#define LWIP_UDP 1
-#endif
-
-/**
- * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
- */
-#ifndef LWIP_UDPLITE
-#define LWIP_UDPLITE 0
-#endif
-
-/**
- * UDP_TTL: Default Time-To-Live value.
- */
-#ifndef UDP_TTL
-#define UDP_TTL (IP_DEFAULT_TTL)
-#endif
-
-/**
- * LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf.
- */
-#ifndef LWIP_NETBUF_RECVINFO
-#define LWIP_NETBUF_RECVINFO 0
-#endif
-
-/*
- ---------------------------------
- ---------- TCP options ----------
- ---------------------------------
-*/
-/**
- * LWIP_TCP==1: Turn on TCP.
- */
-#ifndef LWIP_TCP
-#define LWIP_TCP 1
-#endif
-
-/**
- * TCP_TTL: Default Time-To-Live value.
- */
-#ifndef TCP_TTL
-#define TCP_TTL (IP_DEFAULT_TTL)
-#endif
-
-/**
- * TCP_WND: The size of a TCP window. This must be at least
- * (2 * TCP_MSS) for things to work well
- */
-#ifndef TCP_WND
-#define TCP_WND (4 * TCP_MSS)
-#endif
-
-/**
- * TCP_MAXRTX: Maximum number of retransmissions of data segments.
- */
-#ifndef TCP_MAXRTX
-#define TCP_MAXRTX 5
-#endif
-
-/**
- * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
- */
-#ifndef TCP_SYNMAXRTX
-#define TCP_SYNMAXRTX 5
-#endif
-
-/**
- * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
- * Define to 0 if your device is low on memory.
- */
-#ifndef TCP_QUEUE_OOSEQ
-#define TCP_QUEUE_OOSEQ 0
-#endif
-
-/**
- * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
- * you might want to increase this.)
- * For the receive side, this MSS is advertised to the remote side
- * when opening a connection. For the transmit size, this MSS sets
- * an upper limit on the MSS advertised by the remote host.
- */
-#ifndef TCP_MSS
-#define TCP_MSS 1460
-#endif
-
-/**
- * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
- * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
- * reflects the available reassembly buffer size at the remote host) and the
- * largest size permitted by the IP layer" (RFC 1122)
- * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
- * netif used for a connection and limits the MSS if it would be too big otherwise.
- */
-#ifndef TCP_CALCULATE_EFF_SEND_MSS
-#define TCP_CALCULATE_EFF_SEND_MSS 1
-#endif
-
-
-/**
- * TCP_SND_BUF: TCP sender buffer space (bytes).
- */
-#ifndef TCP_SND_BUF
-#define TCP_SND_BUF 2 * TCP_MSS
-#endif
-
-/**
- * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
- * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
- */
-#ifndef TCP_SND_QUEUELEN
-#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
-#endif
-
-/**
- * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than
- * TCP_SND_BUF. It is the amount of space which must be available in the
- * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT).
- */
-#ifndef TCP_SNDLOWAT
-#define TCP_SNDLOWAT ((TCP_SND_BUF)/2)
-#endif
-
-/**
- * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be grater
- * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below
- * this number, select returns writable (combined with TCP_SNDLOWAT).
- */
-#ifndef TCP_SNDQUEUELOWAT
-#define TCP_SNDQUEUELOWAT LWIP_MAX(((TCP_SND_QUEUELEN)/2), 5)
-#endif
-
-/**
- * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
- */
-#ifndef TCP_LISTEN_BACKLOG
-#define TCP_LISTEN_BACKLOG 0
-#endif
-
-/**
- * The maximum allowed backlog for TCP listen netconns.
- * This backlog is used unless another is explicitly specified.
- * 0xff is the maximum (u8_t).
- */
-#ifndef TCP_DEFAULT_LISTEN_BACKLOG
-#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
-#endif
-
-/**
- * TCP_OVERSIZE: The maximum number of bytes that tcp_write may
- * allocate ahead of time in an attempt to create shorter pbuf chains
- * for transmission. The meaningful range is 0 to TCP_MSS. Some
- * suggested values are:
- *
- * 0: Disable oversized allocation. Each tcp_write() allocates a new
- pbuf (old behaviour).
- * 1: Allocate size-aligned pbufs with minimal excess. Use this if your
- * scatter-gather DMA requires aligned fragments.
- * 128: Limit the pbuf/memory overhead to 20%.
- * TCP_MSS: Try to create unfragmented TCP packets.
- * TCP_MSS/4: Try to create 4 fragments or less per TCP packet.
- */
-#ifndef TCP_OVERSIZE
-#define TCP_OVERSIZE TCP_MSS
-#endif
-
-/**
- * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
- */
-#ifndef LWIP_TCP_TIMESTAMPS
-#define LWIP_TCP_TIMESTAMPS 0
-#endif
-
-/**
- * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an
- * explicit window update
- */
-#ifndef TCP_WND_UPDATE_THRESHOLD
-#define TCP_WND_UPDATE_THRESHOLD (TCP_WND / 4)
-#endif
-
-/**
- * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
- * LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
- * events (accept, sent, etc) that happen in the system.
- * LWIP_CALLBACK_API==1: The PCB callback function is called directly
- * for the event.
- */
-#ifndef LWIP_EVENT_API
-#define LWIP_EVENT_API 0
-#define LWIP_CALLBACK_API 1
-#else
-#define LWIP_EVENT_API 1
-#define LWIP_CALLBACK_API 0
-#endif
-
-
-/*
- ----------------------------------
- ---------- Pbuf options ----------
- ----------------------------------
-*/
-/**
- * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
- * link level header. The default is 14, the standard value for
- * Ethernet.
- */
-#ifndef PBUF_LINK_HLEN
-#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
-#endif
-
-/**
- * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
- * designed to accomodate single full size TCP frame in one pbuf, including
- * TCP_MSS, IP header, and link header.
- */
-#ifndef PBUF_POOL_BUFSIZE
-#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
-#endif
-
-/*
- ------------------------------------------------
- ---------- Network Interfaces options ----------
- ------------------------------------------------
-*/
-/**
- * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname
- * field.
- */
-#ifndef LWIP_NETIF_HOSTNAME
-#define LWIP_NETIF_HOSTNAME 0
-#endif
-
-/**
- * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
- */
-#ifndef LWIP_NETIF_API
-#define LWIP_NETIF_API 0
-#endif
-
-/**
- * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
- * changes its up/down status (i.e., due to DHCP IP acquistion)
- */
-#ifndef LWIP_NETIF_STATUS_CALLBACK
-#define LWIP_NETIF_STATUS_CALLBACK 0
-#endif
-
-/**
- * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
- * whenever the link changes (i.e., link down)
- */
-#ifndef LWIP_NETIF_LINK_CALLBACK
-#define LWIP_NETIF_LINK_CALLBACK 0
-#endif
-
-/**
- * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table
- * indices) in struct netif. TCP and UDP can make use of this to prevent
- * scanning the ARP table for every sent packet. While this is faster for big
- * ARP tables or many concurrent connections, it might be counterproductive
- * if you have a tiny ARP table or if there never are concurrent connections.
- */
-#ifndef LWIP_NETIF_HWADDRHINT
-#define LWIP_NETIF_HWADDRHINT 0
-#endif
-
-/**
- * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
- * address equal to the netif IP address, looping them back up the stack.
- */
-#ifndef LWIP_NETIF_LOOPBACK
-#define LWIP_NETIF_LOOPBACK 0
-#endif
-
-/**
- * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback
- * sending for each netif (0 = disabled)
- */
-#ifndef LWIP_LOOPBACK_MAX_PBUFS
-#define LWIP_LOOPBACK_MAX_PBUFS 0
-#endif
-
-/**
- * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in
- * the system, as netifs must change how they behave depending on this setting
- * for the LWIP_NETIF_LOOPBACK option to work.
- * Setting this is needed to avoid reentering non-reentrant functions like
- * tcp_input().
- * LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a
- * multithreaded environment like tcpip.c. In this case, netif->input()
- * is called directly.
- * LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup.
- * The packets are put on a list and netif_poll() must be called in
- * the main application loop.
- */
-#ifndef LWIP_NETIF_LOOPBACK_MULTITHREADING
-#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
-#endif
-
-/**
- * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data
- * to be sent into one single pbuf. This is for compatibility with DMA-enabled
- * MACs that do not support scatter-gather.
- * Beware that this might involve CPU-memcpy before transmitting that would not
- * be needed without this flag! Use this only if you need to!
- *
- * @todo: TCP and IP-frag do not work with this, yet:
- */
-#ifndef LWIP_NETIF_TX_SINGLE_PBUF
-#define LWIP_NETIF_TX_SINGLE_PBUF 1
-#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
-
-/*
- ------------------------------------
- ---------- LOOPIF options ----------
- ------------------------------------
-*/
-/**
- * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
- */
-#ifndef LWIP_HAVE_LOOPIF
-#define LWIP_HAVE_LOOPIF 0
-#endif
-
-/*
- ------------------------------------
- ---------- SLIPIF options ----------
- ------------------------------------
-*/
-/**
- * LWIP_HAVE_SLIPIF==1: Support slip interface and slipif.c
- */
-#ifndef LWIP_HAVE_SLIPIF
-#define LWIP_HAVE_SLIPIF 0
-#endif
-
-/*
- ------------------------------------
- ---------- Thread options ----------
- ------------------------------------
-*/
-/**
- * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
- */
-#ifndef TCPIP_THREAD_NAME
-#define TCPIP_THREAD_NAME "tcpip_thread"
-#endif
-
-/**
- * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef TCPIP_THREAD_STACKSIZE
-#define TCPIP_THREAD_STACKSIZE 0
-#endif
-
-/**
- * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef TCPIP_THREAD_PRIO
-#define TCPIP_THREAD_PRIO 1
-#endif
-
-/**
- * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
- * The queue size value itself is platform-dependent, but is passed to
- * sys_mbox_new() when tcpip_init is called.
- */
-#ifndef TCPIP_MBOX_SIZE
-#define TCPIP_MBOX_SIZE 0
-#endif
-
-/**
- * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
- */
-#ifndef SLIPIF_THREAD_NAME
-#define SLIPIF_THREAD_NAME "slipif_loop"
-#endif
-
-/**
- * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef SLIPIF_THREAD_STACKSIZE
-#define SLIPIF_THREAD_STACKSIZE 0
-#endif
-
-/**
- * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef SLIPIF_THREAD_PRIO
-#define SLIPIF_THREAD_PRIO 1
-#endif
-
-/**
- * PPP_THREAD_NAME: The name assigned to the pppInputThread.
- */
-#ifndef PPP_THREAD_NAME
-#define PPP_THREAD_NAME "pppInputThread"
-#endif
-
-/**
- * PPP_THREAD_STACKSIZE: The stack size used by the pppInputThread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef PPP_THREAD_STACKSIZE
-#define PPP_THREAD_STACKSIZE 0
-#endif
-
-/**
- * PPP_THREAD_PRIO: The priority assigned to the pppInputThread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef PPP_THREAD_PRIO
-#define PPP_THREAD_PRIO 1
-#endif
-
-/**
- * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
- */
-#ifndef DEFAULT_THREAD_NAME
-#define DEFAULT_THREAD_NAME "lwIP"
-#endif
-
-/**
- * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef DEFAULT_THREAD_STACKSIZE
-#define DEFAULT_THREAD_STACKSIZE 0
-#endif
-
-/**
- * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef DEFAULT_THREAD_PRIO
-#define DEFAULT_THREAD_PRIO 1
-#endif
-
-/**
- * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
- * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
- * to sys_mbox_new() when the recvmbox is created.
- */
-#ifndef DEFAULT_RAW_RECVMBOX_SIZE
-#define DEFAULT_RAW_RECVMBOX_SIZE 0
-#endif
-
-/**
- * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
- * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
- * to sys_mbox_new() when the recvmbox is created.
- */
-#ifndef DEFAULT_UDP_RECVMBOX_SIZE
-#define DEFAULT_UDP_RECVMBOX_SIZE 0
-#endif
-
-/**
- * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
- * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
- * to sys_mbox_new() when the recvmbox is created.
- */
-#ifndef DEFAULT_TCP_RECVMBOX_SIZE
-#define DEFAULT_TCP_RECVMBOX_SIZE 0
-#endif
-
-/**
- * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
- * The queue size value itself is platform-dependent, but is passed to
- * sys_mbox_new() when the acceptmbox is created.
- */
-#ifndef DEFAULT_ACCEPTMBOX_SIZE
-#define DEFAULT_ACCEPTMBOX_SIZE 0
-#endif
-
-/*
- ----------------------------------------------
- ---------- Sequential layer options ----------
- ----------------------------------------------
-*/
-/**
- * LWIP_TCPIP_CORE_LOCKING: (EXPERIMENTAL!)
- * Don't use it if you're not an active lwIP project member
- */
-#ifndef LWIP_TCPIP_CORE_LOCKING
-#define LWIP_TCPIP_CORE_LOCKING 0
-#endif
-
-/**
- * LWIP_TCPIP_CORE_LOCKING_INPUT: (EXPERIMENTAL!)
- * Don't use it if you're not an active lwIP project member
- */
-#ifndef LWIP_TCPIP_CORE_LOCKING_INPUT
-#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
-#endif
-
-/**
- * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
- */
-#ifndef LWIP_NETCONN
-#define LWIP_NETCONN 0
-#endif
-
-/** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout tod create
- * timers running in tcpip_thread from another thread.
- */
-#ifndef LWIP_TCPIP_TIMEOUT
-#define LWIP_TCPIP_TIMEOUT 1
-#endif
-
-/*
- ------------------------------------
- ---------- Socket options ----------
- ------------------------------------
-*/
-/**
- * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
- */
-#ifndef LWIP_SOCKET
-#define LWIP_SOCKET 0
-#endif
-
-/**
- * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
- * (only used if you use sockets.c)
- */
-#ifndef LWIP_COMPAT_SOCKETS
-#define LWIP_COMPAT_SOCKETS 0
-#endif
-
-/**
- * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
- * Disable this option if you use a POSIX operating system that uses the same
- * names (read, write & close). (only used if you use sockets.c)
- */
-#ifndef LWIP_POSIX_SOCKETS_IO_NAMES
-#define LWIP_POSIX_SOCKETS_IO_NAMES 0
-#endif
-
-/**
- * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
- * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
- * in seconds. (does not require sockets.c, and will affect tcp.c)
- */
-#ifndef LWIP_TCP_KEEPALIVE
-#define LWIP_TCP_KEEPALIVE 1
-#endif
-
-/**
- * LWIP_SO_RCVTIMEO==1: Enable SO_RCVTIMEO processing.
- */
-#ifndef LWIP_SO_RCVTIMEO
-#define LWIP_SO_RCVTIMEO 0
-#endif
-
-/**
- * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
- */
-#ifndef LWIP_SO_RCVBUF
-#define LWIP_SO_RCVBUF 0
-#endif
-
-/**
- * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
- */
-#ifndef RECV_BUFSIZE_DEFAULT
-#define RECV_BUFSIZE_DEFAULT INT_MAX
-#endif
-
-/**
- * SO_REUSE==1: Enable SO_REUSEADDR option.
- */
-#ifndef SO_REUSE
-#define SO_REUSE 0
-#endif
-
-/**
- * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets
- * to all local matches if SO_REUSEADDR is turned on.
- * WARNING: Adds a memcpy for every packet if passing to more than one pcb!
- */
-#ifndef SO_REUSE_RXTOALL
-#define SO_REUSE_RXTOALL 0
-#endif
-
-/*
- ----------------------------------------
- ---------- Statistics options ----------
- ----------------------------------------
-*/
-/**
- * LWIP_STATS==1: Enable statistics collection in lwip_stats.
- */
-#ifndef LWIP_STATS
-#define LWIP_STATS 0
-#endif
-
-#if LWIP_STATS
-
-/**
- * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
- */
-#ifndef LWIP_STATS_DISPLAY
-#define LWIP_STATS_DISPLAY 0
-#endif
-
-/**
- * LINK_STATS==1: Enable link stats.
- */
-#ifndef LINK_STATS
-#define LINK_STATS 1
-#endif
-
-/**
- * ETHARP_STATS==1: Enable etharp stats.
- */
-#ifndef ETHARP_STATS
-#define ETHARP_STATS (LWIP_ARP)
-#endif
-
-/**
- * IP_STATS==1: Enable IP stats.
- */
-#ifndef IP_STATS
-#define IP_STATS 1
-#endif
-
-/**
- * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is
- * on if using either frag or reass.
- */
-#ifndef IPFRAG_STATS
-#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
-#endif
-
-/**
- * ICMP_STATS==1: Enable ICMP stats.
- */
-#ifndef ICMP_STATS
-#define ICMP_STATS 1
-#endif
-
-/**
- * IGMP_STATS==1: Enable IGMP stats.
- */
-#ifndef IGMP_STATS
-#define IGMP_STATS (LWIP_IGMP)
-#endif
-
-/**
- * UDP_STATS==1: Enable UDP stats. Default is on if
- * UDP enabled, otherwise off.
- */
-#ifndef UDP_STATS
-#define UDP_STATS (LWIP_UDP)
-#endif
-
-/**
- * TCP_STATS==1: Enable TCP stats. Default is on if TCP
- * enabled, otherwise off.
- */
-#ifndef TCP_STATS
-#define TCP_STATS (LWIP_TCP)
-#endif
-
-/**
- * MEM_STATS==1: Enable mem.c stats.
- */
-#ifndef MEM_STATS
-#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
-#endif
-
-/**
- * MEMP_STATS==1: Enable memp.c pool stats.
- */
-#ifndef MEMP_STATS
-#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
-#endif
-
-/**
- * SYS_STATS==1: Enable system stats (sem and mbox counts, etc).
- */
-#ifndef SYS_STATS
-#define SYS_STATS (NO_SYS == 0)
-#endif
-
-#else
-#define ETHARP_STATS 0
-#define LINK_STATS 0
-#define IP_STATS 0
-#define IPFRAG_STATS 0
-#define ICMP_STATS 0
-#define IGMP_STATS 0
-#define UDP_STATS 0
-#define TCP_STATS 0
-#define MEM_STATS 0
-#define MEMP_STATS 0
-#define SYS_STATS 0
-#define LWIP_STATS_DISPLAY 0
-
-#endif /* LWIP_STATS */
-
-/*
- ---------------------------------
- ---------- PPP options ----------
- ---------------------------------
-*/
-/**
- * PPP_SUPPORT==1: Enable PPP.
- */
-#ifndef PPP_SUPPORT
-#define PPP_SUPPORT 0
-#endif
-
-/**
- * PPPOE_SUPPORT==1: Enable PPP Over Ethernet
- */
-#ifndef PPPOE_SUPPORT
-#define PPPOE_SUPPORT 0
-#endif
-
-/**
- * PPPOS_SUPPORT==1: Enable PPP Over Serial
- */
-#ifndef PPPOS_SUPPORT
-#define PPPOS_SUPPORT PPP_SUPPORT
-#endif
-
-#if PPP_SUPPORT
-
-/**
- * NUM_PPP: Max PPP sessions.
- */
-#ifndef NUM_PPP
-#define NUM_PPP 1
-#endif
-
-/**
- * PAP_SUPPORT==1: Support PAP.
- */
-#ifndef PAP_SUPPORT
-#define PAP_SUPPORT 0
-#endif
-
-/**
- * CHAP_SUPPORT==1: Support CHAP.
- */
-#ifndef CHAP_SUPPORT
-#define CHAP_SUPPORT 0
-#endif
-
-/**
- * MSCHAP_SUPPORT==1: Support MSCHAP. CURRENTLY NOT SUPPORTED! DO NOT SET!
- */
-#ifndef MSCHAP_SUPPORT
-#define MSCHAP_SUPPORT 0
-#endif
-
-/**
- * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET!
- */
-#ifndef CBCP_SUPPORT
-#define CBCP_SUPPORT 0
-#endif
-
-/**
- * CCP_SUPPORT==1: Support CCP. CURRENTLY NOT SUPPORTED! DO NOT SET!
- */
-#ifndef CCP_SUPPORT
-#define CCP_SUPPORT 0
-#endif
-
-/**
- * VJ_SUPPORT==1: Support VJ header compression.
- */
-#ifndef VJ_SUPPORT
-#define VJ_SUPPORT 0
-#endif
-
-/**
- * MD5_SUPPORT==1: Support MD5 (see also CHAP).
- */
-#ifndef MD5_SUPPORT
-#define MD5_SUPPORT 0
-#endif
-
-/*
- * Timeouts
- */
-#ifndef FSM_DEFTIMEOUT
-#define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */
-#endif
-
-#ifndef FSM_DEFMAXTERMREQS
-#define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
-#endif
-
-#ifndef FSM_DEFMAXCONFREQS
-#define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
-#endif
-
-#ifndef FSM_DEFMAXNAKLOOPS
-#define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
-#endif
-
-#ifndef UPAP_DEFTIMEOUT
-#define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */
-#endif
-
-#ifndef UPAP_DEFREQTIME
-#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
-#endif
-
-#ifndef CHAP_DEFTIMEOUT
-#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */
-#endif
-
-#ifndef CHAP_DEFTRANSMITS
-#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
-#endif
-
-/* Interval in seconds between keepalive echo requests, 0 to disable. */
-#ifndef LCP_ECHOINTERVAL
-#define LCP_ECHOINTERVAL 0
-#endif
-
-/* Number of unanswered echo requests before failure. */
-#ifndef LCP_MAXECHOFAILS
-#define LCP_MAXECHOFAILS 3
-#endif
-
-/* Max Xmit idle time (in jiffies) before resend flag char. */
-#ifndef PPP_MAXIDLEFLAG
-#define PPP_MAXIDLEFLAG 100
-#endif
-
-/*
- * Packet sizes
- *
- * Note - lcp shouldn't be allowed to negotiate stuff outside these
- * limits. See lcp.h in the pppd directory.
- * (XXX - these constants should simply be shared by lcp.c instead
- * of living in lcp.h)
- */
-#define PPP_MTU 1500 /* Default MTU (size of Info field) */
-#ifndef PPP_MAXMTU
-/* #define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN) */
-#define PPP_MAXMTU 1500 /* Largest MTU we allow */
-#endif
-#define PPP_MINMTU 64
-#define PPP_MRU 1500 /* default MRU = max length of info field */
-#define PPP_MAXMRU 1500 /* Largest MRU we allow */
-#ifndef PPP_DEFMRU
-#define PPP_DEFMRU 296 /* Try for this */
-#endif
-#define PPP_MINMRU 128 /* No MRUs below this */
-
-#ifndef MAXNAMELEN
-#define MAXNAMELEN 256 /* max length of hostname or name for auth */
-#endif
-#ifndef MAXSECRETLEN
-#define MAXSECRETLEN 256 /* max length of password or secret */
-#endif
-
-#endif /* PPP_SUPPORT */
-
-/*
- --------------------------------------
- ---------- Checksum options ----------
- --------------------------------------
-*/
-/**
- * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.
- */
-#ifndef CHECKSUM_GEN_IP
-#define CHECKSUM_GEN_IP 1
-#endif
-
-/**
- * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
- */
-#ifndef CHECKSUM_GEN_UDP
-#define CHECKSUM_GEN_UDP 1
-#endif
-
-/**
- * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
- */
-#ifndef CHECKSUM_GEN_TCP
-#define CHECKSUM_GEN_TCP 1
-#endif
-
-/**
- * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
- */
-#ifndef CHECKSUM_CHECK_IP
-#define CHECKSUM_CHECK_IP 1
-#endif
-
-/**
- * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
- */
-#ifndef CHECKSUM_CHECK_UDP
-#define CHECKSUM_CHECK_UDP 1
-#endif
-
-/**
- * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.
- */
-#ifndef CHECKSUM_CHECK_TCP
-#define CHECKSUM_CHECK_TCP 1
-#endif
-
-/**
- * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from
- * application buffers to pbufs.
- */
-#ifndef LWIP_CHECKSUM_ON_COPY
-#define LWIP_CHECKSUM_ON_COPY 0
-#endif
-
-/*
- ---------------------------------------
- ---------- Debugging options ----------
- ---------------------------------------
-*/
-/**
- * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is
- * compared against this value. If it is smaller, then debugging
- * messages are written.
- */
-#ifndef LWIP_DBG_MIN_LEVEL
-#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
-#endif
-
-/**
- * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable
- * debug messages of certain types.
- */
-#ifndef LWIP_DBG_TYPES_ON
-#define LWIP_DBG_TYPES_ON LWIP_DBG_OFF
-#endif
-
-/**
- * ETHARP_DEBUG: Enable debugging in etharp.c.
- */
-#ifndef ETHARP_DEBUG
-#define ETHARP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * NETIF_DEBUG: Enable debugging in netif.c.
- */
-#ifndef NETIF_DEBUG
-#define NETIF_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * PBUF_DEBUG: Enable debugging in pbuf.c.
- */
-#ifndef PBUF_DEBUG
-#define PBUF_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * API_LIB_DEBUG: Enable debugging in api_lib.c.
- */
-#ifndef API_LIB_DEBUG
-#define API_LIB_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * API_MSG_DEBUG: Enable debugging in api_msg.c.
- */
-#ifndef API_MSG_DEBUG
-#define API_MSG_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SOCKETS_DEBUG: Enable debugging in sockets.c.
- */
-#ifndef SOCKETS_DEBUG
-#define SOCKETS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * ICMP_DEBUG: Enable debugging in icmp.c.
- */
-#ifndef ICMP_DEBUG
-#define ICMP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * IGMP_DEBUG: Enable debugging in igmp.c.
- */
-#ifndef IGMP_DEBUG
-#define IGMP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * INET_DEBUG: Enable debugging in inet.c.
- */
-#ifndef INET_DEBUG
-#define INET_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * IP_DEBUG: Enable debugging for IP.
- */
-#ifndef IP_DEBUG
-#define IP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
- */
-#ifndef IP_REASS_DEBUG
-#define IP_REASS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * RAW_DEBUG: Enable debugging in raw.c.
- */
-#ifndef RAW_DEBUG
-#define RAW_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * MEM_DEBUG: Enable debugging in mem.c.
- */
-#ifndef MEM_DEBUG
-#define MEM_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * MEMP_DEBUG: Enable debugging in memp.c.
- */
-#ifndef MEMP_DEBUG
-#define MEMP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SYS_DEBUG: Enable debugging in sys.c.
- */
-#ifndef SYS_DEBUG
-#define SYS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TIMERS_DEBUG: Enable debugging in timers.c.
- */
-#ifndef TIMERS_DEBUG
-#define TIMERS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_DEBUG: Enable debugging for TCP.
- */
-#ifndef TCP_DEBUG
-#define TCP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
- */
-#ifndef TCP_INPUT_DEBUG
-#define TCP_INPUT_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
- */
-#ifndef TCP_FR_DEBUG
-#define TCP_FR_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
- * timeout.
- */
-#ifndef TCP_RTO_DEBUG
-#define TCP_RTO_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
- */
-#ifndef TCP_CWND_DEBUG
-#define TCP_CWND_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
- */
-#ifndef TCP_WND_DEBUG
-#define TCP_WND_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
- */
-#ifndef TCP_OUTPUT_DEBUG
-#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
- */
-#ifndef TCP_RST_DEBUG
-#define TCP_RST_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
- */
-#ifndef TCP_QLEN_DEBUG
-#define TCP_QLEN_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * UDP_DEBUG: Enable debugging in UDP.
- */
-#ifndef UDP_DEBUG
-#define UDP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCPIP_DEBUG: Enable debugging in tcpip.c.
- */
-#ifndef TCPIP_DEBUG
-#define TCPIP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * PPP_DEBUG: Enable debugging for PPP.
- */
-#ifndef PPP_DEBUG
-#define PPP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SLIP_DEBUG: Enable debugging in slipif.c.
- */
-#ifndef SLIP_DEBUG
-#define SLIP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * DHCP_DEBUG: Enable debugging in dhcp.c.
- */
-#ifndef DHCP_DEBUG
-#define DHCP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * AUTOIP_DEBUG: Enable debugging in autoip.c.
- */
-#ifndef AUTOIP_DEBUG
-#define AUTOIP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SNMP_MSG_DEBUG: Enable debugging for SNMP messages.
- */
-#ifndef SNMP_MSG_DEBUG
-#define SNMP_MSG_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs.
- */
-#ifndef SNMP_MIB_DEBUG
-#define SNMP_MIB_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * DNS_DEBUG: Enable debugging for DNS.
- */
-#ifndef DNS_DEBUG
-#define DNS_DEBUG LWIP_DBG_OFF
-#endif
-
-#endif /* __LWIP_OPT_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/api.h b/sparkfun/esp8266/firmwares/loader/src/lwip/api.h
deleted file mode 100644
index 91b9e5d2..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/api.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_API_H__
-#define __LWIP_API_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
-
-#include /* for size_t */
-
-#include "lwip/netbuf.h"
-#include "lwip/sys.h"
-#include "lwip/ip_addr.h"
-#include "lwip/err.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Throughout this file, IP addresses and port numbers are expected to be in
- * the same byte order as in the corresponding pcb.
- */
-
-/* Flags for netconn_write (u8_t) */
-#define NETCONN_NOFLAG 0x00
-#define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */
-#define NETCONN_COPY 0x01
-#define NETCONN_MORE 0x02
-#define NETCONN_DONTBLOCK 0x04
-
-/* Flags for struct netconn.flags (u8_t) */
-/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
- this temporarily stores whether to wake up the original application task
- if data couldn't be sent in the first try. */
-#define NETCONN_FLAG_WRITE_DELAYED 0x01
-/** Should this netconn avoid blocking? */
-#define NETCONN_FLAG_NON_BLOCKING 0x02
-/** Was the last connect action a non-blocking one? */
-#define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04
-/** If this is set, a TCP netconn must call netconn_recved() to update
- the TCP receive window (done automatically if not set). */
-#define NETCONN_FLAG_NO_AUTO_RECVED 0x08
-/** If a nonblocking write has been rejected before, poll_tcp needs to
- check if the netconn is writable again */
-#define NETCONN_FLAG_CHECK_WRITESPACE 0x10
-
-
-/* Helpers to process several netconn_types by the same code */
-#define NETCONNTYPE_GROUP(t) (t&0xF0)
-#define NETCONNTYPE_DATAGRAM(t) (t&0xE0)
-
-/** Protocol family and type of the netconn */
-enum netconn_type {
- NETCONN_INVALID = 0,
- /* NETCONN_TCP Group */
- NETCONN_TCP = 0x10,
- /* NETCONN_UDP Group */
- NETCONN_UDP = 0x20,
- NETCONN_UDPLITE = 0x21,
- NETCONN_UDPNOCHKSUM= 0x22,
- /* NETCONN_RAW Group */
- NETCONN_RAW = 0x40
-};
-
-/** Current state of the netconn. Non-TCP netconns are always
- * in state NETCONN_NONE! */
-enum netconn_state {
- NETCONN_NONE,
- NETCONN_WRITE,
- NETCONN_LISTEN,
- NETCONN_CONNECT,
- NETCONN_CLOSE
-};
-
-/** Use to inform the callback function about changes */
-enum netconn_evt {
- NETCONN_EVT_RCVPLUS,
- NETCONN_EVT_RCVMINUS,
- NETCONN_EVT_SENDPLUS,
- NETCONN_EVT_SENDMINUS,
- NETCONN_EVT_ERROR
-};
-
-#if LWIP_IGMP
-/** Used for netconn_join_leave_group() */
-enum netconn_igmp {
- NETCONN_JOIN,
- NETCONN_LEAVE
-};
-#endif /* LWIP_IGMP */
-
-/* forward-declare some structs to avoid to include their headers */
-struct ip_pcb;
-struct tcp_pcb;
-struct udp_pcb;
-struct raw_pcb;
-struct netconn;
-struct api_msg_msg;
-
-/** A callback prototype to inform about events for a netconn */
-typedef void (* netconn_callback)(struct netconn *, enum netconn_evt, u16_t len);
-
-/** A netconn descriptor */
-struct netconn {
- /** type of the netconn (TCP, UDP or RAW) */
- enum netconn_type type;
- /** current state of the netconn */
- enum netconn_state state;
- /** the lwIP internal protocol control block */
- union {
- struct ip_pcb *ip;
- struct tcp_pcb *tcp;
- struct udp_pcb *udp;
- struct raw_pcb *raw;
- } pcb;
- /** the last error this netconn had */
- err_t last_err;
- /** sem that is used to synchroneously execute functions in the core context */
- sys_sem_t op_completed;
- /** mbox where received packets are stored until they are fetched
- by the netconn application thread (can grow quite big) */
- sys_mbox_t recvmbox;
-#if LWIP_TCP
- /** mbox where new connections are stored until processed
- by the application thread */
- sys_mbox_t acceptmbox;
-#endif /* LWIP_TCP */
- /** only used for socket layer */
-#if LWIP_SOCKET
- int socket;
-#endif /* LWIP_SOCKET */
-#if LWIP_SO_RCVTIMEO
- /** timeout to wait for new data to be received
- (or connections to arrive for listening netconns) */
- int recv_timeout;
-#endif /* LWIP_SO_RCVTIMEO */
-#if LWIP_SO_RCVBUF
- /** maximum amount of bytes queued in recvmbox
- not used for TCP: adjust TCP_WND instead! */
- int recv_bufsize;
- /** number of bytes currently in recvmbox to be received,
- tested against recv_bufsize to limit bytes on recvmbox
- for UDP and RAW, used for FIONREAD */
- s16_t recv_avail;
-#endif /* LWIP_SO_RCVBUF */
- /** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */
- u8_t flags;
-#if LWIP_TCP
- /** TCP: when data passed to netconn_write doesn't fit into the send buffer,
- this temporarily stores how much is already sent. */
- size_t write_offset;
- /** TCP: when data passed to netconn_write doesn't fit into the send buffer,
- this temporarily stores the message.
- Also used during connect and close. */
- struct api_msg_msg *current_msg;
-#endif /* LWIP_TCP */
- /** A callback function that is informed about events for this netconn */
- netconn_callback callback;
-};
-
-/** Register an Network connection event */
-#define API_EVENT(c,e,l) if (c->callback) { \
- (*c->callback)(c, e, l); \
- }
-
-/** Set conn->last_err to err but don't overwrite fatal errors */
-#define NETCONN_SET_SAFE_ERR(conn, err) do { \
- SYS_ARCH_DECL_PROTECT(lev); \
- SYS_ARCH_PROTECT(lev); \
- if (!ERR_IS_FATAL((conn)->last_err)) { \
- (conn)->last_err = err; \
- } \
- SYS_ARCH_UNPROTECT(lev); \
-} while(0);
-
-/* Network connection functions: */
-#define netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL)
-#define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c)
-struct
-netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto,
- netconn_callback callback);
-err_t netconn_delete(struct netconn *conn);
-/** Get the type of a netconn (as enum netconn_type). */
-#define netconn_type(conn) (conn->type)
-
-err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr,
- u16_t *port, u8_t local);
-#define netconn_peer(c,i,p) netconn_getaddr(c,i,p,0)
-#define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1)
-
-err_t netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port);
-err_t netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port);
-err_t netconn_disconnect (struct netconn *conn);
-err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog);
-#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
-err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
-err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf);
-err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf);
-void netconn_recved(struct netconn *conn, u32_t length);
-err_t netconn_sendto(struct netconn *conn, struct netbuf *buf,
- ip_addr_t *addr, u16_t port);
-err_t netconn_send(struct netconn *conn, struct netbuf *buf);
-err_t netconn_write(struct netconn *conn, const void *dataptr, size_t size,
- u8_t apiflags);
-err_t netconn_close(struct netconn *conn);
-err_t netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx);
-
-#if LWIP_IGMP
-err_t netconn_join_leave_group(struct netconn *conn, ip_addr_t *multiaddr,
- ip_addr_t *netif_addr, enum netconn_igmp join_or_leave);
-#endif /* LWIP_IGMP */
-#if LWIP_DNS
-err_t netconn_gethostbyname(const char *name, ip_addr_t *addr);
-#endif /* LWIP_DNS */
-
-#define netconn_err(conn) ((conn)->last_err)
-#define netconn_recv_bufsize(conn) ((conn)->recv_bufsize)
-
-/** Set the blocking status of netconn calls (@todo: write/send is missing) */
-#define netconn_set_nonblocking(conn, val) do { if(val) { \
- (conn)->flags |= NETCONN_FLAG_NON_BLOCKING; \
-} else { \
- (conn)->flags &= ~ NETCONN_FLAG_NON_BLOCKING; }} while(0)
-/** Get the blocking status of netconn calls (@todo: write/send is missing) */
-#define netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0)
-
-/** TCP: Set the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */
-#define netconn_set_noautorecved(conn, val) do { if(val) { \
- (conn)->flags |= NETCONN_FLAG_NO_AUTO_RECVED; \
-} else { \
- (conn)->flags &= ~ NETCONN_FLAG_NO_AUTO_RECVED; }} while(0)
-/** TCP: Get the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */
-#define netconn_get_noautorecved(conn) (((conn)->flags & NETCONN_FLAG_NO_AUTO_RECVED) != 0)
-
-#if LWIP_SO_RCVTIMEO
-/** Set the receive timeout in milliseconds */
-#define netconn_set_recvtimeout(conn, timeout) ((conn)->recv_timeout = (timeout))
-/** Get the receive timeout in milliseconds */
-#define netconn_get_recvtimeout(conn) ((conn)->recv_timeout)
-#endif /* LWIP_SO_RCVTIMEO */
-#if LWIP_SO_RCVBUF
-/** Set the receive buffer in bytes */
-#define netconn_set_recvbufsize(conn, recvbufsize) ((conn)->recv_bufsize = (recvbufsize))
-/** Get the receive buffer in bytes */
-#define netconn_get_recvbufsize(conn) ((conn)->recv_bufsize)
-#endif /* LWIP_SO_RCVBUF*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_NETCONN */
-
-#endif /* __LWIP_API_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/api_msg.h b/sparkfun/esp8266/firmwares/loader/src/lwip/api_msg.h
deleted file mode 100644
index f99d8c3b..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/api_msg.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_API_MSG_H__
-#define __LWIP_API_MSG_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
-
-#include /* for size_t */
-
-#include "lwip/ip_addr.h"
-#include "lwip/err.h"
-#include "lwip/sys.h"
-#include "lwip/igmp.h"
-#include "lwip/api.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For the netconn API, these values are use as a bitmask! */
-#define NETCONN_SHUT_RD 1
-#define NETCONN_SHUT_WR 2
-#define NETCONN_SHUT_RDWR (NETCONN_SHUT_RD | NETCONN_SHUT_WR)
-
-/* IP addresses and port numbers are expected to be in
- * the same byte order as in the corresponding pcb.
- */
-/** This struct includes everything that is necessary to execute a function
- for a netconn in another thread context (mainly used to process netconns
- in the tcpip_thread context to be thread safe). */
-struct api_msg_msg {
- /** The netconn which to process - always needed: it includes the semaphore
- which is used to block the application thread until the function finished. */
- struct netconn *conn;
- /** The return value of the function executed in tcpip_thread. */
- err_t err;
- /** Depending on the executed function, one of these union members is used */
- union {
- /** used for do_send */
- struct netbuf *b;
- /** used for do_newconn */
- struct {
- u8_t proto;
- } n;
- /** used for do_bind and do_connect */
- struct {
- ip_addr_t *ipaddr;
- u16_t port;
- } bc;
- /** used for do_getaddr */
- struct {
- ip_addr_t *ipaddr;
- u16_t *port;
- u8_t local;
- } ad;
- /** used for do_write */
- struct {
- const void *dataptr;
- size_t len;
- u8_t apiflags;
- } w;
- /** used for do_recv */
- struct {
- u32_t len;
- } r;
- /** used for do_close (/shutdown) */
- struct {
- u8_t shut;
- } sd;
-#if LWIP_IGMP
- /** used for do_join_leave_group */
- struct {
- ip_addr_t *multiaddr;
- ip_addr_t *netif_addr;
- enum netconn_igmp join_or_leave;
- } jl;
-#endif /* LWIP_IGMP */
-#if TCP_LISTEN_BACKLOG
- struct {
- u8_t backlog;
- } lb;
-#endif /* TCP_LISTEN_BACKLOG */
- } msg;
-};
-
-/** This struct contains a function to execute in another thread context and
- a struct api_msg_msg that serves as an argument for this function.
- This is passed to tcpip_apimsg to execute functions in tcpip_thread context. */
-struct api_msg {
- /** function to execute in tcpip_thread context */
- void (* function)(struct api_msg_msg *msg);
- /** arguments for this function */
- struct api_msg_msg msg;
-};
-
-#if LWIP_DNS
-/** As do_gethostbyname requires more arguments but doesn't require a netconn,
- it has its own struct (to avoid struct api_msg getting bigger than necessary).
- do_gethostbyname must be called using tcpip_callback instead of tcpip_apimsg
- (see netconn_gethostbyname). */
-struct dns_api_msg {
- /** Hostname to query or dotted IP address string */
- const char *name;
- /** Rhe resolved address is stored here */
- ip_addr_t *addr;
- /** This semaphore is posted when the name is resolved, the application thread
- should wait on it. */
- sys_sem_t *sem;
- /** Errors are given back here */
- err_t *err;
-};
-#endif /* LWIP_DNS */
-
-void do_newconn ( struct api_msg_msg *msg);
-void do_delconn ( struct api_msg_msg *msg);
-void do_bind ( struct api_msg_msg *msg);
-void do_connect ( struct api_msg_msg *msg);
-void do_disconnect ( struct api_msg_msg *msg);
-void do_listen ( struct api_msg_msg *msg);
-void do_send ( struct api_msg_msg *msg);
-void do_recv ( struct api_msg_msg *msg);
-void do_write ( struct api_msg_msg *msg);
-void do_getaddr ( struct api_msg_msg *msg);
-void do_close ( struct api_msg_msg *msg);
-void do_shutdown ( struct api_msg_msg *msg);
-#if LWIP_IGMP
-void do_join_leave_group( struct api_msg_msg *msg);
-#endif /* LWIP_IGMP */
-
-#if LWIP_DNS
-void do_gethostbyname(void *arg);
-#endif /* LWIP_DNS */
-
-struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback);
-void netconn_free(struct netconn *conn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_NETCONN */
-
-#endif /* __LWIP_API_MSG_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/arch.h b/sparkfun/esp8266/firmwares/loader/src/lwip/arch.h
deleted file mode 100644
index 524af6be..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/arch.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_ARCH_H__
-#define __LWIP_ARCH_H__
-
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN 4321
-#endif
-
-#include "arch/cc.h"
-
-/** Temporary: define format string for size_t if not defined in cc.h */
-#ifndef SZT_F
-#define SZT_F U32_F
-#endif /* SZT_F */
-/** Temporary upgrade helper: define format string for u8_t as hex if not
- defined in cc.h */
-#ifndef X8_F
-#define X8_F "02x"
-#endif /* X8_F */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef PACK_STRUCT_BEGIN
-#define PACK_STRUCT_BEGIN
-#endif /* PACK_STRUCT_BEGIN */
-
-#ifndef PACK_STRUCT_END
-#define PACK_STRUCT_END
-#endif /* PACK_STRUCT_END */
-
-#ifndef PACK_STRUCT_FIELD
-#define PACK_STRUCT_FIELD(x) x
-#endif /* PACK_STRUCT_FIELD */
-
-
-#ifndef LWIP_UNUSED_ARG
-#define LWIP_UNUSED_ARG(x) (void)x
-#endif /* LWIP_UNUSED_ARG */
-
-
-#ifdef LWIP_PROVIDE_ERRNO
-
-#define EPERM 1 /* Operation not permitted */
-#define ENOENT 2 /* No such file or directory */
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted system call */
-#define EIO 5 /* I/O error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file number */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Try again */
-#define ENOMEM 12 /* Out of memory */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-#define ENOTBLK 15 /* Block device required */
-#define EBUSY 16 /* Device or resource busy */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Cross-device link */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* File table overflow */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Not a typewriter */
-#define ETXTBSY 26 /* Text file busy */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Illegal seek */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Math argument out of domain of func */
-#define ERANGE 34 /* Math result not representable */
-#define EDEADLK 35 /* Resource deadlock would occur */
-#define ENAMETOOLONG 36 /* File name too long */
-#define ENOLCK 37 /* No record locks available */
-#define ENOSYS 38 /* Function not implemented */
-#define ENOTEMPTY 39 /* Directory not empty */
-#define ELOOP 40 /* Too many symbolic links encountered */
-#define EWOULDBLOCK EAGAIN /* Operation would block */
-#define ENOMSG 42 /* No message of desired type */
-#define EIDRM 43 /* Identifier removed */
-#define ECHRNG 44 /* Channel number out of range */
-#define EL2NSYNC 45 /* Level 2 not synchronized */
-#define EL3HLT 46 /* Level 3 halted */
-#define EL3RST 47 /* Level 3 reset */
-#define ELNRNG 48 /* Link number out of range */
-#define EUNATCH 49 /* Protocol driver not attached */
-#define ENOCSI 50 /* No CSI structure available */
-#define EL2HLT 51 /* Level 2 halted */
-#define EBADE 52 /* Invalid exchange */
-#define EBADR 53 /* Invalid request descriptor */
-#define EXFULL 54 /* Exchange full */
-#define ENOANO 55 /* No anode */
-#define EBADRQC 56 /* Invalid request code */
-#define EBADSLT 57 /* Invalid slot */
-
-#define EDEADLOCK EDEADLK
-
-#define EBFONT 59 /* Bad font file format */
-#define ENOSTR 60 /* Device not a stream */
-#define ENODATA 61 /* No data available */
-#define ETIME 62 /* Timer expired */
-#define ENOSR 63 /* Out of streams resources */
-#define ENONET 64 /* Machine is not on the network */
-#define ENOPKG 65 /* Package not installed */
-#define EREMOTE 66 /* Object is remote */
-#define ENOLINK 67 /* Link has been severed */
-#define EADV 68 /* Advertise error */
-#define ESRMNT 69 /* Srmount error */
-#define ECOMM 70 /* Communication error on send */
-#define EPROTO 71 /* Protocol error */
-#define EMULTIHOP 72 /* Multihop attempted */
-#define EDOTDOT 73 /* RFS specific error */
-#define EBADMSG 74 /* Not a data message */
-#define EOVERFLOW 75 /* Value too large for defined data type */
-#define ENOTUNIQ 76 /* Name not unique on network */
-#define EBADFD 77 /* File descriptor in bad state */
-#define EREMCHG 78 /* Remote address changed */
-#define ELIBACC 79 /* Can not access a needed shared library */
-#define ELIBBAD 80 /* Accessing a corrupted shared library */
-#define ELIBSCN 81 /* .lib section in a.out corrupted */
-#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
-#define ELIBEXEC 83 /* Cannot exec a shared library directly */
-#define EILSEQ 84 /* Illegal byte sequence */
-#define ERESTART 85 /* Interrupted system call should be restarted */
-#define ESTRPIPE 86 /* Streams pipe error */
-#define EUSERS 87 /* Too many users */
-#define ENOTSOCK 88 /* Socket operation on non-socket */
-#define EDESTADDRREQ 89 /* Destination address required */
-#define EMSGSIZE 90 /* Message too long */
-#define EPROTOTYPE 91 /* Protocol wrong type for socket */
-#define ENOPROTOOPT 92 /* Protocol not available */
-#define EPROTONOSUPPORT 93 /* Protocol not supported */
-#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
-#define EPFNOSUPPORT 96 /* Protocol family not supported */
-#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
-#define EADDRINUSE 98 /* Address already in use */
-#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
-#define ENETDOWN 100 /* Network is down */
-#define ENETUNREACH 101 /* Network is unreachable */
-#define ENETRESET 102 /* Network dropped connection because of reset */
-#define ECONNABORTED 103 /* Software caused connection abort */
-#define ECONNRESET 104 /* Connection reset by peer */
-#define ENOBUFS 105 /* No buffer space available */
-#define EISCONN 106 /* Transport endpoint is already connected */
-#define ENOTCONN 107 /* Transport endpoint is not connected */
-#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
-#define ETOOMANYREFS 109 /* Too many references: cannot splice */
-#define ETIMEDOUT 110 /* Connection timed out */
-#define ECONNREFUSED 111 /* Connection refused */
-#define EHOSTDOWN 112 /* Host is down */
-#define EHOSTUNREACH 113 /* No route to host */
-#define EALREADY 114 /* Operation already in progress */
-#define EINPROGRESS 115 /* Operation now in progress */
-#define ESTALE 116 /* Stale NFS file handle */
-#define EUCLEAN 117 /* Structure needs cleaning */
-#define ENOTNAM 118 /* Not a XENIX named type file */
-#define ENAVAIL 119 /* No XENIX semaphores available */
-#define EISNAM 120 /* Is a named type file */
-#define EREMOTEIO 121 /* Remote I/O error */
-#define EDQUOT 122 /* Quota exceeded */
-
-#define ENOMEDIUM 123 /* No medium found */
-#define EMEDIUMTYPE 124 /* Wrong medium type */
-
-
-#define ENSROK 0 /* DNS server returned answer with no data */
-#define ENSRNODATA 160 /* DNS server returned answer with no data */
-#define ENSRFORMERR 161 /* DNS server claims query was misformatted */
-#define ENSRSERVFAIL 162 /* DNS server returned general failure */
-#define ENSRNOTFOUND 163 /* Domain name not found */
-#define ENSRNOTIMP 164 /* DNS server does not implement requested operation */
-#define ENSRREFUSED 165 /* DNS server refused query */
-#define ENSRBADQUERY 166 /* Misformatted DNS query */
-#define ENSRBADNAME 167 /* Misformatted domain name */
-#define ENSRBADFAMILY 168 /* Unsupported address family */
-#define ENSRBADRESP 169 /* Misformatted DNS reply */
-#define ENSRCONNREFUSED 170 /* Could not contact DNS servers */
-#define ENSRTIMEOUT 171 /* Timeout while contacting DNS servers */
-#define ENSROF 172 /* End of file */
-#define ENSRFILE 173 /* Error reading file */
-#define ENSRNOMEM 174 /* Out of memory */
-#define ENSRDESTRUCTION 175 /* Application terminated lookup */
-#define ENSRQUERYDOMAINTOOLONG 176 /* Domain name is too long */
-#define ENSRCNAMELOOP 177 /* Domain name is too long */
-
-#ifndef errno
-extern int errno;
-#endif
-
-#endif /* LWIP_PROVIDE_ERRNO */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_ARCH_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/autoip.h b/sparkfun/esp8266/firmwares/loader/src/lwip/autoip.h
deleted file mode 100644
index 23c264a1..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/autoip.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * @file
- *
- * AutoIP Automatic LinkLocal IP Configuration
- */
-
-/*
- *
- * Copyright (c) 2007 Dominik Spies
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Dominik Spies
- *
- * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
- * with RFC 3927.
- *
- *
- * Please coordinate changes and requests with Dominik Spies
- *
- */
-
-#ifndef __LWIP_AUTOIP_H__
-#define __LWIP_AUTOIP_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/netif.h"
-#include "lwip/udp.h"
-#include "netif/etharp.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* AutoIP Timing */
-#define AUTOIP_TMR_INTERVAL 100
-#define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL)
-
-/* RFC 3927 Constants */
-#define PROBE_WAIT 1 /* second (initial random delay) */
-#define PROBE_MIN 1 /* second (minimum delay till repeated probe) */
-#define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */
-#define PROBE_NUM 3 /* (number of probe packets) */
-#define ANNOUNCE_NUM 2 /* (number of announcement packets) */
-#define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */
-#define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */
-#define MAX_CONFLICTS 10 /* (max conflicts before rate limiting) */
-#define RATE_LIMIT_INTERVAL 60 /* seconds (delay between successive attempts) */
-#define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */
-
-/* AutoIP client states */
-#define AUTOIP_STATE_OFF 0
-#define AUTOIP_STATE_PROBING 1
-#define AUTOIP_STATE_ANNOUNCING 2
-#define AUTOIP_STATE_BOUND 3
-
-struct autoip
-{
- ip_addr_t llipaddr; /* the currently selected, probed, announced or used LL IP-Address */
- u8_t state; /* current AutoIP state machine state */
- u8_t sent_num; /* sent number of probes or announces, dependent on state */
- u16_t ttw; /* ticks to wait, tick is AUTOIP_TMR_INTERVAL long */
- u8_t lastconflict; /* ticks until a conflict can be solved by defending */
- u8_t tried_llipaddr; /* total number of probed/used Link Local IP-Addresses */
-};
-
-
-/** Init srand, has to be called before entering mainloop */
-void autoip_init(void);
-
-/** Set a struct autoip allocated by the application to work with */
-void autoip_set_struct(struct netif *netif, struct autoip *autoip);
-
-/** Start AutoIP client */
-err_t autoip_start(struct netif *netif);
-
-/** Stop AutoIP client */
-err_t autoip_stop(struct netif *netif);
-
-/** Handles every incoming ARP Packet, called by etharp_arp_input */
-void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
-
-/** Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds */
-void autoip_tmr(void);
-
-/** Handle a possible change in the network configuration */
-void autoip_network_changed(struct netif *netif);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_AUTOIP */
-
-#endif /* __LWIP_AUTOIP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/debug.h b/sparkfun/esp8266/firmwares/loader/src/lwip/debug.h
deleted file mode 100644
index d8359ea3..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/debug.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_DEBUG_H__
-#define __LWIP_DEBUG_H__
-
-#include "lwip/arch.h"
-
-/** lower two bits indicate debug level
- * - 0 all
- * - 1 warning
- * - 2 serious
- * - 3 severe
- */
-#define LWIP_DBG_LEVEL_ALL 0x00
-#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /* compatibility define only */
-#define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */
-#define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */
-#define LWIP_DBG_LEVEL_SEVERE 0x03
-#define LWIP_DBG_MASK_LEVEL 0x03
-
-/** flag for LWIP_DEBUGF to enable that debug message */
-#define LWIP_DBG_ON 0x80U
-/** flag for LWIP_DEBUGF to disable that debug message */
-#define LWIP_DBG_OFF 0x00U
-
-/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
-#define LWIP_DBG_TRACE 0x40U
-/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
-#define LWIP_DBG_STATE 0x20U
-/** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */
-#define LWIP_DBG_FRESH 0x10U
-/** flag for LWIP_DEBUGF to halt after printing this debug message */
-#define LWIP_DBG_HALT 0x08U
-
-#ifndef LWIP_NOASSERT
-#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \
- LWIP_PLATFORM_ASSERT(message); } while(0)
-#else /* LWIP_NOASSERT */
-#define LWIP_ASSERT(message, assertion)
-#endif /* LWIP_NOASSERT */
-
-/** if "expression" isn't true, then print "message" and execute "handler" expression */
-#ifndef LWIP_ERROR
-#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
- LWIP_PLATFORM_ASSERT(message); handler;}} while(0)
-#endif /* LWIP_ERROR */
-
-#ifdef LWIP_DEBUG
-/** print debug message only if debug message type is enabled...
- * AND is of correct type AND is at least LWIP_DBG_LEVEL
- */
-#define LWIP_DEBUGF(debug, message) do { \
- if ( \
- ((debug) & LWIP_DBG_ON) && \
- ((debug) & LWIP_DBG_TYPES_ON) && \
- ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
- LWIP_PLATFORM_DIAG(message); \
- if ((debug) & LWIP_DBG_HALT) { \
- while(1); \
- } \
- } \
- } while(0)
-
-#else /* LWIP_DEBUG */
-#define LWIP_DEBUGF(debug, message)
-#endif /* LWIP_DEBUG */
-
-#endif /* __LWIP_DEBUG_H__ */
-
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/def.h b/sparkfun/esp8266/firmwares/loader/src/lwip/def.h
deleted file mode 100644
index 9b6de6a8..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/def.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_DEF_H__
-#define __LWIP_DEF_H__
-
-/* arch.h might define NULL already */
-#include "lwip/arch.h"
-#include "lwip/opt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y))
-#define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y))
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
-/** Get the absolute difference between 2 u32_t values (correcting overflows)
- * 'a' is expected to be 'higher' (without overflow) than 'b'. */
-#define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1)))
-
-/* Endianess-optimized shifting of two u8_t to create one u16_t */
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define LWIP_MAKE_U16(a, b) ((a << 8) | b)
-#else
-#define LWIP_MAKE_U16(a, b) ((b << 8) | a)
-#endif
-
-#ifndef LWIP_PLATFORM_BYTESWAP
-#define LWIP_PLATFORM_BYTESWAP 0
-#endif
-
-#ifndef LWIP_PREFIX_BYTEORDER_FUNCS
-/* workaround for naming collisions on some platforms */
-
-#ifdef htons
-#undef htons
-#endif /* htons */
-#ifdef htonl
-#undef htonl
-#endif /* htonl */
-#ifdef ntohs
-#undef ntohs
-#endif /* ntohs */
-#ifdef ntohl
-#undef ntohl
-#endif /* ntohl */
-
-#define htons(x) lwip_htons(x)
-#define ntohs(x) lwip_ntohs(x)
-#define htonl(x) lwip_htonl(x)
-#define ntohl(x) lwip_ntohl(x)
-#endif /* LWIP_PREFIX_BYTEORDER_FUNCS */
-
-#if BYTE_ORDER == BIG_ENDIAN
-#define lwip_htons(x) (x)
-#define lwip_ntohs(x) (x)
-#define lwip_htonl(x) (x)
-#define lwip_ntohl(x) (x)
-#define PP_HTONS(x) (x)
-#define PP_NTOHS(x) (x)
-#define PP_HTONL(x) (x)
-#define PP_NTOHL(x) (x)
-#else /* BYTE_ORDER != BIG_ENDIAN */
-#if LWIP_PLATFORM_BYTESWAP
-#define lwip_htons(x) LWIP_PLATFORM_HTONS(x)
-#define lwip_ntohs(x) LWIP_PLATFORM_HTONS(x)
-#define lwip_htonl(x) LWIP_PLATFORM_HTONL(x)
-#define lwip_ntohl(x) LWIP_PLATFORM_HTONL(x)
-#else /* LWIP_PLATFORM_BYTESWAP */
-u16_t lwip_htons(u16_t x);
-u16_t lwip_ntohs(u16_t x);
-u32_t lwip_htonl(u32_t x);
-u32_t lwip_ntohl(u32_t x);
-#endif /* LWIP_PLATFORM_BYTESWAP */
-
-/* These macros should be calculated by the preprocessor and are used
- with compile-time constants only (so that there is no little-endian
- overhead at runtime). */
-#define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
-#define PP_NTOHS(x) PP_HTONS(x)
-#define PP_HTONL(x) ((((x) & 0xff) << 24) | \
- (((x) & 0xff00) << 8) | \
- (((x) & 0xff0000UL) >> 8) | \
- (((x) & 0xff000000UL) >> 24))
-#define PP_NTOHL(x) PP_HTONL(x)
-
-#endif /* BYTE_ORDER == BIG_ENDIAN */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_DEF_H__ */
-
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/dhcp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/dhcp.h
deleted file mode 100644
index ba21068c..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/dhcp.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/** @file
- */
-
-#ifndef __LWIP_DHCP_H__
-#define __LWIP_DHCP_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/netif.h"
-#include "lwip/udp.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** period (in seconds) of the application calling dhcp_coarse_tmr() */
-#define DHCP_COARSE_TIMER_SECS 60
-/** period (in milliseconds) of the application calling dhcp_coarse_tmr() */
-#define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL)
-/** period (in milliseconds) of the application calling dhcp_fine_tmr() */
-#define DHCP_FINE_TIMER_MSECS 500
-
-#define DHCP_CHADDR_LEN 16U
-#define DHCP_SNAME_LEN 64U
-#define DHCP_FILE_LEN 128U
-
-struct dhcp
-{
- /** transaction identifier of last sent request */
- u32_t xid;
- /** our connection to the DHCP server */
- struct udp_pcb *pcb;
- /** incoming msg */
- struct dhcp_msg *msg_in;
- /** current DHCP state machine state */
- u8_t state;
- /** retries of current request */
- u8_t tries;
-#if LWIP_DHCP_AUTOIP_COOP
- u8_t autoip_coop_state;
-#endif
- u8_t subnet_mask_given;
-
- struct pbuf *p_out; /* pbuf of outcoming msg */
- struct dhcp_msg *msg_out; /* outgoing msg */
- u16_t options_out_len; /* outgoing msg options length */
- u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
- u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
- u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */
- ip_addr_t server_ip_addr; /* dhcp server address that offered this lease */
- ip_addr_t offered_ip_addr;
- ip_addr_t offered_sn_mask;
- ip_addr_t offered_gw_addr;
-
- u32_t offered_t0_lease; /* lease period (in seconds) */
- u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
- u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */
- /* @todo: LWIP_DHCP_BOOTP_FILE configuration option?
- integrate with possible TFTP-client for booting? */
-#define LWIP_DHCP_BOOTP_FILE 0
-#if LWIP_DHCP_BOOTP_FILE
- ip_addr_t offered_si_addr;
- char boot_file_name[DHCP_FILE_LEN];
-#endif /* LWIP_DHCP_BOOTPFILE */
-};
-
-/* MUST be compiled with "pack structs" or equivalent! */
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-/** minimum set of fields of any DHCP message */
-struct dhcp_msg
-{
- PACK_STRUCT_FIELD(u8_t op);
- PACK_STRUCT_FIELD(u8_t htype);
- PACK_STRUCT_FIELD(u8_t hlen);
- PACK_STRUCT_FIELD(u8_t hops);
- PACK_STRUCT_FIELD(u32_t xid);
- PACK_STRUCT_FIELD(u16_t secs);
- PACK_STRUCT_FIELD(u16_t flags);
- PACK_STRUCT_FIELD(ip_addr_p_t ciaddr);
- PACK_STRUCT_FIELD(ip_addr_p_t yiaddr);
- PACK_STRUCT_FIELD(ip_addr_p_t siaddr);
- PACK_STRUCT_FIELD(ip_addr_p_t giaddr);
- PACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]);
- PACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]);
- PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]);
- PACK_STRUCT_FIELD(u32_t cookie);
-#define DHCP_MIN_OPTIONS_LEN 68U
-/** make sure user does not configure this too small */
-#if ((defined(DHCP_OPTIONS_LEN)) && (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN))
-# undef DHCP_OPTIONS_LEN
-#endif
-/** allow this to be configured in lwipopts.h, but not too small */
-#if (!defined(DHCP_OPTIONS_LEN))
-/** set this to be sufficient for your options in outgoing DHCP msgs */
-# define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN
-#endif
- PACK_STRUCT_FIELD(u8_t options[DHCP_OPTIONS_LEN]);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-void dhcp_set_struct(struct netif *netif, struct dhcp *dhcp);
-/** Remove a struct dhcp previously set to the netif using dhcp_set_struct() */
-#define dhcp_remove_struct(netif) do { (netif)->dhcp = NULL; } while(0)
-void dhcp_cleanup(struct netif *netif);
-/** start DHCP configuration */
-err_t dhcp_start(struct netif *netif);
-/** enforce early lease renewal (not needed normally)*/
-err_t dhcp_renew(struct netif *netif);
-/** release the DHCP lease, usually called before dhcp_stop()*/
-err_t dhcp_release(struct netif *netif);
-/** stop DHCP configuration */
-void dhcp_stop(struct netif *netif);
-/** inform server of our manual IP address */
-void dhcp_inform(struct netif *netif);
-/** Handle a possible change in the network configuration */
-void dhcp_network_changed(struct netif *netif);
-
-/** if enabled, check whether the offered IP address is not in use, using ARP */
-#if DHCP_DOES_ARP_CHECK
-void dhcp_arp_reply(struct netif *netif, ip_addr_t *addr);
-#endif
-
-/** to be called every minute */
-void dhcp_coarse_tmr(void);
-/** to be called every half second */
-void dhcp_fine_tmr(void);
-
-/** DHCP message item offsets and length */
-#define DHCP_OP_OFS 0
-#define DHCP_HTYPE_OFS 1
-#define DHCP_HLEN_OFS 2
-#define DHCP_HOPS_OFS 3
-#define DHCP_XID_OFS 4
-#define DHCP_SECS_OFS 8
-#define DHCP_FLAGS_OFS 10
-#define DHCP_CIADDR_OFS 12
-#define DHCP_YIADDR_OFS 16
-#define DHCP_SIADDR_OFS 20
-#define DHCP_GIADDR_OFS 24
-#define DHCP_CHADDR_OFS 28
-#define DHCP_SNAME_OFS 44
-#define DHCP_FILE_OFS 108
-#define DHCP_MSG_LEN 236
-
-#define DHCP_COOKIE_OFS DHCP_MSG_LEN
-#define DHCP_OPTIONS_OFS (DHCP_MSG_LEN + 4)
-
-#define DHCP_CLIENT_PORT 68
-#define DHCP_SERVER_PORT 67
-
-/** DHCP client states */
-#define DHCP_OFF 0
-#define DHCP_REQUESTING 1
-#define DHCP_INIT 2
-#define DHCP_REBOOTING 3
-#define DHCP_REBINDING 4
-#define DHCP_RENEWING 5
-#define DHCP_SELECTING 6
-#define DHCP_INFORMING 7
-#define DHCP_CHECKING 8
-#define DHCP_PERMANENT 9
-#define DHCP_BOUND 10
-/** not yet implemented #define DHCP_RELEASING 11 */
-#define DHCP_BACKING_OFF 12
-
-/** AUTOIP cooperatation flags */
-#define DHCP_AUTOIP_COOP_STATE_OFF 0
-#define DHCP_AUTOIP_COOP_STATE_ON 1
-
-#define DHCP_BOOTREQUEST 1
-#define DHCP_BOOTREPLY 2
-
-/** DHCP message types */
-#define DHCP_DISCOVER 1
-#define DHCP_OFFER 2
-#define DHCP_REQUEST 3
-#define DHCP_DECLINE 4
-#define DHCP_ACK 5
-#define DHCP_NAK 6
-#define DHCP_RELEASE 7
-#define DHCP_INFORM 8
-
-/** DHCP hardware type, currently only ethernet is supported */
-#define DHCP_HTYPE_ETH 1
-
-#define DHCP_MAGIC_COOKIE 0x63825363UL
-
-/* This is a list of options for BOOTP and DHCP, see RFC 2132 for descriptions */
-
-/** BootP options */
-#define DHCP_OPTION_PAD 0
-#define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */
-#define DHCP_OPTION_ROUTER 3
-#define DHCP_OPTION_DNS_SERVER 6
-#define DHCP_OPTION_HOSTNAME 12
-#define DHCP_OPTION_IP_TTL 23
-#define DHCP_OPTION_MTU 26
-#define DHCP_OPTION_BROADCAST 28
-#define DHCP_OPTION_TCP_TTL 37
-#define DHCP_OPTION_END 255
-
-/** DHCP options */
-#define DHCP_OPTION_REQUESTED_IP 50 /* RFC 2132 9.1, requested IP address */
-#define DHCP_OPTION_LEASE_TIME 51 /* RFC 2132 9.2, time in seconds, in 4 bytes */
-#define DHCP_OPTION_OVERLOAD 52 /* RFC2132 9.3, use file and/or sname field for options */
-
-#define DHCP_OPTION_MESSAGE_TYPE 53 /* RFC 2132 9.6, important for DHCP */
-#define DHCP_OPTION_MESSAGE_TYPE_LEN 1
-
-#define DHCP_OPTION_SERVER_ID 54 /* RFC 2132 9.7, server IP address */
-#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 /* RFC 2132 9.8, requested option types */
-
-#define DHCP_OPTION_MAX_MSG_SIZE 57 /* RFC 2132 9.10, message size accepted >= 576 */
-#define DHCP_OPTION_MAX_MSG_SIZE_LEN 2
-
-#define DHCP_OPTION_T1 58 /* T1 renewal time */
-#define DHCP_OPTION_T2 59 /* T2 rebinding time */
-#define DHCP_OPTION_US 60
-#define DHCP_OPTION_CLIENT_ID 61
-#define DHCP_OPTION_TFTP_SERVERNAME 66
-#define DHCP_OPTION_BOOTFILE 67
-
-/** possible combinations of overloading the file and sname fields with options */
-#define DHCP_OVERLOAD_NONE 0
-#define DHCP_OVERLOAD_FILE 1
-#define DHCP_OVERLOAD_SNAME 2
-#define DHCP_OVERLOAD_SNAME_FILE 3
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_DHCP */
-
-#endif /*__LWIP_DHCP_H__*/
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/dns.h b/sparkfun/esp8266/firmwares/loader/src/lwip/dns.h
deleted file mode 100644
index 6c7d9b07..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/dns.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * lwip DNS resolver header file.
-
- * Author: Jim Pettinato
- * April 2007
-
- * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __LWIP_DNS_H__
-#define __LWIP_DNS_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** DNS timer period */
-#define DNS_TMR_INTERVAL 1000
-
-/** DNS field TYPE used for "Resource Records" */
-#define DNS_RRTYPE_A 1 /* a host address */
-#define DNS_RRTYPE_NS 2 /* an authoritative name server */
-#define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */
-#define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */
-#define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */
-#define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */
-#define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */
-#define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */
-#define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */
-#define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */
-#define DNS_RRTYPE_WKS 11 /* a well known service description */
-#define DNS_RRTYPE_PTR 12 /* a domain name pointer */
-#define DNS_RRTYPE_HINFO 13 /* host information */
-#define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */
-#define DNS_RRTYPE_MX 15 /* mail exchange */
-#define DNS_RRTYPE_TXT 16 /* text strings */
-
-/** DNS field CLASS used for "Resource Records" */
-#define DNS_RRCLASS_IN 1 /* the Internet */
-#define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
-#define DNS_RRCLASS_CH 3 /* the CHAOS class */
-#define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */
-#define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */
-
-/* The size used for the next line is rather a hack, but it prevents including socket.h in all files
- that include memp.h, and that would possibly break portability (since socket.h defines some types
- and constants possibly already define by the OS).
- Calculation rule:
- sizeof(struct addrinfo) + sizeof(struct sockaddr_in) + DNS_MAX_NAME_LENGTH + 1 byte zero-termination */
-#define NETDB_ELEM_SIZE (32 + 16 + DNS_MAX_NAME_LENGTH + 1)
-
-#if DNS_LOCAL_HOSTLIST
-/** struct used for local host-list */
-struct local_hostlist_entry {
- /** static hostname */
- const char *name;
- /** static host address in network byteorder */
- ip_addr_t addr;
- struct local_hostlist_entry *next;
-};
-#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
-#ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN
-#define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH
-#endif
-#define LOCALHOSTLIST_ELEM_SIZE ((sizeof(struct local_hostlist_entry) + DNS_LOCAL_HOSTLIST_MAX_NAMELEN + 1))
-#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
-#endif /* DNS_LOCAL_HOSTLIST */
-
-/** Callback which is invoked when a hostname is found.
- * A function of this type must be implemented by the application using the DNS resolver.
- * @param name pointer to the name that was looked up.
- * @param ipaddr pointer to an ip_addr_t containing the IP address of the hostname,
- * or NULL if the name could not be found (or on any other error).
- * @param callback_arg a user-specified callback argument passed to dns_gethostbyname
-*/
-typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
-
-void dns_init(void);
-void dns_tmr(void);
-void dns_setserver(u8_t numdns, ip_addr_t *dnsserver);
-ip_addr_t dns_getserver(u8_t numdns);
-err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
- dns_found_callback found, void *callback_arg);
-
-#if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
-int dns_local_removehost(const char *hostname, const ip_addr_t *addr);
-err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
-#endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_DNS */
-
-#endif /* __LWIP_DNS_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/err.h b/sparkfun/esp8266/firmwares/loader/src/lwip/err.h
deleted file mode 100644
index cb69a9f4..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/err.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_ERR_H__
-#define __LWIP_ERR_H__
-
-#include "lwip/opt.h"
-#include "lwip/arch.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Define LWIP_ERR_T in cc.h if you want to use
- * a different type for your platform (must be signed). */
-#ifdef LWIP_ERR_T
-typedef LWIP_ERR_T err_t;
-#else /* LWIP_ERR_T */
-typedef s8_t err_t;
-#endif /* LWIP_ERR_T*/
-
-/* Definitions for error constants. */
-
-#define ERR_OK 0 /* No error, everything OK. */
-#define ERR_MEM -1 /* Out of memory error. */
-#define ERR_BUF -2 /* Buffer error. */
-#define ERR_TIMEOUT -3 /* Timeout. */
-#define ERR_RTE -4 /* Routing problem. */
-#define ERR_INPROGRESS -5 /* Operation in progress */
-#define ERR_VAL -6 /* Illegal value. */
-#define ERR_WOULDBLOCK -7 /* Operation would block. */
-
-#define ERR_IS_FATAL(e) ((e) < ERR_WOULDBLOCK)
-
-#define ERR_ABRT -8 /* Connection aborted. */
-#define ERR_RST -9 /* Connection reset. */
-#define ERR_CLSD -10 /* Connection closed. */
-#define ERR_CONN -11 /* Not connected. */
-
-#define ERR_ARG -12 /* Illegal argument. */
-
-#define ERR_USE -13 /* Address in use. */
-
-#define ERR_IF -14 /* Low-level netif error */
-#define ERR_ISCONN -15 /* Already connected. */
-
-
-#ifdef LWIP_DEBUG
-extern const char *lwip_strerr(err_t err)ICACHE_FLASH_ATTR;
-#else
-#define lwip_strerr(x) ""
-#endif /* LWIP_DEBUG */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_ERR_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/icmp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/icmp.h
deleted file mode 100644
index 9bcb7bc4..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/icmp.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_ICMP_H__
-#define __LWIP_ICMP_H__
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ICMP_ER 0 /* echo reply */
-#define ICMP_DUR 3 /* destination unreachable */
-#define ICMP_SQ 4 /* source quench */
-#define ICMP_RD 5 /* redirect */
-#define ICMP_ECHO 8 /* echo */
-#define ICMP_TE 11 /* time exceeded */
-#define ICMP_PP 12 /* parameter problem */
-#define ICMP_TS 13 /* timestamp */
-#define ICMP_TSR 14 /* timestamp reply */
-#define ICMP_IRQ 15 /* information request */
-#define ICMP_IR 16 /* information reply */
-
-enum icmp_dur_type {
- ICMP_DUR_NET = 0, /* net unreachable */
- ICMP_DUR_HOST = 1, /* host unreachable */
- ICMP_DUR_PROTO = 2, /* protocol unreachable */
- ICMP_DUR_PORT = 3, /* port unreachable */
- ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */
- ICMP_DUR_SR = 5 /* source route failed */
-};
-
-enum icmp_te_type {
- ICMP_TE_TTL = 0, /* time to live exceeded in transit */
- ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */
-};
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-/** This is the standard ICMP header only that the u32_t data
- * is splitted to two u16_t like ICMP echo needs it.
- * This header is also used for other ICMP types that do not
- * use the data part.
- * ¶¨ÒåICMP»ØËÍÇëÇó±¨ÎÄÊײ¿½á¹¹£¬
- * ÓÉÓÚËùÓÐICMP±¨ÎÄÊײ¿ÓкܴóÏàËÆÐÔ£¬
- * ¸Ã½á¹¹Í¬ÑùÊÊÓÃÓÚÆäËüICMP±¨ÎÄ¡£
- */
-PACK_STRUCT_BEGIN
-struct icmp_echo_hdr {
- PACK_STRUCT_FIELD(u8_t type);
- PACK_STRUCT_FIELD(u8_t code);
- PACK_STRUCT_FIELD(u16_t chksum);
- PACK_STRUCT_FIELD(u16_t id);
- PACK_STRUCT_FIELD(u16_t seqno);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-//¶ÁÈ¡ICMPÊײ¿ÖÐ×Ö¶Î
-#define ICMPH_TYPE(hdr) ((hdr)->type)
-#define ICMPH_CODE(hdr) ((hdr)->code)
-
-/** Combines type and code to an u16_t ÏòICMP±¨ÎÄÊײ¿×Ö¶ÎÖÐдÈëÏàÓ¦Öµ*/
-#define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t))
-#define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c))
-
-
-#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */
-
-void icmp_input(struct pbuf *p, struct netif *inp)ICACHE_FLASH_ATTR;
-void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)ICACHE_FLASH_ATTR;
-void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)ICACHE_FLASH_ATTR;
-
-#endif /* LWIP_ICMP */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_ICMP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/igmp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/igmp.h
deleted file mode 100644
index 8cf9a481..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/igmp.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2002 CITEL Technologies Ltd.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file is a contribution to the lwIP TCP/IP stack.
- * The Swedish Institute of Computer Science and Adam Dunkels
- * are specifically granted permission to redistribute this
- * source code.
-*/
-
-#ifndef __LWIP_IGMP_H__
-#define __LWIP_IGMP_H__
-
-#include "lwip/opt.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/pbuf.h"
-
-#if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* IGMP timer */
-#define IGMP_TMR_INTERVAL 100 /* Milliseconds */
-#define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL)
-#define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
-
-/* MAC Filter Actions, these are passed to a netif's
- * igmp_mac_filter callback function. */
-#define IGMP_DEL_MAC_FILTER 0
-#define IGMP_ADD_MAC_FILTER 1
-
-
-/**
- * igmp group structure - there is
- * a list of groups for each interface
- * these should really be linked from the interface, but
- * if we keep them separate we will not affect the lwip original code
- * too much
- *
- * There will be a group for the all systems group address but this
- * will not run the state machine as it is used to kick off reports
- * from all the other groups
- */
-struct igmp_group {
- /** next link */
- struct igmp_group *next;
- /** interface on which the group is active */
- struct netif *netif;
- /** multicast address */
- ip_addr_t group_address;
- /** signifies we were the last person to report */
- u8_t last_reporter_flag;
- /** current state of the group */
- u8_t group_state;
- /** timer for reporting, negative is OFF */
- u16_t timer;
- /** counter of simultaneous uses */
- u8_t use;
-};
-
-/* Prototypes */
-void igmp_init(void)ICACHE_FLASH_ATTR;
-err_t igmp_start(struct netif *netif)ICACHE_FLASH_ATTR;
-err_t igmp_stop(struct netif *netif)ICACHE_FLASH_ATTR;
-void igmp_report_groups(struct netif *netif)ICACHE_FLASH_ATTR;
-struct igmp_group *igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr)ICACHE_FLASH_ATTR;
-void igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest)ICACHE_FLASH_ATTR;
-err_t igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr)ICACHE_FLASH_ATTR;
-err_t igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr)ICACHE_FLASH_ATTR;
-void igmp_tmr(void)ICACHE_FLASH_ATTR;
-#define LWIP_RAND() rand()
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_IGMP */
-
-#endif /* __LWIP_IGMP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/inet.h b/sparkfun/esp8266/firmwares/loader/src/lwip/inet.h
deleted file mode 100644
index 7bff49b5..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/inet.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_INET_H__
-#define __LWIP_INET_H__
-
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/ip_addr.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** For compatibility with BSD code */
-struct in_addr {
- u32_t s_addr;
-};
-
-/** 255.255.255.255 */
-#define INADDR_NONE IPADDR_NONE
-/** 127.0.0.1 */
-#define INADDR_LOOPBACK IPADDR_LOOPBACK
-/** 0.0.0.0 */
-#define INADDR_ANY IPADDR_ANY
-/** 255.255.255.255 */
-#define INADDR_BROADCAST IPADDR_BROADCAST
-
-/* Definitions of the bits in an Internet address integer.
-
- On subnets, host and network parts are found according to
- the subnet mask, not these masks. */
-#define IN_CLASSA(a) IP_CLASSA(a)
-#define IN_CLASSA_NET IP_CLASSA_NET
-#define IN_CLASSA_NSHIFT IP_CLASSA_NSHIFT
-#define IN_CLASSA_HOST IP_CLASSA_HOST
-#define IN_CLASSA_MAX IP_CLASSA_MAX
-
-#define IN_CLASSB(b) IP_CLASSB(b)
-#define IN_CLASSB_NET IP_CLASSB_NET
-#define IN_CLASSB_NSHIFT IP_CLASSB_NSHIFT
-#define IN_CLASSB_HOST IP_CLASSB_HOST
-#define IN_CLASSB_MAX IP_CLASSB_MAX
-
-#define IN_CLASSC(c) IP_CLASSC(c)
-#define IN_CLASSC_NET IP_CLASSC_NET
-#define IN_CLASSC_NSHIFT IP_CLASSC_NSHIFT
-#define IN_CLASSC_HOST IP_CLASSC_HOST
-#define IN_CLASSC_MAX IP_CLASSC_MAX
-
-#define IN_CLASSD(d) IP_CLASSD(d)
-#define IN_CLASSD_NET IP_CLASSD_NET /* These ones aren't really */
-#define IN_CLASSD_NSHIFT IP_CLASSD_NSHIFT /* net and host fields, but */
-#define IN_CLASSD_HOST IP_CLASSD_HOST /* routing needn't know. */
-#define IN_CLASSD_MAX IP_CLASSD_MAX
-
-#define IN_MULTICAST(a) IP_MULTICAST(a)
-
-#define IN_EXPERIMENTAL(a) IP_EXPERIMENTAL(a)
-#define IN_BADCLASS(a) IP_BADCLASS(a)
-
-#define IN_LOOPBACKNET IP_LOOPBACKNET
-
-#define inet_addr_from_ipaddr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
-#define inet_addr_to_ipaddr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
-/* ATTENTION: the next define only works because both s_addr and ip_addr_t are an u32_t effectively! */
-#define inet_addr_to_ipaddr_p(target_ipaddr_p, source_inaddr) ((target_ipaddr_p) = (ip_addr_t*)&((source_inaddr)->s_addr))
-
-/* directly map this to the lwip internal functions */
-#define inet_addr(cp) ipaddr_addr(cp)
-#define inet_aton(cp, addr) ipaddr_aton(cp, (ip_addr_t*)addr)
-#define inet_ntoa(addr) ipaddr_ntoa((ip_addr_t*)&(addr))
-#define inet_ntoa_r(addr, buf, buflen) ipaddr_ntoa_r((ip_addr_t*)&(addr), buf, buflen)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_INET_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/inet_chksum.h b/sparkfun/esp8266/firmwares/loader/src/lwip/inet_chksum.h
deleted file mode 100644
index 41be6415..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/inet_chksum.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_INET_CHKSUM_H__
-#define __LWIP_INET_CHKSUM_H__
-
-#include "lwip/opt.h"
-
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-
-/** Swap the bytes in an u16_t: much like htons() for little-endian */
-#ifndef SWAP_BYTES_IN_WORD
-#if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)
-/* little endian and PLATFORM_BYTESWAP defined */
-#define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w)
-#else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */
-/* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */
-#define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)
-#endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/
-#endif /* SWAP_BYTES_IN_WORD */
-
-/** Split an u32_t in two u16_ts and add them up */
-#ifndef FOLD_U32T
-#define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL))
-#endif
-
-#if LWIP_CHECKSUM_ON_COPY
-/** Function-like macro: same as MEMCPY but returns the checksum of copied data
- as u16_t */
-#ifndef LWIP_CHKSUM_COPY
-#define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len)
-#ifndef LWIP_CHKSUM_COPY_ALGORITHM
-#define LWIP_CHKSUM_COPY_ALGORITHM 1
-#endif /* LWIP_CHKSUM_COPY_ALGORITHM */
-#endif /* LWIP_CHKSUM_COPY */
-#else /* LWIP_CHECKSUM_ON_COPY */
-#define LWIP_CHKSUM_COPY_ALGORITHM 0
-#endif /* LWIP_CHECKSUM_ON_COPY */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-u16_t inet_chksum(void *dataptr, u16_t len)ICACHE_FLASH_ATTR;
-u16_t inet_chksum_pbuf(struct pbuf *p)ICACHE_FLASH_ATTR;
-u16_t inet_chksum_pseudo(struct pbuf *p,
- ip_addr_t *src, ip_addr_t *dest,
- u8_t proto, u16_t proto_len)ICACHE_FLASH_ATTR;
-u16_t inet_chksum_pseudo_partial(struct pbuf *p,
- ip_addr_t *src, ip_addr_t *dest,
- u8_t proto, u16_t proto_len, u16_t chksum_len)ICACHE_FLASH_ATTR;
-#if LWIP_CHKSUM_COPY_ALGORITHM
-u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len)ICACHE_FLASH_ATTR;
-#endif /* LWIP_CHKSUM_COPY_ALGORITHM */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_INET_H__ */
-
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/init.h b/sparkfun/esp8266/firmwares/loader/src/lwip/init.h
deleted file mode 100644
index 7a58aece..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/init.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_INIT_H__
-#define __LWIP_INIT_H__
-
-#include "lwip/opt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** X.x.x: Major version of the stack */
-#define LWIP_VERSION_MAJOR 1U
-/** x.X.x: Minor version of the stack */
-#define LWIP_VERSION_MINOR 4U
-/** x.x.X: Revision of the stack */
-#define LWIP_VERSION_REVISION 0U
-/** For release candidates, this is set to 1..254
- * For official releases, this is set to 255 (LWIP_RC_RELEASE)
- * For development versions (CVS), this is set to 0 (LWIP_RC_DEVELOPMENT) */
-#define LWIP_VERSION_RC 2U
-
-/** LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases */
-#define LWIP_RC_RELEASE 255U
-/** LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for CVS versions */
-#define LWIP_RC_DEVELOPMENT 0U
-
-#define LWIP_VERSION_IS_RELEASE (LWIP_VERSION_RC == LWIP_RC_RELEASE)
-#define LWIP_VERSION_IS_DEVELOPMENT (LWIP_VERSION_RC == LWIP_RC_DEVELOPMENT)
-#define LWIP_VERSION_IS_RC ((LWIP_VERSION_RC != LWIP_RC_RELEASE) && (LWIP_VERSION_RC != LWIP_RC_DEVELOPMENT))
-
-/** Provides the version of the stack */
-#define LWIP_VERSION (LWIP_VERSION_MAJOR << 24 | LWIP_VERSION_MINOR << 16 | \
- LWIP_VERSION_REVISION << 8 | LWIP_VERSION_RC)
-
-/* Modules initialization */
-void lwip_init(void) ICACHE_FLASH_ATTR;
-//void lwip_init(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_INIT_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/ip.h b/sparkfun/esp8266/firmwares/loader/src/lwip/ip.h
deleted file mode 100644
index 1f361fa4..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/ip.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_IP_H__
-#define __LWIP_IP_H__
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-#include "lwip/err.h"
-#include "lwip/netif.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Currently, the function ip_output_if_opt() is only used with IGMP */
-#define IP_OPTIONS_SEND LWIP_IGMP
-
-#define IP_HLEN 20
-
-#define IP_PROTO_ICMP 1
-#define IP_PROTO_IGMP 2
-#define IP_PROTO_UDP 17
-#define IP_PROTO_UDPLITE 136
-#define IP_PROTO_TCP 6
-
-/* This is passed as the destination address to ip_output_if (not
- to ip_output), meaning that an IP header already is constructed
- in the pbuf. This is used when TCP retransmits. */
-#ifdef IP_HDRINCL
-#undef IP_HDRINCL
-#endif /* IP_HDRINCL */
-#define IP_HDRINCL NULL
-
-#if LWIP_NETIF_HWADDRHINT
-#define IP_PCB_ADDRHINT ;u8_t addr_hint
-#else
-#define IP_PCB_ADDRHINT
-#endif /* LWIP_NETIF_HWADDRHINT */
-
-/* This is the common part of all PCB types. It needs to be at the
- beginning of a PCB type definition. It is located here so that
- changes to this common part are made in one location instead of
- having to change all PCB structs. */
-#define IP_PCB \
- /* ip addresses in network byte order */ \
- ip_addr_t local_ip; \
- ip_addr_t remote_ip; \
- /* Socket options */ \
- u8_t so_options; \
- /* Type Of Service */ \
- u8_t tos; \
- /* Time To Live */ \
- u8_t ttl \
- /* link layer address resolution hint */ \
- IP_PCB_ADDRHINT
-
-struct ip_pcb {
-/* Common members of all PCB types */
- IP_PCB;
-};
-
-/*
- * Option flags per-socket. These are the same like SO_XXX.
- */
-/*#define SOF_DEBUG (u8_t)0x01U Unimplemented: turn on debugging info recording */
-#define SOF_ACCEPTCONN (u8_t)0x02U /* socket has had listen() */
-#define SOF_REUSEADDR (u8_t)0x04U /* allow local address reuse */
-#define SOF_KEEPALIVE (u8_t)0x08U /* keep connections alive */
-/*#define SOF_DONTROUTE (u8_t)0x10U Unimplemented: just use interface addresses */
-#define SOF_BROADCAST (u8_t)0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
-/*#define SOF_USELOOPBACK (u8_t)0x40U Unimplemented: bypass hardware when possible */
-#define SOF_LINGER (u8_t)0x80U /* linger on close if data present */
-/*#define SOF_OOBINLINE (u16_t)0x0100U Unimplemented: leave received OOB data in line */
-/*#define SOF_REUSEPORT (u16_t)0x0200U Unimplemented: allow local address & port reuse */
-
-/* These flags are inherited (e.g. from a listen-pcb to a connection-pcb): */
-#define SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE|SOF_LINGER/*|SOF_DEBUG|SOF_DONTROUTE|SOF_OOBINLINE*/)
-
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ip_hdr {
- /* version / header length / type of service */
- PACK_STRUCT_FIELD(u16_t _v_hl_tos);
- /* total length */
- PACK_STRUCT_FIELD(u16_t _len);
- /* identification */
- PACK_STRUCT_FIELD(u16_t _id);
- /* fragment offset field */
- PACK_STRUCT_FIELD(u16_t _offset);
-#define IP_RF 0x8000 /* reserved fragment flag */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- /* time to live */
- PACK_STRUCT_FIELD(u8_t _ttl);
- /* protocol*/
- PACK_STRUCT_FIELD(u8_t _proto);
- /* checksum */
- PACK_STRUCT_FIELD(u16_t _chksum);
- /* source and destination IP addresses */
- PACK_STRUCT_FIELD(ip_addr_p_t src);
- PACK_STRUCT_FIELD(ip_addr_p_t dest);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-#define IPH_V(hdr) (ntohs((hdr)->_v_hl_tos) >> 12)
-#define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f)
-#define IPH_TOS(hdr) (ntohs((hdr)->_v_hl_tos) & 0xff)
-#define IPH_LEN(hdr) ((hdr)->_len)
-#define IPH_ID(hdr) ((hdr)->_id)
-#define IPH_OFFSET(hdr) ((hdr)->_offset)
-#define IPH_TTL(hdr) ((hdr)->_ttl)
-#define IPH_PROTO(hdr) ((hdr)->_proto)
-#define IPH_CHKSUM(hdr) ((hdr)->_chksum)
-
-#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos)))
-#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
-#define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
-#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
-#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl = (u8_t)(ttl)
-#define IPH_PROTO_SET(hdr, proto) (hdr)->_proto = (u8_t)(proto)
-#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
-
-/** The interface that provided the packet for the current callback invocation. */
-extern struct netif *current_netif;
-/** Header of the input packet currently being processed. */
-extern const struct ip_hdr *current_header;
-/** Source IP address of current_header */
-extern ip_addr_t current_iphdr_src;
-/** Destination IP address of current_header */
-extern ip_addr_t current_iphdr_dest;
-
-#define ip_init() /* Compatibility define, not init needed. */
-struct netif *ip_route(ip_addr_t *dest)ICACHE_FLASH_ATTR;
-struct netif *ip_router(ip_addr_t *dest, ip_addr_t *source);
-
-err_t ip_input(struct pbuf *p, struct netif *inp)ICACHE_FLASH_ATTR;
-err_t ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
- u8_t ttl, u8_t tos, u8_t proto)ICACHE_FLASH_ATTR;
-err_t ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
- u8_t ttl, u8_t tos, u8_t proto,
- struct netif *netif)ICACHE_FLASH_ATTR;
-#if LWIP_NETIF_HWADDRHINT
-err_t ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
- u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)ICACHE_FLASH_ATTR;
-#endif /* LWIP_NETIF_HWADDRHINT */
-#if IP_OPTIONS_SEND
-err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
- u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
- u16_t optlen)ICACHE_FLASH_ATTR;
-#endif /* IP_OPTIONS_SEND */
-/** Get the interface that received the current packet.
- * This function must only be called from a receive callback (udp_recv,
- * raw_recv, tcp_accept). It will return NULL otherwise. */
-#define ip_current_netif() (current_netif)
-/** Get the IP header of the current packet.
- * This function must only be called from a receive callback (udp_recv,
- * raw_recv, tcp_accept). It will return NULL otherwise. */
-#define ip_current_header() (current_header)
-/** Source IP address of current_header */
-#define ip_current_src_addr() (¤t_iphdr_src)
-/** Destination IP address of current_header */
-#define ip_current_dest_addr() (¤t_iphdr_dest)
-
-#if IP_DEBUG
-void ip_debug_print(struct pbuf *p)ICACHE_FLASH_ATTR;
-#else
-#define ip_debug_print(p)
-#endif /* IP_DEBUG */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_IP_H__ */
-
-
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/ip_addr.h b/sparkfun/esp8266/firmwares/loader/src/lwip/ip_addr.h
deleted file mode 100644
index cfc10f80..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/ip_addr.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_IP_ADDR_H__
-#define __LWIP_IP_ADDR_H__
-
-#include "lwip/opt.h"
-#include "lwip/def.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This is the aligned version of ip_addr_t,
- used as local variable, on the stack, etc. */
-struct ip_addr {
- u32_t addr;
-};
-
-/* This is the packed version of ip_addr_t,
- used in network headers that are itself packed */
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ip_addr_packed {
- PACK_STRUCT_FIELD(u32_t addr);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-/** ip_addr_t uses a struct for convenience only, so that the same defines can
- * operate both on ip_addr_t as well as on ip_addr_p_t. */
-typedef struct ip_addr ip_addr_t;
-typedef struct ip_addr_packed ip_addr_p_t;
-
-/*
- * struct ipaddr2 is used in the definition of the ARP packet format in
- * order to support compilers that don't have structure packing.
- */
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ip_addr2 {
- PACK_STRUCT_FIELD(u16_t addrw[2]);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-/* Forward declaration to not include netif.h */
-struct netif;
-
-extern const ip_addr_t ip_addr_any;
-extern const ip_addr_t ip_addr_broadcast;
-
-/** IP_ADDR_ can be used as a fixed IP address
- * for the wildcard and the broadcast address
- */
-#define IP_ADDR_ANY ((ip_addr_t *)&ip_addr_any)
-#define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast)
-
-/** 255.255.255.255 */
-#define IPADDR_NONE ((u32_t)0xffffffffUL)
-/** 127.0.0.1 */
-#define IPADDR_LOOPBACK ((u32_t)0x7f000001UL)
-/** 0.0.0.0 */
-#define IPADDR_ANY ((u32_t)0x00000000UL)
-/** 255.255.255.255 */
-#define IPADDR_BROADCAST ((u32_t)0xffffffffUL)
-
-/* Definitions of the bits in an Internet address integer.
-
- On subnets, host and network parts are found according to
- the subnet mask, not these masks. */
-#define IP_CLASSA(a) ((((u32_t)(a)) & 0x80000000UL) == 0)
-#define IP_CLASSA_NET 0xff000000
-#define IP_CLASSA_NSHIFT 24
-#define IP_CLASSA_HOST (0xffffffff & ~IP_CLASSA_NET)
-#define IP_CLASSA_MAX 128
-
-#define IP_CLASSB(a) ((((u32_t)(a)) & 0xc0000000UL) == 0x80000000UL)
-#define IP_CLASSB_NET 0xffff0000
-#define IP_CLASSB_NSHIFT 16
-#define IP_CLASSB_HOST (0xffffffff & ~IP_CLASSB_NET)
-#define IP_CLASSB_MAX 65536
-
-#define IP_CLASSC(a) ((((u32_t)(a)) & 0xe0000000UL) == 0xc0000000UL)
-#define IP_CLASSC_NET 0xffffff00
-#define IP_CLASSC_NSHIFT 8
-#define IP_CLASSC_HOST (0xffffffff & ~IP_CLASSC_NET)
-
-#define IP_CLASSD(a) (((u32_t)(a) & 0xf0000000UL) == 0xe0000000UL)
-#define IP_CLASSD_NET 0xf0000000 /* These ones aren't really */
-#define IP_CLASSD_NSHIFT 28 /* net and host fields, but */
-#define IP_CLASSD_HOST 0x0fffffff /* routing needn't know. */
-#define IP_MULTICAST(a) IP_CLASSD(a)
-
-#define IP_EXPERIMENTAL(a) (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
-#define IP_BADCLASS(a) (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
-
-#define IP_LOOPBACKNET 127 /* official! */
-
-
-#if BYTE_ORDER == BIG_ENDIAN
-/** Set an IP address given by the four byte-parts */
-#define IP4_ADDR(ipaddr, a,b,c,d) \
- (ipaddr)->addr = ((u32_t)((a) & 0xff) << 24) | \
- ((u32_t)((b) & 0xff) << 16) | \
- ((u32_t)((c) & 0xff) << 8) | \
- (u32_t)((d) & 0xff)
-#else
-/** Set an IP address given by the four byte-parts.
- Little-endian version that prevents the use of htonl. */
-#define IP4_ADDR(ipaddr, a,b,c,d) \
- (ipaddr)->addr = ((u32_t)((d) & 0xff) << 24) | \
- ((u32_t)((c) & 0xff) << 16) | \
- ((u32_t)((b) & 0xff) << 8) | \
- (u32_t)((a) & 0xff)
-#endif
-
-/** MEMCPY-like copying of IP addresses where addresses are known to be
- * 16-bit-aligned if the port is correctly configured (so a port could define
- * this to copying 2 u16_t's) - no NULL-pointer-checking needed. */
-#ifndef IPADDR2_COPY
-#define IPADDR2_COPY(dest, src) SMEMCPY(dest, src, sizeof(ip_addr_t))
-#endif
-
-/** Copy IP address - faster than ip_addr_set: no NULL check */
-#define ip_addr_copy(dest, src) ((dest).addr = (src).addr)
-/** Safely copy one IP address to another (src may be NULL) */
-#define ip_addr_set(dest, src) ((dest)->addr = \
- ((src) == NULL ? 0 : \
- (src)->addr))
-/** Set complete address to zero */
-#define ip_addr_set_zero(ipaddr) ((ipaddr)->addr = 0)
-/** Set address to IPADDR_ANY (no need for htonl()) */
-#define ip_addr_set_any(ipaddr) ((ipaddr)->addr = IPADDR_ANY)
-/** Set address to loopback address */
-#define ip_addr_set_loopback(ipaddr) ((ipaddr)->addr = PP_HTONL(IPADDR_LOOPBACK))
-/** Safely copy one IP address to another and change byte order
- * from host- to network-order. */
-#define ip_addr_set_hton(dest, src) ((dest)->addr = \
- ((src) == NULL ? 0:\
- htonl((src)->addr)))
-/** IPv4 only: set the IP address given as an u32_t */
-#define ip4_addr_set_u32(dest_ipaddr, src_u32) ((dest_ipaddr)->addr = (src_u32))
-/** IPv4 only: get the IP address as an u32_t */
-#define ip4_addr_get_u32(src_ipaddr) ((src_ipaddr)->addr)
-
-/** Get the network address by combining host address with netmask */
-#define ip_addr_get_network(target, host, netmask) ((target)->addr = ((host)->addr) & ((netmask)->addr))
-
-/**
- * Determine if two address are on the same network.
- *
- * @arg addr1 IP address 1
- * @arg addr2 IP address 2
- * @arg mask network identifier mask
- * @return !0 if the network identifiers of both address match
- */
-#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
- (mask)->addr) == \
- ((addr2)->addr & \
- (mask)->addr))
-#define ip_addr_cmp(addr1, addr2) ((addr1)->addr == (addr2)->addr)
-
-#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == IPADDR_ANY)
-
-#define ip_addr_isbroadcast(ipaddr, netif) ip4_addr_isbroadcast((ipaddr)->addr, (netif))
-u8_t ip4_addr_isbroadcast(u32_t addr, const struct netif *netif)ICACHE_FLASH_ATTR;
-
-#define ip_addr_netmask_valid(netmask) ip4_addr_netmask_valid((netmask)->addr)
-u8_t ip4_addr_netmask_valid(u32_t netmask)ICACHE_FLASH_ATTR;
-
-#define ip_addr_ismulticast(addr1) (((addr1)->addr & PP_HTONL(0xf0000000UL)) == PP_HTONL(0xe0000000UL))
-
-#define ip_addr_islinklocal(addr1) (((addr1)->addr & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xa9fe0000UL))
-
-#define ip_addr_debug_print(debug, ipaddr) \
- LWIP_DEBUGF(debug, ("%" U16_F ".%" U16_F ".%" U16_F ".%" U16_F, \
- ipaddr != NULL ? ip4_addr1_16(ipaddr) : 0, \
- ipaddr != NULL ? ip4_addr2_16(ipaddr) : 0, \
- ipaddr != NULL ? ip4_addr3_16(ipaddr) : 0, \
- ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0))
-
-/* Get one byte from the 4-byte address */
-#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
-#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
-#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
-#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
-/* These are cast to u16_t, with the intent that they are often arguments
- * to printf using the U16_F format from cc.h. */
-#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
-#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
-#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
-#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
-
-/** For backwards compatibility */
-#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr)
-
-u32_t ipaddr_addr(const char *cp)ICACHE_FLASH_ATTR;
-int ipaddr_aton(const char *cp, ip_addr_t *addr)ICACHE_FLASH_ATTR;
-/** returns ptr to static buffer; not reentrant! */
-char *ipaddr_ntoa(const ip_addr_t *addr)ICACHE_FLASH_ATTR;
-char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)ICACHE_FLASH_ATTR;
-
-#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
- ip4_addr2_16(ipaddr), \
- ip4_addr3_16(ipaddr), \
- ip4_addr4_16(ipaddr)
-
-#define IPSTR "%d.%d.%d.%d"
-
-struct ip_info {
- struct ip_addr ip;
- struct ip_addr netmask;
- struct ip_addr gw;
-};
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_IP_ADDR_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/ip_frag.h b/sparkfun/esp8266/firmwares/loader/src/lwip/ip_frag.h
deleted file mode 100644
index df6db5f5..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/ip_frag.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Jani Monoses
- *
- */
-
-#ifndef __LWIP_IP_FRAG_H__
-#define __LWIP_IP_FRAG_H__
-
-#include "lwip/opt.h"
-#include "lwip/err.h"
-#include "lwip/pbuf.h"
-#include "lwip/netif.h"
-#include "lwip/ip_addr.h"
-#include "lwip/ip.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if IP_REASSEMBLY
-/* The IP reassembly timer interval in milliseconds. */
-#define IP_TMR_INTERVAL 1000
-
-/* IP reassembly helper struct.
- * This is exported because memp needs to know the size.
- */
-struct ip_reassdata {
- struct ip_reassdata *next;
- struct pbuf *p;
- struct ip_hdr iphdr;
- u16_t datagram_len;
- u8_t flags;
- u8_t timer;
-};
-
-void ip_reass_init(void)ICACHE_FLASH_ATTR;
-void ip_reass_tmr(void)ICACHE_FLASH_ATTR;
-struct pbuf * ip_reass(struct pbuf *p)ICACHE_FLASH_ATTR;
-#endif /* IP_REASSEMBLY */
-
-#if IP_FRAG
-#if !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF
-/** A custom pbuf that holds a reference to another pbuf, which is freed
- * when this custom pbuf is freed. This is used to create a custom PBUF_REF
- * that points into the original pbuf. */
-struct pbuf_custom_ref {
- /** 'base class' */
- struct pbuf_custom pc;
- /** pointer to the original pbuf that is referenced */
- struct pbuf *original;
-};
-#endif /* !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */
-
-err_t ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest)ICACHE_FLASH_ATTR;
-#endif /* IP_FRAG */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_IP_FRAG_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/mem.h b/sparkfun/esp8266/firmwares/loader/src/lwip/mem.h
deleted file mode 100644
index 7a4febcc..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/mem.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_MEM_H__
-#define __LWIP_MEM_H__
-
-#include "lwip/opt.h"
-#include "mem_manager.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if MEM_LIBC_MALLOC
-
-#include /* for size_t */
-
-typedef size_t mem_size_t;
-
-/* aliases for C library malloc() */
-#define mem_init()
-/* in case C library malloc() needs extra protection,
- * allow these defines to be overridden.
- */
-#ifndef mem_free
-#define mem_free vPortFree
-#endif
-#ifndef mem_malloc
-#define mem_malloc pvPortMalloc
-#endif
-#ifndef mem_calloc
-#define mem_calloc pvPortCalloc
-#endif
-#ifndef mem_realloc
-#define mem_realloc pvPortRealloc
-#endif
-#ifndef mem_zalloc
-#define mem_zalloc pvPortZalloc
-#endif
-
-#ifndef os_malloc
-#define os_malloc(s) mem_malloc((s))
-#endif
-#ifndef os_realloc
-#define os_realloc(p, s) mem_realloc((p), (s))
-#endif
-#ifndef os_zalloc
-#define os_zalloc(s) mem_zalloc((s))
-#endif
-#ifndef os_free
-#define os_free(p) mem_free((p))
-#endif
-
-/* Since there is no C library allocation function to shrink memory without
- moving it, define this to nothing. */
-#ifndef mem_trim
-#define mem_trim(mem, size) (mem)
-#endif
-#else /* MEM_LIBC_MALLOC */
-
-/* MEM_SIZE would have to be aligned, but using 64000 here instead of
- * 65535 leaves some room for alignment...
- */
-#if MEM_SIZE > 64000l
-typedef u32_t mem_size_t;
-#define MEM_SIZE_F U32_F
-#else
-typedef u16_t mem_size_t;
-#define MEM_SIZE_F U16_F
-#endif /* MEM_SIZE > 64000 */
-
-#if MEM_USE_POOLS
-/** mem_init is not used when using pools instead of a heap */
-#define mem_init()
-/** mem_trim is not used when using pools instead of a heap:
- we can't free part of a pool element and don't want to copy the rest */
-#define mem_trim(mem, size) (mem)
-#else /* MEM_USE_POOLS */
-/* lwIP alternative malloc */
-void mem_init(void)ICACHE_FLASH_ATTR;
-void *mem_trim(void *mem, mem_size_t size)ICACHE_FLASH_ATTR;
-#endif /* MEM_USE_POOLS */
-void *mem_malloc(mem_size_t size)ICACHE_FLASH_ATTR;
-void *mem_calloc(mem_size_t count, mem_size_t size)ICACHE_FLASH_ATTR;
-void mem_free(void *mem)ICACHE_FLASH_ATTR;
-#endif /* MEM_LIBC_MALLOC */
-
-/** Calculate memory size for an aligned buffer - returns the next highest
- * multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and
- * LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4).
- */
-#ifndef LWIP_MEM_ALIGN_SIZE
-#define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
-#endif
-
-/** Calculate safe memory size for an aligned buffer when using an unaligned
- * type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the
- * start (e.g. if buffer is u8_t[] and actual data will be u32_t*)
- */
-#ifndef LWIP_MEM_ALIGN_BUFFER
-#define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1))
-#endif
-
-/** Align a memory pointer to the alignment defined by MEM_ALIGNMENT
- * so that ADDR % MEM_ALIGNMENT == 0
- */
-#ifndef LWIP_MEM_ALIGN
-#define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_MEM_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/mem_manager.h b/sparkfun/esp8266/firmwares/loader/src/lwip/mem_manager.h
deleted file mode 100644
index 03559689..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/mem_manager.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef __MEM_MANAGER_H__
-#define __MEM_MANAGER_H__
-
-#include "c_types.h"
-
-/*------------------------±äÁ¿¶¨Òå------------------------*/
-
-#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
-#ifndef IOT_SIP_MODE
-//#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x3fffc000 - (uint32)&_heap_start ) )//fix 16000 to 24000 on 14.2.26
-#else
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8000 ) )
-#endif
-#define portBYTE_ALIGNMENT 8
-#define pdFALSE 0
-#define pdTRUE 1
-
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
-#if portBYTE_ALIGNMENT == 8
- #define portBYTE_ALIGNMENT_MASK ( 0x0007 )
-#endif
-
-#if portBYTE_ALIGNMENT == 4
- #define portBYTE_ALIGNMENT_MASK ( 0x0003 )
-#endif
-
-#if portBYTE_ALIGNMENT == 2
- #define portBYTE_ALIGNMENT_MASK ( 0x0001 )
-#endif
-
-#if portBYTE_ALIGNMENT == 1
- #define portBYTE_ALIGNMENT_MASK ( 0x0000 )
-#endif
-
-#ifndef portBYTE_ALIGNMENT_MASK
- #error "Invalid portBYTE_ALIGNMENT definition"
-#endif
-
-#define configUSE_MALLOC_FAILED_HOOK 1
-#define portPOINTER_SIZE_TYPE unsigned int
-
-#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) )
-
-//#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
-
-//static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ];
-//static unsigned char *ucHeap;
-
-typedef struct A_BLOCK_LINK
-{
- struct A_BLOCK_LINK *pxNextFreeBlock; //The next free block in the list.
- size_t xBlockSize; //The size of the free block.
-} xBlockLink;
-
-static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_ALIGNMENT - ( sizeof( xBlockLink ) % portBYTE_ALIGNMENT ) );
-
-//static const size_t xTotalHeapSize = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
-
-//static xBlockLink xStart, *pxEnd = NULL;
-
-//static size_t xFreeBytesRemaining = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
-
-
-/*------------------------º¯ÊýÉùÃ÷-----------------------------------*/
-
-//static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ) ;//ICACHE_FLASH_ATTR;
-
-//static void prvHeapInit( void ) ;//ICACHE_FLASH_ATTR;
-
-void vApplicationMallocFailedHook( void ) ;//ICACHE_FLASH_ATTR;
-
-void *pvPortMalloc( size_t xWantedSize ) ;//ICACHE_FLASH_ATTR;
-
-void vPortFree( void *pv ) ;//ICACHE_FLASH_ATTR;
-
-size_t xPortGetFreeHeapSize( void ) ;//ICACHE_FLASH_ATTR;
-
-void vPortInitialiseBlocks( void ) ;//ICACHE_FLASH_ATTR;
-/*-----------------------------------------------------------*/
-
-#endif
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/memp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/memp.h
deleted file mode 100644
index 764dedb1..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/memp.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-
-#ifndef __LWIP_MEMP_H__
-#define __LWIP_MEMP_H__
-
-#include "lwip/opt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */
-typedef enum {
-#define LWIP_MEMPOOL(name,num,size,desc, attr) MEMP_##name,
-#include "lwip/memp_std.h"
- MEMP_MAX
-} memp_t;
-
-#if MEM_USE_POOLS
-/* Use a helper type to get the start and end of the user "memory pools" for mem_malloc */
-typedef enum {
- /* Get the first (via:
- MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A + 0*MEMP_POOL_B + 0*MEMP_POOL_C + 0)*/
- MEMP_POOL_HELPER_FIRST = ((u8_t)
-#define LWIP_MEMPOOL(name,num,size,desc)
-#define LWIP_MALLOC_MEMPOOL_START 1
-#define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0
-#define LWIP_MALLOC_MEMPOOL_END
-#include "lwip/memp_std.h"
- ) ,
- /* Get the last (via:
- MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */
- MEMP_POOL_HELPER_LAST = ((u8_t)
-#define LWIP_MEMPOOL(name,num,size,desc)
-#define LWIP_MALLOC_MEMPOOL_START
-#define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size *
-#define LWIP_MALLOC_MEMPOOL_END 1
-#include "lwip/memp_std.h"
- )
-} memp_pool_helper_t;
-
-/* The actual start and stop values are here (cast them over)
- We use this helper type and these defines so we can avoid using const memp_t values */
-#define MEMP_POOL_FIRST ((memp_t) MEMP_POOL_HELPER_FIRST)
-#define MEMP_POOL_LAST ((memp_t) MEMP_POOL_HELPER_LAST)
-#endif /* MEM_USE_POOLS */
-
-#if MEMP_MEM_MALLOC || MEM_USE_POOLS
-extern const u16_t memp_sizes[MEMP_MAX];
-#endif /* MEMP_MEM_MALLOC || MEM_USE_POOLS */
-
-#if MEMP_MEM_MALLOC
-
-#include "mem.h"
-
-#define memp_init()
-#define memp_malloc(type) mem_malloc(memp_sizes[type])
-#define memp_free(type, mem) mem_free(mem)
-
-#else /* MEMP_MEM_MALLOC */
-
-#if MEM_USE_POOLS
-/** This structure is used to save the pool one element came from. */
-struct memp_malloc_helper
-{
- memp_t poolnr;
-};
-#endif /* MEM_USE_POOLS */
-
-void memp_init(void)ICACHE_FLASH_ATTR;
-
-#if MEMP_OVERFLOW_CHECK
-void *memp_malloc_fn(memp_t type, const char* file, const int line)ICACHE_FLASH_ATTR;
-#define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__)
-#else
-void *memp_malloc(memp_t type)ICACHE_FLASH_ATTR;
-#endif
-void memp_free(memp_t type, void *mem)ICACHE_FLASH_ATTR;
-
-#endif /* MEMP_MEM_MALLOC */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_MEMP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/memp_std.h b/sparkfun/esp8266/firmwares/loader/src/lwip/memp_std.h
deleted file mode 100644
index b20a2405..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/memp_std.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SETUP: Make sure we define everything we will need.
- *
- * We have create three types of pools:
- * 1) MEMPOOL - standard pools
- * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c
- * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct
- *
- * If the include'r doesn't require any special treatment of each of the types
- * above, then will declare #2 & #3 to be just standard mempools.
- */
-#ifndef LWIP_MALLOC_MEMPOOL
-/* This treats "malloc pools" just like any other pool.
- The pools are a little bigger to provide 'size' as the amount of user data. */
-#define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size, attr)
-#define LWIP_MALLOC_MEMPOOL_START
-#define LWIP_MALLOC_MEMPOOL_END
-#endif /* LWIP_MALLOC_MEMPOOL */
-
-#ifndef LWIP_PBUF_MEMPOOL
-/* This treats "pbuf pools" just like any other pool.
- * Allocates buffers for a pbuf struct AND a payload size */
-#define LWIP_PBUF_MEMPOOL(name, num, payload, desc, attr) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc, attr)
-#endif /* LWIP_PBUF_MEMPOOL */
-
-
-/*
- * A list of internal pools used by LWIP.
- *
- * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description)
- * creates a pool name MEMP_pool_name. description is used in stats.c
- */
-#if LWIP_RAW
-LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB", DMEM_ATTR)
-#endif /* LWIP_RAW */
-
-#if LWIP_UDP
-LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB", DMEM_ATTR)
-#endif /* LWIP_UDP */
-
-#if LWIP_TCP
-LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB", DMEM_ATTR)
-LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN", DMEM_ATTR)
-LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG", DMEM_ATTR)
-#endif /* LWIP_TCP */
-
-#if IP_REASSEMBLY
-LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA", DMEM_ATTR)
-#endif /* IP_REASSEMBLY */
-#if IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF
-LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF", DMEM_ATTR)
-#endif /* IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */
-
-#if LWIP_NETCONN
-LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF")
-LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN")
-#endif /* LWIP_NETCONN */
-
-#if NO_SYS==0
-LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API")
-#if !LWIP_TCPIP_CORE_LOCKING_INPUT
-LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT")
-#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
-#endif /* NO_SYS==0 */
-
-#if ARP_QUEUEING
-LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE", DMEM_ATTR)
-#endif /* ARP_QUEUEING */
-
-#if LWIP_IGMP
-LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP", DMEM_ATTR)
-#endif /* LWIP_IGMP */
-
-#if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
-LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT", DMEM_ATTR)
-#endif /* LWIP_TIMERS */
-
-#if LWIP_SNMP
-LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE")
-LWIP_MEMPOOL(SNMP_NODE, MEMP_NUM_SNMP_NODE, sizeof(struct mib_list_node), "SNMP_NODE")
-LWIP_MEMPOOL(SNMP_VARBIND, MEMP_NUM_SNMP_VARBIND, sizeof(struct snmp_varbind), "SNMP_VARBIND")
-LWIP_MEMPOOL(SNMP_VALUE, MEMP_NUM_SNMP_VALUE, SNMP_MAX_VALUE_SIZE, "SNMP_VALUE")
-#endif /* LWIP_SNMP */
-#if LWIP_DNS && LWIP_SOCKET
-LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB")
-#endif /* LWIP_DNS && LWIP_SOCKET */
-#if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
-LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST")
-#endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
-#if PPP_SUPPORT && PPPOE_SUPPORT
-LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF")
-#endif /* PPP_SUPPORT && PPPOE_SUPPORT */
-
-/*
- * A list of pools of pbuf's used by LWIP.
- *
- * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
- * creates a pool name MEMP_pool_name. description is used in stats.c
- * This allocates enough space for the pbuf struct and a payload.
- * (Example: pbuf_payload_size=0 allocates only size for the struct)
- */
-LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM", DMEM_ATTR)
-
-/* XXX: need to align to 4 byte as memp strcut is 4-byte long. otherwise will crash */
-#define LWIP_MEM_ALIGN4_SIZE(size) (((size) + 4 - 1) & ~(4-1))
-
-LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, LWIP_MEM_ALIGN4_SIZE(PBUF_POOL_BUFSIZE), "PBUF_POOL", DMEM_ATTR)
-
-
-/*
- * Allow for user-defined pools; this must be explicitly set in lwipopts.h
- * since the default is to NOT look for lwippools.h
- */
-#if MEMP_USE_CUSTOM_POOLS
-#include "lwippools.h"
-#endif /* MEMP_USE_CUSTOM_POOLS */
-
-/*
- * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later
- * (#undef is ignored for something that is not defined)
- */
-#undef LWIP_MEMPOOL
-#undef LWIP_MALLOC_MEMPOOL
-#undef LWIP_MALLOC_MEMPOOL_START
-#undef LWIP_MALLOC_MEMPOOL_END
-#undef LWIP_PBUF_MEMPOOL
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/netbuf.h b/sparkfun/esp8266/firmwares/loader/src/lwip/netbuf.h
deleted file mode 100644
index b554a579..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/netbuf.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_NETBUF_H__
-#define __LWIP_NETBUF_H__
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** This netbuf has dest-addr/port set */
-#define NETBUF_FLAG_DESTADDR 0x01
-/** This netbuf includes a checksum */
-#define NETBUF_FLAG_CHKSUM 0x02
-
-struct netbuf {
- struct pbuf *p, *ptr;
- ip_addr_t addr;
- u16_t port;
-#if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY
-#if LWIP_CHECKSUM_ON_COPY
- u8_t flags;
-#endif /* LWIP_CHECKSUM_ON_COPY */
- u16_t toport_chksum;
-#if LWIP_NETBUF_RECVINFO
- ip_addr_t toaddr;
-#endif /* LWIP_NETBUF_RECVINFO */
-#endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */
-};
-
-/* Network buffer functions: */
-struct netbuf * netbuf_new (void)ICACHE_FLASH_ATTR;
-void netbuf_delete (struct netbuf *buf)ICACHE_FLASH_ATTR;
-void * netbuf_alloc (struct netbuf *buf, u16_t size)ICACHE_FLASH_ATTR;
-void netbuf_free (struct netbuf *buf)ICACHE_FLASH_ATTR;
-err_t netbuf_ref (struct netbuf *buf,
- const void *dataptr, u16_t size)ICACHE_FLASH_ATTR;
-void netbuf_chain (struct netbuf *head,
- struct netbuf *tail)ICACHE_FLASH_ATTR;
-
-err_t netbuf_data (struct netbuf *buf,
- void **dataptr, u16_t *len)ICACHE_FLASH_ATTR;
-s8_t netbuf_next (struct netbuf *buf)ICACHE_FLASH_ATTR;
-void netbuf_first (struct netbuf *buf)ICACHE_FLASH_ATTR;
-
-
-#define netbuf_copy_partial(buf, dataptr, len, offset) \
- pbuf_copy_partial((buf)->p, (dataptr), (len), (offset))
-#define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0)
-#define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len)
-#define netbuf_len(buf) ((buf)->p->tot_len)
-#define netbuf_fromaddr(buf) (&((buf)->addr))
-#define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set((&(buf)->addr), fromaddr)
-#define netbuf_fromport(buf) ((buf)->port)
-#if LWIP_NETBUF_RECVINFO
-#define netbuf_destaddr(buf) (&((buf)->toaddr))
-#define netbuf_set_destaddr(buf, destaddr) ip_addr_set((&(buf)->addr), destaddr)
-#define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0)
-#endif /* LWIP_NETBUF_RECVINFO */
-#if LWIP_CHECKSUM_ON_COPY
-#define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \
- (buf)->toport_chksum = chksum; } while(0)
-#endif /* LWIP_CHECKSUM_ON_COPY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_NETBUF_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/netdb.h b/sparkfun/esp8266/firmwares/loader/src/lwip/netdb.h
deleted file mode 100644
index 7587e2f2..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/netdb.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Simon Goldschmidt
- *
- */
-#ifndef __LWIP_NETDB_H__
-#define __LWIP_NETDB_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_DNS && LWIP_SOCKET
-
-#include /* for size_t */
-
-#include "lwip/inet.h"
-#include "lwip/sockets.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* some rarely used options */
-#ifndef LWIP_DNS_API_DECLARE_H_ERRNO
-#define LWIP_DNS_API_DECLARE_H_ERRNO 1
-#endif
-
-#ifndef LWIP_DNS_API_DEFINE_ERRORS
-#define LWIP_DNS_API_DEFINE_ERRORS 1
-#endif
-
-#ifndef LWIP_DNS_API_DECLARE_STRUCTS
-#define LWIP_DNS_API_DECLARE_STRUCTS 1
-#endif
-
-#if LWIP_DNS_API_DEFINE_ERRORS
-/** Errors used by the DNS API functions, h_errno can be one of them */
-#define EAI_NONAME 200
-#define EAI_SERVICE 201
-#define EAI_FAIL 202
-#define EAI_MEMORY 203
-
-#define HOST_NOT_FOUND 210
-#define NO_DATA 211
-#define NO_RECOVERY 212
-#define TRY_AGAIN 213
-#endif /* LWIP_DNS_API_DEFINE_ERRORS */
-
-#if LWIP_DNS_API_DECLARE_STRUCTS
-struct hostent {
- char *h_name; /* Official name of the host. */
- char **h_aliases; /* A pointer to an array of pointers to alternative host names,
- terminated by a null pointer. */
- int h_addrtype; /* Address type. */
- int h_length; /* The length, in bytes, of the address. */
- char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
- network byte order) for the host, terminated by a null pointer. */
-#define h_addr h_addr_list[0] /* for backward compatibility */
-};
-
-struct addrinfo {
- int ai_flags; /* Input flags. */
- int ai_family; /* Address family of socket. */
- int ai_socktype; /* Socket type. */
- int ai_protocol; /* Protocol of socket. */
- socklen_t ai_addrlen; /* Length of socket address. */
- struct sockaddr *ai_addr; /* Socket address of socket. */
- char *ai_canonname; /* Canonical name of service location. */
- struct addrinfo *ai_next; /* Pointer to next in list. */
-};
-#endif /* LWIP_DNS_API_DECLARE_STRUCTS */
-
-#if LWIP_DNS_API_DECLARE_H_ERRNO
-/* application accessable error code set by the DNS API functions */
-extern int h_errno;
-#endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/
-
-struct hostent *lwip_gethostbyname(const char *name);
-int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
- size_t buflen, struct hostent **result, int *h_errnop);
-void lwip_freeaddrinfo(struct addrinfo *ai);
-int lwip_getaddrinfo(const char *nodename,
- const char *servname,
- const struct addrinfo *hints,
- struct addrinfo **res);
-
-#if LWIP_COMPAT_SOCKETS
-#define gethostbyname(name) lwip_gethostbyname(name)
-#define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
- lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
-#define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
-#define getaddrinfo(nodname, servname, hints, res) \
- lwip_getaddrinfo(nodname, servname, hints, res)
-#endif /* LWIP_COMPAT_SOCKETS */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_DNS && LWIP_SOCKET */
-
-#endif /* __LWIP_NETDB_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/netif.h b/sparkfun/esp8266/firmwares/loader/src/lwip/netif.h
deleted file mode 100644
index 8bf13752..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/netif.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_NETIF_H__
-#define __LWIP_NETIF_H__
-
-#include "lwip/opt.h"
-
-#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
-
-#include "lwip/err.h"
-
-#include "lwip/ip_addr.h"
-
-#include "lwip/def.h"
-#include "lwip/pbuf.h"
-#if LWIP_DHCP
-struct dhcp;
-#endif
-#if LWIP_AUTOIP
-struct autoip;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Throughout this file, IP addresses are expected to be in
- * the same byte order as in IP_PCB. */
-
-/** must be the maximum of all used hardware address lengths
- across all types of interfaces in use */
-#define NETIF_MAX_HWADDR_LEN 6U
-
-/** Whether the network interface is 'up'. This is
- * a software flag used to control whether this network
- * interface is enabled and processes traffic.
- * It is set by the startup code (for static IP configuration) or
- * by dhcp/autoip when an address has been assigned.
- */
-#define NETIF_FLAG_UP 0x01U
-/** If set, the netif has broadcast capability.
- * Set by the netif driver in its init function. */
-#define NETIF_FLAG_BROADCAST 0x02U
-/** If set, the netif is one end of a point-to-point connection.
- * Set by the netif driver in its init function. */
-#define NETIF_FLAG_POINTTOPOINT 0x04U
-/** If set, the interface is configured using DHCP.
- * Set by the DHCP code when starting or stopping DHCP. */
-#define NETIF_FLAG_DHCP 0x08U
-/** If set, the interface has an active link
- * (set by the network interface driver).
- * Either set by the netif driver in its init function (if the link
- * is up at that time) or at a later point once the link comes up
- * (if link detection is supported by the hardware). */
-#define NETIF_FLAG_LINK_UP 0x10U
-/** If set, the netif is an ethernet device using ARP.
- * Set by the netif driver in its init function.
- * Used to check input packet types and use of DHCP. */
-#define NETIF_FLAG_ETHARP 0x20U
-/** If set, the netif is an ethernet device. It might not use
- * ARP or TCP/IP if it is used for PPPoE only.
- */
-#define NETIF_FLAG_ETHERNET 0x40U
-/** If set, the netif has IGMP capability.
- * Set by the netif driver in its init function. */
-#define NETIF_FLAG_IGMP 0x80U
-
-/** Function prototype for netif init functions. Set up flags and output/linkoutput
- * callback functions in this function.
- *
- * @param netif The netif to initialize
- */
-typedef err_t (*netif_init_fn)(struct netif *netif);
-/** Function prototype for netif->input functions. This function is saved as 'input'
- * callback function in the netif struct. Call it when a packet has been received.
- *
- * @param p The received packet, copied into a pbuf
- * @param inp The netif which received the packet
- */
-typedef err_t (*netif_input_fn)(struct pbuf *p, struct netif *inp);
-/** Function prototype for netif->output functions. Called by lwIP when a packet
- * shall be sent. For ethernet netif, set this to 'etharp_output' and set
- * 'linkoutput'.
- *
- * @param netif The netif which shall send a packet
- * @param p The packet to send (p->payload points to IP header)
- * @param ipaddr The IP address to which the packet shall be sent
- */
-typedef err_t (*netif_output_fn)(struct netif *netif, struct pbuf *p,
- ip_addr_t *ipaddr);
-/** Function prototype for netif->linkoutput functions. Only used for ethernet
- * netifs. This function is called by ARP when a packet shall be sent.
- *
- * @param netif The netif which shall send a packet
- * @param p The packet to send (raw ethernet packet)
- */
-typedef err_t (*netif_linkoutput_fn)(struct netif *netif, struct pbuf *p);
-/** Function prototype for netif status- or link-callback functions. */
-typedef void (*netif_status_callback_fn)(struct netif *netif);
-/** Function prototype for netif igmp_mac_filter functions */
-typedef err_t (*netif_igmp_mac_filter_fn)(struct netif *netif,
- ip_addr_t *group, u8_t action);
-
-/** Generic data structure used for all lwIP network interfaces.
- * The following fields should be filled in by the initialization
- * function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
-struct netif {
- /** pointer to next in linked list */
- struct netif *next;
-
- /** IP address configuration in network byte order */
- ip_addr_t ip_addr;
- ip_addr_t netmask;
- ip_addr_t gw;
-
- /** This function is called by the network device driver
- * to pass a packet up the TCP/IP stack. ÏòIP²ãÊäÈëÊý¾Ý°ü*/
- netif_input_fn input;
- /** This function is called by the IP module when it wants
- * to send a packet on the interface. This function typically
- * first resolves the hardware address, then sends the packet. ·¢ËÍIPÊý¾Ý°ü*/
- netif_output_fn output;
- /** This function is called by the ARP module when it wants
- * to send a packet on the interface. This function outputs
- * the pbuf as-is on the link medium. µ×²ãÊý¾Ý°ü·¢ËÍ*/
- netif_linkoutput_fn linkoutput;
-#if LWIP_NETIF_STATUS_CALLBACK
- /** This function is called when the netif state is set to up or down
- */
- netif_status_callback_fn status_callback;
-#endif /* LWIP_NETIF_STATUS_CALLBACK */
-#if LWIP_NETIF_LINK_CALLBACK
- /** This function is called when the netif link is set to up or down
- */
- netif_status_callback_fn link_callback;
-#endif /* LWIP_NETIF_LINK_CALLBACK */
- /** This field can be set by the device driver and could point
- * to state information for the device. ×ÔÓÉÉèÖÃ×ֶΣ¬±ÈÈçÖ¸Ïòµ×²ãÉ豸Ïà¹ØÐÅÏ¢*/
- void *state;
-#if LWIP_DHCP
- /** the DHCP client state information for this netif */
- struct dhcp *dhcp;
-#endif /* LWIP_DHCP */
-#if LWIP_AUTOIP
- /** the AutoIP client state information for this netif */
- struct autoip *autoip;
-#endif
-#if LWIP_NETIF_HOSTNAME
- /* the hostname for this netif, NULL is a valid value */
- char* hostname;
-#endif /* LWIP_NETIF_HOSTNAME */
- /** maximum transfer unit (in bytes) ¸Ã½Ó¿ÚÔÊÐíµÄ×î´óÊý¾Ý°ü³¤¶È£¬¶àÊÇ1500*/
- u16_t mtu;
- /** number of bytes used in hwaddr¸Ã½Ó¿ÚÎïÀíµØÖ·³¤¶È */
- u8_t hwaddr_len;
- /** link level hardware address of this interface ¸Ã½Ó¿ÚÎïÀíµØÖ·*/
- u8_t hwaddr[NETIF_MAX_HWADDR_LEN];
- /** flags (see NETIF_FLAG_ above) ¸Ã½Ó¿Ú״̬¡¢ÊôÐÔ×Ö¶Î*/
- u8_t flags;
- /** descriptive abbreviation ¸Ã½Ó¿ÚµÄÃû×Ö*/
- char name[2];
- /** number of this interface ¸Ã½Ó¿ÚµÄ±àºÅ*/
- u8_t num;
-#if LWIP_SNMP
- /** link type (from "snmp_ifType" enum from snmp.h) */
- u8_t link_type;
- /** (estimate) link speed */
- u32_t link_speed;
- /** timestamp at last change made (up/down) */
- u32_t ts;
- /** counters */
- u32_t ifinoctets;
- u32_t ifinucastpkts;
- u32_t ifinnucastpkts;
- u32_t ifindiscards;
- u32_t ifoutoctets;
- u32_t ifoutucastpkts;
- u32_t ifoutnucastpkts;
- u32_t ifoutdiscards;
-#endif /* LWIP_SNMP */
-#if LWIP_IGMP
- /** This function could be called to add or delete a entry in the multicast
- filter table of the ethernet MAC.*/
- netif_igmp_mac_filter_fn igmp_mac_filter;
-#endif /* LWIP_IGMP */
-#if LWIP_NETIF_HWADDRHINT
- u8_t *addr_hint;
-#endif /* LWIP_NETIF_HWADDRHINT */
-#if ENABLE_LOOPBACK
- /* List of packets to be queued for ourselves. Ö¸Ïò·¢Ë͸ø×Ô¼ºµÄÊý¾Ý°üµÄpbuf*/
- struct pbuf *loop_first;//µÚÒ»¸ö
- struct pbuf *loop_last;//×îºóÒ»¸ö
-#if LWIP_LOOPBACK_MAX_PBUFS
- u16_t loop_cnt_current;
-#endif /* LWIP_LOOPBACK_MAX_PBUFS */
-#endif /* ENABLE_LOOPBACK */
-};
-
-#if LWIP_SNMP
-#define NETIF_INIT_SNMP(netif, type, speed) \
- /* use "snmp_ifType" enum from snmp.h for "type", snmp_ifType_ethernet_csmacd by example */ \
- (netif)->link_type = (type); \
- /* your link speed here (units: bits per second) */ \
- (netif)->link_speed = (speed); \
- (netif)->ts = 0; \
- (netif)->ifinoctets = 0; \
- (netif)->ifinucastpkts = 0; \
- (netif)->ifinnucastpkts = 0; \
- (netif)->ifindiscards = 0; \
- (netif)->ifoutoctets = 0; \
- (netif)->ifoutucastpkts = 0; \
- (netif)->ifoutnucastpkts = 0; \
- (netif)->ifoutdiscards = 0
-#else /* LWIP_SNMP */
-#define NETIF_INIT_SNMP(netif, type, speed)
-#endif /* LWIP_SNMP */
-
-
-/** The list of network interfaces. */
-extern struct netif *netif_list;
-/** The default network interface. */
-extern struct netif *netif_default;
-
-void netif_init(void)ICACHE_FLASH_ATTR;
-
-struct netif *netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
- ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)ICACHE_FLASH_ATTR;
-
-void
-netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
- ip_addr_t *gw)ICACHE_FLASH_ATTR;
-void netif_remove(struct netif * netif)ICACHE_FLASH_ATTR;
-
-/* Returns a network interface given its name. The name is of the form
- "et0", where the first two letters are the "name" field in the
- netif structure, and the digit is in the num field in the same
- structure. */
-struct netif *netif_find(char *name)ICACHE_FLASH_ATTR;
-
-void netif_set_default(struct netif *netif)ICACHE_FLASH_ATTR;
-
-void netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr)ICACHE_FLASH_ATTR;
-void netif_set_netmask(struct netif *netif, ip_addr_t *netmask)ICACHE_FLASH_ATTR;
-void netif_set_gw(struct netif *netif, ip_addr_t *gw)ICACHE_FLASH_ATTR;
-
-void netif_set_up(struct netif *netif)ICACHE_FLASH_ATTR;
-void netif_set_down(struct netif *netif)ICACHE_FLASH_ATTR;
-/** Ask if an interface is up */
-#define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
-
-#if LWIP_NETIF_STATUS_CALLBACK
-void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback)ICACHE_FLASH_ATTR;
-#endif /* LWIP_NETIF_STATUS_CALLBACK */
-
-void netif_set_link_up(struct netif *netif)ICACHE_FLASH_ATTR;
-void netif_set_link_down(struct netif *netif)ICACHE_FLASH_ATTR;
-/** Ask if a link is up */
-#define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
-
-#if LWIP_NETIF_LINK_CALLBACK
-void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback)ICACHE_FLASH_ATTR;
-#endif /* LWIP_NETIF_LINK_CALLBACK */
-
-#if LWIP_NETIF_HOSTNAME
-#define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0)
-#define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL)
-#endif /* LWIP_NETIF_HOSTNAME */
-
-#if LWIP_IGMP
-#define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0)
-#define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL)
-#endif /* LWIP_IGMP */
-
-#if ENABLE_LOOPBACK
-err_t netif_loop_output(struct netif *netif, struct pbuf *p, ip_addr_t *dest_ip)ICACHE_FLASH_ATTR;
-void netif_poll(struct netif *netif)ICACHE_FLASH_ATTR;
-#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
-void netif_poll_all(void)ICACHE_FLASH_ATTR;
-#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
-#endif /* ENABLE_LOOPBACK */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_NETIF_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/netifapi.h b/sparkfun/esp8266/firmwares/loader/src/lwip/netifapi.h
deleted file mode 100644
index 33318efa..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/netifapi.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- */
-
-#ifndef __LWIP_NETIFAPI_H__
-#define __LWIP_NETIFAPI_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/sys.h"
-#include "lwip/netif.h"
-#include "lwip/dhcp.h"
-#include "lwip/autoip.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*netifapi_void_fn)(struct netif *netif);
-typedef err_t (*netifapi_errt_fn)(struct netif *netif);
-
-struct netifapi_msg_msg {
-#if !LWIP_TCPIP_CORE_LOCKING
- sys_sem_t sem;
-#endif /* !LWIP_TCPIP_CORE_LOCKING */
- err_t err;
- struct netif *netif;
- union {
- struct {
- ip_addr_t *ipaddr;
- ip_addr_t *netmask;
- ip_addr_t *gw;
- void *state;
- netif_init_fn init;
- netif_input_fn input;
- } add;
- struct {
- netifapi_void_fn voidfunc;
- netifapi_errt_fn errtfunc;
- } common;
- } msg;
-};
-
-struct netifapi_msg {
- void (* function)(struct netifapi_msg_msg *msg);
- struct netifapi_msg_msg msg;
-};
-
-
-/* API for application */
-err_t netifapi_netif_add ( struct netif *netif,
- ip_addr_t *ipaddr,
- ip_addr_t *netmask,
- ip_addr_t *gw,
- void *state,
- netif_init_fn init,
- netif_input_fn input);
-
-err_t netifapi_netif_set_addr ( struct netif *netif,
- ip_addr_t *ipaddr,
- ip_addr_t *netmask,
- ip_addr_t *gw );
-
-err_t netifapi_netif_common ( struct netif *netif,
- netifapi_void_fn voidfunc,
- netifapi_errt_fn errtfunc);
-
-#define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL)
-#define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL)
-#define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL)
-#define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL)
-#define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start)
-#define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL)
-#define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start)
-#define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_NETIF_API */
-
-#endif /* __LWIP_NETIFAPI_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/opt.h b/sparkfun/esp8266/firmwares/loader/src/lwip/opt.h
deleted file mode 100644
index 1a681c99..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/opt.h
+++ /dev/null
@@ -1,2043 +0,0 @@
-/**
- * @file
- *
- * lwIP Options Configuration
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_OPT_H__
-#define __LWIP_OPT_H__
-
-/*
- * Include user defined options first. Anything not defined in these files
- * will be set to standard values. Override anything you dont like!
- */
-#include "include/lwipopts.h"
-#include "lwip/debug.h"
-
-/*
- -----------------------------------------------
- ---------- Platform specific locking ----------
- -----------------------------------------------
-*/
-
-/**
- * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
- * critical regions during buffer allocation, deallocation and memory
- * allocation and deallocation.
- */
-#ifndef SYS_LIGHTWEIGHT_PROT
-#define SYS_LIGHTWEIGHT_PROT 0
-#endif
-
-/**
- * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
- * use lwIP facilities.
- */
-#ifndef NO_SYS
-#define NO_SYS 1
-#endif
-
-/**
- * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1
- * Mainly for compatibility to old versions.
- */
-#ifndef NO_SYS_NO_TIMERS
-#define NO_SYS_NO_TIMERS 1
-#endif
-
-/**
- * MEMCPY: override this if you have a faster implementation at hand than the
- * one included in your C library
- */
-#ifndef MEMCPY
-#define MEMCPY(dst,src,len) memcpy(dst,src,len)
-#endif
-
-/**
- * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a
- * call to memcpy() if the length is known at compile time and is small.
- */
-#ifndef SMEMCPY
-#define SMEMCPY(dst,src,len) memcpy(dst,src,len)
-#endif
-
-/*
- ------------------------------------
- ---------- Memory options ----------
- ------------------------------------
-*/
-/**
- * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
- * instead of the lwip internal allocator. Can save code size if you
- * already use it.
- */
-#ifndef MEM_LIBC_MALLOC
-#define MEM_LIBC_MALLOC 0
-#endif
-
-/**
-* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
-* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
-* speed and usage from interrupts!
-*/
-#ifndef MEMP_MEM_MALLOC
-#define MEMP_MEM_MALLOC 0
-#endif
-
-/**
- * MEM_ALIGNMENT: should be set to the alignment of the CPU
- * 4 byte alignment -> #define MEM_ALIGNMENT 4
- * 2 byte alignment -> #define MEM_ALIGNMENT 2
- */
-#ifndef MEM_ALIGNMENT
-#define MEM_ALIGNMENT 1
-#endif
-
-/**
- * MEM_SIZE: the size of the heap memory. If the application will send
- * a lot of data that needs to be copied, this should be set high.
- */
-#ifndef MEM_SIZE
-#define MEM_SIZE 1600
-#endif
-
-/**
- * MEMP_SEPARATE_POOLS: if defined to 1, each pool is placed in its own array.
- * This can be used to individually change the location of each pool.
- * Default is one big array for all pools
- */
-#ifndef MEMP_SEPARATE_POOLS
-#define MEMP_SEPARATE_POOLS 0
-#endif
-
-/**
- * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable
- * amount of bytes before and after each memp element in every pool and fills
- * it with a prominent default value.
- * MEMP_OVERFLOW_CHECK == 0 no checking
- * MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed
- * MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time
- * memp_malloc() or memp_free() is called (useful but slow!)
- */
-#ifndef MEMP_OVERFLOW_CHECK
-#define MEMP_OVERFLOW_CHECK 0
-#endif
-
-/**
- * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make
- * sure that there are no cycles in the linked lists.
- */
-#ifndef MEMP_SANITY_CHECK
-#define MEMP_SANITY_CHECK 0
-#endif
-
-/**
- * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
- * of memory pools of various sizes. When mem_malloc is called, an element of
- * the smallest pool that can provide the length needed is returned.
- * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled.
- */
-#ifndef MEM_USE_POOLS
-#define MEM_USE_POOLS 0
-#endif
-
-/**
- * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next
- * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more
- * reliable. */
-#ifndef MEM_USE_POOLS_TRY_BIGGER_POOL
-#define MEM_USE_POOLS_TRY_BIGGER_POOL 0
-#endif
-
-/**
- * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h
- * that defines additional pools beyond the "standard" ones required
- * by lwIP. If you set this to 1, you must have lwippools.h in your
- * inlude path somewhere.
- */
-#ifndef MEMP_USE_CUSTOM_POOLS
-#define MEMP_USE_CUSTOM_POOLS 0
-#endif
-
-/**
- * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from
- * interrupt context (or another context that doesn't allow waiting for a
- * semaphore).
- * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT,
- * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs
- * with each loop so that mem_free can run.
- *
- * ATTENTION: As you can see from the above description, this leads to dis-/
- * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc
- * can need longer.
- *
- * If you don't want that, at least for NO_SYS=0, you can still use the following
- * functions to enqueue a deallocation call which then runs in the tcpip_thread
- * context:
- * - pbuf_free_callback(p);
- * - mem_free_callback(m);
- */
-#ifndef LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT
-#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0
-#endif
-
-/*
- ------------------------------------------------
- ---------- Internal Memory Pool Sizes ----------
- ------------------------------------------------
-*/
-/**
- * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF).
- * If the application sends a lot of data out of ROM (or other static memory),
- * this should be set high.
- */
-#ifndef MEMP_NUM_PBUF
-#define MEMP_NUM_PBUF 16
-#endif
-
-/**
- * MEMP_NUM_RAW_PCB: Number of raw connection PCBs
- * (requires the LWIP_RAW option)
- */
-#ifndef MEMP_NUM_RAW_PCB
-#define MEMP_NUM_RAW_PCB 4
-#endif
-
-/**
- * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
- * per active UDP "connection".
- * (requires the LWIP_UDP option)
- */
-#ifndef MEMP_NUM_UDP_PCB
-#define MEMP_NUM_UDP_PCB 4
-#endif
-
-/**
- * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
- * (requires the LWIP_TCP option)
- */
-#ifndef MEMP_NUM_TCP_PCB
-#define MEMP_NUM_TCP_PCB 5
-#endif
-
-/**
- * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
- * (requires the LWIP_TCP option)
- */
-#ifndef MEMP_NUM_TCP_PCB_LISTEN
-#define MEMP_NUM_TCP_PCB_LISTEN 8
-#endif
-
-/**
- * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
- * (requires the LWIP_TCP option)
- */
-#ifndef MEMP_NUM_TCP_SEG
-#define MEMP_NUM_TCP_SEG 16
-#endif
-
-/**
- * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for
- * reassembly (whole packets, not fragments!)
- */
-#ifndef MEMP_NUM_REASSDATA
-#define MEMP_NUM_REASSDATA 5
-#endif
-
-/**
- * MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent
- * (fragments, not whole packets!).
- * This is only used with IP_FRAG_USES_STATIC_BUF==0 and
- * LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1 with DMA-enabled MACs
- * where the packet is not yet sent when netif->output returns.
- */
-#ifndef MEMP_NUM_FRAG_PBUF
-#define MEMP_NUM_FRAG_PBUF 15
-#endif
-
-/**
- * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing
- * packets (pbufs) that are waiting for an ARP request (to resolve
- * their destination address) to finish.
- * (requires the ARP_QUEUEING option)
- */
-#ifndef MEMP_NUM_ARP_QUEUE
-#define MEMP_NUM_ARP_QUEUE 30
-#endif
-
-/**
- * MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces
- * can be members et the same time (one per netif - allsystems group -, plus one
- * per netif membership).
- * (requires the LWIP_IGMP option)
- */
-#ifndef MEMP_NUM_IGMP_GROUP
-#define MEMP_NUM_IGMP_GROUP 8
-#endif
-
-/**
- * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts.
- * (requires NO_SYS==0)
- */
-#ifndef MEMP_NUM_SYS_TIMEOUT
-#define MEMP_NUM_SYS_TIMEOUT 3
-#endif
-
-/**
- * MEMP_NUM_NETBUF: the number of struct netbufs.
- * (only needed if you use the sequential API, like api_lib.c)
- */
-#ifndef MEMP_NUM_NETBUF
-#define MEMP_NUM_NETBUF 2
-#endif
-
-/**
- * MEMP_NUM_NETCONN: the number of struct netconns.
- * (only needed if you use the sequential API, like api_lib.c)
- */
-#ifndef MEMP_NUM_NETCONN
-#define MEMP_NUM_NETCONN 4
-#endif
-
-/**
- * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used
- * for callback/timeout API communication.
- * (only needed if you use tcpip.c)
- */
-#ifndef MEMP_NUM_TCPIP_MSG_API
-#define MEMP_NUM_TCPIP_MSG_API 8
-#endif
-
-/**
- * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used
- * for incoming packets.
- * (only needed if you use tcpip.c)
- */
-#ifndef MEMP_NUM_TCPIP_MSG_INPKT
-#define MEMP_NUM_TCPIP_MSG_INPKT 8
-#endif
-
-/**
- * MEMP_NUM_SNMP_NODE: the number of leafs in the SNMP tree.
- */
-#ifndef MEMP_NUM_SNMP_NODE
-#define MEMP_NUM_SNMP_NODE 50
-#endif
-
-/**
- * MEMP_NUM_SNMP_ROOTNODE: the number of branches in the SNMP tree.
- * Every branch has one leaf (MEMP_NUM_SNMP_NODE) at least!
- */
-#ifndef MEMP_NUM_SNMP_ROOTNODE
-#define MEMP_NUM_SNMP_ROOTNODE 30
-#endif
-
-/**
- * MEMP_NUM_SNMP_VARBIND: the number of concurrent requests (does not have to
- * be changed normally) - 2 of these are used per request (1 for input,
- * 1 for output)
- */
-#ifndef MEMP_NUM_SNMP_VARBIND
-#define MEMP_NUM_SNMP_VARBIND 2
-#endif
-
-/**
- * MEMP_NUM_SNMP_VALUE: the number of OID or values concurrently used
- * (does not have to be changed normally) - 3 of these are used per request
- * (1 for the value read and 2 for OIDs - input and output)
- */
-#ifndef MEMP_NUM_SNMP_VALUE
-#define MEMP_NUM_SNMP_VALUE 3
-#endif
-
-/**
- * MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls
- * (before freeing the corresponding memory using lwip_freeaddrinfo()).
- */
-#ifndef MEMP_NUM_NETDB
-#define MEMP_NUM_NETDB 1
-#endif
-
-/**
- * MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list
- * if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1.
- */
-#ifndef MEMP_NUM_LOCALHOSTLIST
-#define MEMP_NUM_LOCALHOSTLIST 1
-#endif
-
-/**
- * MEMP_NUM_PPPOE_INTERFACES: the number of concurrently active PPPoE
- * interfaces (only used with PPPOE_SUPPORT==1)
- */
-#ifndef MEMP_NUM_PPPOE_INTERFACES
-#define MEMP_NUM_PPPOE_INTERFACES 1
-#endif
-
-/**
- * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
- */
-#ifndef PBUF_POOL_SIZE
-#define PBUF_POOL_SIZE 16
-#endif
-
-/*
- ---------------------------------
- ---------- ARP options ----------
- ---------------------------------
-*/
-/**
- * LWIP_ARP==1: Enable ARP functionality.
- */
-#ifndef LWIP_ARP
-#define LWIP_ARP 1
-#endif
-
-/**
- * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached.
- */
-#ifndef ARP_TABLE_SIZE
-#define ARP_TABLE_SIZE 10
-#endif
-
-/**
- * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address
- * resolution. By default, only the most recent packet is queued per IP address.
- * This is sufficient for most protocols and mainly reduces TCP connection
- * startup time. Set this to 1 if you know your application sends more than one
- * packet in a row to an IP address that is not in the ARP cache.
- */
-#ifndef ARP_QUEUEING
-#define ARP_QUEUEING 0
-#endif
-
-/**
- * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be
- * updated with the source MAC and IP addresses supplied in the packet.
- * You may want to disable this if you do not trust LAN peers to have the
- * correct addresses, or as a limited approach to attempt to handle
- * spoofing. If disabled, lwIP will need to make a new ARP request if
- * the peer is not already in the ARP table, adding a little latency.
- * The peer *is* in the ARP table if it requested our address before.
- * Also notice that this slows down input processing of every IP packet!
- */
-#ifndef ETHARP_TRUST_IP_MAC
-#define ETHARP_TRUST_IP_MAC 0
-#endif
-
-/**
- * ETHARP_SUPPORT_VLAN==1: support receiving ethernet packets with VLAN header.
- * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check.
- * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted.
- * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted.
- */
-#ifndef ETHARP_SUPPORT_VLAN
-#define ETHARP_SUPPORT_VLAN 0
-#endif
-
-/** LWIP_ETHERNET==1: enable ethernet support for PPPoE even though ARP
- * might be disabled
- */
-#ifndef LWIP_ETHERNET
-#define LWIP_ETHERNET (LWIP_ARP || PPPOE_SUPPORT)
-#endif
-
-/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure
- * alignment of payload after that header. Since the header is 14 bytes long,
- * without this padding e.g. addresses in the IP header will not be aligned
- * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms.
- */
-#ifndef ETH_PAD_SIZE
-#define ETH_PAD_SIZE 0
-#endif
-
-/** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table
- * entries (using etharp_add_static_entry/etharp_remove_static_entry).
- */
-#ifndef ETHARP_SUPPORT_STATIC_ENTRIES
-#define ETHARP_SUPPORT_STATIC_ENTRIES 0
-#endif
-
-
-/*
- --------------------------------
- ---------- IP options ----------
- --------------------------------
-*/
-/**
- * IP_FORWARD==1: Enables the ability to forward IP packets across network
- * interfaces. If you are going to run lwIP on a device with only one network
- * interface, define this to 0.
- */
-#ifndef IP_FORWARD
-#define IP_FORWARD 0
-#endif
-
-/**
- * IP_OPTIONS_ALLOWED: Defines the behavior for IP options.
- * IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped.
- * IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed).
- */
-#ifndef IP_OPTIONS_ALLOWED
-#define IP_OPTIONS_ALLOWED 1
-#endif
-
-/**
- * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that
- * this option does not affect outgoing packet sizes, which can be controlled
- * via IP_FRAG.
- */
-#ifndef IP_REASSEMBLY
-#define IP_REASSEMBLY 0
-#endif
-
-/**
- * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note
- * that this option does not affect incoming packet sizes, which can be
- * controlled via IP_REASSEMBLY.
- */
-#ifndef IP_FRAG
-#define IP_FRAG 1
-#endif
-
-/**
- * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally)
- * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived
- * in this time, the whole packet is discarded.
- */
-#ifndef IP_REASS_MAXAGE
-#define IP_REASS_MAXAGE 3
-#endif
-
-/**
- * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.
- * Since the received pbufs are enqueued, be sure to configure
- * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive
- * packets even if the maximum amount of fragments is enqueued for reassembly!
- */
-#ifndef IP_REASS_MAX_PBUFS
-#define IP_REASS_MAX_PBUFS 10
-#endif
-
-/**
- * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
- * fragmentation. Otherwise pbufs are allocated and reference the original
- * packet data to be fragmented (or with LWIP_NETIF_TX_SINGLE_PBUF==1,
- * new PBUF_RAM pbufs are used for fragments).
- * ATTENTION: IP_FRAG_USES_STATIC_BUF==1 may not be used for DMA-enabled MACs!
- */
-#ifndef IP_FRAG_USES_STATIC_BUF
-#define IP_FRAG_USES_STATIC_BUF 0
-#endif
-
-/**
- * IP_FRAG_MAX_MTU: Assumed max MTU on any interface for IP frag buffer
- * (requires IP_FRAG_USES_STATIC_BUF==1)
- */
-#if IP_FRAG_USES_STATIC_BUF && !defined(IP_FRAG_MAX_MTU)
-#define IP_FRAG_MAX_MTU 1500
-#endif
-
-/**
- * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers.
- */
-#ifndef IP_DEFAULT_TTL
-#define IP_DEFAULT_TTL 255
-#endif
-
-/**
- * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast
- * filter per pcb on udp and raw send operations. To enable broadcast filter
- * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1.
- */
-#ifndef IP_SOF_BROADCAST
-#define IP_SOF_BROADCAST 0
-#endif
-
-/**
- * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
- * filter on recv operations.
- */
-#ifndef IP_SOF_BROADCAST_RECV
-#define IP_SOF_BROADCAST_RECV 0
-#endif
-
-/*
- ----------------------------------
- ---------- ICMP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_ICMP==1: Enable ICMP module inside the IP stack.
- * Be careful, disable that make your product non-compliant to RFC1122
- */
-#ifndef LWIP_ICMP
-#define LWIP_ICMP 1
-#endif
-
-/**
- * ICMP_TTL: Default value for Time-To-Live used by ICMP packets.
- */
-#ifndef ICMP_TTL
-#define ICMP_TTL (IP_DEFAULT_TTL)
-#endif
-
-/**
- * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only)
- */
-#ifndef LWIP_BROADCAST_PING
-#define LWIP_BROADCAST_PING 0
-#endif
-
-/**
- * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only)
- */
-#ifndef LWIP_MULTICAST_PING
-#define LWIP_MULTICAST_PING 0
-#endif
-
-/*
- ---------------------------------
- ---------- RAW options ----------
- ---------------------------------
-*/
-/**
- * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
- */
-#ifndef LWIP_RAW
-#define LWIP_RAW 1
-#endif
-
-/**
- * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
- */
-#ifndef RAW_TTL
-#define RAW_TTL (IP_DEFAULT_TTL)
-#endif
-
-/*
- ----------------------------------
- ---------- DHCP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_DHCP==1: Enable DHCP module.
- */
-#ifndef LWIP_DHCP
-#define LWIP_DHCP 0
-#endif
-
-/**
- * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address.
- */
-#ifndef DHCP_DOES_ARP_CHECK
-#define DHCP_DOES_ARP_CHECK ((LWIP_DHCP) && (LWIP_ARP))
-#endif
-
-/*
- ------------------------------------
- ---------- AUTOIP options ----------
- ------------------------------------
-*/
-/**
- * LWIP_AUTOIP==1: Enable AUTOIP module.
- */
-#ifndef LWIP_AUTOIP
-#define LWIP_AUTOIP 0
-#endif
-
-/**
- * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on
- * the same interface at the same time.
- */
-#ifndef LWIP_DHCP_AUTOIP_COOP
-#define LWIP_DHCP_AUTOIP_COOP 0
-#endif
-
-/**
- * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes
- * that should be sent before falling back on AUTOIP. This can be set
- * as low as 1 to get an AutoIP address very quickly, but you should
- * be prepared to handle a changing IP address when DHCP overrides
- * AutoIP.
- */
-#ifndef LWIP_DHCP_AUTOIP_COOP_TRIES
-#define LWIP_DHCP_AUTOIP_COOP_TRIES 9
-#endif
-
-/*
- ----------------------------------
- ---------- SNMP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP
- * transport.
- */
-#ifndef LWIP_SNMP
-#define LWIP_SNMP 0
-#endif
-
-/**
- * SNMP_CONCURRENT_REQUESTS: Number of concurrent requests the module will
- * allow. At least one request buffer is required.
- * Does not have to be changed unless external MIBs answer request asynchronously
- */
-#ifndef SNMP_CONCURRENT_REQUESTS
-#define SNMP_CONCURRENT_REQUESTS 1
-#endif
-
-/**
- * SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap
- * destination is required
- */
-#ifndef SNMP_TRAP_DESTINATIONS
-#define SNMP_TRAP_DESTINATIONS 1
-#endif
-
-/**
- * SNMP_PRIVATE_MIB:
- * When using a private MIB, you have to create a file 'private_mib.h' that contains
- * a 'struct mib_array_node mib_private' which contains your MIB.
- */
-#ifndef SNMP_PRIVATE_MIB
-#define SNMP_PRIVATE_MIB 0
-#endif
-
-/**
- * Only allow SNMP write actions that are 'safe' (e.g. disabeling netifs is not
- * a safe action and disabled when SNMP_SAFE_REQUESTS = 1).
- * Unsafe requests are disabled by default!
- */
-#ifndef SNMP_SAFE_REQUESTS
-#define SNMP_SAFE_REQUESTS 1
-#endif
-
-/**
- * The maximum length of strings used. This affects the size of
- * MEMP_SNMP_VALUE elements.
- */
-#ifndef SNMP_MAX_OCTET_STRING_LEN
-#define SNMP_MAX_OCTET_STRING_LEN 127
-#endif
-
-/**
- * The maximum depth of the SNMP tree.
- * With private MIBs enabled, this depends on your MIB!
- * This affects the size of MEMP_SNMP_VALUE elements.
- */
-#ifndef SNMP_MAX_TREE_DEPTH
-#define SNMP_MAX_TREE_DEPTH 15
-#endif
-
-/**
- * The size of the MEMP_SNMP_VALUE elements, normally calculated from
- * SNMP_MAX_OCTET_STRING_LEN and SNMP_MAX_TREE_DEPTH.
- */
-#ifndef SNMP_MAX_VALUE_SIZE
-#define SNMP_MAX_VALUE_SIZE LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN)+1, sizeof(s32_t)*(SNMP_MAX_TREE_DEPTH))
-#endif
-
-/*
- ----------------------------------
- ---------- IGMP options ----------
- ----------------------------------
-*/
-/**
- * LWIP_IGMP==1: Turn on IGMP module.
- */
-#ifndef LWIP_IGMP
-#define LWIP_IGMP 0
-#endif
-
-/*
- ----------------------------------
- ---------- DNS options -----------
- ----------------------------------
-*/
-/**
- * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS
- * transport.
- */
-#ifndef LWIP_DNS
-#define LWIP_DNS 0
-#endif
-
-/** DNS maximum number of entries to maintain locally. */
-#ifndef DNS_TABLE_SIZE
-#define DNS_TABLE_SIZE 4
-#endif
-
-/** DNS maximum host name length supported in the name table. */
-#ifndef DNS_MAX_NAME_LENGTH
-#define DNS_MAX_NAME_LENGTH 256
-#endif
-
-/** The maximum of DNS servers */
-#ifndef DNS_MAX_SERVERS
-#define DNS_MAX_SERVERS 2
-#endif
-
-/** DNS do a name checking between the query and the response. */
-#ifndef DNS_DOES_NAME_CHECK
-#define DNS_DOES_NAME_CHECK 1
-#endif
-
-/** DNS message max. size. Default value is RFC compliant. */
-#ifndef DNS_MSG_SIZE
-#define DNS_MSG_SIZE 512
-#endif
-
-/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled,
- * you have to define
- * #define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}}
- * (an array of structs name/address, where address is an u32_t in network
- * byte order).
- *
- * Instead, you can also use an external function:
- * #define DNS_LOOKUP_LOCAL_EXTERN(x) extern u32_t my_lookup_function(const char *name)
- * that returns the IP address or INADDR_NONE if not found.
- */
-#ifndef DNS_LOCAL_HOSTLIST
-#define DNS_LOCAL_HOSTLIST 0
-#endif /* DNS_LOCAL_HOSTLIST */
-
-/** If this is turned on, the local host-list can be dynamically changed
- * at runtime. */
-#ifndef DNS_LOCAL_HOSTLIST_IS_DYNAMIC
-#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
-#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
-
-/*
- ---------------------------------
- ---------- UDP options ----------
- ---------------------------------
-*/
-/**
- * LWIP_UDP==1: Turn on UDP.
- */
-#ifndef LWIP_UDP
-#define LWIP_UDP 1
-#endif
-
-/**
- * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP)
- */
-#ifndef LWIP_UDPLITE
-#define LWIP_UDPLITE 0
-#endif
-
-/**
- * UDP_TTL: Default Time-To-Live value.
- */
-#ifndef UDP_TTL
-#define UDP_TTL (IP_DEFAULT_TTL)
-#endif
-
-/**
- * LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf.
- */
-#ifndef LWIP_NETBUF_RECVINFO
-#define LWIP_NETBUF_RECVINFO 0
-#endif
-
-/*
- ---------------------------------
- ---------- TCP options ----------
- ---------------------------------
-*/
-/**
- * LWIP_TCP==1: Turn on TCP.
- */
-#ifndef LWIP_TCP
-#define LWIP_TCP 1
-#endif
-
-/**
- * TCP_TTL: Default Time-To-Live value.
- */
-#ifndef TCP_TTL
-#define TCP_TTL (IP_DEFAULT_TTL)
-#endif
-
-/**
- * TCP_WND: The size of a TCP window. This must be at least
- * (2 * TCP_MSS) for things to work well
- */
-#ifndef TCP_WND
-#define TCP_WND (4 * TCP_MSS)
-#endif
-
-/**
- * TCP_MAXRTX: Maximum number of retransmissions of data segments.
- */
-#ifndef TCP_MAXRTX
-#define TCP_MAXRTX 12
-#endif
-
-/**
- * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments.
- */
-#ifndef TCP_SYNMAXRTX
-#define TCP_SYNMAXRTX 6
-#endif
-
-/**
- * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
- * Define to 0 if your device is low on memory.
- */
-#ifndef TCP_QUEUE_OOSEQ
-#define TCP_QUEUE_OOSEQ (LWIP_TCP)
-#endif
-
-/**
- * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
- * you might want to increase this.)
- * For the receive side, this MSS is advertised to the remote side
- * when opening a connection. For the transmit size, this MSS sets
- * an upper limit on the MSS advertised by the remote host.
- */
-#ifndef TCP_MSS
-#define TCP_MSS 536
-#endif
-
-/**
- * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really
- * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which
- * reflects the available reassembly buffer size at the remote host) and the
- * largest size permitted by the IP layer" (RFC 1122)
- * Setting this to 1 enables code that checks TCP_MSS against the MTU of the
- * netif used for a connection and limits the MSS if it would be too big otherwise.
- */
-#ifndef TCP_CALCULATE_EFF_SEND_MSS
-#define TCP_CALCULATE_EFF_SEND_MSS 1
-#endif
-
-
-/**
- * TCP_SND_BUF: TCP sender buffer space (bytes).
- */
-#ifndef TCP_SND_BUF
-#define TCP_SND_BUF 256
-#endif
-
-/**
- * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
- * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
- */
-#ifndef TCP_SND_QUEUELEN
-#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
-#endif
-
-/**
- * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than
- * TCP_SND_BUF. It is the amount of space which must be available in the
- * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT).
- */
-#ifndef TCP_SNDLOWAT
-#define TCP_SNDLOWAT ((TCP_SND_BUF)/2)
-#endif
-
-/**
- * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be grater
- * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below
- * this number, select returns writable (combined with TCP_SNDLOWAT).
- */
-#ifndef TCP_SNDQUEUELOWAT
-#define TCP_SNDQUEUELOWAT ((TCP_SND_QUEUELEN)/2)
-#endif
-
-/**
- * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
- */
-#ifndef TCP_LISTEN_BACKLOG
-#define TCP_LISTEN_BACKLOG 0
-#endif
-
-/**
- * The maximum allowed backlog for TCP listen netconns.
- * This backlog is used unless another is explicitly specified.
- * 0xff is the maximum (u8_t).
- */
-#ifndef TCP_DEFAULT_LISTEN_BACKLOG
-#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
-#endif
-
-/**
- * TCP_OVERSIZE: The maximum number of bytes that tcp_write may
- * allocate ahead of time in an attempt to create shorter pbuf chains
- * for transmission. The meaningful range is 0 to TCP_MSS. Some
- * suggested values are:
- *
- * 0: Disable oversized allocation. Each tcp_write() allocates a new
- pbuf (old behaviour).
- * 1: Allocate size-aligned pbufs with minimal excess. Use this if your
- * scatter-gather DMA requires aligned fragments.
- * 128: Limit the pbuf/memory overhead to 20%.
- * TCP_MSS: Try to create unfragmented TCP packets.
- * TCP_MSS/4: Try to create 4 fragments or less per TCP packet.
- */
-#ifndef TCP_OVERSIZE
-#define TCP_OVERSIZE TCP_MSS
-#endif
-
-/**
- * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option.
- */
-#ifndef LWIP_TCP_TIMESTAMPS
-#define LWIP_TCP_TIMESTAMPS 0
-#endif
-
-/**
- * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an
- * explicit window update
- */
-#ifndef TCP_WND_UPDATE_THRESHOLD
-#define TCP_WND_UPDATE_THRESHOLD (TCP_WND / 4)
-#endif
-
-/**
- * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1.
- * LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
- * events (accept, sent, etc) that happen in the system.
- * LWIP_CALLBACK_API==1: The PCB callback function is called directly
- * for the event.
- */
-//#ifndef LWIP_EVENT_API
-//#define LWIP_EVENT_API 0
-//#define LWIP_CALLBACK_API 1
-//#else
-//#define LWIP_EVENT_API 1
-//#define LWIP_CALLBACK_API 0
-//#endif
-
-
-/*
- ----------------------------------
- ---------- Pbuf options ----------
- ----------------------------------
-*/
-/**
- * PBUF_LINK_HLEN: the number of bytes that should be allocated for a
- * link level header. The default is 14, the standard value for
- * Ethernet.
- */
-#ifndef PBUF_LINK_HLEN
-#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
-#endif
-
-/**
- * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
- * designed to accomodate single full size TCP frame in one pbuf, including
- * TCP_MSS, IP header, and link header.
- */
-#ifndef PBUF_POOL_BUFSIZE
-#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
-#endif
-
-/*
- ------------------------------------------------
- ---------- Network Interfaces options ----------
- ------------------------------------------------
-*/
-/**
- * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname
- * field.
- */
-#ifndef LWIP_NETIF_HOSTNAME
-#define LWIP_NETIF_HOSTNAME 0
-#endif
-
-/**
- * LWIP_NETIF_API==1: Support netif api (in netifapi.c)
- */
-#ifndef LWIP_NETIF_API
-#define LWIP_NETIF_API 0
-#endif
-
-/**
- * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface
- * changes its up/down status (i.e., due to DHCP IP acquistion)
- */
-#ifndef LWIP_NETIF_STATUS_CALLBACK
-#define LWIP_NETIF_STATUS_CALLBACK 0
-#endif
-
-/**
- * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
- * whenever the link changes (i.e., link down)
- */
-#ifndef LWIP_NETIF_LINK_CALLBACK
-#define LWIP_NETIF_LINK_CALLBACK 0
-#endif
-
-/**
- * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table
- * indices) in struct netif. TCP and UDP can make use of this to prevent
- * scanning the ARP table for every sent packet. While this is faster for big
- * ARP tables or many concurrent connections, it might be counterproductive
- * if you have a tiny ARP table or if there never are concurrent connections.
- */
-#ifndef LWIP_NETIF_HWADDRHINT
-#define LWIP_NETIF_HWADDRHINT 0
-#endif
-
-/**
- * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
- * address equal to the netif IP address, looping them back up the stack.
- */
-#ifndef LWIP_NETIF_LOOPBACK
-#define LWIP_NETIF_LOOPBACK 1
-#endif
-
-/**
- * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback
- * sending for each netif (0 = disabled)
- */
-#ifndef LWIP_LOOPBACK_MAX_PBUFS
-#define LWIP_LOOPBACK_MAX_PBUFS 0
-#endif
-
-/**
- * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in
- * the system, as netifs must change how they behave depending on this setting
- * for the LWIP_NETIF_LOOPBACK option to work.
- * Setting this is needed to avoid reentering non-reentrant functions like
- * tcp_input().
- * LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a
- * multithreaded environment like tcpip.c. In this case, netif->input()
- * is called directly.
- * LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup.
- * The packets are put on a list and netif_poll() must be called in
- * the main application loop.
- */
-#ifndef LWIP_NETIF_LOOPBACK_MULTITHREADING
-#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS)
-#endif
-
-/**
- * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data
- * to be sent into one single pbuf. This is for compatibility with DMA-enabled
- * MACs that do not support scatter-gather.
- * Beware that this might involve CPU-memcpy before transmitting that would not
- * be needed without this flag! Use this only if you need to!
- *
- * @todo: TCP and IP-frag do not work with this, yet:
- */
-#ifndef LWIP_NETIF_TX_SINGLE_PBUF
-#define LWIP_NETIF_TX_SINGLE_PBUF 0
-#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
-
-/*
- ------------------------------------
- ---------- LOOPIF options ----------
- ------------------------------------
-*/
-/**
- * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
- */
-#ifndef LWIP_HAVE_LOOPIF
-#define LWIP_HAVE_LOOPIF 1
-#endif
-
-/*
- ------------------------------------
- ---------- SLIPIF options ----------
- ------------------------------------
-*/
-/**
- * LWIP_HAVE_SLIPIF==1: Support slip interface and slipif.c
- */
-#ifndef LWIP_HAVE_SLIPIF
-#define LWIP_HAVE_SLIPIF 0
-#endif
-
-/*
- ------------------------------------
- ---------- Thread options ----------
- ------------------------------------
-*/
-/**
- * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread.
- */
-#ifndef TCPIP_THREAD_NAME
-#define TCPIP_THREAD_NAME "tcpip_thread"
-#endif
-
-/**
- * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef TCPIP_THREAD_STACKSIZE
-#define TCPIP_THREAD_STACKSIZE 0
-#endif
-
-/**
- * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef TCPIP_THREAD_PRIO
-#define TCPIP_THREAD_PRIO 1
-#endif
-
-/**
- * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
- * The queue size value itself is platform-dependent, but is passed to
- * sys_mbox_new() when tcpip_init is called.
- */
-#ifndef TCPIP_MBOX_SIZE
-#define TCPIP_MBOX_SIZE 0
-#endif
-
-/**
- * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread.
- */
-#ifndef SLIPIF_THREAD_NAME
-#define SLIPIF_THREAD_NAME "slipif_loop"
-#endif
-
-/**
- * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef SLIPIF_THREAD_STACKSIZE
-#define SLIPIF_THREAD_STACKSIZE 0
-#endif
-
-/**
- * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef SLIPIF_THREAD_PRIO
-#define SLIPIF_THREAD_PRIO 1
-#endif
-
-/**
- * PPP_THREAD_NAME: The name assigned to the pppInputThread.
- */
-#ifndef PPP_THREAD_NAME
-#define PPP_THREAD_NAME "pppInputThread"
-#endif
-
-/**
- * PPP_THREAD_STACKSIZE: The stack size used by the pppInputThread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef PPP_THREAD_STACKSIZE
-#define PPP_THREAD_STACKSIZE 0
-#endif
-
-/**
- * PPP_THREAD_PRIO: The priority assigned to the pppInputThread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef PPP_THREAD_PRIO
-#define PPP_THREAD_PRIO 1
-#endif
-
-/**
- * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread.
- */
-#ifndef DEFAULT_THREAD_NAME
-#define DEFAULT_THREAD_NAME "lwIP"
-#endif
-
-/**
- * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
- * The stack size value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef DEFAULT_THREAD_STACKSIZE
-#define DEFAULT_THREAD_STACKSIZE 0
-#endif
-
-/**
- * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread.
- * The priority value itself is platform-dependent, but is passed to
- * sys_thread_new() when the thread is created.
- */
-#ifndef DEFAULT_THREAD_PRIO
-#define DEFAULT_THREAD_PRIO 1
-#endif
-
-/**
- * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
- * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
- * to sys_mbox_new() when the recvmbox is created.
- */
-#ifndef DEFAULT_RAW_RECVMBOX_SIZE
-#define DEFAULT_RAW_RECVMBOX_SIZE 0
-#endif
-
-/**
- * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
- * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
- * to sys_mbox_new() when the recvmbox is created.
- */
-#ifndef DEFAULT_UDP_RECVMBOX_SIZE
-#define DEFAULT_UDP_RECVMBOX_SIZE 0
-#endif
-
-/**
- * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
- * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
- * to sys_mbox_new() when the recvmbox is created.
- */
-#ifndef DEFAULT_TCP_RECVMBOX_SIZE
-#define DEFAULT_TCP_RECVMBOX_SIZE 0
-#endif
-
-/**
- * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
- * The queue size value itself is platform-dependent, but is passed to
- * sys_mbox_new() when the acceptmbox is created.
- */
-#ifndef DEFAULT_ACCEPTMBOX_SIZE
-#define DEFAULT_ACCEPTMBOX_SIZE 0
-#endif
-
-/*
- ----------------------------------------------
- ---------- Sequential layer options ----------
- ----------------------------------------------
-*/
-/**
- * LWIP_TCPIP_CORE_LOCKING: (EXPERIMENTAL!)
- * Don't use it if you're not an active lwIP project member
- */
-#ifndef LWIP_TCPIP_CORE_LOCKING
-#define LWIP_TCPIP_CORE_LOCKING 0
-#endif
-
-/**
- * LWIP_TCPIP_CORE_LOCKING_INPUT: (EXPERIMENTAL!)
- * Don't use it if you're not an active lwIP project member
- */
-#ifndef LWIP_TCPIP_CORE_LOCKING_INPUT
-#define LWIP_TCPIP_CORE_LOCKING_INPUT 0
-#endif
-
-/**
- * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
- */
-#ifndef LWIP_NETCONN
-#define LWIP_NETCONN 0
-#endif
-
-/** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout tod create
- * timers running in tcpip_thread from another thread.
- */
-#ifndef LWIP_TCPIP_TIMEOUT
-#define LWIP_TCPIP_TIMEOUT 1
-#endif
-
-/*
- ------------------------------------
- ---------- Socket options ----------
- ------------------------------------
-*/
-/**
- * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
- */
-#ifndef LWIP_SOCKET
-#define LWIP_SOCKET 0
-#endif
-
-/**
- * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
- * (only used if you use sockets.c)
- */
-#ifndef LWIP_COMPAT_SOCKETS
-#define LWIP_COMPAT_SOCKETS 1
-#endif
-
-/**
- * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names.
- * Disable this option if you use a POSIX operating system that uses the same
- * names (read, write & close). (only used if you use sockets.c)
- */
-#ifndef LWIP_POSIX_SOCKETS_IO_NAMES
-#define LWIP_POSIX_SOCKETS_IO_NAMES 1
-#endif
-
-/**
- * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT
- * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set
- * in seconds. (does not require sockets.c, and will affect tcp.c)
- */
-#ifndef LWIP_TCP_KEEPALIVE
-#define LWIP_TCP_KEEPALIVE 0
-#endif
-
-/**
- * LWIP_SO_RCVTIMEO==1: Enable SO_RCVTIMEO processing.
- */
-#ifndef LWIP_SO_RCVTIMEO
-#define LWIP_SO_RCVTIMEO 0
-#endif
-
-/**
- * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
- */
-#ifndef LWIP_SO_RCVBUF
-#define LWIP_SO_RCVBUF 0
-#endif
-
-/**
- * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize.
- */
-#ifndef RECV_BUFSIZE_DEFAULT
-#define RECV_BUFSIZE_DEFAULT INT_MAX
-#endif
-
-/**
- * SO_REUSE==1: Enable SO_REUSEADDR option.
- */
-#ifndef SO_REUSE
-#define SO_REUSE 0
-#endif
-
-/**
- * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets
- * to all local matches if SO_REUSEADDR is turned on.
- * WARNING: Adds a memcpy for every packet if passing to more than one pcb!
- */
-#ifndef SO_REUSE_RXTOALL
-#define SO_REUSE_RXTOALL 0
-#endif
-
-/*
- ----------------------------------------
- ---------- Statistics options ----------
- ----------------------------------------
-*/
-/**
- * LWIP_STATS==1: Enable statistics collection in lwip_stats.
- */
-#ifndef LWIP_STATS
-#define LWIP_STATS 1
-#endif
-
-#if LWIP_STATS
-
-/**
- * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions.
- */
-#ifndef LWIP_STATS_DISPLAY
-#define LWIP_STATS_DISPLAY 0
-#endif
-
-/**
- * LINK_STATS==1: Enable link stats.
- */
-#ifndef LINK_STATS
-#define LINK_STATS 1
-#endif
-
-/**
- * ETHARP_STATS==1: Enable etharp stats.
- */
-#ifndef ETHARP_STATS
-#define ETHARP_STATS (LWIP_ARP)
-#endif
-
-/**
- * IP_STATS==1: Enable IP stats.
- */
-#ifndef IP_STATS
-#define IP_STATS 1
-#endif
-
-/**
- * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is
- * on if using either frag or reass.
- */
-#ifndef IPFRAG_STATS
-#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG)
-#endif
-
-/**
- * ICMP_STATS==1: Enable ICMP stats.
- */
-#ifndef ICMP_STATS
-#define ICMP_STATS 1
-#endif
-
-/**
- * IGMP_STATS==1: Enable IGMP stats.
- */
-#ifndef IGMP_STATS
-#define IGMP_STATS (LWIP_IGMP)
-#endif
-
-/**
- * UDP_STATS==1: Enable UDP stats. Default is on if
- * UDP enabled, otherwise off.
- */
-#ifndef UDP_STATS
-#define UDP_STATS (LWIP_UDP)
-#endif
-
-/**
- * TCP_STATS==1: Enable TCP stats. Default is on if TCP
- * enabled, otherwise off.
- */
-#ifndef TCP_STATS
-#define TCP_STATS (LWIP_TCP)
-#endif
-
-/**
- * MEM_STATS==1: Enable mem.c stats.
- */
-#ifndef MEM_STATS
-#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0))
-#endif
-
-/**
- * MEMP_STATS==1: Enable memp.c pool stats.
- */
-#ifndef MEMP_STATS
-#define MEMP_STATS (MEMP_MEM_MALLOC == 0)
-#endif
-
-/**
- * SYS_STATS==1: Enable system stats (sem and mbox counts, etc).
- */
-#ifndef SYS_STATS
-#define SYS_STATS (NO_SYS == 0)
-#endif
-
-#else
-
-#define LINK_STATS 0
-#define IP_STATS 0
-#define IPFRAG_STATS 0
-#define ICMP_STATS 0
-#define IGMP_STATS 0
-#define UDP_STATS 0
-#define TCP_STATS 0
-#define MEM_STATS 0
-#define MEMP_STATS 0
-#define SYS_STATS 0
-#define LWIP_STATS_DISPLAY 0
-
-#endif /* LWIP_STATS */
-
-/*
- ---------------------------------
- ---------- PPP options ----------
- ---------------------------------
-*/
-/**
- * PPP_SUPPORT==1: Enable PPP.
- */
-#ifndef PPP_SUPPORT
-#define PPP_SUPPORT 0
-#endif
-
-/**
- * PPPOE_SUPPORT==1: Enable PPP Over Ethernet
- */
-#ifndef PPPOE_SUPPORT
-#define PPPOE_SUPPORT 0
-#endif
-
-/**
- * PPPOS_SUPPORT==1: Enable PPP Over Serial
- */
-#ifndef PPPOS_SUPPORT
-#define PPPOS_SUPPORT PPP_SUPPORT
-#endif
-
-#if PPP_SUPPORT
-
-/**
- * NUM_PPP: Max PPP sessions.
- */
-#ifndef NUM_PPP
-#define NUM_PPP 1
-#endif
-
-/**
- * PAP_SUPPORT==1: Support PAP.
- */
-#ifndef PAP_SUPPORT
-#define PAP_SUPPORT 0
-#endif
-
-/**
- * CHAP_SUPPORT==1: Support CHAP.
- */
-#ifndef CHAP_SUPPORT
-#define CHAP_SUPPORT 0
-#endif
-
-/**
- * MSCHAP_SUPPORT==1: Support MSCHAP. CURRENTLY NOT SUPPORTED! DO NOT SET!
- */
-#ifndef MSCHAP_SUPPORT
-#define MSCHAP_SUPPORT 0
-#endif
-
-/**
- * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET!
- */
-#ifndef CBCP_SUPPORT
-#define CBCP_SUPPORT 0
-#endif
-
-/**
- * CCP_SUPPORT==1: Support CCP. CURRENTLY NOT SUPPORTED! DO NOT SET!
- */
-#ifndef CCP_SUPPORT
-#define CCP_SUPPORT 0
-#endif
-
-/**
- * VJ_SUPPORT==1: Support VJ header compression.
- */
-#ifndef VJ_SUPPORT
-#define VJ_SUPPORT 0
-#endif
-
-/**
- * MD5_SUPPORT==1: Support MD5 (see also CHAP).
- */
-#ifndef MD5_SUPPORT
-#define MD5_SUPPORT 0
-#endif
-
-/*
- * Timeouts
- */
-#ifndef FSM_DEFTIMEOUT
-#define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */
-#endif
-
-#ifndef FSM_DEFMAXTERMREQS
-#define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
-#endif
-
-#ifndef FSM_DEFMAXCONFREQS
-#define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
-#endif
-
-#ifndef FSM_DEFMAXNAKLOOPS
-#define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
-#endif
-
-#ifndef UPAP_DEFTIMEOUT
-#define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */
-#endif
-
-#ifndef UPAP_DEFREQTIME
-#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
-#endif
-
-#ifndef CHAP_DEFTIMEOUT
-#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */
-#endif
-
-#ifndef CHAP_DEFTRANSMITS
-#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
-#endif
-
-/* Interval in seconds between keepalive echo requests, 0 to disable. */
-#ifndef LCP_ECHOINTERVAL
-#define LCP_ECHOINTERVAL 0
-#endif
-
-/* Number of unanswered echo requests before failure. */
-#ifndef LCP_MAXECHOFAILS
-#define LCP_MAXECHOFAILS 3
-#endif
-
-/* Max Xmit idle time (in jiffies) before resend flag char. */
-#ifndef PPP_MAXIDLEFLAG
-#define PPP_MAXIDLEFLAG 100
-#endif
-
-/*
- * Packet sizes
- *
- * Note - lcp shouldn't be allowed to negotiate stuff outside these
- * limits. See lcp.h in the pppd directory.
- * (XXX - these constants should simply be shared by lcp.c instead
- * of living in lcp.h)
- */
-#define PPP_MTU 1500 /* Default MTU (size of Info field) */
-#ifndef PPP_MAXMTU
-/* #define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN) */
-#define PPP_MAXMTU 1500 /* Largest MTU we allow */
-#endif
-#define PPP_MINMTU 64
-#define PPP_MRU 1500 /* default MRU = max length of info field */
-#define PPP_MAXMRU 1500 /* Largest MRU we allow */
-#ifndef PPP_DEFMRU
-#define PPP_DEFMRU 296 /* Try for this */
-#endif
-#define PPP_MINMRU 128 /* No MRUs below this */
-
-#ifndef MAXNAMELEN
-#define MAXNAMELEN 256 /* max length of hostname or name for auth */
-#endif
-#ifndef MAXSECRETLEN
-#define MAXSECRETLEN 256 /* max length of password or secret */
-#endif
-
-#endif /* PPP_SUPPORT */
-
-/*
- --------------------------------------
- ---------- Checksum options ----------
- --------------------------------------
-*/
-/**
- * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.
- */
-#ifndef CHECKSUM_GEN_IP
-#define CHECKSUM_GEN_IP 1
-#endif
-
-/**
- * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.
- */
-#ifndef CHECKSUM_GEN_UDP
-#define CHECKSUM_GEN_UDP 1
-#endif
-
-/**
- * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.
- */
-#ifndef CHECKSUM_GEN_TCP
-#define CHECKSUM_GEN_TCP 1
-#endif
-
-/**
- * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.
- */
-#ifndef CHECKSUM_CHECK_IP
-#define CHECKSUM_CHECK_IP 1
-#endif
-
-/**
- * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.
- */
-#ifndef CHECKSUM_CHECK_UDP
-#define CHECKSUM_CHECK_UDP 1
-#endif
-
-/**
- * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.
- */
-#ifndef CHECKSUM_CHECK_TCP
-#define CHECKSUM_CHECK_TCP 1
-#endif
-
-/**
- * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from
- * application buffers to pbufs.
- */
-#ifndef LWIP_CHECKSUM_ON_COPY
-#define LWIP_CHECKSUM_ON_COPY 0
-#endif
-
-/*
- ---------------------------------------
- ---------- Debugging options ----------
- ---------------------------------------
-*/
-/**
- * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is
- * compared against this value. If it is smaller, then debugging
- * messages are written.
- */
-#ifndef LWIP_DBG_MIN_LEVEL
-#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
-#endif
-
-/**
- * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable
- * debug messages of certain types.
- */
-#ifndef LWIP_DBG_TYPES_ON
-#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
-#endif
-
-/**
- * ETHARP_DEBUG: Enable debugging in etharp.c.
- */
-#ifndef ETHARP_DEBUG
-#define ETHARP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * NETIF_DEBUG: Enable debugging in netif.c.
- */
-#ifndef NETIF_DEBUG
-#define NETIF_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * PBUF_DEBUG: Enable debugging in pbuf.c.
- */
-#ifndef PBUF_DEBUG
-#define PBUF_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * API_LIB_DEBUG: Enable debugging in api_lib.c.
- */
-#ifndef API_LIB_DEBUG
-#define API_LIB_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * API_MSG_DEBUG: Enable debugging in api_msg.c.
- */
-#ifndef API_MSG_DEBUG
-#define API_MSG_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SOCKETS_DEBUG: Enable debugging in sockets.c.
- */
-#ifndef SOCKETS_DEBUG
-#define SOCKETS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * ICMP_DEBUG: Enable debugging in icmp.c.
- */
-#ifndef ICMP_DEBUG
-#define ICMP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * IGMP_DEBUG: Enable debugging in igmp.c.
- */
-#ifndef IGMP_DEBUG
-#define IGMP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * INET_DEBUG: Enable debugging in inet.c.
- */
-#ifndef INET_DEBUG
-#define INET_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * IP_DEBUG: Enable debugging for IP.
- */
-#ifndef IP_DEBUG
-#define IP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass.
- */
-#ifndef IP_REASS_DEBUG
-#define IP_REASS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * RAW_DEBUG: Enable debugging in raw.c.
- */
-#ifndef RAW_DEBUG
-#define RAW_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * MEM_DEBUG: Enable debugging in mem.c.
- */
-#ifndef MEM_DEBUG
-#define MEM_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * MEMP_DEBUG: Enable debugging in memp.c.
- */
-#ifndef MEMP_DEBUG
-#define MEMP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SYS_DEBUG: Enable debugging in sys.c.
- */
-#ifndef SYS_DEBUG
-#define SYS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TIMERS_DEBUG: Enable debugging in timers.c.
- */
-#ifndef TIMERS_DEBUG
-#define TIMERS_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_DEBUG: Enable debugging for TCP.
- */
-#ifndef TCP_DEBUG
-#define TCP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug.
- */
-#ifndef TCP_INPUT_DEBUG
-#define TCP_INPUT_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit.
- */
-#ifndef TCP_FR_DEBUG
-#define TCP_FR_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit
- * timeout.
- */
-#ifndef TCP_RTO_DEBUG
-#define TCP_RTO_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_CWND_DEBUG: Enable debugging for TCP congestion window.
- */
-#ifndef TCP_CWND_DEBUG
-#define TCP_CWND_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating.
- */
-#ifndef TCP_WND_DEBUG
-#define TCP_WND_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions.
- */
-#ifndef TCP_OUTPUT_DEBUG
-#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_RST_DEBUG: Enable debugging for TCP with the RST message.
- */
-#ifndef TCP_RST_DEBUG
-#define TCP_RST_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths.
- */
-#ifndef TCP_QLEN_DEBUG
-#define TCP_QLEN_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * UDP_DEBUG: Enable debugging in UDP.
- */
-#ifndef UDP_DEBUG
-#define UDP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * TCPIP_DEBUG: Enable debugging in tcpip.c.
- */
-#ifndef TCPIP_DEBUG
-#define TCPIP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * PPP_DEBUG: Enable debugging for PPP.
- */
-#ifndef PPP_DEBUG
-#define PPP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SLIP_DEBUG: Enable debugging in slipif.c.
- */
-#ifndef SLIP_DEBUG
-#define SLIP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * DHCP_DEBUG: Enable debugging in dhcp.c.
- */
-#ifndef DHCP_DEBUG
-#define DHCP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * AUTOIP_DEBUG: Enable debugging in autoip.c.
- */
-#ifndef AUTOIP_DEBUG
-#define AUTOIP_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SNMP_MSG_DEBUG: Enable debugging for SNMP messages.
- */
-#ifndef SNMP_MSG_DEBUG
-#define SNMP_MSG_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs.
- */
-#ifndef SNMP_MIB_DEBUG
-#define SNMP_MIB_DEBUG LWIP_DBG_OFF
-#endif
-
-/**
- * DNS_DEBUG: Enable debugging for DNS.
- */
-#ifndef DNS_DEBUG
-#define DNS_DEBUG LWIP_DBG_OFF
-#endif
-
-#endif /* __LWIP_OPT_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/pbuf.h b/sparkfun/esp8266/firmwares/loader/src/lwip/pbuf.h
deleted file mode 100644
index 3d24db4d..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/pbuf.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-
-#ifndef __LWIP_PBUF_H__
-#define __LWIP_PBUF_H__
-
-#include "lwip/opt.h"
-#include "lwip/err.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Currently, the pbuf_custom code is only needed for one specific configuration
- * of IP_FRAG */
-#define LWIP_SUPPORT_CUSTOM_PBUF (IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF)
-
-#define PBUF_TRANSPORT_HLEN 20
-#define PBUF_IP_HLEN 20
-
-typedef enum {
- PBUF_TRANSPORT,
- PBUF_IP,
- PBUF_LINK,
- PBUF_RAW
-} pbuf_layer;
-
-typedef enum {
- PBUF_RAM, /* pbuf data is stored in RAM */
- PBUF_ROM, /* pbuf data is stored in ROM */
- PBUF_REF, /* pbuf comes from the pbuf pool */
- PBUF_POOL, /* pbuf payload refers to RAM */
-#ifdef EBUF_LWIP
- PBUF_ESF_RX /* pbuf payload is from WLAN */
-#endif /* ESF_LWIP */
-} pbuf_type;
-
-
-/** indicates this packet's data should be immediately passed to the application */
-#define PBUF_FLAG_PUSH 0x01U
-/** indicates this is a custom pbuf: pbuf_free and pbuf_header handle such a
- a pbuf differently */
-#define PBUF_FLAG_IS_CUSTOM 0x02U
-/** indicates this pbuf is UDP multicast to be looped back */
-#define PBUF_FLAG_MCASTLOOP 0x04U
-
-struct pbuf {
- /** next pbuf in singly linked pbuf chain */
- struct pbuf *next;
-
- /** pointer to the actual data in the buffer */
- void *payload;
-
- /**
- * total length of this buffer and all next buffers in chain
- * belonging to the same packet.
- *
- * For non-queue packet chains this is the invariant:
- * p->tot_len == p->len + (p->next? p->next->tot_len: 0)
- */
- u16_t tot_len;
-
- /** length of this buffer */
- u16_t len;
-
- /** pbuf_type as u8_t instead of enum to save space */
- u8_t /*pbuf_type*/ type;
-
- /** misc flags */
- u8_t flags;
-
- /**
- * the reference count always equals the number of pointers
- * that refer to this pbuf. This can be pointers from an application,
- * the stack itself, or pbuf->next pointers from a chain.
- */
- u16_t ref;
-
- /* add a pointer for esf_buf */
- void * eb;
-};
-
-#if LWIP_SUPPORT_CUSTOM_PBUF
-/** Prototype for a function to free a custom pbuf */
-typedef void (*pbuf_free_custom_fn)(struct pbuf *p);
-
-/** A custom pbuf: like a pbuf, but following a function pointer to free it. */
-struct pbuf_custom {
- /** The actual pbuf */
- struct pbuf pbuf;
- /** This function is called when pbuf_free deallocates this pbuf(_custom) */
- pbuf_free_custom_fn custom_free_function;
-};
-#endif /* LWIP_SUPPORT_CUSTOM_PBUF */
-
-/* Initializes the pbuf module. This call is empty for now, but may not be in future. */
-#define pbuf_init()
-
-struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type)ICACHE_FLASH_ATTR;
-#if LWIP_SUPPORT_CUSTOM_PBUF
-struct pbuf *pbuf_alloced_custom(pbuf_layer l, u16_t length, pbuf_type type,
- struct pbuf_custom *p, void *payload_mem,
- u16_t payload_mem_len)ICACHE_FLASH_ATTR;
-#endif /* LWIP_SUPPORT_CUSTOM_PBUF */
-void pbuf_realloc(struct pbuf *p, u16_t size)ICACHE_FLASH_ATTR;
-u8_t pbuf_header(struct pbuf *p, s16_t header_size)ICACHE_FLASH_ATTR;
-void pbuf_ref(struct pbuf *p)ICACHE_FLASH_ATTR;
-u8_t pbuf_free(struct pbuf *p)ICACHE_FLASH_ATTR;
-u8_t pbuf_clen(struct pbuf *p)ICACHE_FLASH_ATTR;
-void pbuf_cat(struct pbuf *head, struct pbuf *tail)ICACHE_FLASH_ATTR;
-void pbuf_chain(struct pbuf *head, struct pbuf *tail)ICACHE_FLASH_ATTR;
-struct pbuf *pbuf_dechain(struct pbuf *p)ICACHE_FLASH_ATTR;
-err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from)ICACHE_FLASH_ATTR;
-u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset)ICACHE_FLASH_ATTR;
-err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)ICACHE_FLASH_ATTR;
-struct pbuf *pbuf_coalesce(struct pbuf *p, pbuf_layer layer)ICACHE_FLASH_ATTR;
-#if LWIP_CHECKSUM_ON_COPY
-err_t pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr,
- u16_t len, u16_t *chksum)ICACHE_FLASH_ATTR;
-#endif /* LWIP_CHECKSUM_ON_COPY */
-
-u8_t pbuf_get_at(struct pbuf* p, u16_t offset)ICACHE_FLASH_ATTR;
-u16_t pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n)ICACHE_FLASH_ATTR;
-u16_t pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset)ICACHE_FLASH_ATTR;
-u16_t pbuf_strstr(struct pbuf* p, const char* substr)ICACHE_FLASH_ATTR;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_PBUF_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/raw.h b/sparkfun/esp8266/firmwares/loader/src/lwip/raw.h
deleted file mode 100644
index c9c40871..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/raw.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_RAW_H__
-#define __LWIP_RAW_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/pbuf.h"
-#include "lwip/def.h"
-#include "lwip/ip.h"
-#include "lwip/ip_addr.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct raw_pcb;
-
-/** Function prototype for raw pcb receive callback functions.
- * @param arg user supplied argument (raw_pcb.recv_arg)
- * @param pcb the raw_pcb which received data
- * @param p the packet buffer that was received
- * @param addr the remote IP address from which the packet was received
- * @return 1 if the packet was 'eaten' (aka. deleted),
- * 0 if the packet lives on
- * If returning 1, the callback is responsible for freeing the pbuf
- * if it's not used any more.
- */
-typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
- ip_addr_t *addr);
-
-struct raw_pcb {
- /* Common members of all PCB types */
- IP_PCB;
-
- struct raw_pcb *next;
-
- u8_t protocol;
-
- /** receive callback function */
- raw_recv_fn recv;
- /* user-supplied argument for the recv callback */
- void *recv_arg;
-};
-
-/* The following functions is the application layer interface to the
- RAW code. */
-struct raw_pcb * raw_new (u8_t proto)ICACHE_FLASH_ATTR;
-void raw_remove (struct raw_pcb *pcb)ICACHE_FLASH_ATTR;
-err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr)ICACHE_FLASH_ATTR;
-err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr)ICACHE_FLASH_ATTR;
-
-void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg)ICACHE_FLASH_ATTR;
-err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)ICACHE_FLASH_ATTR;
-err_t raw_send (struct raw_pcb *pcb, struct pbuf *p);
-
-/* The following functions are the lower layer interface to RAW. */
-u8_t raw_input (struct pbuf *p, struct netif *inp)ICACHE_FLASH_ATTR;
-#define raw_init() /* Compatibility define, not init needed. */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_RAW */
-
-#endif /* __LWIP_RAW_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/sio.h b/sparkfun/esp8266/firmwares/loader/src/lwip/sio.h
deleted file mode 100644
index 228c8577..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/sio.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- */
-
-/*
- * This is the interface to the platform specific serial IO module
- * It needs to be implemented by those platforms which need SLIP or PPP
- */
-
-#ifndef __SIO_H__
-#define __SIO_H__
-
-#include "lwip/arch.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* If you want to define sio_fd_t elsewhere or differently,
- define this in your cc.h file. */
-#ifndef __sio_fd_t_defined
-typedef void * sio_fd_t;
-#endif
-
-/* The following functions can be defined to something else in your cc.h file
- or be implemented in your custom sio.c file. */
-
-#ifndef sio_open
-/**
- * Opens a serial device for communication.
- *
- * @param devnum device number
- * @return handle to serial device if successful, NULL otherwise
- */
-sio_fd_t sio_open(u8_t devnum)ICACHE_FLASH_ATTR;
-#endif
-
-#ifndef sio_send
-/**
- * Sends a single character to the serial device.
- *
- * @param c character to send
- * @param fd serial device handle
- *
- * @note This function will block until the character can be sent.
- */
-void sio_send(u8_t c, sio_fd_t fd)ICACHE_FLASH_ATTR;
-#endif
-
-#ifndef sio_recv
-/**
- * Receives a single character from the serial device.
- *
- * @param fd serial device handle
- *
- * @note This function will block until a character is received.
- */
-u8_t sio_recv(sio_fd_t fd)ICACHE_FLASH_ATTR;
-#endif
-
-#ifndef sio_read
-/**
- * Reads from the serial device.
- *
- * @param fd serial device handle
- * @param data pointer to data buffer for receiving
- * @param len maximum length (in bytes) of data to receive
- * @return number of bytes actually received - may be 0 if aborted by sio_read_abort
- *
- * @note This function will block until data can be received. The blocking
- * can be cancelled by calling sio_read_abort().
- */
-u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
-#endif
-
-#ifndef sio_tryread
-/**
- * Tries to read from the serial device. Same as sio_read but returns
- * immediately if no data is available and never blocks.
- *
- * @param fd serial device handle
- * @param data pointer to data buffer for receiving
- * @param len maximum length (in bytes) of data to receive
- * @return number of bytes actually received
- */
-u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
-#endif
-
-#ifndef sio_write
-/**
- * Writes to the serial device.
- *
- * @param fd serial device handle
- * @param data pointer to data to send
- * @param len length (in bytes) of data to send
- * @return number of bytes actually sent
- *
- * @note This function will block until all data can be sent.
- */
-u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len)ICACHE_FLASH_ATTR;
-#endif
-
-#ifndef sio_read_abort
-/**
- * Aborts a blocking sio_read() call.
- *
- * @param fd serial device handle
- */
-void sio_read_abort(sio_fd_t fd)ICACHE_FLASH_ATTR;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SIO_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/snmp.h
deleted file mode 100644
index 2ed043dd..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp.h
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2001, 2002 Leon Woestenberg
- * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Leon Woestenberg
- *
- */
-#ifndef __LWIP_SNMP_H__
-#define __LWIP_SNMP_H__
-
-#include "lwip/opt.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "lwip/ip_addr.h"
-
-struct udp_pcb;
-struct netif;
-
-/**
- * @see RFC1213, "MIB-II, 6. Definitions"
- */
-enum snmp_ifType {
- snmp_ifType_other=1, /* none of the following */
- snmp_ifType_regular1822,
- snmp_ifType_hdh1822,
- snmp_ifType_ddn_x25,
- snmp_ifType_rfc877_x25,
- snmp_ifType_ethernet_csmacd,
- snmp_ifType_iso88023_csmacd,
- snmp_ifType_iso88024_tokenBus,
- snmp_ifType_iso88025_tokenRing,
- snmp_ifType_iso88026_man,
- snmp_ifType_starLan,
- snmp_ifType_proteon_10Mbit,
- snmp_ifType_proteon_80Mbit,
- snmp_ifType_hyperchannel,
- snmp_ifType_fddi,
- snmp_ifType_lapb,
- snmp_ifType_sdlc,
- snmp_ifType_ds1, /* T-1 */
- snmp_ifType_e1, /* european equiv. of T-1 */
- snmp_ifType_basicISDN,
- snmp_ifType_primaryISDN, /* proprietary serial */
- snmp_ifType_propPointToPointSerial,
- snmp_ifType_ppp,
- snmp_ifType_softwareLoopback,
- snmp_ifType_eon, /* CLNP over IP [11] */
- snmp_ifType_ethernet_3Mbit,
- snmp_ifType_nsip, /* XNS over IP */
- snmp_ifType_slip, /* generic SLIP */
- snmp_ifType_ultra, /* ULTRA technologies */
- snmp_ifType_ds3, /* T-3 */
- snmp_ifType_sip, /* SMDS */
- snmp_ifType_frame_relay
-};
-
-#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
-
-/** SNMP "sysuptime" Interval */
-#define SNMP_SYSUPTIME_INTERVAL 10
-
-/** fixed maximum length for object identifier type */
-#define LWIP_SNMP_OBJ_ID_LEN 32
-
-/** internal object identifier representation */
-struct snmp_obj_id
-{
- u8_t len;
- s32_t id[LWIP_SNMP_OBJ_ID_LEN];
-};
-
-/* system */
-void snmp_set_sysdesr(u8_t* str, u8_t* len);
-void snmp_set_sysobjid(struct snmp_obj_id *oid);
-void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid);
-void snmp_inc_sysuptime(void);
-void snmp_add_sysuptime(u32_t value);
-void snmp_get_sysuptime(u32_t *value);
-void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen);
-void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen);
-void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen);
-
-/* network interface */
-void snmp_add_ifinoctets(struct netif *ni, u32_t value);
-void snmp_inc_ifinucastpkts(struct netif *ni);
-void snmp_inc_ifinnucastpkts(struct netif *ni);
-void snmp_inc_ifindiscards(struct netif *ni);
-void snmp_add_ifoutoctets(struct netif *ni, u32_t value);
-void snmp_inc_ifoutucastpkts(struct netif *ni);
-void snmp_inc_ifoutnucastpkts(struct netif *ni);
-void snmp_inc_ifoutdiscards(struct netif *ni);
-void snmp_inc_iflist(void);
-void snmp_dec_iflist(void);
-
-/* ARP (for atTable and ipNetToMediaTable) */
-void snmp_insert_arpidx_tree(struct netif *ni, ip_addr_t *ip);
-void snmp_delete_arpidx_tree(struct netif *ni, ip_addr_t *ip);
-
-/* IP */
-void snmp_inc_ipinreceives(void);
-void snmp_inc_ipinhdrerrors(void);
-void snmp_inc_ipinaddrerrors(void);
-void snmp_inc_ipforwdatagrams(void);
-void snmp_inc_ipinunknownprotos(void);
-void snmp_inc_ipindiscards(void);
-void snmp_inc_ipindelivers(void);
-void snmp_inc_ipoutrequests(void);
-void snmp_inc_ipoutdiscards(void);
-void snmp_inc_ipoutnoroutes(void);
-void snmp_inc_ipreasmreqds(void);
-void snmp_inc_ipreasmoks(void);
-void snmp_inc_ipreasmfails(void);
-void snmp_inc_ipfragoks(void);
-void snmp_inc_ipfragfails(void);
-void snmp_inc_ipfragcreates(void);
-void snmp_inc_iproutingdiscards(void);
-void snmp_insert_ipaddridx_tree(struct netif *ni);
-void snmp_delete_ipaddridx_tree(struct netif *ni);
-void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni);
-void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni);
-
-/* ICMP */
-void snmp_inc_icmpinmsgs(void);
-void snmp_inc_icmpinerrors(void);
-void snmp_inc_icmpindestunreachs(void);
-void snmp_inc_icmpintimeexcds(void);
-void snmp_inc_icmpinparmprobs(void);
-void snmp_inc_icmpinsrcquenchs(void);
-void snmp_inc_icmpinredirects(void);
-void snmp_inc_icmpinechos(void);
-void snmp_inc_icmpinechoreps(void);
-void snmp_inc_icmpintimestamps(void);
-void snmp_inc_icmpintimestampreps(void);
-void snmp_inc_icmpinaddrmasks(void);
-void snmp_inc_icmpinaddrmaskreps(void);
-void snmp_inc_icmpoutmsgs(void);
-void snmp_inc_icmpouterrors(void);
-void snmp_inc_icmpoutdestunreachs(void);
-void snmp_inc_icmpouttimeexcds(void);
-void snmp_inc_icmpoutparmprobs(void);
-void snmp_inc_icmpoutsrcquenchs(void);
-void snmp_inc_icmpoutredirects(void);
-void snmp_inc_icmpoutechos(void);
-void snmp_inc_icmpoutechoreps(void);
-void snmp_inc_icmpouttimestamps(void);
-void snmp_inc_icmpouttimestampreps(void);
-void snmp_inc_icmpoutaddrmasks(void);
-void snmp_inc_icmpoutaddrmaskreps(void);
-
-/* TCP */
-void snmp_inc_tcpactiveopens(void);
-void snmp_inc_tcppassiveopens(void);
-void snmp_inc_tcpattemptfails(void);
-void snmp_inc_tcpestabresets(void);
-void snmp_inc_tcpinsegs(void);
-void snmp_inc_tcpoutsegs(void);
-void snmp_inc_tcpretranssegs(void);
-void snmp_inc_tcpinerrs(void);
-void snmp_inc_tcpoutrsts(void);
-
-/* UDP */
-void snmp_inc_udpindatagrams(void);
-void snmp_inc_udpnoports(void);
-void snmp_inc_udpinerrors(void);
-void snmp_inc_udpoutdatagrams(void);
-void snmp_insert_udpidx_tree(struct udp_pcb *pcb);
-void snmp_delete_udpidx_tree(struct udp_pcb *pcb);
-
-/* SNMP */
-void snmp_inc_snmpinpkts(void);
-void snmp_inc_snmpoutpkts(void);
-void snmp_inc_snmpinbadversions(void);
-void snmp_inc_snmpinbadcommunitynames(void);
-void snmp_inc_snmpinbadcommunityuses(void);
-void snmp_inc_snmpinasnparseerrs(void);
-void snmp_inc_snmpintoobigs(void);
-void snmp_inc_snmpinnosuchnames(void);
-void snmp_inc_snmpinbadvalues(void);
-void snmp_inc_snmpinreadonlys(void);
-void snmp_inc_snmpingenerrs(void);
-void snmp_add_snmpintotalreqvars(u8_t value);
-void snmp_add_snmpintotalsetvars(u8_t value);
-void snmp_inc_snmpingetrequests(void);
-void snmp_inc_snmpingetnexts(void);
-void snmp_inc_snmpinsetrequests(void);
-void snmp_inc_snmpingetresponses(void);
-void snmp_inc_snmpintraps(void);
-void snmp_inc_snmpouttoobigs(void);
-void snmp_inc_snmpoutnosuchnames(void);
-void snmp_inc_snmpoutbadvalues(void);
-void snmp_inc_snmpoutgenerrs(void);
-void snmp_inc_snmpoutgetrequests(void);
-void snmp_inc_snmpoutgetnexts(void);
-void snmp_inc_snmpoutsetrequests(void);
-void snmp_inc_snmpoutgetresponses(void);
-void snmp_inc_snmpouttraps(void);
-void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
-void snmp_set_snmpenableauthentraps(u8_t *value);
-void snmp_get_snmpenableauthentraps(u8_t *value);
-
-/* LWIP_SNMP support not available */
-/* define everything to be empty */
-#else
-
-/* system */
-#define snmp_set_sysdesr(str, len)
-#define snmp_set_sysobjid(oid);
-#define snmp_get_sysobjid_ptr(oid)
-#define snmp_inc_sysuptime()
-#define snmp_add_sysuptime(value)
-#define snmp_get_sysuptime(value)
-#define snmp_set_syscontact(ocstr, ocstrlen);
-#define snmp_set_sysname(ocstr, ocstrlen);
-#define snmp_set_syslocation(ocstr, ocstrlen);
-
-/* network interface */
-#define snmp_add_ifinoctets(ni,value)
-#define snmp_inc_ifinucastpkts(ni)
-#define snmp_inc_ifinnucastpkts(ni)
-#define snmp_inc_ifindiscards(ni)
-#define snmp_add_ifoutoctets(ni,value)
-#define snmp_inc_ifoutucastpkts(ni)
-#define snmp_inc_ifoutnucastpkts(ni)
-#define snmp_inc_ifoutdiscards(ni)
-#define snmp_inc_iflist()
-#define snmp_dec_iflist()
-
-/* ARP */
-#define snmp_insert_arpidx_tree(ni,ip)
-#define snmp_delete_arpidx_tree(ni,ip)
-
-/* IP */
-#define snmp_inc_ipinreceives()
-#define snmp_inc_ipinhdrerrors()
-#define snmp_inc_ipinaddrerrors()
-#define snmp_inc_ipforwdatagrams()
-#define snmp_inc_ipinunknownprotos()
-#define snmp_inc_ipindiscards()
-#define snmp_inc_ipindelivers()
-#define snmp_inc_ipoutrequests()
-#define snmp_inc_ipoutdiscards()
-#define snmp_inc_ipoutnoroutes()
-#define snmp_inc_ipreasmreqds()
-#define snmp_inc_ipreasmoks()
-#define snmp_inc_ipreasmfails()
-#define snmp_inc_ipfragoks()
-#define snmp_inc_ipfragfails()
-#define snmp_inc_ipfragcreates()
-#define snmp_inc_iproutingdiscards()
-#define snmp_insert_ipaddridx_tree(ni)
-#define snmp_delete_ipaddridx_tree(ni)
-#define snmp_insert_iprteidx_tree(dflt, ni)
-#define snmp_delete_iprteidx_tree(dflt, ni)
-
-/* ICMP */
-#define snmp_inc_icmpinmsgs()
-#define snmp_inc_icmpinerrors()
-#define snmp_inc_icmpindestunreachs()
-#define snmp_inc_icmpintimeexcds()
-#define snmp_inc_icmpinparmprobs()
-#define snmp_inc_icmpinsrcquenchs()
-#define snmp_inc_icmpinredirects()
-#define snmp_inc_icmpinechos()
-#define snmp_inc_icmpinechoreps()
-#define snmp_inc_icmpintimestamps()
-#define snmp_inc_icmpintimestampreps()
-#define snmp_inc_icmpinaddrmasks()
-#define snmp_inc_icmpinaddrmaskreps()
-#define snmp_inc_icmpoutmsgs()
-#define snmp_inc_icmpouterrors()
-#define snmp_inc_icmpoutdestunreachs()
-#define snmp_inc_icmpouttimeexcds()
-#define snmp_inc_icmpoutparmprobs()
-#define snmp_inc_icmpoutsrcquenchs()
-#define snmp_inc_icmpoutredirects()
-#define snmp_inc_icmpoutechos()
-#define snmp_inc_icmpoutechoreps()
-#define snmp_inc_icmpouttimestamps()
-#define snmp_inc_icmpouttimestampreps()
-#define snmp_inc_icmpoutaddrmasks()
-#define snmp_inc_icmpoutaddrmaskreps()
-/* TCP */
-#define snmp_inc_tcpactiveopens()
-#define snmp_inc_tcppassiveopens()
-#define snmp_inc_tcpattemptfails()
-#define snmp_inc_tcpestabresets()
-#define snmp_inc_tcpinsegs()
-#define snmp_inc_tcpoutsegs()
-#define snmp_inc_tcpretranssegs()
-#define snmp_inc_tcpinerrs()
-#define snmp_inc_tcpoutrsts()
-
-/* UDP */
-#define snmp_inc_udpindatagrams()
-#define snmp_inc_udpnoports()
-#define snmp_inc_udpinerrors()
-#define snmp_inc_udpoutdatagrams()
-#define snmp_insert_udpidx_tree(pcb)
-#define snmp_delete_udpidx_tree(pcb)
-
-/* SNMP */
-#define snmp_inc_snmpinpkts()
-#define snmp_inc_snmpoutpkts()
-#define snmp_inc_snmpinbadversions()
-#define snmp_inc_snmpinbadcommunitynames()
-#define snmp_inc_snmpinbadcommunityuses()
-#define snmp_inc_snmpinasnparseerrs()
-#define snmp_inc_snmpintoobigs()
-#define snmp_inc_snmpinnosuchnames()
-#define snmp_inc_snmpinbadvalues()
-#define snmp_inc_snmpinreadonlys()
-#define snmp_inc_snmpingenerrs()
-#define snmp_add_snmpintotalreqvars(value)
-#define snmp_add_snmpintotalsetvars(value)
-#define snmp_inc_snmpingetrequests()
-#define snmp_inc_snmpingetnexts()
-#define snmp_inc_snmpinsetrequests()
-#define snmp_inc_snmpingetresponses()
-#define snmp_inc_snmpintraps()
-#define snmp_inc_snmpouttoobigs()
-#define snmp_inc_snmpoutnosuchnames()
-#define snmp_inc_snmpoutbadvalues()
-#define snmp_inc_snmpoutgenerrs()
-#define snmp_inc_snmpoutgetrequests()
-#define snmp_inc_snmpoutgetnexts()
-#define snmp_inc_snmpoutsetrequests()
-#define snmp_inc_snmpoutgetresponses()
-#define snmp_inc_snmpouttraps()
-#define snmp_get_snmpgrpid_ptr(oid)
-#define snmp_set_snmpenableauthentraps(value)
-#define snmp_get_snmpenableauthentraps(value)
-
-#endif /* LWIP_SNMP */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_SNMP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_asn1.h b/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_asn1.h
deleted file mode 100644
index 605fa3f1..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_asn1.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * @file
- * Abstract Syntax Notation One (ISO 8824, 8825) codec.
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons
- */
-
-#ifndef __LWIP_SNMP_ASN1_H__
-#define __LWIP_SNMP_ASN1_H__
-
-#include "lwip/opt.h"
-#include "lwip/err.h"
-#include "lwip/pbuf.h"
-#include "lwip/snmp.h"
-
-#if LWIP_SNMP
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SNMP_ASN1_UNIV (0) /* (!0x80 | !0x40) */
-#define SNMP_ASN1_APPLIC (0x40) /* (!0x80 | 0x40) */
-#define SNMP_ASN1_CONTXT (0x80) /* ( 0x80 | !0x40) */
-
-#define SNMP_ASN1_CONSTR (0x20) /* ( 0x20) */
-#define SNMP_ASN1_PRIMIT (0) /* (!0x20) */
-
-/* universal tags */
-#define SNMP_ASN1_INTEG 2
-#define SNMP_ASN1_OC_STR 4
-#define SNMP_ASN1_NUL 5
-#define SNMP_ASN1_OBJ_ID 6
-#define SNMP_ASN1_SEQ 16
-
-/* application specific (SNMP) tags */
-#define SNMP_ASN1_IPADDR 0 /* octet string size(4) */
-#define SNMP_ASN1_COUNTER 1 /* u32_t */
-#define SNMP_ASN1_GAUGE 2 /* u32_t */
-#define SNMP_ASN1_TIMETICKS 3 /* u32_t */
-#define SNMP_ASN1_OPAQUE 4 /* octet string */
-
-/* context specific (SNMP) tags */
-#define SNMP_ASN1_PDU_GET_REQ 0
-#define SNMP_ASN1_PDU_GET_NEXT_REQ 1
-#define SNMP_ASN1_PDU_GET_RESP 2
-#define SNMP_ASN1_PDU_SET_REQ 3
-#define SNMP_ASN1_PDU_TRAP 4
-
-err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type);
-err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length);
-err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value);
-err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value);
-err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid);
-err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw);
-
-void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed);
-void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed);
-void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed);
-void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed);
-err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type);
-err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length);
-err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value);
-err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value);
-err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident);
-err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_SNMP */
-
-#endif /* __LWIP_SNMP_ASN1_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_msg.h b/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_msg.h
deleted file mode 100644
index 1183e3a9..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_msg.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/**
- * @file
- * SNMP Agent message handling structures.
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons
- */
-
-#ifndef __LWIP_SNMP_MSG_H__
-#define __LWIP_SNMP_MSG_H__
-
-#include "lwip/opt.h"
-#include "lwip/snmp.h"
-#include "lwip/snmp_structs.h"
-#include "lwip/ip_addr.h"
-#include "lwip/err.h"
-
-#if LWIP_SNMP
-
-#if SNMP_PRIVATE_MIB
-/* When using a private MIB, you have to create a file 'private_mib.h' that contains
- * a 'struct mib_array_node mib_private' which contains your MIB. */
-#include "private_mib.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The listen port of the SNMP agent. Clients have to make their requests to
- this port. Most standard clients won't work if you change this! */
-#ifndef SNMP_IN_PORT
-#define SNMP_IN_PORT 161
-#endif
-/* The remote port the SNMP agent sends traps to. Most standard trap sinks won't
- work if you change this! */
-#ifndef SNMP_TRAP_PORT
-#define SNMP_TRAP_PORT 162
-#endif
-
-#define SNMP_ES_NOERROR 0
-#define SNMP_ES_TOOBIG 1
-#define SNMP_ES_NOSUCHNAME 2
-#define SNMP_ES_BADVALUE 3
-#define SNMP_ES_READONLY 4
-#define SNMP_ES_GENERROR 5
-
-#define SNMP_GENTRAP_COLDSTART 0
-#define SNMP_GENTRAP_WARMSTART 1
-#define SNMP_GENTRAP_AUTHFAIL 4
-#define SNMP_GENTRAP_ENTERPRISESPC 6
-
-struct snmp_varbind
-{
- /* next pointer, NULL for last in list */
- struct snmp_varbind *next;
- /* previous pointer, NULL for first in list */
- struct snmp_varbind *prev;
-
- /* object identifier length (in s32_t) */
- u8_t ident_len;
- /* object identifier array */
- s32_t *ident;
-
- /* object value ASN1 type */
- u8_t value_type;
- /* object value length (in u8_t) */
- u8_t value_len;
- /* object value */
- void *value;
-
- /* encoding varbind seq length length */
- u8_t seqlenlen;
- /* encoding object identifier length length */
- u8_t olenlen;
- /* encoding object value length length */
- u8_t vlenlen;
- /* encoding varbind seq length */
- u16_t seqlen;
- /* encoding object identifier length */
- u16_t olen;
- /* encoding object value length */
- u16_t vlen;
-};
-
-struct snmp_varbind_root
-{
- struct snmp_varbind *head;
- struct snmp_varbind *tail;
- /* number of variable bindings in list */
- u8_t count;
- /* encoding varbind-list seq length length */
- u8_t seqlenlen;
- /* encoding varbind-list seq length */
- u16_t seqlen;
-};
-
-/** output response message header length fields */
-struct snmp_resp_header_lengths
-{
- /* encoding error-index length length */
- u8_t erridxlenlen;
- /* encoding error-status length length */
- u8_t errstatlenlen;
- /* encoding request id length length */
- u8_t ridlenlen;
- /* encoding pdu length length */
- u8_t pdulenlen;
- /* encoding community length length */
- u8_t comlenlen;
- /* encoding version length length */
- u8_t verlenlen;
- /* encoding sequence length length */
- u8_t seqlenlen;
-
- /* encoding error-index length */
- u16_t erridxlen;
- /* encoding error-status length */
- u16_t errstatlen;
- /* encoding request id length */
- u16_t ridlen;
- /* encoding pdu length */
- u16_t pdulen;
- /* encoding community length */
- u16_t comlen;
- /* encoding version length */
- u16_t verlen;
- /* encoding sequence length */
- u16_t seqlen;
-};
-
-/** output response message header length fields */
-struct snmp_trap_header_lengths
-{
- /* encoding timestamp length length */
- u8_t tslenlen;
- /* encoding specific-trap length length */
- u8_t strplenlen;
- /* encoding generic-trap length length */
- u8_t gtrplenlen;
- /* encoding agent-addr length length */
- u8_t aaddrlenlen;
- /* encoding enterprise-id length length */
- u8_t eidlenlen;
- /* encoding pdu length length */
- u8_t pdulenlen;
- /* encoding community length length */
- u8_t comlenlen;
- /* encoding version length length */
- u8_t verlenlen;
- /* encoding sequence length length */
- u8_t seqlenlen;
-
- /* encoding timestamp length */
- u16_t tslen;
- /* encoding specific-trap length */
- u16_t strplen;
- /* encoding generic-trap length */
- u16_t gtrplen;
- /* encoding agent-addr length */
- u16_t aaddrlen;
- /* encoding enterprise-id length */
- u16_t eidlen;
- /* encoding pdu length */
- u16_t pdulen;
- /* encoding community length */
- u16_t comlen;
- /* encoding version length */
- u16_t verlen;
- /* encoding sequence length */
- u16_t seqlen;
-};
-
-/* Accepting new SNMP messages. */
-#define SNMP_MSG_EMPTY 0
-/* Search for matching object for variable binding. */
-#define SNMP_MSG_SEARCH_OBJ 1
-/* Perform SNMP operation on in-memory object.
- Pass-through states, for symmetry only. */
-#define SNMP_MSG_INTERNAL_GET_OBJDEF 2
-#define SNMP_MSG_INTERNAL_GET_VALUE 3
-#define SNMP_MSG_INTERNAL_SET_TEST 4
-#define SNMP_MSG_INTERNAL_GET_OBJDEF_S 5
-#define SNMP_MSG_INTERNAL_SET_VALUE 6
-/* Perform SNMP operation on object located externally.
- In theory this could be used for building a proxy agent.
- Practical use is for an enterprise spc. app. gateway. */
-#define SNMP_MSG_EXTERNAL_GET_OBJDEF 7
-#define SNMP_MSG_EXTERNAL_GET_VALUE 8
-#define SNMP_MSG_EXTERNAL_SET_TEST 9
-#define SNMP_MSG_EXTERNAL_GET_OBJDEF_S 10
-#define SNMP_MSG_EXTERNAL_SET_VALUE 11
-
-#define SNMP_COMMUNITY_STR_LEN 64
-struct snmp_msg_pstat
-{
- /* lwIP local port (161) binding */
- struct udp_pcb *pcb;
- /* source IP address */
- ip_addr_t sip;
- /* source UDP port */
- u16_t sp;
- /* request type */
- u8_t rt;
- /* request ID */
- s32_t rid;
- /* error status */
- s32_t error_status;
- /* error index */
- s32_t error_index;
- /* community name (zero terminated) */
- u8_t community[SNMP_COMMUNITY_STR_LEN + 1];
- /* community string length (exclusive zero term) */
- u8_t com_strlen;
- /* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */
- u8_t state;
- /* saved arguments for MSG_EXTERNAL_x */
- struct mib_external_node *ext_mib_node;
- struct snmp_name_ptr ext_name_ptr;
- struct obj_def ext_object_def;
- struct snmp_obj_id ext_oid;
- /* index into input variable binding list */
- u8_t vb_idx;
- /* ptr into input variable binding list */
- struct snmp_varbind *vb_ptr;
- /* list of variable bindings from input */
- struct snmp_varbind_root invb;
- /* list of variable bindings to output */
- struct snmp_varbind_root outvb;
- /* output response lengths used in ASN encoding */
- struct snmp_resp_header_lengths rhl;
-};
-
-struct snmp_msg_trap
-{
- /* lwIP local port (161) binding */
- struct udp_pcb *pcb;
- /* destination IP address in network order */
- ip_addr_t dip;
-
- /* source enterprise ID (sysObjectID) */
- struct snmp_obj_id *enterprise;
- /* source IP address, raw network order format */
- u8_t sip_raw[4];
- /* generic trap code */
- u32_t gen_trap;
- /* specific trap code */
- u32_t spc_trap;
- /* timestamp */
- u32_t ts;
- /* list of variable bindings to output */
- struct snmp_varbind_root outvb;
- /* output trap lengths used in ASN encoding */
- struct snmp_trap_header_lengths thl;
-};
-
-/** Agent Version constant, 0 = v1 oddity */
-extern const s32_t snmp_version;
-/** Agent default "public" community string */
-extern const char snmp_publiccommunity[7];
-
-extern struct snmp_msg_trap trap_msg;
-
-/** Agent setup, start listening to port 161. */
-void snmp_init(void);
-void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
-void snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst);
-
-/** Varbind-list functions. */
-struct snmp_varbind* snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len);
-void snmp_varbind_free(struct snmp_varbind *vb);
-void snmp_varbind_list_free(struct snmp_varbind_root *root);
-void snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb);
-struct snmp_varbind* snmp_varbind_tail_remove(struct snmp_varbind_root *root);
-
-/** Handle an internal (recv) or external (private response) event. */
-void snmp_msg_event(u8_t request_id);
-err_t snmp_send_response(struct snmp_msg_pstat *m_stat);
-err_t snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap);
-void snmp_coldstart_trap(void);
-void snmp_authfail_trap(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_SNMP */
-
-#endif /* __LWIP_SNMP_MSG_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_structs.h b/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_structs.h
deleted file mode 100644
index 0d3b46a9..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/snmp_structs.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/**
- * @file
- * Generic MIB tree structures.
- *
- * @todo namespace prefixes
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons
- */
-
-#ifndef __LWIP_SNMP_STRUCTS_H__
-#define __LWIP_SNMP_STRUCTS_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/snmp.h"
-
-#if SNMP_PRIVATE_MIB
-/* When using a private MIB, you have to create a file 'private_mib.h' that contains
- * a 'struct mib_array_node mib_private' which contains your MIB. */
-#include "private_mib.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* MIB object instance */
-#define MIB_OBJECT_NONE 0
-#define MIB_OBJECT_SCALAR 1
-#define MIB_OBJECT_TAB 2
-
-/* MIB access types */
-#define MIB_ACCESS_READ 1
-#define MIB_ACCESS_WRITE 2
-
-/* MIB object access */
-#define MIB_OBJECT_READ_ONLY MIB_ACCESS_READ
-#define MIB_OBJECT_READ_WRITE (MIB_ACCESS_READ | MIB_ACCESS_WRITE)
-#define MIB_OBJECT_WRITE_ONLY MIB_ACCESS_WRITE
-#define MIB_OBJECT_NOT_ACCESSIBLE 0
-
-/** object definition returned by (get_object_def)() */
-struct obj_def
-{
- /* MIB_OBJECT_NONE (0), MIB_OBJECT_SCALAR (1), MIB_OBJECT_TAB (2) */
- u8_t instance;
- /* 0 read-only, 1 read-write, 2 write-only, 3 not-accessible */
- u8_t access;
- /* ASN type for this object */
- u8_t asn_type;
- /* value length (host length) */
- u16_t v_len;
- /* length of instance part of supplied object identifier */
- u8_t id_inst_len;
- /* instance part of supplied object identifier */
- s32_t *id_inst_ptr;
-};
-
-struct snmp_name_ptr
-{
- u8_t ident_len;
- s32_t *ident;
-};
-
-/** MIB const scalar (.0) node */
-#define MIB_NODE_SC 0x01
-/** MIB const array node */
-#define MIB_NODE_AR 0x02
-/** MIB array node (mem_malloced from RAM) */
-#define MIB_NODE_RA 0x03
-/** MIB list root node (mem_malloced from RAM) */
-#define MIB_NODE_LR 0x04
-/** MIB node for external objects */
-#define MIB_NODE_EX 0x05
-
-/** node "base class" layout, the mandatory fields for a node */
-struct mib_node
-{
- /** returns struct obj_def for the given object identifier */
- void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
- /** returns object value for the given object identifier,
- @note the caller must allocate at least len bytes for the value */
- void (*get_value)(struct obj_def *od, u16_t len, void *value);
- /** tests length and/or range BEFORE setting */
- u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
- /** sets object value, only to be called when set_test() */
- void (*set_value)(struct obj_def *od, u16_t len, void *value);
- /** One out of MIB_NODE_AR, MIB_NODE_LR or MIB_NODE_EX */
- u8_t node_type;
- /* array or max list length */
- u16_t maxlength;
-};
-
-/** derived node for scalars .0 index */
-typedef struct mib_node mib_scalar_node;
-
-/** derived node, points to a fixed size const array
- of sub-identifiers plus a 'child' pointer */
-struct mib_array_node
-{
- /* inherited "base class" members */
- void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
- void (*get_value)(struct obj_def *od, u16_t len, void *value);
- u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
- void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
- u8_t node_type;
- u16_t maxlength;
-
- /* additional struct members */
- const s32_t *objid;
- struct mib_node* const *nptr;
-};
-
-/** derived node, points to a fixed size mem_malloced array
- of sub-identifiers plus a 'child' pointer */
-struct mib_ram_array_node
-{
- /* inherited "base class" members */
- void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
- void (*get_value)(struct obj_def *od, u16_t len, void *value);
- u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
- void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
- u8_t node_type;
- u16_t maxlength;
-
- /* aditional struct members */
- s32_t *objid;
- struct mib_node **nptr;
-};
-
-struct mib_list_node
-{
- struct mib_list_node *prev;
- struct mib_list_node *next;
- s32_t objid;
- struct mib_node *nptr;
-};
-
-/** derived node, points to a doubly linked list
- of sub-identifiers plus a 'child' pointer */
-struct mib_list_rootnode
-{
- /* inherited "base class" members */
- void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
- void (*get_value)(struct obj_def *od, u16_t len, void *value);
- u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
- void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
- u8_t node_type;
- u16_t maxlength;
-
- /* additional struct members */
- struct mib_list_node *head;
- struct mib_list_node *tail;
- /* counts list nodes in list */
- u16_t count;
-};
-
-/** derived node, has access functions for mib object in external memory or device
- using 'tree_level' and 'idx', with a range 0 .. (level_length() - 1) */
-struct mib_external_node
-{
- /* inherited "base class" members */
- void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
- void (*get_value)(struct obj_def *od, u16_t len, void *value);
- u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
- void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
- u8_t node_type;
- u16_t maxlength;
-
- /* additional struct members */
- /** points to an external (in memory) record of some sort of addressing
- information, passed to and interpreted by the funtions below */
- void* addr_inf;
- /** tree levels under this node */
- u8_t tree_levels;
- /** number of objects at this level */
- u16_t (*level_length)(void* addr_inf, u8_t level);
- /** compares object sub identifier with external id
- return zero when equal, nonzero when unequal */
- s32_t (*ident_cmp)(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id);
- void (*get_objid)(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id);
-
- /** async Questions */
- void (*get_object_def_q)(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident);
- void (*get_value_q)(u8_t rid, struct obj_def *od);
- void (*set_test_q)(u8_t rid, struct obj_def *od);
- void (*set_value_q)(u8_t rid, struct obj_def *od, u16_t len, void *value);
- /** async Answers */
- void (*get_object_def_a)(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od);
- void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
- u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
- void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
- /** async Panic Close (agent returns error reply,
- e.g. used for external transaction cleanup) */
- void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
- void (*get_value_pc)(u8_t rid, struct obj_def *od);
- void (*set_test_pc)(u8_t rid, struct obj_def *od);
- void (*set_value_pc)(u8_t rid, struct obj_def *od);
-};
-
-/** export MIB tree from mib2.c */
-extern const struct mib_array_node internet;
-
-/** dummy function pointers for non-leaf MIB nodes from mib2.c */
-void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
-u8_t noleafs_set_test(struct obj_def *od, u16_t len, void *value);
-void noleafs_set_value(struct obj_def *od, u16_t len, void *value);
-
-void snmp_oidtoip(s32_t *ident, ip_addr_t *ip);
-void snmp_iptooid(ip_addr_t *ip, s32_t *ident);
-void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
-void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
-
-struct mib_list_node* snmp_mib_ln_alloc(s32_t id);
-void snmp_mib_ln_free(struct mib_list_node *ln);
-struct mib_list_rootnode* snmp_mib_lrn_alloc(void);
-void snmp_mib_lrn_free(struct mib_list_rootnode *lrn);
-
-s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn);
-s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn);
-struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n);
-
-struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np);
-struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
-u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
-u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_SNMP */
-
-#endif /* __LWIP_SNMP_STRUCTS_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/sockets.h b/sparkfun/esp8266/firmwares/loader/src/lwip/sockets.h
deleted file mode 100644
index 3c8fed24..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/sockets.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-
-
-#ifndef __LWIP_SOCKETS_H__
-#define __LWIP_SOCKETS_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
-
-#include /* for size_t */
-
-#include "lwip/ip_addr.h"
-#include "lwip/inet.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* members are in network byte order */
-struct sockaddr_in {
- u8_t sin_len;
- u8_t sin_family;
- u16_t sin_port;
- struct in_addr sin_addr;
- char sin_zero[8];
-};
-
-struct sockaddr {
- u8_t sa_len;
- u8_t sa_family;
- char sa_data[14];
-};
-
-#ifndef socklen_t
-# define socklen_t u32_t
-#endif
-
-/* Socket protocol types (TCP/UDP/RAW) */
-#define SOCK_STREAM 1
-#define SOCK_DGRAM 2
-#define SOCK_RAW 3
-
-/*
- * Option flags per-socket. These must match the SOF_ flags in ip.h (checked in init.c)
- */
-#define SO_DEBUG 0x0001 /* Unimplemented: turn on debugging info recording */
-#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
-#define SO_REUSEADDR 0x0004 /* Allow local address reuse */
-#define SO_KEEPALIVE 0x0008 /* keep connections alive */
-#define SO_DONTROUTE 0x0010 /* Unimplemented: just use interface addresses */
-#define SO_BROADCAST 0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
-#define SO_USELOOPBACK 0x0040 /* Unimplemented: bypass hardware when possible */
-#define SO_LINGER 0x0080 /* linger on close if data present */
-#define SO_OOBINLINE 0x0100 /* Unimplemented: leave received OOB data in line */
-#define SO_REUSEPORT 0x0200 /* Unimplemented: allow local address & port reuse */
-
-#define SO_DONTLINGER ((int)(~SO_LINGER))
-
-/*
- * Additional options, not kept in so_options.
- */
-#define SO_SNDBUF 0x1001 /* Unimplemented: send buffer size */
-#define SO_RCVBUF 0x1002 /* receive buffer size */
-#define SO_SNDLOWAT 0x1003 /* Unimplemented: send low-water mark */
-#define SO_RCVLOWAT 0x1004 /* Unimplemented: receive low-water mark */
-#define SO_SNDTIMEO 0x1005 /* Unimplemented: send timeout */
-#define SO_RCVTIMEO 0x1006 /* receive timeout */
-#define SO_ERROR 0x1007 /* get error status and clear */
-#define SO_TYPE 0x1008 /* get socket type */
-#define SO_CONTIMEO 0x1009 /* Unimplemented: connect timeout */
-#define SO_NO_CHECK 0x100a /* don't create UDP checksum */
-
-
-/*
- * Structure used for manipulating linger option.
- */
-struct linger {
- int l_onoff; /* option on/off */
- int l_linger; /* linger time */
-};
-
-/*
- * Level number for (get/set)sockopt() to apply to socket itself.
- */
-#define SOL_SOCKET 0xfff /* options for socket level */
-
-
-#define AF_UNSPEC 0
-#define AF_INET 2
-#define PF_INET AF_INET
-#define PF_UNSPEC AF_UNSPEC
-
-#define IPPROTO_IP 0
-#define IPPROTO_TCP 6
-#define IPPROTO_UDP 17
-#define IPPROTO_UDPLITE 136
-
-/* Flags we can use with send and recv. */
-#define MSG_PEEK 0x01 /* Peeks at an incoming message */
-#define MSG_WAITALL 0x02 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */
-#define MSG_OOB 0x04 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */
-#define MSG_DONTWAIT 0x08 /* Nonblocking i/o for this operation only */
-#define MSG_MORE 0x10 /* Sender will send more */
-
-
-/*
- * Options for level IPPROTO_IP
- */
-#define IP_TOS 1
-#define IP_TTL 2
-
-#if LWIP_TCP
-/*
- * Options for level IPPROTO_TCP
- */
-#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
-#define TCP_KEEPALIVE 0x02 /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */
-#define TCP_KEEPIDLE 0x03 /* set pcb->keep_idle - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */
-#define TCP_KEEPINTVL 0x04 /* set pcb->keep_intvl - Use seconds for get/setsockopt */
-#define TCP_KEEPCNT 0x05 /* set pcb->keep_cnt - Use number of probes sent for get/setsockopt */
-#endif /* LWIP_TCP */
-
-#if LWIP_UDP && LWIP_UDPLITE
-/*
- * Options for level IPPROTO_UDPLITE
- */
-#define UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */
-#define UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */
-#endif /* LWIP_UDP && LWIP_UDPLITE*/
-
-
-#if LWIP_IGMP
-/*
- * Options and types for UDP multicast traffic handling
- */
-#define IP_ADD_MEMBERSHIP 3
-#define IP_DROP_MEMBERSHIP 4
-#define IP_MULTICAST_TTL 5
-#define IP_MULTICAST_IF 6
-#define IP_MULTICAST_LOOP 7
-
-typedef struct ip_mreq {
- struct in_addr imr_multiaddr; /* IP multicast address of group */
- struct in_addr imr_interface; /* local IP address of interface */
-} ip_mreq;
-#endif /* LWIP_IGMP */
-
-/*
- * The Type of Service provides an indication of the abstract
- * parameters of the quality of service desired. These parameters are
- * to be used to guide the selection of the actual service parameters
- * when transmitting a datagram through a particular network. Several
- * networks offer service precedence, which somehow treats high
- * precedence traffic as more important than other traffic (generally
- * by accepting only traffic above a certain precedence at time of high
- * load). The major choice is a three way tradeoff between low-delay,
- * high-reliability, and high-throughput.
- * The use of the Delay, Throughput, and Reliability indications may
- * increase the cost (in some sense) of the service. In many networks
- * better performance for one of these parameters is coupled with worse
- * performance on another. Except for very unusual cases at most two
- * of these three indications should be set.
- */
-#define IPTOS_TOS_MASK 0x1E
-#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
-#define IPTOS_LOWDELAY 0x10
-#define IPTOS_THROUGHPUT 0x08
-#define IPTOS_RELIABILITY 0x04
-#define IPTOS_LOWCOST 0x02
-#define IPTOS_MINCOST IPTOS_LOWCOST
-
-/*
- * The Network Control precedence designation is intended to be used
- * within a network only. The actual use and control of that
- * designation is up to each network. The Internetwork Control
- * designation is intended for use by gateway control originators only.
- * If the actual use of these precedence designations is of concern to
- * a particular network, it is the responsibility of that network to
- * control the access to, and use of, those precedence designations.
- */
-#define IPTOS_PREC_MASK 0xe0
-#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
-#define IPTOS_PREC_NETCONTROL 0xe0
-#define IPTOS_PREC_INTERNETCONTROL 0xc0
-#define IPTOS_PREC_CRITIC_ECP 0xa0
-#define IPTOS_PREC_FLASHOVERRIDE 0x80
-#define IPTOS_PREC_FLASH 0x60
-#define IPTOS_PREC_IMMEDIATE 0x40
-#define IPTOS_PREC_PRIORITY 0x20
-#define IPTOS_PREC_ROUTINE 0x00
-
-
-/*
- * Commands for ioctlsocket(), taken from the BSD file fcntl.h.
- * lwip_ioctl only supports FIONREAD and FIONBIO, for now
- *
- * Ioctl's have the command encoded in the lower word,
- * and the size of any in or out parameters in the upper
- * word. The high 2 bits of the upper word are used
- * to encode the in/out status of the parameter; for now
- * we restrict parameters to at most 128 bytes.
- */
-#if !defined(FIONREAD) || !defined(FIONBIO)
-#define IOCPARM_MASK 0x7fU /* parameters must be < 128 bytes */
-#define IOC_VOID 0x20000000UL /* no parameters */
-#define IOC_OUT 0x40000000UL /* copy out parameters */
-#define IOC_IN 0x80000000UL /* copy in parameters */
-#define IOC_INOUT (IOC_IN|IOC_OUT)
- /* 0x20000000 distinguishes new &
- old ioctl's */
-#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
-
-#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
-
-#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
-#endif /* !defined(FIONREAD) || !defined(FIONBIO) */
-
-#ifndef FIONREAD
-#define FIONREAD _IOR('f', 127, unsigned long) /* get # bytes to read */
-#endif
-#ifndef FIONBIO
-#define FIONBIO _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */
-#endif
-
-/* Socket I/O Controls: unimplemented */
-#ifndef SIOCSHIWAT
-#define SIOCSHIWAT _IOW('s', 0, unsigned long) /* set high watermark */
-#define SIOCGHIWAT _IOR('s', 1, unsigned long) /* get high watermark */
-#define SIOCSLOWAT _IOW('s', 2, unsigned long) /* set low watermark */
-#define SIOCGLOWAT _IOR('s', 3, unsigned long) /* get low watermark */
-#define SIOCATMARK _IOR('s', 7, unsigned long) /* at oob mark? */
-#endif
-
-/* commands for fnctl */
-#ifndef F_GETFL
-#define F_GETFL 3
-#endif
-#ifndef F_SETFL
-#define F_SETFL 4
-#endif
-
-/* File status flags and file access modes for fnctl,
- these are bits in an int. */
-#ifndef O_NONBLOCK
-#define O_NONBLOCK 1 /* nonblocking I/O */
-#endif
-#ifndef O_NDELAY
-#define O_NDELAY 1 /* same as O_NONBLOCK, for compatibility */
-#endif
-
-#ifndef SHUT_RD
- #define SHUT_RD 0
- #define SHUT_WR 1
- #define SHUT_RDWR 2
-#endif
-
-/* FD_SET used for lwip_select */
-#ifndef FD_SET
- #undef FD_SETSIZE
- /* Make FD_SETSIZE match NUM_SOCKETS in socket.c */
- #define FD_SETSIZE MEMP_NUM_NETCONN
- #define FD_SET(n, p) ((p)->fd_bits[(n)/8] |= (1 << ((n) & 7)))
- #define FD_CLR(n, p) ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))
- #define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] & (1 << ((n) & 7)))
- #define FD_ZERO(p) memset((void*)(p),0,sizeof(*(p)))
-
- typedef struct fd_set {
- unsigned char fd_bits [(FD_SETSIZE+7)/8];
- } fd_set;
-
-#endif /* FD_SET */
-
-/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
- * by your system, set this to 0 and include in cc.h */
-#ifndef LWIP_TIMEVAL_PRIVATE
-#define LWIP_TIMEVAL_PRIVATE 1
-#endif
-
-#if LWIP_TIMEVAL_PRIVATE
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif /* LWIP_TIMEVAL_PRIVATE */
-
-void lwip_socket_init(void);
-
-int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
-int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen);
-int lwip_shutdown(int s, int how);
-int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen);
-int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen);
-int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
-int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
-int lwip_close(int s);
-int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen);
-int lwip_listen(int s, int backlog);
-int lwip_recv(int s, void *mem, size_t len, int flags);
-int lwip_read(int s, void *mem, size_t len);
-int lwip_recvfrom(int s, void *mem, size_t len, int flags,
- struct sockaddr *from, socklen_t *fromlen);
-int lwip_send(int s, const void *dataptr, size_t size, int flags);
-int lwip_sendto(int s, const void *dataptr, size_t size, int flags,
- const struct sockaddr *to, socklen_t tolen);
-int lwip_socket(int domain, int type, int protocol);
-int lwip_write(int s, const void *dataptr, size_t size);
-int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
- struct timeval *timeout);
-int lwip_ioctl(int s, long cmd, void *argp);
-int lwip_fcntl(int s, int cmd, int val);
-
-#if LWIP_COMPAT_SOCKETS
-#define accept(a,b,c) lwip_accept(a,b,c)
-#define bind(a,b,c) lwip_bind(a,b,c)
-#define shutdown(a,b) lwip_shutdown(a,b)
-#define closesocket(s) lwip_close(s)
-#define connect(a,b,c) lwip_connect(a,b,c)
-#define getsockname(a,b,c) lwip_getsockname(a,b,c)
-#define getpeername(a,b,c) lwip_getpeername(a,b,c)
-#define setsockopt(a,b,c,d,e) lwip_setsockopt(a,b,c,d,e)
-#define getsockopt(a,b,c,d,e) lwip_getsockopt(a,b,c,d,e)
-#define listen(a,b) lwip_listen(a,b)
-#define recv(a,b,c,d) lwip_recv(a,b,c,d)
-#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f)
-#define send(a,b,c,d) lwip_send(a,b,c,d)
-#define sendto(a,b,c,d,e,f) lwip_sendto(a,b,c,d,e,f)
-#define socket(a,b,c) lwip_socket(a,b,c)
-#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
-#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
-
-#if LWIP_POSIX_SOCKETS_IO_NAMES
-#define read(a,b,c) lwip_read(a,b,c)
-#define write(a,b,c) lwip_write(a,b,c)
-#define close(s) lwip_close(s)
-#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
-
-#endif /* LWIP_COMPAT_SOCKETS */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_SOCKET */
-
-#endif /* __LWIP_SOCKETS_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/stats.h b/sparkfun/esp8266/firmwares/loader/src/lwip/stats.h
deleted file mode 100644
index 43883217..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/stats.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_STATS_H__
-#define __LWIP_STATS_H__
-
-#include "lwip/opt.h"
-
-#include "lwip/mem.h"
-#include "lwip/memp.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if LWIP_STATS
-
-#ifndef LWIP_STATS_LARGE
-#define LWIP_STATS_LARGE 0
-#endif
-
-#if LWIP_STATS_LARGE
-#define STAT_COUNTER u32_t
-#define STAT_COUNTER_F U32_F
-#else
-#define STAT_COUNTER u16_t
-#define STAT_COUNTER_F U16_F
-#endif
-
-struct stats_proto {
- STAT_COUNTER xmit; /* Transmitted packets. */
- STAT_COUNTER recv; /* Received packets. */
- STAT_COUNTER fw; /* Forwarded packets. */
- STAT_COUNTER drop; /* Dropped packets. */
- STAT_COUNTER chkerr; /* Checksum error. */
- STAT_COUNTER lenerr; /* Invalid length error. */
- STAT_COUNTER memerr; /* Out of memory error. */
- STAT_COUNTER rterr; /* Routing error. */
- STAT_COUNTER proterr; /* Protocol error. */
- STAT_COUNTER opterr; /* Error in options. */
- STAT_COUNTER err; /* Misc error. */
- STAT_COUNTER cachehit;
-};
-
-struct stats_igmp {
- STAT_COUNTER xmit; /* Transmitted packets. */
- STAT_COUNTER recv; /* Received packets. */
- STAT_COUNTER drop; /* Dropped packets. */
- STAT_COUNTER chkerr; /* Checksum error. */
- STAT_COUNTER lenerr; /* Invalid length error. */
- STAT_COUNTER memerr; /* Out of memory error. */
- STAT_COUNTER proterr; /* Protocol error. */
- STAT_COUNTER rx_v1; /* Received v1 frames. */
- STAT_COUNTER rx_group; /* Received group-specific queries. */
- STAT_COUNTER rx_general; /* Received general queries. */
- STAT_COUNTER rx_report; /* Received reports. */
- STAT_COUNTER tx_join; /* Sent joins. */
- STAT_COUNTER tx_leave; /* Sent leaves. */
- STAT_COUNTER tx_report; /* Sent reports. */
-};
-
-struct stats_mem {
-#ifdef LWIP_DEBUG
- const char *name;
-#endif /* LWIP_DEBUG */
- mem_size_t avail;
- mem_size_t used;
- mem_size_t max;
- STAT_COUNTER err;
- STAT_COUNTER illegal;
-};
-
-struct stats_syselem {
- STAT_COUNTER used;
- STAT_COUNTER max;
- STAT_COUNTER err;
-};
-
-struct stats_sys {
- struct stats_syselem sem;
- struct stats_syselem mutex;
- struct stats_syselem mbox;
-};
-
-struct stats_ {
-#if LINK_STATS
- struct stats_proto link;
-#endif
-#if ETHARP_STATS
- struct stats_proto etharp;
-#endif
-#if IPFRAG_STATS
- struct stats_proto ip_frag;
-#endif
-#if IP_STATS
- struct stats_proto ip;
-#endif
-#if ICMP_STATS
- struct stats_proto icmp;
-#endif
-#if IGMP_STATS
- struct stats_igmp igmp;
-#endif
-#if UDP_STATS
- struct stats_proto udp;
-#endif
-#if TCP_STATS
- struct stats_proto tcp;
-#endif
-#if MEM_STATS
- struct stats_mem mem;
-#endif
-#if MEMP_STATS
- struct stats_mem memp[MEMP_MAX];
-#endif
-#if SYS_STATS
- struct stats_sys sys;
-#endif
-};
-
-extern struct stats_ lwip_stats;
-
-void stats_init(void)ICACHE_FLASH_ATTR;
-
-#define STATS_INC(x) ++lwip_stats.x
-#define STATS_DEC(x) --lwip_stats.x
-#define STATS_INC_USED(x, y) do { lwip_stats.x.used += y; \
- if (lwip_stats.x.max < lwip_stats.x.used) { \
- lwip_stats.x.max = lwip_stats.x.used; \
- } \
- } while(0)
-#else /* LWIP_STATS */
-#define stats_init()
-#define STATS_INC(x)
-#define STATS_DEC(x)
-#define STATS_INC_USED(x)
-#endif /* LWIP_STATS */
-
-#if TCP_STATS
-#define TCP_STATS_INC(x) STATS_INC(x)
-#define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP")
-#else
-#define TCP_STATS_INC(x)
-#define TCP_STATS_DISPLAY()
-#endif
-
-#if UDP_STATS
-#define UDP_STATS_INC(x) STATS_INC(x)
-#define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP")
-#else
-#define UDP_STATS_INC(x)
-#define UDP_STATS_DISPLAY()
-#endif
-
-#if ICMP_STATS
-#define ICMP_STATS_INC(x) STATS_INC(x)
-#define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP")
-#else
-#define ICMP_STATS_INC(x)
-#define ICMP_STATS_DISPLAY()
-#endif
-
-#if IGMP_STATS
-#define IGMP_STATS_INC(x) STATS_INC(x)
-#define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp)
-#else
-#define IGMP_STATS_INC(x)
-#define IGMP_STATS_DISPLAY()
-#endif
-
-#if IP_STATS
-#define IP_STATS_INC(x) STATS_INC(x)
-#define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP")
-#else
-#define IP_STATS_INC(x)
-#define IP_STATS_DISPLAY()
-#endif
-
-#if IPFRAG_STATS
-#define IPFRAG_STATS_INC(x) STATS_INC(x)
-#define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG")
-#else
-#define IPFRAG_STATS_INC(x)
-#define IPFRAG_STATS_DISPLAY()
-#endif
-
-#if ETHARP_STATS
-#define ETHARP_STATS_INC(x) STATS_INC(x)
-#define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP")
-#else
-#define ETHARP_STATS_INC(x)
-#define ETHARP_STATS_DISPLAY()
-#endif
-
-#if LINK_STATS
-#define LINK_STATS_INC(x) STATS_INC(x)
-#define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK")
-#else
-#define LINK_STATS_INC(x)
-#define LINK_STATS_DISPLAY()
-#endif
-
-#if MEM_STATS
-#define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y
-#define MEM_STATS_INC(x) STATS_INC(mem.x)
-#define MEM_STATS_INC_USED(x, y) STATS_INC_USED(mem, y)
-#define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y
-#define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP")
-#else
-#define MEM_STATS_AVAIL(x, y)
-#define MEM_STATS_INC(x)
-#define MEM_STATS_INC_USED(x, y)
-#define MEM_STATS_DEC_USED(x, y)
-#define MEM_STATS_DISPLAY()
-#endif
-
-#if MEMP_STATS
-#define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y
-#define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x)
-#define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x)
-#define MEMP_STATS_INC_USED(x, i) STATS_INC_USED(memp[i], 1)
-#define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i)
-#else
-#define MEMP_STATS_AVAIL(x, i, y)
-#define MEMP_STATS_INC(x, i)
-#define MEMP_STATS_DEC(x, i)
-#define MEMP_STATS_INC_USED(x, i)
-#define MEMP_STATS_DISPLAY(i)
-#endif
-
-#if SYS_STATS
-#define SYS_STATS_INC(x) STATS_INC(sys.x)
-#define SYS_STATS_DEC(x) STATS_DEC(sys.x)
-#define SYS_STATS_INC_USED(x) STATS_INC_USED(sys.x, 1)
-#define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys)
-#else
-#define SYS_STATS_INC(x)
-#define SYS_STATS_DEC(x)
-#define SYS_STATS_INC_USED(x)
-#define SYS_STATS_DISPLAY()
-#endif
-
-/* Display of statistics */
-#if LWIP_STATS_DISPLAY
-void stats_display(void)ICACHE_FLASH_ATTR;
-void stats_display_proto(struct stats_proto *proto, char *name)ICACHE_FLASH_ATTR;
-void stats_display_igmp(struct stats_igmp *igmp)ICACHE_FLASH_ATTR;
-void stats_display_mem(struct stats_mem *mem, char *name)ICACHE_FLASH_ATTR;
-void stats_display_memp(struct stats_mem *mem, int index)ICACHE_FLASH_ATTR;
-void stats_display_sys(struct stats_sys *sys)ICACHE_FLASH_ATTR;
-#else /* LWIP_STATS_DISPLAY */
-#define stats_display()
-#define stats_display_proto(proto, name)
-#define stats_display_igmp(igmp)
-#define stats_display_mem(mem, name)
-#define stats_display_memp(mem, index)
-#define stats_display_sys(sys)
-#endif /* LWIP_STATS_DISPLAY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_STATS_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/sys.h b/sparkfun/esp8266/firmwares/loader/src/lwip/sys.h
deleted file mode 100644
index 31a9dea7..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/sys.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_SYS_H__
-#define __LWIP_SYS_H__
-
-#include "lwip/opt.h"
-
-#include "eagle_soc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if NO_SYS
-
-/* For a totally minimal and standalone system, we provide null
- definitions of the sys_ functions. */
-typedef u8_t sys_sem_t;
-typedef u8_t sys_mutex_t;
-typedef u8_t sys_mbox_t;
-
-#define sys_sem_new(s, c) ERR_OK
-#define sys_sem_signal(s)
-#define sys_sem_wait(s)
-#define sys_arch_sem_wait(s,t)
-#define sys_sem_free(s)
-#define sys_mutex_new(mu) ERR_OK
-#define sys_mutex_lock(mu)
-#define sys_mutex_unlock(mu)
-#define sys_mutex_free(mu)
-#define sys_mbox_new(m, s) ERR_OK
-#define sys_mbox_fetch(m,d)
-#define sys_mbox_tryfetch(m,d)
-#define sys_mbox_post(m,d)
-#define sys_mbox_trypost(m,d)
-#define sys_mbox_free(m)
-
-#define sys_thread_new(n,t,a,s,p)
-
-#define sys_msleep(t)
-
-#else /* NO_SYS */
-
-/** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */
-#define SYS_ARCH_TIMEOUT 0xffffffffUL
-
-/** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate.
- * For now we use the same magic value, but we allow this to change in future.
- */
-#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT
-
-#include "lwip/err.h"
-#include "arch/sys_arch.h"
-
-/** Function prototype for thread functions */
-typedef void (*lwip_thread_fn)(void *arg);
-
-/* Function prototypes for functions to be implemented by platform ports
- (in sys_arch.c) */
-
-/* Mutex functions: */
-
-/** Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
- should be used instead */
-#if LWIP_COMPAT_MUTEX
-/* for old ports that don't have mutexes: define them to binary semaphores */
-#define sys_mutex_t sys_sem_t
-#define sys_mutex_new(mutex) sys_sem_new(mutex, 1)
-#define sys_mutex_lock(mutex) sys_sem_wait(mutex)
-#define sys_mutex_unlock(mutex) sys_sem_signal(mutex)
-#define sys_mutex_free(mutex) sys_sem_free(mutex)
-#define sys_mutex_valid(mutex) sys_sem_valid(mutex)
-#define sys_mutex_set_invalid(mutex) sys_sem_set_invalid(mutex)
-
-#else /* LWIP_COMPAT_MUTEX */
-
-/** Create a new mutex
- * @param mutex pointer to the mutex to create
- * @return a new mutex */
-err_t sys_mutex_new(sys_mutex_t *mutex);
-/** Lock a mutex
- * @param mutex the mutex to lock */
-void sys_mutex_lock(sys_mutex_t *mutex);
-/** Unlock a mutex
- * @param mutex the mutex to unlock */
-void sys_mutex_unlock(sys_mutex_t *mutex);
-/** Delete a semaphore
- * @param mutex the mutex to delete */
-void sys_mutex_free(sys_mutex_t *mutex);
-#ifndef sys_mutex_valid
-/** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */
-int sys_mutex_valid(sys_mutex_t *mutex);
-#endif
-#ifndef sys_mutex_set_invalid
-/** Set a mutex invalid so that sys_mutex_valid returns 0 */
-void sys_mutex_set_invalid(sys_mutex_t *mutex);
-#endif
-#endif /* LWIP_COMPAT_MUTEX */
-
-/* Semaphore functions: */
-
-/** Create a new semaphore
- * @param sem pointer to the semaphore to create
- * @param count initial count of the semaphore
- * @return ERR_OK if successful, another err_t otherwise */
-err_t sys_sem_new(sys_sem_t *sem, u8_t count);
-/** Signals a semaphore
- * @param sem the semaphore to signal */
-void sys_sem_signal(sys_sem_t *sem);
-/** Wait for a semaphore for the specified timeout
- * @param sem the semaphore to wait for
- * @param timeout timeout in milliseconds to wait (0 = wait forever)
- * @return time (in milliseconds) waited for the semaphore
- * or SYS_ARCH_TIMEOUT on timeout */
-u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout);
-/** Delete a semaphore
- * @param sem semaphore to delete */
-void sys_sem_free(sys_sem_t *sem);
-/** Wait for a semaphore - forever/no timeout */
-#define sys_sem_wait(sem) sys_arch_sem_wait(sem, 0)
-#ifndef sys_sem_valid
-/** Check if a sempahore is valid/allocated: return 1 for valid, 0 for invalid */
-int sys_sem_valid(sys_sem_t *sem);
-#endif
-#ifndef sys_sem_set_invalid
-/** Set a semaphore invalid so that sys_sem_valid returns 0 */
-void sys_sem_set_invalid(sys_sem_t *sem);
-#endif
-
-/* Time functions. */
-#ifndef sys_msleep
-void sys_msleep(u32_t ms); /* only has a (close to) 1 jiffy resolution. */
-#endif
-
-/* Mailbox functions. */
-
-/** Create a new mbox of specified size
- * @param mbox pointer to the mbox to create
- * @param size (miminum) number of messages in this mbox
- * @return ERR_OK if successful, another err_t otherwise */
-err_t sys_mbox_new(sys_mbox_t *mbox, int size);
-/** Post a message to an mbox - may not fail
- * -> blocks if full, only used from tasks not from ISR
- * @param mbox mbox to posts the message
- * @param msg message to post (ATTENTION: can be NULL) */
-void sys_mbox_post(sys_mbox_t *mbox, void *msg);
-/** Try to post a message to an mbox - may fail if full or ISR
- * @param mbox mbox to posts the message
- * @param msg message to post (ATTENTION: can be NULL) */
-err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg);
-/** Wait for a new message to arrive in the mbox
- * @param mbox mbox to get a message from
- * @param msg pointer where the message is stored
- * @param timeout maximum time (in milliseconds) to wait for a message
- * @return time (in milliseconds) waited for a message, may be 0 if not waited
- or SYS_ARCH_TIMEOUT on timeout
- * The returned time has to be accurate to prevent timer jitter! */
-u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout);
-/* Allow port to override with a macro, e.g. special timout for sys_arch_mbox_fetch() */
-#ifndef sys_arch_mbox_tryfetch
-/** Wait for a new message to arrive in the mbox
- * @param mbox mbox to get a message from
- * @param msg pointer where the message is stored
- * @param timeout maximum time (in milliseconds) to wait for a message
- * @return 0 (milliseconds) if a message has been received
- * or SYS_MBOX_EMPTY if the mailbox is empty */
-u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg);
-#endif
-/** For now, we map straight to sys_arch implementation. */
-#define sys_mbox_tryfetch(mbox, msg) sys_arch_mbox_tryfetch(mbox, msg)
-/** Delete an mbox
- * @param mbox mbox to delete */
-void sys_mbox_free(sys_mbox_t *mbox);
-#define sys_mbox_fetch(mbox, msg) sys_arch_mbox_fetch(mbox, msg, 0)
-#ifndef sys_mbox_valid
-/** Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid */
-int sys_mbox_valid(sys_mbox_t *mbox);
-#endif
-#ifndef sys_mbox_set_invalid
-/** Set an mbox invalid so that sys_mbox_valid returns 0 */
-void sys_mbox_set_invalid(sys_mbox_t *mbox);
-#endif
-
-/** The only thread function:
- * Creates a new thread
- * @param name human-readable name for the thread (used for debugging purposes)
- * @param thread thread-function
- * @param arg parameter passed to 'thread'
- * @param stacksize stack size in bytes for the new thread (may be ignored by ports)
- * @param prio priority of the new thread (may be ignored by ports) */
-sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio);
-
-#endif /* NO_SYS */
-
-/* sys_init() must be called before anthing else. */
-void sys_init(void)ICACHE_FLASH_ATTR;
-
-#ifndef sys_jiffies
-/** Ticks/jiffies since power up. */
-u32_t sys_jiffies(void)ICACHE_FLASH_ATTR;
-#endif
-
-/** Returns the current time in milliseconds,
- * may be the same as sys_jiffies or at least based on it. */
-static inline u32_t sys_now(void) ICACHE_FLASH_ATTR;
-static inline u32_t sys_now(void)
-{
- return NOW()/(TIMER_CLK_FREQ/1000);
-}
-
-/* Critical Region Protection */
-/* These functions must be implemented in the sys_arch.c file.
- In some implementations they can provide a more light-weight protection
- mechanism than using semaphores. Otherwise semaphores can be used for
- implementation */
-#ifndef SYS_ARCH_PROTECT
-/** SYS_LIGHTWEIGHT_PROT
- * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
- * for certain critical regions during buffer allocation, deallocation and memory
- * allocation and deallocation.
- */
-#if SYS_LIGHTWEIGHT_PROT
-
-/** SYS_ARCH_DECL_PROTECT
- * declare a protection variable. This macro will default to defining a variable of
- * type sys_prot_t. If a particular port needs a different implementation, then
- * this macro may be defined in sys_arch.h.
- */
-#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t lev
-/** SYS_ARCH_PROTECT
- * Perform a "fast" protect. This could be implemented by
- * disabling interrupts for an embedded system or by using a semaphore or
- * mutex. The implementation should allow calling SYS_ARCH_PROTECT when
- * already protected. The old protection level is returned in the variable
- * "lev". This macro will default to calling the sys_arch_protect() function
- * which should be implemented in sys_arch.c. If a particular port needs a
- * different implementation, then this macro may be defined in sys_arch.h
- */
-#define SYS_ARCH_PROTECT(lev) lev = sys_arch_protect()
-/** SYS_ARCH_UNPROTECT
- * Perform a "fast" set of the protection level to "lev". This could be
- * implemented by setting the interrupt level to "lev" within the MACRO or by
- * using a semaphore or mutex. This macro will default to calling the
- * sys_arch_unprotect() function which should be implemented in
- * sys_arch.c. If a particular port needs a different implementation, then
- * this macro may be defined in sys_arch.h
- */
-#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev)
-sys_prot_t sys_arch_protect(void)ICACHE_FLASH_ATTR;
-void sys_arch_unprotect(sys_prot_t pval)ICACHE_FLASH_ATTR;
-
-#else
-
-#define SYS_ARCH_DECL_PROTECT(lev)
-#define SYS_ARCH_PROTECT(lev) lev = os_intr_lock() //fix by ives at 2014.3.24
-#define SYS_ARCH_UNPROTECT(lev) lev = os_intr_unlock()
-
-#endif /* SYS_LIGHTWEIGHT_PROT */
-
-#endif /* SYS_ARCH_PROTECT */
-
-/*
- * Macros to set/get and increase/decrease variables in a thread-safe way.
- * Use these for accessing variable that are used from more than one thread.
- */
-
-#ifndef SYS_ARCH_INC
-#define SYS_ARCH_INC(var, val) do { \
- SYS_ARCH_DECL_PROTECT(old_level); \
- SYS_ARCH_PROTECT(old_level); \
- var += val; \
- SYS_ARCH_UNPROTECT(old_level); \
- } while(0)
-#endif /* SYS_ARCH_INC */
-
-#ifndef SYS_ARCH_DEC
-#define SYS_ARCH_DEC(var, val) do { \
- SYS_ARCH_DECL_PROTECT(old_level); \
- SYS_ARCH_PROTECT(old_level); \
- var -= val; \
- SYS_ARCH_UNPROTECT(old_level); \
- } while(0)
-#endif /* SYS_ARCH_DEC */
-
-#ifndef SYS_ARCH_GET
-#define SYS_ARCH_GET(var, ret) do { \
- SYS_ARCH_DECL_PROTECT(old_level); \
- SYS_ARCH_PROTECT(old_level); \
- ret = var; \
- SYS_ARCH_UNPROTECT(old_level); \
- } while(0)
-#endif /* SYS_ARCH_GET */
-
-#ifndef SYS_ARCH_SET
-#define SYS_ARCH_SET(var, val) do { \
- SYS_ARCH_DECL_PROTECT(old_level); \
- SYS_ARCH_PROTECT(old_level); \
- var = val; \
- SYS_ARCH_UNPROTECT(old_level); \
- } while(0)
-#endif /* SYS_ARCH_SET */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LWIP_SYS_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/tcp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/tcp.h
deleted file mode 100644
index 909ff9b7..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/tcp.h
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_TCP_H__
-#define __LWIP_TCP_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/sys.h"
-#include "lwip/mem.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip.h"
-#include "lwip/icmp.h"
-#include "lwip/err.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct tcp_pcb;
-
-/** Function prototype for tcp accept callback functions. Called when a new
- * connection can be accepted on a listening pcb.
- *
- * @param arg Additional argument to pass to the callback function (@see tcp_arg())
- * @param newpcb The new connection pcb
- * @param err An error code if there has been an error accepting.
- * Only return ERR_ABRT if you have called tcp_abort from within the
- * callback function!
- */
-typedef err_t (*tcp_accept_fn)(void *arg, struct tcp_pcb *newpcb, err_t err);
-
-/** Function prototype for tcp receive callback functions. Called when data has
- * been received.
- *
- * @param arg Additional argument to pass to the callback function (@see tcp_arg())
- * @param tpcb The connection pcb which received data
- * @param p The received data (or NULL when the connection has been closed!)
- * @param err An error code if there has been an error receiving
- * Only return ERR_ABRT if you have called tcp_abort from within the
- * callback function!
- */
-typedef err_t (*tcp_recv_fn)(void *arg, struct tcp_pcb *tpcb,
- struct pbuf *p, err_t err);
-
-/** Function prototype for tcp sent callback functions. Called when sent data has
- * been acknowledged by the remote side. Use it to free corresponding resources.
- * This also means that the pcb has now space available to send new data.
- *
- * @param arg Additional argument to pass to the callback function (@see tcp_arg())
- * @param tpcb The connection pcb for which data has been acknowledged
- * @param len The amount of bytes acknowledged
- * @return ERR_OK: try to send some data by calling tcp_output
- * Only return ERR_ABRT if you have called tcp_abort from within the
- * callback function!
- */
-typedef err_t (*tcp_sent_fn)(void *arg, struct tcp_pcb *tpcb,
- u16_t len);
-
-/** Function prototype for tcp poll callback functions. Called periodically as
- * specified by @see tcp_poll.
- *
- * @param arg Additional argument to pass to the callback function (@see tcp_arg())
- * @param tpcb tcp pcb
- * @return ERR_OK: try to send some data by calling tcp_output
- * Only return ERR_ABRT if you have called tcp_abort from within the
- * callback function!
- */
-typedef err_t (*tcp_poll_fn)(void *arg, struct tcp_pcb *tpcb);
-
-/** Function prototype for tcp error callback functions. Called when the pcb
- * receives a RST or is unexpectedly closed for any other reason.
- *
- * @note The corresponding pcb is already freed when this callback is called!
- *
- * @param arg Additional argument to pass to the callback function (@see tcp_arg())
- * @param err Error code to indicate why the pcb has been closed
- * ERR_ABRT: aborted through tcp_abort or by a TCP timer
- * ERR_RST: the connection was reset by the remote host
- */
-typedef void (*tcp_err_fn)(void *arg, err_t err);
-
-/** Function prototype for tcp connected callback functions. Called when a pcb
- * is connected to the remote side after initiating a connection attempt by
- * calling tcp_connect().
- *
- * @param arg Additional argument to pass to the callback function (@see tcp_arg())
- * @param tpcb The connection pcb which is connected
- * @param err An unused error code, always ERR_OK currently ;-) TODO!
- * Only return ERR_ABRT if you have called tcp_abort from within the
- * callback function!
- *
- * @note When a connection attempt fails, the error callback is currently called!
- */
-typedef err_t (*tcp_connected_fn)(void *arg, struct tcp_pcb *tpcb, err_t err);
-
-enum tcp_state {
- CLOSED = 0,
- LISTEN = 1,
- SYN_SENT = 2,
- SYN_RCVD = 3,
- ESTABLISHED = 4,
- FIN_WAIT_1 = 5,
- FIN_WAIT_2 = 6,
- CLOSE_WAIT = 7,
- CLOSING = 8,
- LAST_ACK = 9,
- TIME_WAIT = 10
-};
-
-#if LWIP_CALLBACK_API
- /* Function to call when a listener has been connected.
- * @param arg user-supplied argument (tcp_pcb.callback_arg)
- * @param pcb a new tcp_pcb that now is connected
- * @param err an error argument (TODO: that is current always ERR_OK?)
- * @return ERR_OK: accept the new connection,
- * any other err_t abortsthe new connection
- */
-#define DEF_ACCEPT_CALLBACK tcp_accept_fn accept;
-#else /* LWIP_CALLBACK_API */
-#define DEF_ACCEPT_CALLBACK
-#endif /* LWIP_CALLBACK_API */
-
-/**
- * members common to struct tcp_pcb and struct tcp_listen_pcb
- */
-#define TCP_PCB_COMMON(type) \
- type *next; /* for the linked list */ \
- enum tcp_state state; /* TCP state */ \
- u8_t prio; \
- void *callback_arg; \
- /* the accept callback for listen- and normal pcbs, if LWIP_CALLBACK_API */ \
- DEF_ACCEPT_CALLBACK \
- /* ports are in host byte order */ \
- u16_t local_port
-
-
-/* the TCP protocol control block */
-struct tcp_pcb {
-/** common PCB members */
- IP_PCB;
-/** protocol specific PCB members */
- TCP_PCB_COMMON(struct tcp_pcb);
-
- /* ports are in host byte order */
- u16_t remote_port;
-
- u8_t flags;
-#define TF_ACK_DELAY ((u8_t)0x01U) /* Delayed ACK. */
-#define TF_ACK_NOW ((u8_t)0x02U) /* Immediate ACK. */
-#define TF_INFR ((u8_t)0x04U) /* In fast recovery. */
-#define TF_TIMESTAMP ((u8_t)0x08U) /* Timestamp option enabled */
-#define TF_RXCLOSED ((u8_t)0x10U) /* rx closed by tcp_shutdown */
-#define TF_FIN ((u8_t)0x20U) /* Connection was closed locally (FIN segment enqueued). */
-#define TF_NODELAY ((u8_t)0x40U) /* Disable Nagle algorithm */
-#define TF_NAGLEMEMERR ((u8_t)0x80U) /* nagle enabled, memerr, try to output to prevent delayed ACK to happen */
-
- /* the rest of the fields are in host byte order
- as we have to do some math with them */
- /* receiver variables */
- u32_t rcv_nxt; /* next seqno expected */
- u16_t rcv_wnd; /* receiver window available */
- u16_t rcv_ann_wnd; /* receiver window to announce */
- u32_t rcv_ann_right_edge; /* announced right edge of window */
-
- /* Timers */
- u32_t tmr;
- u8_t polltmr, pollinterval;
-
- /* Retransmission timer. */
- s16_t rtime;
-
- u16_t mss; /* maximum segment size */
-
- /* RTT (round trip time) estimation variables */
- u32_t rttest; /* RTT estimate in 500ms ticks */
- u32_t rtseq; /* sequence number being timed */
- s16_t sa, sv; /* @todo document this */
-
- s16_t rto; /* retransmission time-out */
- u8_t nrtx; /* number of retransmissions */
-
- /* fast retransmit/recovery */
- u32_t lastack; /* Highest acknowledged seqno. */
- u8_t dupacks;
-
- /* congestion avoidance/control variables */
- u16_t cwnd;
- u16_t ssthresh;
-
- /* sender variables */
- u32_t snd_nxt; /* next new seqno to be sent */
- u16_t snd_wnd; /* sender window */
- u32_t snd_wl1, snd_wl2; /* Sequence and acknowledgement numbers of last
- window update. */
- u32_t snd_lbb; /* Sequence number of next byte to be buffered. */
-
- u16_t acked;
-
- u16_t snd_buf; /* Available buffer space for sending (in bytes). */
-#define TCP_SNDQUEUELEN_OVERFLOW (0xffff-3)
- u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */
-
-#if TCP_OVERSIZE
- /* Extra bytes available at the end of the last pbuf in unsent. */
- u16_t unsent_oversize;
-#endif /* TCP_OVERSIZE */
-
- /* These are ordered by sequence number: */
- struct tcp_seg *unsent; /* Unsent (queued) segments. */
- struct tcp_seg *unacked; /* Sent but unacknowledged segments. */
-#if TCP_QUEUE_OOSEQ
- struct tcp_seg *ooseq; /* Received out of sequence segments. */
-#endif /* TCP_QUEUE_OOSEQ */
-
- struct pbuf *refused_data; /* Data previously received but not yet taken by upper layer */
-
-#if LWIP_CALLBACK_API
- /* Function to be called when more send buffer space is available. */
- tcp_sent_fn sent;
- /* Function to be called when (in-sequence) data has arrived. */
- tcp_recv_fn recv;
- /* Function to be called when a connection has been set up. */
- tcp_connected_fn connected;
- /* Function which is called periodically. */
- tcp_poll_fn poll;
- /* Function to be called whenever a fatal error occurs. */
- tcp_err_fn errf;
-#endif /* LWIP_CALLBACK_API */
-
-#if LWIP_TCP_TIMESTAMPS
- u32_t ts_lastacksent;
- u32_t ts_recent;
-#endif /* LWIP_TCP_TIMESTAMPS */
-
- /* idle time before KEEPALIVE is sent */
- u32_t keep_idle;
-#if LWIP_TCP_KEEPALIVE
- u32_t keep_intvl;
- u32_t keep_cnt;
-#endif /* LWIP_TCP_KEEPALIVE */
-
- /* Persist timer counter */
- u32_t persist_cnt;
- /* Persist timer back-off */
- u8_t persist_backoff;
-
- /* KEEPALIVE counter */
- u8_t keep_cnt_sent;
-};
-
-struct tcp_pcb_listen {
-/* Common members of all PCB types */
- IP_PCB;
-/* Protocol specific PCB members */
- TCP_PCB_COMMON(struct tcp_pcb_listen);
-
-#if TCP_LISTEN_BACKLOG
- u8_t backlog;
- u8_t accepts_pending;
-#endif /* TCP_LISTEN_BACKLOG */
-};
-
-#if LWIP_EVENT_API
-
-enum lwip_event {
- LWIP_EVENT_ACCEPT,
- LWIP_EVENT_SENT,
- LWIP_EVENT_RECV,
- LWIP_EVENT_CONNECTED,
- LWIP_EVENT_POLL,
- LWIP_EVENT_ERR
-};
-
-err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
- enum lwip_event,
- struct pbuf *p,
- u16_t size,
- err_t err);
-
-#endif /* LWIP_EVENT_API */
-
-/* Application program's interface: */
-struct tcp_pcb * tcp_new (void)ICACHE_FLASH_ATTR;
-
-void tcp_arg (struct tcp_pcb *pcb, void *arg) ICACHE_FLASH_ATTR;
-void tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept) ICACHE_FLASH_ATTR;
-void tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv) ICACHE_FLASH_ATTR;
-void tcp_sent (struct tcp_pcb *pcb, tcp_sent_fn sent)ICACHE_FLASH_ATTR;
-void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval)ICACHE_FLASH_ATTR;
-void tcp_err (struct tcp_pcb *pcb, tcp_err_fn err)ICACHE_FLASH_ATTR;
-
-#define tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss)
-#define tcp_sndbuf(pcb) ((pcb)->snd_buf)
-#define tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen)
-#define tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY)
-#define tcp_nagle_enable(pcb) ((pcb)->flags &= ~TF_NODELAY)
-#define tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0)
-
-#if TCP_LISTEN_BACKLOG
-#define tcp_accepted(pcb) do { \
- LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", pcb->state == LISTEN); \
- (((struct tcp_pcb_listen *)(pcb))->accepts_pending--); } while(0)
-#else /* TCP_LISTEN_BACKLOG */
-#define tcp_accepted(pcb) LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", \
- pcb->state == LISTEN)
-#endif /* TCP_LISTEN_BACKLOG */
-
-void tcp_recved (struct tcp_pcb *pcb, u16_t len)ICACHE_FLASH_ATTR;
-err_t tcp_bind (struct tcp_pcb *pcb, ip_addr_t *ipaddr,
- u16_t port)ICACHE_FLASH_ATTR;
-err_t tcp_connect (struct tcp_pcb *pcb, ip_addr_t *ipaddr,
- u16_t port, tcp_connected_fn connected)ICACHE_FLASH_ATTR;
-
-struct tcp_pcb * tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)ICACHE_FLASH_ATTR;
-#define tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG)
-
-void tcp_abort (struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-err_t tcp_close (struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-err_t tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx)ICACHE_FLASH_ATTR;
-
-/* Flags for "apiflags" parameter in tcp_write */
-#define TCP_WRITE_FLAG_COPY 0x01
-#define TCP_WRITE_FLAG_MORE 0x02
-
-err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len,
- u8_t apiflags)ICACHE_FLASH_ATTR;
-
-void tcp_setprio (struct tcp_pcb *pcb, u8_t prio)ICACHE_FLASH_ATTR;
-
-#define TCP_PRIO_MIN 1
-#define TCP_PRIO_NORMAL 64
-#define TCP_PRIO_MAX 127
-
-extern err_t tcp_output(struct tcp_pcb *pcb);
-
-
-const char* tcp_debug_state_str(enum tcp_state s)ICACHE_FLASH_ATTR;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_TCP */
-
-#endif /* __LWIP_TCP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/tcp_impl.h b/sparkfun/esp8266/firmwares/loader/src/lwip/tcp_impl.h
deleted file mode 100644
index f906c0d1..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/tcp_impl.h
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_TCP_IMPL_H__
-#define __LWIP_TCP_IMPL_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/tcp.h"
-#include "lwip/sys.h"
-#include "lwip/mem.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip.h"
-#include "lwip/icmp.h"
-#include "lwip/err.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Functions for interfacing with TCP: */
-
-/* Lower layer interface to TCP: */
-#define tcp_init() /* Compatibility define, no init needed. */
-void tcp_tmr (void)ICACHE_FLASH_ATTR; /* Must be called every
- TCP_TMR_INTERVAL
- ms. (Typically 250 ms). */
-/* It is also possible to call these two functions at the right
- intervals (instead of calling tcp_tmr()). */
-void tcp_slowtmr (void)ICACHE_FLASH_ATTR;
-void tcp_fasttmr (void)ICACHE_FLASH_ATTR;
-
-
-/* Only used by IP to pass a TCP segment to TCP: */
-void tcp_input (struct pbuf *p, struct netif *inp)ICACHE_FLASH_ATTR;
-/* Used within the TCP code only: */
-struct tcp_pcb * tcp_alloc (u8_t prio)ICACHE_FLASH_ATTR;
-void tcp_abandon (struct tcp_pcb *pcb, int reset)ICACHE_FLASH_ATTR;
-err_t tcp_send_empty_ack(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-void tcp_rexmit (struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-void tcp_rexmit_rto (struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-void tcp_rexmit_fast (struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-u32_t tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-
-/**
- * This is the Nagle algorithm: try to combine user data to send as few TCP
- * segments as possible. Only send if
- * - no previously transmitted data on the connection remains unacknowledged or
- * - the TF_NODELAY flag is set (nagle algorithm turned off for this pcb) or
- * - the only unsent segment is at least pcb->mss bytes long (or there is more
- * than one unsent segment - with lwIP, this can happen although unsent->len < mss)
- * - or if we are in fast-retransmit (TF_INFR)
- */
-#define tcp_do_output_nagle(tpcb) ((((tpcb)->unacked == NULL) || \
- ((tpcb)->flags & (TF_NODELAY | TF_INFR)) || \
- (((tpcb)->unsent != NULL) && (((tpcb)->unsent->next != NULL) || \
- ((tpcb)->unsent->len >= (tpcb)->mss))) \
- ) ? 1 : 0)
-#define tcp_output_nagle(tpcb) (tcp_do_output_nagle(tpcb) ? tcp_output(tpcb) : ERR_OK)
-
-
-#define TCP_SEQ_LT(a,b) ((s32_t)((a)-(b)) < 0)
-#define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b)) <= 0)
-#define TCP_SEQ_GT(a,b) ((s32_t)((a)-(b)) > 0)
-#define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b)) >= 0)
-/* is b<=a<=c? */
-#if 0 /* see bug #10548 */
-#define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
-#endif
-#define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
-#define TCP_FIN 0x01U
-#define TCP_SYN 0x02U
-#define TCP_RST 0x04U
-#define TCP_PSH 0x08U
-#define TCP_ACK 0x10U
-#define TCP_URG 0x20U
-#define TCP_ECE 0x40U
-#define TCP_CWR 0x80U
-
-#define TCP_FLAGS 0x3fU
-
-/* Length of the TCP header, excluding options. */
-#define TCP_HLEN 20
-
-#ifndef TCP_TMR_INTERVAL
-#define TCP_TMR_INTERVAL 250 /* The TCP timer interval in milliseconds. */
-#endif /* TCP_TMR_INTERVAL */
-
-#ifndef TCP_FAST_INTERVAL
-#define TCP_FAST_INTERVAL TCP_TMR_INTERVAL /* the fine grained timeout in milliseconds */
-#endif /* TCP_FAST_INTERVAL */
-
-#ifndef TCP_SLOW_INTERVAL
-#define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL) /* the coarse grained timeout in milliseconds */
-#endif /* TCP_SLOW_INTERVAL */
-
-#define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */
-#define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */
-
-#define TCP_OOSEQ_TIMEOUT 6U /* x RTO */
-
-#ifndef TCP_MSL
-#define TCP_MSL 60000UL /* The maximum segment lifetime in milliseconds */
-#endif
-
-/* Keepalive values, compliant with RFC 1122. Don't change this unless you know what you're doing */
-#ifndef TCP_KEEPIDLE_DEFAULT
-#define TCP_KEEPIDLE_DEFAULT 3000UL /* Default KEEPALIVE timer in milliseconds */
-#endif
-
-#ifndef TCP_KEEPINTVL_DEFAULT
-#define TCP_KEEPINTVL_DEFAULT 1000UL /* Default Time between KEEPALIVE probes in milliseconds */
-#endif
-
-#ifndef TCP_KEEPCNT_DEFAULT
-#define TCP_KEEPCNT_DEFAULT 3U /* Default Counter for KEEPALIVE probes */
-#endif
-
-#define TCP_MAXIDLE TCP_KEEPCNT_DEFAULT * TCP_KEEPINTVL_DEFAULT /* Maximum KEEPALIVE probe time */
-
-/* Fields are (of course) in network byte order.
- * Some fields are converted to host byte order in tcp_input().
- */
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct tcp_hdr {
- PACK_STRUCT_FIELD(u16_t src); //Ô´¶Ë¿Ú
- PACK_STRUCT_FIELD(u16_t dest); //Ä¿µÄ¶Ë¿Ú
- PACK_STRUCT_FIELD(u32_t seqno); //ÐòºÅ
- PACK_STRUCT_FIELD(u32_t ackno); //Ó¦´ðÐòºÅ
- PACK_STRUCT_FIELD(u16_t _hdrlen_rsvd_flags);//Êײ¿³¤¶È+±£Áôλ+±ê־λ
- PACK_STRUCT_FIELD(u16_t wnd); //´°¿Ú´óС
- PACK_STRUCT_FIELD(u16_t chksum); //УÑéºÍ
- PACK_STRUCT_FIELD(u16_t urgp); //½ô¼±Ö¸Õë
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-#define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8)
-#define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12)
-#define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)
-
-#define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr))
-#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr))
-#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS((u16_t)(~(u16_t)(TCP_FLAGS)))) | htons(flags))
-#define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | (flags))
-
-#define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags | htons(flags))
-#define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) )
-
-#define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & (TCP_FIN | TCP_SYN)) != 0))
-
-/** Flags used on input processing, not on pcb->flags
-*/
-#define TF_RESET (u8_t)0x08U /* Connection was reset. */
-#define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */
-#define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */
-
-
-#if LWIP_EVENT_API
-
-#define TCP_EVENT_ACCEPT(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
- LWIP_EVENT_ACCEPT, NULL, 0, err)
-#define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
- LWIP_EVENT_SENT, NULL, space, ERR_OK)
-#define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
- LWIP_EVENT_RECV, (p), 0, (err))
-#define TCP_EVENT_CLOSED(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
- LWIP_EVENT_RECV, NULL, 0, ERR_OK)
-#define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
- LWIP_EVENT_CONNECTED, NULL, 0, (err))
-#define TCP_EVENT_POLL(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
- LWIP_EVENT_POLL, NULL, 0, ERR_OK)
-#define TCP_EVENT_ERR(errf,arg,err) lwip_tcp_event((arg), NULL, \
- LWIP_EVENT_ERR, NULL, 0, (err))
-
-#else /* LWIP_EVENT_API */
-
-#define TCP_EVENT_ACCEPT(pcb,err,ret) \
- do { \
- if((pcb)->accept != NULL) \
- (ret) = (pcb)->accept((pcb)->callback_arg,(pcb),(err)); \
- else (ret) = ERR_ARG; \
- } while (0)
-
-#define TCP_EVENT_SENT(pcb,space,ret) \
- do { \
- if((pcb)->sent != NULL) \
- (ret) = (pcb)->sent((pcb)->callback_arg,(pcb),(space)); \
- else (ret) = ERR_OK; \
- } while (0)
-
-#define TCP_EVENT_RECV(pcb,p,err,ret) \
- do { \
- if((pcb)->recv != NULL) { \
- (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err));\
- } else { \
- (ret) = tcp_recv_null(NULL, (pcb), (p), (err)); \
- } \
- } while (0)
-
-#define TCP_EVENT_CLOSED(pcb,ret) \
- do { \
- if(((pcb)->recv != NULL)) { \
- (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),NULL,ERR_OK);\
- } else { \
- (ret) = ERR_OK; \
- } \
- } while (0)
-
-#define TCP_EVENT_CONNECTED(pcb,err,ret) \
- do { \
- if((pcb)->connected != NULL) \
- (ret) = (pcb)->connected((pcb)->callback_arg,(pcb),(err)); \
- else (ret) = ERR_OK; \
- } while (0)
-
-#define TCP_EVENT_POLL(pcb,ret) \
- do { \
- if((pcb)->poll != NULL) \
- (ret) = (pcb)->poll((pcb)->callback_arg,(pcb)); \
- else (ret) = ERR_OK; \
- } while (0)
-
-#define TCP_EVENT_ERR(errf,arg,err) \
- do { \
- if((errf) != NULL) \
- (errf)((arg),(err)); \
- } while (0)
-
-#endif /* LWIP_EVENT_API */
-
-/** Enabled extra-check for TCP_OVERSIZE if LWIP_DEBUG is enabled */
-#if TCP_OVERSIZE && defined(LWIP_DEBUG)
-#define TCP_OVERSIZE_DBGCHECK 1
-#else
-#define TCP_OVERSIZE_DBGCHECK 0
-#endif
-
-/** Don't generate checksum on copy if CHECKSUM_GEN_TCP is disabled */
-#define TCP_CHECKSUM_ON_COPY (LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_TCP)
-
-/* This structure represents a TCP segment on the unsent, unacked and ooseq queues */
-struct tcp_seg {
- struct tcp_seg *next; /* used when putting segements on a queue */
- struct pbuf *p; /* buffer containing data + TCP header */
- void *dataptr; /* pointer to the TCP data in the pbuf */
- u16_t len; /* the TCP length of this segment */
-#if TCP_OVERSIZE_DBGCHECK
- u16_t oversize_left; /* Extra bytes available at the end of the last
- pbuf in unsent (used for asserting vs.
- tcp_pcb.unsent_oversized only) */
-#endif /* TCP_OVERSIZE_DBGCHECK */
-#if TCP_CHECKSUM_ON_COPY
- u16_t chksum;
- u8_t chksum_swapped;
-#endif /* TCP_CHECKSUM_ON_COPY */
- u8_t flags;
-#define TF_SEG_OPTS_MSS (u8_t)0x01U /* Include MSS option. */
-#define TF_SEG_OPTS_TS (u8_t)0x02U /* Include timestamp option. */
-#define TF_SEG_DATA_CHECKSUMMED (u8_t)0x04U /* ALL data (not the header) is
- checksummed into 'chksum' */
- struct tcp_hdr *tcphdr; /* the TCP header */
-};
-
-#define LWIP_TCP_OPT_LENGTH(flags) \
- (flags & TF_SEG_OPTS_MSS ? 4 : 0) + \
- (flags & TF_SEG_OPTS_TS ? 12 : 0)
-
-/** This returns a TCP header option for MSS in an u32_t */
-#define TCP_BUILD_MSS_OPTION(x) (x) = PP_HTONL(((u32_t)2 << 24) | \
- ((u32_t)4 << 16) | \
- (((u32_t)TCP_MSS / 256) << 8) | \
- (TCP_MSS & 255))
-
-/* Global variables: */
-extern struct tcp_pcb *tcp_input_pcb;
-extern u32_t tcp_ticks;
-
-/* The TCP PCB lists. */
-union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */
- struct tcp_pcb_listen *listen_pcbs;
- struct tcp_pcb *pcbs;
-};
-extern struct tcp_pcb *tcp_bound_pcbs;
-extern union tcp_listen_pcbs_t tcp_listen_pcbs;
-extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a
- state in which they accept or send
- data. */
-extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */
-
-extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
-
-/* Axioms about the above lists:
- 1) Every TCP PCB that is not CLOSED is in one of the lists.
- 2) A PCB is only in one of the lists.
- 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
- 4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state.
-*/
-/* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB
- with a PCB list or removes a PCB from a list, respectively. */
-#ifndef TCP_DEBUG_PCB_LISTS
-#define TCP_DEBUG_PCB_LISTS 0
-#endif
-#if TCP_DEBUG_PCB_LISTS
-#define TCP_REG(pcbs, npcb) do {\
- LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \
- for(tcp_tmp_pcb = *(pcbs); \
- tcp_tmp_pcb != NULL; \
- tcp_tmp_pcb = tcp_tmp_pcb->next) { \
- LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \
- } \
- LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", ((pcbs) == &tcp_bound_pcbs) || ((npcb)->state != CLOSED)); \
- (npcb)->next = *(pcbs); \
- LWIP_ASSERT("TCP_REG: npcb->next != npcb", (npcb)->next != (npcb)); \
- *(pcbs) = (npcb); \
- LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
- tcp_timer_needed(); \
- } while(0)
-#define TCP_RMV(pcbs, npcb) do { \
- LWIP_ASSERT("TCP_RMV: pcbs != NULL", *(pcbs) != NULL); \
- LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \
- if(*(pcbs) == (npcb)) { \
- *(pcbs) = (*pcbs)->next; \
- } else for(tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
- if(tcp_tmp_pcb->next == (npcb)) { \
- tcp_tmp_pcb->next = (npcb)->next; \
- break; \
- } \
- } \
- (npcb)->next = NULL; \
- LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
- LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (npcb), *(pcbs))); \
- } while(0)
-
-#else /* LWIP_DEBUG */
-
-#define TCP_REG(pcbs, npcb) \
- do { \
- (npcb)->next = *pcbs; \
- *(pcbs) = (npcb); \
- tcp_timer_needed(); \
- } while (0)
-
-#define TCP_RMV(pcbs, npcb) \
- do { \
- if(*(pcbs) == (npcb)) { \
- (*(pcbs)) = (*pcbs)->next; \
- } \
- else { \
- for(tcp_tmp_pcb = *pcbs; \
- tcp_tmp_pcb != NULL; \
- tcp_tmp_pcb = tcp_tmp_pcb->next) { \
- if(tcp_tmp_pcb->next == (npcb)) { \
- tcp_tmp_pcb->next = (npcb)->next; \
- break; \
- } \
- } \
- } \
- (npcb)->next = NULL; \
- } while(0)
-
-#endif /* LWIP_DEBUG */
-
-
-/* Internal functions: */
-struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-void tcp_pcb_purge(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-
-void tcp_segs_free(struct tcp_seg *seg)ICACHE_FLASH_ATTR;
-void tcp_seg_free(struct tcp_seg *seg)ICACHE_FLASH_ATTR;
-struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg)ICACHE_FLASH_ATTR;
-
-#define tcp_ack(pcb) \
- do { \
- if((pcb)->flags & TF_ACK_DELAY) { \
- (pcb)->flags &= ~TF_ACK_DELAY; \
- (pcb)->flags |= TF_ACK_NOW; \
- } \
- else { \
- (pcb)->flags |= TF_ACK_DELAY; \
- } \
- } while (0)
-
-#define tcp_ack_now(pcb) \
- do { \
- (pcb)->flags |= TF_ACK_NOW; \
- } while (0)
-
-err_t tcp_send_fin(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-err_t tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)ICACHE_FLASH_ATTR;
-
-void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg)ICACHE_FLASH_ATTR;
-
-void tcp_rst(u32_t seqno, u32_t ackno,
- ip_addr_t *local_ip, ip_addr_t *remote_ip,
- u16_t local_port, u16_t remote_port)ICACHE_FLASH_ATTR;
-
-u32_t tcp_next_iss(void)ICACHE_FLASH_ATTR;
-
-void tcp_keepalive(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-void tcp_zero_window_probe(struct tcp_pcb *pcb)ICACHE_FLASH_ATTR;
-
-#if TCP_CALCULATE_EFF_SEND_MSS
-u16_t tcp_eff_send_mss(u16_t sendmss, ip_addr_t *addr)ICACHE_FLASH_ATTR;
-#endif /* TCP_CALCULATE_EFF_SEND_MSS */
-
-#if LWIP_CALLBACK_API
-err_t tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)ICACHE_FLASH_ATTR;
-#endif /* LWIP_CALLBACK_API */
-
-#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
-void tcp_debug_print(struct tcp_hdr *tcphdr)ICACHE_FLASH_ATTR;
-void tcp_debug_print_flags(u8_t flags)ICACHE_FLASH_ATTR;
-void tcp_debug_print_state(enum tcp_state s)ICACHE_FLASH_ATTR;
-void tcp_debug_print_pcbs(void)ICACHE_FLASH_ATTR;
-s16_t tcp_pcbs_sane(void)ICACHE_FLASH_ATTR;
-#else
-# define tcp_debug_print(tcphdr)
-# define tcp_debug_print_flags(flags)
-# define tcp_debug_print_state(s)
-# define tcp_debug_print_pcbs()
-# define tcp_pcbs_sane() 1
-#endif /* TCP_DEBUG */
-
-/** External function (implemented in timers.c), called when TCP detects
- * that a timer is needed (i.e. active- or time-wait-pcb found). */
-void tcp_timer_needed(void)ICACHE_FLASH_ATTR;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_TCP */
-
-#endif /* __LWIP_TCP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/tcpip.h b/sparkfun/esp8266/firmwares/loader/src/lwip/tcpip.h
deleted file mode 100644
index 995ba8ad..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/tcpip.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_TCPIP_H__
-#define __LWIP_TCPIP_H__
-
-#include "lwip/opt.h"
-
-#if !NO_SYS /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/api_msg.h"
-#include "lwip/netifapi.h"
-#include "lwip/pbuf.h"
-#include "lwip/api.h"
-#include "lwip/sys.h"
-#include "lwip/timers.h"
-#include "lwip/netif.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Define this to something that triggers a watchdog. This is called from
- * tcpip_thread after processing a message. */
-#ifndef LWIP_TCPIP_THREAD_ALIVE
-#define LWIP_TCPIP_THREAD_ALIVE()
-#endif
-
-#if LWIP_TCPIP_CORE_LOCKING
-/** The global semaphore to lock the stack. */
-extern sys_mutex_t lock_tcpip_core;
-#define LOCK_TCPIP_CORE() sys_mutex_lock(&lock_tcpip_core)
-#define UNLOCK_TCPIP_CORE() sys_mutex_unlock(&lock_tcpip_core)
-#define TCPIP_APIMSG(m) tcpip_apimsg_lock(m)
-#define TCPIP_APIMSG_ACK(m)
-#define TCPIP_NETIFAPI(m) tcpip_netifapi_lock(m)
-#define TCPIP_NETIFAPI_ACK(m)
-#else /* LWIP_TCPIP_CORE_LOCKING */
-#define LOCK_TCPIP_CORE()
-#define UNLOCK_TCPIP_CORE()
-#define TCPIP_APIMSG(m) tcpip_apimsg(m)
-#define TCPIP_APIMSG_ACK(m) sys_sem_signal(&m->conn->op_completed)
-#define TCPIP_NETIFAPI(m) tcpip_netifapi(m)
-#define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(&m->sem)
-#endif /* LWIP_TCPIP_CORE_LOCKING */
-
-/** Function prototype for the init_done function passed to tcpip_init */
-typedef void (*tcpip_init_done_fn)(void *arg);
-/** Function prototype for functions passed to tcpip_callback() */
-typedef void (*tcpip_callback_fn)(void *ctx);
-
-void tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg);
-
-#if LWIP_NETCONN
-err_t tcpip_apimsg(struct api_msg *apimsg);
-#if LWIP_TCPIP_CORE_LOCKING
-err_t tcpip_apimsg_lock(struct api_msg *apimsg);
-#endif /* LWIP_TCPIP_CORE_LOCKING */
-#endif /* LWIP_NETCONN */
-
-err_t tcpip_input(struct pbuf *p, struct netif *inp);
-
-#if LWIP_NETIF_API
-err_t tcpip_netifapi(struct netifapi_msg *netifapimsg);
-#if LWIP_TCPIP_CORE_LOCKING
-err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg);
-#endif /* LWIP_TCPIP_CORE_LOCKING */
-#endif /* LWIP_NETIF_API */
-
-err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block);
-#define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1)
-
-/* free pbufs or heap memory from another context without blocking */
-err_t pbuf_free_callback(struct pbuf *p);
-err_t mem_free_callback(void *m);
-
-#if LWIP_TCPIP_TIMEOUT
-err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
-err_t tcpip_untimeout(sys_timeout_handler h, void *arg);
-#endif /* LWIP_TCPIP_TIMEOUT */
-
-enum tcpip_msg_type {
-#if LWIP_NETCONN
- TCPIP_MSG_API,
-#endif /* LWIP_NETCONN */
- TCPIP_MSG_INPKT,
-#if LWIP_NETIF_API
- TCPIP_MSG_NETIFAPI,
-#endif /* LWIP_NETIF_API */
-#if LWIP_TCPIP_TIMEOUT
- TCPIP_MSG_TIMEOUT,
- TCPIP_MSG_UNTIMEOUT,
-#endif /* LWIP_TCPIP_TIMEOUT */
- TCPIP_MSG_CALLBACK
-};
-
-struct tcpip_msg {
- enum tcpip_msg_type type;
- sys_sem_t *sem;
- union {
-#if LWIP_NETCONN
- struct api_msg *apimsg;
-#endif /* LWIP_NETCONN */
-#if LWIP_NETIF_API
- struct netifapi_msg *netifapimsg;
-#endif /* LWIP_NETIF_API */
- struct {
- struct pbuf *p;
- struct netif *netif;
- } inp;
- struct {
- tcpip_callback_fn function;
- void *ctx;
- } cb;
-#if LWIP_TCPIP_TIMEOUT
- struct {
- u32_t msecs;
- sys_timeout_handler h;
- void *arg;
- } tmo;
-#endif /* LWIP_TCPIP_TIMEOUT */
- } msg;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !NO_SYS */
-
-#endif /* __LWIP_TCPIP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/timers.h b/sparkfun/esp8266/firmwares/loader/src/lwip/timers.h
deleted file mode 100644
index e9db02a2..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/timers.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- * Simon Goldschmidt
- *
- */
-#ifndef __LWIP_TIMERS_H__
-#define __LWIP_TIMERS_H__
-
-#include "lwip/opt.h"
-
-/* Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1 */
-#define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS))
-
-#if LWIP_TIMERS
-
-#include "lwip/err.h"
-#include "lwip/sys.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef LWIP_DEBUG_TIMERNAMES
-#ifdef LWIP_DEBUG
-#define LWIP_DEBUG_TIMERNAMES SYS_DEBUG
-#else /* LWIP_DEBUG */
-#define LWIP_DEBUG_TIMERNAMES 0
-#endif /* LWIP_DEBUG*/
-#endif
-
-/** Function prototype for a timeout callback function. Register such a function
- * using sys_timeout().
- *
- * @param arg Additional argument to pass to the function - set up by sys_timeout()
- */
-typedef void (* sys_timeout_handler)(void *arg);
-
-struct sys_timeo {
- struct sys_timeo *next;
- u32_t time;
- sys_timeout_handler h;
- void *arg;
-#if LWIP_DEBUG_TIMERNAMES
- const char* handler_name;
-#endif /* LWIP_DEBUG_TIMERNAMES */
-};
-
-void sys_timeouts_init(void)ICACHE_FLASH_ATTR;
-
-#if LWIP_DEBUG_TIMERNAMES
-void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name)ICACHE_FLASH_ATTR;
-#define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler)
-#else /* LWIP_DEBUG_TIMERNAMES */
-void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)ICACHE_FLASH_ATTR;
-#endif /* LWIP_DEBUG_TIMERNAMES */
-
-void sys_untimeout(sys_timeout_handler handler, void *arg)ICACHE_FLASH_ATTR;
-#if NO_SYS
-void sys_check_timeouts(void)ICACHE_FLASH_ATTR;
-void sys_restart_timeouts(void)ICACHE_FLASH_ATTR;
-#else /* NO_SYS */
-void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg);
-#endif /* NO_SYS */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_TIMERS */
-#endif /* __LWIP_TIMERS_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/lwip/udp.h b/sparkfun/esp8266/firmwares/loader/src/lwip/udp.h
deleted file mode 100644
index cb53d33e..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/lwip/udp.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels
- *
- */
-#ifndef __LWIP_UDP_H__
-#define __LWIP_UDP_H__
-
-#include "lwip/opt.h"
-
-#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */
-
-#include "lwip/pbuf.h"
-#include "lwip/netif.h"
-#include "lwip/ip_addr.h"
-#include "lwip/ip.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UDP_HLEN 8
-
-/* Fields are (of course) in network byte order. */
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct udp_hdr {
- PACK_STRUCT_FIELD(u16_t src);
- PACK_STRUCT_FIELD(u16_t dest); /* src/dest UDP ports */
- PACK_STRUCT_FIELD(u16_t len);
- PACK_STRUCT_FIELD(u16_t chksum);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-# include "arch/epstruct.h"
-#endif
-
-#define UDP_FLAGS_NOCHKSUM 0x01U
-#define UDP_FLAGS_UDPLITE 0x02U
-#define UDP_FLAGS_CONNECTED 0x04U
-#define UDP_FLAGS_MULTICAST_LOOP 0x08U
-
-struct udp_pcb;
-
-/** Function prototype for udp pcb receive callback functions
- * addr and port are in same byte order as in the pcb
- * The callback is responsible for freeing the pbuf
- * if it's not used any more.
- *
- * ATTENTION: Be aware that 'addr' points into the pbuf 'p' so freeing this pbuf
- * makes 'addr' invalid, too.
- *
- * @param arg user supplied argument (udp_pcb.recv_arg)
- * @param pcb the udp_pcb which received data
- * @param p the packet buffer that was received
- * @param addr the remote IP address from which the packet was received
- * @param port the remote port from which the packet was received
- */
-typedef void (*udp_recv_fn)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
- ip_addr_t *addr, u16_t port);
-
-
-struct udp_pcb {
-/* Common members of all PCB types */
- IP_PCB;
-
-/* Protocol specific PCB members */
-
- struct udp_pcb *next;
-
- u8_t flags;
- /** ports are in host byte order */
- u16_t local_port, remote_port;
-
-#if LWIP_IGMP
- /** outgoing network interface for multicast packets */
- ip_addr_t multicast_ip;
-#endif /* LWIP_IGMP */
-
-#if LWIP_UDPLITE
- /** used for UDP_LITE only */
- u16_t chksum_len_rx, chksum_len_tx;
-#endif /* LWIP_UDPLITE */
-
- /** receive callback function */
- udp_recv_fn recv;
- /** user-supplied argument for the recv callback */
- void *recv_arg;
-};
-/* udp_pcbs export for exernal reference (e.g. SNMP agent) */
-extern struct udp_pcb *udp_pcbs;
-
-/* The following functions is the application layer interface to the
- UDP code. */
-struct udp_pcb * udp_new (void)ICACHE_FLASH_ATTR;
-void udp_remove (struct udp_pcb *pcb)ICACHE_FLASH_ATTR;
-err_t udp_bind (struct udp_pcb *pcb, ip_addr_t *ipaddr,
- u16_t port)ICACHE_FLASH_ATTR;
-err_t udp_connect (struct udp_pcb *pcb, ip_addr_t *ipaddr,
- u16_t port)ICACHE_FLASH_ATTR;
-void udp_disconnect (struct udp_pcb *pcb)ICACHE_FLASH_ATTR;
-void udp_recv (struct udp_pcb *pcb, udp_recv_fn recv,
- void *recv_arg)ICACHE_FLASH_ATTR;
-err_t udp_sendto_if (struct udp_pcb *pcb, struct pbuf *p,
- ip_addr_t *dst_ip, u16_t dst_port,
- struct netif *netif)ICACHE_FLASH_ATTR;
-err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p,
- ip_addr_t *dst_ip, u16_t dst_port)ICACHE_FLASH_ATTR;
-err_t udp_send (struct udp_pcb *pcb, struct pbuf *p)ICACHE_FLASH_ATTR;
-
-#if LWIP_CHECKSUM_ON_COPY
-err_t udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p,
- ip_addr_t *dst_ip, u16_t dst_port,
- struct netif *netif, u8_t have_chksum,
- u16_t chksum)ICACHE_FLASH_ATTR;
-err_t udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p,
- ip_addr_t *dst_ip, u16_t dst_port,
- u8_t have_chksum, u16_t chksum)ICACHE_FLASH_ATTR;
-err_t udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
- u8_t have_chksum, u16_t chksum)ICACHE_FLASH_ATTR;
-#endif /* LWIP_CHECKSUM_ON_COPY */
-
-#define udp_flags(pcb) ((pcb)->flags)
-#define udp_setflags(pcb, f) ((pcb)->flags = (f))
-
-/* The following functions are the lower layer interface to UDP. */
-void udp_input (struct pbuf *p, struct netif *inp)ICACHE_FLASH_ATTR;
-
-#define udp_init() /* Compatibility define, not init needed. */
-
-#if UDP_DEBUG
-void udp_debug_print(struct udp_hdr *udphdr)ICACHE_FLASH_ATTR;
-#else
-#define udp_debug_print(udphdr)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LWIP_UDP */
-
-#endif /* __LWIP_UDP_H__ */
diff --git a/sparkfun/esp8266/firmwares/loader/src/main.cpp b/sparkfun/esp8266/firmwares/loader/src/main.cpp
deleted file mode 100644
index 23d44634..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/main.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-#include "Common.hpp"
-#include "TcpServerSource.hpp"
-
-
-using namespace update;
-
-
-
-
-extern "C" void user_init(void)
-{
- Sink dummySink;
- AuthChecker dummyAuth;
- Args args("");
-
- TcpServerSource server(dummySink, dummyAuth);
- server.begin(args);
-}
-
-
diff --git a/sparkfun/esp8266/firmwares/loader/src/main.d b/sparkfun/esp8266/firmwares/loader/src/main.d
deleted file mode 100644
index df3f289f..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/main.d
+++ /dev/null
@@ -1,13 +0,0 @@
-src/main.o: src/main.cpp src/Common.hpp \
- ../../../../../build/macosx/work/Arduino.app/Contents/Java/hardware/tools/esp8266/sdk/include/ets_sys.h \
- ../../../../../build/macosx/work/Arduino.app/Contents/Java/hardware/tools/esp8266/sdk/include/c_types.h \
- ../../../../../build/macosx/work/Arduino.app/Contents/Java/hardware/tools/esp8266/sdk/include/eagle_soc.h \
- ../../../../../build/macosx/work/Arduino.app/Contents/Java/hardware/tools/esp8266/sdk/include/osapi.h \
- src/user_config.h src/lwip/opt.h src/include/lwipopts.h src/lwip/debug.h \
- src/lwip/arch.h src/arch/cc.h \
- ../../../../../build/macosx/work/Arduino.app/Contents/Java/hardware/tools/esp8266/sdk/include/c_types.h \
- src/lwip/tcp.h src/lwip/opt.h src/lwip/sys.h \
- ../../../../../build/macosx/work/Arduino.app/Contents/Java/hardware/tools/esp8266/sdk/include/eagle_soc.h \
- src/lwip/mem.h src/lwip/mem_manager.h src/lwip/pbuf.h src/lwip/err.h \
- src/lwip/ip.h src/lwip/def.h src/lwip/ip_addr.h src/lwip/netif.h \
- src/lwip/icmp.h src/lwip/inet.h src/TcpServerSource.hpp
diff --git a/sparkfun/esp8266/firmwares/loader/src/main.o b/sparkfun/esp8266/firmwares/loader/src/main.o
deleted file mode 100644
index dbe7654b..00000000
Binary files a/sparkfun/esp8266/firmwares/loader/src/main.o and /dev/null differ
diff --git a/sparkfun/esp8266/firmwares/loader/src/user_config.h b/sparkfun/esp8266/firmwares/loader/src/user_config.h
deleted file mode 100644
index 8b137891..00000000
--- a/sparkfun/esp8266/firmwares/loader/src/user_config.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/sparkfun/esp8266/firmwares/loader/target.mk b/sparkfun/esp8266/firmwares/loader/target.mk
deleted file mode 100644
index 94a2329a..00000000
--- a/sparkfun/esp8266/firmwares/loader/target.mk
+++ /dev/null
@@ -1,111 +0,0 @@
-include $(TARGET_DIR)/lwip.mk
-
-TARGET_OBJ_FILES := main.o \
- uart.o \
- interface_commands.o \
- info_commands.o \
- wifi_commands.o \
- ip_commands.o \
- ip_commands_info.o \
- ip_commands_common.o \
- ip_commands_socket.o \
- config_store.o \
-
-
-TARGET_OBJ_PATHS := $(addprefix $(TARGET_DIR)/,$(TARGET_OBJ_FILES))
-
-TOOLCHAIN_PREFIX ?= xtensa-lx106-elf-
-XTENSA_TOOCHAIN := ../xtensa-lx106-elf/bin
-CC := $(TOOLCHAIN_PREFIX)gcc
-AR := $(TOOLCHAIN_PREFIX)ar
-LD := $(TOOLCHAIN_PREFIX)gcc
-OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy
-
-
-XTENSA_LIBS ?= $(shell $(CC) -print-sysroot)
-
-ESPTOOL ?= ../esptool/esptool
-
-SDK_BASE ?= ../esp_iot_sdk_v0.9.3
-
-SDK_EXAMPLE_DIR := $(SDK_BASE)/examples/IoT_Demo
-
-SDK_DRIVER_OBJ_FILES :=
-SDK_DRIVER_OBJ_PATHS := $(addprefix $(SDK_AT_DIR)/driver/,$(SDK_DRIVER_OBJ_FILES))
-
-CPPFLAGS += -I$(XTENSA_LIBS)/include \
- -I$(SDK_BASE)/include \
- -I$(TARGET_DIR) \
- -I$(LWIP_DIR)/include \
- -I$(SDK_EXAMPLE_DIR)/include
-
-LDFLAGS += -L$(XTENSA_LIBS)/lib \
- -L$(XTENSA_LIBS)/arch/lib \
- -L$(SDK_BASE)/lib
-
-CFLAGS+=-std=c99
-CPPFLAGS+=-DESP_PLATFORM=1
-
-LIBS := c gcc hal phy net80211 wpa main json ssl pp
-
-#-Werror
-CFLAGS += -Os -g -O2 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals -D__ets__ -DICACHE_FLASH
-
-LDFLAGS += -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
-
-LD_SCRIPT := $(SDK_BASE)/ld/eagle.app.v6.ld
-
-LWIP_AR:=$(BIN_DIR)/lwipc.a
-
-APP_AR:=$(BIN_DIR)/app.a
-APP_OUT:=$(BIN_DIR)/app.out
-APP_FW_1 := $(BIN_DIR)/0x00000.bin
-APP_FW_2 := $(BIN_DIR)/0x40000.bin
-FULL_FW := $(BIN_DIR)/firmware.bin
-
-$(LWIP_AR) : $(LWIP_OBJ_PATHS)
- for file in $(LWIP_OBJ_PATHS); do \
- $(OBJCOPY) \
- --rename-section .text=.irom0.text \
- --rename-section .literal=.irom0.literal \
- $$file; \
- done
- $(AR) cru $@ $^
-
-$(LWIP_AR): | $(BIN_DIR)
-
-$(APP_AR): $(COMMON_OBJ_PATHS) $(TARGET_OBJ_PATHS) $(SDK_DRIVER_OBJ_PATHS)
- $(AR) cru $@ $^
-
-$(APP_AR): | $(BIN_DIR)
-
-$(APP_OUT): $(APP_AR) $(LWIP_AR)
- $(LD) -T$(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(addprefix -l,$(LIBS)) $(APP_AR) $(LWIP_AR) -Wl,--end-group -o $@
-
-$(APP_FW_1): $(APP_OUT)
- $(ESPTOOL) -eo $(APP_OUT) -bo $@ -bs .text -bs .data -bs .rodata -bc -ec
-
-$(APP_FW_2): $(APP_OUT)
- $(ESPTOOL) -eo $(APP_OUT) -es .irom0.text $@ -ec
-
-$(FULL_FW): $(APP_FW_1) $(APP_FW_2)
- dd if=/dev/zero ibs=4k count=124 | LC_ALL=C tr "\000" "\377" >$(FULL_FW)
- dd if=$(APP_FW_1) of=$(FULL_FW) bs=4k seek=0 conv=notrunc
- dd if=$(APP_FW_2) of=$(FULL_FW) bs=4k seek=64 conv=notrunc
-
-firmware: $(APP_FW_1) $(APP_FW_2) $(FULL_FW)
-
-all: firmware
-
-clean-driver:
- rm -r $(SDK_DRIVER_OBJ_PATHS)
-
-clean-lwip:
- rm -rf $(LWIP_OBJ_PATHS)
- rm -rf $(LWIP_AR)
-
-clean: clean-lwip
-
-#clean: clean-driver
-
-.PHONY: all firmware
diff --git a/sparkfun/esp8266/libraries/.DS_Store b/sparkfun/esp8266/libraries/.DS_Store
deleted file mode 100644
index 78608c86..00000000
Binary files a/sparkfun/esp8266/libraries/.DS_Store and /dev/null differ
diff --git a/sparkfun/esp8266/libraries/EEPROM/EEPROM.cpp b/sparkfun/esp8266/libraries/EEPROM/EEPROM.cpp
deleted file mode 100644
index 2d8b23db..00000000
--- a/sparkfun/esp8266/libraries/EEPROM/EEPROM.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- EEPROM.cpp - esp8266 EEPROM emulation
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "Arduino.h"
-#include "EEPROM.h"
-
- extern "C" {
-#include "c_types.h"
-#include "ets_sys.h"
-#include "os_type.h"
-#include "osapi.h"
-#include "spi_flash.h"
-extern uint32_t _SPIFFS_end;
-}
-
-#define CONFIG_START_SECTOR (((uint32_t)_SPIFFS_end - 0x40200000) / 4096)
-#define CONFIG_SECTOR (CONFIG_START_SECTOR + 0)
-#define CONFIG_ADDR (SPI_FLASH_SEC_SIZE * CONFIG_SECTOR)
-
-EEPROMClass::EEPROMClass()
-: _data(0), _size(0), _dirty(false)
-{
-}
-
-void EEPROMClass::begin(size_t size)
-{
- if (size <= 0)
- return;
- if (size > SPI_FLASH_SEC_SIZE)
- size = SPI_FLASH_SEC_SIZE;
-
- _data = new uint8_t[size];
- _size = size;
-
- noInterrupts();
- spi_flash_read(CONFIG_ADDR, reinterpret_cast(_data), _size);
- interrupts();
-}
-
-void EEPROMClass::end()
-{
- if (!_size)
- return;
-
- commit();
- if(_data) {
- delete[] _data;
- }
- _data = 0;
- _size = 0;
-}
-
-
-uint8_t EEPROMClass::read(int address)
-{
- if (address < 0 || (size_t)address >= _size)
- return 0;
- if(!_data)
- return 0;
-
- return _data[address];
-}
-
-void EEPROMClass::write(int address, uint8_t value)
-{
- if (address < 0 || (size_t)address >= _size)
- return;
- if(!_data)
- return;
-
- _data[address] = value;
- _dirty = true;
-}
-
-bool EEPROMClass::commit()
-{
- bool ret = false;
- if (!_size)
- return false;
- if(!_dirty)
- return true;
- if(!_data)
- return false;
-
- noInterrupts();
- if(spi_flash_erase_sector(CONFIG_SECTOR) == SPI_FLASH_RESULT_OK) {
- if(spi_flash_write(CONFIG_ADDR, reinterpret_cast(_data), _size) == SPI_FLASH_RESULT_OK) {
- _dirty = false;
- ret = true;
- }
- }
- interrupts();
-
- return ret;
-}
-
-uint8_t * EEPROMClass::getDataPtr()
-{
- _dirty = true;
- return &_data[0];
-}
-
-
-EEPROMClass EEPROM;
diff --git a/sparkfun/esp8266/libraries/EEPROM/EEPROM.h b/sparkfun/esp8266/libraries/EEPROM/EEPROM.h
deleted file mode 100644
index 97dd4c26..00000000
--- a/sparkfun/esp8266/libraries/EEPROM/EEPROM.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- EEPROM.cpp - esp8266 EEPROM emulation
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef EEPROM_h
-#define EEPROM_h
-
-#include
-#include
-#include
-
-class EEPROMClass
-{
- public:
- EEPROMClass();
- void begin(size_t size);
- uint8_t read(int address);
- void write(int address, uint8_t val);
- bool commit();
- void end();
-
- uint8_t * getDataPtr();
-
- template T &get(int address, T &t)
- {
- if (address < 0 || address + sizeof(T) > _size)
- return t;
-
- uint8_t *ptr = (uint8_t*) &t;
- memcpy(ptr, _data + address, sizeof(T));
- return t;
- }
-
- template const T &put(int address, const T &t)
- {
- if (address < 0 || address + sizeof(T) > _size)
- return t;
-
- const uint8_t *ptr = (const uint8_t*) &t;
- memcpy(_data + address, ptr, sizeof(T));
- _dirty = true;
- return t;
- }
-
- protected:
- uint8_t* _data;
- size_t _size;
- bool _dirty;
-};
-
-extern EEPROMClass EEPROM;
-
-#endif
-
diff --git a/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino b/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino
deleted file mode 100644
index 98b7ad74..00000000
--- a/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * EEPROM Clear
- *
- * Sets all of the bytes of the EEPROM to 0.
- * This example code is in the public domain.
-
- */
-
-#include
-
-void setup()
-{
- EEPROM.begin(512);
- // write a 0 to all 512 bytes of the EEPROM
- for (int i = 0; i < 512; i++)
- EEPROM.write(i, 0);
-
- // turn the LED on when we're done
- pinMode(13, OUTPUT);
- digitalWrite(13, HIGH);
- EEPROM.end();
-}
-
-void loop()
-{
-}
diff --git a/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino b/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
deleted file mode 100644
index d1395b31..00000000
--- a/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * EEPROM Read
- *
- * Reads the value of each byte of the EEPROM and prints it
- * to the computer.
- * This example code is in the public domain.
- */
-
-#include
-
-// start reading from the first byte (address 0) of the EEPROM
-int address = 0;
-byte value;
-
-void setup()
-{
- // initialize serial and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
- EEPROM.begin(512);
-}
-
-void loop()
-{
- // read a byte from the current address of the EEPROM
- value = EEPROM.read(address);
-
- Serial.print(address);
- Serial.print("\t");
- Serial.print(value, DEC);
- Serial.println();
-
- // advance to the next address of the EEPROM
- address = address + 1;
-
- // there are only 512 bytes of EEPROM, from 0 to 511, so if we're
- // on address 512, wrap around to address 0
- if (address == 512)
- address = 0;
-
- delay(500);
-}
diff --git a/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_write/eeprom_write.ino b/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_write/eeprom_write.ino
deleted file mode 100644
index 3f1af8e4..00000000
--- a/sparkfun/esp8266/libraries/EEPROM/examples/eeprom_write/eeprom_write.ino
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * EEPROM Write
- *
- * Stores values read from analog input 0 into the EEPROM.
- * These values will stay in the EEPROM when the board is
- * turned off and may be retrieved later by another sketch.
- */
-
-#include
-
-// the current address in the EEPROM (i.e. which byte
-// we're going to write to next)
-int addr = 0;
-
-void setup()
-{
- EEPROM.begin(512);
-}
-
-void loop()
-{
- // need to divide by 4 because analog inputs range from
- // 0 to 1023 and each byte of the EEPROM can only hold a
- // value from 0 to 255.
- int val = analogRead(0) / 4;
-
- // write the value to the appropriate byte of the EEPROM.
- // these values will remain there when the board is
- // turned off.
- EEPROM.write(addr, val);
-
- // advance to the next address. there are 512 bytes in
- // the EEPROM, so go back to 0 when we hit 512.
- // save all changes to the flash.
- addr = addr + 1;
- if (addr == 512)
- {
- addr = 0;
- EEPROM.commit();
- }
-
- delay(100);
-}
diff --git a/sparkfun/esp8266/libraries/EEPROM/library.properties b/sparkfun/esp8266/libraries/EEPROM/library.properties
deleted file mode 100644
index fbd99086..00000000
--- a/sparkfun/esp8266/libraries/EEPROM/library.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-name=EEPROM
-version=1.0
-author=Ivan Grokhotkov
-maintainer=Ivan Grokhotkov
-sentence=Enables reading and writing data to the permanent FLASH storage, up to 4kb.
-paragraph=
-url=http://arduino.cc/en/Reference/EEPROM
-architectures=esp8266
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/.DS_Store b/sparkfun/esp8266/libraries/ESP8266WebServer/.DS_Store
deleted file mode 100644
index 5008ddfc..00000000
Binary files a/sparkfun/esp8266/libraries/ESP8266WebServer/.DS_Store and /dev/null differ
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino b/sparkfun/esp8266/libraries/ESP8266WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino
deleted file mode 100644
index 0ffdd717..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2015, Majenko Technologies
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * * Neither the name of Majenko Technologies nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include
-#include
-#include
-#include
-
-const char *ssid = "YourSSIDHere";
-const char *password = "YourPSKHere";
-MDNSResponder mdns;
-
-ESP8266WebServer server ( 80 );
-
-const int led = 13;
-
-void handleRoot() {
- digitalWrite ( led, 1 );
- char temp[400];
- int sec = millis() / 1000;
- int min = sec / 60;
- int hr = min / 60;
-
- snprintf ( temp, 400,
-
-"\
- \
- \
- ESP8266 Demo\
- \
- \
- \
- Hello from ESP8266!
\
- Uptime: %02d:%02d:%02d
\
-
\
- \
-",
-
- hr, min % 60, sec % 60
- );
- server.send ( 200, "text/html", temp );
- digitalWrite ( led, 0 );
-}
-
-void handleNotFound() {
- digitalWrite ( led, 1 );
- String message = "File Not Found\n\n";
- message += "URI: ";
- message += server.uri();
- message += "\nMethod: ";
- message += ( server.method() == HTTP_GET ) ? "GET" : "POST";
- message += "\nArguments: ";
- message += server.args();
- message += "\n";
-
- for ( uint8_t i = 0; i < server.args(); i++ ) {
- message += " " + server.argName ( i ) + ": " + server.arg ( i ) + "\n";
- }
-
- server.send ( 404, "text/plain", message );
- digitalWrite ( led, 0 );
-}
-
-void setup ( void ) {
- pinMode ( led, OUTPUT );
- digitalWrite ( led, 0 );
- Serial.begin ( 115200 );
- WiFi.begin ( ssid, password );
- Serial.println ( "" );
-
- // Wait for connection
- while ( WiFi.status() != WL_CONNECTED ) {
- delay ( 500 );
- Serial.print ( "." );
- }
-
- Serial.println ( "" );
- Serial.print ( "Connected to " );
- Serial.println ( ssid );
- Serial.print ( "IP address: " );
- Serial.println ( WiFi.localIP() );
-
- if ( mdns.begin ( "esp8266", WiFi.localIP() ) ) {
- Serial.println ( "MDNS responder started" );
- }
-
- server.on ( "/", handleRoot );
- server.on ( "/test.svg", drawGraph );
- server.on ( "/inline", []() {
- server.send ( 200, "text/plain", "this works as well" );
- } );
- server.onNotFound ( handleNotFound );
- server.begin();
- Serial.println ( "HTTP server started" );
-}
-
-void loop ( void ) {
- mdns.update();
- server.handleClient();
-}
-
-void drawGraph() {
- String out = "";
- char temp[100];
- out += "\n";
-
- server.send ( 200, "image/svg+xml", out);
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino b/sparkfun/esp8266/libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino
deleted file mode 100644
index 4264aeca..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/HelloServer/HelloServer.ino
+++ /dev/null
@@ -1,73 +0,0 @@
-#include
-#include
-#include
-#include
-
-const char* ssid = "........";
-const char* password = "........";
-MDNSResponder mdns;
-
-ESP8266WebServer server(80);
-
-const int led = 13;
-
-void handleRoot() {
- digitalWrite(led, 1);
- server.send(200, "text/plain", "hello from esp8266!");
- digitalWrite(led, 0);
-}
-
-void handleNotFound(){
- digitalWrite(led, 1);
- String message = "File Not Found\n\n";
- message += "URI: ";
- message += server.uri();
- message += "\nMethod: ";
- message += (server.method() == HTTP_GET)?"GET":"POST";
- message += "\nArguments: ";
- message += server.args();
- message += "\n";
- for (uint8_t i=0; i
-#include
-#include
-#include
-#include
-#include
-
-#define DBG_OUTPUT_PORT Serial
-
-const char* ssid = "**********";
-const char* password = "**********";
-const char* hostname = "esp8266sd";
-
-MDNSResponder mdns;
-ESP8266WebServer server(80);
-
-static bool hasSD = false;
-File uploadFile;
-
-
-void returnOK() {
- server.sendHeader("Connection", "close");
- server.sendHeader("Access-Control-Allow-Origin", "*");
- server.send(200, "text/plain", "");
-}
-
-void returnFail(String msg) {
- server.sendHeader("Connection", "close");
- server.sendHeader("Access-Control-Allow-Origin", "*");
- server.send(500, "text/plain", msg + "\r\n");
-}
-
-bool loadFromSdCard(String path){
- String dataType = "text/plain";
- if(path.endsWith("/")) path += "index.htm";
-
- if(path.endsWith(".src")) path = path.substring(0, path.lastIndexOf("."));
- else if(path.endsWith(".htm")) dataType = "text/html";
- else if(path.endsWith(".css")) dataType = "text/css";
- else if(path.endsWith(".js")) dataType = "application/javascript";
- else if(path.endsWith(".png")) dataType = "image/png";
- else if(path.endsWith(".gif")) dataType = "image/gif";
- else if(path.endsWith(".jpg")) dataType = "image/jpeg";
- else if(path.endsWith(".ico")) dataType = "image/x-icon";
- else if(path.endsWith(".xml")) dataType = "text/xml";
- else if(path.endsWith(".pdf")) dataType = "application/pdf";
- else if(path.endsWith(".zip")) dataType = "application/zip";
-
- File dataFile = SD.open(path.c_str());
- if(dataFile.isDirectory()){
- path += "/index.htm";
- dataType = "text/html";
- dataFile = SD.open(path.c_str());
- }
-
- if (!dataFile)
- return false;
-
- if(server.hasArg("download")) dataType = "application/octet-stream";
-
- server.sendHeader("Content-Length", String(dataFile.size()));
- server.sendHeader("Connection", "close");
- server.sendHeader("Access-Control-Allow-Origin", "*");
- server.send(200, dataType.c_str(), "");
-
- WiFiClient client = server.client();
- size_t totalSize = dataFile.size();
- if (client.write(dataFile, HTTP_DOWNLOAD_UNIT_SIZE) != totalSize) {
- DBG_OUTPUT_PORT.println("Sent less data than expected!");
- }
-
- dataFile.close();
- return true;
-}
-
-void handleFileUpload(){
- if(server.uri() != "/edit") return;
- HTTPUpload& upload = server.upload();
- if(upload.status == UPLOAD_FILE_START){
- if(SD.exists((char *)upload.filename.c_str())) SD.remove((char *)upload.filename.c_str());
- uploadFile = SD.open(upload.filename.c_str(), FILE_WRITE);
- DBG_OUTPUT_PORT.print("Upload: START, filename: "); DBG_OUTPUT_PORT.println(upload.filename);
- } else if(upload.status == UPLOAD_FILE_WRITE){
- if(uploadFile) uploadFile.write(upload.buf, upload.currentSize);
- DBG_OUTPUT_PORT.print("Upload: WRITE, Bytes: "); DBG_OUTPUT_PORT.println(upload.currentSize);
- } else if(upload.status == UPLOAD_FILE_END){
- if(uploadFile) uploadFile.close();
- DBG_OUTPUT_PORT.print("Upload: END, Size: "); DBG_OUTPUT_PORT.println(upload.totalSize);
- }
-}
-
-void deleteRecursive(String path){
- File file = SD.open((char *)path.c_str());
- if(!file.isDirectory()){
- file.close();
- SD.remove((char *)path.c_str());
- return;
- }
-
- file.rewindDirectory();
- while(true) {
- File entry = file.openNextFile();
- if (!entry) break;
- String entryPath = path + "/" +entry.name();
- if(entry.isDirectory()){
- entry.close();
- deleteRecursive(entryPath);
- } else {
- entry.close();
- SD.remove((char *)entryPath.c_str());
- }
- yield();
- }
-
- SD.rmdir((char *)path.c_str());
- file.close();
-}
-
-void handleDelete(){
- if(server.args() == 0) return returnFail("BAD ARGS");
- String path = server.arg(0);
- if(path == "/" || !SD.exists((char *)path.c_str())) {
- returnFail("BAD PATH");
- return;
- }
- deleteRecursive(path);
- returnOK();
-}
-
-void handleCreate(){
- if(server.args() == 0) return returnFail("BAD ARGS");
- String path = server.arg(0);
- if(path == "/" || SD.exists((char *)path.c_str())) {
- returnFail("BAD PATH");
- return;
- }
-
- if(path.indexOf('.') > 0){
- File file = SD.open((char *)path.c_str(), FILE_WRITE);
- if(file){
- file.write((const char *)0);
- file.close();
- }
- } else {
- SD.mkdir((char *)path.c_str());
- }
- returnOK();
-}
-
-void printDirectory() {
- if(!server.hasArg("dir")) return returnFail("BAD ARGS");
- String path = server.arg("dir");
- if(path != "/" && !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
- File dir = SD.open((char *)path.c_str());
- path = String();
- if(!dir.isDirectory()){
- dir.close();
- return returnFail("NOT DIR");
- }
- dir.rewindDirectory();
-
- server.send(200, "text/json", "");
- WiFiClient client = server.client();
-
- for (int cnt = 0; true; ++cnt) {
- File entry = dir.openNextFile();
- if (!entry)
- break;
-
- String output;
- if (cnt == 0)
- output = '[';
- else
- output = ',';
-
- output += "{\"type\":\"";
- output += (entry.isDirectory()) ? "dir" : "file";
- output += "\",\"name\":\"";
- output += entry.name();
- output += "\"";
- output += "}";
- server.sendContent(output);
- entry.close();
- }
- server.sendContent("]");
- dir.close();
-}
-
-void handleNotFound(){
- if(hasSD && loadFromSdCard(server.uri())) return;
- String message = "SDCARD Not Detected\n\n";
- message += "URI: ";
- message += server.uri();
- message += "\nMethod: ";
- message += (server.method() == HTTP_GET)?"GET":"POST";
- message += "\nArguments: ";
- message += server.args();
- message += "\n";
- for (uint8_t i=0; i
-#include
-#include
-#include
-#include
-#include
-
-#define DBG_OUTPUT_PORT Serial
-
-const char* ssid = "**********";
-const char* password = "**********";
-const char* hostname = "esp8266sd";
-
-MDNSResponder mdns;
-ESP8266WebServer server(80);
-
-static bool hasSD = false;
-File uploadFile;
-
-
-void returnOK() {
- server.sendHeader("Connection", "close");
- server.sendHeader("Access-Control-Allow-Origin", "*");
- server.send(200, "text/plain", "");
-}
-
-void returnFail(String msg) {
- server.sendHeader("Connection", "close");
- server.sendHeader("Access-Control-Allow-Origin", "*");
- server.send(500, "text/plain", msg + "\r\n");
-}
-
-bool loadFromSdCard(String path){
- String dataType = "text/plain";
- if(path.endsWith("/")) path += "index.htm";
-
- if(path.endsWith(".src")) path = path.substring(0, path.lastIndexOf("."));
- else if(path.endsWith(".htm")) dataType = "text/html";
- else if(path.endsWith(".css")) dataType = "text/css";
- else if(path.endsWith(".js")) dataType = "application/javascript";
- else if(path.endsWith(".png")) dataType = "image/png";
- else if(path.endsWith(".gif")) dataType = "image/gif";
- else if(path.endsWith(".jpg")) dataType = "image/jpeg";
- else if(path.endsWith(".ico")) dataType = "image/x-icon";
- else if(path.endsWith(".xml")) dataType = "text/xml";
- else if(path.endsWith(".pdf")) dataType = "application/pdf";
- else if(path.endsWith(".zip")) dataType = "application/zip";
-
- File dataFile = SD.open(path.c_str());
- if(dataFile.isDirectory()){
- path += "/index.htm";
- dataType = "text/html";
- dataFile = SD.open(path.c_str());
- }
-
- if (!dataFile)
- return false;
-
- if(server.hasArg("download")) dataType = "application/octet-stream";
-
-<<<<<<< HEAD
- server.sendHeader("Content-Length", String(dataFile.size()));
- server.sendHeader("Connection", "close");
- server.sendHeader("Access-Control-Allow-Origin", "*");
- server.send(200, dataType.c_str(), "");
-
- WiFiClient client = server.client();
- size_t totalSize = dataFile.size();
- if (client.write(dataFile, PAYLOAD_UNIT_SIZE) != totalSize) {
- DBG_OUTPUT_PORT.println("Sent less data than expected!");
-=======
- if (dataFile) {
- WiFiClient client = server.client();
- String head = "HTTP/1.1 200 OK\r\nContent-Type: ";
- head += dataType;
- head += "\r\nContent-Length: ";
- head += dataFile.size();
- head += "\r\nConnection: close";
- head += "\r\nAccess-Control-Allow-Origin: *";
- head += "\r\n\r\n";
- client.print(head);
- dataType = String();
- path = String();
-
- if(client.write(dataFile) != dataFile.size()){
- DBG_OUTPUT_PORT.println("Sent less data than expected!");
- }
-
- dataFile.close();
- client.stop();
- return true;
->>>>>>> ficeto-esp8266
- }
-
- dataFile.close();
- return true;
-}
-
-void handleFileUpload(){
- if(server.uri() != "/edit") return;
- HTTPUpload& upload = server.upload();
- if(upload.status == UPLOAD_FILE_START){
- if(SD.exists((char *)upload.filename.c_str())) SD.remove((char *)upload.filename.c_str());
- uploadFile = SD.open(upload.filename.c_str(), FILE_WRITE);
- DBG_OUTPUT_PORT.print("Upload: START, filename: "); DBG_OUTPUT_PORT.println(upload.filename);
- } else if(upload.status == UPLOAD_FILE_WRITE){
- if(uploadFile) uploadFile.write(upload.buf, upload.currentSize);
- DBG_OUTPUT_PORT.print("Upload: WRITE, Bytes: "); DBG_OUTPUT_PORT.println(upload.currentSize);
- } else if(upload.status == UPLOAD_FILE_END){
- if(uploadFile) uploadFile.close();
- DBG_OUTPUT_PORT.print("Upload: END, Size: "); DBG_OUTPUT_PORT.println(upload.totalSize);
- }
-}
-
-void deleteRecursive(String path){
- File file = SD.open((char *)path.c_str());
- if(!file.isDirectory()){
- file.close();
- SD.remove((char *)path.c_str());
- return;
- }
-
- file.rewindDirectory();
- while(true) {
- File entry = file.openNextFile();
- if (!entry) break;
- String entryPath = path + "/" +entry.name();
- if(entry.isDirectory()){
- entry.close();
- deleteRecursive(entryPath);
- } else {
- entry.close();
- SD.remove((char *)entryPath.c_str());
- }
- yield();
- }
-
- SD.rmdir((char *)path.c_str());
- file.close();
-}
-
-void handleDelete(){
- if(server.args() == 0) return returnFail("BAD ARGS");
- String path = server.arg(0);
- if(path == "/" || !SD.exists((char *)path.c_str())) {
- returnFail("BAD PATH");
- return;
- }
- deleteRecursive(path);
- returnOK();
-}
-
-void handleCreate(){
- if(server.args() == 0) return returnFail("BAD ARGS");
- String path = server.arg(0);
- if(path == "/" || SD.exists((char *)path.c_str())) {
- returnFail("BAD PATH");
- return;
- }
-
- if(path.indexOf('.') > 0){
- File file = SD.open((char *)path.c_str(), FILE_WRITE);
- if(file){
- file.write((const char *)0);
- file.close();
- }
- } else {
- SD.mkdir((char *)path.c_str());
- }
- returnOK();
-}
-
-void printDirectory() {
- if(!server.hasArg("dir")) return returnFail("BAD ARGS");
- String path = server.arg("dir");
- if(path != "/" && !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
- File dir = SD.open((char *)path.c_str());
- path = String();
- if(!dir.isDirectory()){
- dir.close();
- return returnFail("NOT DIR");
- }
- dir.rewindDirectory();
-
- server.send(200, "text/json", "");
- WiFiClient client = server.client();
-
- for (int cnt = 0; true; ++cnt) {
- File entry = dir.openNextFile();
- if (!entry)
- break;
-
- String output;
- if (cnt == 0)
- output = '[';
- else
- output = ',';
-
- output += "{\"type\":\"";
- output += (entry.isDirectory()) ? "dir" : "file";
- output += "\",\"name\":\"";
- output += entry.name();
- output += "\"";
- output += "}";
- server.sendContent(output);
- entry.close();
- }
- server.sendContent("]");
- dir.close();
-}
-
-void handleNotFound(){
- if(hasSD && loadFromSdCard(server.uri())) return;
- String message = "SDCARD Not Detected\n\n";
- message += "URI: ";
- message += server.uri();
- message += "\nMethod: ";
- message += (server.method() == HTTP_GET)?"GET":"POST";
- message += "\nArguments: ";
- message += server.args();
- message += "\n";
- for (uint8_t i=0; i
-
-
- SD Editor
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/index.htm b/sparkfun/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/index.htm
deleted file mode 100644
index 55fe5a66..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/index.htm
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- ESP Index
-
-
-
-
- ESP8266 Pin Functions
-
-
-
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/pins.png b/sparkfun/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/pins.png
deleted file mode 100644
index ac7fc0f9..00000000
Binary files a/sparkfun/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SdRoot/pins.png and /dev/null differ
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/keywords.txt b/sparkfun/esp8266/libraries/ESP8266WebServer/keywords.txt
deleted file mode 100644
index 6eee0f19..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/keywords.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-#######################################
-# Syntax Coloring Map For Ultrasound
-#######################################
-
-#######################################
-# Datatypes (KEYWORD1)
-#######################################
-
-ESP8266WebServer KEYWORD1
-HTTPMethod KEYWORD1
-
-#######################################
-# Methods and Functions (KEYWORD2)
-#######################################
-
-begin KEYWORD2
-handleClient KEYWORD2
-on KEYWORD2
-uri KEYWORD2
-method KEYWORD2
-client KEYWORD2
-send KEYWORD2
-arg KEYWORD2
-argName KEYWORD2
-args KEYWORD2
-hasArg KEYWORD2
-onNotFound KEYWORD2
-
-#######################################
-# Constants (LITERAL1)
-#######################################
-
-HTTP_GET LITERAL1
-HTTP_POST LITERAL1
-HTTP_ANY LITERAL1
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/library.properties b/sparkfun/esp8266/libraries/ESP8266WebServer/library.properties
deleted file mode 100644
index 4dd12d3b..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/library.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-name=ESP8266WebServer
-version=1.0
-author=Ivan Grokhotkov
-maintainer=Ivan Grokhtkov
-sentence=Simple web server library
-paragraph=The library supports HTTP GET and POST requests, provides argument parsing, handles one client at a time.
-category=Communication
-url=
-architectures=esp8266
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp b/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp
deleted file mode 100644
index 391cc556..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- ESP8266WebServer.cpp - Dead simple web-server.
- Supports only one simultaneous client, knows how to handle GET and POST.
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
-*/
-
-
-#include
-#include "WiFiServer.h"
-#include "WiFiClient.h"
-#include "ESP8266WebServer.h"
-
-// #define DEBUG
-#define DEBUG_OUTPUT Serial
-
-struct ESP8266WebServer::RequestHandler {
- RequestHandler(ESP8266WebServer::THandlerFunction fn, const char* uri, HTTPMethod method)
- : fn(fn)
- , uri(uri)
- , method(method)
- , next(NULL)
- {
- }
-
- ESP8266WebServer::THandlerFunction fn;
- String uri;
- HTTPMethod method;
- RequestHandler* next;
-
-};
-
-ESP8266WebServer::ESP8266WebServer(int port)
-: _server(port)
-, _firstHandler(0)
-, _lastHandler(0)
-, _currentArgCount(0)
-, _currentArgs(0)
-{
-}
-
-ESP8266WebServer::~ESP8266WebServer()
-{
- if (!_firstHandler)
- return;
- RequestHandler* handler = _firstHandler;
- while (handler) {
- RequestHandler* next = handler->next;
- delete handler;
- handler = next;
- }
-}
-
-void ESP8266WebServer::begin() {
- _server.begin();
-}
-
-
-void ESP8266WebServer::on(const char* uri, ESP8266WebServer::THandlerFunction handler)
-{
- on(uri, HTTP_ANY, handler);
-}
-
-void ESP8266WebServer::on(const char* uri, HTTPMethod method, ESP8266WebServer::THandlerFunction fn)
-{
- RequestHandler* handler = new RequestHandler(fn, uri, method);
- if (!_lastHandler) {
- _firstHandler = handler;
- _lastHandler = handler;
- }
- else {
- _lastHandler->next = handler;
- _lastHandler = handler;
- }
-}
-
-void ESP8266WebServer::handleClient()
-{
- WiFiClient client = _server.available();
- if (!client) {
- return;
- }
-
-#ifdef DEBUG
- DEBUG_OUTPUT.println("New client");
-#endif
-
- // Wait for data from client to become available
- while(client.connected() && !client.available()){
- delay(1);
- }
-
- if (!_parseRequest(client)) {
- return;
- }
-
- _currentClient = client;
- _handleRequest();
-}
-
-void ESP8266WebServer::sendHeader(String name, String value, bool first) {
- String headerLine = name;
- headerLine += ": ";
- headerLine += value;
- headerLine += "\r\n";
-
- if (first) {
- _responseHeaders = headerLine + _responseHeaders;
- }
- else {
- _responseHeaders += headerLine;
- }
-}
-
-void ESP8266WebServer::send(int code, const char* content_type, String content) {
- String response = "HTTP/1.1 ";
- response += String(code);
- response += " ";
- response += _responseCodeToString(code);
- response += "\r\n";
-
- if (!content_type)
- content_type = "text/html";
- sendHeader("Content-Type", content_type, true);
-
- response += _responseHeaders;
- response += "\r\n";
- response += content;
- _responseHeaders = String();
- sendContent(response);
-}
-
-void ESP8266WebServer::sendContent(String content) {
- size_t size_to_send = content.length();
- size_t size_sent = 0;
- while(size_to_send) {
- const size_t unit_size = HTTP_DOWNLOAD_UNIT_SIZE;
- size_t will_send = (size_to_send < unit_size) ? size_to_send : unit_size;
- size_t sent = _currentClient.write(content.c_str() + size_sent, will_send);
- size_to_send -= sent;
- size_sent += sent;
- if (sent == 0) {
- break;
- }
- }
-}
-
-String ESP8266WebServer::arg(const char* name) {
- for (int i = 0; i < _currentArgCount; ++i) {
- if (_currentArgs[i].key == name)
- return _currentArgs[i].value;
- }
- return String();
-}
-
-String ESP8266WebServer::arg(int i) {
- if (i < _currentArgCount)
- return _currentArgs[i].value;
- return String();
-}
-
-String ESP8266WebServer::argName(int i) {
- if (i < _currentArgCount)
- return _currentArgs[i].key;
- return String();
-}
-
-int ESP8266WebServer::args() {
- return _currentArgCount;
-}
-
-bool ESP8266WebServer::hasArg(const char* name) {
- for (int i = 0; i < _currentArgCount; ++i) {
- if (_currentArgs[i].key == name)
- return true;
- }
- return false;
-}
-
-void ESP8266WebServer::onFileUpload(THandlerFunction fn) {
- _fileUploadHandler = fn;
-}
-
-void ESP8266WebServer::onNotFound(THandlerFunction fn) {
- _notFoundHandler = fn;
-}
-
-void ESP8266WebServer::_handleRequest() {
- RequestHandler* handler;
- for (handler = _firstHandler; handler; handler = handler->next)
- {
- if (handler->method != HTTP_ANY && handler->method != _currentMethod)
- continue;
-
- if (handler->uri != _currentUri)
- continue;
-
- handler->fn();
- break;
- }
-
- if (!handler){
-#ifdef DEBUG
- DEBUG_OUTPUT.println("request handler not found");
-#endif
-
- if(_notFoundHandler) {
- _notFoundHandler();
- }
- else {
- send(404, "text/plain", String("Not found: ") + _currentUri);
- }
- }
-
- _currentClient = WiFiClient();
- _currentUri = String();
-}
-
-const char* ESP8266WebServer::_responseCodeToString(int code) {
- switch (code) {
- case 200: return "OK";
- case 404: return "Not found";
- case 500: return "Fail";
- default: return "";
- }
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp.orig b/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp.orig
deleted file mode 100644
index ab0c2981..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp.orig
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- ESP8266WebServer.cpp - Dead simple web-server.
- Supports only one simultaneous client, knows how to handle GET and POST.
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
-*/
-
-
-#include
-#include "WiFiServer.h"
-#include "WiFiClient.h"
-#include "ESP8266WebServer.h"
-
-// #define DEBUG
-#define DEBUG_OUTPUT Serial
-
-struct ESP8266WebServer::RequestHandler {
- RequestHandler(ESP8266WebServer::THandlerFunction fn, const char* uri, HTTPMethod method)
- : fn(fn)
- , uri(uri)
- , method(method)
- , next(NULL)
- {
- }
-
- ESP8266WebServer::THandlerFunction fn;
- String uri;
- HTTPMethod method;
- RequestHandler* next;
-
-};
-
-ESP8266WebServer::ESP8266WebServer(int port)
-: _server(port)
-, _firstHandler(0)
-, _lastHandler(0)
-, _currentArgCount(0)
-, _currentArgs(0)
-{
-}
-
-ESP8266WebServer::~ESP8266WebServer()
-{
- if (!_firstHandler)
- return;
- RequestHandler* handler = _firstHandler;
- while (handler) {
- RequestHandler* next = handler->next;
- delete handler;
- handler = next;
- }
-}
-
-void ESP8266WebServer::begin() {
- _server.begin();
-}
-
-
-void ESP8266WebServer::on(const char* uri, ESP8266WebServer::THandlerFunction handler)
-{
- on(uri, HTTP_ANY, handler);
-}
-
-void ESP8266WebServer::on(const char* uri, HTTPMethod method, ESP8266WebServer::THandlerFunction fn)
-{
- RequestHandler* handler = new RequestHandler(fn, uri, method);
- if (!_lastHandler) {
- _firstHandler = handler;
- _lastHandler = handler;
- }
- else {
- _lastHandler->next = handler;
- _lastHandler = handler;
- }
-}
-
-void ESP8266WebServer::handleClient()
-{
- WiFiClient client = _server.available();
- if (!client) {
- return;
- }
-
-#ifdef DEBUG
- DEBUG_OUTPUT.println("New client");
-#endif
-
- // Wait for data from client to become available
- while(client.connected() && !client.available()){
- delay(1);
- }
-
- if (!_parseRequest(client)) {
- return;
- }
-
- _currentClient = client;
- _handleRequest();
-}
-
-void ESP8266WebServer::sendHeader(String name, String value, bool first) {
- String headerLine = name;
- headerLine += ": ";
- headerLine += value;
- headerLine += "\r\n";
-
- if (first) {
- _responseHeaders = headerLine + _responseHeaders;
- }
- else {
- _responseHeaders += headerLine;
- }
-}
-
-void ESP8266WebServer::send(int code, const char* content_type, String content) {
- String response = "HTTP/1.1 ";
- response += String(code);
- response += " ";
- response += _responseCodeToString(code);
- response += "\r\n";
-
- if (!content_type)
- content_type = "text/html";
- sendHeader("Content-Type", content_type, true);
-
- response += _responseHeaders;
- response += "\r\n";
- response += content;
- _responseHeaders = String();
- sendContent(response);
-}
-
-void ESP8266WebServer::sendContent(String content) {
- size_t size_to_send = content.length();
- size_t size_sent = 0;
- while(size_to_send) {
- const size_t unit_size = PAYLOAD_UNIT_SIZE;
- size_t will_send = (size_to_send < unit_size) ? size_to_send : unit_size;
- size_t sent = _currentClient.write(content.c_str() + size_sent, will_send);
- size_to_send -= sent;
- size_sent += sent;
- if (sent == 0) {
- break;
- }
- }
-}
-
-String ESP8266WebServer::arg(const char* name) {
- for (int i = 0; i < _currentArgCount; ++i) {
- if (_currentArgs[i].key == name)
- return _currentArgs[i].value;
- }
- return String();
-}
-
-String ESP8266WebServer::arg(int i) {
- if (i < _currentArgCount)
- return _currentArgs[i].value;
- return String();
-}
-
-String ESP8266WebServer::argName(int i) {
- if (i < _currentArgCount)
- return _currentArgs[i].key;
- return String();
-}
-
-int ESP8266WebServer::args() {
- return _currentArgCount;
-}
-
-bool ESP8266WebServer::hasArg(const char* name) {
- for (int i = 0; i < _currentArgCount; ++i) {
- if (_currentArgs[i].key == name)
- return true;
- }
- return false;
-}
-
-<<<<<<< HEAD
-=======
-void ESP8266WebServer::_parseArguments(String data) {
-#ifdef DEBUG
- DEBUG_OUTPUT.print("args: ");
- DEBUG_OUTPUT.println(data);
-#endif
- if (_currentArgs)
- delete[] _currentArgs;
- _currentArgs = 0;
- if (data.length() == 0) {
- _currentArgCount = 0;
- return;
- }
- _currentArgCount = 1;
-
- for (int i = 0; i < data.length(); ) {
- i = data.indexOf('&', i);
- if (i == -1)
- break;
- ++i;
- ++_currentArgCount;
- }
-#ifdef DEBUG
- DEBUG_OUTPUT.print("args count: ");
- DEBUG_OUTPUT.println(_currentArgCount);
-#endif
-
- _currentArgs = new RequestArgument[_currentArgCount];
- int pos = 0;
- int iarg;
- for (iarg = 0; iarg < _currentArgCount;) {
- int equal_sign_index = data.indexOf('=', pos);
- int next_arg_index = data.indexOf('&', pos);
-#ifdef DEBUG
- DEBUG_OUTPUT.print("pos ");
- DEBUG_OUTPUT.print(pos);
- DEBUG_OUTPUT.print("=@ ");
- DEBUG_OUTPUT.print(equal_sign_index);
- DEBUG_OUTPUT.print(" &@ ");
- DEBUG_OUTPUT.println(next_arg_index);
-#endif
- if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) {
-#ifdef DEBUG
- DEBUG_OUTPUT.print("arg missing value: ");
- DEBUG_OUTPUT.println(iarg);
-#endif
- if (next_arg_index == -1)
- break;
- pos = next_arg_index + 1;
- continue;
- }
- RequestArgument& arg = _currentArgs[iarg];
- arg.key = data.substring(pos, equal_sign_index);
- arg.value = data.substring(equal_sign_index + 1, next_arg_index);
-#ifdef DEBUG
- DEBUG_OUTPUT.print("arg ");
- DEBUG_OUTPUT.print(iarg);
- DEBUG_OUTPUT.print(" key: ");
- DEBUG_OUTPUT.print(arg.key);
- DEBUG_OUTPUT.print(" value: ");
- DEBUG_OUTPUT.println(arg.value);
-#endif
- ++iarg;
- if (next_arg_index == -1)
- break;
- pos = next_arg_index + 1;
- }
- _currentArgCount = iarg;
-#ifdef DEBUG
- DEBUG_OUTPUT.print("args count: ");
- DEBUG_OUTPUT.println(_currentArgCount);
-#endif
-
-}
-
-void ESP8266WebServer::_uploadWriteByte(uint8_t b){
- if(_currentUpload.buflen == HTTP_UPLOAD_BUFLEN){
- if(_fileUploadHandler) _fileUploadHandler();
- _currentUpload.size += _currentUpload.buflen;
- _currentUpload.buflen = 0;
- }
- _currentUpload.buf[_currentUpload.buflen++] = b;
-}
-
-void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){
-
-#ifdef DEBUG
- DEBUG_OUTPUT.print("Parse Form: Boundary: ");
- DEBUG_OUTPUT.print(boundary);
- DEBUG_OUTPUT.print("Length: ");
- DEBUG_OUTPUT.println(len);
-#endif
- String line;
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- //start reading the form
- if(line == ("--"+boundary)){
- RequestArgument* postArgs = new RequestArgument[32];
- int postArgsLen = 0;
- while(1){
- String argName;
- String argValue;
- String argType;
- String argFilename;
- bool argIsFile = false;
-
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if(line.startsWith("Content-Disposition")){
- int nameStart = line.indexOf('=');
- if(nameStart != -1){
- argName = line.substring(nameStart+2);
- nameStart = argName.indexOf('=');
- if(nameStart == -1){
- argName = argName.substring(0, argName.length() - 1);
- } else {
- argFilename = argName.substring(nameStart+2, argName.length() - 1);
- argName = argName.substring(0, argName.indexOf('"'));
- argIsFile = true;
- #ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg FileName: ");
- DEBUG_OUTPUT.println(argFilename);
- #endif
- //use GET to set the filename if uploading using blob
- if(argFilename == "blob" && hasArg("filename")) argFilename = arg("filename");
- }
- #ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg Name: ");
- DEBUG_OUTPUT.println(argName);
- #endif
- argType = "text/plain";
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if(line.startsWith("Content-Type")){
- argType = line.substring(line.indexOf(':')+2);
- //skip next line
- client.readStringUntil('\r');
- client.readStringUntil('\n');
- }
- #ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg Type: ");
- DEBUG_OUTPUT.println(argType);
- #endif
- if(!argIsFile){
- while(1){
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if(line.startsWith("--"+boundary)) break;
- if(argValue.length() > 0) argValue += "\n";
- argValue += line;
- }
- #ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg Value: ");
- DEBUG_OUTPUT.println(argValue);
- DEBUG_OUTPUT.println();
- #endif
-
- RequestArgument& arg = postArgs[postArgsLen++];
- arg.key = argName;
- arg.value = argValue;
-
- if(line == ("--"+boundary+"--")){
- #ifdef DEBUG
- DEBUG_OUTPUT.println("Done Parsing POST");
- #endif
- break;
- }
- } else {
- _currentUpload.status = UPLOAD_FILE_START;
- _currentUpload.name = argName;
- _currentUpload.filename = argFilename;
- _currentUpload.type = argType;
- _currentUpload.size = 0;
- _currentUpload.buflen = 0;
-#ifdef DEBUG
- DEBUG_OUTPUT.print("Start File: ");
- DEBUG_OUTPUT.print(_currentUpload.filename);
- DEBUG_OUTPUT.print(" Type: ");
- DEBUG_OUTPUT.println(_currentUpload.type);
-#endif
- if(_fileUploadHandler) _fileUploadHandler();
- _currentUpload.status = UPLOAD_FILE_WRITE;
- uint8_t argByte = client.read();
-readfile:
- while(argByte != 0x0D){
- _uploadWriteByte(argByte);
- argByte = client.read();
- }
-
- argByte = client.read();
- if(argByte == 0x0A){
- argByte = client.read();
- if((char)argByte != '-'){
- //continue reading the file
- _uploadWriteByte(0x0D);
- _uploadWriteByte(0x0A);
- goto readfile;
- } else {
- argByte = client.read();
- if((char)argByte != '-'){
- //continue reading the file
- _uploadWriteByte(0x0D);
- _uploadWriteByte(0x0A);
- _uploadWriteByte((uint8_t)('-'));
- goto readfile;
- }
- }
-
- uint8_t endBuf[boundary.length()];
- client.readBytes(endBuf, boundary.length());
-
- if(strstr((const char*)endBuf, (const char*)(boundary.c_str())) != NULL){
- if(_fileUploadHandler) _fileUploadHandler();
- _currentUpload.size += _currentUpload.buflen;
- _currentUpload.status = UPLOAD_FILE_END;
- if(_fileUploadHandler) _fileUploadHandler();
-#ifdef DEBUG
- DEBUG_OUTPUT.print("End File: ");
- DEBUG_OUTPUT.print(_currentUpload.filename);
- DEBUG_OUTPUT.print(" Type: ");
- DEBUG_OUTPUT.print(_currentUpload.type);
- DEBUG_OUTPUT.print(" Size: ");
- DEBUG_OUTPUT.println(_currentUpload.size);
-#endif
- line = client.readStringUntil(0x0D);
- client.readStringUntil(0x0A);
- if(line == "--"){
-#ifdef DEBUG
- DEBUG_OUTPUT.println("Done Parsing POST");
-#endif
- break;
- }
- continue;
- } else {
- _uploadWriteByte(0x0D);
- _uploadWriteByte(0x0A);
- uint32_t i = 0;
- while(i < boundary.length()){
- _uploadWriteByte(endBuf[i++]);
- }
- argByte = client.read();
- goto readfile;
- }
- } else {
- _uploadWriteByte(0x0D);
- goto readfile;
- }
- break;
- }
- }
- }
- }
-
- int iarg;
- int totalArgs = ((32 - postArgsLen) < _currentArgCount)?(32 - postArgsLen):_currentArgCount;
- for (iarg = 0; iarg < totalArgs; iarg++){
- RequestArgument& arg = postArgs[postArgsLen++];
- arg.key = _currentArgs[iarg].key;
- arg.value = _currentArgs[iarg].value;
- }
- if (_currentArgs) delete[] _currentArgs;
- _currentArgs = new RequestArgument[postArgsLen];
- for (iarg = 0; iarg < postArgsLen; iarg++){
- RequestArgument& arg = _currentArgs[iarg];
- arg.key = postArgs[iarg].key;
- arg.value = postArgs[iarg].value;
- }
- _currentArgCount = iarg;
- if (postArgs) delete[] postArgs;
- }
-}
-
->>>>>>> ficeto-esp8266
-void ESP8266WebServer::onFileUpload(THandlerFunction fn) {
- _fileUploadHandler = fn;
-}
-
-void ESP8266WebServer::onNotFound(THandlerFunction fn) {
- _notFoundHandler = fn;
-}
-
-void ESP8266WebServer::_handleRequest() {
- RequestHandler* handler;
- for (handler = _firstHandler; handler; handler = handler->next)
- {
- if (handler->method != HTTP_ANY && handler->method != _currentMethod)
- continue;
-
- if (handler->uri != _currentUri)
- continue;
-
- handler->fn();
- break;
- }
-
- if (!handler){
-#ifdef DEBUG
- DEBUG_OUTPUT.println("request handler not found");
-#endif
-
- if(_notFoundHandler) {
- _notFoundHandler();
- }
- else {
- send(404, "text/plain", String("Not found: ") + _currentUri);
- }
- }
-
- _currentClient = WiFiClient();
- _currentUri = String();
-}
-
-const char* ESP8266WebServer::_responseCodeToString(int code) {
- switch (code) {
- case 200: return "OK";
- case 404: return "Not found";
- case 500: return "Fail";
- default: return "";
- }
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h b/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h
deleted file mode 100644
index d957e15b..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- ESP8266WebServer.h - Dead simple web-server.
- Supports only one simultaneous client, knows how to handle GET and POST.
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
-*/
-
-
-#ifndef ESP8266WEBSERVER_H
-#define ESP8266WEBSERVER_H
-
-#include
-
-enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE };
-enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END };
-
-#define HTTP_DOWNLOAD_UNIT_SIZE 1460
-#define HTTP_UPLOAD_BUFLEN 2048
-
-typedef struct {
- HTTPUploadStatus status;
- String filename;
- String name;
- String type;
- size_t totalSize; // file size
- size_t currentSize; // size of data currently in buf
- uint8_t buf[HTTP_UPLOAD_BUFLEN];
-} HTTPUpload;
-
-class ESP8266WebServer
-{
-public:
- ESP8266WebServer(int port = 80);
- ~ESP8266WebServer();
-
- void begin();
- void handleClient();
-
- typedef std::function THandlerFunction;
- void on(const char* uri, THandlerFunction handler);
- void on(const char* uri, HTTPMethod method, THandlerFunction fn);
- void onNotFound(THandlerFunction fn); //called when handler is not assigned
- void onFileUpload(THandlerFunction fn); //handle file uploads
-
- String uri() { return _currentUri; }
- HTTPMethod method() { return _currentMethod; }
- WiFiClient client() { return _currentClient; }
- HTTPUpload& upload() { return _currentUpload; }
-
- String arg(const char* name); // get request argument value by name
- String arg(int i); // get request argument value by number
- String argName(int i); // get request argument name by number
- int args(); // get arguments count
- bool hasArg(const char* name); // check if argument exists
-
- // send response to the client
- // code - HTTP response code, can be 200 or 404
- // content_type - HTTP content type, like "text/plain" or "image/png"
- // content - actual content body
- void send(int code, const char* content_type = NULL, String content = String(""));
-
- void sendHeader(String name, String value, bool first = false);
- void sendContent(String content);
-
-template size_t streamFile(T &file, String contentType){
- String head = "HTTP/1.1 200 OK\r\nContent-Type: ";
- head += contentType;
- head += "\r\nContent-Length: ";
- head += file.size();
- head += "\r\nConnection: close";
- head += "\r\nAccess-Control-Allow-Origin: *";
- head += "\r\n\r\n";
- _currentClient.print(head);
- head = String();
- return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE);
-}
-
-protected:
- void _handleRequest();
- bool _parseRequest(WiFiClient& client);
- void _parseArguments(String data);
- static const char* _responseCodeToString(int code);
- void _parseForm(WiFiClient& client, String boundary, uint32_t len);
- void _uploadWriteByte(uint8_t b);
- uint8_t _uploadReadByte(WiFiClient& client);
-
- struct RequestHandler;
- struct RequestArgument {
- String key;
- String value;
- };
-
- WiFiServer _server;
-
- WiFiClient _currentClient;
- HTTPMethod _currentMethod;
- String _currentUri;
-
- size_t _currentArgCount;
- RequestArgument* _currentArgs;
- HTTPUpload _currentUpload;
-
- String _responseHeaders;
-
- RequestHandler* _firstHandler;
- RequestHandler* _lastHandler;
- THandlerFunction _notFoundHandler;
- THandlerFunction _fileUploadHandler;
-
-};
-
-
-#endif //ESP8266WEBSERVER_H
diff --git a/sparkfun/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp b/sparkfun/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp
deleted file mode 100644
index 40a58d24..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- Parsing.cpp - HTTP request parsing.
-
- Copyright (c) 2015 Ivan Grokhotkov. All rights reserved.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Modified 8 May 2015 by Hristo Gochkov (proper post and file upload handling)
-*/
-
-#include
-#include "WiFiServer.h"
-#include "WiFiClient.h"
-#include "ESP8266WebServer.h"
-
-// #define DEBUG
-#define DEBUG_OUTPUT Serial1
-
-bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
- // Read the first line of HTTP request
- String req = client.readStringUntil('\r');
- client.readStringUntil('\n');
-
- // First line of HTTP request looks like "GET /path HTTP/1.1"
- // Retrieve the "/path" part by finding the spaces
- int addr_start = req.indexOf(' ');
- int addr_end = req.indexOf(' ', addr_start + 1);
- if (addr_start == -1 || addr_end == -1) {
-#ifdef DEBUG
- DEBUG_OUTPUT.print("Invalid request: ");
- DEBUG_OUTPUT.println(req);
-#endif
- return false;
- }
-
- String methodStr = req.substring(0, addr_start);
- String url = req.substring(addr_start + 1, addr_end);
- String searchStr = "";
- int hasSearch = url.indexOf('?');
- if (hasSearch != -1){
- searchStr = url.substring(hasSearch + 1);
- url = url.substring(0, hasSearch);
- }
- _currentUri = url;
-
- HTTPMethod method = HTTP_GET;
- if (methodStr == "POST") {
- method = HTTP_POST;
- } else if (methodStr == "DELETE") {
- method = HTTP_DELETE;
- } else if (methodStr == "PUT") {
- method = HTTP_PUT;
- } else if (methodStr == "PATCH") {
- method = HTTP_PATCH;
- }
- _currentMethod = method;
-
-#ifdef DEBUG
- DEBUG_OUTPUT.print("method: ");
- DEBUG_OUTPUT.print(methodStr);
- DEBUG_OUTPUT.print(" url: ");
- DEBUG_OUTPUT.print(url);
- DEBUG_OUTPUT.print(" search: ");
- DEBUG_OUTPUT.println(searchStr);
-#endif
-
- String formData;
- // below is needed only when POST type request
- if (method == HTTP_POST || method == HTTP_PUT || method == HTTP_PATCH || method == HTTP_DELETE){
- String boundaryStr;
- String headerName;
- String headerValue;
- bool isForm = false;
- uint32_t contentLength = 0;
- //parse headers
- while(1){
- req = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if (req == "") break;//no moar headers
- int headerDiv = req.indexOf(':');
- if (headerDiv == -1){
- break;
- }
- headerName = req.substring(0, headerDiv);
- headerValue = req.substring(headerDiv + 2);
- if (headerName == "Content-Type"){
- if (headerValue.startsWith("text/plain")){
- isForm = false;
- } else if (headerValue.startsWith("multipart/form-data")){
- boundaryStr = headerValue.substring(headerValue.indexOf('=')+1);
- isForm = true;
- }
- } else if (headerName == "Content-Length"){
- contentLength = headerValue.toInt();
- }
- }
-
- if (!isForm){
- if (searchStr != "") searchStr += '&';
- searchStr += client.readStringUntil('\r');
- client.readStringUntil('\n');
- }
- _parseArguments(searchStr);
- if (isForm){
- _parseForm(client, boundaryStr, contentLength);
- }
- } else {
- _parseArguments(searchStr);
- }
- client.flush();
-
-#ifdef DEBUG
- DEBUG_OUTPUT.print("Request: ");
- DEBUG_OUTPUT.println(url);
- DEBUG_OUTPUT.print(" Arguments: ");
- DEBUG_OUTPUT.println(searchStr);
-#endif
-
- return true;
-}
-
-
-void ESP8266WebServer::_parseArguments(String data) {
-#ifdef DEBUG
- DEBUG_OUTPUT.print("args: ");
- DEBUG_OUTPUT.println(data);
-#endif
- if (_currentArgs)
- delete[] _currentArgs;
- _currentArgs = 0;
- if (data.length() == 0) {
- _currentArgCount = 0;
- return;
- }
- _currentArgCount = 1;
-
- for (int i = 0; i < data.length(); ) {
- i = data.indexOf('&', i);
- if (i == -1)
- break;
- ++i;
- ++_currentArgCount;
- }
-#ifdef DEBUG
- DEBUG_OUTPUT.print("args count: ");
- DEBUG_OUTPUT.println(_currentArgCount);
-#endif
-
- _currentArgs = new RequestArgument[_currentArgCount];
- int pos = 0;
- int iarg;
- for (iarg = 0; iarg < _currentArgCount;) {
- int equal_sign_index = data.indexOf('=', pos);
- int next_arg_index = data.indexOf('&', pos);
-#ifdef DEBUG
- DEBUG_OUTPUT.print("pos ");
- DEBUG_OUTPUT.print(pos);
- DEBUG_OUTPUT.print("=@ ");
- DEBUG_OUTPUT.print(equal_sign_index);
- DEBUG_OUTPUT.print(" &@ ");
- DEBUG_OUTPUT.println(next_arg_index);
-#endif
- if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) {
-#ifdef DEBUG
- DEBUG_OUTPUT.print("arg missing value: ");
- DEBUG_OUTPUT.println(iarg);
-#endif
- if (next_arg_index == -1)
- break;
- pos = next_arg_index + 1;
- continue;
- }
- RequestArgument& arg = _currentArgs[iarg];
- arg.key = data.substring(pos, equal_sign_index);
- arg.value = data.substring(equal_sign_index + 1, next_arg_index);
-#ifdef DEBUG
- DEBUG_OUTPUT.print("arg ");
- DEBUG_OUTPUT.print(iarg);
- DEBUG_OUTPUT.print(" key: ");
- DEBUG_OUTPUT.print(arg.key);
- DEBUG_OUTPUT.print(" value: ");
- DEBUG_OUTPUT.println(arg.value);
-#endif
- ++iarg;
- if (next_arg_index == -1)
- break;
- pos = next_arg_index + 1;
- }
- _currentArgCount = iarg;
-#ifdef DEBUG
- DEBUG_OUTPUT.print("args count: ");
- DEBUG_OUTPUT.println(_currentArgCount);
-#endif
-
-}
-
-void ESP8266WebServer::_uploadWriteByte(uint8_t b){
- if (_currentUpload.currentSize == HTTP_UPLOAD_BUFLEN){
- if (_fileUploadHandler) _fileUploadHandler();
- _currentUpload.totalSize += _currentUpload.currentSize;
- _currentUpload.currentSize = 0;
- }
- _currentUpload.buf[_currentUpload.currentSize++] = b;
-}
-
-uint8_t ESP8266WebServer::_uploadReadByte(WiFiClient& client){
- int res = client.read();
- if(res == -1){
- while(!client.available())
- yield();
- res = client.read();
- }
- return (uint8_t)res;
-}
-
-void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){
-
-#ifdef DEBUG
- DEBUG_OUTPUT.print("Parse Form: Boundary: ");
- DEBUG_OUTPUT.print(boundary);
- DEBUG_OUTPUT.print(" Length: ");
- DEBUG_OUTPUT.println(len);
-#endif
- String line;
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- //start reading the form
- if (line == ("--"+boundary)){
- RequestArgument* postArgs = new RequestArgument[32];
- int postArgsLen = 0;
- while(1){
- String argName;
- String argValue;
- String argType;
- String argFilename;
- bool argIsFile = false;
-
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if (line.startsWith("Content-Disposition")){
- int nameStart = line.indexOf('=');
- if (nameStart != -1){
- argName = line.substring(nameStart+2);
- nameStart = argName.indexOf('=');
- if (nameStart == -1){
- argName = argName.substring(0, argName.length() - 1);
- } else {
- argFilename = argName.substring(nameStart+2, argName.length() - 1);
- argName = argName.substring(0, argName.indexOf('"'));
- argIsFile = true;
-#ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg FileName: ");
- DEBUG_OUTPUT.println(argFilename);
-#endif
- //use GET to set the filename if uploading using blob
- if (argFilename == "blob" && hasArg("filename")) argFilename = arg("filename");
- }
-#ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg Name: ");
- DEBUG_OUTPUT.println(argName);
-#endif
- argType = "text/plain";
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if (line.startsWith("Content-Type")){
- argType = line.substring(line.indexOf(':')+2);
- //skip next line
- client.readStringUntil('\r');
- client.readStringUntil('\n');
- }
-#ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg Type: ");
- DEBUG_OUTPUT.println(argType);
-#endif
- if (!argIsFile){
- while(1){
- line = client.readStringUntil('\r');
- client.readStringUntil('\n');
- if (line.startsWith("--"+boundary)) break;
- if (argValue.length() > 0) argValue += "\n";
- argValue += line;
- }
-#ifdef DEBUG
- DEBUG_OUTPUT.print("PostArg Value: ");
- DEBUG_OUTPUT.println(argValue);
- DEBUG_OUTPUT.println();
-#endif
-
- RequestArgument& arg = postArgs[postArgsLen++];
- arg.key = argName;
- arg.value = argValue;
-
- if (line == ("--"+boundary+"--")){
-#ifdef DEBUG
- DEBUG_OUTPUT.println("Done Parsing POST");
-#endif
- break;
- }
- } else {
- _currentUpload.status = UPLOAD_FILE_START;
- _currentUpload.name = argName;
- _currentUpload.filename = argFilename;
- _currentUpload.type = argType;
- _currentUpload.totalSize = 0;
- _currentUpload.currentSize = 0;
-#ifdef DEBUG
- DEBUG_OUTPUT.print("Start File: ");
- DEBUG_OUTPUT.print(_currentUpload.filename);
- DEBUG_OUTPUT.print(" Type: ");
- DEBUG_OUTPUT.println(_currentUpload.type);
-#endif
- if (_fileUploadHandler) _fileUploadHandler();
- _currentUpload.status = UPLOAD_FILE_WRITE;
- uint8_t argByte = _uploadReadByte(client);
-readfile:
- while(argByte != 0x0D){
- _uploadWriteByte(argByte);
- argByte = _uploadReadByte(client);
- }
-
- argByte = _uploadReadByte(client);
- if (argByte == 0x0A){
- argByte = _uploadReadByte(client);
- if ((char)argByte != '-'){
- //continue reading the file
- _uploadWriteByte(0x0D);
- _uploadWriteByte(0x0A);
- goto readfile;
- } else {
- argByte = _uploadReadByte(client);
- if ((char)argByte != '-'){
- //continue reading the file
- _uploadWriteByte(0x0D);
- _uploadWriteByte(0x0A);
- _uploadWriteByte((uint8_t)('-'));
- goto readfile;
- }
- }
-
- uint8_t endBuf[boundary.length()];
- client.readBytes(endBuf, boundary.length());
-
- if (strstr((const char*)endBuf, boundary.c_str()) != NULL){
- if (_fileUploadHandler) _fileUploadHandler();
- _currentUpload.totalSize += _currentUpload.currentSize;
- _currentUpload.status = UPLOAD_FILE_END;
- if (_fileUploadHandler) _fileUploadHandler();
-#ifdef DEBUG
- DEBUG_OUTPUT.print("End File: ");
- DEBUG_OUTPUT.print(_currentUpload.filename);
- DEBUG_OUTPUT.print(" Type: ");
- DEBUG_OUTPUT.print(_currentUpload.type);
- DEBUG_OUTPUT.print(" Size: ");
- DEBUG_OUTPUT.println(_currentUpload.totalSize);
-#endif
- line = client.readStringUntil(0x0D);
- client.readStringUntil(0x0A);
- if (line == "--"){
-#ifdef DEBUG
- DEBUG_OUTPUT.println("Done Parsing POST");
-#endif
- break;
- }
- continue;
- } else {
- _uploadWriteByte(0x0D);
- _uploadWriteByte(0x0A);
- _uploadWriteByte((uint8_t)('-'));
- _uploadWriteByte((uint8_t)('-'));
- uint32_t i = 0;
- while(i < boundary.length()){
- _uploadWriteByte(endBuf[i++]);
- }
- argByte = _uploadReadByte(client);
- goto readfile;
- }
- } else {
- _uploadWriteByte(0x0D);
- goto readfile;
- }
- break;
- }
- }
- }
- }
-
- int iarg;
- int totalArgs = ((32 - postArgsLen) < _currentArgCount)?(32 - postArgsLen):_currentArgCount;
- for (iarg = 0; iarg < totalArgs; iarg++){
- RequestArgument& arg = postArgs[postArgsLen++];
- arg.key = _currentArgs[iarg].key;
- arg.value = _currentArgs[iarg].value;
- }
- if (_currentArgs) delete[] _currentArgs;
- _currentArgs = new RequestArgument[postArgsLen];
- for (iarg = 0; iarg < postArgsLen; iarg++){
- RequestArgument& arg = _currentArgs[iarg];
- arg.key = postArgs[iarg].key;
- arg.value = postArgs[iarg].value;
- }
- _currentArgCount = iarg;
- if (postArgs) delete[] postArgs;
- }
-}
-
-
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/.DS_Store b/sparkfun/esp8266/libraries/ESP8266WiFi/.DS_Store
deleted file mode 100644
index 94e8e06d..00000000
Binary files a/sparkfun/esp8266/libraries/ESP8266WiFi/.DS_Store and /dev/null differ
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/.DS_Store b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/.DS_Store
deleted file mode 100644
index 5008ddfc..00000000
Binary files a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/.DS_Store and /dev/null differ
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/NTPClient/NTPClient.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/NTPClient/NTPClient.ino
deleted file mode 100644
index 4a9771b5..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/NTPClient/NTPClient.ino
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-
- Udp NTP Client
-
- Get the time from a Network Time Protocol (NTP) time server
- Demonstrates use of UDP sendPacket and ReceivePacket
- For more on NTP time servers and the messages needed to communicate with them,
- see http://en.wikipedia.org/wiki/Network_Time_Protocol
-
- created 4 Sep 2010
- by Michael Margolis
- modified 9 Apr 2012
- by Tom Igoe
- updated for the ESP8266 12 Apr 2015
- by Ivan Grokhotkov
-
- This code is in the public domain.
-
- */
-
-#include
-#include
-
-char ssid[] = "*************"; // your network SSID (name)
-char pass[] = "********"; // your network password
-
-
-unsigned int localPort = 2390; // local port to listen for UDP packets
-
-IPAddress timeServer(129, 6, 15, 28); // time.nist.gov NTP server
-
-const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
-
-byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
-
-// A UDP instance to let us send and receive packets over UDP
-WiFiUDP udp;
-
-void setup()
-{
- Serial.begin(115200);
- Serial.println();
- Serial.println();
-
- // We start by connecting to a WiFi network
- Serial.print("Connecting to ");
- Serial.println(ssid);
- WiFi.begin(ssid, pass);
-
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
-
- Serial.println("WiFi connected");
- Serial.println("IP address: ");
- Serial.println(WiFi.localIP());
-
- Serial.println("Starting UDP");
- udp.begin(localPort);
- Serial.print("Local port: ");
- Serial.println(udp.localPort());
-}
-
-void loop()
-{
- sendNTPpacket(timeServer); // send an NTP packet to a time server
- // wait to see if a reply is available
- delay(1000);
-
- int cb = udp.parsePacket();
- if (!cb) {
- Serial.println("no packet yet");
- }
- else {
- Serial.print("packet received, length=");
- Serial.println(cb);
- // We've received a packet, read the data from it
- udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer
-
- //the timestamp starts at byte 40 of the received packet and is four bytes,
- // or two words, long. First, esxtract the two words:
-
- unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
- unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
- // combine the four bytes (two words) into a long integer
- // this is NTP time (seconds since Jan 1 1900):
- unsigned long secsSince1900 = highWord << 16 | lowWord;
- Serial.print("Seconds since Jan 1 1900 = " );
- Serial.println(secsSince1900);
-
- // now convert NTP time into everyday time:
- Serial.print("Unix time = ");
- // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
- const unsigned long seventyYears = 2208988800UL;
- // subtract seventy years:
- unsigned long epoch = secsSince1900 - seventyYears;
- // print Unix time:
- Serial.println(epoch);
-
-
- // print the hour, minute and second:
- Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
- Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
- Serial.print(':');
- if ( ((epoch % 3600) / 60) < 10 ) {
- // In the first 10 minutes of each hour, we'll want a leading '0'
- Serial.print('0');
- }
- Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
- Serial.print(':');
- if ( (epoch % 60) < 10 ) {
- // In the first 10 seconds of each minute, we'll want a leading '0'
- Serial.print('0');
- }
- Serial.println(epoch % 60); // print the second
- }
- // wait ten seconds before asking for the time again
- delay(10000);
-}
-
-// send an NTP request to the time server at the given address
-unsigned long sendNTPpacket(IPAddress& address)
-{
- Serial.println("sending NTP packet...");
- // set all bytes in the buffer to 0
- memset(packetBuffer, 0, NTP_PACKET_SIZE);
- // Initialize values needed to form NTP request
- // (see URL above for details on the packets)
- packetBuffer[0] = 0b11100011; // LI, Version, Mode
- packetBuffer[1] = 0; // Stratum, or type of clock
- packetBuffer[2] = 6; // Polling Interval
- packetBuffer[3] = 0xEC; // Peer Clock Precision
- // 8 bytes of zero for Root Delay & Root Dispersion
- packetBuffer[12] = 49;
- packetBuffer[13] = 0x4E;
- packetBuffer[14] = 49;
- packetBuffer[15] = 52;
-
- // all NTP fields have been given values, now
- // you can send a packet requesting a timestamp:
- udp.beginPacket(address, 123); //NTP requests are to port 123
- udp.write(packetBuffer, NTP_PACKET_SIZE);
- udp.endPacket();
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino
deleted file mode 100644
index 9bd39006..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiAccessPoint/WiFiAccessPoint.ino
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2015, Majenko Technologies
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * * Neither the name of Majenko Technologies nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Create a WiFi access point and provide a web server on it. */
-
-#include
-#include
-#include
-
-/* Set these to your desired credentials. */
-const char *ssid = "ESPap";
-const char *password = "thereisnospoon";
-
-ESP8266WebServer server(80);
-
-/* Just a little test message. Go to http://192.168.4.1 in a web browser
- * connected to this access point to see it.
- */
-void handleRoot() {
- server.send(200, "text/html", "You are connected
");
-}
-
-void setup() {
- delay(1000);
- Serial.begin(115200);
- Serial.println();
- Serial.print("Configuring access point...");
- /* You can remove the password parameter if you want the AP to be open. */
- WiFi.softAP(ssid, password);
-
- while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
-
- Serial.println("done");
- IPAddress myIP = WiFi.softAPIP();
- Serial.print("AP IP address: ");
- Serial.println(myIP);
- server.on("/", handleRoot);
- server.begin();
- Serial.println("HTTP server started");
-}
-
-void loop() {
- server.handleClient();
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino
deleted file mode 100644
index 7ffc78ac..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * This sketch sends data via HTTP GET requests to data.sparkfun.com service.
- *
- * You need to get streamId and privateKey at data.sparkfun.com and paste them
- * below. Or just customize this script to talk to other HTTP servers.
- *
- */
-
-#include
-
-const char* ssid = "your-ssid";
-const char* password = "your-password";
-
-const char* host = "data.sparkfun.com";
-const char* streamId = "....................";
-const char* privateKey = "....................";
-
-void setup() {
- Serial.begin(115200);
- delay(10);
-
- // We start by connecting to a WiFi network
-
- Serial.println();
- Serial.println();
- Serial.print("Connecting to ");
- Serial.println(ssid);
-
- WiFi.begin(ssid, password);
-
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
-
- Serial.println("");
- Serial.println("WiFi connected");
- Serial.println("IP address: ");
- Serial.println(WiFi.localIP());
-}
-
-int value = 0;
-
-void loop() {
- delay(5000);
- ++value;
-
- Serial.print("connecting to ");
- Serial.println(host);
-
- // Use WiFiClient class to create TCP connections
- WiFiClient client;
- const int httpPort = 80;
- if (!client.connect(host, httpPort)) {
- Serial.println("connection failed");
- return;
- }
-
- // We now create a URI for the request
- String url = "/input/";
- url += streamId;
- url += "?private_key=";
- url += privateKey;
- url += "&value=";
- url += value;
-
- Serial.print("Requesting URL: ");
- Serial.println(url);
-
- // This will send the request to the server
- client.print(String("GET ") + url + " HTTP/1.1\r\n" +
- "Host: " + host + "\r\n" +
- "Connection: close\r\n\r\n");
- delay(10);
-
- // Read all the lines of the reply from server and print them to Serial
- while(client.available()){
- String line = client.readStringUntil('\r');
- Serial.print(line);
- }
-
- Serial.println();
- Serial.println("closing connection");
-}
-
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino
deleted file mode 100644
index 70803254..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This sketch trys to Connect to the best AP based on a given list
- *
- */
-
-#include
-#include
-
-ESP8266WiFiMulti wifiMulti;
-
-void setup() {
- Serial.begin(115200);
- delay(10);
-
- wifiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1");
- wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2");
- wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");
-
- Serial.println("Connecting Wifi...");
- if(wifiMulti.run() == WL_CONNECTED) {
- Serial.println("");
- Serial.println("WiFi connected");
- Serial.println("IP address: ");
- Serial.println(WiFi.localIP());
- }
-}
-
-void loop() {
- if(wifiMulti.run() != WL_CONNECTED) {
- Serial.println("WiFi not connected!");
- delay(1000);
- }
-}
\ No newline at end of file
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino
deleted file mode 100644
index 3e6ff736..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiScan/WiFiScan.ino
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This sketch demonstrates how to scan WiFi networks.
- * The API is almost the same as with the WiFi Shield library,
- * the most obvious difference being the different file you need to include:
- */
-#include "ESP8266WiFi.h"
-
-void setup() {
- Serial.begin(115200);
-
- // Set WiFi to station mode and disconnect from an AP if it was previously connected
- WiFi.mode(WIFI_STA);
- WiFi.disconnect();
- delay(100);
-
- Serial.println("Setup done");
-}
-
-void loop() {
- Serial.println("scan start");
-
- // WiFi.scanNetworks will return the number of networks found
- int n = WiFi.scanNetworks();
- Serial.println("scan done");
- if (n == 0)
- Serial.println("no networks found");
- else
- {
- Serial.print(n);
- Serial.println(" networks found");
- for (int i = 0; i < n; ++i)
- {
- // Print SSID and RSSI for each network found
- Serial.print(i + 1);
- Serial.print(": ");
- Serial.print(WiFi.SSID(i));
- Serial.print(" (");
- Serial.print(WiFi.RSSI(i));
- Serial.print(")");
- Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
- delay(10);
- }
- }
- Serial.println("");
-
- // Wait a bit before scanning again
- delay(5000);
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino
deleted file mode 100644
index 43a9d825..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- WiFiTelnetToSerial - Example Transparent UART to Telnet Server for esp8266
-
- Copyright (c) 2015 Hristo Gochkov. All rights reserved.
- This file is part of the ESP8266WiFi library for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include
-
-//how many clients should be able to telnet to this ESP8266
-#define MAX_SRV_CLIENTS 1
-const char* ssid = "**********";
-const char* password = "**********";
-
-WiFiServer server(21);
-WiFiClient serverClients[MAX_SRV_CLIENTS];
-
-void setup() {
- Serial1.begin(115200);
- WiFi.begin(ssid, password);
- Serial1.print("\nConnecting to "); Serial1.println(ssid);
- uint8_t i = 0;
- while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);
- if(i == 21){
- Serial1.print("Could not connect to"); Serial1.println(ssid);
- while(1) delay(500);
- }
- //start UART and the server
- Serial.begin(115200);
- server.begin();
- server.setNoDelay(true);
-
- Serial1.print("Ready! Use 'telnet ");
- Serial1.print(WiFi.localIP());
- Serial1.println(" 21' to connect");
-}
-
-void loop() {
- uint8_t i;
- //check if there are any new clients
- if (server.hasClient()){
- for(i = 0; i < MAX_SRV_CLIENTS; i++){
- //find free/disconnected spot
- if (!serverClients[i] || !serverClients[i].connected()){
- if(serverClients[i]) serverClients[i].stop();
- serverClients[i] = server.available();
- Serial1.print("New client: "); Serial1.print(i);
- continue;
- }
- }
- //no free/disconnected spot so reject
- WiFiClient serverClient = server.available();
- serverClient.stop();
- }
- //check clients for data
- for(i = 0; i < MAX_SRV_CLIENTS; i++){
- if (serverClients[i] && serverClients[i].connected()){
- if(serverClients[i].available()){
- //get data from the telnet client and push it to the UART
- while(serverClients[i].available()) Serial.write(serverClients[i].read());
- }
- }
- }
- //check UART for data
- if(Serial.available()){
- size_t len = Serial.available();
- uint8_t sbuf[len];
- Serial.readBytes(sbuf, len);
- //push UART data to all connected telnet clients
- for(i = 0; i < MAX_SRV_CLIENTS; i++){
- if (serverClients[i] && serverClients[i].connected()){
- serverClients[i].write(sbuf, len);
- delay(1);
- }
- }
- }
-}
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiWebServer/WiFiWebServer.ino b/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiWebServer/WiFiWebServer.ino
deleted file mode 100644
index fa40678a..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/examples/WiFiWebServer/WiFiWebServer.ino
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * This sketch demonstrates how to set up a simple HTTP-like server.
- * The server will set a GPIO pin depending on the request
- * http://server_ip/gpio/0 will set the GPIO2 low,
- * http://server_ip/gpio/1 will set the GPIO2 high
- * server_ip is the IP address of the ESP8266 module, will be
- * printed to Serial when the module is connected.
- */
-
-#include
-
-const char* ssid = "your-ssid";
-const char* password = "your-password";
-
-// Create an instance of the server
-// specify the port to listen on as an argument
-WiFiServer server(80);
-
-void setup() {
- Serial.begin(115200);
- delay(10);
-
- // prepare GPIO2
- pinMode(2, OUTPUT);
- digitalWrite(2, 0);
-
- // Connect to WiFi network
- Serial.println();
- Serial.println();
- Serial.print("Connecting to ");
- Serial.println(ssid);
-
- WiFi.begin(ssid, password);
-
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
- Serial.println("WiFi connected");
-
- // Start the server
- server.begin();
- Serial.println("Server started");
-
- // Print the IP address
- Serial.println(WiFi.localIP());
-}
-
-void loop() {
- // Check if a client has connected
- WiFiClient client = server.available();
- if (!client) {
- return;
- }
-
- // Wait until the client sends some data
- Serial.println("new client");
- while(!client.available()){
- delay(1);
- }
-
- // Read the first line of the request
- String req = client.readStringUntil('\r');
- Serial.println(req);
- client.flush();
-
- // Match the request
- int val;
- if (req.indexOf("/gpio/0") != -1)
- val = 0;
- else if (req.indexOf("/gpio/1") != -1)
- val = 1;
- else {
- Serial.println("invalid request");
- client.stop();
- return;
- }
-
- // Set GPIO2 according to the request
- digitalWrite(2, val);
-
- client.flush();
-
- // Prepare the response
- String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n\r\nGPIO is now ";
- s += (val)?"high":"low";
- s += "\n";
-
- // Send the response to the client
- client.print(s);
- delay(1);
- Serial.println("Client disonnected");
-
- // The client will actually be disconnected
- // when the function returns and 'client' object is detroyed
-}
-
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/keywords.txt b/sparkfun/esp8266/libraries/ESP8266WiFi/keywords.txt
deleted file mode 100644
index e693ea4d..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/keywords.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-#######################################
-# Syntax Coloring Map For ESP8266WiFi
-#######################################
-
-#######################################
-# Library (KEYWORD3)
-#######################################
-
-ESP8266WiFi KEYWORD3
-
-#######################################
-# Datatypes (KEYWORD1)
-#######################################
-
-WiFi KEYWORD1
-WiFiClient KEYWORD1
-WiFiServer KEYWORD1
-WiFiUDP KEYWORD1
-
-#######################################
-# Methods and Functions (KEYWORD2)
-#######################################
-
-status KEYWORD2
-mode KEYWORD2
-connect KEYWORD2
-write KEYWORD2
-available KEYWORD2
-config KEYWORD2
-setDNS KEYWORD2
-read KEYWORD2
-flush KEYWORD2
-stop KEYWORD2
-connected KEYWORD2
-begin KEYWORD2
-beginMulticast KEYWORD2
-disconnect KEYWORD2
-macAddress KEYWORD2
-localIP KEYWORD2
-subnetMask KEYWORD2
-gatewayIP KEYWORD2
-SSID KEYWORD2
-BSSID KEYWORD2
-RSSI KEYWORD2
-encryptionType KEYWORD2
-beginPacket KEYWORD2
-beginPacketMulticast KEYWORD2
-endPacket KEYWORD2
-parsePacket KEYWORD2
-destinationIP KEYWORD2
-remoteIP KEYWORD2
-remotePort KEYWORD2
-softAP KEYWORD2
-softAPIP KEYWORD2
-softAPmacAddress KEYWORD2
-softAPConfig KEYWORD2
-printDiag KEYWORD2
-hostByName KEYWORD2
-scanNetworks KEYWORD2
-
-#######################################
-# Constants (LITERAL1)
-#######################################
-WIFI_AP LITERAL1
-WIFI_STA LITERAL1
-WIFI_AP_STA LITERAL1
-
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/library.properties b/sparkfun/esp8266/libraries/ESP8266WiFi/library.properties
deleted file mode 100644
index 3db731e8..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/library.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-name=ESP8266WiFi
-version=1.0
-author=Ivan Grokhotkov
-maintainer=Ivan Grokhtkov
-sentence=Enables network connection (local and Internet) using the ESP8266 built-in WiFi.
-paragraph=With this library you can instantiate Servers, Clients and send/receive UDP packets through WiFi. The shield can connect either to open or encrypted networks (WEP, WPA). The IP address can be assigned statically or through a DHCP. The library can also manage DNS.
-category=Communication
-url=
-architectures=esp8266
diff --git a/sparkfun/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp b/sparkfun/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp
deleted file mode 100644
index 115b2376..00000000
--- a/sparkfun/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- ESP8266WiFi.cpp - WiFi library for esp8266
-
- Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
- This file is part of the esp8266 core for Arduino environment.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "ESP8266WiFi.h"
-extern "C" {
-#include "c_types.h"
-#include "ets_sys.h"
-#include "os_type.h"
-#include "osapi.h"
-#include "mem.h"
-#include "user_interface.h"
-#include "smartconfig.h"
-#include "lwip/opt.h"
-#include "lwip/err.h"
-#include "lwip/dns.h"
-}
-
-
-extern "C" void esp_schedule();
-extern "C" void esp_yield();
-
-ESP8266WiFiClass::ESP8266WiFiClass()
-{
-
-}
-
-void ESP8266WiFiClass::mode(WiFiMode m)
-{
- ETS_UART_INTR_DISABLE();
- wifi_set_opmode(m);
- ETS_UART_INTR_ENABLE();
-}
-
-
-int ESP8266WiFiClass::begin(const char* ssid)
-{
- return begin(ssid, 0);
-}
-
-
-int ESP8266WiFiClass::begin(const char* ssid, const char *passphrase)
-{
- if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled
- {
- // turn on AP+STA mode
- mode(WIFI_AP_STA);
- }
-
- struct station_config conf;
- strcpy(reinterpret_cast(conf.ssid), ssid);
- if (passphrase)
- strcpy(reinterpret_cast(conf.password), passphrase);
- else
- *conf.password = 0;
-
- conf.bssid_set = 0;
-
- ETS_UART_INTR_DISABLE();
- wifi_station_set_config(&conf);
- wifi_station_connect();
- ETS_UART_INTR_ENABLE();
- wifi_station_dhcpc_start();
- return status();
-}
-
-uint8_t ESP8266WiFiClass::waitForConnectResult(){
- if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled
- return WL_DISCONNECTED;
- while (status() == WL_DISCONNECTED)
- delay(100);
- return status();
-}
-
-void ESP8266WiFiClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet)
-{
- struct ip_info info;
- info.ip.addr = static_cast(local_ip);
- info.gw.addr = static_cast(gateway);
- info.netmask.addr = static_cast(subnet);
-
- wifi_station_dhcpc_stop();
- wifi_set_ip_info(STATION_IF, &info);
-}
-
-int ESP8266WiFiClass::disconnect()
-{
- struct station_config conf;
- *conf.ssid = 0;
- *conf.password = 0;
- ETS_UART_INTR_DISABLE();
- wifi_station_set_config(&conf);
- wifi_station_disconnect();
- ETS_UART_INTR_ENABLE();
- return 0;
-}
-
-void ESP8266WiFiClass::softAP(const char* ssid)
-{
- softAP(ssid, 0);
-}
-
-
-void ESP8266WiFiClass::softAP(const char* ssid, const char* passphrase, int channel)
-{
- if (wifi_get_opmode() < WIFI_AP)//will be OFF or STA
- {
- // turn on AP+STA mode
- mode(WIFI_AP_STA);
- }
-
- struct softap_config conf;
- wifi_softap_get_config(&conf);
- strcpy(reinterpret_cast(conf.ssid), ssid);
- conf.channel = channel;
- conf.ssid_len = strlen(ssid);
- conf.ssid_hidden = 0;
- conf.max_connection = 4;
- conf.beacon_interval = 100;
-
- if (!passphrase || strlen(passphrase) == 0)
- {
- conf.authmode = AUTH_OPEN;
- *conf.password = 0;
- }
- else
- {
- conf.authmode = AUTH_WPA2_PSK;
- strcpy(reinterpret_cast(conf.password), passphrase);
- }
-
- ETS_UART_INTR_DISABLE();
- wifi_softap_set_config(&conf);
- ETS_UART_INTR_ENABLE();
-}
-
-void ESP8266WiFiClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPAddress subnet)
-{
- struct ip_info info;
- info.ip.addr = static_cast(local_ip);
- info.gw.addr = static_cast(gateway);
- info.netmask.addr = static_cast(subnet);
- wifi_softap_dhcps_stop();
- wifi_set_ip_info(SOFTAP_IF, &info);
- wifi_softap_dhcps_start();
-}
-
-uint8_t* ESP8266WiFiClass::macAddress(uint8_t* mac)
-{
- wifi_get_macaddr(STATION_IF, mac);
- return mac;
-}
-
-uint8_t* ESP8266WiFiClass::softAPmacAddress(uint8_t* mac)
-{
- wifi_get_macaddr(SOFTAP_IF, mac);
- return mac;
-}
-
-IPAddress ESP8266WiFiClass::localIP()
-{
- struct ip_info ip;
- wifi_get_ip_info(STATION_IF, &ip);
- return IPAddress(ip.ip.addr);
-}
-
-IPAddress ESP8266WiFiClass::softAPIP()
-{
- struct ip_info ip;
- wifi_get_ip_info(SOFTAP_IF, &ip);
- return IPAddress(ip.ip.addr);
-}
-
-IPAddress ESP8266WiFiClass::subnetMask()
-{
- struct ip_info ip;
- wifi_get_ip_info(STATION_IF, &ip);
- return IPAddress(ip.netmask.addr);
-}
-
-IPAddress ESP8266WiFiClass::gatewayIP()
-{
- struct ip_info ip;
- wifi_get_ip_info(STATION_IF, &ip);
- return IPAddress(ip.gw.addr);
-}
-
-char* ESP8266WiFiClass::SSID()
-{
- static struct station_config conf;
- wifi_station_get_config(&conf);
- return reinterpret_cast(conf.ssid);
-}
-
-// uint8_t* ESP8266WiFiClass::BSSID(uint8_t* bssid)
-// {
-// uint8_t* _bssid = WiFiDrv::getCurrentBSSID();
-// memcpy(bssid, _bssid, WL_MAC_ADDR_LENGTH);
-// return bssid;
-// }
-
-// int32_t ESP8266WiFiClass::RSSI()
-// {
-// return WiFiDrv::getCurrentRSSI();
-// }
-
-// uint8_t ESP8266WiFiClass::encryptionType()
-// {
-// return WiFiDrv::getCurrentEncryptionType();
-// }
-
-extern "C"
-{
- typedef STAILQ_HEAD(, bss_info) bss_info_head_t;
-}
-
-void ESP8266WiFiClass::_scanDone(void* result, int status)
-{
- if (status != OK)
- {
- ESP8266WiFiClass::_scanCount = 0;
- ESP8266WiFiClass::_scanResult = 0;
- }
- else
- {
-
- int i = 0;
- bss_info_head_t* head = reinterpret_cast(result);
-
- for (bss_info* it = STAILQ_FIRST(head); it; it = STAILQ_NEXT(it, next), ++i);
- ESP8266WiFiClass::_scanCount = i;
- if (i == 0)
- {
- ESP8266WiFiClass::_scanResult = 0;
- }
- else
- {
- bss_info* copied_info = new bss_info[i];
- i = 0;
- for (bss_info* it = STAILQ_FIRST(head); it; it = STAILQ_NEXT(it, next), ++i)
- {
- memcpy(copied_info + i, it, sizeof(bss_info));
- }
-
- ESP8266WiFiClass::_scanResult = copied_info;
- }
-
- }
- esp_schedule();
-}
-
-
-int8_t ESP8266WiFiClass::scanNetworks()
-{
- if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled
- {
- mode(WIFI_AP_STA);
- }
- int status = wifi_station_get_connect_status();
- if (status != STATION_GOT_IP && status != STATION_IDLE)
- {
- disconnect();
- }
-
- if (ESP8266WiFiClass::_scanResult)
- {
- delete[] reinterpret_cast(ESP8266WiFiClass::_scanResult);
- ESP8266WiFiClass::_scanResult = 0;
- ESP8266WiFiClass::_scanCount = 0;
- }
-
- struct scan_config config;
- config.ssid = 0;
- config.bssid = 0;
- config.channel = 0;
- config.show_hidden = 0;
- wifi_station_scan(&config, reinterpret_cast(&ESP8266WiFiClass::_scanDone));
- esp_yield();
- return ESP8266WiFiClass::_scanCount;
-}
-
-void * ESP8266WiFiClass::_getScanInfoByIndex(int i)
-{
- if (!ESP8266WiFiClass::_scanResult || i > ESP8266WiFiClass::_scanCount)
- {
- return 0;
- }
-
- return reinterpret_cast(ESP8266WiFiClass::_scanResult) + i;
-}
-
-const char* ESP8266WiFiClass::SSID(uint8_t i)
-{
- struct bss_info* it = reinterpret_cast(_getScanInfoByIndex(i));
- if (!it)
- return 0;
-
- return reinterpret_cast(it->ssid);
-}
-
-int32_t ESP8266WiFiClass::RSSI(uint8_t i)
-{
- struct bss_info* it = reinterpret_cast(_getScanInfoByIndex(i));
- if (!it)
- return 0;
-
- return it->rssi;
-}
-
-uint8_t ESP8266WiFiClass::encryptionType(uint8_t i)
-{
- struct bss_info* it = reinterpret_cast