mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2025-10-29 19:43:22 +00:00
RTL8721DA (AmebaDplus) and RTL8720E (AmebaLite) (#1718)
* amebadplus * fix + amebalite * ota, lfs, fast connect fix * Fix TCP_MSL and hostname * Readme and releaserc fix esp irq * small fixes * setting mac on amebad/1 * ameba ir * win ef * update sdk & disable rtl8720e rest ota * fix
This commit is contained in:
parent
9e89d4f375
commit
a1501c00c4
50
.github/workflows/workflow.yaml
vendored
50
.github/workflows/workflow.yaml
vendored
@ -448,6 +448,56 @@ jobs:
|
||||
output/${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}/${{ matrix.platform }}_Tuya_UA_${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}.bin
|
||||
if-no-files-found: warn
|
||||
|
||||
build_ameba:
|
||||
name: Build ameba
|
||||
needs: refs
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: OpenRTL8721DA
|
||||
variant: default
|
||||
- platform: OpenRTL8720E
|
||||
variant: default
|
||||
steps:
|
||||
- name: Source checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: SDK checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: Ameba-AIoT/ameba-rtos
|
||||
path: sdk/ameba-rtos
|
||||
#ref: release/v1.1
|
||||
ref: 347af9133679eacb10b368010f9ce5e143ff1643 # pin commit until stable release
|
||||
submodules: recursive
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
architecture: 'x64'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install make cmake python3-venv
|
||||
pip install -r sdk/ameba-rtos/tools/requirements.txt
|
||||
mkdir /opt/rtk-toolchain
|
||||
cd /opt/rtk-toolchain
|
||||
wget https://github.com/Ameba-AIoT/ameba-toolchain/releases/download/prebuilts-v1.0.3/prebuilts-linux-1.0.3.tar.gz
|
||||
tar -xzf prebuilts-linux-1.0.3.tar.gz
|
||||
cd ~/work/OpenBK7231T_App/OpenBK7231T_App
|
||||
source sdk/ameba-rtos/ameba.sh
|
||||
- run: ls -la
|
||||
- name: Run make
|
||||
run: make APP_VERSION=${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }} APP_NAME=${{ matrix.platform }} VARIANT="${{ matrix.variant }}" ${{ matrix.platform }}
|
||||
- name: Save build assets
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_${{ matrix.platform }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}
|
||||
path: |
|
||||
output/${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}.bin
|
||||
output/${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}${{ matrix.variant != 'default' && '_' || '' }}${{ matrix.variant != 'default' && matrix.variant || '' }}_ota.img
|
||||
if-no-files-found: warn
|
||||
|
||||
merge:
|
||||
name: Merge Artifacts
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
output/**
|
||||
**/*.o
|
||||
**/*.oo
|
||||
**/*.obj
|
||||
*.idb
|
||||
*.exe
|
||||
|
||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -69,3 +69,7 @@
|
||||
path = sdk/ESP8266_RTOS_SDK
|
||||
url = https://github.com/espressif/ESP8266_RTOS_SDK
|
||||
branch = release/v3.4
|
||||
[submodule "sdk/ameba-rtos"]
|
||||
path = sdk/ameba-rtos
|
||||
url = https://github.com/Ameba-AIoT/ameba-rtos
|
||||
branch = release/v1.1
|
||||
|
||||
142
.releaserc.yaml
142
.releaserc.yaml
@ -101,6 +101,8 @@ generateNotes:
|
||||
- RTL8710C/RTL8720C (AmebaZ2 family) (eg BW15, W701, W701H, WBR2, WBR3, CR3L, CRG1)
|
||||
- RTL8720D (AmebaD family) (eg BW16, BW16E, W701D, W701DH, WBR3D, WBR3T)
|
||||
- RTL872xCSM/RTL8720CS (AmebaCS family) (eg WBRG1, WBR3S, WBR3N) (Firmware compatible with RTL8720D)
|
||||
- RTL87x1DA (AmebaDplus family) (eg BW20, WR11-U, WR11-2S)
|
||||
- RTL87x0E (AmebaLite family) (eg PKM8710ECF)
|
||||
- ECR6600 (eg AXYU, AXY2S, WG236, DSM-036, CDI-WX56600A-00, BL-M6600XT1, HF-LPT6200)
|
||||
|
||||
footerPartial: |
|
||||
@ -117,74 +119,78 @@ generateNotes:
|
||||
|
||||
### Assets
|
||||
Refer to the following table for the usage of the various assests included in this release
|
||||
| Platform | Usage | Filename |
|
||||
| --- | --- | --- |
|
||||
| BK7231T | OTA Update | [OpenBK7231T_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_{{version}}.rbl) |
|
||||
| BK7231T | CCtr Flash | [OpenBK7231T_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UG_{{version}}.bin) |
|
||||
| BK7231T | UART Flash | [OpenBK7231T_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UA_{{version}}.bin) |
|
||||
| BK7231T | SPI Flash | [OpenBK7231T_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_QIO_{{version}}.bin) |
|
||||
| BK7231N | OTA Update | [OpenBK7231N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_{{version}}.rbl) |
|
||||
| BK7231N | CCtr Flash | [OpenBK7231N_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_UG_{{version}}.bin) |
|
||||
| BK7231N | UART Flash | [OpenBK7231N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_QIO_{{version}}.bin) |
|
||||
| BK7231M | UART Flash | [OpenBK7231M_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231M_QIO_{{version}}.bin) |
|
||||
| BK7231U | OTA Update | [OpenBK7231U_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_{{version}}.rbl) |
|
||||
| BK7231U | UART Flash | [OpenBK7231U_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_UA_{{version}}.bin) |
|
||||
| BK7231U | SPI Flash | [OpenBK7231U_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_QIO_{{version}}.bin) |
|
||||
| BK7238 | OTA Update | [OpenBK7238_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7238_{{version}}.rbl) |
|
||||
| BK7238 | UART Flash | [OpenBK7238_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7238_QIO_{{version}}.bin) |
|
||||
| BK7252 | OTA Update | [OpenBK7252_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_{{version}}.rbl) |
|
||||
| BK7252 | UART Flash | [OpenBK7252_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_UA_{{version}}.bin) |
|
||||
| BK7252 | SPI Flash | [OpenBK7252_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_QIO_{{version}}.bin) |
|
||||
| BK7252N | OTA Update | [OpenBK7252N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252N_{{version}}.rbl) |
|
||||
| BK7252N | UART Flash | [OpenBK7252N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252N_QIO_{{version}}.bin) |
|
||||
| XR809 | UART Flash | [OpenXR809_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR809_{{version}}.img) |
|
||||
| XR806 | UART Flash | [OpenXR806_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR806_{{version}}.img) |
|
||||
| XR806 | OTA Update | [OpenXR806_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR806_{{version}}_ota.img) |
|
||||
| XR872 | UART Flash | [OpenXR872_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR872_{{version}}.img) |
|
||||
| XR872 | OTA Update | [OpenXR872_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR872_{{version}}_ota.img) |
|
||||
| BL602 | UART Flash | [OpenBL602_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}.bin) |
|
||||
| BL602 | OTA Update | [OpenBL602_{{version}}_OTA.bin.xz.ota]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}_OTA.bin.xz.ota) |
|
||||
| W800 | OTA Update | [OpenW800_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}_ota.img) |
|
||||
| W800 | UART Flash | [OpenW800_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}.fls) |
|
||||
| W600 | OTA Update | [OpenW600_{{version}}_gz.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW600_{{version}}_gz.img) |
|
||||
| W600 | UART Flash | [OpenW600_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW600_{{version}}.fls) |
|
||||
| LN882H | OTA Update | [OpenLN882H_{{version}}_OTA.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenLN882H_{{version}}_OTA.bin) |
|
||||
| LN882H | UART Flash | [OpenLN882H_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenLN882H_{{version}}.bin) |
|
||||
| TR6260 | UART Flash | [OpenTR6260_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenTR6260_{{version}}.bin) |
|
||||
| RTL8710A | JTAG Flash | [OpenRTL8710A_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710A_{{version}}.bin) |
|
||||
| RTL8710A | OTA Update | [OpenRTL8710A_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710A_{{version}}_ota.img) |
|
||||
| RTL8710B | UART Flash | [OpenRTL8710B_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_{{version}}.bin) |
|
||||
| RTL8710B | OTA Update | [OpenRTL8710B_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_{{version}}_ota.img) |
|
||||
| RTL87X0C | UART Flash | [OpenRTL87X0C_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL87X0C_{{version}}.bin) |
|
||||
| RTL87X0C | OTA Update | [OpenRTL87X0C_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL87X0C_{{version}}_ota.img) |
|
||||
| RTL8720D | UART Flash | [OpenRTL8720D_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720D_{{version}}.bin) |
|
||||
| RTL8720D | OTA Update | [OpenRTL8720D_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720D_{{version}}_ota.img) |
|
||||
| ECR6600 | UART Flash | [OpenECR6600_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenECR6600_{{version}}.bin) |
|
||||
| ECR6600 | OTA Update | [OpenECR6600_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenECR6600_{{version}}_ota.img) |
|
||||
| ESP32 4MB | UART Flash | [OpenESP32_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32_{{version}}_4M.factory.bin) |
|
||||
| ESP32 4MB | OTA Update | [OpenESP32_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32_{{version}}_4M.img) |
|
||||
| ESP32 S2 4MB | UART Flash | [OpenESP32S2_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S2_{{version}}_4M.factory.bin) |
|
||||
| ESP32 S2 4MB | OTA Update | [OpenESP32S2_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S2_{{version}}_4M.img) |
|
||||
| ESP32 S3 4MB | UART Flash | [OpenESP32S3_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S3_{{version}}_4M.factory.bin) |
|
||||
| ESP32 S3 4MB | OTA Update | [OpenESP32S3_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S3_{{version}}_4M.img) |
|
||||
| ESP32 C2 2MB | UART Flash | [OpenESP32C2_{{version}}_2M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_2M.factory.bin) |
|
||||
| ESP32 C2 2MB | OTA Update | [OpenESP32C2_{{version}}_2M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_2M.img) |
|
||||
| ESP32 C2 4MB | UART Flash | [OpenESP32C2_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C2 4MB | OTA Update | [OpenESP32C2_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_4M.img) |
|
||||
| ESP32 C3 2MB | UART Flash | [OpenESP32C3_{{version}}_2M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_2M.factory.bin) |
|
||||
| ESP32 C3 2MB | OTA Update | [OpenESP32C3_{{version}}_2M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_2M.img) |
|
||||
| ESP32 C3 4MB | UART Flash | [OpenESP32C3_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C3 4MB | OTA Update | [OpenESP32C3_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_4M.img) |
|
||||
| ESP32 C5 4MB | UART Flash | [OpenESP32C5_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C5_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C5 4MB | OTA Update | [OpenESP32C5_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C5_{{version}}_4M.img) |
|
||||
| ESP32 C6 4MB | UART Flash | [OpenESP32C6_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C6_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C6 4MB | OTA Update | [OpenESP32C6_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C6_{{version}}_4M.img) |
|
||||
| ESP32 C61 4MB | UART Flash | [OpenESP32C61_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C61_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C61 4MB | OTA Update | [OpenESP32C61_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C61_{{version}}_4M.img) |
|
||||
| ESP8266 1MB | UART Flash | [OpenESP8266_1MB_{{version}}.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_1MB_{{version}}.factory.bin) |
|
||||
| ESP8266 2MB | UART Flash | [OpenESP8266_2MB_{{version}}.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_2MB_{{version}}.factory.bin) |
|
||||
| ESP8266 | OTA Update | [OpenESP8266_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_{{version}}.img) |
|
||||
| Win32 | | [obkSimulator_{{version}}.zip]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/obkSimulator_{{version}}.zip) |
|
||||
| Platform | Usage | Filename |
|
||||
| --- | --- | --- |
|
||||
| BK7231T | OTA Update | [OpenBK7231T_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_{{version}}.rbl) |
|
||||
| BK7231T | CCtr Flash | [OpenBK7231T_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UG_{{version}}.bin) |
|
||||
| BK7231T | UART Flash | [OpenBK7231T_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UA_{{version}}.bin) |
|
||||
| BK7231T | SPI Flash | [OpenBK7231T_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_QIO_{{version}}.bin) |
|
||||
| BK7231N | OTA Update | [OpenBK7231N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_{{version}}.rbl) |
|
||||
| BK7231N | CCtr Flash | [OpenBK7231N_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_UG_{{version}}.bin) |
|
||||
| BK7231N | UART Flash | [OpenBK7231N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_QIO_{{version}}.bin) |
|
||||
| BK7231M | UART Flash | [OpenBK7231M_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231M_QIO_{{version}}.bin) |
|
||||
| BK7231U | OTA Update | [OpenBK7231U_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_{{version}}.rbl) |
|
||||
| BK7231U | UART Flash | [OpenBK7231U_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_UA_{{version}}.bin) |
|
||||
| BK7231U | SPI Flash | [OpenBK7231U_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231U_QIO_{{version}}.bin) |
|
||||
| BK7238 | OTA Update | [OpenBK7238_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7238_{{version}}.rbl) |
|
||||
| BK7238 | UART Flash | [OpenBK7238_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7238_QIO_{{version}}.bin) |
|
||||
| BK7252 | OTA Update | [OpenBK7252_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_{{version}}.rbl) |
|
||||
| BK7252 | UART Flash | [OpenBK7252_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_UA_{{version}}.bin) |
|
||||
| BK7252 | SPI Flash | [OpenBK7252_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252_QIO_{{version}}.bin) |
|
||||
| BK7252N | OTA Update | [OpenBK7252N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252N_{{version}}.rbl) |
|
||||
| BK7252N | UART Flash | [OpenBK7252N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7252N_QIO_{{version}}.bin) |
|
||||
| XR809 | UART Flash | [OpenXR809_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR809_{{version}}.img) |
|
||||
| XR806 | UART Flash | [OpenXR806_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR806_{{version}}.img) |
|
||||
| XR806 | OTA Update | [OpenXR806_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR806_{{version}}_ota.img) |
|
||||
| XR872 | UART Flash | [OpenXR872_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR872_{{version}}.img) |
|
||||
| XR872 | OTA Update | [OpenXR872_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR872_{{version}}_ota.img) |
|
||||
| BL602 | UART Flash | [OpenBL602_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}.bin) |
|
||||
| BL602 | OTA Update | [OpenBL602_{{version}}_OTA.bin.xz.ota]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}_OTA.bin.xz.ota) |
|
||||
| W800 | OTA Update | [OpenW800_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}_ota.img) |
|
||||
| W800 | UART Flash | [OpenW800_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}.fls) |
|
||||
| W600 | OTA Update | [OpenW600_{{version}}_gz.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW600_{{version}}_gz.img) |
|
||||
| W600 | UART Flash | [OpenW600_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW600_{{version}}.fls) |
|
||||
| LN882H | OTA Update | [OpenLN882H_{{version}}_OTA.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenLN882H_{{version}}_OTA.bin) |
|
||||
| LN882H | UART Flash | [OpenLN882H_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenLN882H_{{version}}.bin) |
|
||||
| TR6260 | UART Flash | [OpenTR6260_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenTR6260_{{version}}.bin) |
|
||||
| RTL8710A | JTAG Flash | [OpenRTL8710A_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710A_{{version}}.bin) |
|
||||
| RTL8710A | OTA Update | [OpenRTL8710A_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710A_{{version}}_ota.img) |
|
||||
| RTL8710B | UART Flash | [OpenRTL8710B_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_{{version}}.bin) |
|
||||
| RTL8710B | OTA Update | [OpenRTL8710B_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8710B_{{version}}_ota.img) |
|
||||
| RTL87X0C | UART Flash | [OpenRTL87X0C_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL87X0C_{{version}}.bin) |
|
||||
| RTL87X0C | OTA Update | [OpenRTL87X0C_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL87X0C_{{version}}_ota.img) |
|
||||
| RTL8720D | UART Flash | [OpenRTL8720D_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720D_{{version}}.bin) |
|
||||
| RTL8720D | OTA Update | [OpenRTL8720D_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720D_{{version}}_ota.img) |
|
||||
| RTL8721DA | UART Flash | [OpenRTL8721DA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8721DA_{{version}}.bin) |
|
||||
| RTL8721DA | OTA Update | [OpenRTL8721DA_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8721DA_{{version}}_ota.img) |
|
||||
| RTL8720E | UART Flash | [OpenRTL8720E_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720E_{{version}}.bin) |
|
||||
| RTL8720E | OTA Update | [OpenRTL8720E_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenRTL8720E_{{version}}_ota.img) |
|
||||
| ECR6600 | UART Flash | [OpenECR6600_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenECR6600_{{version}}.bin) |
|
||||
| ECR6600 | OTA Update | [OpenECR6600_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenECR6600_{{version}}_ota.img) |
|
||||
| ESP32 4MB | UART Flash | [OpenESP32_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32_{{version}}_4M.factory.bin) |
|
||||
| ESP32 4MB | OTA Update | [OpenESP32_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32_{{version}}_4M.img) |
|
||||
| ESP32-S2 4MB | UART Flash | [OpenESP32S2_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S2_{{version}}_4M.factory.bin) |
|
||||
| ESP32-S2 4MB | OTA Update | [OpenESP32S2_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S2_{{version}}_4M.img) |
|
||||
| ESP32-S3 4MB | UART Flash | [OpenESP32S3_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S3_{{version}}_4M.factory.bin) |
|
||||
| ESP32-S3 4MB | OTA Update | [OpenESP32S3_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32S3_{{version}}_4M.img) |
|
||||
| ESP32-C2 2MB | UART Flash | [OpenESP32C2_{{version}}_2M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_2M.factory.bin) |
|
||||
| ESP32-C2 2MB | OTA Update | [OpenESP32C2_{{version}}_2M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_2M.img) |
|
||||
| ESP32 C2 4MB | UART Flash | [OpenESP32C2_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C2 4MB | OTA Update | [OpenESP32C2_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C2_{{version}}_4M.img) |
|
||||
| ESP32-C3 2MB | UART Flash | [OpenESP32C3_{{version}}_2M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_2M.factory.bin) |
|
||||
| ESP32-C3 2MB | OTA Update | [OpenESP32C3_{{version}}_2M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_2M.img) |
|
||||
| ESP32 C3 4MB | UART Flash | [OpenESP32C3_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C3 4MB | OTA Update | [OpenESP32C3_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C3_{{version}}_4M.img) |
|
||||
| ESP32 C5 4MB | UART Flash | [OpenESP32C5_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C5_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C5 4MB | OTA Update | [OpenESP32C5_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C5_{{version}}_4M.img) |
|
||||
| ESP32-C6 4MB | UART Flash | [OpenESP32C6_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C6_{{version}}_4M.factory.bin) |
|
||||
| ESP32-C6 4MB | OTA Update | [OpenESP32C6_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C6_{{version}}_4M.img) |
|
||||
| ESP32 C61 4MB | UART Flash | [OpenESP32C61_{{version}}_4M.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C61_{{version}}_4M.factory.bin) |
|
||||
| ESP32 C61 4MB | OTA Update | [OpenESP32C61_{{version}}_4M.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP32C61_{{version}}_4M.img) |
|
||||
| ESP8266 1MB | UART Flash | [OpenESP8266_1MB_{{version}}.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_1MB_{{version}}.factory.bin) |
|
||||
| ESP8266 2MB | UART Flash | [OpenESP8266_2MB_{{version}}.factory.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_2MB_{{version}}.factory.bin) |
|
||||
| ESP8266 2MB | OTA Update | [OpenESP8266_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenESP8266_{{version}}.img) |
|
||||
| Win32 | | [obkSimulator_{{version}}.zip]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/obkSimulator_{{version}}.zip) |
|
||||
|
||||
|
||||
CCtr Flash = Tuya cloud Cutter flash
|
||||
|
||||
40
Makefile
40
Makefile
@ -338,6 +338,24 @@ prebuild_OpenECR6600: berry
|
||||
else echo "prebuild for OpenECR6600 not found ... "; \
|
||||
fi
|
||||
|
||||
prebuild_OpenRTL8721DA: berry
|
||||
#git submodule update --init --recursive --depth=1 sdk/ameba-rtos
|
||||
if [ ! -e sdk/ameba-rtos/amebadplus_gcc_project/menuconfig/.config ]; then cd sdk/ameba-rtos/amebadplus_gcc_project && ./menuconfig.py -f ../../../platforms/RTL8721DA/default.conf; fi
|
||||
@if [ -e platforms/RTL8721DA/pre_build.sh ]; then \
|
||||
echo "prebuild found for OpenRTL8721DA"; \
|
||||
sh platforms/RTL8721DA/pre_build.sh; \
|
||||
else echo "prebuild for OpenRTL8721DA not found ... "; \
|
||||
fi
|
||||
|
||||
prebuild_OpenRTL8720E: berry
|
||||
#git submodule update --init --recursive --depth=1 sdk/ameba-rtos
|
||||
if [ ! -e sdk/ameba-rtos/amebalite_gcc_project/menuconfig/.config ]; then cd sdk/ameba-rtos/amebalite_gcc_project && ./menuconfig.py -f ../../../platforms/RTL8720E/default.conf; fi
|
||||
@if [ -e platforms/RTL8720E/pre_build.sh ]; then \
|
||||
echo "prebuild found for OpenRTL8720E"; \
|
||||
sh platforms/RTL8720E/pre_build.sh; \
|
||||
else echo "prebuild for OpenRTL8720E not found ... "; \
|
||||
fi
|
||||
|
||||
# Build main binaries
|
||||
OpenBK7231T: prebuild_OpenBK7231T
|
||||
mkdir -p output
|
||||
@ -551,6 +569,24 @@ OpenRTL8720D: prebuild_OpenRTL8720D
|
||||
dd conv=notrunc bs=1 if=sdk/OpenRTL8720D/project/OpenBeken/GCC-RELEASE/project_hp/asdk/image/km0_km4_image2.bin of=output/$(APP_VERSION)/OpenRTL8720D_$(APP_VERSION).bin seek=$(shell printf "%d" 0x6000)
|
||||
cp sdk/OpenRTL8720D/project/OpenBeken/GCC-RELEASE/project_lp/asdk/image/OTA_All.bin output/$(APP_VERSION)/OpenRTL8720D_$(APP_VERSION)_ota.img
|
||||
|
||||
.PHONY: OpenRTL8721DA
|
||||
OpenRTL8721DA: prebuild_OpenRTL8721DA
|
||||
cd sdk/ameba-rtos/amebadplus_gcc_project && APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) ./build.py -a ../../../platforms/RTL8721DA
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
cp sdk/ameba-rtos/amebadplus_gcc_project/km4_boot_all.bin /tmp/OpenRTL8721DA_$(APP_VERSION).bin
|
||||
dd conv=notrunc bs=1K if=sdk/ameba-rtos/amebadplus_gcc_project/km0_km4_app.bin of=/tmp/OpenRTL8721DA_$(APP_VERSION).bin seek=80
|
||||
mv /tmp/OpenRTL8721DA_$(APP_VERSION).bin output/$(APP_VERSION)/
|
||||
cp sdk/ameba-rtos/amebadplus_gcc_project/ota_all.bin output/$(APP_VERSION)/OpenRTL8721DA_$(APP_VERSION)_ota.img
|
||||
|
||||
.PHONY: OpenRTL8720E
|
||||
OpenRTL8720E: prebuild_OpenRTL8720E
|
||||
cd sdk/ameba-rtos/amebalite_gcc_project && APP_VERSION=$(APP_VERSION) OBK_VARIANT=$(OBK_VARIANT) ./build.py -a ../../../platforms/RTL8720E
|
||||
mkdir -p output/$(APP_VERSION)
|
||||
cp sdk/ameba-rtos/amebalite_gcc_project/km4_boot_all.bin /tmp/OpenRTL8720E_$(APP_VERSION).bin
|
||||
dd conv=notrunc bs=1K if=sdk/ameba-rtos/amebalite_gcc_project/kr4_km4_app.bin of=/tmp/OpenRTL8720E_$(APP_VERSION).bin seek=80
|
||||
mv /tmp/OpenRTL8720E_$(APP_VERSION).bin output/$(APP_VERSION)/
|
||||
cp sdk/ameba-rtos/amebalite_gcc_project/ota_all.bin output/$(APP_VERSION)/OpenRTL8720E_$(APP_VERSION)_ota.img
|
||||
|
||||
.PHONY: OpenBK7238
|
||||
OpenBK7238: prebuild_OpenBK7238
|
||||
cd sdk/beken_freertos_sdk && OBK_VARIANT=$(OBK_VARIANT) sh build.sh bk7238 $(APP_VERSION)
|
||||
@ -640,6 +676,10 @@ clean:
|
||||
-test -d ./sdk/OpenRTL87X0C && $(MAKE) -C sdk/OpenRTL87X0C/project/OpenBeken/GCC-RELEASE clean
|
||||
-test -d ./sdk/OpenRTL8710A_B && $(MAKE) -C sdk/OpenRTL8710A_B/project/obk_amebaz/GCC-RELEASE clean
|
||||
-test -d ./sdk/OpenRTL8710A_B && $(MAKE) -C sdk/OpenRTL8710A_B/project/obk_ameba1/GCC-RELEASE clean
|
||||
-test -d ./sdk/OpenRTL8720D && $(MAKE) -C sdk/OpenRTL8720D/project/OpenBeken/GCC-RELEASE/project_hp clean
|
||||
-test -d ./sdk/OpenRTL8720D && $(MAKE) -C sdk/OpenRTL8720D/project/OpenBeken/GCC-RELEASE/project_lp clean
|
||||
-test -d ./sdk/ameba-rtos && cd sdk/ameba-rtos/amebadplus_gcc_project && ./build.py -a ../../../platforms/RTL8721DA -c
|
||||
-test -d ./sdk/ameba-rtos && cd sdk/ameba-rtos/amebalite_gcc_project && ./build.py -a ../../../platforms/RTL8720E -c
|
||||
-test -d ./sdk/beken_freertos_sdk && $(MAKE) -C sdk/beken_freertos_sdk clean
|
||||
-test -d ./sdk/OpenLN882H/build && cmake --build ./sdk/OpenLN882H/build --target clean
|
||||
-test -d ./platforms/ESP-IDF/build-32 && cmake --build ./platforms/ESP-IDF/build-32 --target clean
|
||||
|
||||
@ -20,11 +20,14 @@ Although this repository is named "OpenBK7231T_App", it has evolved into a multi
|
||||
- [LN882H](https://www.elektroda.com/rtvforum/topic4027545.html) by Lightning Semi - [datasheet](https://www.elektroda.com/rtvforum/topic4027545.html), see [flashing how-to](https://www.elektroda.com/rtvforum/topic4028087.html), see [sample device teardown and flashing](https://www.elektroda.com/rtvforum/topic4032240.html), see [new flash tool](https://www.elektroda.com/rtvforum/topic4045532.html), see [dev board](https://www.elektroda.com/rtvforum/topic4050274.html)
|
||||
- Windows, via [simulator](https://www.elektroda.com/rtvforum/topic4046056.html)
|
||||
- ESP32 (original), ESP32-S2, ESP32-S3, ESP32-C2, ESP32-C3, ESP32-C6 (working well - guide to be released soon, [development topic](https://www.elektroda.com/rtvforum/topic4074860.html))
|
||||
- ESP8266/ESP8285 (1MB variant without OTA, 2MB or more with OTA)
|
||||
- RTL8711AM (Ameba1 family, with SDRAM only. Can't be flashed via UART, only JTAG or SPI) (eg [WRG1](https://developer.tuya.com/en/docs/iot/wrg1-datasheet?id=K97rig6mscj8e), see [development thread](https://www.elektroda.com/rtvforum/viewtopic.php?p=21452754#21452754))
|
||||
- RTL8710B (AmebaZ family) (eg [T102_V1.0](https://fccid.io/2ASKS-T102), [W302/T102_V1.0](https://fcc.report/FCC-ID/2AU7O-T102V11), [T112_V1.1](https://fccid.io/2AU7O-T102V11), [WR2](https://developer.tuya.com/en/docs/iot/wifiwr2module?id=K9605tko0juc3), [WR3E](https://developer.tuya.com/en/docs/iot/wr3e-module-datasheet?id=K9elwlqbfosbc), BW14)
|
||||
- RTL8710C/RTL8720C (AmebaZ2 family) (eg BW15, W701, W701H, W701M, W701P, [WBR2, WBR3](https://www.elektroda.com/rtvforum/topic4104395.html), [CR3L](https://developer.tuya.com/en/docs/iot/cr3l-module-datasheet?id=Ka3gl6ria8f1t), [CRG1](https://developer.tuya.com/en/docs/iot/CRG1-Module-Datasheet?id=Kbtesqh678sbe)) (see [guide](https://www.elektroda.com/rtvforum/topic4097185.html))
|
||||
- RTL8720D (AmebaD family) (eg [BW16](https://fcc.report/FCC-ID/2AHMR-BW16), BW16E, W701D, W701DH, [WBR3D](https://developer.tuya.com/en/docs/iot/wbr3d-module-datasheet?id=K9dukbbnmuw4h), [WBR3T](https://developer.tuya.com/en/docs/iot/wbr3t-module-datasheet?id=K9qs708w94ox8))
|
||||
- RTL872xCSM/RTL8720CS (AmebaCS family, firmware is compatible with RTL8720D) (eg [WBRG1](https://developer.tuya.com/en/docs/iot/wbrg1-module-datasheet?id=Ka015vo8tfztz) (see [Zigbee gateway guide](https://www.elektroda.com/rtvforum/topic4127578.html)), [WBR3N](https://developer.tuya.com/en/docs/iot/wbr3n-datasheet?id=K9qskxwpcqyaq), [WBR3S](https://developer.tuya.com/en/docs/iot/wbr3s-module-datasheet?id=K9qrt2je8wqxo))
|
||||
- RTL87x1DA (AmebaDplus family, not compatible with AmebaD/RTL8720D) (eg [BW20](https://fcc.report/FCC-ID/2ATPO-BW20/), [WR11-U](https://developer.tuya.com/en/docs/iot/wr11-u-module-datasheet?id=Kedlt4ye35tmv), [WR11-2S](https://developer.tuya.com/en/docs/iot/WR11-2S-Moudule-Datasheet?id=Kee3bl7v2agiy))
|
||||
- RTL87x0E (AmebaLite family) (eg [PKM8710ECF](https://fccid.io/2BASB-PKM8710ECF))
|
||||
- TR6260 (eg [HLK-M20](https://fccid.io/2AD56HLK-M20), XY-WE2S-A V1.1) (see [guide](https://www.elektroda.com/rtvforum/topic4093752.html))
|
||||
- ECR6600 (eg [AXYU](https://developer.tuya.com/en/docs/iot/AXYU?id=Kb0rwbv5b7aiy), [AXY2S](https://developer.tuya.com/en/docs/iot/AXY2S?id=Kb1aztk507fxf), [WG236](https://www.skylabmodule.com/product/wifi6-802-11axbluetooth-ble-5-1-combo-module-wg236), [DSM-036](https://www.dusuniot.com/product-specification/dsm-036-wi-fi6-and-ble-dual-cloud-module]), CDI-WX56600A-00, [BL-M6600XT1](https://jkrorwxhkqmllp5m-static.micyjz.com/BL-M6600XT1_datasheet_V1.0.1.0_230817-aidllBpoKqpljSRnkmnkjlnjp.pdf?dp=GvUApKfKKUAU), [HF-LPT6200](http://www.hi-flying.com/hf-lpt6200) (see [guide](https://www.elektroda.com/rtvforum/topic4111822.html))
|
||||
|
||||
|
||||
@ -41,26 +41,26 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* easyflash.c */
|
||||
EfErrCode easyflash_init(void);
|
||||
DllExport EfErrCode easyflash_init(void);
|
||||
|
||||
#ifdef EF_USING_ENV
|
||||
/* only supported on ef_env.c */
|
||||
size_t ef_get_env_blob(const char *key, void *value_buf, size_t buf_len, size_t *saved_value_len);
|
||||
bool ef_get_env_obj(const char *key, env_node_obj_t env);
|
||||
size_t ef_read_env_value(env_node_obj_t env, uint8_t *value_buf, size_t buf_len);
|
||||
EfErrCode ef_set_env_blob(const char *key, const void *value_buf, size_t buf_len);
|
||||
DllExport size_t ef_get_env_blob(const char *key, void *value_buf, size_t buf_len, size_t *saved_value_len);
|
||||
DllExport bool ef_get_env_obj(const char *key, env_node_obj_t env);
|
||||
DllExport size_t ef_read_env_value(env_node_obj_t env, uint8_t *value_buf, size_t buf_len);
|
||||
DllExport EfErrCode ef_set_env_blob(const char *key, const void *value_buf, size_t buf_len);
|
||||
|
||||
/* ef_env.c, ef_env_legacy_wl.c and ef_env_legacy.c */
|
||||
EfErrCode ef_load_env(void);
|
||||
void ef_print_env(void);
|
||||
char *ef_get_env(const char *key);
|
||||
EfErrCode ef_set_env(const char *key, const char *value);
|
||||
EfErrCode ef_del_env(const char *key);
|
||||
EfErrCode ef_save_env(void);
|
||||
EfErrCode ef_env_set_default(void);
|
||||
size_t ef_get_env_write_bytes(void);
|
||||
EfErrCode ef_set_and_save_env(const char *key, const char *value);
|
||||
EfErrCode ef_del_and_save_env(const char *key);
|
||||
DllExport EfErrCode ef_load_env(void);
|
||||
DllExport void ef_print_env(void);
|
||||
DllExport char *ef_get_env(const char *key);
|
||||
DllExport EfErrCode ef_set_env(const char *key, const char *value);
|
||||
DllExport EfErrCode ef_del_env(const char *key);
|
||||
DllExport EfErrCode ef_save_env(void);
|
||||
DllExport EfErrCode ef_env_set_default(void);
|
||||
DllExport size_t ef_get_env_write_bytes(void);
|
||||
DllExport EfErrCode ef_set_and_save_env(const char *key, const char *value);
|
||||
DllExport EfErrCode ef_del_and_save_env(const char *key);
|
||||
#endif
|
||||
|
||||
#ifdef EF_USING_IAP
|
||||
@ -88,17 +88,17 @@ size_t ef_log_get_used_size(void);
|
||||
#endif
|
||||
|
||||
/* ef_utils.c */
|
||||
uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size);
|
||||
DllExport uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size);
|
||||
|
||||
/* ef_port.c */
|
||||
EfErrCode ef_port_read(uint32_t addr, uint32_t *buf, size_t size);
|
||||
EfErrCode ef_port_erase(uint32_t addr, size_t size);
|
||||
EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size);
|
||||
void ef_port_env_lock(void);
|
||||
void ef_port_env_unlock(void);
|
||||
void ef_log_debug(const char *file, const long line, const char *format, ...);
|
||||
void ef_log_info(const char *format, ...);
|
||||
void ef_print(const char *format, ...);
|
||||
DllExport EfErrCode ef_port_read(uint32_t addr, uint32_t *buf, size_t size);
|
||||
DllExport EfErrCode ef_port_erase(uint32_t addr, size_t size);
|
||||
DllExport EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size);
|
||||
DllExport void ef_port_env_lock(void);
|
||||
DllExport void ef_port_env_unlock(void);
|
||||
DllExport void ef_log_debug(const char *file, const long line, const char *format, ...);
|
||||
DllExport void ef_log_info(const char *format, ...);
|
||||
DllExport void ef_print(const char *format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -132,10 +132,20 @@
|
||||
#define EF_START_ADDR 0xEF000
|
||||
#define ENV_AREA_SIZE 0x8000
|
||||
|
||||
#elif WINDOWS
|
||||
|
||||
#define EF_START_ADDR 0
|
||||
extern uint32_t ENV_AREA_SIZE;
|
||||
#define DllExport __declspec(dllexport)
|
||||
|
||||
#endif
|
||||
/* print debug information of flash */
|
||||
#ifdef PKG_EASYFLASH_DEBUG
|
||||
#define PRINT_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef DllExport
|
||||
#define DllExport
|
||||
#endif
|
||||
|
||||
#endif /* EF_CFG_H_ */
|
||||
|
||||
4
libraries/easyflash/ports/WinEF/.gitignore
vendored
Normal file
4
libraries/easyflash/ports/WinEF/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.vs
|
||||
x64
|
||||
WinEF
|
||||
Release
|
||||
100
libraries/easyflash/ports/WinEF/WinEF.vcxproj
Normal file
100
libraries/easyflash/ports/WinEF/WinEF.vcxproj
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{e827212d-b194-42be-9282-43fbdc5a4d38}</ProjectGuid>
|
||||
<RootNamespace>WinEF</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>./;../../inc;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>./;../../inc;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;WINEF_EXPORTS;_WINDOWS;_USRDLL;WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;WINEF_EXPORTS;_WINDOWS;_USRDLL;WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\easyflash.c" />
|
||||
<ClCompile Include="..\..\src\ef_env.c" />
|
||||
<ClCompile Include="..\..\src\ef_env_legacy.c" />
|
||||
<ClCompile Include="..\..\src\ef_env_legacy_wl.c" />
|
||||
<ClCompile Include="..\..\src\ef_iap.c" />
|
||||
<ClCompile Include="..\..\src\ef_log.c" />
|
||||
<ClCompile Include="..\..\src\ef_utils.c" />
|
||||
<ClCompile Include="..\ef_port.c" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
51
libraries/easyflash/ports/WinEF/WinEF.vcxproj.filters
Normal file
51
libraries/easyflash/ports/WinEF/WinEF.vcxproj.filters
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ef_port.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\easyflash.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_env.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_env_legacy.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_env_legacy_wl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_iap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_log.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_utils.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
libraries/easyflash/ports/WinEF/dllmain.cpp
Normal file
17
libraries/easyflash/ports/WinEF/dllmain.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "framework.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
5
libraries/easyflash/ports/WinEF/framework.h
Normal file
5
libraries/easyflash/ports/WinEF/framework.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
@ -30,9 +30,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#if !WINDOWS
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include "queue.h"
|
||||
#endif
|
||||
|
||||
#if PLATFORM_REALTEK
|
||||
|
||||
@ -53,6 +55,43 @@ flash_t flash;
|
||||
#include <image/flash.h>
|
||||
#define QueueHandle_t xQueueHandle
|
||||
|
||||
#elif WINDOWS
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
#define QueueHandle_t HANDLE
|
||||
extern QueueHandle_t ef_mutex;
|
||||
|
||||
BYTE* env_area = NULL;
|
||||
uint32_t ENV_AREA_SIZE = 0;
|
||||
|
||||
DllExport BYTE* get_env_area(void)
|
||||
{
|
||||
return env_area;
|
||||
}
|
||||
|
||||
DllExport void set_env_size(uint32_t size)
|
||||
{
|
||||
ENV_AREA_SIZE = size;
|
||||
if(env_area) free(env_area);
|
||||
env_area = malloc(size * sizeof(BYTE));
|
||||
}
|
||||
|
||||
HANDLE xSemaphoreCreateMutex()
|
||||
{
|
||||
return CreateMutex(NULL, FALSE, NULL);
|
||||
}
|
||||
|
||||
void xSemaphoreTake(HANDLE handle, int time)
|
||||
{
|
||||
WaitForSingleObject(ef_mutex, time);
|
||||
}
|
||||
|
||||
void xSemaphoreGive(HANDLE handle)
|
||||
{
|
||||
ReleaseMutex(ef_mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* default ENV set for user */
|
||||
@ -113,6 +152,9 @@ EfErrCode ef_port_read(uint32_t addr, uint32_t* buf, size_t size)
|
||||
if(res == 0) res = EF_READ_ERR;
|
||||
else res = EF_NO_ERR;
|
||||
return res;
|
||||
#elif WINDOWS
|
||||
memcpy(buf, env_area + addr, size);
|
||||
return EF_NO_ERR;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -147,6 +189,8 @@ EfErrCode ef_port_erase(uint32_t addr, size_t size)
|
||||
if(res != 0) res = EF_ERASE_ERR;
|
||||
else res = EF_NO_ERR;
|
||||
return res;
|
||||
#elif WINDOWS
|
||||
memset(env_area + addr, 0xFF, size);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
@ -180,6 +224,9 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t* buf, size_t size)
|
||||
if(res == 0) res = EF_WRITE_ERR;
|
||||
else res = EF_NO_ERR;
|
||||
return res;
|
||||
#elif WINDOWS
|
||||
memcpy(env_area + addr, buf, size);
|
||||
return EF_NO_ERR;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -114,6 +114,7 @@
|
||||
#define SECTOR_SIZE EF_ERASE_MIN_SIZE
|
||||
#define SECTOR_NUM (ENV_AREA_SIZE / (EF_ERASE_MIN_SIZE))
|
||||
|
||||
#if !WINDOWS
|
||||
#if (SECTOR_NUM < 2)
|
||||
#error "The sector number must lager then or equal to 2"
|
||||
#endif
|
||||
@ -121,6 +122,7 @@
|
||||
#if (EF_GC_EMPTY_SEC_THRESHOLD == 0 || EF_GC_EMPTY_SEC_THRESHOLD >= SECTOR_NUM)
|
||||
#error "There is at least one empty sector for GC."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SECTOR_HDR_DATA_SIZE (EF_WG_ALIGN(sizeof(struct sector_hdr_data)))
|
||||
#define SECTOR_DIRTY_OFFSET ((unsigned long)(&((struct sector_hdr_data *)0)->status_table.dirty))
|
||||
|
||||
@ -11,13 +11,31 @@
|
||||
extern void Main_Init();
|
||||
extern void Main_OnEverySecond();
|
||||
extern struct netif xnetif[NET_IF_NUM];
|
||||
extern int wifi_get_mac_address(char* mac);
|
||||
|
||||
rtw_mode_t wifi_mode = RTW_MODE_NONE;
|
||||
rtw_mode_t wifi_mode = RTW_MODE_STA;
|
||||
TaskHandle_t g_sys_task_handle1;
|
||||
uint8_t wmac[6] = { 0 };
|
||||
|
||||
static void obk_task(void* pvParameters)
|
||||
{
|
||||
char buf[21];
|
||||
wifi_get_mac_address(&buf);
|
||||
sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", &(wmac[0]), &(wmac[1]), &(wmac[2]), &(wmac[3]), &(wmac[4]), &(wmac[5]));
|
||||
if((wmac[0] == 0 && wmac[1] == 0 && wmac[2] == 0 && wmac[3] == 0 && wmac[4] == 0 && wmac[5] == 0) ||
|
||||
(wmac[0] == 0xFF && wmac[1] == 0xFF && wmac[2] == 0xFF && wmac[3] == 0xFF && wmac[4] == 0xFF && wmac[5] == 0xFF) ||
|
||||
(wmac[0] == 0 && wmac[1] == 0xE0 && wmac[2] == 0x4C && wmac[3] == 0x87 && wmac[4] == 0 && wmac[5] == 0))
|
||||
{
|
||||
// this is not mac, but at least it should be unique
|
||||
device_mutex_lock(RT_DEV_LOCK_EFUSE);
|
||||
for(int i = 0xF4; i < 0xFA; i++)
|
||||
{
|
||||
HALEFUSEOneByteReadROM(HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_EFUSE_CTRL), i, &wmac[i - 0xF4], 7);
|
||||
}
|
||||
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
|
||||
}
|
||||
WiFI_GetMacAddress(&wmac);
|
||||
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
Main_Init();
|
||||
for(;;)
|
||||
@ -33,14 +51,6 @@ int main(void)
|
||||
wlan_network();
|
||||
//sys_jtag_off();
|
||||
|
||||
// this is not mac, but at least it should be unique
|
||||
device_mutex_lock(RT_DEV_LOCK_EFUSE);
|
||||
for(int i = 0xF4; i < 0xFA; i++)
|
||||
{
|
||||
HALEFUSEOneByteReadROM(HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_EFUSE_CTRL), i, &wmac[i - 0xF4], 7);
|
||||
}
|
||||
device_mutex_unlock(RT_DEV_LOCK_EFUSE);
|
||||
|
||||
xTaskCreate(
|
||||
obk_task,
|
||||
"OpenBeken",
|
||||
|
||||
@ -17,6 +17,7 @@ CSRC += hal/realtek/hal_wifi_realtek.c
|
||||
OBK_SRCS =
|
||||
include $(EFDIR)/../platforms/obk_main.mk
|
||||
CSRC += $(OBKM_SRC)
|
||||
CPPSRC += $(OBKM_SRC_CXX)
|
||||
MODULE_IFLAGS += $(OBK_CFLAGS)
|
||||
|
||||
CSRC += libraries/easyflash/ports/ef_port.c
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include "main.h"
|
||||
#include "wifi_constants.h"
|
||||
#include "rom_map.h"
|
||||
#include "flash_api.h"
|
||||
#include "rtl8721d_flash.h"
|
||||
#include "device_lock.h"
|
||||
|
||||
extern void wlan_network(void);
|
||||
@ -119,7 +119,7 @@ static void app_dslp_wake(void)
|
||||
extern void Main_Init();
|
||||
extern void Main_OnEverySecond();
|
||||
extern uint32_t ota_get_cur_index(void);
|
||||
extern flash_t flash;
|
||||
extern void WiFI_GetMacAddress(char* mac);
|
||||
|
||||
TaskHandle_t g_sys_task_handle1;
|
||||
uint8_t wmac[6] = { 0 };
|
||||
@ -132,6 +132,7 @@ __attribute__((weak)) void _fini(void) {}
|
||||
|
||||
static void obk_task(void* pvParameters)
|
||||
{
|
||||
WiFI_GetMacAddress(&wmac);
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
Main_Init();
|
||||
for(;;)
|
||||
@ -182,18 +183,9 @@ int main(void)
|
||||
free(efuse);
|
||||
current_fw_idx = ota_get_cur_index();
|
||||
|
||||
uint8_t flash_size;
|
||||
do
|
||||
{
|
||||
// HACK: determine flash size by reading 0x96969999 (boot signature).
|
||||
uint32_t fboot;
|
||||
device_mutex_lock(RT_DEV_LOCK_FLASH);
|
||||
flash_read_word(&flash, flash_size_8720 << 20, &fboot);
|
||||
device_mutex_unlock(RT_DEV_LOCK_FLASH);
|
||||
if(fboot == 0x96969999) flash_size = flash_size_8720;
|
||||
} while((flash_size_8720 /= 2) >= 2);
|
||||
|
||||
flash_size_8720 = flash_size;
|
||||
uint8_t flash_ID[4];
|
||||
FLASH_RxCmd(flash_init_para.FLASH_cmd_rd_id, 3, flash_ID);
|
||||
flash_size_8720 = (1 << (flash_ID[2] - 0x11)) / 8;
|
||||
app_start_autoicg();
|
||||
//app_shared_btmem(ENABLE);
|
||||
|
||||
|
||||
63
platforms/RTL8720E/CMakeLists.txt
Normal file
63
platforms/RTL8720E/CMakeLists.txt
Normal file
@ -0,0 +1,63 @@
|
||||
ameba_internal_library(OpenBeken)
|
||||
|
||||
set(public_definitions)
|
||||
set(SDK_CJSON true)
|
||||
set(SDK_LFS true)
|
||||
set(OBK_SRCS "../../src/")
|
||||
set(BERRY_SRCPATH "../../libraries/berry/src")
|
||||
set(BERRY_MODULEPATH "${OBK_SRCS}berry/modules")
|
||||
|
||||
include(../obk_main.cmake)
|
||||
include(../../libraries/berry.cmake)
|
||||
|
||||
ameba_list_append(public_definitions LWIP_NETIF_HOSTNAME=1 TCP_MSL=1000)
|
||||
ameba_global_define(${public_definitions})
|
||||
|
||||
add_compile_definitions(
|
||||
PLATFORM_REALTEK=1
|
||||
PLATFORM_REALTEK_NEW=1
|
||||
PLATFORM_RTL8720E=1
|
||||
)
|
||||
|
||||
if(DEFINED ENV{APP_VERSION})
|
||||
add_compile_definitions(USER_SW_VER="$ENV{APP_VERSION}")
|
||||
endif()
|
||||
if(DEFINED ENV{OBK_VARIANT})
|
||||
add_compile_definitions(OBK_VARIANT=$ENV{OBK_VARIANT})
|
||||
endif()
|
||||
|
||||
target_compile_options(
|
||||
${CURRENT_LIB_NAME} PRIVATE
|
||||
-Wno-undef
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-variable
|
||||
-Wno-implicit-fallthrough
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-error
|
||||
"$<$<COMPILE_LANGUAGE:C>:-Wno-strict-prototypes>"
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${CURRENT_LIB_NAME} PRIVATE
|
||||
../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${BERRY_SRCPATH}
|
||||
)
|
||||
|
||||
target_sources(
|
||||
${CURRENT_LIB_NAME} PRIVATE
|
||||
|
||||
${OBK_SRCS}hal/realtek/hal_flashConfig_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_flashVars_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_generic_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_pins_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_wifi_realtek_new.c
|
||||
${OBK_SRCS}hal/realtek/rtl8721da/hal_main_rtl8721da.c
|
||||
${OBK_SRCS}hal/realtek/rtl8720e/hal_pins_rtl8720e.c
|
||||
${OBK_SRCS}hal/realtek/rtl8721da/hal_uart_rtl8721da.c
|
||||
|
||||
${OBKM_SRC}
|
||||
${OBKM_SRC_CXX}
|
||||
${BERRY_SRC_C}
|
||||
../../libraries/mqtt_patched.c
|
||||
)
|
||||
7
platforms/RTL8720E/default.conf
Normal file
7
platforms/RTL8720E/default.conf
Normal file
@ -0,0 +1,7 @@
|
||||
CONFIG_SUPPORT_ATCMD=n
|
||||
CONFIG_ATCMD_NETWORK=n
|
||||
CONFIG_VFS_LITTLEFS_INCLUDED=n
|
||||
CONFIG_KERNEL=y
|
||||
CONFIG_LWIP_NETCONN_SEM_PER_THREAD_MENU=y
|
||||
CONFIG_MBEDTLS_ENABLED_MENU=y
|
||||
CONFIG_LWIP_IPV6=n
|
||||
3
platforms/RTL8720E/device_lock.h
Normal file
3
platforms/RTL8720E/device_lock.h
Normal file
@ -0,0 +1,3 @@
|
||||
#define RT_DEV_LOCK_FLASH 0
|
||||
#define device_mutex_lock(x)
|
||||
#define device_mutex_unlock(x)
|
||||
7
platforms/RTL8720E/easyflash.h
Normal file
7
platforms/RTL8720E/easyflash.h
Normal file
@ -0,0 +1,7 @@
|
||||
#include "kv.h"
|
||||
#define ef_get_env_blob(a,b,c,d) rt_kv_get(a,b,c)
|
||||
#define ef_set_env_blob rt_kv_set
|
||||
#define EF_ENV_INIT_FAILED -1
|
||||
#define EF_ENV_NAME_ERR -1
|
||||
#define easyflash_init()
|
||||
typedef int EfErrCode;
|
||||
63
platforms/RTL8721DA/CMakeLists.txt
Normal file
63
platforms/RTL8721DA/CMakeLists.txt
Normal file
@ -0,0 +1,63 @@
|
||||
ameba_internal_library(OpenBeken)
|
||||
|
||||
set(public_definitions)
|
||||
set(SDK_CJSON true)
|
||||
set(SDK_LFS true)
|
||||
set(OBK_SRCS "../../src/")
|
||||
set(BERRY_SRCPATH "../../libraries/berry/src")
|
||||
set(BERRY_MODULEPATH "${OBK_SRCS}berry/modules")
|
||||
|
||||
include(../obk_main.cmake)
|
||||
include(../../libraries/berry.cmake)
|
||||
|
||||
ameba_list_append(public_definitions LWIP_NETIF_HOSTNAME=1 TCP_MSL=1000)
|
||||
ameba_global_define(${public_definitions})
|
||||
|
||||
add_compile_definitions(
|
||||
PLATFORM_REALTEK=1
|
||||
PLATFORM_REALTEK_NEW=1
|
||||
PLATFORM_RTL8721DA=1
|
||||
)
|
||||
|
||||
if(DEFINED ENV{APP_VERSION})
|
||||
add_compile_definitions(USER_SW_VER="$ENV{APP_VERSION}")
|
||||
endif()
|
||||
if(DEFINED ENV{OBK_VARIANT})
|
||||
add_compile_definitions(OBK_VARIANT=$ENV{OBK_VARIANT})
|
||||
endif()
|
||||
|
||||
target_compile_options(
|
||||
${CURRENT_LIB_NAME} PRIVATE
|
||||
-Wno-undef
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-variable
|
||||
-Wno-implicit-fallthrough
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-error
|
||||
"$<$<COMPILE_LANGUAGE:C>:-Wno-strict-prototypes>"
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${CURRENT_LIB_NAME} PRIVATE
|
||||
../../include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${BERRY_SRCPATH}
|
||||
)
|
||||
|
||||
target_sources(
|
||||
${CURRENT_LIB_NAME} PRIVATE
|
||||
|
||||
${OBK_SRCS}hal/realtek/hal_flashConfig_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_flashVars_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_generic_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_pins_realtek.c
|
||||
${OBK_SRCS}hal/realtek/hal_wifi_realtek_new.c
|
||||
${OBK_SRCS}hal/realtek/rtl8721da/hal_main_rtl8721da.c
|
||||
${OBK_SRCS}hal/realtek/rtl8721da/hal_pins_rtl8721da.c
|
||||
${OBK_SRCS}hal/realtek/rtl8721da/hal_uart_rtl8721da.c
|
||||
|
||||
${OBKM_SRC}
|
||||
${OBKM_SRC_CXX}
|
||||
${BERRY_SRC_C}
|
||||
../../libraries/mqtt_patched.c
|
||||
)
|
||||
7
platforms/RTL8721DA/default.conf
Normal file
7
platforms/RTL8721DA/default.conf
Normal file
@ -0,0 +1,7 @@
|
||||
CONFIG_SUPPORT_ATCMD=n
|
||||
CONFIG_ATCMD_NETWORK=n
|
||||
CONFIG_VFS_LITTLEFS_INCLUDED=n
|
||||
CONFIG_KERNEL=y
|
||||
CONFIG_LWIP_NETCONN_SEM_PER_THREAD_MENU=y
|
||||
CONFIG_MBEDTLS_ENABLED_MENU=y
|
||||
CONFIG_LWIP_IPV6=n
|
||||
3
platforms/RTL8721DA/device_lock.h
Normal file
3
platforms/RTL8721DA/device_lock.h
Normal file
@ -0,0 +1,3 @@
|
||||
#define RT_DEV_LOCK_FLASH 0
|
||||
#define device_mutex_lock(x)
|
||||
#define device_mutex_unlock(x)
|
||||
7
platforms/RTL8721DA/easyflash.h
Normal file
7
platforms/RTL8721DA/easyflash.h
Normal file
@ -0,0 +1,7 @@
|
||||
#include "kv.h"
|
||||
#define ef_get_env_blob(a,b,c,d) rt_kv_get(a,b,c)
|
||||
#define ef_set_env_blob rt_kv_set
|
||||
#define EF_ENV_INIT_FAILED -1
|
||||
#define EF_ENV_NAME_ERR -1
|
||||
#define easyflash_init()
|
||||
typedef int EfErrCode;
|
||||
@ -19,7 +19,9 @@ SRC_C += $(OBK_DIR)/src/hal/realtek/hal_wifi_realtek.c
|
||||
OBK_SRCS = $(OBK_DIR)/src/
|
||||
include $(OBK_DIR)/platforms/obk_main.mk
|
||||
SRC_C += $(OBKM_SRC)
|
||||
SRC_CPP += $(OBKM_SRC_CXX)
|
||||
CFLAGS += $(OBK_CFLAGS)
|
||||
CPPFLAGS += $(INCLUDES) -fpermissive
|
||||
|
||||
SRC_C += $(OBK_DIR)/libraries/easyflash/ports/ef_port.c
|
||||
SRC_C += $(OBK_DIR)/libraries/easyflash/src/easyflash.c
|
||||
|
||||
@ -4,7 +4,6 @@ set(OBKM_SRC
|
||||
${OBK_SRCS}base64/base64.c
|
||||
${OBK_SRCS}bitmessage/bitmessage_read.c
|
||||
${OBK_SRCS}bitmessage/bitmessage_write.c
|
||||
${OBK_SRCS}cJSON/cJSON.c
|
||||
${OBK_SRCS}cmnds/cmd_berry.c
|
||||
${OBK_SRCS}cmnds/cmd_channels.c
|
||||
${OBK_SRCS}cmnds/cmd_eventHandlers.c
|
||||
@ -52,8 +51,6 @@ set(OBKM_SRC
|
||||
${OBK_SRCS}httpclient/http_client.c
|
||||
${OBK_SRCS}httpclient/utils_net.c
|
||||
${OBK_SRCS}httpclient/utils_timer.c
|
||||
${OBK_SRCS}littlefs/lfs_util.c
|
||||
${OBK_SRCS}littlefs/lfs.c
|
||||
${OBK_SRCS}littlefs/our_lfs.c
|
||||
${OBK_SRCS}ota/ota.c
|
||||
|
||||
@ -124,6 +121,7 @@ set(OBKM_SRC
|
||||
${OBK_SRCS}driver/drv_spidma.c
|
||||
${OBK_SRCS}driver/drv_ssdp.c
|
||||
${OBK_SRCS}driver/drv_tasmotaDeviceGroups.c
|
||||
${OBK_SRCS}driver/drv_tclAC.c
|
||||
${OBK_SRCS}driver/drv_test.c
|
||||
${OBK_SRCS}driver/drv_test_drivers.c
|
||||
${OBK_SRCS}driver/drv_textScroller.c
|
||||
@ -146,3 +144,104 @@ set(OBKM_SRC
|
||||
# ${OBK_SRCS}driver/drv_bmp280.c
|
||||
# ${OBK_SRCS}driver/drv_test_charts.c
|
||||
)
|
||||
|
||||
|
||||
if(NOT DEFINED SDK_CJSON)
|
||||
set(OBKM_SRC ${OBKM_SRC} ${OBK_SRCS}cJSON/cJSON.c)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED SDK_LFS)
|
||||
set(OBKM_SRC ${OBKM_SRC} ${OBK_SRCS}littlefs/lfs.c ${OBK_SRCS}littlefs/lfs_util.c)
|
||||
endif()
|
||||
|
||||
set(OBKM_SRC_CXX
|
||||
${OBK_SRCS}driver/drv_ir.cpp
|
||||
${OBK_SRCS}driver/drv_ir_new.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRac.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRproto.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRrecv.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRsend.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRtext.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRtimer.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/IRutils.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/String.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/digitalWriteFast.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Airton.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Airwell.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Aiwa.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Amcor.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Argo.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Arris.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Bosch.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Bose.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Carrier.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_ClimaButler.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Coolix.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Corona.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Daikin.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Delonghi.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Denon.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Dish.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Doshisha.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Ecoclim.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Electra.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_EliteScreens.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Epson.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Fujitsu.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_GICable.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_GlobalCache.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Goodweather.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Gorenje.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Gree.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Haier.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Hitachi.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Inax.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_JVC.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Kelon.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Kelvinator.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_LG.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Lasertag.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Lego.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Lutron.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_MWM.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Magiquest.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Metz.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Midea.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_MilesTag2.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Mirage.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Mitsubishi.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_MitsubishiHeavy.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Multibrackets.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_NEC.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Neoclima.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Nikai.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Panasonic.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Pioneer.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Pronto.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_RC5_RC6.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_RCMM.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Rhoss.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Samsung.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Sanyo.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Sharp.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Sherwood.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Sony.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Symphony.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Tcl.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Technibel.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Teco.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Teknopoint.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Toshiba.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Toto.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Transcold.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Trotec.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Truma.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Vestel.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Voltas.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Whirlpool.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Whynter.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Wowwee.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Xmp.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/ir_Zepeal.cpp
|
||||
${OBK_SRCS}libraries/IRremoteESP8266/src/itoa.cpp
|
||||
)
|
||||
|
||||
@ -162,6 +162,90 @@ OBKM_SRC += $(OBK_SRCS)i2c/drv_i2c_tc74.c
|
||||
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)driver/drv_ir.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)driver/drv_ir_new.cpp
|
||||
OBKM_SRC_CXX += $(wildcard $(OBK_SRCS)libraries/IRremoteESP8266/src/*.cpp)
|
||||
|
||||
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRac.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRproto.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRrecv.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRsend.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRtext.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRtimer.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/IRutils.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/String.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/digitalWriteFast.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Airton.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Airwell.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Aiwa.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Amcor.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Argo.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Arris.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Bosch.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Bose.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Carrier.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_ClimaButler.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Coolix.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Corona.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Daikin.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Delonghi.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Denon.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Dish.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Doshisha.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Ecoclim.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Electra.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_EliteScreens.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Epson.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Fujitsu.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_GICable.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_GlobalCache.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Goodweather.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Gorenje.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Gree.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Haier.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Hitachi.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Inax.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_JVC.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Kelon.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Kelvinator.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_LG.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Lasertag.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Lego.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Lutron.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_MWM.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Magiquest.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Metz.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Midea.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_MilesTag2.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Mirage.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Mitsubishi.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_MitsubishiHeavy.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Multibrackets.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_NEC.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Neoclima.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Nikai.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Panasonic.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Pioneer.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Pronto.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_RC5_RC6.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_RCMM.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Rhoss.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Samsung.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Sanyo.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Sharp.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Sherwood.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Sony.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Symphony.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Tcl.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Technibel.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Teco.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Teknopoint.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Toshiba.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Toto.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Transcold.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Trotec.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Truma.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Vestel.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Voltas.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Whirlpool.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Whynter.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Wowwee.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Xmp.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/ir_Zepeal.cpp
|
||||
OBKM_SRC_CXX += $(OBK_SRCS)libraries/IRremoteESP8266/src/itoa.cpp
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 7a30c20f85cdad6eaaaac4a8d856e321cc7149e6
|
||||
Subproject commit a25781506cd4dce8f9bd83c2d886dc333497442e
|
||||
@ -1 +1 @@
|
||||
Subproject commit 017865becde77deab40cc82ec2f8e0ca2ec5d963
|
||||
Subproject commit 029e4ed1c895111b28540a83428f66fe4e8a2e6e
|
||||
1
sdk/ameba-rtos
Submodule
1
sdk/ameba-rtos
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 347af9133679eacb10b368010f9ce5e143ff1643
|
||||
@ -49,7 +49,9 @@ extern void rtw_enable_wlan_low_pwr_mode(WLAN_LOW_PW_MODE mode);
|
||||
#elif PLATFORM_RTL8720D
|
||||
extern void SystemSetCpuClk(unsigned char CpuClk);
|
||||
#endif
|
||||
#if !PLATFORM_REALTEK_NEW
|
||||
#include "wifi_conf.h"
|
||||
#endif
|
||||
int g_sleepfactor = 1;
|
||||
#elif PLATFORM_BEKEN_NEW
|
||||
#include "co_math.h"
|
||||
|
||||
@ -41,8 +41,7 @@
|
||||
#elif PLATFORM_REALTEK
|
||||
|
||||
#include "gpio_irq_api.h"
|
||||
#include "../hal/realtek/hal_generic_realtek.h"
|
||||
extern rtlPinMapping_t g_pins[];
|
||||
#include "../hal/realtek/hal_pinmap_realtek.h"
|
||||
rtlPinMapping_t* rtl_cf;
|
||||
rtlPinMapping_t* rtl_cf1;
|
||||
|
||||
|
||||
@ -8,28 +8,40 @@ extern "C" {
|
||||
// these cause error: conflicting declaration of 'int bk_wlan_mcu_suppress_and_sleep(unsigned int)' with 'C' linkage
|
||||
#include "../new_common.h"
|
||||
|
||||
#include "include.h"
|
||||
#include "arm_arch.h"
|
||||
#include "../new_pins.h"
|
||||
#include "../new_cfg.h"
|
||||
#include "../logging/logging.h"
|
||||
#include "../obk_config.h"
|
||||
#include "../cmnds/cmd_public.h"
|
||||
#include "../hal/hal_pins.h"
|
||||
#include "../hal/hal_generic.h"
|
||||
|
||||
#if PLATFORM_BEKEN
|
||||
#include "include.h"
|
||||
#include "arm_arch.h"
|
||||
#include "bk_timer_pub.h"
|
||||
#include "drv_model_pub.h"
|
||||
|
||||
// why can;t I call this?
|
||||
#include "../mqtt/new_mqtt.h"
|
||||
|
||||
#include <gpio_pub.h>
|
||||
//#include "pwm.h"
|
||||
#include "pwm_pub.h"
|
||||
|
||||
#include "../../beken378/func/include/net_param_pub.h"
|
||||
#include "../../beken378/func/user_driver/BkDriverPwm.h"
|
||||
#include "../../beken378/func/user_driver/BkDriverI2c.h"
|
||||
#include "../../beken378/driver/i2c/i2c1.h"
|
||||
#include "../../beken378/driver/gpio/gpio.h"
|
||||
#elif PLATFORM_REALTEK
|
||||
#define MBED_PERIPHERALNAMES_H
|
||||
#include "timer_api.h"
|
||||
#include "pwmout_api.h"
|
||||
#include "../hal/realtek/hal_pinmap_realtek.h"
|
||||
void pwmout_start(pwmout_t* obj);
|
||||
void pwmout_stop(pwmout_t* obj);
|
||||
#endif
|
||||
|
||||
// why can;t I call this?
|
||||
#include "../mqtt/new_mqtt.h"
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned long ir_counter = 0;
|
||||
@ -39,6 +51,7 @@ extern "C" {
|
||||
uint8_t gIRPinPolarity = 0;
|
||||
|
||||
extern int my_strnicmp(const char* a, const char* b, int len);
|
||||
extern unsigned int g_timeMs;
|
||||
}
|
||||
|
||||
|
||||
@ -59,24 +72,34 @@ typedef unsigned short uint16_t;
|
||||
#define __FlashStringHelper char
|
||||
|
||||
// dummy functions
|
||||
void noInterrupts() {}
|
||||
void interrupts() {}
|
||||
|
||||
unsigned long millis() {
|
||||
#if PLATFORM_BEKEN
|
||||
void noInterrupts() { }
|
||||
void interrupts() { }
|
||||
void delay(int n) { }
|
||||
void delayMicroseconds(int n) { }
|
||||
unsigned long millis()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
unsigned long micros() {
|
||||
unsigned long micros()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void delay(int n) {
|
||||
return;
|
||||
#else
|
||||
void noInterrupts() { taskENTER_CRITICAL(); }
|
||||
void interrupts() { taskEXIT_CRITICAL(); }
|
||||
void delay(int n) { delay_ms(n); }
|
||||
void delayMicroseconds(int n) { HAL_Delay_us(n); }
|
||||
unsigned long millis()
|
||||
{
|
||||
return g_timeMs;
|
||||
}
|
||||
|
||||
void delayMicroseconds(int n) {
|
||||
return;
|
||||
unsigned long micros()
|
||||
{
|
||||
return g_timeMs * 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
class Print {
|
||||
public:
|
||||
@ -107,10 +130,21 @@ Print Serial;
|
||||
// #define ISR void IR_ISR
|
||||
|
||||
// THIS function is defined in src/libraries/IRremoteESP8266/src/IRrecv.cpp
|
||||
extern "C" void DRV_IR_ISR(UINT8 t);
|
||||
extern "C" void
|
||||
#if PLATFORM_BEKEN
|
||||
DRV_IR_ISR(UINT8 t)
|
||||
#else
|
||||
DRV_IR_ISR()
|
||||
#endif
|
||||
;
|
||||
extern void IR_ISR();
|
||||
|
||||
#if PLATFORM_BEKEN
|
||||
static UINT32 ir_chan = BKTIMER0;
|
||||
#elif PLATFORM_REALTEK
|
||||
static gtimer_t ir_timer;
|
||||
static UINT32 ir_chan = TIMER2;
|
||||
#endif
|
||||
static UINT32 ir_div = 1;
|
||||
static UINT32 ir_periodus = 50;
|
||||
|
||||
@ -121,6 +155,7 @@ void timerConfigForReceive() {
|
||||
void _timerConfigForReceive() {
|
||||
ir_counter = 0;
|
||||
|
||||
#if PLATFORM_BEKEN
|
||||
timer_param_t params = {
|
||||
(unsigned char)ir_chan,
|
||||
(unsigned char)ir_div, // div
|
||||
@ -156,6 +191,9 @@ void _timerConfigForReceive() {
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, (char *)"ir timer setup %u", res);
|
||||
res = sddev_control((char *)TIMER_DEV_NAME, CMD_TIMER_UNIT_ENABLE, &ir_chan);
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, (char *)"ir timer enabled %u", res);
|
||||
#elif PLATFORM_REALTEK
|
||||
gtimer_init(&ir_timer, ir_chan);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void timer_enable() {
|
||||
@ -163,13 +201,21 @@ static void timer_enable() {
|
||||
static void timer_disable() {
|
||||
}
|
||||
static void _timer_enable() {
|
||||
UINT32 res;
|
||||
UINT32 res = 0;
|
||||
#if PLATFORM_BEKEN
|
||||
res = sddev_control((char *)TIMER_DEV_NAME, CMD_TIMER_UNIT_ENABLE, &ir_chan);
|
||||
#elif PLATFORM_REALTEK
|
||||
gtimer_start_periodical(&ir_timer, ir_periodus, (void*)&DRV_IR_ISR, (uint32_t)&ir_timer);
|
||||
#endif
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, (char *)"ir timer enabled %u", res);
|
||||
}
|
||||
static void _timer_disable() {
|
||||
UINT32 res;
|
||||
UINT32 res = 0;
|
||||
#if PLATFORM_BEKEN
|
||||
res = sddev_control((char *)TIMER_DEV_NAME, CMD_TIMER_UNIT_DISABLE, &ir_chan);
|
||||
#elif PLATFORM_REALTEK
|
||||
gtimer_stop(&ir_timer);
|
||||
#endif
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, (char *)"ir timer disabled %u", res);
|
||||
}
|
||||
|
||||
@ -197,8 +243,6 @@ SpoofIrReceiver IrReceiver;
|
||||
#include "../libraries/IRremoteESP8266/src/IRproto.h"
|
||||
#include "../libraries/IRremoteESP8266/src/digitalWriteFast.h"
|
||||
|
||||
extern "C" int PIN_GetPWMIndexForPinIndex(int pin);
|
||||
|
||||
// override aspects of sending for our own interrupt driven sends
|
||||
// basically, IRsend calls mark(us) and space(us) to send.
|
||||
// we simply note the numbers into a rolling buffer, assume the first is a mark()
|
||||
@ -262,19 +306,10 @@ public:
|
||||
ADDLOG_INFO(LOG_FEATURE_IR, (char *)"enableIROut %d freq %d duty",(int)freq, (int)duty);
|
||||
if(duty<1)
|
||||
duty=1;
|
||||
if(duty>100)
|
||||
duty=100;
|
||||
// just setup variables for use in ISR
|
||||
//pwmfrequency = ((uint32_t)aFrequencyKHz) * 1000;
|
||||
pwmperiod = (26000000 / freq);
|
||||
pwmduty = pwmperiod / (100/duty);
|
||||
|
||||
|
||||
#if PLATFORM_BK7231N
|
||||
bk_pwm_update_param((bk_pwm_t)this->pwmIndex, this->pwmperiod, pwmduty, 0, 0);
|
||||
#else
|
||||
bk_pwm_update_param((bk_pwm_t)this->pwmIndex, this->pwmperiod, pwmduty);
|
||||
#endif
|
||||
pwmduty = duty;
|
||||
|
||||
HAL_PIN_PWM_Start(this->sendPin, freq);
|
||||
HAL_PIN_PWM_Update(this->sendPin, duty);
|
||||
}
|
||||
|
||||
void resetsendqueue() {
|
||||
@ -302,14 +337,21 @@ public:
|
||||
}
|
||||
return val;
|
||||
}
|
||||
#if PLATFORM_REALTEK
|
||||
void ledOff()
|
||||
{
|
||||
pwmout_start(g_pins[sendPin].pwm);
|
||||
}
|
||||
|
||||
void ledOn()
|
||||
{
|
||||
pwmout_stop(g_pins[sendPin].pwm);
|
||||
}
|
||||
#endif
|
||||
int currentsendtime;
|
||||
int currentbitval;
|
||||
|
||||
uint8_t sendPin;
|
||||
uint8_t pwmIndex;
|
||||
uint32_t pwmfrequency;
|
||||
uint32_t pwmperiod;
|
||||
uint32_t pwmduty;
|
||||
|
||||
uint32_t our_ms;
|
||||
@ -323,9 +365,15 @@ IRrecv *ourReceiver = NULL;
|
||||
|
||||
// this is our ISR.
|
||||
// it is called every 50us, so we need to work on making it as efficient as possible.
|
||||
extern "C" void DRV_IR_ISR(UINT8 t) {
|
||||
extern "C" void
|
||||
#if PLATFORM_BEKEN
|
||||
DRV_IR_ISR(UINT8 t)
|
||||
#else
|
||||
DRV_IR_ISR()
|
||||
#endif
|
||||
{
|
||||
int sending = 0;
|
||||
if (pIRsend && (pIRsend->pwmIndex >= 0)) {
|
||||
if (pIRsend) {
|
||||
pIRsend->our_us += 50;
|
||||
if (pIRsend->our_us > 1000) {
|
||||
pIRsend->our_ms++;
|
||||
@ -373,17 +421,13 @@ extern "C" void DRV_IR_ISR(UINT8 t) {
|
||||
uint32_t duty = pIRsend->pwmduty;
|
||||
if (!pinval) {
|
||||
if (gIRPinPolarity) {
|
||||
duty = pIRsend->pwmperiod;
|
||||
duty = 100;
|
||||
}
|
||||
else {
|
||||
duty = 0;
|
||||
}
|
||||
}
|
||||
#if PLATFORM_BK7231N
|
||||
bk_pwm_update_param((bk_pwm_t)pIRsend->pwmIndex, pIRsend->pwmperiod, duty, 0, 0);
|
||||
#else
|
||||
bk_pwm_update_param((bk_pwm_t)pIRsend->pwmIndex, pIRsend->pwmperiod, duty);
|
||||
#endif
|
||||
HAL_PIN_PWM_Update(pIRsend->sendPin, duty);
|
||||
}
|
||||
|
||||
// is someone really wants rx and TX at the same time, then allow it.
|
||||
@ -729,28 +773,16 @@ extern "C" void DRV_IR_Init() {
|
||||
}
|
||||
|
||||
if (txpin > 0) {
|
||||
int pwmIndex = PIN_GetPWMIndexForPinIndex(txpin);
|
||||
// is this pin capable of PWM?
|
||||
if (pwmIndex != -1) {
|
||||
if (HAL_PIN_CanThisPinBePWM(txpin)) {
|
||||
uint32_t pwmfrequency = 38000;
|
||||
uint32_t period = (26000000 / pwmfrequency);
|
||||
uint32_t duty = period / 2;
|
||||
#if PLATFORM_BK7231N
|
||||
// OSStatus bk_pwm_initialize(bk_pwm_t pwm, uint32_t frequency, uint32_t duty_cycle);
|
||||
bk_pwm_initialize((bk_pwm_t)pwmIndex, period, duty, 0, 0);
|
||||
#else
|
||||
bk_pwm_initialize((bk_pwm_t)pwmIndex, period, duty);
|
||||
#endif
|
||||
bk_pwm_start((bk_pwm_t)pwmIndex);
|
||||
HAL_PIN_PWM_Start(txpin, pwmfrequency);
|
||||
myIRsend *pIRsendTemp = new myIRsend((uint_fast8_t)txpin);
|
||||
pIRsendTemp->resetsendqueue();
|
||||
pIRsendTemp->enableIROut(pwmfrequency,50);
|
||||
pIRsendTemp->pwmIndex = pwmIndex;
|
||||
pIRsendTemp->pwmduty = duty;
|
||||
pIRsendTemp->pwmperiod = period;
|
||||
pIRsendTemp->enableIROut(pwmfrequency, 50);
|
||||
pIRsendTemp->pwmduty = 50;
|
||||
|
||||
pIRsend = pIRsendTemp;
|
||||
//bk_pwm_stop((bk_pwm_t)pIRsend->pwmIndex);
|
||||
|
||||
//cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
|
||||
//cmddetail:"descr":"Sends IR commands in the form PROT-ADDR-CMD-REP, e.g. NEC-1-1A-0",
|
||||
@ -779,6 +811,7 @@ extern "C" void DRV_IR_Init() {
|
||||
if ((pin > 0) || (txpin > 0)) {
|
||||
// both tx and rx need the interrupt
|
||||
_timerConfigForReceive();
|
||||
delay_ms(10);
|
||||
_timer_enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "../httpserver/new_http.h"
|
||||
#include "../hal/hal_pins.h"
|
||||
|
||||
#if !defined(PLATFORM_ESPIDF) && !defined(PLATFORM_XR806) && !defined(PLATFORM_XR872) && !defined(PLATFORM_ESP8266)
|
||||
#if !PLATFORM_ESPIDF && !PLATFORM_XR806 && !PLATFORM_XR872 && !PLATFORM_ESP8266 && !PLATFORM_REALTEK_NEW
|
||||
void usleep(int r) //delay function do 10*r nops, because rtos_delay_milliseconds is too much
|
||||
{
|
||||
#ifdef WIN32
|
||||
|
||||
@ -2,9 +2,11 @@
|
||||
#include "../new_pins.h"
|
||||
#include "../new_cfg.h"
|
||||
#include "../quicktick.h"
|
||||
#include "../cmnds/cmd_public.h"
|
||||
#include "../logging/logging.h"
|
||||
#include "errno.h"
|
||||
#include <lwip/sockets.h>
|
||||
#include "drv_uart.h"
|
||||
|
||||
#if ENABLE_DRIVER_UART_TCP
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include "../../beken378/driver/gpio/gpio.h"
|
||||
|
||||
// must fit all pwm indexes
|
||||
static uint32_t g_periods[6];
|
||||
static uint32_t g_periods[6] = { 0 };
|
||||
|
||||
int PIN_GetPWMIndexForPinIndex(int pin)
|
||||
{
|
||||
@ -94,6 +94,7 @@ void HAL_PIN_PWM_Stop(int index) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_periods[pwmIndex] = 0;
|
||||
bk_pwm_stop(pwmIndex);
|
||||
}
|
||||
|
||||
@ -108,6 +109,12 @@ void HAL_PIN_PWM_Start(int index, int freq) {
|
||||
}
|
||||
|
||||
uint32_t period = (26000000 / freq);
|
||||
if(g_periods[pwmIndex] != 0 && g_periods[pwmIndex] != period)
|
||||
{
|
||||
g_periods[pwmIndex] = period;
|
||||
return;
|
||||
}
|
||||
|
||||
g_periods[pwmIndex] = period;
|
||||
#if defined(PLATFORM_BK7231N) && !defined(PLATFORM_BEKEN_NEW)
|
||||
// OSStatus bk_pwm_initialize(bk_pwm_t pwm, uint32_t frequency, uint32_t duty_cycle);
|
||||
|
||||
@ -44,7 +44,7 @@ void app_main(void)
|
||||
#if !CONFIG_IDF_TARGET_ESP32 && !PLATFORM_ESP8266
|
||||
temperature_sensor_config_t temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(-10, 80);
|
||||
temperature_sensor_install(&temp_sensor_config, &temp_handle);
|
||||
xTaskCreate(temp_func, "IntTemp", TEMP_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
|
||||
xTaskCreate(temp_func, "IntTemp", TEMP_STACK_SIZE, NULL, 16, NULL);
|
||||
#endif
|
||||
|
||||
#if PLATFORM_ESP8266
|
||||
|
||||
@ -15,7 +15,11 @@ extern int g_sleepfactor;
|
||||
|
||||
void HAL_RebootModule()
|
||||
{
|
||||
#if !PLATFORM_REALTEK_NEW
|
||||
ota_platform_reset();
|
||||
#else
|
||||
sys_reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void HAL_Delay_us(int delay)
|
||||
|
||||
@ -16,4 +16,7 @@ typedef struct rtlPinMapping_s
|
||||
pwmout_t* pwm;
|
||||
} rtlPinMapping_t;
|
||||
|
||||
extern rtlPinMapping_t g_pins[];
|
||||
extern int g_numPins;
|
||||
|
||||
#endif // PLATFORM_REALTEK
|
||||
@ -4,14 +4,43 @@
|
||||
#include "../../logging/logging.h"
|
||||
#include "../../new_cfg.h"
|
||||
#include "../../new_pins.h"
|
||||
#include "hal_generic_realtek.h"
|
||||
#include "../hal_pins.h"
|
||||
#include "hal_pinmap_realtek.h"
|
||||
#if !PLATFORM_REALTEK_NEW
|
||||
#include "gpio_ex_api.h"
|
||||
#endif
|
||||
#if !PLATFORM_RTL8710A && !PLATFORM_RTL8710B
|
||||
#include "pwmout_ex_api.h"
|
||||
#endif
|
||||
|
||||
extern rtlPinMapping_t g_pins[];
|
||||
extern int g_numPins;
|
||||
#if PLATFORM_REALTEK_NEW
|
||||
|
||||
int PIN_GetPWMIndexForPinIndex(int pin)
|
||||
#include "pwmout_ex_api.h"
|
||||
static int g_active_pwm = 0b0;
|
||||
|
||||
uint8_t HAL_RTK_GetFreeChannel()
|
||||
{
|
||||
return -1;
|
||||
uint8_t freech;
|
||||
for(freech = 0; freech <= 9; freech++) if((g_active_pwm >> freech & 1) == 0) break;
|
||||
if(freech == 9) return -1;
|
||||
g_active_pwm |= 1 << freech;
|
||||
return freech;
|
||||
}
|
||||
|
||||
void HAL_RTK_FreeChannel(uint8_t channel)
|
||||
{
|
||||
g_active_pwm &= ~(1 << channel);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int PIN_GetPWMIndexForPinIndex(int index)
|
||||
{
|
||||
rtlPinMapping_t* pin = g_pins + index;
|
||||
if(index >= g_numPins)
|
||||
return -1;
|
||||
if(pin->pwm != NULL) return pin->pwm->pwm_idx;
|
||||
else return HAL_PIN_CanThisPinBePWM(index);
|
||||
}
|
||||
|
||||
const char* HAL_PIN_GetPinNameAlias(int index)
|
||||
@ -103,6 +132,9 @@ void HAL_PIN_PWM_Stop(int index)
|
||||
rtlPinMapping_t* pin = g_pins + index;
|
||||
if(pin->pwm == NULL) return;
|
||||
//pwmout_stop(pin->pwm);
|
||||
#if PLATFORM_REALTEK_NEW
|
||||
HAL_RTK_FreeChannel(pin->pwm->pwm_idx);
|
||||
#endif
|
||||
pwmout_free(pin->pwm);
|
||||
os_free(pin->pwm);
|
||||
pin->pwm = NULL;
|
||||
@ -113,7 +145,11 @@ void HAL_PIN_PWM_Start(int index, int freq)
|
||||
if(index >= g_numPins || !HAL_PIN_CanThisPinBePWM(index))
|
||||
return;
|
||||
rtlPinMapping_t* pin = g_pins + index;
|
||||
if(pin->pwm != NULL) return;
|
||||
if(pin->pwm != NULL)
|
||||
{
|
||||
pwmout_period_us(pin->pwm, 1000000 / freq);
|
||||
return;
|
||||
}
|
||||
if(pin->gpio != NULL)
|
||||
{
|
||||
gpio_deinit(pin->gpio);
|
||||
@ -122,8 +158,18 @@ void HAL_PIN_PWM_Start(int index, int freq)
|
||||
}
|
||||
pin->pwm = os_malloc(sizeof(pwmout_t));
|
||||
memset(pin->pwm, 0, sizeof(pwmout_t));
|
||||
#if PLATFORM_REALTEK_NEW
|
||||
int ch = HAL_RTK_GetFreeChannel();
|
||||
if(ch == -1)
|
||||
{
|
||||
os_free(pin->pwm);
|
||||
pin->pwm = NULL;
|
||||
return;
|
||||
}
|
||||
pin->pwm->pwm_idx = ch;
|
||||
#endif
|
||||
pwmout_init(pin->pwm, pin->pin);
|
||||
pwmout_period_us(pin->pwm, freq);
|
||||
pwmout_period_us(pin->pwm, 1000000 / freq);
|
||||
#ifndef PLATFORM_RTL8710A
|
||||
pwmout_start(pin->pwm);
|
||||
#endif
|
||||
|
||||
@ -35,6 +35,7 @@ typedef struct
|
||||
} wifi_data_t;
|
||||
|
||||
bool g_STA_static_IP = 0;
|
||||
bool mac_init = false;
|
||||
|
||||
static void (*g_wifiStatusCallback)(int code) = NULL;
|
||||
static int g_bOpenAccessPointMode = 0;
|
||||
@ -65,31 +66,63 @@ const char* HAL_GetMyMaskString()
|
||||
return g_MS;
|
||||
}
|
||||
|
||||
#if PLATFORM_RTL8710A
|
||||
extern int wifi_set_mac_address(char* mac);
|
||||
#endif
|
||||
|
||||
int WiFI_SetMacAddress(char* mac)
|
||||
{
|
||||
printf("WiFI_SetMacAddress\r\n");
|
||||
#ifdef PLATFORM_RTL8720D
|
||||
#if PLATFORM_RTL8720D
|
||||
InitEasyFlashIfNeeded();
|
||||
wifi_change_mac_address_from_ram(0, (uint8_t*)mac);
|
||||
memcpy(wmac, mac, sizeof(wmac));
|
||||
return ef_set_env_blob("rtlmac", mac, sizeof(wmac));
|
||||
#endif
|
||||
#elif PLATFORM_RTL8710A
|
||||
InitEasyFlashIfNeeded();
|
||||
char macstr[21];
|
||||
memset(macstr, 0, sizeof(macstr));
|
||||
sprintf(macstr, "%02x%02x%02x%02x%02x%02x", \
|
||||
mac[0], mac[1], mac[2], \
|
||||
mac[3], mac[4], mac[5]);
|
||||
wifi_set_mac_address(macstr);
|
||||
wifi_off();
|
||||
vTaskDelay(20);
|
||||
wifi_on(RTW_MODE_STA);
|
||||
return ef_set_env_blob("rtlmac", mac, sizeof(wmac));
|
||||
#else
|
||||
return 0; // error
|
||||
#endif
|
||||
}
|
||||
|
||||
void WiFI_GetMacAddress(char* mac)
|
||||
{
|
||||
#ifdef PLATFORM_RTL8720D
|
||||
#if PLATFORM_RTL8720D || PLATFORM_RTL8710A
|
||||
//if((wmac[0] == 255 && wmac[1] == 255 && wmac[2] == 255 && wmac[3] == 255 && wmac[4] == 255 && wmac[5] == 255)
|
||||
// || (wmac[0] == 0 && wmac[1] == 0 && wmac[2] == 0 && wmac[3] == 0 && wmac[4] == 0 && wmac[5] == 0))
|
||||
if(!mac_init)
|
||||
{
|
||||
InitEasyFlashIfNeeded();
|
||||
uint8_t fmac[6] = { 0 };
|
||||
int readLen = ef_get_env_blob("rtlmac", &fmac, sizeof(fmac), NULL);
|
||||
if(readLen)
|
||||
{
|
||||
#if PLATFORM_RTL8710A
|
||||
char macstr[21];
|
||||
memset(macstr, 0, sizeof(macstr));
|
||||
sprintf(macstr, "%02x%02x%02x%02x%02x%02x", \
|
||||
fmac[0], fmac[1], fmac[2], \
|
||||
fmac[3], fmac[4], fmac[5]);
|
||||
wifi_set_mac_address(macstr);
|
||||
wifi_off();
|
||||
vTaskDelay(20);
|
||||
wifi_on(RTW_MODE_STA);
|
||||
#else
|
||||
wifi_change_mac_address_from_ram(0, fmac);
|
||||
#endif
|
||||
memcpy(wmac, fmac, sizeof(fmac));
|
||||
}
|
||||
mac_init = true;
|
||||
}
|
||||
#endif
|
||||
memcpy(mac, (char*)wmac, sizeof(wmac));
|
||||
@ -109,6 +142,7 @@ void HAL_PrintNetworkInfo()
|
||||
WiFI_GetMacAddress((char*)mac);
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "+--------------- net device info ------------+\r\n");
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif type : %-16s |\r\n", g_bOpenAccessPointMode == 0 ? "STA" : "AP");
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif rssi = %-16i |\r\n", HAL_GetWifiStrength());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif ip = %-16s |\r\n", HAL_GetMyIPString());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif mask = %-16s |\r\n", HAL_GetMyMaskString());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif gateway = %-16s |\r\n", HAL_GetMyGatewayString());
|
||||
|
||||
306
src/hal/realtek/hal_wifi_realtek_new.c
Normal file
306
src/hal/realtek/hal_wifi_realtek_new.c
Normal file
@ -0,0 +1,306 @@
|
||||
#ifdef PLATFORM_REALTEK_NEW
|
||||
|
||||
#include "../hal_wifi.h"
|
||||
#include "../../new_cfg.h"
|
||||
#include "../../new_common.h"
|
||||
#include "../../logging/logging.h"
|
||||
#include "../../new_pins.h"
|
||||
#include <lwip/sockets.h>
|
||||
#include <lwip/netif.h>
|
||||
#include <lwip/dns.h>
|
||||
#include <lwip_netconf.h>
|
||||
#include <dhcp/dhcps.h>
|
||||
#include "wifi_api.h"
|
||||
#include "wifi_fast_connect.h"
|
||||
|
||||
extern struct netif xnetif[NET_IF_NUM];
|
||||
extern void InitEasyFlashIfNeeded();
|
||||
extern int wifi_do_fast_connect(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char ssid[32];
|
||||
char pwd[64];
|
||||
unsigned char bssid[6];
|
||||
} wifi_data_t;
|
||||
|
||||
extern uint8_t wmac[6];
|
||||
extern bool g_powersave;
|
||||
extern int (*p_wifi_do_fast_connect)(void);
|
||||
extern int (*p_store_fast_connect_info)(unsigned int data1, unsigned int data2);
|
||||
|
||||
bool g_STA_static_IP = 0;
|
||||
|
||||
static void (*g_wifiStatusCallback)(int code) = NULL;
|
||||
static int g_bOpenAccessPointMode = 0;
|
||||
static wifi_data_t wdata = { 0 };
|
||||
static int g_bStaticIP = 0;
|
||||
obkFastConnectData_t fcdata = { 0 };
|
||||
struct static_ip_config user_static_ip = { 0 };
|
||||
|
||||
const char* HAL_GetMyIPString()
|
||||
{
|
||||
return ipaddr_ntoa(&xnetif[g_bOpenAccessPointMode].ip_addr);
|
||||
}
|
||||
|
||||
const char* HAL_GetMyGatewayString()
|
||||
{
|
||||
return ipaddr_ntoa(&xnetif[g_bOpenAccessPointMode].gw);
|
||||
}
|
||||
|
||||
const char* HAL_GetMyDNSString()
|
||||
{
|
||||
return ipaddr_ntoa(dns_getserver(0));
|
||||
}
|
||||
|
||||
const char* HAL_GetMyMaskString()
|
||||
{
|
||||
return ipaddr_ntoa(&xnetif[g_bOpenAccessPointMode].netmask);
|
||||
}
|
||||
|
||||
int WiFI_SetMacAddress(char* mac)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WiFI_GetMacAddress(char* mac)
|
||||
{
|
||||
memcpy(mac, (char*)wmac, sizeof(wmac));
|
||||
}
|
||||
|
||||
const char* HAL_GetMACStr(char* macstr)
|
||||
{
|
||||
unsigned char mac[6];
|
||||
WiFI_GetMacAddress((char*)mac);
|
||||
sprintf(macstr, MACSTR, MAC2STR(mac));
|
||||
return macstr;
|
||||
}
|
||||
|
||||
void HAL_PrintNetworkInfo()
|
||||
{
|
||||
uint8_t mac[6];
|
||||
WiFI_GetMacAddress((char*)mac);
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "+--------------- net device info ------------+\r\n");
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif type : %-16s |\r\n", g_bOpenAccessPointMode == 0 ? "STA" : "AP");
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif rssi = %-16i |\r\n", HAL_GetWifiStrength());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif ip = %-16s |\r\n", HAL_GetMyIPString());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif mask = %-16s |\r\n", HAL_GetMyMaskString());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif gateway = %-16s |\r\n", HAL_GetMyGatewayString());
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "|netif mac : [%02X:%02X:%02X:%02X:%02X:%02X] %-7s |\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], "");
|
||||
ADDLOG_DEBUG(LOG_FEATURE_GENERAL, "+--------------------------------------------+\r\n");
|
||||
}
|
||||
|
||||
int HAL_GetWifiStrength()
|
||||
{
|
||||
union rtw_phy_stats phy_stats;
|
||||
wifi_get_phy_stats(STA_WLAN_INDEX, NULL, &phy_stats);
|
||||
return -((uint8_t)(0xFF - phy_stats.sta.rssi + 1));
|
||||
}
|
||||
|
||||
void HAL_WiFi_SetupStatusCallback(void (*cb)(int code))
|
||||
{
|
||||
g_wifiStatusCallback = cb;
|
||||
}
|
||||
|
||||
void obk_wifi_hdl_new(u8* buf, s32 buf_len, s32 flags, void* userdata)
|
||||
{
|
||||
UNUSED(buf_len);
|
||||
UNUSED(userdata);
|
||||
u8 join_status = (u8)flags;
|
||||
struct rtw_event_info_joinstatus_joinfail* fail_info = (struct rtw_event_info_joinstatus_joinfail*)buf;
|
||||
struct rtw_event_info_joinstatus_disconn* disconn_info = (struct rtw_event_info_joinstatus_disconn*)buf;
|
||||
|
||||
if(join_status == RTW_JOINSTATUS_SUCCESS)
|
||||
{
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
netif_set_hostname(&xnetif[0], CFG_GetDeviceName());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if(join_status == RTW_JOINSTATUS_FAIL)
|
||||
{
|
||||
switch(fail_info->fail_reason)
|
||||
{
|
||||
case -RTK_ERR_WIFI_CONN_INVALID_KEY:
|
||||
case -RTK_ERR_WIFI_CONN_AUTH_PASSWORD_WRONG:
|
||||
case -RTK_ERR_WIFI_CONN_4WAY_PASSWORD_WRONG:
|
||||
case -RTK_ERR_WIFI_CONN_AUTH_FAIL:
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_AUTH_FAILED);
|
||||
}
|
||||
break;
|
||||
case -RTK_ERR_WIFI_CONN_SCAN_FAIL:
|
||||
case -RTK_ERR_WIFI_CONN_ASSOC_FAIL:
|
||||
case -RTK_ERR_WIFI_CONN_4WAY_HANDSHAKE_FAIL:
|
||||
default:
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_DISCONNECTED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(join_status == RTW_JOINSTATUS_DISCONNECT)
|
||||
{
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectToWiFiTask(void* args)
|
||||
{
|
||||
struct rtw_network_info connect_param = { 0 };
|
||||
|
||||
memcpy(connect_param.ssid.val, wdata.ssid, strlen(wdata.ssid));
|
||||
connect_param.ssid.len = strlen(wdata.ssid);
|
||||
connect_param.password = (unsigned char*)wdata.pwd;
|
||||
connect_param.password_len = strlen(wdata.pwd);
|
||||
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_CONNECTING);
|
||||
}
|
||||
wifi_connect(&connect_param, 1);
|
||||
if(!g_bStaticIP) LwIP_DHCP(0, DHCP_START);
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_CONNECTED);
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void ConfigureSTA(obkStaticIP_t* ip)
|
||||
{
|
||||
struct ip_addr ipaddr;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
struct ip_addr dnsserver;
|
||||
|
||||
wifi_set_autoreconnect(0);
|
||||
wifi_reg_event_handler(RTW_EVENT_JOIN_STATUS, obk_wifi_hdl_new, NULL);
|
||||
|
||||
if(ip->localIPAddr[0] == 0)
|
||||
{
|
||||
g_bStaticIP = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_bStaticIP = 1;
|
||||
|
||||
IP4_ADDR(ip_2_ip4(&ipaddr), ip->localIPAddr[0], ip->localIPAddr[1], ip->localIPAddr[2], ip->localIPAddr[3]);
|
||||
IP4_ADDR(ip_2_ip4(&netmask), ip->netMask[0], ip->netMask[1], ip->netMask[2], ip->netMask[3]);
|
||||
IP4_ADDR(ip_2_ip4(&gw), ip->gatewayIPAddr[0], ip->gatewayIPAddr[1], ip->gatewayIPAddr[2], ip->gatewayIPAddr[3]);
|
||||
IP4_ADDR(ip_2_ip4(&dnsserver), ip->dnsServerIpAddr[0], ip->dnsServerIpAddr[1], ip->dnsServerIpAddr[2], ip->dnsServerIpAddr[3]);
|
||||
netif_set_addr(&xnetif[STA_WLAN_INDEX], ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw));
|
||||
dns_setserver(0, &dnsserver);
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_ConnectToWiFi(const char* oob_ssid, const char* connect_key, obkStaticIP_t* ip)
|
||||
{
|
||||
g_bOpenAccessPointMode = 0;
|
||||
strcpy((char*)&wdata.ssid, oob_ssid);
|
||||
strncpy((char*)&wdata.pwd, connect_key, 64);
|
||||
|
||||
ConfigureSTA(ip);
|
||||
|
||||
xTaskCreate(
|
||||
(TaskFunction_t)ConnectToWiFiTask,
|
||||
"WC",
|
||||
4096 / sizeof(StackType_t),
|
||||
NULL,
|
||||
9,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void HAL_DisconnectFromWifi()
|
||||
{
|
||||
wifi_disconnect();
|
||||
}
|
||||
|
||||
int HAL_SetupWiFiOpenAccessPoint(const char* ssid)
|
||||
{
|
||||
g_bOpenAccessPointMode = 1;
|
||||
rtw_mode_t mode = RTW_MODE_STA_AP;
|
||||
struct ip_addr ipaddr;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
struct netif* pnetif = &xnetif[SOFTAP_WLAN_INDEX];
|
||||
dhcps_deinit();
|
||||
wifi_stop_ap();
|
||||
struct rtw_softap_info connect_param = { 0 };
|
||||
memcpy(connect_param.ssid.val, ssid, strlen(ssid));
|
||||
connect_param.ssid.len = strlen(ssid);
|
||||
connect_param.security_type = RTW_SECURITY_OPEN;
|
||||
connect_param.channel = 1;
|
||||
|
||||
if(wifi_start_ap(&connect_param) < 0)
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_GENERAL, "Failed to start AP");
|
||||
return 0;
|
||||
}
|
||||
IP4_ADDR(ip_2_ip4(&ipaddr), 192, 168, 4, 1);
|
||||
IP4_ADDR(ip_2_ip4(&netmask), 255, 255, 255, 0);
|
||||
IP4_ADDR(ip_2_ip4(&gw), 192, 168, 4, 1);
|
||||
netifapi_netif_set_addr(pnetif, ip_2_ip4(&ipaddr), ip_2_ip4(&netmask), ip_2_ip4(&gw));
|
||||
|
||||
dhcps_init(pnetif);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FastConnectToWiFiTask(void* args)
|
||||
{
|
||||
struct wlan_fast_reconnect* data = (struct wlan_fast_reconnect*)malloc(sizeof(struct wlan_fast_reconnect));
|
||||
struct wlan_fast_reconnect* empty_data = (struct wlan_fast_reconnect*)malloc(sizeof(struct wlan_fast_reconnect));
|
||||
memset(data, 0xff, sizeof(struct wlan_fast_reconnect));
|
||||
memset(empty_data, 0xff, sizeof(struct wlan_fast_reconnect));
|
||||
int ret = rt_kv_get("wlan_data", (uint8_t*)data, sizeof(struct wlan_fast_reconnect));
|
||||
if(ret < 0 || memcmp(empty_data, data, sizeof(struct wlan_fast_reconnect)) == 0)
|
||||
{
|
||||
ConnectToWiFiTask(args);
|
||||
goto exit;
|
||||
}
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_CONNECTING);
|
||||
}
|
||||
wifi_do_fast_connect();
|
||||
if(g_wifiStatusCallback != NULL)
|
||||
{
|
||||
g_wifiStatusCallback(WIFI_STA_CONNECTED);
|
||||
}
|
||||
exit:
|
||||
free(data);
|
||||
free(empty_data);
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void HAL_FastConnectToWiFi(const char* oob_ssid, const char* connect_key, obkStaticIP_t* ip)
|
||||
{
|
||||
g_bOpenAccessPointMode = 0;
|
||||
strcpy((char*)&wdata.ssid, oob_ssid);
|
||||
strncpy((char*)&wdata.pwd, connect_key, 64);
|
||||
|
||||
ConfigureSTA(ip);
|
||||
|
||||
xTaskCreate(
|
||||
(TaskFunction_t)FastConnectToWiFiTask,
|
||||
"WFC",
|
||||
4096 / sizeof(StackType_t),
|
||||
NULL,
|
||||
9,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void HAL_DisableEnhancedFastConnect()
|
||||
{
|
||||
rt_kv_delete("wlan_data");
|
||||
}
|
||||
|
||||
#endif // PLATFORM_REALTEK_NEW
|
||||
@ -1,6 +1,6 @@
|
||||
#ifdef PLATFORM_RTL8710A
|
||||
|
||||
#include "../hal_generic_realtek.h"
|
||||
#include "../hal_pinmap_realtek.h"
|
||||
|
||||
// commented out pins are those not wired out on RTL8711AM
|
||||
rtlPinMapping_t g_pins[] = {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifdef PLATFORM_RTL8710B
|
||||
|
||||
#include "../hal_generic_realtek.h"
|
||||
#include "../hal_pinmap_realtek.h"
|
||||
|
||||
rtlPinMapping_t g_pins[] = {
|
||||
{ "PA0", PA_0, NULL, NULL },
|
||||
|
||||
@ -1,72 +1,72 @@
|
||||
#ifdef PLATFORM_RTL8720D
|
||||
|
||||
#include "../hal_generic_realtek.h"
|
||||
#include "../hal_pinmap_realtek.h"
|
||||
|
||||
rtlPinMapping_t g_pins[] = {
|
||||
{ "PA0", PA_0, NULL, NULL },
|
||||
{ "PA1", PA_1, NULL, NULL },
|
||||
{ "PA2", PA_2, NULL, NULL },
|
||||
{ "PA3", PA_3, NULL, NULL },
|
||||
{ "PA4", PA_4, NULL, NULL },
|
||||
{ "PA5", PA_5, NULL, NULL },
|
||||
{ "PA6", PA_6, NULL, NULL },
|
||||
{ "PA7 (LOG_TX)", PA_7, NULL, NULL },
|
||||
{ "PA8 (LOG_RX)", PA_8, NULL, NULL },
|
||||
{ "PA9", PA_9, NULL, NULL },
|
||||
{ "PA10", PA_10, NULL, NULL },
|
||||
{ "PA11", PA_11, NULL, NULL },
|
||||
{ "PA12 (TX1)", PA_12, NULL, NULL },
|
||||
{ "PA13 (RX1)", PA_13, NULL, NULL },
|
||||
{ "PA14", PA_14, NULL, NULL },
|
||||
{ "PA15", PA_15, NULL, NULL },
|
||||
{ "PA16 (RTS0)", PA_16, NULL, NULL },
|
||||
{ "PA17 (CTS0)", PA_17, NULL, NULL },
|
||||
{ "PA18 (TX0)", PA_18, NULL, NULL },
|
||||
{ "PA19 (RX0)", PA_19, NULL, NULL },
|
||||
{ "PA20", PA_20, NULL, NULL },
|
||||
{ "PA21", PA_21, NULL, NULL },
|
||||
{ "PA22", PA_22, NULL, NULL },
|
||||
{ "PA23 (RTS1)", PA_23, NULL, NULL },
|
||||
{ "PA24 (RTS1)", PA_24, NULL, NULL },
|
||||
{ "PA25", PA_25, NULL, NULL },
|
||||
{ "PA26", PA_26, NULL, NULL },
|
||||
{ "PA27", PA_27, NULL, NULL },
|
||||
{ "PA28", PA_28, NULL, NULL },
|
||||
{ "PA29", PA_29, NULL, NULL },
|
||||
{ "PA30", PA_30, NULL, NULL },
|
||||
{ "PA31", PA_31, NULL, NULL },
|
||||
{ "PB0", PB_0, NULL, NULL },
|
||||
{ "PB1", PB_1, NULL, NULL },
|
||||
{ "PB2", PB_2, NULL, NULL },
|
||||
{ "PB3", PB_3, NULL, NULL },
|
||||
{ "PB4", PB_4, NULL, NULL },
|
||||
{ "PB5", PB_5, NULL, NULL },
|
||||
{ "PB6", PB_6, NULL, NULL },
|
||||
{ "PB7", PB_7, NULL, NULL },
|
||||
{ "PB8", PB_8, NULL, NULL },
|
||||
{ "PB9", PB_9, NULL, NULL },
|
||||
{ "PB10", PB_10, NULL, NULL },
|
||||
{ "PB11", PB_11, NULL, NULL },
|
||||
{ "PB12", PB_12, NULL, NULL },
|
||||
{ "PB13", PB_13, NULL, NULL },
|
||||
{ "PB14", PB_14, NULL, NULL },
|
||||
{ "PB15", PB_15, NULL, NULL },
|
||||
{ "PB16", PB_16, NULL, NULL },
|
||||
{ "PB17", PB_17, NULL, NULL },
|
||||
{ "PB18", PB_18, NULL, NULL },
|
||||
{ "PB19", PB_19, NULL, NULL },
|
||||
{ "PB20", PB_20, NULL, NULL },
|
||||
{ "PB21", PB_21, NULL, NULL },
|
||||
{ "PB22", PB_22, NULL, NULL },
|
||||
{ "PB23", PB_23, NULL, NULL },
|
||||
{ "PB24", PB_24, NULL, NULL },
|
||||
{ "PB25", PB_25, NULL, NULL },
|
||||
{ "PB26", PB_26, NULL, NULL },
|
||||
{ "PB27", PB_27, NULL, NULL },
|
||||
{ "PB28", PB_28, NULL, NULL },
|
||||
{ "PB29", PB_29, NULL, NULL },
|
||||
{ "PB30", PB_30, NULL, NULL },
|
||||
{ "PB31", PB_31, NULL, NULL },
|
||||
{ "PA0", PA_0, NULL, NULL, NULL },
|
||||
{ "PA1", PA_1, NULL, NULL, NULL },
|
||||
{ "PA2", PA_2, NULL, NULL, NULL },
|
||||
{ "PA3", PA_3, NULL, NULL, NULL },
|
||||
{ "PA4", PA_4, NULL, NULL, NULL },
|
||||
{ "PA5", PA_5, NULL, NULL, NULL },
|
||||
{ "PA6", PA_6, NULL, NULL, NULL },
|
||||
{ "PA7 (LOG_TX)", PA_7, NULL, NULL, NULL },
|
||||
{ "PA8 (LOG_RX)", PA_8, NULL, NULL, NULL },
|
||||
{ "PA9", PA_9, NULL, NULL, NULL },
|
||||
{ "PA10", PA_10, NULL, NULL, NULL },
|
||||
{ "PA11", PA_11, NULL, NULL, NULL },
|
||||
{ "PA12 (TX1)", PA_12, NULL, NULL, NULL },
|
||||
{ "PA13 (RX1)", PA_13, NULL, NULL, NULL },
|
||||
{ "PA14", PA_14, NULL, NULL, NULL },
|
||||
{ "PA15", PA_15, NULL, NULL, NULL },
|
||||
{ "PA16 (RTS0)", PA_16, NULL, NULL, NULL },
|
||||
{ "PA17 (CTS0)", PA_17, NULL, NULL, NULL },
|
||||
{ "PA18 (TX0)", PA_18, NULL, NULL, NULL },
|
||||
{ "PA19 (RX0)", PA_19, NULL, NULL, NULL },
|
||||
{ "PA20", PA_20, NULL, NULL, NULL },
|
||||
{ "PA21", PA_21, NULL, NULL, NULL },
|
||||
{ "PA22", PA_22, NULL, NULL, NULL },
|
||||
{ "PA23 (RTS1)", PA_23, NULL, NULL, NULL },
|
||||
{ "PA24 (RTS1)", PA_24, NULL, NULL, NULL },
|
||||
{ "PA25", PA_25, NULL, NULL, NULL },
|
||||
{ "PA26", PA_26, NULL, NULL, NULL },
|
||||
{ "PA27", PA_27, NULL, NULL, NULL },
|
||||
{ "PA28", PA_28, NULL, NULL, NULL },
|
||||
{ "PA29", PA_29, NULL, NULL, NULL },
|
||||
{ "PA30", PA_30, NULL, NULL, NULL },
|
||||
{ "PA31", PA_31, NULL, NULL, NULL },
|
||||
{ "PB0", PB_0, NULL, NULL, NULL },
|
||||
{ "PB1", PB_1, NULL, NULL, NULL },
|
||||
{ "PB2", PB_2, NULL, NULL, NULL },
|
||||
{ "PB3", PB_3, NULL, NULL, NULL },
|
||||
{ "PB4", PB_4, NULL, NULL, NULL },
|
||||
{ "PB5", PB_5, NULL, NULL, NULL },
|
||||
{ "PB6", PB_6, NULL, NULL, NULL },
|
||||
{ "PB7", PB_7, NULL, NULL, NULL },
|
||||
{ "PB8", PB_8, NULL, NULL, NULL },
|
||||
{ "PB9", PB_9, NULL, NULL, NULL },
|
||||
{ "PB10", PB_10, NULL, NULL, NULL },
|
||||
{ "PB11", PB_11, NULL, NULL, NULL },
|
||||
{ "PB12", PB_12, NULL, NULL, NULL },
|
||||
{ "PB13", PB_13, NULL, NULL, NULL },
|
||||
{ "PB14", PB_14, NULL, NULL, NULL },
|
||||
{ "PB15", PB_15, NULL, NULL, NULL },
|
||||
{ "PB16", PB_16, NULL, NULL, NULL },
|
||||
{ "PB17", PB_17, NULL, NULL, NULL },
|
||||
{ "PB18", PB_18, NULL, NULL, NULL },
|
||||
{ "PB19", PB_19, NULL, NULL, NULL },
|
||||
{ "PB20", PB_20, NULL, NULL, NULL },
|
||||
{ "PB21", PB_21, NULL, NULL, NULL },
|
||||
{ "PB22", PB_22, NULL, NULL, NULL },
|
||||
{ "PB23", PB_23, NULL, NULL, NULL },
|
||||
{ "PB24", PB_24, NULL, NULL, NULL },
|
||||
{ "PB25", PB_25, NULL, NULL, NULL },
|
||||
{ "PB26", PB_26, NULL, NULL, NULL },
|
||||
{ "PB27", PB_27, NULL, NULL, NULL },
|
||||
{ "PB28", PB_28, NULL, NULL, NULL },
|
||||
{ "PB29", PB_29, NULL, NULL, NULL },
|
||||
{ "PB30", PB_30, NULL, NULL, NULL },
|
||||
{ "PB31", PB_31, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
int g_numPins = sizeof(g_pins) / sizeof(g_pins[0]);
|
||||
|
||||
69
src/hal/realtek/rtl8720e/hal_pins_rtl8720e.c
Normal file
69
src/hal/realtek/rtl8720e/hal_pins_rtl8720e.c
Normal file
@ -0,0 +1,69 @@
|
||||
#ifdef PLATFORM_RTL8720E
|
||||
|
||||
#include "../hal_pinmap_realtek.h"
|
||||
|
||||
rtlPinMapping_t g_pins[] = {
|
||||
{ "PA0", PA_0, NULL, NULL },
|
||||
{ "PA1", PA_1, NULL, NULL },
|
||||
{ "PA2", PA_2, NULL, NULL },
|
||||
{ "PA3", PA_3, NULL, NULL },
|
||||
{ "PA4", PA_4, NULL, NULL },
|
||||
{ "PA5", PA_5, NULL, NULL },
|
||||
{ "PA6", PA_6, NULL, NULL },
|
||||
{ "PA7", PA_7, NULL, NULL },
|
||||
{ "PA8", PA_8, NULL, NULL },
|
||||
{ "PA9", PA_9, NULL, NULL },
|
||||
{ "PA10", PA_10, NULL, NULL },
|
||||
{ "PA11", PA_11, NULL, NULL },
|
||||
{ "PA12", PA_12, NULL, NULL },
|
||||
{ "PA13", PA_13, NULL, NULL },
|
||||
{ "PA14", PA_14, NULL, NULL },
|
||||
{ "PA15", PA_15, NULL, NULL },
|
||||
{ "PA16", PA_16, NULL, NULL },
|
||||
{ "PA17", PA_17, NULL, NULL },
|
||||
{ "PA18", PA_18, NULL, NULL },
|
||||
{ "PA19 (LOG_RX)", PA_19, NULL, NULL },
|
||||
{ "PA20 (LOG_TX)", PA_20, NULL, NULL },
|
||||
{ "PA21", PA_21, NULL, NULL },
|
||||
{ "PA22", PA_22, NULL, NULL },
|
||||
{ "PA23", PA_23, NULL, NULL },
|
||||
{ "PA24", PA_24, NULL, NULL },
|
||||
{ "PA25", PA_25, NULL, NULL },
|
||||
{ "PA26", PA_26, NULL, NULL },
|
||||
{ "PA27", PA_27, NULL, NULL },
|
||||
{ "PA28", PA_28, NULL, NULL },
|
||||
{ "PA29", PA_29, NULL, NULL },
|
||||
{ "PA30", PA_30, NULL, NULL },
|
||||
{ "PA31", PA_31, NULL, NULL },
|
||||
{ "PB0", PB_0, NULL, NULL },
|
||||
{ "PB1", PB_1, NULL, NULL },
|
||||
{ "PB2", PB_2, NULL, NULL },
|
||||
{ "PB3", PB_3, NULL, NULL },
|
||||
{ "PB4", PB_4, NULL, NULL },
|
||||
{ "PB5", PB_5, NULL, NULL },
|
||||
{ "PB6", PB_6, NULL, NULL },
|
||||
{ "PB7", PB_7, NULL, NULL },
|
||||
{ "PB8", PB_8, NULL, NULL },
|
||||
{ "PB9", PB_9, NULL, NULL },
|
||||
{ "PB10", PB_10, NULL, NULL },
|
||||
{ "PB11", PB_11, NULL, NULL },
|
||||
{ "PB12", PB_12, NULL, NULL },
|
||||
{ "PB13", PB_13, NULL, NULL },
|
||||
{ "PB14", PB_14, NULL, NULL },
|
||||
{ "PB15", PB_15, NULL, NULL },
|
||||
{ "PB16", PB_16, NULL, NULL },
|
||||
{ "PB17", PB_17, NULL, NULL },
|
||||
{ "PB18", PB_18, NULL, NULL },
|
||||
{ "PB19", PB_19, NULL, NULL },
|
||||
};
|
||||
|
||||
int g_numPins = sizeof(g_pins) / sizeof(g_pins[0]);
|
||||
|
||||
int HAL_PIN_CanThisPinBePWM(int index)
|
||||
{
|
||||
if(index >= g_numPins)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // PLATFORM_RTL8720E
|
||||
79
src/hal/realtek/rtl8721da/hal_main_rtl8721da.c
Normal file
79
src/hal/realtek/rtl8721da/hal_main_rtl8721da.c
Normal file
@ -0,0 +1,79 @@
|
||||
#if PLATFORM_RTL8721DA || PLATFORM_RTL8720E
|
||||
|
||||
#include "../../../new_common.h"
|
||||
#include "wifi_api_types.h"
|
||||
#include "wifi_api_ext.h"
|
||||
#include "flash_api.h"
|
||||
#include "ameba_ota.h"
|
||||
#include "ameba_soc.h"
|
||||
#include "os_wrapper.h"
|
||||
|
||||
TaskHandle_t g_sys_task_handle1;
|
||||
uint32_t current_fw_idx = 0;
|
||||
uint8_t wmac[6] = { 0 };
|
||||
uint8_t flash_size_8720;
|
||||
unsigned char ap_ip[4] = { 192, 168, 4, 1 }, ap_netmask[4] = { 255, 255, 255, 0 }, ap_gw[4] = { 192, 168, 4, 1 };
|
||||
extern void wifi_fast_connect_enable(unsigned char enable);
|
||||
extern int (*p_wifi_do_fast_connect)(void);
|
||||
__attribute__((weak)) flash_t flash;
|
||||
|
||||
#if PLATFORM_RTL8720E
|
||||
|
||||
extern float g_wifi_temperature;
|
||||
void temp_func(void* pvParameters)
|
||||
{
|
||||
RCC_PeriphClockCmd(APBPeriph_ATIM, APBPeriph_ATIM_CLOCK, ENABLE);
|
||||
TM_Cmd(ENABLE);
|
||||
TM_InitTypeDef TM_InitStruct;
|
||||
TM_StructInit(&TM_InitStruct);
|
||||
TM_Init(&TM_InitStruct);
|
||||
for(;;)
|
||||
{
|
||||
g_wifi_temperature = TM_GetCdegree(TM_GetTempResult());
|
||||
vTaskDelay(10000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void sys_task1(void* pvParameters)
|
||||
{
|
||||
if(p_wifi_do_fast_connect) p_wifi_do_fast_connect = NULL;
|
||||
wifi_get_mac_address(0, (struct rtw_mac*)&wmac, 1);
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
Main_Init();
|
||||
for(;;)
|
||||
{
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
Main_OnEverySecond();
|
||||
}
|
||||
}
|
||||
|
||||
void app_pre_example(void)
|
||||
{
|
||||
u8 flash_ID[4];
|
||||
FLASH_RxCmd(flash_init_para.FLASH_cmd_rd_id, 3, flash_ID);
|
||||
flash_size_8720 = (1 << (flash_ID[2] - 0x11)) / 8;
|
||||
current_fw_idx = ota_get_cur_index(1);
|
||||
xTaskCreate(
|
||||
sys_task1,
|
||||
"OpenBeken",
|
||||
8 * 256,
|
||||
NULL,
|
||||
3,
|
||||
&g_sys_task_handle1);
|
||||
|
||||
#if PLATFORM_RTL8720E
|
||||
|
||||
xTaskCreate(
|
||||
temp_func,
|
||||
"TempFunc",
|
||||
1024,
|
||||
NULL,
|
||||
13,
|
||||
NULL);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // PLATFORM_RTL8721DA
|
||||
81
src/hal/realtek/rtl8721da/hal_pins_rtl8721da.c
Normal file
81
src/hal/realtek/rtl8721da/hal_pins_rtl8721da.c
Normal file
@ -0,0 +1,81 @@
|
||||
#ifdef PLATFORM_RTL8721DA
|
||||
|
||||
#include "../hal_pinmap_realtek.h"
|
||||
|
||||
rtlPinMapping_t g_pins[] = {
|
||||
{ "PA0", PA_0, NULL, NULL },
|
||||
{ "PA1", PA_1, NULL, NULL },
|
||||
{ "PA2", PA_2, NULL, NULL },
|
||||
{ "PA3", PA_3, NULL, NULL },
|
||||
{ "PA4", PA_4, NULL, NULL },
|
||||
{ "PA5", PA_5, NULL, NULL },
|
||||
{ "PA6", PA_6, NULL, NULL },
|
||||
{ "PA7", PA_7, NULL, NULL },
|
||||
{ "PA8", PA_8, NULL, NULL },
|
||||
{ "PA9", PA_9, NULL, NULL },
|
||||
{ "PA10", PA_10, NULL, NULL },
|
||||
{ "PA11", PA_11, NULL, NULL },
|
||||
{ "PA12", PA_12, NULL, NULL },
|
||||
{ "PA13", PA_13, NULL, NULL },
|
||||
{ "PA14", PA_14, NULL, NULL },
|
||||
{ "PA15", PA_15, NULL, NULL },
|
||||
{ "PA16", PA_16, NULL, NULL },
|
||||
{ "PA17", PA_17, NULL, NULL },
|
||||
{ "PA18", PA_18, NULL, NULL },
|
||||
{ "PA19", PA_19, NULL, NULL },
|
||||
{ "PA20", PA_20, NULL, NULL },
|
||||
{ "PA21", PA_21, NULL, NULL },
|
||||
{ "PA22", PA_22, NULL, NULL },
|
||||
{ "PA23", PA_23, NULL, NULL },
|
||||
{ "PA24", PA_24, NULL, NULL },
|
||||
{ "PA25", PA_25, NULL, NULL },
|
||||
{ "PA26", PA_26, NULL, NULL },
|
||||
{ "PA27", PA_27, NULL, NULL },
|
||||
{ "PA28", PA_28, NULL, NULL },
|
||||
{ "PA29", PA_29, NULL, NULL },
|
||||
{ "PA30", PA_30, NULL, NULL },
|
||||
{ "PA31", PA_31, NULL, NULL },
|
||||
{ "PB0", PB_0, NULL, NULL },
|
||||
{ "PB1", PB_1, NULL, NULL },
|
||||
{ "PB2", PB_2, NULL, NULL },
|
||||
{ "PB3", PB_3, NULL, NULL },
|
||||
{ "PB4 (LOG_RX)", PB_4, NULL, NULL },
|
||||
{ "PB5 (LOG_TX)", PB_5, NULL, NULL },
|
||||
{ "PB6", PB_6, NULL, NULL },
|
||||
{ "PB7", PB_7, NULL, NULL },
|
||||
{ "PB8", PB_8, NULL, NULL },
|
||||
{ "PB9", PB_9, NULL, NULL },
|
||||
{ "PB10", PB_10, NULL, NULL },
|
||||
{ "PB11", PB_11, NULL, NULL },
|
||||
{ "PB12", PB_12, NULL, NULL },
|
||||
{ "PB13", PB_13, NULL, NULL },
|
||||
{ "PB14", PB_14, NULL, NULL },
|
||||
{ "PB15", PB_15, NULL, NULL },
|
||||
{ "PB16", PB_16, NULL, NULL },
|
||||
{ "PB17", PB_17, NULL, NULL },
|
||||
{ "PB18", PB_18, NULL, NULL },
|
||||
{ "PB19", PB_19, NULL, NULL },
|
||||
{ "PB20", PB_20, NULL, NULL },
|
||||
{ "PB21", PB_21, NULL, NULL },
|
||||
{ "PB22", PB_22, NULL, NULL },
|
||||
{ "PB23", PB_23, NULL, NULL },
|
||||
{ "PB24", PB_24, NULL, NULL },
|
||||
{ "PB25", PB_25, NULL, NULL },
|
||||
{ "PB26", PB_26, NULL, NULL },
|
||||
{ "PB27", PB_27, NULL, NULL },
|
||||
{ "PB28", PB_28, NULL, NULL },
|
||||
{ "PB29", PB_29, NULL, NULL },
|
||||
{ "PB30", PB_30, NULL, NULL },
|
||||
{ "PB31", PB_31, NULL, NULL },
|
||||
};
|
||||
|
||||
int g_numPins = sizeof(g_pins) / sizeof(g_pins[0]);
|
||||
|
||||
int HAL_PIN_CanThisPinBePWM(int index)
|
||||
{
|
||||
if(index >= g_numPins)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // PLATFORM_RTL8721DA
|
||||
74
src/hal/realtek/rtl8721da/hal_uart_rtl8721da.c
Normal file
74
src/hal/realtek/rtl8721da/hal_uart_rtl8721da.c
Normal file
@ -0,0 +1,74 @@
|
||||
#if PLATFORM_RTL8721DA || PLATFORM_RTL8720E
|
||||
|
||||
#include "../../../new_pins.h"
|
||||
#include "../../../new_cfg.h"
|
||||
#include "../../hal_uart.h"
|
||||
#include "serial_api.h"
|
||||
#include "os_wrapper.h"
|
||||
#if PLATFORM_RTL8721DA
|
||||
// default example pins
|
||||
#define UART0_TX PA_26
|
||||
#define UART0_RX PA_27
|
||||
#define UART0_RTS PA_28
|
||||
#define UART0_CTS PA_29
|
||||
// UART0 on WR11-U and WR11-2S
|
||||
#define UART1_TX PB_20
|
||||
#define UART1_RX PB_21
|
||||
#elif PLATFORM_RTL8720E
|
||||
// default example pins
|
||||
#define UART0_TX PA_28
|
||||
#define UART0_RX PA_29
|
||||
#define UART0_RTS PA_30
|
||||
#define UART0_CTS PA_31
|
||||
#define UART1_TX UART0_TX
|
||||
#define UART1_RX UART0_RX
|
||||
#endif
|
||||
|
||||
serial_t sobj;
|
||||
static bool isInitialized;
|
||||
|
||||
static void uart_cb(uint32_t id, SerialIrq event)
|
||||
{
|
||||
if(event != RxIrq)
|
||||
return;
|
||||
|
||||
serial_t* obj = (void*)id;
|
||||
while(serial_readable(obj))
|
||||
{
|
||||
uint8_t c = (uint8_t)serial_getc(obj);
|
||||
UART_AppendByteToReceiveRingBuffer(c);
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_UART_SendByte(byte b)
|
||||
{
|
||||
while(!serial_writable(&sobj));
|
||||
serial_putc(&sobj, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
{
|
||||
if(isInitialized)
|
||||
{
|
||||
serial_free(&sobj);
|
||||
}
|
||||
PinName tx = UART0_TX, rx = UART0_RX, rts = UART0_RTS, cts = UART0_CTS;
|
||||
if(CFG_HasFlag(OBK_FLAG_USE_SECONDARY_UART))
|
||||
{
|
||||
tx = UART1_TX;
|
||||
rx = UART1_RX;
|
||||
}
|
||||
serial_init(&sobj, tx, rx);
|
||||
serial_baud(&sobj, baud);
|
||||
serial_format(&sobj, 8, parity, 1);
|
||||
serial_irq_handler(&sobj, uart_cb, (uint32_t)&sobj);
|
||||
serial_irq_set(&sobj, RxIrq, 1);
|
||||
if(hwflowc && !CFG_HasFlag(OBK_FLAG_USE_SECONDARY_UART))
|
||||
{
|
||||
serial_set_flow_control(&sobj, FlowControlRTSCTS, rts, cts);
|
||||
}
|
||||
isInitialized = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,6 +1,6 @@
|
||||
#ifdef PLATFORM_RTL87X0C
|
||||
|
||||
#include "../hal_generic_realtek.h"
|
||||
#include "../hal_pinmap_realtek.h"
|
||||
|
||||
rtlPinMapping_t g_pins[] = {
|
||||
{ "PA0 (RX1)", PA_0, NULL, NULL },
|
||||
@ -33,7 +33,7 @@ int g_numPins = sizeof(g_pins) / sizeof(g_pins[0]);
|
||||
|
||||
int HAL_PIN_CanThisPinBePWM(int index)
|
||||
{
|
||||
if(index > 6 && index < 11) return 0;
|
||||
if(index > 6 && index < 11) return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
#include "temp_detect_pub.h"
|
||||
#elif defined(PLATFORM_LN882H)
|
||||
#elif defined(PLATFORM_TR6260)
|
||||
#elif defined(PLATFORM_REALTEK)
|
||||
#elif defined(PLATFORM_REALTEK) && !PLATFORM_REALTEK_NEW
|
||||
#include "wifi_structures.h"
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_conf.h"
|
||||
@ -53,6 +53,11 @@
|
||||
extern hal_reset_reason_t reset_reason;
|
||||
#endif
|
||||
SemaphoreHandle_t scan_hdl;
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
#include "lwip_netconf.h"
|
||||
#include "ameba_soc.h"
|
||||
#include "ameba_ota.h"
|
||||
extern uint32_t current_fw_idx;
|
||||
#elif defined(PLATFORM_ESPIDF) || PLATFORM_ESP8266
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_system.h"
|
||||
@ -948,7 +953,7 @@ typedef enum {
|
||||
}
|
||||
hprintf255(request, "<h5>Reboot reason: %i - %s</h5>", reset_reason, s);
|
||||
hprintf255(request, "<h5>Current fw: FW%i</h5>", current_fw_idx);
|
||||
#elif PLATFORM_RTL8710B || PLATFORM_RTL8720D
|
||||
#elif PLATFORM_RTL8710B || PLATFORM_RTL8720D || PLATFORM_REALTEK_NEW
|
||||
hprintf255(request, "<h5>Current fw: FW%i</h5>", current_fw_idx + 1);
|
||||
#elif PLATFORM_ECR6600
|
||||
RST_TYPE reset_type = hal_get_reset_type();
|
||||
@ -1433,7 +1438,7 @@ int http_fn_cfg_wifi(http_request_t* request) {
|
||||
{
|
||||
hprintf255(request, "[%i/%u] SSID: %s, Channel: %i, Signal %i<br>", i + 1, number, ap_info[i].ssid, ap_info[i].primary, ap_info[i].rssi);
|
||||
}
|
||||
#elif defined(PLATFORM_REALTEK)
|
||||
#elif defined(PLATFORM_REALTEK) && !PLATFORM_REALTEK_NEW
|
||||
#ifndef PLATFORM_RTL87X0C
|
||||
extern void rltk_wlan_enable_scan_with_ssid_by_extended_security(bool);
|
||||
#endif
|
||||
@ -3201,15 +3206,8 @@ int http_fn_cfg_dgr(http_request_t* request) {
|
||||
#endif
|
||||
|
||||
void OTA_RequestDownloadFromHTTP(const char* s) {
|
||||
#if WINDOWS
|
||||
|
||||
#elif PLATFORM_BL602
|
||||
|
||||
#elif PLATFORM_LN882H
|
||||
|
||||
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
|
||||
#elif PLATFORM_TR6260
|
||||
#elif PLATFORM_REALTEK
|
||||
#if PLATFORM_BEKEN
|
||||
otarequest(s);
|
||||
#elif PLATFORM_ECR6600
|
||||
extern int http_client_download_file(const char* url);
|
||||
extern int ota_done(bool reset);
|
||||
@ -3248,8 +3246,33 @@ void OTA_RequestDownloadFromHTTP(const char* s) {
|
||||
}
|
||||
|
||||
ota_reboot();
|
||||
#else
|
||||
otarequest(s);
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
ota_context* ctx = NULL;
|
||||
ctx = (ota_context*)malloc(sizeof(ota_context));
|
||||
if(ctx == NULL) goto exit;
|
||||
memset(ctx, 0, sizeof(ota_context));
|
||||
char url[256] = { 0 };
|
||||
char resource[256] = { 0 };
|
||||
uint16_t port;
|
||||
parser_url(s, &url, &port, &resource, 256);
|
||||
int ret = ota_update_init(ctx, &url, port, &resource, OTA_HTTP);
|
||||
if(ret != 0)
|
||||
{
|
||||
addLogAdv(LOG_ERROR, LOG_FEATURE_HTTP, "ota_update_init failed");
|
||||
goto exit;
|
||||
}
|
||||
ret = ota_update_start(ctx);
|
||||
if(!ret)
|
||||
{
|
||||
addLogAdv(LOG_INFO, LOG_FEATURE_HTTP, "OTA finished");
|
||||
sys_clear_ota_signature();
|
||||
delay_ms(50);
|
||||
sys_reset();
|
||||
}
|
||||
exit:
|
||||
ota_update_deinit(ctx);
|
||||
addLogAdv(LOG_ERROR, LOG_FEATURE_HTTP, "OTA failed");
|
||||
if(ctx) free(ctx);
|
||||
#endif
|
||||
}
|
||||
int http_fn_ota_exec(http_request_t* request) {
|
||||
|
||||
@ -103,6 +103,15 @@ extern uint8_t flash_size_8720;
|
||||
#undef DEFAULT_FLASH_LEN
|
||||
#define DEFAULT_FLASH_LEN (flash_size_8720 << 20)
|
||||
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
|
||||
#include "ameba_ota.h"
|
||||
extern uint32_t current_fw_idx;
|
||||
extern uint32_t IMG_ADDR[OTA_IMGID_MAX][2];
|
||||
extern uint8_t flash_size_8720;
|
||||
#undef DEFAULT_FLASH_LEN
|
||||
#define DEFAULT_FLASH_LEN (flash_size_8720 << 20)
|
||||
|
||||
#endif
|
||||
|
||||
#elif PLATFORM_ECR6600
|
||||
@ -319,7 +328,7 @@ static int http_rest_post(http_request_t* request) {
|
||||
return http_rest_post_flash(request, -1, -1);
|
||||
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
|
||||
return http_rest_post_flash(request, -1, -1);
|
||||
#elif PLATFORM_REALTEK
|
||||
#elif PLATFORM_REALTEK && !PLATFORM_RTL8720E
|
||||
return http_rest_post_flash(request, 0, -1);
|
||||
#elif PLATFORM_ECR6600 || PLATFORM_TR6260
|
||||
return http_rest_post_flash(request, -1, -1);
|
||||
@ -327,7 +336,7 @@ static int http_rest_post(http_request_t* request) {
|
||||
return http_rest_post_flash(request, 0, -1);
|
||||
#else
|
||||
// TODO
|
||||
ADDLOG_DEBUG(LOG_FEATURE_API, "No OTA");
|
||||
ADDLOG_ERROR(LOG_FEATURE_API, "No OTA");
|
||||
#endif
|
||||
}
|
||||
if (!strncmp(request->url, "api/flash/", 10)) {
|
||||
@ -3255,6 +3264,128 @@ update_ota_exit:
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "OTA failed.");
|
||||
return http_rest_error(request, ret, "error");
|
||||
}
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
|
||||
// Bad implementation. While it somewhat works, it is not recommended to use. HTTP OTA is preferable.
|
||||
int ret = 0;
|
||||
|
||||
if(request->contentLength > 0)
|
||||
{
|
||||
towrite = request->contentLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -1;
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "Content-length is 0");
|
||||
goto update_ota_exit;
|
||||
}
|
||||
|
||||
flash_get_layout_info(IMG_BOOT, &IMG_ADDR[OTA_IMGID_BOOT][OTA_INDEX_1], NULL);
|
||||
flash_get_layout_info(IMG_BOOT_OTA2, &IMG_ADDR[OTA_IMGID_BOOT][OTA_INDEX_2], NULL);
|
||||
flash_get_layout_info(IMG_APP_OTA1, &IMG_ADDR[OTA_IMGID_APP][OTA_INDEX_1], NULL);
|
||||
flash_get_layout_info(IMG_APP_OTA2, &IMG_ADDR[OTA_IMGID_APP][OTA_INDEX_2], NULL);
|
||||
|
||||
ota_context ctx;
|
||||
memset(&ctx, 0, sizeof(ota_context));
|
||||
ctx.otactrl = malloc(sizeof(update_ota_ctrl_info));
|
||||
memset(ctx.otactrl, 0, sizeof(update_ota_ctrl_info));
|
||||
|
||||
ctx.otaTargetHdr = malloc(sizeof(update_ota_target_hdr));
|
||||
memset(ctx.otaTargetHdr, 0, sizeof(update_ota_target_hdr));
|
||||
writebuf = request->received;
|
||||
if(!writelen) writelen = recv(request->fd, writebuf, request->receivedLenmax, 0);
|
||||
// for some reason we receive data along with HTTP header. Skip it.
|
||||
int skip = 0;
|
||||
for(; skip < writelen - 5; skip++)
|
||||
{
|
||||
if(*(uint32_t*)&writebuf[skip] == 0xFFFFFFFF && writebuf[skip + 4] == 0x01) break;
|
||||
}
|
||||
writebuf += skip;
|
||||
writelen -= skip;
|
||||
towrite -= skip;
|
||||
update_file_hdr* pOtaFileHdr = (update_file_hdr*)(writebuf);
|
||||
ctx.otaTargetHdr->FileHdr.FwVer = pOtaFileHdr->FwVer;
|
||||
ctx.otaTargetHdr->FileHdr.HdrNum = pOtaFileHdr->HdrNum;
|
||||
|
||||
uint32_t RevHdrLen = pOtaFileHdr->HdrNum * SUB_HEADER_LEN + HEADER_LEN;
|
||||
if(writelen < RevHdrLen)
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "failed to recv file header");
|
||||
ret = -1;
|
||||
goto update_ota_exit;
|
||||
}
|
||||
|
||||
if(!get_ota_tartget_header(&ctx, writebuf, RevHdrLen))
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "Get OTA header failed");
|
||||
ret = -1;
|
||||
goto update_ota_exit;
|
||||
}
|
||||
if(!ota_checkimage_layout(ctx.otaTargetHdr))
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "ota_checkimage_layout failed");
|
||||
ret = -1;
|
||||
goto update_ota_exit;
|
||||
}
|
||||
ctx.otactrl->IsGetOTAHdr = 1;
|
||||
writebuf += RevHdrLen;
|
||||
// magic values to make it somewhat work.
|
||||
writelen -= RevHdrLen + 5 - 384;
|
||||
towrite -= RevHdrLen + 5 - 384;
|
||||
ctx.otactrl->NextImgLen = towrite;
|
||||
do
|
||||
{
|
||||
int size = download_packet_process(&ctx, writebuf, writelen);
|
||||
download_percentage(&ctx, size, ctx.otactrl->ImageLen);
|
||||
rtos_delay_milliseconds(10);
|
||||
ADDLOG_DEBUG(LOG_FEATURE_OTA, "Writelen %i at %i", writelen, total);
|
||||
total += writelen;
|
||||
towrite -= writelen;
|
||||
|
||||
if(towrite > 0)
|
||||
{
|
||||
writebuf = request->received;
|
||||
writelen = recv(request->fd, writebuf, 2048 < towrite ? 2048 : towrite, 0);
|
||||
if(writelen < 0)
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "recv returned %d - end of data - remaining %d", writelen, towrite);
|
||||
ret = -1;
|
||||
goto update_ota_exit;
|
||||
}
|
||||
}
|
||||
} while((towrite > 0) && (writelen >= 0));
|
||||
|
||||
//erase manifest
|
||||
flash_erase_sector(&flash, ctx.otactrl->FlashAddr);
|
||||
|
||||
if(!verify_ota_checksum(ctx.otaTargetHdr, ctx.otactrl->targetIdx, ctx.otactrl->index))
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "The checksum is wrong!");
|
||||
ret = -1;
|
||||
goto update_ota_exit;
|
||||
}
|
||||
|
||||
if(!ota_update_manifest(ctx.otaTargetHdr, ctx.otactrl->targetIdx, ctx.otactrl->index))
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "Change signature failed!");
|
||||
ret = -1;
|
||||
goto update_ota_exit;
|
||||
}
|
||||
|
||||
update_ota_exit:
|
||||
ota_update_deinit(&ctx);
|
||||
if(ret != -1)
|
||||
{
|
||||
ADDLOG_INFO(LOG_FEATURE_OTA, "OTA is successful");
|
||||
sys_clear_ota_signature();
|
||||
//sys_recover_ota_signature();
|
||||
}
|
||||
else
|
||||
{
|
||||
ADDLOG_ERROR(LOG_FEATURE_OTA, "OTA failed.");
|
||||
return http_rest_error(request, ret, "error");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
init_ota(startaddr);
|
||||
|
||||
@ -1510,6 +1510,9 @@ extern "C" {
|
||||
#define DPRINTLN(x)
|
||||
#endif
|
||||
#endif // DEBUG
|
||||
#if PLATFORM_REALTEK
|
||||
#define strcasecmp strcmp
|
||||
#endif
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
#ifndef F
|
||||
|
||||
@ -6,19 +6,10 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if PLATFORM_BEKEN
|
||||
#if PLATFORM_BEKEN || PLATFORM_REALTEK
|
||||
//TODO
|
||||
static uint32_t micros(void)
|
||||
{
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t millis(void)
|
||||
{
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
extern unsigned long micros(void);
|
||||
extern unsigned long millis(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,34 +1,47 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include "../../../obk_config.h"
|
||||
|
||||
#if ENABLE_DRIVER_IRREMOTEESP
|
||||
|
||||
|
||||
extern "C" {
|
||||
#if PLATFORM_BEKEN
|
||||
#include <gpio_pub.h>
|
||||
#else
|
||||
#include "../../../hal/hal_pins.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "digitalWriteFast.h"
|
||||
|
||||
|
||||
void digitalToggleFast(unsigned char P) {
|
||||
#if PLATFORM_BEKEN
|
||||
bk_gpio_output((GPIO_INDEX)P, !bk_gpio_input((GPIO_INDEX)P));
|
||||
#else
|
||||
HAL_PIN_SetOutputValue(P, !HAL_PIN_ReadDigitalInput(P));
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned char digitalReadFast(unsigned char P) {
|
||||
#if PLATFORM_BEKEN
|
||||
return bk_gpio_input((GPIO_INDEX)P);
|
||||
#else
|
||||
return HAL_PIN_ReadDigitalInput(P);
|
||||
#endif
|
||||
}
|
||||
|
||||
void digitalWriteFast(unsigned char P, unsigned char V) {
|
||||
//RAW_SetPinValue(P, V);
|
||||
//HAL_PIN_SetOutputValue(index, iVal);
|
||||
#if PLATFORM_BEKEN
|
||||
bk_gpio_output((GPIO_INDEX)P, V);
|
||||
#else
|
||||
HAL_PIN_SetOutputValue(P, V);
|
||||
#endif
|
||||
}
|
||||
|
||||
void pinModeFast(unsigned char P, unsigned char V) {
|
||||
#if PLATFORM_BEKEN
|
||||
if (V == INPUT_PULLUP) {
|
||||
bk_gpio_config_input_pup((GPIO_INDEX)P);
|
||||
}
|
||||
@ -41,6 +54,15 @@ void pinModeFast(unsigned char P, unsigned char V) {
|
||||
else if (V == OUTPUT) {
|
||||
bk_gpio_config_output((GPIO_INDEX)P);
|
||||
}
|
||||
#else
|
||||
switch(V)
|
||||
{
|
||||
case INPUT_PULLUP: HAL_PIN_Setup_Input_Pulldown(P); break;
|
||||
case INPUT_PULLDOWN: HAL_PIN_Setup_Input_Pullup(P); break;
|
||||
case INPUT: HAL_PIN_Setup_Input(P); break;
|
||||
case OUTPUT: HAL_PIN_Setup_Output(P); break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
#ifndef __digitalWriteFast_h_
|
||||
#define __digitalWriteFast_h_ 1
|
||||
|
||||
|
||||
#if PLATFORM_BEKEN
|
||||
//TODO: check these?
|
||||
typedef enum {
|
||||
LOW = 0,
|
||||
@ -34,9 +32,7 @@ typedef enum {
|
||||
OUTPUT = 0x1,
|
||||
INPUT_PULLUP = 0x2,
|
||||
INPUT_PULLDOWN = 0x3,
|
||||
} PinMode;
|
||||
#endif
|
||||
|
||||
} PinModeOBK;
|
||||
|
||||
void digitalToggleFast(unsigned char P);
|
||||
unsigned char digitalReadFast(unsigned char P);
|
||||
@ -44,5 +40,3 @@ void digitalWriteFast(unsigned char P, unsigned char V);
|
||||
void pinModeFast(unsigned char P, unsigned char V);
|
||||
|
||||
#endif //__digitalWriteFast_h_
|
||||
|
||||
|
||||
|
||||
@ -119,6 +119,11 @@ struct lfs_config cfg = {
|
||||
.erase = lfs_erase,
|
||||
.sync = lfs_sync,
|
||||
|
||||
#if PLATFORM_REALTEK_NEW
|
||||
.lock = lfs_diskio_lock,
|
||||
.unlock = lfs_diskio_unlock,
|
||||
#endif
|
||||
|
||||
// block device configuration
|
||||
.read_size = 1,
|
||||
.prog_size = 1,
|
||||
@ -144,7 +149,7 @@ static commandResult_t CMD_LFS_Size(const void *context, const char *cmd, const
|
||||
return CMD_RES_OK;
|
||||
}
|
||||
|
||||
#if PLATFORM_ESPIDF || PLATFORM_RTL8720D || PLATFORM_BL602 || PLATFORM_ESP8266
|
||||
#if PLATFORM_ESPIDF || PLATFORM_RTL8720D || PLATFORM_BL602 || PLATFORM_ESP8266 || PLATFORM_REALTEK_NEW
|
||||
ADDLOG_ERROR(LOG_FEATURE_CMD, PLATFORM_MCU_NAME" doesn't support changing LFS size");
|
||||
return CMD_RES_ERROR;
|
||||
#endif
|
||||
@ -289,6 +294,20 @@ static commandResult_t CMD_LFS_Format(const void *context, const char *cmd, cons
|
||||
LFS_Start = newstart = 0; // lfs_info.offset;
|
||||
LFS_Size = newsize = lfs_info.size;
|
||||
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
|
||||
switch(flash_size_8720)
|
||||
{
|
||||
case 4:
|
||||
LFS_Start = newstart = 0x1F0000;
|
||||
LFS_Size = newsize = 0x24000;
|
||||
break;
|
||||
default:
|
||||
LFS_Start = newstart = 0x400000;
|
||||
LFS_Size = newsize = (flash_size_8720 << 20) - LFS_Start;
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
cfg.block_count = (newsize/LFS_BLOCK_SIZE);
|
||||
@ -555,6 +574,22 @@ void init_lfs(int create){
|
||||
ADDLOGF_INFO("8720D Detected Flash Size: %i MB, adjusting LFS, start: 0x%X, size: 0x%X", flash_size_8720, newstart, newsize);
|
||||
CFG_SetLFS_Size(newsize);
|
||||
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
|
||||
switch(flash_size_8720)
|
||||
{
|
||||
case 4:
|
||||
LFS_Start = newstart = 0x1F0000;
|
||||
LFS_Size = newsize = 0x24000;
|
||||
break;
|
||||
default:
|
||||
LFS_Start = newstart = 0x400000;
|
||||
LFS_Size = newsize = (flash_size_8720 << 20) - LFS_Start;
|
||||
break;
|
||||
}
|
||||
ADDLOGF_INFO("8721DA/8720E Detected Flash Size: %i MB, adjusting LFS, start: 0x%X, size: 0x%X", flash_size_8720, newstart, newsize);
|
||||
CFG_SetLFS_Size(newsize);
|
||||
|
||||
#endif
|
||||
|
||||
LFS_Start = newstart;
|
||||
|
||||
@ -107,6 +107,13 @@
|
||||
#define LFS_BLOCKS_END 0x80000000
|
||||
#define LFS_BLOCKS_MAX_LEN 0x80000000
|
||||
|
||||
#elif PLATFORM_REALTEK_NEW
|
||||
|
||||
#define LFS_BLOCKS_START 0x1F0000
|
||||
#define LFS_BLOCKS_START_MIN 0x1F0000
|
||||
#define LFS_BLOCKS_END 0x80000000
|
||||
#define LFS_BLOCKS_MAX_LEN 0x80000000
|
||||
|
||||
#elif PLATFORM_ECR6600
|
||||
|
||||
#define LFS_BLOCKS_START 0x1D5000
|
||||
@ -155,7 +162,11 @@
|
||||
|
||||
#if ENABLE_LITTLEFS
|
||||
|
||||
#if PLATFORM_REALTEK_NEW
|
||||
#include "littlefs_adapter.h"
|
||||
#else
|
||||
#include "lfs.h"
|
||||
#endif
|
||||
|
||||
// 512k MAX - i.e. no more that 0x80000
|
||||
// 0x8000 = 32k
|
||||
|
||||
@ -112,7 +112,7 @@ const char* strcasestr(const char* str1, const char* str2)
|
||||
// where is buffer with [64] bytes?
|
||||
// 2022-11-02 update: It was also causing crash on OpenBL602. Original strdup was crashing while my strdup works.
|
||||
// Let's just rename test_strdup to strdup and let it be our main correct strdup
|
||||
#if !defined(PLATFORM_W600) && !defined(PLATFORM_W800) && !defined(WINDOWS) && !defined(PLATFORM_ECR6600)
|
||||
#if !defined(PLATFORM_W600) && !defined(PLATFORM_W800) && !defined(WINDOWS) && !defined(PLATFORM_ECR6600) && !PLATFORM_REALTEK_NEW
|
||||
// W600 and W800 already seem to have a strdup?
|
||||
char *strdup(const char *s)
|
||||
{
|
||||
|
||||
@ -172,6 +172,16 @@ typedef long BaseType_t;
|
||||
#define DEVICENAME_PREFIX_SHORT "esp8266"
|
||||
#define PLATFORM_MCU_NAME "ESP8266"
|
||||
#define MANUFACTURER "Espressif"
|
||||
#elif PLATFORM_RTL8721DA
|
||||
#define DEVICENAME_PREFIX_FULL "OpenRTL8721DA"
|
||||
#define DEVICENAME_PREFIX_SHORT "rtl8721da"
|
||||
#define PLATFORM_MCU_NAME "RTL8721DA"
|
||||
#define MANUFACTURER "Realtek"
|
||||
#elif PLATFORM_RTL8720E
|
||||
#define DEVICENAME_PREFIX_FULL "OpenRTL8720E"
|
||||
#define DEVICENAME_PREFIX_SHORT "rtl8720e"
|
||||
#define PLATFORM_MCU_NAME "RTL8720E"
|
||||
#define MANUFACTURER "Realtek"
|
||||
#else
|
||||
#error "You must define a platform.."
|
||||
This platform is not supported, error!
|
||||
@ -225,6 +235,10 @@ This platform is not supported, error!
|
||||
#define USER_SW_VER "ECR6600_Test"
|
||||
#elif PLATFORM_ESP8266
|
||||
#define USER_SW_VER "ESP8266_Test"
|
||||
#elif PLATFORM_RTL8721DA
|
||||
#define USER_SW_VER "RTL8721DA_Test"
|
||||
#elif PLATFORM_RTL8720E
|
||||
#define USER_SW_VER "RTL8720E_Test"
|
||||
#else
|
||||
#warning "USER_SW_VER undefined"
|
||||
#define USER_SW_VER "unknown"
|
||||
@ -630,6 +644,10 @@ OSStatus rtos_suspend_thread(beken_thread_t* thread);
|
||||
|
||||
#elif PLATFORM_REALTEK
|
||||
|
||||
#if __cplusplus && !PLATFORM_REALTEK_NEW
|
||||
typedef uint32_t in_addr_t;
|
||||
#endif
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
@ -641,10 +659,32 @@ OSStatus rtos_suspend_thread(beken_thread_t* thread);
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "PinNames.h"
|
||||
#if PLATFORM_REALTEK_NEW
|
||||
#include "wifi_api_event.h"
|
||||
#include "wifi_api_types.h"
|
||||
#include "wifi_api_ext.h"
|
||||
#include "kv.h"
|
||||
#if PLATFORM_RTL8721DA
|
||||
#include "autoconf_8721da.h"
|
||||
#elif PLATFORM_RTL8720E
|
||||
#include "autoconf_8720e.h"
|
||||
#endif
|
||||
#define wifi_is_up wifi_is_running
|
||||
#define RTW_STA_INTERFACE STA_WLAN_INDEX
|
||||
#define RTW_AP_INTERFACE SOFTAP_WLAN_INDEX
|
||||
#define RTW_MODE_STA_AP RTW_MODE_AP
|
||||
#define wifi_enable_powersave() wifi_set_lps_enable(1)
|
||||
#define wifi_disable_powersave() wifi_set_lps_enable(0)
|
||||
#define RTW_SUCCESS 0
|
||||
typedef enum rtw_security rtw_security_t;
|
||||
typedef enum rtw_drv_op_mode rtw_mode_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned int UINT32;
|
||||
typedef uint8_t UINT8;
|
||||
extern int g_sleepfactor;
|
||||
extern u32 pwmout_pin2chan(PinName pin);
|
||||
|
||||
#undef ASSERT
|
||||
#define ASSERT
|
||||
@ -883,7 +923,7 @@ int LWIP_GetMaxSockets();
|
||||
int LWIP_GetActiveSockets();
|
||||
|
||||
#ifndef LINUX
|
||||
#if !PLATFORM_ESPIDF && !PLATFORM_ESP8266
|
||||
#if !PLATFORM_ESPIDF && !PLATFORM_ESP8266 && !PLATFORM_REALTEK_NEW
|
||||
//delay function do 10*r nops, because rtos_delay_milliseconds is too much
|
||||
void usleep(int r);
|
||||
#endif
|
||||
|
||||
@ -1060,8 +1060,10 @@ typedef enum channelType_e {
|
||||
#define PLATFORM_GPIO_MAX 17
|
||||
#elif PLATFORM_RTL8710A
|
||||
#define PLATFORM_GPIO_MAX 20
|
||||
#elif PLATFORM_RTL8720D
|
||||
#elif PLATFORM_RTL8720D || PLATFORM_RTL8721DA
|
||||
#define PLATFORM_GPIO_MAX 64
|
||||
#elif PLATFORM_RTL8720E
|
||||
#define PLATFORM_GPIO_MAX 52
|
||||
#elif PLATFORM_ECR6600
|
||||
#define PLATFORM_GPIO_MAX 27
|
||||
#elif PLATFORM_BK7252 || PLATFORM_BK7252N
|
||||
@ -1133,7 +1135,7 @@ typedef struct pinsState_s
|
||||
byte channelTypes[CHANNEL_MAX];
|
||||
} pinsState_t;
|
||||
|
||||
#elif PLATFORM_RTL8720D
|
||||
#elif PLATFORM_RTL8720D || PLATFORM_RTL8721DA || PLATFORM_RTL8720E
|
||||
|
||||
#define MAX_PIN_ROLES 64
|
||||
|
||||
@ -1387,7 +1389,7 @@ typedef struct mainConfig_s {
|
||||
byte unusedSectorAB[51];
|
||||
#elif PLATFORM_ESPIDF
|
||||
byte unusedSectorAB[43];
|
||||
#elif PLATFORM_RTL8720D
|
||||
#elif PLATFORM_RTL8720D || PLATFORM_RTL8721DA || PLATFORM_RTL8720E
|
||||
byte unusedSectorAB;
|
||||
#else
|
||||
byte unusedSectorAB[99];
|
||||
|
||||
@ -439,11 +439,20 @@
|
||||
#define ENABLE_ADVANCED_CHANNELTYPES_DISCOVERY 1
|
||||
#define ENABLE_DRIVER_SSDP 1
|
||||
#define ENABLE_OBK_SCRIPTING 1
|
||||
#define ENABLE_DRIVER_TCL 1
|
||||
|
||||
#ifndef PLATFORM_RTL8710B
|
||||
#define ENABLE_OBK_BERRY 1
|
||||
#endif
|
||||
#define ENABLE_DRIVER_TCL 1
|
||||
|
||||
#if PLATFORM_RTL87X0C || PLATFORM_REALTEK_NEW || PLATFORM_RTL8720D
|
||||
#undef ENABLE_DRIVER_DDP
|
||||
#define ENABLE_DRIVER_IRREMOTEESP 1
|
||||
#endif
|
||||
|
||||
#if PLATFORM_RTL8720E
|
||||
#undef NO_CHIP_TEMPERATURE
|
||||
#endif
|
||||
|
||||
#elif PLATFORM_ECR6600
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ void extended_app_waiting_for_launch2(void) {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PLATFORM_LN882H) || defined(PLATFORM_ESPIDF) || defined(PLATFORM_ESP8266)
|
||||
#if PLATFORM_LN882H || PLATFORM_ESPIDF || PLATFORM_ESP8266 || PLATFORM_REALTEK_NEW
|
||||
|
||||
int LWIP_GetMaxSockets() {
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user