mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 09:32:34 +00:00
Compare commits
1 Commits
v2.7.0-rc2
...
uCentral-t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6c5e1f1f2 |
39
.github/actions/create-ami-from-image/action.yml
vendored
39
.github/actions/create-ami-from-image/action.yml
vendored
@@ -1,39 +0,0 @@
|
||||
name: Create AMI from firmware image in S3 bucket
|
||||
|
||||
inputs:
|
||||
firmware_image_name:
|
||||
description: Name of the firmware image
|
||||
required: true
|
||||
firmware_image_s3_bucket:
|
||||
description: Name of the S3 bucket where the image resides
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Import snapshot based on firmware image
|
||||
id: import_snapshot
|
||||
shell: bash
|
||||
run: |
|
||||
echo ::set-output name=import_task_id::$(aws ec2 import-snapshot --description '${{ inputs.firmware_image_name }}' --disk-container 'Format=raw,UserBucket={S3Bucket=${{ inputs.firmware_image_s3_bucket }},S3Key=${{ inputs.firmware_image_name }}}' | jq -r '.ImportTaskId')
|
||||
|
||||
- name: Wait for import task to complete and get snapshot ID
|
||||
id: get_snapshot_id
|
||||
shell: bash
|
||||
run: |
|
||||
IMPORT_TASK_STATUS=""
|
||||
while [[ $IMPORT_TASK_STATUS != 'completed' ]]; do
|
||||
IMPORT_TASK_STATUS=$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.Status')
|
||||
echo "Import task status is $IMPORT_TASK_STATUS, waiting for completion."
|
||||
done
|
||||
echo ::set-output name=id::$(aws ec2 describe-import-snapshot-tasks --import-task-ids ${{ steps.import_snapshot.outputs.import_task_id }} | jq -r '.ImportSnapshotTasks[].SnapshotTaskDetail.SnapshotId')
|
||||
|
||||
- name: Tag snapshot with image name
|
||||
shell: bash
|
||||
run: |
|
||||
aws ec2 create-tags --resources ${{ steps.get_snapshot_id.outputs.id }} --tags 'Key=Name,Value=${{ inputs.firmware_image_name }}'
|
||||
|
||||
- name: Register AMI based on snapshot
|
||||
shell: bash
|
||||
run: |
|
||||
aws ec2 register-image --name '${{ inputs.firmware_image_name }}' --root-device-name /dev/xvda --block-device-mappings 'DeviceName=/dev/xvda,Ebs={SnapshotId=${{ steps.get_snapshot_id.outputs.id }}}'
|
||||
55
.github/workflows/build-dev.yml
vendored
55
.github/workflows/build-dev.yml
vendored
@@ -1,27 +1,17 @@
|
||||
name: Build OpenWrt/uCentral images
|
||||
|
||||
env:
|
||||
AWS_DEFAULT_OUTPUT: json
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
|
||||
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, next, staging-* ]
|
||||
branches: [ uCentral-* ]
|
||||
tags: [ v* ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ['actiontec_web7200', 'cig_wf188n', 'cig_wf196', 'cig_wf610d', 'cig_wf808', 'cybertan_eww622-a1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'indio_um-305ac', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'meshpp_s618_cp03', 'meshpp_s618_cp01', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'x64_vm' ]
|
||||
target: ['cig_wf188', 'cig_wf194c', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'indio_um-305ac', 'linksys_e8450-ubi', 'linksys_ea8300', 'mikrotik_nand', 'tplink_cpe210_v3', 'tplink_cpe510_v3', 'tplink_eap225_outdoor_v1', 'tplink_ec420', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -34,12 +24,17 @@ jobs:
|
||||
make -j TARGET=${{ matrix.target }}
|
||||
|
||||
- name: Package and upload image for ${{ matrix.target }}
|
||||
id: package_and_upload_image
|
||||
env:
|
||||
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
|
||||
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
|
||||
ARTIFACTORY_USERNAME: cicd-indoor-main
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
|
||||
AWS_DEFAULT_OUTPUT: json
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
|
||||
run: |
|
||||
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
|
||||
HASH=$(git rev-parse --short HEAD)
|
||||
@@ -47,10 +42,8 @@ jobs:
|
||||
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
|
||||
then
|
||||
REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
|
||||
IS_RELEASE="false"
|
||||
else
|
||||
REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
|
||||
IS_RELEASE="true"
|
||||
fi
|
||||
|
||||
BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH"
|
||||
@@ -67,36 +60,4 @@ jobs:
|
||||
[ -f openwrt/tmp/image-file ] && curl -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json"
|
||||
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
|
||||
if [ ${{ matrix.target }} == 'x64_vm' ]; then
|
||||
echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)"
|
||||
fi
|
||||
|
||||
trigger-testing:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- name: Trigger testing of release
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
with:
|
||||
token: ${{ secrets.WLAN_TESTING_PAT }}
|
||||
repository: Telecominfraproject/wlan-testing
|
||||
event-type: new-ap-release
|
||||
client-payload: '{"ref": "${GITHUB_REF#refs/tags/}", "sha": "${{ github.sha }}"}'
|
||||
|
||||
create-x64_vm-ami:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use create-ami-from-image composite action
|
||||
uses: ./.github/actions/create-ami-from-image
|
||||
with:
|
||||
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
|
||||
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}
|
||||
|
||||
88
.github/workflows/x64_vm-build-test.yml
vendored
88
.github/workflows/x64_vm-build-test.yml
vendored
@@ -1,88 +0,0 @@
|
||||
name: Test x64_vm build and AMI creation
|
||||
|
||||
env:
|
||||
AWS_DEFAULT_OUTPUT: json
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
AWS_S3_BUCKET_NAME: ucentral-ap-firmware
|
||||
AWS_ACCOUNT_ID: ${{ secrets.UCENTRAL_S3_ACCOUNT_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.UCENTRAL_S3_ACCESS_KEY_SECRET }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
x64_vm_image_name: ${{ steps.package_and_upload_image.outputs.x64_vm_image_name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: ['x64_vm']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build image for ${{ matrix.target }}
|
||||
id: build
|
||||
run: |
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
make -j TARGET=${{ matrix.target }}
|
||||
|
||||
- name: Package and upload image for ${{ matrix.target }}
|
||||
id: package_and_upload_image
|
||||
env:
|
||||
GH_BUILD_USERNAME: ${{ secrets.GH_BUILD_USERNAME }}
|
||||
GH_BUILD_PASSWORD: ${{ secrets.GH_BUILD_PASSWORD }}
|
||||
ARTIFACTORY_USERNAME: cicd-indoor-main
|
||||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
run: |
|
||||
LOWERCASE_TARGET=`echo ${{ matrix.target }} | tr '[:upper:]' '[:lower:]'`
|
||||
HASH=$(git rev-parse --short HEAD)
|
||||
|
||||
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
|
||||
then
|
||||
REF=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
|
||||
IS_RELEASE="false"
|
||||
else
|
||||
REF=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
|
||||
IS_RELEASE="true"
|
||||
fi
|
||||
|
||||
BASENAME="$(date +%Y%m%d)-$LOWERCASE_TARGET-$REF-$HASH"
|
||||
TAR_NAME="$BASENAME.tar.gz"
|
||||
IMG_NAME="$BASENAME-upgrade.bin";
|
||||
JSON_NAME="$BASENAME.json";
|
||||
|
||||
tar cfz "$TAR_NAME" -C openwrt/bin/targets/ .
|
||||
curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "$TAR_NAME" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$TAR_NAME""
|
||||
IMG_NAME="$BASENAME-upgrade.bin";
|
||||
TIP_VERSION="$(grep DISTRIB_TIP= openwrt/tmp/openwrt_release | cut -d\' -f2)"
|
||||
echo -e "{\n\t\"image\":\""${IMG_NAME}"\",\n\t\"revision\": \""${TIP_VERSION}"\",\n\t\"timestamp\":\""$(date +%s)"\",\n\t\"compatible\": \""${LOWERCASE_TARGET}"\"\n}" > latest-upgrade.json
|
||||
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "openwrt/$(cat openwrt/tmp/image-file)" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/"$IMG_NAME""
|
||||
[ -f openwrt/tmp/image-file ] && curl -s -u $GH_BUILD_USERNAME:$GH_BUILD_PASSWORD -T "latest-upgrade.json" "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/$LOWERCASE_TARGET/latest-upgrade.json"
|
||||
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/octet-stream" "openwrt/$(cat openwrt/tmp/image-file)" "s3://$AWS_S3_BUCKET_NAME/$IMG_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$IMG_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3 cp --acl public-read --content-type "application/json" "latest-upgrade.json" "s3://$AWS_S3_BUCKET_NAME/$JSON_NAME"
|
||||
[ -f openwrt/tmp/image-file ] && aws s3api put-object-tagging --bucket "$AWS_S3_BUCKET_NAME" --key "$JSON_NAME" --tagging "{\"TagSet\":[{\"Key\":\"release\",\"Value\":\"$IS_RELEASE\"}]}"
|
||||
|
||||
if [[ ${{ matrix.target }} == 'x64_vm' ]]; then
|
||||
echo ::set-output name=x64_vm_image_name::"$(echo $IMG_NAME)"
|
||||
fi
|
||||
|
||||
create-x64_vm-ami:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: WIFI-7206-add-workflow-to-build-virtual-ap-image
|
||||
|
||||
- name: Use create-ami-from-image composite action
|
||||
uses: ./.github/actions/create-ami-from-image
|
||||
with:
|
||||
firmware_image_name: ${{ needs.build.outputs.x64_vm_image_name }}
|
||||
firmware_image_s3_bucket: ${{ env.AWS_S3_BUCKET_NAME }}
|
||||
@@ -12,7 +12,7 @@ First we need to clone and setup our tree. This will result in an openwrt/.
|
||||
Next we need to select the profile and base package selection. This setup will install the feeds, packages and generate the .config file.
|
||||
```
|
||||
cd openwrt
|
||||
./scripts/gen_config.py linksys_ea8300
|
||||
./scripts/gen_config.py ea8300
|
||||
```
|
||||
Finally we can build the tree.
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 9baf9f77dbc5129bd0f8f655e9ccf9fab93cd7e6 Mon Sep 17 00:00:00 2001
|
||||
From 0b769e318e332d3bf8c7ab68b492cdc90dcb8e18 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Sat, 4 Sep 2021 05:42:30 +0200
|
||||
Subject: [PATCH 01/88] realtek: update to latest owrt HEAD
|
||||
Subject: [PATCH 08/27] realtek: update to latest owrt HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
.../realtek/base-files/etc/board.d/02_network | 12 +-
|
||||
.../lib/preinit/05_set_preinit_iface_realtek | 13 -
|
||||
.../lib/preinit/98_remove_preinit_realtek | 6 -
|
||||
target/linux/realtek/config-5.4 | 31 +-
|
||||
target/linux/realtek/config-5.4 | 30 +-
|
||||
.../realtek/dts/rtl8380_netgear_gigabit.dtsi | 11 +-
|
||||
.../realtek/dts/rtl8380_zyxel_gs1900-10hp.dts | 4 +-
|
||||
.../realtek/dts/rtl8380_zyxel_gs1900-8.dts | 12 -
|
||||
@@ -24,7 +24,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
.../files-5.4/drivers/net/dsa/rtl83xx/Kconfig | 2 +-
|
||||
.../drivers/net/dsa/rtl83xx/Makefile | 2 +-
|
||||
.../drivers/net/dsa/rtl83xx/common.c | 1065 +++++-
|
||||
.../drivers/net/dsa/rtl83xx/debugfs.c | 392 +-
|
||||
.../drivers/net/dsa/rtl83xx/debugfs.c | 392 ++-
|
||||
.../files-5.4/drivers/net/dsa/rtl83xx/dsa.c | 1363 +++++--
|
||||
.../drivers/net/dsa/rtl83xx/rtl838x.c | 1749 ++++++++-
|
||||
.../drivers/net/dsa/rtl83xx/rtl838x.h | 472 ---
|
||||
@@ -39,10 +39,9 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
.../realtek/files-5.4/include/linux/rtl838x.h | 1072 ++++++
|
||||
.../realtek/files-5.4/net/dsa/tag_rtl83xx.c | 119 +
|
||||
target/linux/realtek/image/Makefile | 44 +-
|
||||
.../realtek/patches-5.4/100-dsa-lag.patch | 3145 +++++++++++++++++
|
||||
.../realtek/patches-5.4/100-dsa-lag.patch | 3123 +++++++++++++++++
|
||||
.../realtek/patches-5.4/101-brflood-api.patch | 817 +++++
|
||||
...0-gpio-Add-Realtek-Otto-GPIO-support.patch | 405 +++
|
||||
...net-add-support-for-rtl838x-ethernet.patch | 2 +-
|
||||
...nclude-linux-add-phy-ops-for-rtl838x.patch | 2 +-
|
||||
...04-include-linux-add-phy-hsgmii-mode.patch | 19 +
|
||||
.../realtek/patches-5.4/706-sysled.patch | 288 ++
|
||||
@@ -52,7 +51,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
.../realtek/patches-5.4/710-adt7470.patch | 20 +
|
||||
.../realtek/patches-5.4/711-ec4100.patch | 150 +
|
||||
.../linux/realtek/patches-5.4/712-fixes.patch | 23 +
|
||||
47 files changed, 16286 insertions(+), 1624 deletions(-)
|
||||
46 files changed, 16262 insertions(+), 1623 deletions(-)
|
||||
delete mode 100644 target/linux/realtek/base-files/lib/preinit/05_set_preinit_iface_realtek
|
||||
delete mode 100644 target/linux/realtek/base-files/lib/preinit/98_remove_preinit_realtek
|
||||
delete mode 100644 target/linux/realtek/dts/rtl8380_zyxel_gs1900-8.dts
|
||||
@@ -160,7 +159,7 @@ index dc5fdb059b..0000000000
|
||||
-
|
||||
-boot_hook_add preinit_main remove_switch
|
||||
diff --git a/target/linux/realtek/config-5.4 b/target/linux/realtek/config-5.4
|
||||
index 51025d5d89..cba448acb6 100644
|
||||
index 51025d5d89..ced5d5f7ae 100644
|
||||
--- a/target/linux/realtek/config-5.4
|
||||
+++ b/target/linux/realtek/config-5.4
|
||||
@@ -2,17 +2,18 @@ CONFIG_ARCH_32BIT_OFF_T=y
|
||||
@@ -185,7 +184,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15
|
||||
CONFIG_CPU_BIG_ENDIAN=y
|
||||
CONFIG_CPU_GENERIC_DUMP_TLB=y
|
||||
@@ -40,14 +41,11 @@ CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
|
||||
@@ -40,14 +41,10 @@ CONFIG_DMA_NONCOHERENT_CACHE_SYNC=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_EARLY_PRINTK_8250=y
|
||||
@@ -197,11 +196,10 @@ index 51025d5d89..cba448acb6 100644
|
||||
-CONFIG_FONT_8x16=y
|
||||
-CONFIG_FONT_AUTOSELECT=y
|
||||
-CONFIG_FONT_SUPPORT=y
|
||||
+CONFIG_FORCE_MAX_ZONEORDER=13
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
@@ -74,7 +72,9 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
|
||||
@@ -74,7 +71,9 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_RTL8231=y
|
||||
CONFIG_GPIO_RTL838X=y
|
||||
@@ -212,7 +210,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_GRO_CELLS=y
|
||||
CONFIG_HANDLE_DOMAIN_IRQ=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
@@ -89,6 +89,7 @@ CONFIG_HZ_PERIODIC=y
|
||||
@@ -89,6 +88,7 @@ CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_ALGOBIT=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
@@ -220,7 +218,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_I2C_GPIO=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQCHIP=y
|
||||
@@ -107,6 +108,8 @@ CONFIG_MDIO_BUS=y
|
||||
@@ -107,6 +107,8 @@ CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MDIO_I2C=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
@@ -229,7 +227,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_MFD_SYSCON=y
|
||||
CONFIG_MIGRATION=y
|
||||
CONFIG_MIPS=y
|
||||
@@ -138,7 +141,7 @@ CONFIG_NEED_PER_CPU_KM=y
|
||||
@@ -138,7 +140,7 @@ CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_DEVLINK=y
|
||||
CONFIG_NET_DSA=y
|
||||
CONFIG_NET_DSA_RTL83XX=y
|
||||
@@ -238,7 +236,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_NET_RTL838X=y
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
|
||||
@@ -161,12 +164,17 @@ CONFIG_PINCTRL=y
|
||||
@@ -161,12 +163,17 @@ CONFIG_PINCTRL=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
CONFIG_PSB6970_PHY=y
|
||||
@@ -256,7 +254,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_SERIAL_MCTRL_GPIO=y
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
CONFIG_SFP=y
|
||||
@@ -175,7 +183,7 @@ CONFIG_SPI_MASTER=y
|
||||
@@ -175,7 +182,7 @@ CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_MEM=y
|
||||
CONFIG_SPI_RTL838X=y
|
||||
CONFIG_SRCU=y
|
||||
@@ -265,7 +263,7 @@ index 51025d5d89..cba448acb6 100644
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SYSCTL_EXCEPTION_TRACE=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
@@ -187,8 +195,11 @@ CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
|
||||
@@ -187,8 +194,11 @@ CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
|
||||
CONFIG_SYS_SUPPORTS_MIPS16=y
|
||||
CONFIG_TARGET_ISA_REV=2
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
@@ -15347,14 +15345,13 @@ index 18e5fedb9b..a4b2ea892c 100644
|
||||
$(eval $(call BuildImage))
|
||||
diff --git a/target/linux/realtek/patches-5.4/100-dsa-lag.patch b/target/linux/realtek/patches-5.4/100-dsa-lag.patch
|
||||
new file mode 100644
|
||||
index 0000000000..5a28760ba9
|
||||
index 0000000000..3d1992e4cb
|
||||
--- /dev/null
|
||||
+++ b/target/linux/realtek/patches-5.4/100-dsa-lag.patch
|
||||
@@ -0,0 +1,3145 @@
|
||||
+Index: linux-5.4.158/drivers/net/bonding/bond_main.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/bonding/bond_main.c
|
||||
++++ linux-5.4.158/drivers/net/bonding/bond_main.c
|
||||
@@ -0,0 +1,3123 @@
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/bonding/bond_main.c linux-5.4.137/drivers/net/bonding/bond_main.c
|
||||
+--- linux-5.4.137.old/drivers/net/bonding/bond_main.c 2021-08-04 14:05:38.055697349 +0700
|
||||
++++ linux-5.4.137/drivers/net/bonding/bond_main.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -1753,6 +1753,8 @@ int bond_enslave(struct net_device *bond
|
||||
+ goto err_unregister;
|
||||
+ }
|
||||
@@ -15364,10 +15361,9 @@ index 0000000000..5a28760ba9
|
||||
+ res = bond_sysfs_slave_add(new_slave);
|
||||
+ if (res) {
|
||||
+ slave_dbg(bond_dev, slave_dev, "Error %d calling bond_sysfs_slave_add\n", res);
|
||||
+Index: linux-5.4.158/drivers/net/dsa/b53/b53_common.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/b53/b53_common.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/b53/b53_common.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/b53/b53_common.c linux-5.4.137/drivers/net/dsa/b53/b53_common.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/b53/b53_common.c 2021-08-04 14:05:38.055697349 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/b53/b53_common.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -537,7 +537,7 @@ int b53_enable_port(struct dsa_switch *d
|
||||
+ if (!dsa_is_user_port(ds, port))
|
||||
+ return 0;
|
||||
@@ -15395,7 +15391,7 @@ index 0000000000..5a28760ba9
|
||||
+ unsigned int i;
|
||||
+ u16 pvlan, reg, pvid;
|
||||
+
|
||||
+@@ -2395,10 +2395,13 @@ struct b53_device *b53_switch_alloc(stru
|
||||
+@@ -2396,10 +2396,13 @@ struct b53_device *b53_switch_alloc(stru
|
||||
+ struct dsa_switch *ds;
|
||||
+ struct b53_device *dev;
|
||||
+
|
||||
@@ -15410,10 +15406,9 @@ index 0000000000..5a28760ba9
|
||||
+ dev = devm_kzalloc(base, sizeof(*dev), GFP_KERNEL);
|
||||
+ if (!dev)
|
||||
+ return NULL;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/bcm_sf2.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/bcm_sf2.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/bcm_sf2.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/bcm_sf2.c linux-5.4.137/drivers/net/dsa/bcm_sf2.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/bcm_sf2.c 2021-08-04 14:05:38.055697349 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/bcm_sf2.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -670,7 +670,7 @@ static void bcm_sf2_sw_fixed_state(struc
|
||||
+ * state machine and make it go in PHY_FORCING state instead.
|
||||
+ */
|
||||
@@ -15444,10 +15439,9 @@ index 0000000000..5a28760ba9
|
||||
+ struct ethtool_wolinfo pwol = { };
|
||||
+
|
||||
+ if (p->ethtool_ops->get_wol)
|
||||
+Index: linux-5.4.158/drivers/net/dsa/bcm_sf2_cfp.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/bcm_sf2_cfp.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/bcm_sf2_cfp.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/bcm_sf2_cfp.c linux-5.4.137/drivers/net/dsa/bcm_sf2_cfp.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/bcm_sf2_cfp.c 2021-08-04 14:05:38.055697349 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/bcm_sf2_cfp.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -821,7 +821,7 @@ static int bcm_sf2_cfp_rule_insert(struc
|
||||
+ struct ethtool_rx_flow_spec *fs)
|
||||
+ {
|
||||
@@ -15475,10 +15469,9 @@ index 0000000000..5a28760ba9
|
||||
+ struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
|
||||
+ int ret = 0;
|
||||
+
|
||||
+Index: linux-5.4.158/drivers/net/dsa/dsa_loop.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/dsa_loop.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/dsa_loop.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/dsa_loop.c linux-5.4.137/drivers/net/dsa/dsa_loop.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/dsa_loop.c 2021-08-04 14:05:38.055697349 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/dsa_loop.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -286,10 +286,13 @@ static int dsa_loop_drv_probe(struct mdi
|
||||
+ dev_info(&mdiodev->dev, "%s: 0x%0x\n",
|
||||
+ pdata->name, pdata->enabled_ports);
|
||||
@@ -15494,11 +15487,10 @@ index 0000000000..5a28760ba9
|
||||
+ ps = devm_kzalloc(&mdiodev->dev, sizeof(*ps), GFP_KERNEL);
|
||||
+ if (!ps)
|
||||
+ return -ENOMEM;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/lan9303-core.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/lan9303-core.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/lan9303-core.c
|
||||
+@@ -1287,10 +1287,12 @@ static int lan9303_register_switch(struc
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/lan9303-core.c linux-5.4.137/drivers/net/dsa/lan9303-core.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/lan9303-core.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/lan9303-core.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -1283,10 +1283,12 @@ static int lan9303_register_switch(struc
|
||||
+ {
|
||||
+ int base;
|
||||
+
|
||||
@@ -15512,11 +15504,10 @@ index 0000000000..5a28760ba9
|
||||
+ chip->ds->priv = chip;
|
||||
+ chip->ds->ops = &lan9303_switch_ops;
|
||||
+ base = chip->phy_addr_base;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/lantiq_gswip.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/lantiq_gswip.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/lantiq_gswip.c
|
||||
+@@ -2013,10 +2013,12 @@ static int gswip_probe(struct platform_d
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/lantiq_gswip.c linux-5.4.137/drivers/net/dsa/lantiq_gswip.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/lantiq_gswip.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/lantiq_gswip.c 2021-08-04 14:05:53.887713713 +0700
|
||||
+@@ -2006,10 +2006,12 @@ static int gswip_probe(struct platform_d
|
||||
+ if (!priv->hw_info)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
@@ -15530,10 +15521,9 @@ index 0000000000..5a28760ba9
|
||||
+ priv->ds->priv = priv;
|
||||
+ priv->ds->ops = &gswip_switch_ops;
|
||||
+ priv->dev = dev;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/microchip/ksz_common.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/microchip/ksz_common.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/microchip/ksz_common.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/microchip/ksz_common.c linux-5.4.137/drivers/net/dsa/microchip/ksz_common.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/microchip/ksz_common.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/microchip/ksz_common.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -396,10 +396,13 @@ struct ksz_device *ksz_switch_alloc(stru
|
||||
+ struct dsa_switch *ds;
|
||||
+ struct ksz_device *swdev;
|
||||
@@ -15549,11 +15539,10 @@ index 0000000000..5a28760ba9
|
||||
+ swdev = devm_kzalloc(base, sizeof(*swdev), GFP_KERNEL);
|
||||
+ if (!swdev)
|
||||
+ return NULL;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mt7530.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mt7530.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/mt7530.c
|
||||
+@@ -786,7 +786,7 @@ mt7530_port_set_vlan_unaware(struct dsa_
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mt7530.c linux-5.4.137/drivers/net/dsa/mt7530.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mt7530.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mt7530.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -785,7 +785,7 @@ mt7530_port_set_vlan_unaware(struct dsa_
|
||||
+
|
||||
+ for (i = 0; i < MT7530_NUM_PORTS; i++) {
|
||||
+ if (dsa_is_user_port(ds, i) &&
|
||||
@@ -15562,7 +15551,16 @@ index 0000000000..5a28760ba9
|
||||
+ all_user_ports_removed = false;
|
||||
+ break;
|
||||
+ }
|
||||
+@@ -1217,7 +1217,7 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
+@@ -843,7 +843,7 @@ mt7530_port_bridge_leave(struct dsa_swit
|
||||
+ * other port is still a VLAN-aware port.
|
||||
+ */
|
||||
+ if (dsa_is_user_port(ds, i) && i != port &&
|
||||
+- !dsa_port_is_vlan_filtering(&ds->ports[i])) {
|
||||
++ !dsa_port_is_vlan_filtering(dsa_to_port(ds, i))) {
|
||||
+ if (dsa_to_port(ds, i)->bridge_dev != bridge)
|
||||
+ continue;
|
||||
+ if (priv->ports[i].enable)
|
||||
+@@ -1219,7 +1219,7 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
+ * controller also is the container for two GMACs nodes representing
|
||||
+ * as two netdev instances.
|
||||
+ */
|
||||
@@ -15571,7 +15569,7 @@ index 0000000000..5a28760ba9
|
||||
+ ds->configure_vlan_while_not_filtering = true;
|
||||
+
|
||||
+ if (priv->id == ID_MT7530) {
|
||||
+@@ -1304,7 +1304,7 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
+@@ -1306,7 +1306,7 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
+
|
||||
+ if (!dsa_is_unused_port(ds, 5)) {
|
||||
+ priv->p5_intf_sel = P5_INTF_SEL_GMAC5;
|
||||
@@ -15580,7 +15578,7 @@ index 0000000000..5a28760ba9
|
||||
+ } else {
|
||||
+ /* Scan the ethernet nodes. look for GMAC1, lookup used phy */
|
||||
+ for_each_child_of_node(dn, mac_np) {
|
||||
+@@ -1647,10 +1647,13 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
+@@ -1649,10 +1649,13 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
@@ -15595,10 +15593,9 @@ index 0000000000..5a28760ba9
|
||||
+ /* Use medatek,mcm property to distinguish hardware type that would
|
||||
+ * casues a little bit differences on power-on sequence.
|
||||
+ */
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mv88e6060.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mv88e6060.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/mv88e6060.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mv88e6060.c linux-5.4.137/drivers/net/dsa/mv88e6060.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mv88e6060.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mv88e6060.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -270,10 +270,12 @@ static int mv88e6060_probe(struct mdio_d
|
||||
+
|
||||
+ dev_info(dev, "switch %s detected\n", name);
|
||||
@@ -15613,10 +15610,9 @@ index 0000000000..5a28760ba9
|
||||
+ ds->priv = priv;
|
||||
+ ds->dev = dev;
|
||||
+ ds->ops = &mv88e6060_switch_ops;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/chip.c linux-5.4.137/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/chip.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mv88e6xxx/chip.c 2021-08-04 14:05:57.643717592 +0700
|
||||
+@@ -1075,7 +1075,7 @@ static u16 mv88e6xxx_port_vlan(struct mv
|
||||
+ if (dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))
|
||||
+ return mv88e6xxx_port_mask(chip);
|
||||
@@ -16028,10 +16024,9 @@ index 0000000000..5a28760ba9
|
||||
+ dev_set_drvdata(dev, ds);
|
||||
+
|
||||
+ return dsa_register_switch(ds);
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mv88e6xxx/global2.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mv88e6xxx/global2.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/mv88e6xxx/global2.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/global2.c linux-5.4.137/drivers/net/dsa/mv88e6xxx/global2.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/global2.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mv88e6xxx/global2.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -126,8 +126,8 @@ int mv88e6xxx_g2_device_mapping_write(st
|
||||
+
|
||||
+ /* Offset 0x07: Trunk Mask Table register */
|
||||
@@ -16054,10 +16049,9 @@ index 0000000000..5a28760ba9
|
||||
+ {
|
||||
+ const u16 port_mask = BIT(mv88e6xxx_num_ports(chip)) - 1;
|
||||
+ u16 val = (id << 11) | (map & port_mask);
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mv88e6xxx/global2.h
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mv88e6xxx/global2.h
|
||||
++++ linux-5.4.158/drivers/net/dsa/mv88e6xxx/global2.h
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/global2.h linux-5.4.137/drivers/net/dsa/mv88e6xxx/global2.h
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/global2.h 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mv88e6xxx/global2.h 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -101,6 +101,7 @@
|
||||
+ #define MV88E6XXX_G2_PVT_ADDR_OP_WRITE_PVLAN 0x3000
|
||||
+ #define MV88E6XXX_G2_PVT_ADDR_OP_READ 0x4000
|
||||
@@ -16077,10 +16071,9 @@ index 0000000000..5a28760ba9
|
||||
+ int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip);
|
||||
+
|
||||
+ int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, int target,
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mv88e6xxx/port.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mv88e6xxx/port.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/mv88e6xxx/port.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/port.c linux-5.4.137/drivers/net/dsa/mv88e6xxx/port.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/port.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mv88e6xxx/port.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -994,6 +994,27 @@ int mv88e6xxx_port_set_message_port(stru
|
||||
+ return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_CTL1, val);
|
||||
+ }
|
||||
@@ -16109,10 +16102,9 @@ index 0000000000..5a28760ba9
|
||||
+ /* Offset 0x06: Port Based VLAN Map */
|
||||
+
|
||||
+ int mv88e6xxx_port_set_vlan_map(struct mv88e6xxx_chip *chip, int port, u16 map)
|
||||
+Index: linux-5.4.158/drivers/net/dsa/mv88e6xxx/port.h
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/mv88e6xxx/port.h
|
||||
++++ linux-5.4.158/drivers/net/dsa/mv88e6xxx/port.h
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/port.h linux-5.4.137/drivers/net/dsa/mv88e6xxx/port.h
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/mv88e6xxx/port.h 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/mv88e6xxx/port.h 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -168,6 +168,9 @@
|
||||
+ /* Offset 0x05: Port Control 1 */
|
||||
+ #define MV88E6XXX_PORT_CTL1 0x05
|
||||
@@ -16132,10 +16124,9 @@ index 0000000000..5a28760ba9
|
||||
+ int mv88e6165_port_set_jumbo_size(struct mv88e6xxx_chip *chip, int port,
|
||||
+ size_t size);
|
||||
+ int mv88e6095_port_egress_rate_limiting(struct mv88e6xxx_chip *chip, int port);
|
||||
+Index: linux-5.4.158/drivers/net/dsa/qca8k.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/qca8k.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/qca8k.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/qca8k.c linux-5.4.137/drivers/net/dsa/qca8k.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/qca8k.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/qca8k.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -661,7 +661,7 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
+ return ret;
|
||||
+
|
||||
@@ -16160,10 +16151,9 @@ index 0000000000..5a28760ba9
|
||||
+ priv->ds->priv = priv;
|
||||
+ priv->ops = qca8k_switch_ops;
|
||||
+ priv->ds->ops = &priv->ops;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/realtek-smi-core.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/realtek-smi-core.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/realtek-smi-core.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/realtek-smi-core.c linux-5.4.137/drivers/net/dsa/realtek-smi-core.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/realtek-smi-core.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/realtek-smi-core.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -444,9 +444,12 @@ static int realtek_smi_probe(struct plat
|
||||
+ return ret;
|
||||
+ }
|
||||
@@ -16178,11 +16168,10 @@ index 0000000000..5a28760ba9
|
||||
+ smi->ds->priv = smi;
|
||||
+
|
||||
+ smi->ds->ops = var->ds_ops;
|
||||
+Index: linux-5.4.158/drivers/net/dsa/sja1105/sja1105_main.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/sja1105/sja1105_main.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/sja1105/sja1105_main.c
|
||||
+@@ -1121,7 +1121,7 @@ int sja1105pqrs_fdb_add(struct dsa_switc
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/sja1105/sja1105_main.c linux-5.4.137/drivers/net/dsa/sja1105/sja1105_main.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/sja1105/sja1105_main.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/sja1105/sja1105_main.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -1096,7 +1096,7 @@ int sja1105pqrs_fdb_add(struct dsa_switc
|
||||
+ l2_lookup.vlanid = vid;
|
||||
+ l2_lookup.iotag = SJA1105_S_TAG;
|
||||
+ l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0);
|
||||
@@ -16191,7 +16180,7 @@ index 0000000000..5a28760ba9
|
||||
+ l2_lookup.mask_vlanid = VLAN_VID_MASK;
|
||||
+ l2_lookup.mask_iotag = BIT(0);
|
||||
+ } else {
|
||||
+@@ -1214,7 +1214,7 @@ int sja1105pqrs_fdb_del(struct dsa_switc
|
||||
+@@ -1159,7 +1159,7 @@ int sja1105pqrs_fdb_del(struct dsa_switc
|
||||
+ l2_lookup.vlanid = vid;
|
||||
+ l2_lookup.iotag = SJA1105_S_TAG;
|
||||
+ l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0);
|
||||
@@ -16200,7 +16189,7 @@ index 0000000000..5a28760ba9
|
||||
+ l2_lookup.mask_vlanid = VLAN_VID_MASK;
|
||||
+ l2_lookup.mask_iotag = BIT(0);
|
||||
+ } else {
|
||||
+@@ -1260,7 +1260,7 @@ static int sja1105_fdb_add(struct dsa_sw
|
||||
+@@ -1205,7 +1205,7 @@ static int sja1105_fdb_add(struct dsa_sw
|
||||
+ * for what gets printed in 'bridge fdb show'. In the case of zero,
|
||||
+ * no VID gets printed at all.
|
||||
+ */
|
||||
@@ -16209,7 +16198,7 @@ index 0000000000..5a28760ba9
|
||||
+ vid = 0;
|
||||
+
|
||||
+ return priv->info->fdb_add_cmd(ds, port, addr, vid);
|
||||
+@@ -1271,7 +1271,7 @@ static int sja1105_fdb_del(struct dsa_sw
|
||||
+@@ -1216,7 +1216,7 @@ static int sja1105_fdb_del(struct dsa_sw
|
||||
+ {
|
||||
+ struct sja1105_private *priv = ds->priv;
|
||||
+
|
||||
@@ -16218,16 +16207,16 @@ index 0000000000..5a28760ba9
|
||||
+ vid = 0;
|
||||
+
|
||||
+ return priv->info->fdb_del_cmd(ds, port, addr, vid);
|
||||
+@@ -1310,7 +1310,7 @@ static int sja1105_fdb_dump(struct dsa_s
|
||||
+@@ -1255,7 +1255,7 @@ static int sja1105_fdb_dump(struct dsa_s
|
||||
+ u64_to_ether_addr(l2_lookup.macaddr, macaddr);
|
||||
+
|
||||
+ /* We need to hide the dsa_8021q VLANs from the user. */
|
||||
+- if (!dsa_port_is_vlan_filtering(&ds->ports[port]))
|
||||
++ if (!dsa_port_is_vlan_filtering(dsa_to_port(ds, port)))
|
||||
+ l2_lookup.vlanid = 0;
|
||||
+ rc = cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data);
|
||||
+ if (rc)
|
||||
+@@ -1805,7 +1805,7 @@ static int sja1105_port_enable(struct ds
|
||||
+ cb(macaddr, l2_lookup.vlanid, l2_lookup.lockeds, data);
|
||||
+ }
|
||||
+@@ -1748,7 +1748,7 @@ static int sja1105_port_enable(struct ds
|
||||
+ if (!dsa_is_user_port(ds, port))
|
||||
+ return 0;
|
||||
+
|
||||
@@ -16236,7 +16225,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ slave->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
+
|
||||
+@@ -1837,7 +1837,7 @@ static int sja1105_mgmt_xmit(struct dsa_
|
||||
+@@ -1780,7 +1780,7 @@ static int sja1105_mgmt_xmit(struct dsa_
|
||||
+ }
|
||||
+
|
||||
+ /* Transfer skb to the host port. */
|
||||
@@ -16245,7 +16234,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ /* Wait until the switch has processed the frame */
|
||||
+ do {
|
||||
+@@ -2255,10 +2255,12 @@ static int sja1105_probe(struct spi_devi
|
||||
+@@ -2198,10 +2198,12 @@ static int sja1105_probe(struct spi_devi
|
||||
+
|
||||
+ dev_info(dev, "Probed switch chip: %s\n", priv->info->name);
|
||||
+
|
||||
@@ -16259,7 +16248,7 @@ index 0000000000..5a28760ba9
|
||||
+ ds->ops = &sja1105_switch_ops;
|
||||
+ ds->priv = priv;
|
||||
+ priv->ds = ds;
|
||||
+@@ -2272,8 +2274,8 @@ static int sja1105_probe(struct spi_devi
|
||||
+@@ -2215,8 +2217,8 @@ static int sja1105_probe(struct spi_devi
|
||||
+ for (i = 0; i < SJA1105_NUM_PORTS; i++) {
|
||||
+ struct sja1105_port *sp = &priv->ports[i];
|
||||
+
|
||||
@@ -16270,10 +16259,9 @@ index 0000000000..5a28760ba9
|
||||
+ sp->data = tagger_data;
|
||||
+ }
|
||||
+ mutex_init(&priv->mgmt_lock);
|
||||
+Index: linux-5.4.158/drivers/net/dsa/vitesse-vsc73xx-core.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/drivers/net/dsa/vitesse-vsc73xx-core.c
|
||||
++++ linux-5.4.158/drivers/net/dsa/vitesse-vsc73xx-core.c
|
||||
+diff -urpN linux-5.4.137.old/drivers/net/dsa/vitesse-vsc73xx-core.c linux-5.4.137/drivers/net/dsa/vitesse-vsc73xx-core.c
|
||||
+--- linux-5.4.137.old/drivers/net/dsa/vitesse-vsc73xx-core.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/drivers/net/dsa/vitesse-vsc73xx-core.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -1178,9 +1178,12 @@ int vsc73xx_probe(struct vsc73xx *vsc)
|
||||
+ * We allocate 8 ports and avoid access to the nonexistant
|
||||
+ * ports.
|
||||
@@ -16288,10 +16276,9 @@ index 0000000000..5a28760ba9
|
||||
+ vsc->ds->priv = vsc;
|
||||
+
|
||||
+ vsc->ds->ops = &vsc73xx_ds_ops;
|
||||
+Index: linux-5.4.158/include/net/dsa.h
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/include/net/dsa.h
|
||||
++++ linux-5.4.158/include/net/dsa.h
|
||||
+diff -urpN linux-5.4.137.old/include/net/dsa.h linux-5.4.137/include/net/dsa.h
|
||||
+--- linux-5.4.137.old/include/net/dsa.h 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/include/net/dsa.h 2021-08-04 14:05:57.643717592 +0700
|
||||
+@@ -124,17 +124,46 @@ struct dsa_switch_tree {
|
||||
+ */
|
||||
+ struct dsa_platform_data *pd;
|
||||
@@ -16520,10 +16507,9 @@ index 0000000000..5a28760ba9
|
||||
+ #endif
|
||||
+
|
||||
+ /* Broadcom tag specific helpers to insert and extract queue/port number */
|
||||
+Index: linux-5.4.158/net/dsa/Kconfig
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/Kconfig
|
||||
++++ linux-5.4.158/net/dsa/Kconfig
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/Kconfig linux-5.4.137/net/dsa/Kconfig
|
||||
+--- linux-5.4.137.old/net/dsa/Kconfig 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/Kconfig 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -56,14 +56,19 @@ config NET_DSA_TAG_GSWIP
|
||||
+ Say Y or M if you want to enable support for tagging frames for the
|
||||
+ Lantiq / Intel GSWIP switches.
|
||||
@@ -16544,10 +16530,9 @@ index 0000000000..5a28760ba9
|
||||
+ help
|
||||
+ Say Y or M if you want to enable support for tagging frames for the
|
||||
+ Marvell switches which use EtherType DSA headers.
|
||||
+Index: linux-5.4.158/net/dsa/Makefile
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/Makefile
|
||||
++++ linux-5.4.158/net/dsa/Makefile
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/Makefile linux-5.4.137/net/dsa/Makefile
|
||||
+--- linux-5.4.137.old/net/dsa/Makefile 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/Makefile 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -6,8 +6,7 @@ dsa_core-y += dsa.o dsa2.o master.o port
|
||||
+ # tagging formats
|
||||
+ obj-$(CONFIG_NET_DSA_TAG_8021Q) += tag_8021q.o
|
||||
@@ -16558,10 +16543,9 @@ index 0000000000..5a28760ba9
|
||||
+ obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o
|
||||
+ obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
|
||||
+ obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o
|
||||
+Index: linux-5.4.158/net/dsa/dsa.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/dsa.c
|
||||
++++ linux-5.4.158/net/dsa/dsa.c
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/dsa.c linux-5.4.137/net/dsa/dsa.c
|
||||
+--- linux-5.4.137.old/net/dsa/dsa.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/dsa.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -224,11 +224,21 @@ static int dsa_switch_rcv(struct sk_buff
|
||||
+ }
|
||||
+
|
||||
@@ -16614,11 +16598,10 @@ index 0000000000..5a28760ba9
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+Index: linux-5.4.158/net/dsa/dsa2.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/dsa2.c
|
||||
++++ linux-5.4.158/net/dsa/dsa2.c
|
||||
+@@ -24,6 +24,65 @@ static DEFINE_MUTEX(dsa2_mutex);
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/dsa2.c linux-5.4.137/net/dsa/dsa2.c
|
||||
+--- linux-5.4.137.old/net/dsa/dsa2.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/dsa2.c 2021-08-04 14:05:57.643717592 +0700
|
||||
+@@ -25,6 +25,65 @@ static DEFINE_MUTEX(dsa2_mutex);
|
||||
+ static const struct devlink_ops dsa_devlink_ops = {
|
||||
+ };
|
||||
+
|
||||
@@ -16684,7 +16667,7 @@ index 0000000000..5a28760ba9
|
||||
+ static struct dsa_switch_tree *dsa_tree_find(int index)
|
||||
+ {
|
||||
+ struct dsa_switch_tree *dst;
|
||||
+@@ -45,6 +104,10 @@ static struct dsa_switch_tree *dsa_tree_
|
||||
+@@ -46,6 +105,10 @@ static struct dsa_switch_tree *dsa_tree_
|
||||
+
|
||||
+ dst->index = index;
|
||||
+
|
||||
@@ -16695,7 +16678,7 @@ index 0000000000..5a28760ba9
|
||||
+ INIT_LIST_HEAD(&dst->list);
|
||||
+ list_add_tail(&dst->list, &dsa_tree_list);
|
||||
+
|
||||
+@@ -111,24 +174,38 @@ static bool dsa_port_is_user(struct dsa_
|
||||
+@@ -112,24 +175,38 @@ static bool dsa_port_is_user(struct dsa_
|
||||
+ static struct dsa_port *dsa_tree_find_port_by_node(struct dsa_switch_tree *dst,
|
||||
+ struct device_node *dn)
|
||||
+ {
|
||||
@@ -16747,7 +16730,7 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ static bool dsa_port_setup_routing_table(struct dsa_port *dp)
|
||||
+@@ -138,6 +215,7 @@ static bool dsa_port_setup_routing_table
|
||||
+@@ -139,6 +216,7 @@ static bool dsa_port_setup_routing_table
|
||||
+ struct device_node *dn = dp->dn;
|
||||
+ struct of_phandle_iterator it;
|
||||
+ struct dsa_port *link_dp;
|
||||
@@ -16755,7 +16738,7 @@ index 0000000000..5a28760ba9
|
||||
+ int err;
|
||||
+
|
||||
+ of_for_each_phandle(&it, err, dn, "link", NULL, 0) {
|
||||
+@@ -147,24 +225,22 @@ static bool dsa_port_setup_routing_table
|
||||
+@@ -148,24 +226,22 @@ static bool dsa_port_setup_routing_table
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
@@ -16787,7 +16770,7 @@ index 0000000000..5a28760ba9
|
||||
+ if (dsa_port_is_dsa(dp)) {
|
||||
+ complete = dsa_port_setup_routing_table(dp);
|
||||
+ if (!complete)
|
||||
+@@ -175,81 +251,42 @@ static bool dsa_switch_setup_routing_tab
|
||||
+@@ -176,81 +252,42 @@ static bool dsa_switch_setup_routing_tab
|
||||
+ return complete;
|
||||
+ }
|
||||
+
|
||||
@@ -16884,7 +16867,7 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ static int dsa_port_setup(struct dsa_port *dp)
|
||||
+@@ -265,6 +302,9 @@ static int dsa_port_setup(struct dsa_por
|
||||
+@@ -266,6 +303,9 @@ static int dsa_port_setup(struct dsa_por
|
||||
+ bool dsa_port_enabled = false;
|
||||
+ int err = 0;
|
||||
+
|
||||
@@ -16894,7 +16877,7 @@ index 0000000000..5a28760ba9
|
||||
+ switch (dp->type) {
|
||||
+ case DSA_PORT_TYPE_UNUSED:
|
||||
+ dsa_port_disable(dp);
|
||||
+@@ -333,14 +373,21 @@ static int dsa_port_setup(struct dsa_por
|
||||
+@@ -335,14 +375,21 @@ static int dsa_port_setup(struct dsa_por
|
||||
+ dsa_port_link_unregister_of(dp);
|
||||
+ if (err && devlink_port_registered)
|
||||
+ devlink_port_unregister(dlp);
|
||||
@@ -16917,7 +16900,7 @@ index 0000000000..5a28760ba9
|
||||
+ switch (dp->type) {
|
||||
+ case DSA_PORT_TYPE_UNUSED:
|
||||
+ break;
|
||||
+@@ -363,11 +410,16 @@ static void dsa_port_teardown(struct dsa
|
||||
+@@ -365,11 +412,16 @@ static void dsa_port_teardown(struct dsa
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
@@ -16935,7 +16918,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ /* Initialize ds->phys_mii_mask before registering the slave MDIO bus
|
||||
+ * driver and before ops->setup() has run, since the switch drivers and
|
||||
+@@ -409,6 +461,8 @@ static int dsa_switch_setup(struct dsa_s
|
||||
+@@ -411,6 +463,8 @@ static int dsa_switch_setup(struct dsa_s
|
||||
+ goto teardown;
|
||||
+ }
|
||||
+
|
||||
@@ -16944,7 +16927,7 @@ index 0000000000..5a28760ba9
|
||||
+ return 0;
|
||||
+
|
||||
+ teardown:
|
||||
+@@ -427,6 +481,9 @@ free_devlink:
|
||||
+@@ -429,6 +483,9 @@ free_devlink:
|
||||
+
|
||||
+ static void dsa_switch_teardown(struct dsa_switch *ds)
|
||||
+ {
|
||||
@@ -16954,7 +16937,7 @@ index 0000000000..5a28760ba9
|
||||
+ if (ds->slave_mii_bus && ds->ops->phy_read)
|
||||
+ mdiobus_unregister(ds->slave_mii_bus);
|
||||
+
|
||||
+@@ -441,89 +498,98 @@ static void dsa_switch_teardown(struct d
|
||||
+@@ -443,89 +500,98 @@ static void dsa_switch_teardown(struct d
|
||||
+ ds->devlink = NULL;
|
||||
+ }
|
||||
+
|
||||
@@ -17105,7 +17088,7 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ static int dsa_tree_setup(struct dsa_switch_tree *dst)
|
||||
+@@ -553,12 +619,18 @@ static int dsa_tree_setup(struct dsa_swi
|
||||
+@@ -555,12 +621,18 @@ static int dsa_tree_setup(struct dsa_swi
|
||||
+ if (err)
|
||||
+ goto teardown_switches;
|
||||
+
|
||||
@@ -17124,7 +17107,7 @@ index 0000000000..5a28760ba9
|
||||
+ teardown_switches:
|
||||
+ dsa_tree_teardown_switches(dst);
|
||||
+ teardown_default_cpu:
|
||||
+@@ -569,48 +641,49 @@ teardown_default_cpu:
|
||||
+@@ -571,48 +643,49 @@ teardown_default_cpu:
|
||||
+
|
||||
+ static void dsa_tree_teardown(struct dsa_switch_tree *dst)
|
||||
+ {
|
||||
@@ -17196,7 +17179,7 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ static int dsa_port_parse_user(struct dsa_port *dp, const char *name)
|
||||
+@@ -705,7 +778,7 @@ static int dsa_switch_parse_ports_of(str
|
||||
+@@ -707,7 +780,7 @@ static int dsa_switch_parse_ports_of(str
|
||||
+ goto out_put_node;
|
||||
+ }
|
||||
+
|
||||
@@ -17205,7 +17188,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ err = dsa_port_parse_of(dp, port);
|
||||
+ if (err)
|
||||
+@@ -729,8 +802,6 @@ static int dsa_switch_parse_member_of(st
|
||||
+@@ -731,8 +804,6 @@ static int dsa_switch_parse_member_of(st
|
||||
+ return sz;
|
||||
+
|
||||
+ ds->index = m[1];
|
||||
@@ -17214,7 +17197,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ ds->dst = dsa_tree_touch(m[0]);
|
||||
+ if (!ds->dst)
|
||||
+@@ -739,6 +810,20 @@ static int dsa_switch_parse_member_of(st
|
||||
+@@ -741,6 +812,20 @@ static int dsa_switch_parse_member_of(st
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
@@ -17235,7 +17218,7 @@ index 0000000000..5a28760ba9
|
||||
+ static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn)
|
||||
+ {
|
||||
+ int err;
|
||||
+@@ -747,6 +832,10 @@ static int dsa_switch_parse_of(struct ds
|
||||
+@@ -749,6 +834,10 @@ static int dsa_switch_parse_of(struct ds
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
@@ -17246,7 +17229,7 @@ index 0000000000..5a28760ba9
|
||||
+ return dsa_switch_parse_ports_of(ds, dn);
|
||||
+ }
|
||||
+
|
||||
+@@ -784,7 +873,7 @@ static int dsa_switch_parse_ports(struct
|
||||
+@@ -786,7 +875,7 @@ static int dsa_switch_parse_ports(struct
|
||||
+ for (i = 0; i < DSA_MAX_PORTS; i++) {
|
||||
+ name = cd->port_names[i];
|
||||
+ dev = cd->netdev[i];
|
||||
@@ -17255,7 +17238,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ if (!name)
|
||||
+ continue;
|
||||
+@@ -804,6 +893,8 @@ static int dsa_switch_parse_ports(struct
|
||||
+@@ -806,6 +895,8 @@ static int dsa_switch_parse_ports(struct
|
||||
+
|
||||
+ static int dsa_switch_parse(struct dsa_switch *ds, struct dsa_chip_data *cd)
|
||||
+ {
|
||||
@@ -17264,7 +17247,7 @@ index 0000000000..5a28760ba9
|
||||
+ ds->cd = cd;
|
||||
+
|
||||
+ /* We don't support interconnected switches nor multiple trees via
|
||||
+@@ -814,22 +905,26 @@ static int dsa_switch_parse(struct dsa_s
|
||||
+@@ -816,22 +907,26 @@ static int dsa_switch_parse(struct dsa_s
|
||||
+ if (!ds->dst)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
@@ -17298,7 +17281,7 @@ index 0000000000..5a28760ba9
|
||||
+ if (np)
|
||||
+ err = dsa_switch_parse_of(ds, np);
|
||||
+ else if (pdata)
|
||||
+@@ -840,29 +935,14 @@ static int dsa_switch_probe(struct dsa_s
|
||||
+@@ -842,29 +937,14 @@ static int dsa_switch_probe(struct dsa_s
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
@@ -17334,7 +17317,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ int dsa_register_switch(struct dsa_switch *ds)
|
||||
+ {
|
||||
+@@ -880,9 +960,15 @@ EXPORT_SYMBOL_GPL(dsa_register_switch);
|
||||
+@@ -882,9 +962,15 @@ EXPORT_SYMBOL_GPL(dsa_register_switch);
|
||||
+ static void dsa_switch_remove(struct dsa_switch *ds)
|
||||
+ {
|
||||
+ struct dsa_switch_tree *dst = ds->dst;
|
||||
@@ -17352,10 +17335,9 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ void dsa_unregister_switch(struct dsa_switch *ds)
|
||||
+Index: linux-5.4.158/net/dsa/dsa_priv.h
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/dsa_priv.h
|
||||
++++ linux-5.4.158/net/dsa/dsa_priv.h
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/dsa_priv.h linux-5.4.137/net/dsa/dsa_priv.h
|
||||
+--- linux-5.4.137.old/net/dsa/dsa_priv.h 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/dsa_priv.h 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -19,6 +19,9 @@ enum {
|
||||
+ DSA_NOTIFIER_BRIDGE_LEAVE,
|
||||
+ DSA_NOTIFIER_FDB_ADD,
|
||||
@@ -17459,10 +17441,9 @@ index 0000000000..5a28760ba9
|
||||
++void dsa_lag_unmap(struct dsa_switch_tree *dst, struct net_device *lag);
|
||||
++
|
||||
+ #endif
|
||||
+Index: linux-5.4.158/net/dsa/port.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/port.c
|
||||
++++ linux-5.4.158/net/dsa/port.c
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/port.c linux-5.4.137/net/dsa/port.c
|
||||
+--- linux-5.4.137.old/net/dsa/port.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/port.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -174,6 +174,85 @@ void dsa_port_bridge_leave(struct dsa_po
|
||||
+ dsa_port_set_state_now(dp, BR_STATE_FORWARDING);
|
||||
+ }
|
||||
@@ -17549,10 +17530,9 @@ index 0000000000..5a28760ba9
|
||||
+ static bool dsa_port_can_apply_vlan_filtering(struct dsa_port *dp,
|
||||
+ bool vlan_filtering)
|
||||
+ {
|
||||
+Index: linux-5.4.158/net/dsa/slave.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/slave.c
|
||||
++++ linux-5.4.158/net/dsa/slave.c
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/slave.c linux-5.4.137/net/dsa/slave.c
|
||||
+--- linux-5.4.137.old/net/dsa/slave.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/slave.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -26,8 +26,6 @@
|
||||
+
|
||||
+ #include "dsa_priv.h"
|
||||
@@ -17608,7 +17588,7 @@ index 0000000000..5a28760ba9
|
||||
+ return -EOPNOTSUPP;
|
||||
+ err = dsa_port_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
|
||||
+ break;
|
||||
+@@ -1525,10 +1526,11 @@ void dsa_slave_destroy(struct net_device
|
||||
+@@ -1527,10 +1528,11 @@ void dsa_slave_destroy(struct net_device
|
||||
+ free_netdev(slave_dev);
|
||||
+ }
|
||||
+
|
||||
@@ -17621,7 +17601,7 @@ index 0000000000..5a28760ba9
|
||||
+
|
||||
+ static int dsa_slave_changeupper(struct net_device *dev,
|
||||
+ struct netdev_notifier_changeupper_info *info)
|
||||
+@@ -1544,6 +1546,46 @@ static int dsa_slave_changeupper(struct
|
||||
+@@ -1546,6 +1548,46 @@ static int dsa_slave_changeupper(struct
|
||||
+ dsa_port_bridge_leave(dp, info->upper_dev);
|
||||
+ err = NOTIFY_OK;
|
||||
+ }
|
||||
@@ -17668,7 +17648,7 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ return err;
|
||||
+@@ -1586,11 +1628,33 @@ static int dsa_slave_netdevice_event(str
|
||||
+@@ -1588,11 +1630,33 @@ static int dsa_slave_netdevice_event(str
|
||||
+ {
|
||||
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
|
||||
+
|
||||
@@ -17704,10 +17684,9 @@ index 0000000000..5a28760ba9
|
||||
+ }
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+Index: linux-5.4.158/net/dsa/switch.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/switch.c
|
||||
++++ linux-5.4.158/net/dsa/switch.c
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/switch.c linux-5.4.137/net/dsa/switch.c
|
||||
+--- linux-5.4.137.old/net/dsa/switch.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/switch.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -20,7 +20,7 @@ static unsigned int dsa_switch_fastest_a
|
||||
+ int i;
|
||||
+
|
||||
@@ -17790,10 +17769,9 @@ index 0000000000..5a28760ba9
|
||||
+ case DSA_NOTIFIER_MDB_ADD:
|
||||
+ err = dsa_switch_mdb_add(ds, info);
|
||||
+ break;
|
||||
+Index: linux-5.4.158/net/dsa/tag_8021q.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/tag_8021q.c
|
||||
++++ linux-5.4.158/net/dsa/tag_8021q.c
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/tag_8021q.c linux-5.4.137/net/dsa/tag_8021q.c
|
||||
+--- linux-5.4.137.old/net/dsa/tag_8021q.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/tag_8021q.c 2021-08-04 14:05:57.643717592 +0700
|
||||
+@@ -31,15 +31,14 @@
|
||||
+ * Must be transmitted as zero and ignored on receive.
|
||||
+ *
|
||||
@@ -17839,10 +17817,9 @@ index 0000000000..5a28760ba9
|
||||
+ struct bridge_vlan_info vinfo;
|
||||
+ int err;
|
||||
+
|
||||
+Index: linux-5.4.158/net/dsa/tag_dsa.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/tag_dsa.c
|
||||
++++ linux-5.4.158/net/dsa/tag_dsa.c
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/tag_dsa.c linux-5.4.137/net/dsa/tag_dsa.c
|
||||
+--- linux-5.4.137.old/net/dsa/tag_dsa.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/tag_dsa.c 2021-08-04 14:05:53.891713717 +0700
|
||||
+@@ -1,7 +1,48 @@
|
||||
+ // SPDX-License-Identifier: GPL-2.0+
|
||||
+ /*
|
||||
@@ -18276,10 +18253,9 @@ index 0000000000..5a28760ba9
|
||||
++module_dsa_tag_drivers(dsa_tag_drivers);
|
||||
++
|
||||
++MODULE_LICENSE("GPL");
|
||||
+Index: linux-5.4.158/net/dsa/tag_edsa.c
|
||||
+===================================================================
|
||||
+--- linux-5.4.158.orig/net/dsa/tag_edsa.c
|
||||
++++ /dev/null
|
||||
+diff -urpN linux-5.4.137.old/net/dsa/tag_edsa.c linux-5.4.137/net/dsa/tag_edsa.c
|
||||
+--- linux-5.4.137.old/net/dsa/tag_edsa.c 2021-08-04 14:05:38.059697353 +0700
|
||||
++++ linux-5.4.137/net/dsa/tag_edsa.c 1970-01-01 07:00:00.000000000 +0700
|
||||
+@@ -1,215 +0,0 @@
|
||||
+-// SPDX-License-Identifier: GPL-2.0+
|
||||
+-/*
|
||||
@@ -19730,18 +19706,6 @@ index 0000000000..8b43f07e8a
|
||||
++MODULE_DESCRIPTION("Realtek Otto GPIO support");
|
||||
++MODULE_AUTHOR("Sander Vanheule <sander@svanheule.net>");
|
||||
++MODULE_LICENSE("GPL v2");
|
||||
diff --git a/target/linux/realtek/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/realtek/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
|
||||
index 952384ac89..11e62450d5 100644
|
||||
--- a/target/linux/realtek/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
|
||||
+++ b/target/linux/realtek/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/ethernet/Kconfig
|
||||
+++ b/drivers/net/ethernet/Kconfig
|
||||
-@@ -164,6 +164,13 @@ source "drivers/net/ethernet/rdc/Kconfig
|
||||
+@@ -163,6 +163,13 @@ source "drivers/net/ethernet/rdc/Kconfig
|
||||
source "drivers/net/ethernet/realtek/Kconfig"
|
||||
source "drivers/net/ethernet/renesas/Kconfig"
|
||||
source "drivers/net/ethernet/rocker/Kconfig"
|
||||
diff --git a/target/linux/realtek/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch
|
||||
index 03accd1e07..3682eb30a3 100644
|
||||
--- a/target/linux/realtek/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch
|
||||
@@ -1,7 +1,7 @@
|
||||
From d28712edcc0e57b5c0e5d79125a5517ced252e18 Mon Sep 17 00:00:00 2001
|
||||
From 4ed9b7d04405d5109681643f3ceebbd25f3f28e2 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Wed, 7 Apr 2021 10:46:26 +0200
|
||||
Subject: [PATCH] include: set kernel-version.mk
|
||||
Subject: [PATCH 09/27] include: set kernel-version.mk
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/include/kernel-version.mk b/include/kernel-version.mk
|
||||
index 688660cbbd..c7aba61cd7 100644
|
||||
index fe81dbf603..3c109c13c8 100644
|
||||
--- a/include/kernel-version.mk
|
||||
+++ b/include/kernel-version.mk
|
||||
@@ -6,9 +6,15 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
@@ -18,12 +18,12 @@ index 688660cbbd..c7aba61cd7 100644
|
||||
|
||||
+LINUX_VERSION-4.4 = .60
|
||||
+LINUX_VERSION-4.14 = .193
|
||||
LINUX_VERSION-5.4 = .158
|
||||
LINUX_VERSION-5.4 = .142
|
||||
+LINUX_VERSION-5.10 = .27
|
||||
|
||||
+LINUX_KERNEL_HASH-4.4.60 = 2cd8df6f1ac6a5329c5a286ec9b5956215977221a1b731597ed169fff74a9659
|
||||
+LINUX_KERNEL_HASH-4.14.193 = 0b0fb41d4430e1a42738b341cbfd2f41951aa5cd02acabbd53f076119c8b9f03
|
||||
LINUX_KERNEL_HASH-5.4.158 = 6e018fecdc8fc24553756e582d83b82d65b10a6b03ef36262a24911f839b8d59
|
||||
LINUX_KERNEL_HASH-5.4.142 = 99785728968564ba27c7e552d024b560072dcbc885540912eabb5c021e231451
|
||||
+LINUX_KERNEL_HASH-5.10.27 = d99dc9662951299c53a0a8d8c8d0a72a16ff861d20e927c0f9b14f63282d69d9
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
137757
backports/0010-ar71xx-forward-port-target-to-get-routerboard-suppor.patch
Normal file
137757
backports/0010-ar71xx-forward-port-target-to-get-routerboard-suppor.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
From 4b7a8429c654dc7a3fc96c0042592793a09f667a Mon Sep 17 00:00:00 2001
|
||||
From 2af08d2e85ee946de5f53bbd0ddf239de9b78f6d Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Tue, 18 May 2021 10:46:43 +0200
|
||||
Subject: [PATCH 2/4] libubox: update to latest HEAD
|
||||
Subject: [PATCH 12/27] libubox: update to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
|
||||
index d2c07783e1..c112b49d0f 100644
|
||||
index d2c07783e1..33aa73eef7 100644
|
||||
--- a/package/libs/libubox/Makefile
|
||||
+++ b/package/libs/libubox/Makefile
|
||||
@@ -5,9 +5,9 @@ PKG_RELEASE=2
|
||||
@@ -19,9 +19,9 @@ index d2c07783e1..c112b49d0f 100644
|
||||
-PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca
|
||||
-PKG_SOURCE_DATE:=2021-05-16
|
||||
-PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e
|
||||
+PKG_MIRROR_HASH:=cf48d00ed0ea74d53f2043eb9f9dc52834c0b214f258201cf22dfff7dd6c6e40
|
||||
+PKG_SOURCE_DATE:=2022-05-15
|
||||
+PKG_SOURCE_VERSION:=d2223ef9da7172a84d1508733dc58840e1381e3c
|
||||
+PKG_MIRROR_HASH:=1cdb91ac0ee925f133ee9f70eac131a99def312fe7cf0aed44df84eb1762e30b
|
||||
+PKG_SOURCE_DATE:=2021-08-19
|
||||
+PKG_SOURCE_VERSION:=d716ac4bc4236031d4c3cc1ed362b502e20e3787
|
||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
62
backports/0017-netifd-update-to-latest-HEAD.patch
Normal file
62
backports/0017-netifd-update-to-latest-HEAD.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From 3bc625814c04a24cdf16587c2adb2060a77a5e1a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 27 May 2021 13:24:47 +0200
|
||||
Subject: [PATCH 17/27] netifd: update to latest HEAD
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/network/config/netifd/Makefile | 8 +++-----
|
||||
.../netifd/patches/002-fix-dhcp-issue.patch | 17 +++++++++++++++++
|
||||
2 files changed, 20 insertions(+), 5 deletions(-)
|
||||
create mode 100644 package/network/config/netifd/patches/002-fix-dhcp-issue.patch
|
||||
|
||||
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
|
||||
index 4b5f110da2..13c1d96ed7 100644
|
||||
--- a/package/network/config/netifd/Makefile
|
||||
+++ b/package/network/config/netifd/Makefile
|
||||
@@ -5,16 +5,14 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
|
||||
-PKG_SOURCE_DATE:=2021-07-26
|
||||
-PKG_SOURCE_VERSION:=440eb0647708274cc8d7d9e7c2bb0cfdfba90023
|
||||
-PKG_MIRROR_HASH:=eed957036ab608fdc49bdf801fc5b4405fcd2a3a5e5d3343ec39898e156c10e9
|
||||
+PKG_SOURCE_DATE:=2021-09-01
|
||||
+PKG_SOURCE_VERSION:=300b1220fab38600f102bb8cfcc59a29ce41b095
|
||||
+PKG_MIRROR_HASH:=310fa90059795b1c956f9822db712ecc58bc19725b0f05f98c9e0a6824c8ca36
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
-PKG_BUILD_PARALLEL:=1
|
||||
-
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
diff --git a/package/network/config/netifd/patches/002-fix-dhcp-issue.patch b/package/network/config/netifd/patches/002-fix-dhcp-issue.patch
|
||||
new file mode 100644
|
||||
index 0000000000..6f1d2e708e
|
||||
--- /dev/null
|
||||
+++ b/package/network/config/netifd/patches/002-fix-dhcp-issue.patch
|
||||
@@ -0,0 +1,17 @@
|
||||
+Index: netifd-2019-08-05-5e02f944/interface.c
|
||||
+===================================================================
|
||||
+--- netifd-2019-08-05-5e02f944.orig/interface.c
|
||||
++++ netifd-2019-08-05-5e02f944/interface.c
|
||||
+@@ -424,7 +424,11 @@ interface_main_dev_cb(struct device_user
|
||||
+ interface_set_link_state(iface, false);
|
||||
+ break;
|
||||
+ case DEV_EVENT_TOPO_CHANGE:
|
||||
+- interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
|
||||
++ /* This renews the dhcp lease when the bridge adds/deletes a
|
||||
++ * new interface. It causes some dhcp servers to fail in
|
||||
++ * case where there are many interfaces being added to the
|
||||
++ * bridge frequently. Disabling this for now. */
|
||||
++ /* interface_proto_event(iface->proto, PROTO_CMD_RENEW, false); */
|
||||
+ return;
|
||||
+ default:
|
||||
+ break;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
4323
backports/0018-mac80211-update-to-latest-HEAD.patch
Normal file
4323
backports/0018-mac80211-update-to-latest-HEAD.patch
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,17 @@
|
||||
From 006abf1773051ad355b52d70095f63f44a496b13 Mon Sep 17 00:00:00 2001
|
||||
From aab305d662fa77ef4495574c096cb1e065c1908a Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Sun, 25 Jul 2021 13:32:37 +0200
|
||||
Subject: [PATCH 02/70] procd: add uxc support
|
||||
Subject: [PATCH 20/27] procd: add uxc support
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/system/procd/Makefile | 15 +++---
|
||||
package/system/procd/Makefile | 12 ++---
|
||||
package/system/procd/files/procd.sh | 79 +++++++++++++++++++++++++++++
|
||||
package/system/procd/files/uxc.init | 4 ++
|
||||
3 files changed, 90 insertions(+), 8 deletions(-)
|
||||
3 files changed, 89 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
|
||||
index 30d5adf427..b831f86639 100644
|
||||
index 30d5adf427..98f1ed1775 100644
|
||||
--- a/package/system/procd/Makefile
|
||||
+++ b/package/system/procd/Makefile
|
||||
@@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
@@ -21,9 +21,9 @@ index 30d5adf427..b831f86639 100644
|
||||
-PKG_SOURCE_DATE:=2021-02-23
|
||||
-PKG_SOURCE_VERSION:=37eed131e9967a35f47bacb3437a9d3c8a57b3f4
|
||||
-PKG_MIRROR_HASH:=2b0131ff9055ccf987cbeb5f36c2c2585dc780999df6be312fbbbcd61ce676d4
|
||||
+PKG_MIRROR_HASH:=0d51642d82d7bb4150355a6986e54504dce171c6fcb7eeff312d20a5d106bad8
|
||||
+PKG_SOURCE_DATE:=2021-11-04
|
||||
+PKG_SOURCE_VERSION:=0ee8e734a7f67220cf4a3412b60ff674b5fb20dd
|
||||
+PKG_SOURCE_DATE:=2021-08-15
|
||||
+PKG_SOURCE_VERSION:=104b49d6ab25a8cf067e6d8d1f2da7defb9876d4
|
||||
+PKG_MIRROR_HASH:=d13b566a14e84f6babe8b7d3dfb88e34c3dff0e97d7770d6fe71174685bca628
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
@@ -36,30 +36,21 @@ index 30d5adf427..b831f86639 100644
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
|
||||
@@ -68,7 +68,7 @@ define Package/procd-ujail
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS \
|
||||
- +libubox +libubus +libblobmsg-json
|
||||
+ +libubox +libubus +libuci +libblobmsg-json
|
||||
TITLE:=OpenWrt process jail helper
|
||||
endef
|
||||
|
||||
@@ -82,15 +82,14 @@ endef
|
||||
@@ -82,7 +82,7 @@ endef
|
||||
define Package/procd-seccomp
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
- DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
|
||||
- @KERNEL_SECCOMP +libubox +libblobmsg-json
|
||||
+ DEPENDS:=@SECCOMP +libubox +libblobmsg-json
|
||||
+ DEPENDS:=@(aarch64||arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
|
||||
@KERNEL_SECCOMP +libubox +libblobmsg-json
|
||||
TITLE:=OpenWrt process seccomp helper + utrace
|
||||
endef
|
||||
|
||||
@@ -90,7 +90,7 @@ endef
|
||||
define Package/uxc
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
- DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json
|
||||
+ DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +PACKAGE_uxc:rpcd
|
||||
+ DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +rpcd
|
||||
TITLE:=OpenWrt container management
|
||||
MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
endef
|
||||
@@ -1,19 +1,19 @@
|
||||
From 813b09542fd13428d432e47eecd7191d1b3067fd Mon Sep 17 00:00:00 2001
|
||||
From 08809a60a8f2c065a38c24fcdbd69b939e5c29d9 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 13 Aug 2021 08:46:57 +0200
|
||||
Subject: [PATCH 01/83] uvol: backport package
|
||||
Subject: [PATCH 24/27] uvol: backport package
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
package/system/uvol/Makefile | 77 ++++
|
||||
package/system/uvol/files/autopart.defaults | 127 ++++++
|
||||
package/system/uvol/files/common.sh | 83 ++++
|
||||
package/system/uvol/files/lvm.sh | 459 ++++++++++++++++++++
|
||||
package/system/uvol/files/ubi.sh | 358 +++++++++++++++
|
||||
package/system/uvol/files/lvm.sh | 435 ++++++++++++++++++++
|
||||
package/system/uvol/files/ubi.sh | 337 +++++++++++++++
|
||||
package/system/uvol/files/uvol | 52 +++
|
||||
package/system/uvol/files/uvol.defaults | 17 +
|
||||
package/system/uvol/files/uvol.init | 23 +
|
||||
8 files changed, 1196 insertions(+)
|
||||
package/system/uvol/files/uvol.defaults | 3 +
|
||||
package/system/uvol/files/uvol.init | 23 ++
|
||||
8 files changed, 1137 insertions(+)
|
||||
create mode 100644 package/system/uvol/Makefile
|
||||
create mode 100644 package/system/uvol/files/autopart.defaults
|
||||
create mode 100644 package/system/uvol/files/common.sh
|
||||
@@ -25,14 +25,14 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
|
||||
diff --git a/package/system/uvol/Makefile b/package/system/uvol/Makefile
|
||||
new file mode 100644
|
||||
index 0000000000..6583e6e756
|
||||
index 0000000000..bd70410c5e
|
||||
--- /dev/null
|
||||
+++ b/package/system/uvol/Makefile
|
||||
@@ -0,0 +1,77 @@
|
||||
+include $(TOPDIR)/rules.mk
|
||||
+
|
||||
+PKG_NAME:=uvol
|
||||
+PKG_VERSION:=0.6
|
||||
+PKG_VERSION:=0.4
|
||||
+PKG_RELEASE:=$(AUTORELEASE)
|
||||
+
|
||||
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
@@ -45,7 +45,7 @@ index 0000000000..6583e6e756
|
||||
+ CATEGORY:=Utilities
|
||||
+ SUBMENU:=Disc
|
||||
+ TITLE:=Automatically initialize LVM partition
|
||||
+ DEPENDS:=+lvm2 +partx-utils +sfdisk
|
||||
+ DEPENDS:=+partx-utils +sfdisk
|
||||
+ PKGARCH=all
|
||||
+endef
|
||||
+
|
||||
@@ -101,7 +101,7 @@ index 0000000000..6583e6e756
|
||||
+ $(INSTALL_BIN) ./files/ubi.sh $(1)/usr/libexec/uvol/20-ubi.sh
|
||||
+ $(INSTALL_BIN) ./files/lvm.sh $(1)/usr/libexec/uvol/50-lvm.sh
|
||||
+ $(INSTALL_BIN) ./files/uvol $(1)/usr/sbin
|
||||
+ $(INSTALL_BIN) ./files/uvol.defaults $(1)/etc/uci-defaults/90-uvol-init
|
||||
+ $(INSTALL_BIN) ./files/uvol.defaults $(1)/etc/uci-defaults/90-uvol-restore-uci
|
||||
+endef
|
||||
+
|
||||
+$(eval $(call BuildPackage,autopart))
|
||||
@@ -241,7 +241,7 @@ index 0000000000..870cd44156
|
||||
+exit 0
|
||||
diff --git a/package/system/uvol/files/common.sh b/package/system/uvol/files/common.sh
|
||||
new file mode 100644
|
||||
index 0000000000..8306477720
|
||||
index 0000000000..e3b554e180
|
||||
--- /dev/null
|
||||
+++ b/package/system/uvol/files/common.sh
|
||||
@@ -0,0 +1,83 @@
|
||||
@@ -270,8 +270,8 @@ index 0000000000..8306477720
|
||||
+ uuid="${uuid:5}"
|
||||
+
|
||||
+ case "$uciname" in
|
||||
+ "_meta")
|
||||
+ target="/var/run/uvol/.meta"
|
||||
+ "_uxc")
|
||||
+ target="/var/state/uxc"
|
||||
+ ;;
|
||||
+ "_"*)
|
||||
+ return 1
|
||||
@@ -297,7 +297,7 @@ index 0000000000..8306477720
|
||||
+ local volname="$1"
|
||||
+ local uciname
|
||||
+
|
||||
+ uciname="${volname//[-.]/_}"
|
||||
+ uciname="${volname//-/_}"
|
||||
+ uciname="${uciname//[!([:alnum:]_)]}"
|
||||
+ if [ -e "${UCI_SPOOLDIR}/add-$1" ]; then
|
||||
+ rm "${UCI_SPOOLDIR}/add-$1"
|
||||
@@ -330,10 +330,10 @@ index 0000000000..8306477720
|
||||
+}
|
||||
diff --git a/package/system/uvol/files/lvm.sh b/package/system/uvol/files/lvm.sh
|
||||
new file mode 100644
|
||||
index 0000000000..c7e93f13f2
|
||||
index 0000000000..95281194ba
|
||||
--- /dev/null
|
||||
+++ b/package/system/uvol/files/lvm.sh
|
||||
@@ -0,0 +1,459 @@
|
||||
@@ -0,0 +1,435 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+cmd="$1"
|
||||
@@ -398,12 +398,8 @@ index 0000000000..c7e93f13f2
|
||||
+
|
||||
+vg_name=
|
||||
+exportpv() {
|
||||
+ vg_name=
|
||||
+ config_load fstab
|
||||
+ local uvolsect="$(config_foreach echo uvol)"
|
||||
+ [ -n "$uvolsect" ] && config_get vg_name "$uvolsect" vg_name
|
||||
+ [ -n "$vg_name" ] && return
|
||||
+ local reports rep pv pvs
|
||||
+ vg_name=
|
||||
+ json_init
|
||||
+ json_load "$(pvs -o vg_name -S "pv_name=~^/dev/$rootdev.*\$")"
|
||||
+ json_select report
|
||||
@@ -492,7 +488,7 @@ index 0000000000..c7e93f13f2
|
||||
+ for dms in /sys/devices/virtual/block/dm-* ; do
|
||||
+ [ "$dms" = "/sys/devices/virtual/block/dm-*" ] && break
|
||||
+ read -r dm_name < "$dms/dm/name"
|
||||
+ [ "$(basename "$lv_dm_path")" = "$dm_name" ] && basename "$dms"
|
||||
+ [ $(basename "$lv_dm_path") = "$dm_name" ] && echo "$(basename "$dms")"
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
@@ -538,7 +534,7 @@ index 0000000000..c7e93f13f2
|
||||
+ *)
|
||||
+ [ "$lv_active" = "active" ] || return 0
|
||||
+ devname="$(getdev "$1")"
|
||||
+ [ "$devname" ] && umount "/dev/$devname"
|
||||
+ [ "$devname" ] && /sbin/block umount "$devname"
|
||||
+ lvm_cmd lvchange -a n "$lv_full_name"
|
||||
+ lvm_cmd lvchange -k y "$lv_full_name" || return $?
|
||||
+ return 0
|
||||
@@ -635,12 +631,7 @@ index 0000000000..c7e93f13f2
|
||||
+}
|
||||
+
|
||||
+listvols() {
|
||||
+ local reports rep lv lvs lv_name lv_size lv_mode volname json_output json_notfirst
|
||||
+ if [ "$1" = "-j" ]; then
|
||||
+ json_output=1
|
||||
+ echo "["
|
||||
+ shift
|
||||
+ fi
|
||||
+ local reports rep lv lvs lv_name lv_size lv_mode volname
|
||||
+ volname=${1:-.*}
|
||||
+ json_init
|
||||
+ json_load "$(lvs -o lv_name,lv_size -S "lv_name=~^[rw][owp]_$volname\$ && vg_name=$vg_name")"
|
||||
@@ -656,32 +647,17 @@ index 0000000000..c7e93f13f2
|
||||
+ lv_mode="${lv_name:0:2}"
|
||||
+ lv_name="${lv_name:3}"
|
||||
+ lv_size=${lv_size%B}
|
||||
+ [ "${lv_name:0:1}" = "." ] && continue
|
||||
+ if [ "$json_output" = "1" ]; then
|
||||
+ [ "$json_notfirst" = "1" ] && echo ","
|
||||
+ echo -e "\t{"
|
||||
+ echo -e "\t\t\"name\": \"$lv_name\","
|
||||
+ echo -e "\t\t\"mode\": \"$lv_mode\","
|
||||
+ echo -e "\t\t\"size\": $lv_size"
|
||||
+ echo -n -e "\t}"
|
||||
+ json_notfirst=1
|
||||
+ else
|
||||
+ echo "$lv_name $lv_mode $lv_size"
|
||||
+ fi
|
||||
+ echo "$lv_name $lv_mode $lv_size"
|
||||
+ json_select ..
|
||||
+ done
|
||||
+ json_select ..
|
||||
+ break
|
||||
+ done
|
||||
+
|
||||
+ if [ "$json_output" = "1" ]; then
|
||||
+ [ "$json_notfirst" = "1" ] && echo
|
||||
+ echo "]"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+
|
||||
+detect() {
|
||||
+ local reports rep lv lvs lv_name lv_full_name lv_mode volname devname
|
||||
+ local reports rep lv lvs lv_name lv_full_name lv_mode volname devname lv_skip_activation
|
||||
+ local temp_up=""
|
||||
+
|
||||
+ json_init
|
||||
@@ -795,10 +771,10 @@ index 0000000000..c7e93f13f2
|
||||
+esac
|
||||
diff --git a/package/system/uvol/files/ubi.sh b/package/system/uvol/files/ubi.sh
|
||||
new file mode 100644
|
||||
index 0000000000..7637fba682
|
||||
index 0000000000..b0b363d7ed
|
||||
--- /dev/null
|
||||
+++ b/package/system/uvol/files/ubi.sh
|
||||
@@ -0,0 +1,358 @@
|
||||
@@ -0,0 +1,337 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+cmd="$1"
|
||||
@@ -969,12 +945,12 @@ index 0000000000..7637fba682
|
||||
+ vol_is_mode "$voldev" wo && return 22
|
||||
+ vol_is_mode "$voldev" wp && return 16
|
||||
+ if vol_is_mode "$voldev" ro; then
|
||||
+ grep -q "^/dev/ubiblock${voldev:3}" /proc/self/mounts && umount "/dev/ubiblock${voldev:3}"
|
||||
+ /sbin/block umount "ubiblock${voldev:3}"
|
||||
+ ubiblock --remove "/dev/$voldev"
|
||||
+ ubirename "/dev/$ubidev" "uvol-ro-$1" "uvol-rd-$1" || return $?
|
||||
+ return 0
|
||||
+ elif vol_is_mode "$voldev" rw; then
|
||||
+ umount "/dev/$voldev"
|
||||
+ /sbin/block umount "$voldev"
|
||||
+ ubirename "/dev/$ubidev" "uvol-rw-$1" "uvol-wd-$1" || return $?
|
||||
+ block_hotplug remove "$voldev"
|
||||
+ return 0
|
||||
@@ -995,12 +971,7 @@ index 0000000000..7637fba682
|
||||
+}
|
||||
+
|
||||
+listvols() {
|
||||
+ local volname volmode volsize json_output json_notfirst
|
||||
+ if [ "$1" = "-j" ]; then
|
||||
+ json_output=1
|
||||
+ shift
|
||||
+ echo "["
|
||||
+ fi
|
||||
+ local volname volmode volsize
|
||||
+ for voldir in "/sys/devices/virtual/ubi/${ubidev}/${ubidev}_"*; do
|
||||
+ read -r volname < "$voldir/name"
|
||||
+ case "$volname" in
|
||||
@@ -1013,24 +984,8 @@ index 0000000000..7637fba682
|
||||
+ esac
|
||||
+ volmode="${volname:5:2}"
|
||||
+ volname="${volname:8}"
|
||||
+ [ "${volname:0:1}" = "." ] && continue
|
||||
+ if [ "$json_output" = "1" ]; then
|
||||
+ [ "$json_notfirst" = "1" ] && echo ","
|
||||
+ echo -e "\t{"
|
||||
+ echo -e "\t\t\"name\": \"$volname\","
|
||||
+ echo -e "\t\t\"mode\": \"$volmode\","
|
||||
+ echo -e "\t\t\"size\": $volsize"
|
||||
+ echo -n -e "\t}"
|
||||
+ json_notfirst=1
|
||||
+ else
|
||||
+ echo "$volname $volmode $volsize"
|
||||
+ fi
|
||||
+ echo "$volname $volmode $volsize"
|
||||
+ done
|
||||
+
|
||||
+ if [ "$json_output" = "1" ]; then
|
||||
+ [ "$json_notfirst" = "1" ] && echo
|
||||
+ echo "]"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+bootvols() {
|
||||
@@ -1217,27 +1172,13 @@ index 0000000000..4ecd2e165a
|
||||
+flock -x /tmp/run/uvol.lock "$uvol_backend" "$@"
|
||||
diff --git a/package/system/uvol/files/uvol.defaults b/package/system/uvol/files/uvol.defaults
|
||||
new file mode 100644
|
||||
index 0000000000..e71135f7a8
|
||||
index 0000000000..cbd53a3e4e
|
||||
--- /dev/null
|
||||
+++ b/package/system/uvol/files/uvol.defaults
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+uvol_init() {
|
||||
+ local metasz freesz totalsz
|
||||
+ uvol detect
|
||||
+ metasz="$(uvol size .meta 2>/dev/null)"
|
||||
+ [ "$((metasz))" -gt 0 ] && return
|
||||
+ totalsz="$(uvol total)"
|
||||
+ freesz="$(uvol free)"
|
||||
+ metasz="$((totalsz / 10240))"
|
||||
+ [ "$metasz" -lt 4194304 ] && metasz=4194304
|
||||
+ [ "$metasz" -gt "$freesz" ] && return
|
||||
+ uvol create .meta "$metasz" rw
|
||||
+ uvol up .meta
|
||||
+}
|
||||
+
|
||||
+uci -q get fstab.@uvol[0].initialized >/dev/null || uvol_init
|
||||
+uci -q get fstab.@uvol[0].initialized >/dev/null || uvol detect || true
|
||||
diff --git a/package/system/uvol/files/uvol.init b/package/system/uvol/files/uvol.init
|
||||
new file mode 100644
|
||||
index 0000000000..1f6e2aac08
|
||||
14
config.yml
14
config.yml
@@ -1,16 +1,8 @@
|
||||
repo: https://github.com/openwrt/openwrt.git
|
||||
branch: openwrt-21.02
|
||||
revision: c67509efd7d0c43eb3f622f06c8a31aa28d22f6e
|
||||
revision: 378769b5551714ccaa821b481bfeecbf362f351e
|
||||
output_dir: ./output
|
||||
|
||||
patch_folders:
|
||||
- patches/backports/
|
||||
- patches/base
|
||||
- patches/wifi
|
||||
- patches/ath79
|
||||
- patches/ramips
|
||||
- patches/ipq40xx
|
||||
- patches/ipq806x
|
||||
- patches/ipq807x
|
||||
- patches/rtkmipsel
|
||||
- patches/rest
|
||||
- backports/
|
||||
- patches/
|
||||
|
||||
@@ -3,7 +3,7 @@ FROM ubuntu:20.04
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata \
|
||||
&& apt-get install -y \
|
||||
time git-core build-essential gcc-multilib clang \
|
||||
time git-core build-essential gcc-multilib \
|
||||
libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \
|
||||
python3 python3-pip python3-yaml libssl-dev rsync \
|
||||
&& apt-get clean
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cc2652
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/cc2652
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=cc2652 -- TI CC26x2 firmware upgrade tool
|
||||
DEPENDS:=+libstdcpp +zlib
|
||||
endef
|
||||
|
||||
define Package/cc2652/description
|
||||
TI CC26x2 firmware upgrade tool
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/cc2652/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/tisbl.init $(1)/etc/init.d/tisbl
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/tifirmware
|
||||
$(INSTALL_BIN) ./files/firmware/* $(1)/etc/tifirmware/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tisbl $(1)/usr/bin/
|
||||
$(INSTALL_BIN) ./files/*.sh $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_BIN) ./files/tisbl.config $(1)/etc/config/tisbl
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/tisbl.defaults $(1)/etc/uci-defaults
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,cc2652))
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
#!/usr/bin/lua
|
||||
--[[
|
||||
ByteCnt: 1 1 1 2 1 4
|
||||
---- --------- ---------- ----- ------ -------
|
||||
FieldName:Type EventCode DataLength Event Status EventId
|
||||
--]]
|
||||
|
||||
--Type
|
||||
Command = 0x01
|
||||
Event = 0x04
|
||||
|
||||
--OpCode
|
||||
GapScan_enable = 0xFE51
|
||||
|
||||
--EventCode
|
||||
HCI_LE_ExtEvent = 0xff
|
||||
|
||||
--Status
|
||||
SUCCESS = 0x00
|
||||
|
||||
--Event
|
||||
GAP_HCI_ExtentionCommandStatus = 0x067F
|
||||
GAP_AdvertiserScannerEvent = 0x0613
|
||||
|
||||
--EventId
|
||||
GAP_EVT_ADV_REPORT = 0x00400000
|
||||
GAP_EVT_SCAN_ENABLED = 0x00010000
|
||||
|
||||
local write = io.write
|
||||
function print(...)
|
||||
local n = select("#",...)
|
||||
for i = 1,n do
|
||||
local v = tostring(select(i,...))
|
||||
write(v)
|
||||
if i~=n then write'\t' end
|
||||
end
|
||||
-- write'\n'
|
||||
end
|
||||
|
||||
function printf(str, ...)
|
||||
return print(str:format(...))
|
||||
end
|
||||
|
||||
function lshift(x, by)
|
||||
return x * 2 ^ by
|
||||
end
|
||||
|
||||
function GetUint8(Payload, position)
|
||||
return string.byte(Payload, position)
|
||||
end
|
||||
|
||||
function GetUint32(Payload, position)
|
||||
return (lshift(string.byte(Payload, position+3),24) + lshift(string.byte(Payload, position+2),16) + lshift(string.byte(Payload, position+1),8) + string.byte(Payload, position))
|
||||
end
|
||||
|
||||
function GetUint16(Payload, position)
|
||||
return (lshift(string.byte(Payload, position+1),8) + string.byte(Payload, position))
|
||||
end
|
||||
|
||||
function hexdump(Payload,separator)
|
||||
for i=1,Payload:len(), 1 do
|
||||
io.write(string.format("%02X", Payload:byte(i)))
|
||||
if (i< Payload:len()) then
|
||||
io.write(separator)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ibeacon_hdr=string.char(0x1A,0xFF,0x4C,0x00,0x02,0x15)
|
||||
|
||||
function DumpAdvertiserData(Payload)
|
||||
--[[
|
||||
Len(1byte)+Type(1byte)+Data(Len bytes)
|
||||
--]]
|
||||
while( Payload:len() > 0 ) do
|
||||
local Len = GetUint8(Payload,1)
|
||||
if (GetUint8(Payload,2) == 0xff) then -- manufacturer data
|
||||
print(" MFR=")
|
||||
hexdump(Payload:sub(1,Len+1),'')
|
||||
if (Payload:sub(1,6) == ibeacon_hdr) then
|
||||
print(" [ibeacon]")
|
||||
end
|
||||
end
|
||||
Payload = string.sub(Payload,Len+2,-1)
|
||||
end
|
||||
end
|
||||
|
||||
function DumpAdvertiserScannerEvent(Payload)
|
||||
local Status = GetUint8(Payload,3)
|
||||
local EventId = GetUint32(Payload,4)
|
||||
if((EventId==GAP_EVT_ADV_REPORT) and (Status==SUCCESS))
|
||||
then
|
||||
local MAC = string.sub(Payload,10,15)
|
||||
local TxPower = GetUint8(Payload,19)
|
||||
local RSSI = GetUint8(Payload,20)
|
||||
printf("MAC=%02X%02X%02X%02X%02X%02X RSI=%d PWR=%d",string.byte(MAC,6),string.byte(MAC,5),string.byte(MAC,4),
|
||||
string.byte(MAC,3),string.byte(MAC,2),string.byte(MAC,1),RSSI,TxPower)
|
||||
local DataLength = GetUint16(Payload,30)
|
||||
DumpAdvertiserData(string.sub(Payload,32,-1))
|
||||
print("\n")
|
||||
end
|
||||
end
|
||||
|
||||
function hci_event_paser()
|
||||
while true do
|
||||
local Header = io.read(3)
|
||||
if not Header then break end
|
||||
local EventType = GetUint8(Header,1)
|
||||
local EventCode = GetUint8(Header,2)
|
||||
local DataLength = GetUint8(Header,3)
|
||||
|
||||
local Data = io.read(DataLength)
|
||||
local Event = GetUint16(Data,1)
|
||||
-- print(EventType,EventCode,DataLength,Event)
|
||||
if not Data then break end
|
||||
if(Event==GAP_AdvertiserScannerEvent)
|
||||
then
|
||||
DumpAdvertiserScannerEvent(Data)
|
||||
-- hexdump(ibeacon_hdr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hci_event_paser()
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
com-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x08\x00\x00\x00\x00\x00\x00\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x02" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x03" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x04" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x61\xFE\x02\x01\x05" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 3 "\x01\x51\xFE\x06\x00\x00\xF4\x01\x28\x00" | tee /tmp/blescan.data | ble-scan-rx-parser.sh
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
# com-wr.sh tty time command parser
|
||||
# example com-wr.sh /dev/ttyMSM1 1 "\x01\x1D\xFC\x01\x00" | hexdump.sh --> send "\x01\x1D\xFC\x01\x00" to /dev/ttyMSM1 and then hexdump receive data until 100ms timeout
|
||||
#command example "\x7E\x03\xD0\xAF und normaler Text"
|
||||
tty=$1
|
||||
time=$2
|
||||
command=$3
|
||||
parser=$4
|
||||
stty -F $tty time $time
|
||||
exec 99< $tty
|
||||
echo -en $command > $tty
|
||||
cat $tty
|
||||
exec 99<&-
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/lua
|
||||
local block = 16
|
||||
while true do
|
||||
local bytes = io.read(block)
|
||||
if not bytes then break end
|
||||
for b in string.gfind(bytes, ".") do
|
||||
io.write(string.format("%02X ", string.byte(b)))
|
||||
end
|
||||
io.write(string.rep(" ", block - string.len(bytes) + 1))
|
||||
io.write(string.gsub(bytes, "%c", "."), "\n")
|
||||
end
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
# script---------------- UUID---------------------------------------------------------------------- MAJOR----- MINOR----- POWER-
|
||||
#example: ibeacon-broadcaster.sh "\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61" "\x01\x23" "\x45\x67" "\xC8"
|
||||
if [ "$#" -eq 4 ]; then
|
||||
UUID=$1
|
||||
MAJOR=$2
|
||||
MINOR=$3
|
||||
POWER=$4
|
||||
else
|
||||
UUID="\xE2\x0A\x39\xF4\x73\xF5\x4B\xC4\xA1\x2F\x17\xD1\xAD\x07\xA9\x61"
|
||||
MAJOR="\x01\x23"
|
||||
MINOR="\x45\x67"
|
||||
POWER="\xC8"
|
||||
fi
|
||||
|
||||
com-wr.sh /dev/ttyMSM1 3 "\x01\x1D\xFC\x01\x00" > /dev/null # this command dealy time must >= 3, if small then 3, the following commands will be something wrong
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x00\xFE\x08\x01\x00\x00\x00\x00\x00\x00\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x3E\xFE\x15\x12\x00\xA0\x00\x00\xA0\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x7F\x01\x01\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x09\x44\xFE\x23\x00\x00\x00\x1E\x00\x02\x01\x1A\x1A\xFF\x4C\x00\x02\x15${UUID}${MAJOR}${MINOR}${POWER}\x00" > /dev/null
|
||||
com-wr.sh /dev/ttyMSM1 1 "\x01\x3F\xFE\x04\x00\x00\x00\x00" | hexdump.sh
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
killall -9 ser2net
|
||||
tisbl.sh /dev/ttyMSM1 115200 2652 /etc/tifirmware/ble5_host_test_bd9.bin 79 34
|
||||
echo "7000:telnet:0:/dev/ttyMSM1:115200 8DATABITS NONE 1STOPBIT remctl" > /tmp/ser2net.conf
|
||||
ser2net -c /tmp/ser2net.conf
|
||||
@@ -1,7 +0,0 @@
|
||||
config tisbl 'tisbl'
|
||||
option firmware '/etc/tifirmware/ble5_host_test_bd9.bin'
|
||||
option tty '/dev/ttyMSM1'
|
||||
option tichip '2652'
|
||||
option baudrate '115200'
|
||||
option resetpin '79'
|
||||
option backdoorpin '34'
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case $board in
|
||||
edgecore,eap104)
|
||||
uci set tisbl.tisbl.backdoorpin=31
|
||||
uci set tisbl.tisbl.resetpin=35
|
||||
;;
|
||||
esac
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
|
||||
#start after dbus (60)
|
||||
START=62
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
firmware="$(uci -q get tisbl.tisbl.firmware)"
|
||||
tty="$(uci -q get tisbl.tisbl.tty)"
|
||||
tichip="$(uci -q get tisbl.tisbl.tichip)"
|
||||
baudrate="$(uci -q get tisbl.tisbl.baudrate)"
|
||||
resetpin="$(uci -q get tisbl.tisbl.resetpin)"
|
||||
backdoorpin="$(uci -q get tisbl.tisbl.backdoorpin)"
|
||||
tisbl.sh $tty $baudrate $tichip $firmware $resetpin $backdoorpin
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "tisbl"
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/sh
|
||||
# tisbl.sh $tty $baudrate $tichip $firmware $resetpin $backdoorpin
|
||||
# tisbl.sh /dev/ttyMSM1 115200 2652 /etc/tifirmware/blinky_bd13.bin 79 67
|
||||
|
||||
#assumption: resetpin and backdoorpin are low active
|
||||
tty=$1
|
||||
baudrate=$2
|
||||
tichip=$3
|
||||
firmware=$4
|
||||
resetpin=$5
|
||||
backdoorpin=$6
|
||||
|
||||
ti_reset() #assumption:resetpin is low active
|
||||
{
|
||||
if [ ! -e /sys/class/gpio/gpio${resetpin} ]; then
|
||||
echo ${resetpin} > /sys/class/gpio/export
|
||||
fi
|
||||
echo out > /sys/class/gpio/gpio${resetpin}/direction
|
||||
|
||||
echo 1 > /sys/class/gpio/gpio${resetpin}/value
|
||||
echo 0 > /sys/class/gpio/gpio${resetpin}/value
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/gpio${resetpin}/value
|
||||
}
|
||||
|
||||
ti_goto_bootloader() #assumption:backdoorpin is low active
|
||||
{
|
||||
if [ ! -e /sys/class/gpio/gpio${backdoorpin} ]; then
|
||||
echo ${backdoorpin} > /sys/class/gpio/export
|
||||
fi
|
||||
echo out > /sys/class/gpio/gpio${backdoorpin}/direction
|
||||
|
||||
echo 0 > /sys/class/gpio/gpio${backdoorpin}/value
|
||||
ti_reset
|
||||
sleep 1
|
||||
echo 1 > /sys/class/gpio/gpio${backdoorpin}/value
|
||||
}
|
||||
|
||||
if [ -e $firmware ]; then
|
||||
ti_goto_bootloader
|
||||
tisbl $tty $baudrate $tichip $firmware #try to upgrade firmware
|
||||
fi
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# Executable
|
||||
EXE = tisbl
|
||||
|
||||
# Compiler, Linker Defines
|
||||
#CC = g++
|
||||
#CFLAGS = -w -O -Wno-deprecated -I. -fpermissive -std=gnu++0x
|
||||
#CFLAGS = -I. -fpermissive -Wwrite-strings -lstdc++
|
||||
CFLAGS = -I. -Wwrite-strings -std=gnu++0x -lstdc++ -fPIC
|
||||
#CFLAGS = -I. -lstdc++ -Wwrite-strings -std=gnu++0x
|
||||
#LIBS =
|
||||
#LDFLAGS = $(LIBS)
|
||||
|
||||
# Compile and Assemble C++ Source Files into Object Files
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CFLAGS) $(LDFLAGS) -c $< -o $@
|
||||
# Source and Object files
|
||||
SRC = $(wildcard *.cpp)
|
||||
OBJ = $(patsubst %.cpp, %.o, $(SRC))
|
||||
|
||||
# Link all Object Files with external Libraries into Binaries
|
||||
$(EXE): $(OBJ)
|
||||
$(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $(EXE)
|
||||
# $(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $(EXE) -lz
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm -f $(EXE) *.o
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#define DEBUG 0
|
||||
#if defined(DEBUG) && DEBUG > 0
|
||||
#define DEBUG_PRINT(fmt, args...) fprintf(stderr, "$$%d:%s:%d:%s():" fmt, \
|
||||
(int)time(NULL), __FILE__, __LINE__, __func__, ##args)
|
||||
#else
|
||||
#define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */
|
||||
#endif
|
||||
|
||||
#endif // __DEBUG_H__
|
||||
@@ -1,257 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Filename: sblAppEx.cpp
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader Library application example.
|
||||
* This example enumerates all COM devices and lets you
|
||||
* select which port to connect to. The example assumes the
|
||||
* connected device is a CC2538, CC2650 or CC2652 and programs
|
||||
* a blinky onto the device. After programming the blinky,
|
||||
* bootloader mode may be forced by
|
||||
* - holding SELECT button on 06EB (for CC2538 and CC26x0 EMKs), or
|
||||
* - holding BTN-1 on the device LaunchPad (for CC26x2 LPs)
|
||||
* when resetting the chip.
|
||||
*
|
||||
* Copyright (C) 2013 - 2019 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "serialib.h"
|
||||
#include "sbllib.h"
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
//#include <time.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Calculate crc32 checksum the way CC2538 and CC2650 does it.
|
||||
int calcCrcLikeChip(const unsigned char *pData, unsigned long ulByteCount)
|
||||
{
|
||||
unsigned long d, ind;
|
||||
unsigned long acc = 0xFFFFFFFF;
|
||||
const unsigned long ulCrcRand32Lut[] =
|
||||
{
|
||||
0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC,
|
||||
0x76DC4190, 0x6B6B51F4, 0x4DB26158, 0x5005713C,
|
||||
0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C,
|
||||
0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C
|
||||
};
|
||||
|
||||
while ( ulByteCount-- )
|
||||
{
|
||||
d = *pData++;
|
||||
ind = (acc & 0x0F) ^ (d & 0x0F);
|
||||
acc = (acc >> 4) ^ ulCrcRand32Lut[ind];
|
||||
ind = (acc & 0x0F) ^ (d >> 4);
|
||||
acc = (acc >> 4) ^ ulCrcRand32Lut[ind];
|
||||
}
|
||||
|
||||
return (acc ^ 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
/// Application status function (used as SBL status callback)
|
||||
void appStatus(char *pcText, bool bError)
|
||||
{
|
||||
if(bError)
|
||||
{
|
||||
cerr << pcText;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << pcText;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Application progress function (used as SBL progress callback)
|
||||
static void appProgress(uint32_t progress)
|
||||
{
|
||||
fprintf(stdout, "\r%d%% ", progress);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// Defines
|
||||
// Name Hex Dec
|
||||
// ------------------------------- --------------- ---------------------------------
|
||||
#define DEVICE_CC2538 0x2538 // 9528
|
||||
#define DEVICE_CC26X0 0x2650 // 9808
|
||||
#define DEVICE_CC2640R2 0x2640 // 9792
|
||||
#define DEVICE_CC26X2 0x2652 // 9810
|
||||
#define CC2538_FLASH_BASE 0x00200000
|
||||
#define CC26XX_FLASH_BASE 0x00000000
|
||||
|
||||
// Application main function
|
||||
// tisbl SerialDevNode baudRate deviceType firmware
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// START: Program Configuration
|
||||
/* UART baud rate. Default: 230400 */
|
||||
uint32_t baudRate = 115200;
|
||||
uint32_t deviceType = DEVICE_CC26X2;
|
||||
SblDevice *pDevice = NULL; // Pointer to SblDevice object
|
||||
char *SerialDevNode;
|
||||
int32_t devStatus = -1; // Hold SBL status codes
|
||||
std::string fileName; // File name to program
|
||||
uint32_t byteCount = 0; // File size in bytes
|
||||
uint32_t fileCrc, devCrc; // Variables to save CRC checksum
|
||||
uint32_t devFlashBase; // Flash start address
|
||||
static std::vector<char> pvWrite(1);// Vector to application firmware in.
|
||||
static std::ifstream file; // File stream
|
||||
|
||||
// Set callback functions
|
||||
SblDevice::setCallBackStatusFunction(&appStatus);
|
||||
SblDevice::setCallBackProgressFunction(&appProgress);
|
||||
|
||||
// Select device
|
||||
// deviceType FlashBase File
|
||||
// DEVICE_CC2538 CC2538_FLASH_BASE blinky_backdoor_select_btn2538.bin
|
||||
// DEVICE_CC26X0 CC26XX_FLASH_BASE blinky_backdoor_select_btn2650.bin
|
||||
// DEVICE_CC2640R2 CC26XX_FLASH_BASE blinky_backdoor_select_btn2640r2.bin
|
||||
// DEVICE_CC26X2 CC26XX_FLASH_BASE blinky_backdoor_select_btn26x2.bin
|
||||
if(argc < 5) {
|
||||
return -1;
|
||||
}
|
||||
SerialDevNode = argv[1];
|
||||
baudRate = atoi(argv[2]);
|
||||
deviceType = strtol(argv[3], NULL, 16);
|
||||
fileName = argv[4];
|
||||
switch(deviceType)
|
||||
{
|
||||
case DEVICE_CC2538:
|
||||
devFlashBase = CC2538_FLASH_BASE;
|
||||
break;
|
||||
case DEVICE_CC26X0:
|
||||
case DEVICE_CC2640R2:
|
||||
case DEVICE_CC26X2:
|
||||
devFlashBase = CC26XX_FLASH_BASE;
|
||||
break;
|
||||
}
|
||||
printf("SerialDevNode=%s, baudRate=%d, deviceType=%04x, fileName=%s\n",SerialDevNode,baudRate,deviceType,fileName.c_str());
|
||||
|
||||
// Should SBL try to enable XOSC? (Not possible for CC26xx)
|
||||
bool bEnableXosc = false;
|
||||
if(deviceType == DEVICE_CC2538)
|
||||
{
|
||||
char answer[64];
|
||||
cout << "Enable device CC2538 XOSC? (Y/N): ";
|
||||
cin >> answer;
|
||||
bEnableXosc = (answer[0] == 'Y' || answer[0] == 'y') ? true : false;
|
||||
}
|
||||
|
||||
// Create SBL object
|
||||
pDevice = SblDevice::Create(deviceType);
|
||||
if(pDevice == NULL)
|
||||
{
|
||||
printf("No SBL device object.\n");
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Connect to device
|
||||
printf("Connecting (%s @ %d baud) ...\n", SerialDevNode, baudRate);
|
||||
if(pDevice->connect(SerialDevNode, baudRate, bEnableXosc) != SBL_SUCCESS)
|
||||
{
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Read file
|
||||
file.open(fileName.c_str(), std::ios::binary);
|
||||
if(file.is_open())
|
||||
{
|
||||
// Get file size:
|
||||
file.seekg(0, std::ios::end);
|
||||
byteCount = (uint32_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
// Read data
|
||||
pvWrite.resize(byteCount);
|
||||
file.read((char*) &pvWrite[0], byteCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Unable to open file " << fileName.c_str();
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Calculate file CRC checksum
|
||||
fileCrc = calcCrcLikeChip((unsigned char *)&pvWrite[0], byteCount);
|
||||
|
||||
if(pDevice->calculateCrc32(devFlashBase, byteCount, &devCrc) != SBL_SUCCESS)
|
||||
{
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
printf ("pre-Comparing CRC: fileCrc=%x,devCrc=%x\n",fileCrc,devCrc);
|
||||
|
||||
if(fileCrc == devCrc) {
|
||||
cout << "CRC is same, no need to upgrade\n";
|
||||
pDevice->reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Erasing as much flash needed to program firmware.
|
||||
cout << "Erasing flash ...\n";
|
||||
if(pDevice->eraseFlashRange(devFlashBase, byteCount) != SBL_SUCCESS)
|
||||
{
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Writing file to device flash memory.
|
||||
cout << "Writing flash ...\n";
|
||||
if(pDevice->writeFlashRange(devFlashBase, byteCount, &pvWrite[0]) != SBL_SUCCESS)
|
||||
{
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Calculate CRC checksum of flashed content.
|
||||
cout << "Calculating CRC on device ...\n";
|
||||
if(pDevice->calculateCrc32(devFlashBase, byteCount, &devCrc) != SBL_SUCCESS)
|
||||
{
|
||||
cout << "\n\nAn error occurred: " << pDevice->getLastStatus();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Compare CRC checksums
|
||||
printf ("Comparing CRC: fileCrc=%x,devCrc=%x\n",fileCrc,devCrc);
|
||||
if(fileCrc == devCrc) printf("OK\n");
|
||||
else printf("Mismatch!\n");
|
||||
|
||||
cout << "Resetting device ...\n";
|
||||
pDevice->reset();
|
||||
cout << "OK\n";
|
||||
|
||||
}
|
||||
@@ -1,673 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Filename: sbl_device.cpp
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader device file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <sbllib.h>
|
||||
#include "sbl_device.h"
|
||||
#include "sbl_device_cc2538.h"
|
||||
#include "sbl_device_cc2650.h"
|
||||
#include "sbl_device_cc2652.h"
|
||||
|
||||
#if 0
|
||||
#include <ComPort.h>
|
||||
#include <ComPortElement.h>
|
||||
#else
|
||||
#include "serialib.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
// Static variables
|
||||
//
|
||||
std::string SblDevice::sm_csLastError;
|
||||
uint32_t SblDevice::sm_progress = 0;
|
||||
tProgressFPTR SblDevice::sm_pProgressFunction = NULL;
|
||||
tStatusFPTR SblDevice::sm_pStatusFunction = NULL;
|
||||
uint32_t SblDevice::sm_chipType = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Constructor
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
SblDevice::SblDevice()
|
||||
{
|
||||
m_pCom = NULL;
|
||||
m_lastDeviceStatus = -1;
|
||||
m_lastSblStatus = SBL_SUCCESS;
|
||||
m_bCommInitialized = false;
|
||||
m_deviceId = 0;
|
||||
m_ramSize = 0;
|
||||
m_flashSize = 0;
|
||||
m_pageEraseSize = 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Destructor
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
SblDevice::~SblDevice()
|
||||
{
|
||||
if (m_pCom != nullptr)
|
||||
{
|
||||
delete m_pCom;
|
||||
m_pCom = nullptr;
|
||||
}
|
||||
|
||||
m_lastDeviceStatus = -1;
|
||||
m_bCommInitialized = false;
|
||||
m_ramSize = -1;
|
||||
m_flashSize = -1;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Create Serial Bootloader Device
|
||||
*
|
||||
* \param[in] ui32ChipType
|
||||
* Chip type the object should be created for, e.g. 0x2650 for CC2650.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/*static*/SblDevice *
|
||||
SblDevice::Create(uint32_t ui32ChipType)
|
||||
{
|
||||
if (ui32ChipType == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sm_chipType = ui32ChipType;
|
||||
|
||||
switch (ui32ChipType)
|
||||
{
|
||||
case 0x2538:
|
||||
return (SblDevice *)new SblDeviceCC2538();
|
||||
case 0x1350:
|
||||
case 0x1310:
|
||||
case 0x2670:
|
||||
case 0x2650:
|
||||
case 0x2640:
|
||||
case 0x2630:
|
||||
case 0x2620:
|
||||
return (SblDevice *)new SblDeviceCC2650();
|
||||
case 0x1312:
|
||||
case 0x1352:
|
||||
case 0x2642:
|
||||
case 0x2652:
|
||||
return (SblDevice *)new SblDeviceCC2652();
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Enumerate COM port devices
|
||||
*
|
||||
* \param[in/out] pComPortElements
|
||||
* Pointer to array where enumerated COM devices are stored
|
||||
* \param[in/out] numElements
|
||||
* Maximum number of elements to enumerate. Is populated with number
|
||||
* of devices enumerated.
|
||||
*
|
||||
* \return
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/*static*/uint32_t
|
||||
SblDevice::enumerate(ComPortElement *pComPortElements, int &numElements)
|
||||
{
|
||||
ComPort com;
|
||||
if (com.enumerate(pComPortElements, numElements) != ComPort::COMPORT_SUCCESS)
|
||||
{
|
||||
printf("Failed to enumerate COM devices.\n");
|
||||
return SBL_ENUM_ERROR;
|
||||
}
|
||||
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Connect to given port number at specified baud rate.
|
||||
*
|
||||
* \param[in] csPortNum
|
||||
* String containing the COM port to use
|
||||
* \param[in] ui32BaudRate
|
||||
* Baud rate to use for talking to the device.
|
||||
* \param[in] bEnableXosc (optional)
|
||||
* If true, try to enable device XOSC. Defaults to false. This option is
|
||||
* not available for all device types.
|
||||
*
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDevice::connect(std::string csPortNum, uint32_t ui32BaudRate,
|
||||
bool bEnableXosc/* = false*/)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
int retCode = SBL_SUCCESS;
|
||||
|
||||
//
|
||||
// Check input arguments
|
||||
//
|
||||
if (csPortNum.empty() || ui32BaudRate == 0)
|
||||
{
|
||||
setState(SBL_ARGUMENT_ERROR, "Cannot connect. Port number '%s' or baud rate '%d' is invalid.\n",
|
||||
csPortNum.c_str(), ui32BaudRate);
|
||||
return SBL_ARGUMENT_ERROR;
|
||||
}
|
||||
|
||||
// Try to connect to the specified port at the specified baud rate
|
||||
if (m_pCom != NULL)
|
||||
{
|
||||
// Try to open port
|
||||
#if 1
|
||||
char result = m_pCom->openDevice(csPortNum.c_str(),ui32BaudRate);
|
||||
if(result < 0)
|
||||
{
|
||||
setState(SBL_PORT_ERROR, "SBL: Unable to open %s. Error: %d.\n", csPortNum.c_str(), result);
|
||||
return SBL_PORT_ERROR;
|
||||
}
|
||||
#else
|
||||
if (int result = m_pCom->open(csPortNum,
|
||||
ui32BaudRate,
|
||||
SBL_DEFAULT_READ_TIMEOUT,
|
||||
SBL_DEFAULT_WRITE_TIMEOUT) != ComPort::COMPORT_SUCCESS)
|
||||
{
|
||||
setState(SBL_PORT_ERROR, "SBL: Unable to open %s. Error: %d.\n", csPortNum.c_str(), result);
|
||||
return SBL_PORT_ERROR;
|
||||
}
|
||||
#endif
|
||||
m_csComPort = csPortNum;
|
||||
m_baudRate = ui32BaudRate;
|
||||
}
|
||||
// Check if device is responding at the given baud rate
|
||||
if ((retCode = initCommunication(bEnableXosc)) != SBL_SUCCESS)
|
||||
{
|
||||
return retCode;
|
||||
}
|
||||
|
||||
//
|
||||
// Read device ID
|
||||
//
|
||||
uint32_t tmp;
|
||||
if ((retCode = readDeviceId(&tmp)) != SBL_SUCCESS)
|
||||
{
|
||||
setState(retCode, "Failed to read device ID during initial connect.\n");
|
||||
return retCode;
|
||||
}
|
||||
//
|
||||
// Read device flash size
|
||||
//
|
||||
if ((retCode = readFlashSize(&tmp)) != SBL_SUCCESS)
|
||||
{
|
||||
setState(retCode, "Failed to read flash size during initial connect.\n");
|
||||
return retCode;
|
||||
}
|
||||
//
|
||||
// Read device ram size
|
||||
//
|
||||
if ((retCode = readRamSize(&tmp)) != SBL_SUCCESS)
|
||||
{
|
||||
setState(retCode, "Failed to read RAM size during initial connect.\n");
|
||||
return retCode;
|
||||
}
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Send auto baud.
|
||||
*
|
||||
* \param[out] bBaudSetOk
|
||||
* True if response is ACK, false otherwise
|
||||
*
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDevice::sendAutoBaud(bool &bBaudSetOk)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
bBaudSetOk = false;
|
||||
//
|
||||
// Send 0x55 0x55 and expect ACK
|
||||
//
|
||||
char pData[2];
|
||||
memset(pData, 0x55, 2);
|
||||
if (m_pCom->writeBytes(pData, 2) != 2)
|
||||
{
|
||||
setState(SBL_PORT_ERROR, "Communication initialization failed. Failed to send data.\n");
|
||||
return SBL_PORT_ERROR;
|
||||
}
|
||||
|
||||
if (getCmdResponse(bBaudSetOk, 2, true) != SBL_SUCCESS)
|
||||
{
|
||||
// No response received. Invalid baud rate?
|
||||
setState(SBL_PORT_ERROR, "No response from device. Device may not be in bootloader mode. Reset device and try again.\nIf problem persists, check connection and baud rate.\n");
|
||||
return SBL_PORT_ERROR;
|
||||
}
|
||||
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Get ACK/NAK from the boot loader.
|
||||
*
|
||||
* \param[out] bAck
|
||||
* True if response is ACK, false if response is NAK.
|
||||
* \param[in] ui32MaxRetries (optional)
|
||||
* How many times ComPort::readBytes() can time out before fail is issued.
|
||||
* \param[in] bQuietTimeout (optional)
|
||||
* Do not set error if no command response is received.
|
||||
*
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDevice::getCmdResponse(bool &bAck,
|
||||
uint32_t ui32MaxRetries/* = SBL_DEFAULT_RETRY_COUNT*/,
|
||||
bool bQuietTimeout/* = false*/)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
unsigned char pIn[2];
|
||||
memset(pIn, 0, 2);
|
||||
uint32_t numBytes = 0;
|
||||
uint32_t retry = 0;
|
||||
bAck = false;
|
||||
uint32_t bytesRecv = 0;
|
||||
|
||||
//
|
||||
// Expect 2 bytes (ACK or NAK)
|
||||
//
|
||||
do
|
||||
{
|
||||
numBytes = m_pCom->readBytes(pIn, 2);
|
||||
bytesRecv += numBytes;
|
||||
retry++;
|
||||
} while ((bytesRecv < 2) && (retry < ui32MaxRetries));
|
||||
|
||||
if (bytesRecv < 2)
|
||||
{
|
||||
if (!bQuietTimeout) setState(SBL_TIMEOUT_ERROR, "Timed out waiting for ACK/NAK. No response from device.\n");
|
||||
return SBL_TIMEOUT_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pIn[0] == 0x00 && pIn[1] == 0xCC)
|
||||
{
|
||||
bAck = true;
|
||||
return setState(SBL_SUCCESS);
|
||||
}
|
||||
else if (pIn[0] == 0x00 && pIn[1] == 0x33)
|
||||
{
|
||||
return setState(SBL_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
setState(SBL_ERROR, "ACK/NAK not received. Expected 0x00 0xCC or 0x00 0x33, received 0x%02X 0x%02X. bytesRecv=%d\n", pIn[0], pIn[1], bytesRecv);
|
||||
return SBL_ERROR;
|
||||
}
|
||||
}
|
||||
return SBL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Send command response (ACK/NAK).
|
||||
*
|
||||
* \param[in] bAck
|
||||
* True if response is ACK, false if response is NAK.
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDevice::sendCmdResponse(bool bAck)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
//
|
||||
// Send response
|
||||
//
|
||||
char pData[2];
|
||||
pData[0] = 0x00;
|
||||
pData[1] = (bAck) ? 0xCC : 0x33;
|
||||
|
||||
if (m_pCom->writeBytes(pData, 2) != 2)
|
||||
{
|
||||
setState(SBL_PORT_ERROR, "Failed to send ACK/NAK response over %s\n",
|
||||
m_csComPort.c_str());
|
||||
return SBL_PORT_ERROR;
|
||||
}
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Get response data from device.
|
||||
*
|
||||
* \param[out] pcData
|
||||
* Pointer to where received data will be stored.
|
||||
* \param[in|out] ui32MaxLen
|
||||
* Max number of bytes that can be received. Is populated with the actual
|
||||
* number of bytes received.
|
||||
* \param[in] ui32MaxRetries (optional)
|
||||
* How many times ComPort::readBytes() can time out before fail is issued.
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDevice::getResponseData(char *pcData, uint32_t &ui32MaxLen,
|
||||
uint32_t ui32MaxRetries/* = SBL_DEFAULT_RETRY_COUNT*/)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
uint32_t numBytes = 0;
|
||||
uint32_t retry = 0;
|
||||
unsigned char pcHdr[2];
|
||||
uint32_t numPayloadBytes;
|
||||
uint8_t hdrChecksum, dataChecksum;
|
||||
uint32_t bytesRecv = 0;
|
||||
|
||||
setState(SBL_SUCCESS);
|
||||
//
|
||||
// Read length and checksum
|
||||
//
|
||||
memset(pcHdr, 0, 2);
|
||||
do
|
||||
{
|
||||
bytesRecv += m_pCom->readBytes(&pcHdr[bytesRecv], (2 - bytesRecv));
|
||||
retry++;
|
||||
} while ((bytesRecv < 2) && retry < ui32MaxRetries);
|
||||
|
||||
//
|
||||
// Check that we've received 2 bytes
|
||||
//
|
||||
if (bytesRecv < 2)
|
||||
{
|
||||
setState(SBL_TIMEOUT_ERROR, "Timed out waiting for data header from device.\n");
|
||||
return SBL_TIMEOUT_ERROR;
|
||||
}
|
||||
numPayloadBytes = pcHdr[0] - 2;
|
||||
hdrChecksum = pcHdr[1];
|
||||
|
||||
//
|
||||
// Check if length byte is too long.
|
||||
//
|
||||
if (numPayloadBytes > ui32MaxLen)
|
||||
{
|
||||
setState(SBL_ERROR, "Error: Device sending more data than expected. \nMax expected was %d, sent was %d.\n", (uint32_t)ui32MaxLen, (numPayloadBytes + 2));
|
||||
#if 1
|
||||
m_pCom->flushReceiver();
|
||||
#endif
|
||||
return SBL_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the payload data
|
||||
//
|
||||
bytesRecv = 0;
|
||||
do
|
||||
{
|
||||
bytesRecv += m_pCom->readBytes(&pcData[bytesRecv], (numPayloadBytes - bytesRecv));
|
||||
retry++;
|
||||
} while (bytesRecv < numPayloadBytes && retry < ui32MaxRetries);
|
||||
|
||||
//
|
||||
// Have we received what we expected?
|
||||
//
|
||||
if (bytesRecv < numPayloadBytes)
|
||||
{
|
||||
ui32MaxLen = bytesRecv;
|
||||
setState(SBL_TIMEOUT_ERROR, "Timed out waiting for data from device.\n");
|
||||
return SBL_TIMEOUT_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Verify data checksum
|
||||
//
|
||||
dataChecksum = generateCheckSum(0, pcData, numPayloadBytes);
|
||||
if (dataChecksum != hdrChecksum)
|
||||
{
|
||||
setState(SBL_ERROR, "Checksum verification error. Expected 0x%02X, got 0x%02X.\n", hdrChecksum, dataChecksum);
|
||||
return SBL_ERROR;
|
||||
}
|
||||
|
||||
ui32MaxLen = bytesRecv;
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Are we connected to the device?
|
||||
*
|
||||
* \return
|
||||
* Returns true if connected to device.
|
||||
* Returns false if not connected to device.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
SblDevice::isConnected()
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
if (!m_pCom)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function generates the bootloader protocol checksum.
|
||||
*
|
||||
* \param[in] ui32Cmd
|
||||
* The bootloader command
|
||||
* \param[in] pcData
|
||||
* Pointer to the command data.
|
||||
* \param[in] ui32DataLen
|
||||
* Data length in bytes.
|
||||
*
|
||||
* \return
|
||||
* Returns the generated checksum.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint8_t
|
||||
SblDevice::generateCheckSum(uint32_t ui32Cmd, const char *pcData,
|
||||
uint32_t ui32DataLen)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
uint8_t ui8CheckSum = (uint8_t)ui32Cmd;
|
||||
for (uint32_t i = 0; i < ui32DataLen; i++)
|
||||
{
|
||||
ui8CheckSum += pcData[i];
|
||||
}
|
||||
return ui8CheckSum;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function sets the SBL status and the SBL error string.
|
||||
*
|
||||
* \param[in] ui32Status
|
||||
* The new SBL status. SBL_SUCCESS, SBL_ERROR, ...
|
||||
* \param[in] pcFormat
|
||||
* 'printf' like format string.
|
||||
* \param[in] ...
|
||||
* Input variables to the \e pcFormat string.
|
||||
*
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDevice::setState(const uint32_t &ui32Status, char *pcFormat, ...)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
va_list args;
|
||||
char text[2048];
|
||||
|
||||
m_lastSblStatus = ui32Status;
|
||||
|
||||
// Attempt to do a sanity check. Not possible to say how long
|
||||
// the formatted text will be, but if we reserve half the space for
|
||||
// formatted arguments it should be sufficient.
|
||||
if (strlen(pcFormat) > 2048 / 2) {
|
||||
return SBL_ERROR;
|
||||
}
|
||||
|
||||
va_start(args, pcFormat);
|
||||
#if 0
|
||||
vsprintf_s(text, pcFormat, args);
|
||||
#else
|
||||
vsprintf(text, pcFormat, args);
|
||||
#endif
|
||||
sm_csLastError = text;
|
||||
va_end(args);
|
||||
|
||||
if (SblDevice::sm_pStatusFunction != NULL)
|
||||
{
|
||||
bool error = (m_lastSblStatus == SBL_SUCCESS) ? false : true;
|
||||
sm_pStatusFunction((char *)sm_csLastError.c_str(), error);
|
||||
}
|
||||
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Utility function for converting 4 elements in char array into
|
||||
* 32 bit variable. Data are converted MSB, that is. \e pcSrc[0] is the
|
||||
* most significant byte.
|
||||
*
|
||||
* \param pcSrc[in]
|
||||
* A pointer to the source array.
|
||||
*
|
||||
* \return
|
||||
* Returns the 32 bit variable.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/*static */uint32_t
|
||||
SblDevice::charArrayToUL(const char *pcSrc)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
uint32_t ui32Val = (unsigned char)pcSrc[3];
|
||||
ui32Val += (((unsigned long)pcSrc[2]) & 0xFF) << 8;
|
||||
ui32Val += (((unsigned long)pcSrc[1]) & 0xFF) << 16;
|
||||
ui32Val += (((unsigned long)pcSrc[0]) & 0xFF) << 24;
|
||||
return (ui32Val);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Utility function for splitting 32 bit variable into char array
|
||||
* (4 elements). Data are converted MSB, that is, \e pcDst[0] is the
|
||||
* most significant byte.
|
||||
*
|
||||
* \param[in] ui32Src
|
||||
* The 32 bit variable to convert.
|
||||
*
|
||||
* \param[out] pcDst
|
||||
* Pointer to the char array where the data will be stored.
|
||||
*
|
||||
* \return
|
||||
* void
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/*static */void
|
||||
SblDevice::ulToCharArray(const uint32_t ui32Src, char *pcDst)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
// MSB first
|
||||
pcDst[0] = (uint8_t)(ui32Src >> 24);
|
||||
pcDst[1] = (uint8_t)(ui32Src >> 16);
|
||||
pcDst[2] = (uint8_t)(ui32Src >> 8);
|
||||
pcDst[3] = (uint8_t)(ui32Src >> 0);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Utility function for swapping the byte order of a 4B char array.
|
||||
*
|
||||
* \param[in|out] pcArray
|
||||
* The char array to byte swap.
|
||||
*
|
||||
* \return
|
||||
* void
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/*static */void
|
||||
SblDevice::byteSwap(char *pcArray)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
uint8_t tmp[2] = { (uint8_t)pcArray[0], (uint8_t)pcArray[1] };
|
||||
pcArray[0] = pcArray[3];
|
||||
pcArray[1] = pcArray[2];
|
||||
pcArray[2] = tmp[1];
|
||||
pcArray[3] = tmp[0];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This functions sets the SBL progress.
|
||||
*
|
||||
* \param[in] ui32Progress
|
||||
* The current progress, typically in percent [0-100].
|
||||
*
|
||||
* \return
|
||||
* void
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
/*static*/uint32_t
|
||||
SblDevice::setProgress(uint32_t ui32Progress)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
if (sm_pProgressFunction)
|
||||
{
|
||||
sm_pProgressFunction(ui32Progress);
|
||||
}
|
||||
|
||||
sm_progress = ui32Progress;
|
||||
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
#ifndef __SBL_DEVICE_H__
|
||||
#define __SBL_DEVICE_H__
|
||||
/******************************************************************************
|
||||
* Filename: sbl_device.h
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader device header file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "serialib.h"
|
||||
//
|
||||
// Typedefs for callback functions to report status and progress to application
|
||||
//
|
||||
typedef void (*tStatusFPTR)(char *pcText, bool bError);
|
||||
typedef void (*tProgressFPTR)(uint32_t ui32Value);
|
||||
|
||||
class SblDevice
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
~SblDevice();
|
||||
|
||||
// Static functions
|
||||
static SblDevice *Create(uint32_t ui32ChipType);
|
||||
virtual uint32_t connect(std::string csPortNum, uint32_t ui32BaudRate, bool bEnableXosc = false);
|
||||
virtual uint32_t ping() = 0;
|
||||
virtual uint32_t readStatus(uint32_t *pui32Status) = 0;
|
||||
virtual uint32_t readDeviceId(uint32_t *pui32DeviceId) = 0;
|
||||
virtual uint32_t readFlashSize(uint32_t *pui32FlashSize) = 0;
|
||||
virtual uint32_t readRamSize(uint32_t *pui32RamSize) = 0;
|
||||
virtual uint32_t run(uint32_t ui32Address) { (void)ui32Address; return SBL_UNSUPPORTED_FUNCTION; };
|
||||
virtual uint32_t reset() = 0;
|
||||
virtual uint32_t eraseFlashRange(uint32_t ui32StartAddress, uint32_t ui32ByteCount) { (void)ui32StartAddress; (void)ui32ByteCount; return 0; };
|
||||
virtual uint32_t writeFlashRange(uint32_t ui32StartAddress, uint32_t ui32ByteCount, const char *pcData) { (void)ui32StartAddress; (void)ui32ByteCount; (void)pcData; return 0; };
|
||||
virtual uint32_t readMemory32(uint32_t ui32StartAddress, uint32_t ui32UnitCount, uint32_t *pui32Data) = 0;
|
||||
virtual uint32_t readMemory8(uint32_t ui32StartAddress, uint32_t ui32UnitCount, char *pcData) = 0;
|
||||
virtual uint32_t writeMemory32(uint32_t ui32StartAddress, uint32_t ui32UnitCount, const uint32_t *pui32Data) = 0;
|
||||
virtual uint32_t writeMemory8(uint32_t ui32StartAddress, uint32_t ui32UnitCount, const char *pcData) = 0;
|
||||
virtual uint32_t calculateCrc32(uint32_t ui32StartAddress, uint32_t ui32ByteCount, uint32_t *pui32Crc) = 0;
|
||||
|
||||
// CC2650 specific
|
||||
virtual uint32_t eraseFlashBank(){ return SBL_UNSUPPORTED_FUNCTION; };
|
||||
virtual uint32_t setCCFG(uint32_t ui32Field, uint32_t ui32FieldValue) { (void)ui32Field; (void)ui32FieldValue; return SBL_UNSUPPORTED_FUNCTION; };
|
||||
|
||||
// CC2538 specific
|
||||
virtual uint32_t setXosc() { return SBL_UNSUPPORTED_FUNCTION; };
|
||||
|
||||
// Utility functions
|
||||
bool isConnected();
|
||||
uint32_t getDeviceId() { return m_deviceId; }
|
||||
uint32_t getFlashSize() { return m_flashSize; }
|
||||
uint32_t getRamSize() { return m_ramSize; }
|
||||
uint32_t getBaudRate() { return m_baudRate; }
|
||||
uint32_t getLastStatus() {return m_lastSblStatus; }
|
||||
uint32_t getLastDeviceStatus() { return m_lastDeviceStatus; }
|
||||
uint32_t getPageEraseSize() { return m_pageEraseSize; }
|
||||
static std::string &getLastError(void) { return sm_csLastError;}
|
||||
static uint32_t getProgress() { return sm_progress; }
|
||||
static uint32_t setProgress(uint32_t ui32Progress);
|
||||
static void setCallBackStatusFunction(tStatusFPTR pSf) {sm_pStatusFunction = pSf; }
|
||||
static void setCallBackProgressFunction(tProgressFPTR pPf) {sm_pProgressFunction = pPf; }
|
||||
|
||||
protected:
|
||||
// Constructor
|
||||
SblDevice();
|
||||
|
||||
virtual uint32_t initCommunication(bool bSetXosc) = 0;
|
||||
virtual uint32_t sendCmd(uint32_t ui32Cmd, const char *pcSendData = NULL, uint32_t ui32SendLen = 0) = 0;
|
||||
virtual uint32_t sendAutoBaud(bool &bBaudSetOk);
|
||||
virtual uint32_t getCmdResponse(bool &bAck, uint32_t ui32MaxRetries = SBL_DEFAULT_RETRY_COUNT, bool bQuiet = false);
|
||||
virtual uint32_t sendCmdResponse(bool bAck);
|
||||
virtual uint32_t getResponseData(char *pcData, uint32_t &ui32MaxLen, uint32_t ui32MaxRetries = SBL_DEFAULT_RETRY_COUNT);
|
||||
|
||||
virtual uint8_t generateCheckSum(uint32_t ui32Cmd, const char *pcData, uint32_t ui32DataLen);
|
||||
virtual uint32_t addressToPage(uint32_t ui32Address) = 0;
|
||||
virtual bool addressInRam(uint32_t ui32StartAddress, uint32_t ui32ByteCount = 1) = 0;
|
||||
virtual bool addressInFlash(uint32_t ui32StartAddress, uint32_t ui32ByteCount = 1) = 0;
|
||||
|
||||
virtual uint32_t getBootloaderEnableAddress() = 0;
|
||||
|
||||
uint32_t setState(const uint32_t &ui32Status) { m_lastSblStatus = ui32Status; return m_lastSblStatus;}
|
||||
uint32_t setState(const uint32_t &ui32Status, char *pcFormat, ...);
|
||||
|
||||
// Utility
|
||||
static uint32_t charArrayToUL(const char *pcSrc);
|
||||
static void ulToCharArray(const uint32_t ui32Src, char *pcDst);
|
||||
static void byteSwap(char *pcArray);
|
||||
|
||||
serialib *m_pCom;
|
||||
std::string m_csComPort;
|
||||
bool m_bCommInitialized;
|
||||
uint32_t m_baudRate;
|
||||
|
||||
static uint32_t sm_chipType;
|
||||
uint32_t m_deviceId;
|
||||
uint32_t m_flashSize;
|
||||
uint32_t m_ramSize;
|
||||
uint32_t m_pageEraseSize;
|
||||
|
||||
// Status and progress variables
|
||||
int32_t m_lastDeviceStatus;
|
||||
int32_t m_lastSblStatus;
|
||||
static uint32_t sm_progress;
|
||||
static std::string sm_csLastError;
|
||||
static tProgressFPTR sm_pProgressFunction;
|
||||
static tStatusFPTR sm_pStatusFunction;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif // __SBL_DEVICE_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,126 +0,0 @@
|
||||
#ifndef __SBL_DEVICE_CC2538_H__
|
||||
#define __SBL_DEVICE_CC2538_H__
|
||||
/******************************************************************************
|
||||
* Filename: sbl_device_cc2538.h
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader for CC2538 header file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <sbl_device.h>
|
||||
|
||||
//
|
||||
// For more information about the CC2538 serial bootloader interface,
|
||||
// please refer to the CC2538 ROM User's guide (http://www.ti.com/lit/swru333)
|
||||
//
|
||||
|
||||
#define SBL_CC2538_PAGE_ERASE_SIZE 2048
|
||||
#define SBL_CC2538_FLASH_START_ADDRESS 0x00200000
|
||||
#define SBL_CC2538_RAM_START_ADDRESS 0x20000000
|
||||
#define SBL_CC2538_ACCESS_WIDTH_4B 4
|
||||
#define SBL_CC2538_ACCESS_WIDTH_1B 1
|
||||
#define SBL_CC2538_PAGE_ERASE_TIME_MS 20
|
||||
#define SBL_CC2538_MAX_BYTES_PER_TRANSFER 252
|
||||
#define SBL_CC2538_DIECFG0 0x400D3014
|
||||
#define SBL_CC2538_BL_CONFIG_PAGE_OFFSET 2007
|
||||
#define SBL_CC2538_BL_CONFIG_ENABLED_BM 0x10
|
||||
|
||||
class SblDeviceCC2538 : public SblDevice
|
||||
{
|
||||
public:
|
||||
SblDeviceCC2538(); // Constructor
|
||||
~SblDeviceCC2538(); // Destructor
|
||||
|
||||
enum {
|
||||
CMD_PING = 0x20,
|
||||
CMD_DOWNLOAD = 0x21,
|
||||
CMD_RUN = 0x22,
|
||||
CMD_GET_STATUS = 0x23,
|
||||
CMD_SEND_DATA = 0x24,
|
||||
CMD_RESET = 0x25,
|
||||
CMD_ERASE = 0x26,
|
||||
CMD_CRC32 = 0x27,
|
||||
CMD_GET_CHIP_ID = 0x28,
|
||||
CMD_SET_XOSC = 0x29,
|
||||
CMD_MEMORY_READ = 0x2A,
|
||||
CMD_MEMORY_WRITE = 0x2B,
|
||||
};
|
||||
|
||||
enum {
|
||||
CMD_RET_SUCCESS = 0x40,
|
||||
CMD_RET_UNKNOWN_CMD = 0x41,
|
||||
CMD_RET_INVALID_CMD = 0x42,
|
||||
CMD_RET_INVALID_ADR = 0x43,
|
||||
CMD_RET_FLASH_FAIL = 0x44,
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
// Virtual functions from SblDevice
|
||||
uint32_t ping();
|
||||
|
||||
uint32_t readStatus(uint32_t *pui32Status);
|
||||
uint32_t readDeviceId(uint32_t *pui32DeviceId);
|
||||
uint32_t readFlashSize(uint32_t *pui32FlashSize);
|
||||
uint32_t readRamSize(uint32_t *pui32RamSize);
|
||||
|
||||
uint32_t run(uint32_t ui32Address);
|
||||
uint32_t reset();
|
||||
uint32_t eraseFlashRange(uint32_t ui32StartAddress, uint32_t ui32ByteCount);
|
||||
uint32_t writeFlashRange(uint32_t ui32StartAddress, uint32_t ui32ByteCount, const char *pcData);
|
||||
uint32_t readMemory32(uint32_t ui32StartAddress, uint32_t ui32UnitCount, uint32_t *pui32Data);
|
||||
uint32_t readMemory8(uint32_t ui32StartAddress, uint32_t ui32UnitCount, char *pcData);
|
||||
uint32_t writeMemory32(uint32_t ui32StartAddress, uint32_t ui32UnitCount, const uint32_t *pui32Data);
|
||||
uint32_t writeMemory8(uint32_t ui32StartAddress, uint32_t ui32UnitCount, const char *pcData);
|
||||
|
||||
uint32_t calculateCrc32(uint32_t ui32StartAddress, uint32_t ui32ByteCount, uint32_t *pui32Crc);
|
||||
|
||||
uint32_t sendCmd(uint32_t ui32Cmd, const char *pcSendData = NULL, uint32_t ui32SendLen = 0);
|
||||
uint32_t addressToPage(uint32_t ui32Address);
|
||||
bool addressInRam(uint32_t ui32StartAddress, uint32_t ui32ByteCount = 1);
|
||||
bool addressInFlash(uint32_t ui32StartAddress, uint32_t ui32ByteCount = 1);
|
||||
uint32_t setXosc();
|
||||
|
||||
private:
|
||||
uint32_t initCommunication(bool bSetXosc);
|
||||
uint32_t cmdDownload(uint32_t ui32Address, uint32_t ui32Size);
|
||||
uint32_t cmdSendData(const char *pcData, uint32_t ui32ByteCount);
|
||||
|
||||
uint32_t getBootloaderEnableAddress();
|
||||
|
||||
std::string getCmdString(uint32_t ui32Cmd);
|
||||
std::string getCmdStatusString(uint32_t ui32Status);
|
||||
};
|
||||
|
||||
#endif // __SBL_DEVICE_CC2538_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,153 +0,0 @@
|
||||
#ifndef __SBL_DEVICE_CC2650_H__
|
||||
#define __SBL_DEVICE_CC2650_H__
|
||||
/******************************************************************************
|
||||
* Filename: sbl_device_cc2650.h
|
||||
* Revised: $Date: 2013-07-26 09:53:42 +0200 (fr, 26 jul 2013) $
|
||||
* Revision: $Revision: 26971 $
|
||||
*
|
||||
* Description: Serial Bootloader for CC2650 header file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <sbl_device.h>
|
||||
|
||||
|
||||
#define SBL_CC2650_PAGE_ERASE_SIZE 4096
|
||||
#define SBL_CC2650_FLASH_START_ADDRESS 0x00000000
|
||||
#define SBL_CC2650_RAM_START_ADDRESS 0x20000000
|
||||
#define SBL_CC2650_ACCESS_WIDTH_32B 1
|
||||
#define SBL_CC2650_ACCESS_WIDTH_8B 0
|
||||
#define SBL_CC2650_PAGE_ERASE_TIME_MS 20
|
||||
#define SBL_CC2650_MAX_BYTES_PER_TRANSFER 252
|
||||
#define SBL_CC2650_MAX_MEMWRITE_BYTES 247
|
||||
#define SBL_CC2650_MAX_MEMWRITE_WORDS 61
|
||||
#define SBL_CC2650_MAX_MEMREAD_BYTES 253
|
||||
#define SBL_CC2650_MAX_MEMREAD_WORDS 63
|
||||
#define SBL_CC2650_FLASH_SIZE_CFG 0x4003002C
|
||||
#define SBL_CC2650_RAM_SIZE_CFG 0x40082250
|
||||
#define SBL_CC2650_BL_CONFIG_PAGE_OFFSET 0xFDB
|
||||
#define SBL_CC2650_BL_CONFIG_ENABLED_BM 0xC5
|
||||
#define SBL_CC2650_BL_WORK_MEMORY_START 0x20000000
|
||||
#define SBL_CC2650_BL_WORK_MEMORY_END 0x2000016F
|
||||
#define SBL_CC2650_BL_STACK_MEMORY_START 0x20000FC0
|
||||
#define SBL_CC2650_BL_STACK_MEMORY_END 0x20000FFF
|
||||
|
||||
class SblDeviceCC2650 : public SblDevice
|
||||
{
|
||||
public:
|
||||
SblDeviceCC2650(); // Constructor
|
||||
~SblDeviceCC2650(); // Destructor
|
||||
|
||||
enum {
|
||||
CMD_PING = 0x20,
|
||||
CMD_DOWNLOAD = 0x21,
|
||||
CMD_GET_STATUS = 0x23,
|
||||
CMD_SEND_DATA = 0x24,
|
||||
CMD_RESET = 0x25,
|
||||
CMD_SECTOR_ERASE = 0x26,
|
||||
CMD_CRC32 = 0x27,
|
||||
CMD_GET_CHIP_ID = 0x28,
|
||||
CMD_MEMORY_READ = 0x2A,
|
||||
CMD_MEMORY_WRITE = 0x2B,
|
||||
CMD_BANK_ERASE = 0x2C,
|
||||
CMD_SET_CCFG = 0x2D,
|
||||
};
|
||||
|
||||
/* Early samples had different command IDs */
|
||||
enum
|
||||
{
|
||||
REV1_CMD_BANK_ERASE = 0x2A,
|
||||
REV1_CMD_SET_CCFG = 0x2B,
|
||||
REV1_CMD_MEMORY_READ = 0x2C,
|
||||
REV1_CMD_MEMORY_WRITE = 0x2D,
|
||||
};
|
||||
|
||||
enum {
|
||||
CMD_RET_SUCCESS = 0x40,
|
||||
CMD_RET_UNKNOWN_CMD = 0x41,
|
||||
CMD_RET_INVALID_CMD = 0x42,
|
||||
CMD_RET_INVALID_ADR = 0x43,
|
||||
CMD_RET_FLASH_FAIL = 0x44,
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
// Virtual functions from SblDevice
|
||||
uint32_t ping();
|
||||
|
||||
uint32_t readStatus(uint32_t *pui32Status);
|
||||
uint32_t readDeviceId(uint32_t *pui32DeviceId);
|
||||
virtual uint32_t readFlashSize(uint32_t *pui32FlashSize);
|
||||
virtual uint32_t readRamSize(uint32_t *pui32RamSize);
|
||||
|
||||
uint32_t reset();
|
||||
uint32_t eraseFlashRange(uint32_t ui32StartAddress, uint32_t ui32ByteCount);
|
||||
uint32_t writeFlashRange(uint32_t ui32StartAddress, uint32_t ui32ByteCount, const char *pcData);
|
||||
|
||||
|
||||
uint32_t readMemory32(uint32_t ui32StartAddress, uint32_t ui32UnitCount, uint32_t *pui32Data);
|
||||
uint32_t readMemory8(uint32_t ui32StartAddress, uint32_t ui32UnitCount, char *pcData);
|
||||
uint32_t writeMemory32(uint32_t ui32StartAddress, uint32_t ui32UnitCount, const uint32_t *pui32Data);
|
||||
uint32_t writeMemory8(uint32_t ui32StartAddress, uint32_t ui32UnitCount, const char *pcData);
|
||||
|
||||
uint32_t calculateCrc32(uint32_t ui32StartAddress, uint32_t ui32ByteCount, uint32_t *pui32Crc);
|
||||
|
||||
uint32_t sendCmd(uint32_t ui32Cmd, const char *pcSendData = NULL, uint32_t ui32SendLen = 0);
|
||||
std::string getCmdString(uint32_t ui32Cmd);
|
||||
uint32_t addressToPage(uint32_t ui32Address);
|
||||
bool addressInRam(uint32_t ui32StartAddress, uint32_t ui32ByteCount = 1);
|
||||
bool addressInFlash(uint32_t ui32StartAddress, uint32_t ui32ByteCount = 1);
|
||||
|
||||
uint32_t convertCmdForEarlySamples(uint32_t ui32Cmd);
|
||||
|
||||
virtual uint32_t getBootloaderEnableAddress();
|
||||
|
||||
// CC2650 specific
|
||||
uint32_t eraseFlashBank();
|
||||
uint32_t setCCFG(uint32_t ui32Field, uint32_t ui32FieldValue);
|
||||
|
||||
// Device revision. Used internally by SBL to handle early samples with different command IDs.
|
||||
uint32_t m_deviceRev;
|
||||
private:
|
||||
uint32_t initCommunication(bool bSetXosc);
|
||||
uint32_t cmdDownload(uint32_t ui32Address, uint32_t ui32Size);
|
||||
uint32_t cmdSendData(const char *pcData, uint32_t ui32ByteCount);
|
||||
|
||||
std::string getCmdStatusString(uint32_t ui32Status);
|
||||
|
||||
bool addressInBLWorkMemory(uint32_t ui32StartAddr, uint32_t ui32ByteCount = 1);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __SBL_DEVICE_CC2650_H__
|
||||
@@ -1,330 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Filename: sbl_device_cc2652.cpp
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader device file for CC13x2/CC26x2
|
||||
*
|
||||
* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <sbllib.h>
|
||||
#include "sbl_device.h"
|
||||
#include "sbl_device_cc2652.h"
|
||||
|
||||
#include "serialib.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Constructor
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
SblDeviceCC2652::SblDeviceCC2652() : SblDeviceCC2650()
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
m_pageEraseSize = SBL_CC2652_PAGE_ERASE_SIZE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Destructor
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
SblDeviceCC2652::~SblDeviceCC2652()
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function reads device FLASH size in bytes.
|
||||
*
|
||||
* \param[out] pui32FlashSize
|
||||
* Pointer to where FLASH size is stored.
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDeviceCC2652::readFlashSize(uint32_t *pui32FlashSize)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
uint32_t retCode = SBL_SUCCESS;
|
||||
|
||||
//
|
||||
// Read CC2652 DIECFG0 (contains FLASH size information)
|
||||
//
|
||||
uint32_t addr = SBL_CC2652_FLASH_SIZE_CFG;
|
||||
uint32_t value;
|
||||
if ((retCode = readMemory32(addr, 1, &value)) != SBL_SUCCESS)
|
||||
{
|
||||
setState((tSblStatus)retCode, "Failed to read device FLASH size: %s", getLastError().c_str());
|
||||
return retCode;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate flash size (The number of flash sectors are at bits [7:0])
|
||||
//
|
||||
value &= 0xFF;
|
||||
*pui32FlashSize = value*SBL_CC2652_PAGE_ERASE_SIZE;
|
||||
|
||||
m_flashSize = *pui32FlashSize;
|
||||
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function reads device RAM size in bytes.
|
||||
*
|
||||
* \param[out] pui32RamSize
|
||||
* Pointer to where RAM size is stored.
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDeviceCC2652::readRamSize(uint32_t *pui32RamSize)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
int retCode = SBL_SUCCESS;
|
||||
|
||||
uint32_t addr = SBL_CC2652_RAM_SIZE_CFG;
|
||||
uint32_t value;
|
||||
|
||||
if ((retCode = readMemory32(addr, 1, &value)) != SBL_SUCCESS)
|
||||
{
|
||||
setState(retCode, "Failed to read device RAM size: %s", getLastError().c_str());
|
||||
return retCode;
|
||||
}
|
||||
|
||||
uint32_t ramSizeInfo = (value & CHIP_SRAM_SIZE_INFO_M) >> CHIP_SRAM_SIZE_INFO_S;
|
||||
|
||||
m_ramSize = calculateRamSize(ramSizeInfo);
|
||||
|
||||
if (*pui32RamSize != NULL)
|
||||
{
|
||||
*pui32RamSize = m_ramSize;
|
||||
}
|
||||
|
||||
return retCode;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Calculate RAM size.
|
||||
*
|
||||
* \param[in] ramSizeInfo
|
||||
* Register value for RAM size configuration (TOP:PRCM:RAMHWOPT).
|
||||
* The argument is optional and the default value is 3 (RAM size 80 KB)
|
||||
* \returns uint32_t
|
||||
* Ram size
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t SblDeviceCC2652::calculateRamSize(uint32_t ramSizeInfo)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
uint32_t ramSize;
|
||||
|
||||
switch (ramSizeInfo)
|
||||
{
|
||||
case 0:
|
||||
ramSize = (32 * 1024);
|
||||
break;
|
||||
case 1:
|
||||
ramSize = (48 * 1024);
|
||||
break;
|
||||
case 2:
|
||||
ramSize = (64 * 1024);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
ramSize = (80 * 1024);
|
||||
break;
|
||||
}
|
||||
|
||||
return ramSize;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function returns the FLASH address of the bootloader enable
|
||||
* configuration.
|
||||
*
|
||||
* \return
|
||||
* Returns true if the address/range is within the device RAM.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t SblDeviceCC2652::getBootloaderEnableAddress()
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
return SBL_CC2652_FLASH_START_ADDRESS + getFlashSize() - getPageEraseSize() + SBL_CC2652_BL_CONFIG_PAGE_OFFSET;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function returns a string with the device command name of
|
||||
* \e ui32Cmd.
|
||||
*
|
||||
* \param[out] ui32Cmd
|
||||
* The serial bootloader command.
|
||||
* \return
|
||||
* Returns std::string with name of device command.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
std::string
|
||||
SblDeviceCC2652::getCmdString(uint32_t ui32Cmd)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
std::string cmd = SblDeviceCC2650::getCmdString(ui32Cmd);
|
||||
if (cmd.find("Unknown") != std::string::npos)
|
||||
{
|
||||
switch (ui32Cmd)
|
||||
{
|
||||
case SblDeviceCC2652::CMD_DOWNLOAD_CRC: cmd = "CMD_DOWNLOAD_CRC"; break;
|
||||
default: cmd = "Unknown command"; break;
|
||||
}
|
||||
}
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief This function sends the CC2652 download CRC command and handles the
|
||||
* device response.
|
||||
*
|
||||
* \param[in] ui32Address
|
||||
* The start address in CC2652 flash.
|
||||
* \param[in] ui32Size
|
||||
* Number of bytes to be sent.
|
||||
* \param[in] ui32Crc
|
||||
* Total number of bytes to be programmed.
|
||||
*
|
||||
* \return
|
||||
* Returns SBL_SUCCESS if command and response was successful.
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t SblDeviceCC2652::cmdDownloadCrc(uint32_t ui32Address, uint32_t ui32Size, uint32_t ui32Crc)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
int retCode = SBL_SUCCESS;
|
||||
bool bSuccess = false;
|
||||
|
||||
//
|
||||
// Check input arguments
|
||||
//
|
||||
if (!addressInFlash(ui32Address, ui32Size) &&
|
||||
!addressInRam(ui32Address, ui32Size))
|
||||
{
|
||||
setState(SBL_ARGUMENT_ERROR, "Specified address range (0x%08X + %d bytes) is not in device FLASH nor RAM.\n", ui32Address, ui32Size);
|
||||
return SBL_ARGUMENT_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Generate payload
|
||||
// - 4B Program address
|
||||
// - 4B Program data
|
||||
// - 4B CRC
|
||||
//
|
||||
char pcPayload[12];
|
||||
ulToCharArray(ui32Address, &pcPayload[0]);
|
||||
ulToCharArray(ui32Size, &pcPayload[4]);
|
||||
ulToCharArray(ui32Crc, &pcPayload[8]);
|
||||
|
||||
//
|
||||
// Send command
|
||||
//
|
||||
if ((retCode = sendCmd(SblDeviceCC2652::CMD_DOWNLOAD_CRC, pcPayload, 12) != SBL_SUCCESS))
|
||||
{
|
||||
return retCode;
|
||||
}
|
||||
|
||||
//
|
||||
// Receive command response (ACK/NAK)
|
||||
//
|
||||
if ((retCode = getCmdResponse(bSuccess)) != SBL_SUCCESS)
|
||||
{
|
||||
return retCode;
|
||||
}
|
||||
|
||||
//
|
||||
// Return command response
|
||||
//
|
||||
return (bSuccess) ? SBL_SUCCESS : SBL_ERROR;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** \brief Send command.
|
||||
*
|
||||
* \param[in] ui32Cmd
|
||||
* The command to send.
|
||||
* \param[in] pcSendData
|
||||
* Pointer to the data to send with the command.
|
||||
* \param[in] ui32SendLen
|
||||
* The number of bytes to send from \e pcSendData.
|
||||
* \return
|
||||
* Returns SBL_SUCCESS, ...
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
uint32_t
|
||||
SblDeviceCC2652::sendCmd(uint32_t ui32Cmd, const char *pcSendData/* = NULL*/,
|
||||
uint32_t ui32SendLen/* = 0*/)
|
||||
{
|
||||
DEBUG_PRINT("\n");
|
||||
unsigned char pktLen = ui32SendLen + 3; // +3 => <1B Length>, <1B checksum>, <1B cmd>
|
||||
std::vector<char> pvPkt((pktLen));
|
||||
unsigned char pktSum = generateCheckSum(ui32Cmd, pcSendData, ui32SendLen);
|
||||
|
||||
//
|
||||
// Build packet
|
||||
//
|
||||
pvPkt.at(0) = pktLen;
|
||||
pvPkt.at(1) = pktSum;
|
||||
pvPkt.at(2) = (unsigned char)ui32Cmd;
|
||||
if (ui32SendLen)
|
||||
{
|
||||
memcpy(&pvPkt[3], pcSendData, ui32SendLen);
|
||||
}
|
||||
|
||||
//
|
||||
// Send packet
|
||||
//
|
||||
if (m_pCom->writeBytes(&pvPkt[0], pvPkt.size()) < 1)
|
||||
{
|
||||
setState(SBL_PORT_ERROR, "\nWriting to device failed (Command 0x%04x:'%s').\n", ui32Cmd,getCmdString(ui32Cmd).c_str());
|
||||
return SBL_PORT_ERROR;
|
||||
}
|
||||
//
|
||||
// Empty and deallocate vector
|
||||
//
|
||||
pvPkt.clear();
|
||||
std::vector<char>().swap(pvPkt);
|
||||
|
||||
return SBL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
#ifndef __SBL_DEVICE_CC2652_H__
|
||||
#define __SBL_DEVICE_CC2652_H__
|
||||
/******************************************************************************
|
||||
* Filename: sbl_device_cc2652.h
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader for CC13x2/CC26x2 header file.
|
||||
*
|
||||
* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "sbl_device_cc2650.h"
|
||||
|
||||
#define SBL_CC2652_PAGE_ERASE_SIZE 8192
|
||||
#define SBL_CC2652_FLASH_SIZE_CFG 0x4003002C
|
||||
#define SBL_CC2652_RAM_SIZE_CFG 0x40082250
|
||||
#define SBL_CC2652_RAM_SIZE_CFG 0x40082250
|
||||
#define SBL_CC2652_FLASH_START_ADDRESS SBL_CC2650_FLASH_START_ADDRESS
|
||||
#define SBL_CC2652_BL_CONFIG_PAGE_OFFSET 0x1FDB
|
||||
|
||||
#define CHIP_SRAM_SIZE_INFO 0x40082250
|
||||
#define CHIP_SRAM_SIZE_INFO_M 0x00000003
|
||||
#define CHIP_SRAM_SIZE_INFO_S 0
|
||||
|
||||
class SblDeviceCC2652 : public SblDeviceCC2650
|
||||
{
|
||||
public:
|
||||
SblDeviceCC2652(); // Constructor
|
||||
~SblDeviceCC2652(); // Destructor
|
||||
|
||||
enum {
|
||||
CMD_DOWNLOAD_CRC = 0x2F,
|
||||
};
|
||||
|
||||
protected:
|
||||
uint32_t readFlashSize(uint32_t *pui32FlashSize);
|
||||
uint32_t readRamSize(uint32_t *pui32RamSize);
|
||||
uint32_t calculateRamSize(uint32_t ramSizeInfo);
|
||||
uint32_t getBootloaderEnableAddress();
|
||||
|
||||
private:
|
||||
std::string getCmdString(uint32_t ui32Cmd);
|
||||
uint32_t sendCmd(uint32_t ui32Cmd, const char *pcSendData = NULL, uint32_t ui32SendLen = 0);
|
||||
uint32_t cmdDownloadCrc(uint32_t ui32Address, uint32_t ui32Size, uint32_t uiCrc);
|
||||
|
||||
};
|
||||
|
||||
#endif // __SBL_DEVICE_CC2652_H__
|
||||
@@ -1,66 +0,0 @@
|
||||
#ifndef __SBL_EB_INFO_H__
|
||||
#define __SBL_EB_INFO_H__
|
||||
/******************************************************************************
|
||||
* Filename: sbl_eb_info.h
|
||||
* Revised: $Date: 2013-07-09 15:06:47 +0200 (Tue, 09 Jul 2013) $
|
||||
* Revision: $Revision: 26800 $
|
||||
*
|
||||
* Description: Serial Bootloader EB info class header file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <string.h>
|
||||
|
||||
class SblEbInfo
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
DEVICE_NAME_SIZE = 15,
|
||||
EB_PORT_SIZE = 16,
|
||||
DESCRIPTION_SIZE = 256
|
||||
};
|
||||
|
||||
char ebPort[EB_PORT_SIZE]; // E.g. COM42
|
||||
char ebDescription[DESCRIPTION_SIZE];
|
||||
char devName[DEVICE_NAME_SIZE]; // E.g. CC2538 for CC2650
|
||||
|
||||
SblEbInfo& operator = (const SblEbInfo& other) {
|
||||
strncpy(ebPort, other.ebPort, EB_PORT_SIZE);
|
||||
strncpy(ebDescription, other.ebDescription, DESCRIPTION_SIZE);
|
||||
strncpy(devName, other.devName, DEVICE_NAME_SIZE);
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // __SBL_EB_INFO_H__
|
||||
@@ -1,39 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Filename: sbllib.cpp
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader Library main file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#ifndef __SBLLIB_H__
|
||||
#define __SBLLIB_H__
|
||||
/******************************************************************************
|
||||
* Filename: sbllib.h
|
||||
* Revised: $Date$
|
||||
* Revision: $Revision$
|
||||
*
|
||||
* Description: Serial Bootloader Library header file.
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "debug.h"
|
||||
#define SBL_MAX_DEVICES 20
|
||||
#define SBL_DEFAULT_RETRY_COUNT 1
|
||||
#define SBL_DEFAULT_READ_TIMEOUT 100 // in ms
|
||||
#define SBL_DEFAULT_WRITE_TIMEOUT 200 // in ms
|
||||
|
||||
typedef enum {
|
||||
SBL_SUCCESS = 0,
|
||||
SBL_ERROR,
|
||||
SBL_ARGUMENT_ERROR,
|
||||
SBL_TIMEOUT_ERROR,
|
||||
SBL_PORT_ERROR,
|
||||
SBL_ENUM_ERROR,
|
||||
SBL_UNSUPPORTED_FUNCTION,
|
||||
} tSblStatus;
|
||||
|
||||
#include "serialib.h"
|
||||
#include "sbl_device.h"
|
||||
#include "sbl_device_cc2538.h"
|
||||
#include "sbl_device_cc2650.h"
|
||||
#include "sbl_device_cc2652.h"
|
||||
#include "sbl_eb_info.h"
|
||||
|
||||
|
||||
|
||||
#endif // __SBLLIB_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,220 +0,0 @@
|
||||
/*!
|
||||
\file serialib.h
|
||||
\brief Header file of the class serialib. This class is used for communication over a serial device.
|
||||
\author Philippe Lucidarme (University of Angers)
|
||||
\version 2.0
|
||||
\date december the 27th of 2019
|
||||
This Serial library is used to communicate through serial port.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
This is a licence-free software, it can be used by anyone who try to build a better world.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SERIALIB_H
|
||||
#define SERIALIB_H
|
||||
|
||||
|
||||
|
||||
// Used for TimeOut operations
|
||||
#include <sys/time.h>
|
||||
// Include for windows
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
// Accessing to the serial port under Windows
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
// Include for Linux
|
||||
#ifdef __linux__
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/shm.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
// File control definitions
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
|
||||
/*! To avoid unused parameters */
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
||||
|
||||
/*! \class serialib
|
||||
\brief This class is used for communication over a serial device.
|
||||
*/
|
||||
class serialib
|
||||
{
|
||||
public:
|
||||
|
||||
//_____________________________________
|
||||
// ::: Constructors and destructors :::
|
||||
|
||||
|
||||
|
||||
// Constructor of the class
|
||||
serialib ();
|
||||
|
||||
// Destructor
|
||||
~serialib ();
|
||||
|
||||
|
||||
|
||||
//_________________________________________
|
||||
// ::: Configuration and initialization :::
|
||||
|
||||
|
||||
// Open a device
|
||||
char openDevice (const char *Device,const unsigned int Bauds);
|
||||
|
||||
// Close the current device
|
||||
void closeDevice();
|
||||
|
||||
|
||||
|
||||
|
||||
//___________________________________________
|
||||
// ::: Read/Write operation on characters :::
|
||||
|
||||
|
||||
// Write a char
|
||||
char writeChar (char);
|
||||
|
||||
// Read a char (with timeout)
|
||||
char readChar (char *pByte,const unsigned int timeOut_ms=0);
|
||||
|
||||
|
||||
|
||||
|
||||
//________________________________________
|
||||
// ::: Read/Write operation on strings :::
|
||||
|
||||
|
||||
// Write a string
|
||||
char writeString (const char *String);
|
||||
|
||||
// Read a string (with timeout)
|
||||
int readString ( char *receivedString,
|
||||
char finalChar,
|
||||
unsigned int maxNbBytes,
|
||||
const unsigned int timeOut_ms=0);
|
||||
|
||||
|
||||
|
||||
// _____________________________________
|
||||
// ::: Read/Write operation on bytes :::
|
||||
|
||||
|
||||
// Write an array of bytes
|
||||
int writeBytes (const void *Buffer, const unsigned int NbBytes);
|
||||
|
||||
// Read an array of byte (with timeout)
|
||||
int readBytes (void *buffer,unsigned int maxNbBytes,const unsigned int timeOut_ms=100, unsigned int sleepDuration_us=100);
|
||||
|
||||
|
||||
|
||||
|
||||
// _________________________
|
||||
// ::: Special operation :::
|
||||
|
||||
|
||||
// Empty the received buffer
|
||||
char flushReceiver();
|
||||
|
||||
// Return the number of bytes in the received buffer
|
||||
int available();
|
||||
|
||||
|
||||
|
||||
|
||||
// _________________________
|
||||
// ::: Access to IO bits :::
|
||||
|
||||
|
||||
// Set CTR status (Data Terminal Ready, pin 4)
|
||||
bool DTR(bool status);
|
||||
bool setDTR();
|
||||
bool clearDTR();
|
||||
|
||||
// Set RTS status (Request To Send, pin 7)
|
||||
bool RTS(bool status);
|
||||
bool setRTS();
|
||||
bool clearRTS();
|
||||
|
||||
// Get RI status (Ring Indicator, pin 9)
|
||||
bool isRI();
|
||||
|
||||
// Get DCD status (Data Carrier Detect, pin 1)
|
||||
bool isDCD();
|
||||
|
||||
// Get CTS status (Clear To Send, pin 8)
|
||||
bool isCTS();
|
||||
|
||||
// Get DSR status (Data Set Ready, pin 9)
|
||||
bool isDSR();
|
||||
|
||||
// Get RTS status (Request To Send, pin 7)
|
||||
bool isRTS();
|
||||
|
||||
// Get CTR status (Data Terminal Ready, pin 4)
|
||||
bool isDTR();
|
||||
|
||||
|
||||
private:
|
||||
// Read a string (no timeout)
|
||||
int readStringNoTimeOut (char *String,char FinalChar,unsigned int MaxNbBytes);
|
||||
|
||||
// Current DTR and RTS state (can't be read on WIndows)
|
||||
bool currentStateRTS;
|
||||
bool currentStateDTR;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined (_WIN32) || defined( _WIN64)
|
||||
// Handle on serial device
|
||||
HANDLE hSerial;
|
||||
// For setting serial port timeouts
|
||||
COMMTIMEOUTS timeouts;
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
int fd;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*! \class timeOut
|
||||
\brief This class can manage a timer which is used as a timeout.
|
||||
*/
|
||||
// Class timeOut
|
||||
class timeOut
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
timeOut();
|
||||
|
||||
// Init the timer
|
||||
void initTimer();
|
||||
|
||||
// Return the elapsed time since initialization
|
||||
unsigned long int elapsedTime_ms();
|
||||
|
||||
private:
|
||||
// Used to store the previous time (for computing timeout)
|
||||
struct timeval previousTime;
|
||||
};
|
||||
|
||||
#endif // serialib_H
|
||||
@@ -1,162 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bluez
|
||||
PKG_VERSION:=5.37
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/bluetooth/
|
||||
PKG_MD5SUM:=33177e5743e24b2b3738f72be64e3ffb
|
||||
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/bluez/Default
|
||||
TITLE:=Bluetooth
|
||||
URL:=http://www.bluez.org/
|
||||
endef
|
||||
|
||||
define Package/bluez-examples
|
||||
$(call Package/bluez/Default)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE+= python example apps
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/bluez-examples/description
|
||||
contains many examples apps for bluetooth, requiring python
|
||||
endef
|
||||
|
||||
define Package/bluez-libs
|
||||
$(call Package/bluez/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE+= library
|
||||
DEPENDS:=+libpthread +kmod-bluetooth
|
||||
endef
|
||||
|
||||
define Package/bluez-utils
|
||||
$(call Package/bluez/Default)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE+= utilities
|
||||
DEPENDS:=+bluez-libs +libpthread +librt +glib2 +libncurses +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/bluez-daemon
|
||||
$(call Package/bluez/Default)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE+= daemon
|
||||
DEPENDS:=+bluez-libs +bluez-utils +dbus +libical $(INTL_DEPENDS) $(ICONV_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/bluez-daemon/conffiles
|
||||
/etc/bluetooth/main.conf
|
||||
/etc/bluetooth/network.conf
|
||||
/etc/bluetooth/input.conf
|
||||
/etc/bluetooth/proximity.conf
|
||||
/etc/config/bluetooth
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-static \
|
||||
--enable-shared \
|
||||
--enable-client \
|
||||
--enable-datafiles \
|
||||
--enable-experimental \
|
||||
--enable-library \
|
||||
--enable-monitor \
|
||||
--enable-obex \
|
||||
--enable-threads \
|
||||
--enable-tools \
|
||||
--disable-android \
|
||||
--disable-cups \
|
||||
--disable-manpages \
|
||||
--disable-sixaxis \
|
||||
--disable-systemd \
|
||||
--disable-test \
|
||||
--disable-udev \
|
||||
|
||||
TARGET_CPPFLAGS += \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/bluetooth $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.{a,so*} $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/bluez.pc $(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/bluez-examples/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/bluez
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/test/* $(1)/usr/bin/bluez/
|
||||
endef
|
||||
|
||||
define Package/bluez-libs/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/bluez-utils/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/bccmd $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/bluemoon $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/btmon $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/tools/btmgmt $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ciptool $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/hciattach $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/hciconfig $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/hcidump $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/hcitool $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/hex2hcd $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/l2ping $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/l2test $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/rctest $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/rfcomm $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/sdptool $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/attrib/gatttool $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/bluez-daemon/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/bluetoothd $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/bluetoothctl $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/obexd $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/bluetooth.config $(1)/etc/config/bluetooth
|
||||
$(INSTALL_DIR) $(1)/etc/dbus-1/system.d/
|
||||
$(INSTALL_DATA) ./files/bluetooth.dbus $(1)/etc/dbus-1/system.d/bluetooth.conf
|
||||
$(INSTALL_DIR) $(1)/etc/bluetooth
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/main.conf $(1)/etc/bluetooth/main.conf
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/network/network.conf $(1)/etc/bluetooth/network.conf
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/input/input.conf $(1)/etc/bluetooth/input.conf
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/profiles/proximity/proximity.conf $(1)/etc/bluetooth/proximity.conf
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/bluetoothd.init $(1)/etc/init.d/bluetoothd
|
||||
$(INSTALL_BIN) ./files/bluez-bccmd.init $(1)/etc/init.d/bluez-bccmd
|
||||
$(INSTALL_DIR) $(1)/etc/bluetooth
|
||||
$(INSTALL_DATA) ./files/csr8x11-a12-bt4.2-patch.psr $(1)/etc/bluetooth/
|
||||
$(INSTALL_DATA) ./files/csr8x11-coex.psr $(1)/etc/bluetooth/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bluez-examples))
|
||||
$(eval $(call BuildPackage,bluez-libs))
|
||||
$(eval $(call BuildPackage,bluez-utils))
|
||||
$(eval $(call BuildPackage,bluez-daemon))
|
||||
@@ -1,15 +0,0 @@
|
||||
config bluetoothd
|
||||
# option config /etc/bluetooth/main.conf
|
||||
option enabled 1
|
||||
|
||||
config hciattach
|
||||
option initspeed 115200
|
||||
option tty ttyS1
|
||||
option type csr
|
||||
option speed 115200
|
||||
option flow noflow
|
||||
option enabled 0
|
||||
|
||||
config rfcomm
|
||||
# option config /etc/bluetooth/rfcomm.conf
|
||||
option enabled 0
|
||||
@@ -1,37 +0,0 @@
|
||||
<!-- This configuration file specifies the required security policies
|
||||
for Bluetooth core daemon to work. -->
|
||||
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
|
||||
<!-- ../system.conf have denied everything, so we just punch some holes -->
|
||||
|
||||
<policy user="root">
|
||||
<allow own="org.bluez"/>
|
||||
</policy>
|
||||
|
||||
<policy at_console="true">
|
||||
<allow send_path="/"/>
|
||||
<allow send_path="/org/bluez"/>
|
||||
|
||||
<allow send_destination="org.bluez.Manager"/>
|
||||
<allow receive_sender="org.bluez.Manager"/>
|
||||
|
||||
<allow send_destination="org.bluez.Adapter"/>
|
||||
<allow receive_sender="org.bluez.Adapter"/>
|
||||
|
||||
<allow send_destination="org.bluez.Device"/>
|
||||
<allow receive_sender="org.bluez.Device"/>
|
||||
|
||||
<allow send_destination="org.bluez.Service"/>
|
||||
<allow receive_sender="org.bluez.Service"/>
|
||||
|
||||
<allow send_destination="org.bluez.Database"/>
|
||||
<allow receive_sender="org.bluez.Database"/>
|
||||
|
||||
<allow send_destination="org.bluez.Security"/>
|
||||
<allow receive_sender="org.bluez.Security"/>
|
||||
</policy>
|
||||
|
||||
</busconfig>
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
|
||||
#start after dbus (60)
|
||||
START=62
|
||||
USE_PROCD=1
|
||||
PROG=/usr/bin/bluetoothd
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" -n
|
||||
procd_close_instance
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
. /lib/ar71xx.sh
|
||||
|
||||
START=63
|
||||
|
||||
bt_up(){
|
||||
hciconfig hci0 up
|
||||
|
||||
count=5
|
||||
while [ $count -gt 0 ]
|
||||
do
|
||||
if hciconfig hci0 lestates >/dev/null; then
|
||||
break;
|
||||
fi
|
||||
let count=$count-1
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ $count -eq 0 ];then
|
||||
echo "Failed to enable hci0" >> /tmp/log/bccmd
|
||||
fi
|
||||
}
|
||||
|
||||
bccmd_init_csr8x11() {
|
||||
bt_up
|
||||
bccmd -t hci -d hci0 psload /etc/bluetooth/csr8x11-a12-bt4.2-patch.psr
|
||||
bccmd -t hci -d hci0 psload /etc/bluetooth/csr8x11-coex.psr
|
||||
bccmd -t hci -d hci0 warmreset
|
||||
bt_up
|
||||
}
|
||||
|
||||
start() {
|
||||
board_name=$(ar71xx_board_name)
|
||||
|
||||
case "$board_name" in
|
||||
cus531mp3|\
|
||||
cus531mp3-dual|\
|
||||
cus531mp3-nand)
|
||||
bccmd_init_csr8x11
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
// explicit, PSKEY_HCI_LMP_LOCAL_VERSION (0x010d, 269), 1 words
|
||||
&010d = 0808
|
||||
|
||||
// explicit, PSKEY_LMP_REMOTE_VERSION (0x010e, 270), 1 words
|
||||
&010e = 0008
|
||||
|
||||
// patch_hardware_0, PSKEY_PATCH50 (0x212c, 8492), 56 words
|
||||
&212c = 0000 f001 0617 0513 0118 ff2b ff0e 1a00 2818 009e 081b f100 8888 24f0 f925 f821 0a17 0184 0cf0 0117 0013 0009 02a4 fb25 fa21 f915 f811 fb55 fa61 09e0 ff84 10f0 0117 0013 0009 02a4 f935 f841 f925 f821 0f1b 0712 10a4 0494 0712 e151 0722 f915 f811 0018 ff2b ff0e f000 0518 00e2 5a79
|
||||
|
||||
// patch_hardware_1, PSKEY_PATCH51 (0x212d, 8493), 21 words
|
||||
&212d = 0002 968a 0863 f925 f821 0757 0663 e099 02ec 05e0 f915 0727 f815 0627 0218 ff2b ff0e 9700 8d18 00e2 7e34
|
||||
|
||||
// patch_hardware_2, PSKEY_PATCH52 (0x212e, 8494), 16 words
|
||||
&212e = 0002 0b5a 0100 7834 0040 0327 0223 f815 e311 0218 ff2b ff0e 0b00 5e18 00e2 59c1
|
||||
|
||||
// patch_hardware_3, PSKEY_PATCH53 (0x212f, 8495), 17 words
|
||||
&212f = 0000 7315 0084 04f0 0800 0014 03e0 f800 1215 0b27 0018 ff2b ff0e 7300 1818 00e2 0549
|
||||
|
||||
// patch_hardware_4, PSKEY_PATCH54 (0x2130, 8496), 21 words
|
||||
&2130 = 0001 53f8 0817 0e27 0c00 6384 07f0 0118 ff2b ff0e 5400 0918 00e2 0917 0118 ff2b ff0e 5400 fb18 00e2 91f6
|
||||
|
||||
// patch_hardware_5, PSKEY_PATCH55 (0x2131, 8497), 49 words
|
||||
&2131 = 0002 c0d5 0423 05f4 031b 0012 0280 1df0 021b 0916 1000 00c4 1ef0 0916 03c4 1bf4 031b 0012 0280 17f4 0380 15f4 0480 13f4 0580 11f4 0680 0ff4 0b80 0df4 0d80 0bf4 019c fb00 6719 0d9e 0218 ff2b ff0e c200 8c18 00e2 0218 ff2b ff0e c100 de18 00e2 c5cf
|
||||
|
||||
// patch_hardware_6, PSKEY_PATCH56 (0x2132, 8498), 42 words
|
||||
&2132 = 0003 243f f40b 0827 0923 e019 0916 01b4 0926 0318 ff2b ff0e 2400 4218 00e2 fa0b 3d14 0327 0114 0227 0014 0127 0027 081b 0816 0218 ff2b ff0e f700 fd18 009e e111 081b 0816 0218 ff2b ff0e 3300 ff18 009e fa0f 40f2
|
||||
|
||||
// patch_hardware_7, PSKEY_PATCH57 (0x2133, 8499), 23 words
|
||||
&2133 = 0003 254e 02c0 0916 1000 00c4 02f4 02b0 0916 fec4 e1b1 0922 0816 0318 ff2b ff0e 2500 5218 8000 00c0 08f2 00e2 e402
|
||||
|
||||
// patch_hardware_8, PSKEY_PATCH58 (0x2134, 8500), 16 words
|
||||
&2134 = 0003 21ca fa0b 0227 0323 e019 0916 01b4 0926 0318 ff2b ff0e 2200 cd18 00e2 22dc
|
||||
|
||||
// patch_hardware_9, PSKEY_PATCH59 (0x2135, 8501), 18 words
|
||||
&2135 = 0000 55e2 09f4 0218 ff2b ff0e 2c00 a718 009e 0314 fc0f 0018 ff2b ff0e 5600 0118 00e2 a008
|
||||
|
||||
// patch_hardware_10, PSKEY_PATCH60 (0x2136, 8502), 30 words
|
||||
&2136 = 0004 0d80 1aa4 0418 ff2b ff0e 1d00 ba18 009e 0184 0d2c 0013 8f00 89d0 0117 bf00 d6d4 0318 ff2b ff0e 2700 4218 009e 0418 ff2b ff0e 0e00 8418 00e2 6855
|
||||
|
||||
// patch_hardware_11, PSKEY_PATCH61 (0x2137, 8503), 22 words
|
||||
&2137 = 0002 4da5 0118 ff2b ff0e 6200 c518 009e 031b 2b22 fcc4 2c26 0114 e700 f025 0218 ff2b ff0e 4e00 a818 00e2 8dfc
|
||||
|
||||
// patch_sched_get_or_peek_message, PSKEY_PATCH123 (0x220b, 8715), 49 words
|
||||
&220b = fa0b 0717 0484 2cf0 0617 0690 e119 0c00 d438 041a 001a 022b 23f4 0116 0184 20f0 0216 0327 1df4 e119 0016 0784 19f0 e500 ab15 8000 0054 0100 c018 ff2b fe27 0317 ff0e fe9f e199 0cf4 7d00 f214 0127 0014 0027 0317 000e 019f 0014 021b 0226 fa0f 8392
|
||||
|
||||
// patch_spare1, PSKEY_PATCH155 (0x222b, 8747), 60 words
|
||||
&222b = e70b 1627 a100 8514 0227 0214 0127 6b00 d814 0427 0214 0327 0417 fe27 0317 ff27 1613 0230 0814 0027 e415 0534 ff0e fe9f 0513 0009 01a4 e015 7fc4 7f84 1bf0 0617 1584 18f0 161b 0116 010e 029f e119 049a 11f4 0116 4184 0ef0 e500 ac11 8000 0050 0100 c014 ff27 fe23 0816 ff0e fe9f 0114 02e0 0014 e70f 4d65
|
||||
|
||||
// patch_spare2, PSKEY_PATCH156 (0x222c, 8748), 40 words
|
||||
&222c = f40b 0927 2900 d414 0427 0314 0327 3500 ea14 0627 0314 0527 2900 9614 0827 0414 0727 0917 0110 070e 089f 0917 030e 049f 0617 fe27 0517 ff27 7f14 0027 1514 0127 2a14 0227 0114 0913 ff0e fe9f f40f 3478
|
||||
@@ -1,38 +0,0 @@
|
||||
// Set the crystal frequency to 26MHz
|
||||
&01fe = 6590
|
||||
|
||||
// PSKEY_COEX_SCHEME
|
||||
// 7 = Use Unity-e.
|
||||
&2480 = 0007
|
||||
|
||||
// Signal Configuration
|
||||
// --------------------
|
||||
// PSKEY_COEX_PIO_UNITY_3_BT_ACTIVE
|
||||
// BT_ACTIVE (PIO=0, polarity=active high)
|
||||
&2483 = 0000 0001
|
||||
|
||||
// PSKEY_COEX_PIO_UNITY_3_BT_STATUS
|
||||
// BT_STATUS (PIO=5, polarity=active high)
|
||||
&2484 = 0005 0001
|
||||
|
||||
// PSKEY_COEX_PIO_UNITY_3_WLAN_DENY
|
||||
// WLAN_DENY (PIO=1, polarity=active high)
|
||||
&2485 = 0001 0001
|
||||
|
||||
// Priority Configuration
|
||||
// ----------------------
|
||||
// PSKEY_coex_transaction_priority_table
|
||||
&2488 = 0000 0000 0000 0000 0000 0001 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001
|
||||
|
||||
// PSKEY_COEX_BLE_TRANSACTION_PRIORITY_TABLE
|
||||
&2493 = 0000 0000 0000 0000 0000 0000 0000 0000 0001 0001 0001 0000 0000 0000 0000 0001
|
||||
|
||||
// PSKEY_COEX_UNITY_EXPRESS_TIMINGS
|
||||
// BT_ACTIVE lead time - 20 us
|
||||
// BT_STATUS lead time - 12 us
|
||||
&248a = 0014 000c
|
||||
|
||||
|
||||
//Disable clock request on PIO2
|
||||
&0246 = 0000
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Write bluetooth PIN number here:
|
||||
pin=
|
||||
|
||||
if [ -z "$pin" ]; then
|
||||
msg="Set bluetooth PIN in file $0"
|
||||
logger -p user.err "$msg"
|
||||
for i in /dev/pts/* ; do
|
||||
[ -w $i ] && echo "$msg" > $i
|
||||
done
|
||||
else
|
||||
echo "PIN:$pin"
|
||||
fi
|
||||
@@ -1,40 +0,0 @@
|
||||
--- a/tools/hciattach.c
|
||||
+++ b/tools/hciattach.c
|
||||
@@ -101,20 +101,37 @@ int uart_speed(int s)
|
||||
return B230400;
|
||||
case 460800:
|
||||
return B460800;
|
||||
+/* FIX: Not all platform support this high serial speed
|
||||
+ claudyus84 @gamil.com
|
||||
+*/
|
||||
+#ifdef B500000
|
||||
case 500000:
|
||||
return B500000;
|
||||
+#endif
|
||||
+#ifdef B576000
|
||||
case 576000:
|
||||
return B576000;
|
||||
+#endif
|
||||
+#ifdef B921600
|
||||
case 921600:
|
||||
return B921600;
|
||||
+#endif
|
||||
+#ifdef B1000000
|
||||
case 1000000:
|
||||
return B1000000;
|
||||
+#endif
|
||||
+#ifdef B1152000
|
||||
case 1152000:
|
||||
return B1152000;
|
||||
+#endif
|
||||
+#ifdef B1500000
|
||||
case 1500000:
|
||||
return B1500000;
|
||||
+#endif
|
||||
+#ifdef B2000000
|
||||
case 2000000:
|
||||
return B2000000;
|
||||
+#endif
|
||||
#ifdef B2500000
|
||||
case 2500000:
|
||||
return B2500000;
|
||||
@@ -1,48 +0,0 @@
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -2441,7 +2441,7 @@ unit_tests = $(am__append_35) unit/test-
|
||||
@CLIENT_TRUE@ monitor/uuid.h monitor/uuid.c
|
||||
|
||||
@CLIENT_TRUE@client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@ \
|
||||
-@CLIENT_TRUE@ -lreadline
|
||||
+@CLIENT_TRUE@ -lreadline -lncurses
|
||||
|
||||
@MONITOR_TRUE@monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
|
||||
@MONITOR_TRUE@ monitor/display.h monitor/display.c \
|
||||
@@ -2691,13 +2691,13 @@ unit_tests = $(am__append_35) unit/test-
|
||||
@READLINE_TRUE@ client/display.h
|
||||
|
||||
@READLINE_TRUE@attrib_gatttool_LDADD = lib/libbluetooth-internal.la \
|
||||
-@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline
|
||||
+@READLINE_TRUE@ src/libshared-glib.la @GLIB_LIBS@ -lreadline -lncurses
|
||||
|
||||
@READLINE_TRUE@tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
|
||||
@READLINE_TRUE@ tools/obex-client-tool.c
|
||||
|
||||
@READLINE_TRUE@tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
|
||||
-@READLINE_TRUE@ @GLIB_LIBS@ -lreadline
|
||||
+@READLINE_TRUE@ @GLIB_LIBS@ -lreadline -lncurses
|
||||
|
||||
@READLINE_TRUE@tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
|
||||
@READLINE_TRUE@ tools/obex-server-tool.c
|
||||
@@ -2707,17 +2707,17 @@ unit_tests = $(am__append_35) unit/test-
|
||||
@READLINE_TRUE@ client/display.h client/display.c
|
||||
|
||||
@READLINE_TRUE@tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
|
||||
-@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
|
||||
+@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses
|
||||
|
||||
@READLINE_TRUE@tools_obexctl_SOURCES = tools/obexctl.c \
|
||||
@READLINE_TRUE@ client/display.h client/display.c
|
||||
|
||||
@READLINE_TRUE@tools_obexctl_LDADD = gdbus/libgdbus-internal.la \
|
||||
-@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
|
||||
+@READLINE_TRUE@ @GLIB_LIBS@ @DBUS_LIBS@ -lreadline -lncurses
|
||||
|
||||
@READLINE_TRUE@tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c
|
||||
@READLINE_TRUE@tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \
|
||||
-@READLINE_TRUE@ -lreadline
|
||||
+@READLINE_TRUE@ -lreadline -lncurses
|
||||
|
||||
@EXPERIMENTAL_TRUE@tools_gatt_service_SOURCES = tools/gatt-service.c
|
||||
@EXPERIMENTAL_TRUE@tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/profiles/audio/a2dp-codecs.h
|
||||
+++ b/profiles/audio/a2dp-codecs.h
|
||||
@@ -234,6 +234,11 @@ typedef struct {
|
||||
uint8_t channel_mode:4;
|
||||
} __attribute__ ((packed)) a2dp_aptx_t;
|
||||
|
||||
+typedef struct {
|
||||
+ a2dp_vendor_codec_t info;
|
||||
+ uint8_t unknown[2];
|
||||
+} __attribute__ ((packed)) a2dp_ldac_t;
|
||||
+
|
||||
#else
|
||||
#error "Unknown byte order"
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/tools/bccmd.c
|
||||
+++ b/tools/bccmd.c
|
||||
@@ -48,7 +48,7 @@
|
||||
#define CSR_STORES_PSF (0x0002)
|
||||
#define CSR_STORES_PSROM (0x0004)
|
||||
#define CSR_STORES_PSRAM (0x0008)
|
||||
-#define CSR_STORES_DEFAULT (CSR_STORES_PSI | CSR_STORES_PSF)
|
||||
+#define CSR_STORES_DEFAULT 0
|
||||
|
||||
#define CSR_TYPE_NULL 0
|
||||
#define CSR_TYPE_COMPLEX 1
|
||||
--
|
||||
2.1.4
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
diff --git a/tools/bccmd.c b/tools/bccmd.c
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 6bc28da..1605d1c
|
||||
--- a/tools/bccmd.c
|
||||
+++ b/tools/bccmd.c
|
||||
@@ -636,6 +636,78 @@ static int opt_pskey(int argc, char *argv[], uint16_t *stores, int *reset, int *
|
||||
return optind;
|
||||
}
|
||||
|
||||
+int inline serialize_u32(uint8_t *array, uint32_t val32)
|
||||
+{
|
||||
+ if (NULL == array)
|
||||
+ return -1;
|
||||
+
|
||||
+ array[0] = (val32 & 0xff0000) >> 16;
|
||||
+ array[1] = val32 >> 24;
|
||||
+ array[2] = val32 & 0xff;
|
||||
+ array[3] = (val32 & 0xff00) >> 8;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int inline deserialize_u32(uint8_t *array, uint32_t *pval32)
|
||||
+{
|
||||
+ if (NULL == array || NULL == pval32)
|
||||
+ return -1;
|
||||
+
|
||||
+ *pval32 = (array[1]<<24)
|
||||
+ | (array[0]<<16)
|
||||
+ | (array[3]<<8)
|
||||
+ | array[2];
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int setpio32(int transport, uint32_t varID, uint32_t mask, uint32_t bits)
|
||||
+{
|
||||
+ uint8_t array[32];
|
||||
+ uint8_t *ptr = NULL;
|
||||
+ uint32_t result = 0;
|
||||
+ int err;
|
||||
+
|
||||
+ memset(array, 0, sizeof(array));
|
||||
+ ptr = array;
|
||||
+
|
||||
+ serialize_u32(ptr, mask);
|
||||
+ ptr += 4;
|
||||
+
|
||||
+ serialize_u32(ptr, bits);
|
||||
+
|
||||
+ err = transport_write(transport, varID, array, 12);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ deserialize_u32(&array[8], &result);
|
||||
+ printf("result: 0x%x\n", result);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int cmd_pio32set(int transport, int argc, char *argv[])
|
||||
+{
|
||||
+ uint32_t varID;
|
||||
+ uint32_t mask;
|
||||
+ uint32_t bits;
|
||||
+
|
||||
+ argc--;
|
||||
+ argv++;
|
||||
+
|
||||
+ if (3 != argc)
|
||||
+ return -1;
|
||||
+
|
||||
+ varID = strtol(argv[0] + 2, NULL, 16);
|
||||
+ mask = strtol(argv[1] + 2, NULL, 16);
|
||||
+ bits = strtol(argv[2] + 2, NULL, 16);
|
||||
+
|
||||
+ return setpio32(transport, varID, mask, bits);
|
||||
+}
|
||||
+
|
||||
+
|
||||
#define OPT_PSKEY(min, max, stores, reset, help) \
|
||||
opt_pskey(argc, argv, (stores), (reset), (help)); \
|
||||
argc -= optind; argv += optind; optind = 0; \
|
||||
@@ -1112,6 +1184,7 @@ static struct {
|
||||
{ "psread", cmd_psread, NULL, "Read all PS keys" },
|
||||
{ "psload", cmd_psload, "<file>", "Load all PS keys from PSR file" },
|
||||
{ "pscheck", cmd_pscheck, "<file>", "Check PSR file" },
|
||||
+ { "pio32set", cmd_pio32set, "<VarID> <mask> <bits>","Set value for PIO32 register" },
|
||||
{ "adc", cmd_adc, "<mux>", "Read ADC value of <mux> input" },
|
||||
{ NULL }
|
||||
};
|
||||
@@ -1,50 +0,0 @@
|
||||
diff --git a/tools/bccmd.c b/tools/bccmd.c
|
||||
index 1605d1c..5655bb5 100755
|
||||
--- a/tools/bccmd.c
|
||||
+++ b/tools/bccmd.c
|
||||
@@ -555,6 +555,37 @@ static int cmd_radiotest(int transport, int argc, char *argv[])
|
||||
return transport_write(transport, CSR_VARID_RADIOTEST, array, 8);
|
||||
}
|
||||
|
||||
+static int cmd_fullradiotest(int transport, int argc, char *argv[])
|
||||
+{
|
||||
+ uint8_t array[8];
|
||||
+ uint16_t testID;
|
||||
+ uint16_t word1;
|
||||
+ uint16_t word2;
|
||||
+ uint16_t word3;
|
||||
+
|
||||
+ OPT_HELP(4, NULL);
|
||||
+
|
||||
+ testID = atoi(argv[0]);
|
||||
+ word1 = atoi(argv[1]);
|
||||
+ word2 = atoi(argv[2]);
|
||||
+ word3 = atoi(argv[3]);
|
||||
+
|
||||
+ printf("TestID %u, word1 %u, word2 %u, word3 %u\n",
|
||||
+ testID, word1, word2, word3);
|
||||
+
|
||||
+ memset(array, 0, sizeof(array));
|
||||
+ array[0] = testID & 0xff;
|
||||
+ array[1] = testID >> 8;
|
||||
+ array[2] = word1 & 0xff;
|
||||
+ array[3] = word1 >> 8;
|
||||
+ array[4] = word2 & 0xff;
|
||||
+ array[5] = word2 >> 8;
|
||||
+ array[6] = word3 & 0xff;
|
||||
+ array[7] = word3 >> 8;
|
||||
+
|
||||
+ return transport_write(transport, CSR_VARID_RADIOTEST, array, 8);
|
||||
+}
|
||||
+
|
||||
static int cmd_memtypes(int transport, int argc, char *argv[])
|
||||
{
|
||||
uint8_t array[8];
|
||||
@@ -1176,6 +1207,7 @@ static struct {
|
||||
{ "hoppingon", cmd_hoppingon, "", "Revert to channel hopping" },
|
||||
{ "rttxdata1", cmd_rttxdata1, "<freq> <level>", "TXData1 radio test" },
|
||||
{ "radiotest", cmd_radiotest, "<freq> <level> <id>", "Run radio tests" },
|
||||
+ { "fullradiotest", cmd_fullradiotest,"<id> <w1> <w2> <w3>", "Run full radio tests" },
|
||||
{ "memtypes", cmd_memtypes, NULL, "Get memory types" },
|
||||
{ "psget", cmd_psget, "<key>", "Get value for PS key" },
|
||||
{ "psset", cmd_psset, "<key> <value>", "Set value for PS key" },
|
||||
@@ -1,29 +0,0 @@
|
||||
Index: bluez-5.37/profiles/input/hog.c
|
||||
===================================================================
|
||||
--- bluez-5.37.orig/profiles/input/hog.c
|
||||
+++ bluez-5.37/profiles/input/hog.c
|
||||
@@ -107,8 +107,13 @@ static struct hog_device *hog_device_new
|
||||
product, version);
|
||||
|
||||
dev = new0(struct hog_device, 1);
|
||||
- dev->device = btd_device_ref(device);
|
||||
dev->hog = bt_hog_new_default(name, vendor, product, version, prim);
|
||||
+ if (!dev->hog) {
|
||||
+ free(dev);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ dev->device = btd_device_ref(device);
|
||||
|
||||
/*
|
||||
* TODO: Remove attio callback and use .accept once using
|
||||
@@ -189,6 +194,9 @@ static int hog_probe(struct btd_service
|
||||
continue;
|
||||
|
||||
dev = hog_device_new(device, prim);
|
||||
+ if (!dev)
|
||||
+ break;
|
||||
+
|
||||
btd_service_set_user_data(service, dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=csr8811
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/csr8811
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TIP CSR8811 support package
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile/Default
|
||||
|
||||
endef
|
||||
Build/Compile = $(Build/Compile/Default)
|
||||
|
||||
define Package/csr8811/install
|
||||
$(CP) ./files/* $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,csr8811))
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
|
||||
boot() {
|
||||
bccmd -t bcsp -b 115200 -d /dev/ttyMSM1 psload -r /lib/firmware/CSR8811/pb-207-csr8x11-rev8.psr
|
||||
sleep 1
|
||||
hciattach -s 115200 /dev/ttyMSM1 any 115200
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
// =============================================================================
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 Qualcomm Technologies International, Ltd.
|
||||
// All Rights Reserved.
|
||||
// Qualcomm Technologies International, Ltd. Confidential and Proprietary.
|
||||
// report this in case of problems:
|
||||
// $Revision: #8 $
|
||||
// Built Mon Feb 20 11:33:32 2017 GMT
|
||||
// Checked-in $DateTime: 2017/02/20 11:36:26 $
|
||||
// $File: //depot/bc/gemini-a12/dev/patches/10520/pb-207.psr $
|
||||
//
|
||||
// Patch is for build 10520 gem_5hci_rom_bt4.1_gemA12_1407301204_dspm_encr128
|
||||
//
|
||||
// Issues patched: B-158094, B-169261, B-171616, B-174351, B-176411,
|
||||
// B-179448, B-180762, B-184008, B-206751, B-208678,
|
||||
// B-216310, B-220605, B-223811
|
||||
//
|
||||
// Documentation from pb-207.pb
|
||||
// ----------------------------
|
||||
//
|
||||
// General purpose patch and PSKEY bundle for CSR8811
|
||||
// and CSR8311 A12 BT4.2 (build ID 10520).
|
||||
//
|
||||
// Documentation from pb-173-common.pb
|
||||
// -----------------------------------
|
||||
//
|
||||
// General patch bundle for Gemini-A12 (build ID 10520)
|
||||
// Patches and keys in here should be common to all
|
||||
// package variants.
|
||||
//
|
||||
// Documentation from report_bt4p2.pb
|
||||
// ----------------------------------
|
||||
//
|
||||
// Issues patched: B-174351
|
||||
//
|
||||
// Report BT version 4.2
|
||||
//
|
||||
// Documentation from patch_ulp_adv_avg_to_calc.xap
|
||||
// ------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-171616
|
||||
//
|
||||
// BlueCore can be configured through BCCMDVARID_BLE_CONFIG_ADV_RSSI_AVG_PARAM
|
||||
// to report the advertising rssi average through LE ADVERTISING REPORT to the
|
||||
// host for a given PEER LE device.
|
||||
// For more information, See CS-317256-AN.
|
||||
//
|
||||
// If the BlueCore is unable to receive a LE ADVERTISING REPORT from the PEER
|
||||
// before a configured average rssi supervision timeout, then the BlueCore
|
||||
// should send a LE ADVERTISING REPORT with rssi value equal to -127 conveying
|
||||
// that the PEER is out of the range; however, it fails to do this.
|
||||
//
|
||||
// Documentation from patch_ble_scan_deaf.xap
|
||||
// ------------------------------------------
|
||||
//
|
||||
// Issues patched: B-158094
|
||||
//
|
||||
// When BlueCore is asked to do BLE scanning, it scans for a window
|
||||
// approximately 2.5% shorter than asked for. Generally, this does
|
||||
// not cause noticeable effects; sometimes BLE adverts can be missed
|
||||
// making connection initialisation between two BLE devices take
|
||||
// somewhat longer than expected. In pathological cases, especially
|
||||
// if the scan window is long, connections may fail to be made entirely.
|
||||
//
|
||||
// Documentation from patch_usb_suspend_deep_sleep.xap
|
||||
// ---------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-176411
|
||||
//
|
||||
// When BlueCore device is bus powered and is in USB suspend mode,
|
||||
// the current consumption is approximately 8 mA which is higher
|
||||
// than the expected current of 250 uA
|
||||
//
|
||||
// Documentation from patch_tx_if_reduction.xap
|
||||
// --------------------------------------------
|
||||
//
|
||||
// Issues patched: B-169261
|
||||
//
|
||||
// When a BlueCore7 device is configured to use a +/-500 kHz transmit IF, this
|
||||
// can be overridden and a +/-375 kHz IF used instead. This reduces the
|
||||
// bandwidthof the transmit spectrum providing a greater margin in a Chinese
|
||||
// regulatory test.
|
||||
// Only transmit IFs of +/-500 kHz may be reduced; if BlueCore7 is configured to
|
||||
// use a TX IF of +/-1 MHz IF that will remain unchanged.
|
||||
//
|
||||
// Documentation from coex_shutdown.xap
|
||||
// ------------------------------------
|
||||
//
|
||||
// Issues patched: B-208678
|
||||
//
|
||||
// With Coexistence Unity-3 scheme, If the WLAN_DENY signal is asserted during
|
||||
// the initial phase of an adaptive frequency hopping(AFH) scan, the Bluecore
|
||||
// device fails to deassert its BT_ACTIVE signal
|
||||
//
|
||||
// Documentation from patch_access_address.xap
|
||||
// -------------------------------------------
|
||||
//
|
||||
// Issues patched: B-206751
|
||||
//
|
||||
// BlueCore devices may generate access addresses that only
|
||||
// have one bit transition in the 6 most significant bits.
|
||||
// The problem is seen on access addresses that have the most
|
||||
// significant bit set to one and only have one bit transition
|
||||
// in the 6 most significant bits.
|
||||
//
|
||||
// Furthermore, the access address, whilst not identical to the
|
||||
// advertising channel packets’ Access Address, may differ by
|
||||
// only one bit.
|
||||
//
|
||||
// Documentation from patch_sched_get_or_peek_message.c
|
||||
// ----------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-220605
|
||||
//
|
||||
// During the crossover of a locally initiated
|
||||
// LMP_unsniff_req and peer initiated LMP_sniff_subrate_req,
|
||||
// Bluecore responds with LMP_Sniff_Subrate_Rsp even if it
|
||||
// has initiated LMP_unsniff. This probably confuses peer and
|
||||
// peer stops responding, leading to a timeout.
|
||||
//
|
||||
// Documentation from patch_sched_get_or_peek_message_part2.c
|
||||
// ----------------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-220605
|
||||
//
|
||||
// During the crossover of a locally initiated
|
||||
// LMP_unsniff_req and peer initiated LMP_sniff_subrate_req,
|
||||
// Bluecore responds with LMP_Sniff_Subrate_Rsp even if it
|
||||
// has initiated LMP_unsniff. This probably confuses peer and
|
||||
// peer stops responding, leading to a timeout.
|
||||
//
|
||||
// Documentation from patch_ble_advt_restart.xap
|
||||
// ---------------------------------------------
|
||||
//
|
||||
// Issues patched: B-223811
|
||||
//
|
||||
// When advertisements are disabled before the expiry of the interval
|
||||
// and enabled immediately the advertisements are not sent before the
|
||||
// expiry of the advertising interval
|
||||
//
|
||||
// Documentation from patch_whitelist_connection_status.xap
|
||||
// --------------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-180762
|
||||
//
|
||||
// If a BlueCore device attempts but fails to form a Low Energy (LE) connection
|
||||
// to a remote slave using the whitelist, it will make no further attempts to
|
||||
// initiate a connection to that slave until either the BlueCore is reset or the
|
||||
// slave is removed and re-added to the whitelist.
|
||||
//
|
||||
// Documentation from patch_semp2.xap
|
||||
// ----------------------------------
|
||||
//
|
||||
// Issues patched: B-184008
|
||||
//
|
||||
// If HCI_SET_EVENT_MASK_PAGE_2 command is sent with wrong parameters
|
||||
// to Bluecore device, it returns error code
|
||||
// 'INVALID_HCI_COMMAND_PARAMETERS'. It should return error code
|
||||
// 'UNKNOWN_HCI_COMMAND'.
|
||||
//
|
||||
// Documentation from patch_disc_ll_pdu.xap
|
||||
// ----------------------------------------
|
||||
//
|
||||
// Issues patched: B-179448
|
||||
//
|
||||
// If a BlueCore device in the Connection State (regardless if in master or
|
||||
// slave role) receives an unexpected Data Channel PDU from the peer Link Layer
|
||||
// during the encryption start or encryption pause procedure, it does not exit
|
||||
// the Connection State and does not notify the Host with error code
|
||||
// "Connection Terminated Due to MIC Failure (0x3d)".
|
||||
//
|
||||
// Documentation from patch_fsm_shared_patchpoint.c
|
||||
// ------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-216310
|
||||
//
|
||||
// In a particular scenario where the peer device retries a Role Switch
|
||||
// (after a failed Role Switch) without EPR sequence, the Hydra/BlueCore
|
||||
// Devices do not handle the user data Start/Stop operation properly.
|
||||
// As a result the user data does not resume after the procedure is finished.
|
||||
//
|
||||
// Version information for input files
|
||||
// -----------------------------------
|
||||
//
|
||||
// Created by patchmaker.pl Revision: #68 Date: 2016/01/18
|
||||
//
|
||||
// Input file: pb-207.pb
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/pb-207.pb
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: pb-173-common.pb
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/pb-173-common.pb
|
||||
// File revision: 7
|
||||
//
|
||||
// Input file: report_bt4p2.pb
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/report_bt4p2.pb
|
||||
// File revision: 1
|
||||
//
|
||||
// Input file: patch_ulp_adv_avg_to_calc.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_ulp_adv_avg_to_calc.xap
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: ../patch_utils.inc
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/patch_utils.inc
|
||||
// File revision: 1
|
||||
//
|
||||
// Input file: patch_ble_scan_deaf.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_ble_scan_deaf.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_usb_suspend_deep_sleep.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_usb_suspend_deep_sleep.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_tx_if_reduction.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_tx_if_reduction.xap
|
||||
// File revision: 1
|
||||
//
|
||||
// Input file: coex_shutdown.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/coex_shutdown.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_access_address.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_access_address.xap
|
||||
// File revision: 2
|
||||
//
|
||||
// Input file: patch_sched_get_or_peek_message.c
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_sched_get_or_peek_message.c
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_sched_get_or_peek_message_part2.c
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_sched_get_or_peek_message_part2.c
|
||||
// File revision: 2
|
||||
//
|
||||
// Input file: patch_ble_advt_restart.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_ble_advt_restart.xap
|
||||
// File revision: 2
|
||||
//
|
||||
// Input file: patch_whitelist_connection_status.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_whitelist_connection_status.xap
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: patch_semp2.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_semp2.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_disc_ll_pdu.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_disc_ll_pdu.xap
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: patch_fsm_shared_patchpoint.c
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_fsm_shared_patchpoint.c
|
||||
// File revision: 3
|
||||
|
||||
// explicit, PSKEY_HCI_LMP_LOCAL_VERSION (0x010d, 269), 1 words
|
||||
&010d = 0808
|
||||
|
||||
// explicit, PSKEY_LMP_REMOTE_VERSION (0x010e, 270), 1 words
|
||||
&010e = 0008
|
||||
|
||||
// patch_hardware_0, PSKEY_PATCH50 (0x212c, 8492), 56 words
|
||||
&212c = 0000 f001 0617 0513 0118 ff2b ff0e 1a00 2818 009e 081b f100 8888 24f0 f925 f821 0a17 0184 0cf0 0117 0013 0009 02a4 fb25 fa21 f915 f811 fb55 fa61 09e0 ff84 10f0 0117 0013 0009 02a4 f935 f841 f925 f821 0f1b 0712 10a4 0494 0712 e151 0722 f915 f811 0018 ff2b ff0e f000 0518 00e2 5a79
|
||||
|
||||
// patch_hardware_1, PSKEY_PATCH51 (0x212d, 8493), 21 words
|
||||
&212d = 0002 968a 0863 f925 f821 0757 0663 e099 02ec 05e0 f915 0727 f815 0627 0218 ff2b ff0e 9700 8d18 00e2 7e34
|
||||
|
||||
// patch_hardware_2, PSKEY_PATCH52 (0x212e, 8494), 16 words
|
||||
&212e = 0002 0b5a 0100 7834 0040 0327 0223 f815 e311 0218 ff2b ff0e 0b00 5e18 00e2 59c1
|
||||
|
||||
// patch_hardware_3, PSKEY_PATCH53 (0x212f, 8495), 17 words
|
||||
&212f = 0000 7315 0084 04f0 0800 0014 03e0 f800 1215 0b27 0018 ff2b ff0e 7300 1818 00e2 0549
|
||||
|
||||
// patch_hardware_4, PSKEY_PATCH54 (0x2130, 8496), 21 words
|
||||
&2130 = 0001 53f8 0817 0e27 0c00 6384 07f0 0118 ff2b ff0e 5400 0918 00e2 0917 0118 ff2b ff0e 5400 fb18 00e2 91f6
|
||||
|
||||
// patch_hardware_5, PSKEY_PATCH55 (0x2131, 8497), 49 words
|
||||
&2131 = 0002 c0d5 0423 05f4 031b 0012 0280 1df0 021b 0916 1000 00c4 1ef0 0916 03c4 1bf4 031b 0012 0280 17f4 0380 15f4 0480 13f4 0580 11f4 0680 0ff4 0b80 0df4 0d80 0bf4 019c fb00 6719 0d9e 0218 ff2b ff0e c200 8c18 00e2 0218 ff2b ff0e c100 de18 00e2 c5cf
|
||||
|
||||
// patch_hardware_6, PSKEY_PATCH56 (0x2132, 8498), 42 words
|
||||
&2132 = 0003 243f f40b 0827 0923 e019 0916 01b4 0926 0318 ff2b ff0e 2400 4218 00e2 fa0b 3d14 0327 0114 0227 0014 0127 0027 081b 0816 0218 ff2b ff0e f700 fd18 009e e111 081b 0816 0218 ff2b ff0e 3300 ff18 009e fa0f 40f2
|
||||
|
||||
// patch_hardware_7, PSKEY_PATCH57 (0x2133, 8499), 23 words
|
||||
&2133 = 0003 254e 02c0 0916 1000 00c4 02f4 02b0 0916 fec4 e1b1 0922 0816 0318 ff2b ff0e 2500 5218 8000 00c0 08f2 00e2 e402
|
||||
|
||||
// patch_hardware_8, PSKEY_PATCH58 (0x2134, 8500), 16 words
|
||||
&2134 = 0003 21ca fa0b 0227 0323 e019 0916 01b4 0926 0318 ff2b ff0e 2200 cd18 00e2 22dc
|
||||
|
||||
// patch_hardware_9, PSKEY_PATCH59 (0x2135, 8501), 18 words
|
||||
&2135 = 0000 55e2 09f4 0218 ff2b ff0e 2c00 a718 009e 0314 fc0f 0018 ff2b ff0e 5600 0118 00e2 a008
|
||||
|
||||
// patch_hardware_10, PSKEY_PATCH60 (0x2136, 8502), 30 words
|
||||
&2136 = 0004 0d80 1aa4 0418 ff2b ff0e 1d00 ba18 009e 0184 0d2c 0013 8f00 89d0 0117 bf00 d6d4 0318 ff2b ff0e 2700 4218 009e 0418 ff2b ff0e 0e00 8418 00e2 6855
|
||||
|
||||
// patch_hardware_11, PSKEY_PATCH61 (0x2137, 8503), 22 words
|
||||
&2137 = 0002 4da5 0118 ff2b ff0e 6200 c518 009e 031b 2b22 fcc4 2c26 0114 e700 f025 0218 ff2b ff0e 4e00 a818 00e2 8dfc
|
||||
|
||||
// patch_hardware_12, PSKEY_PATCH62 (0x2138, 8504), 19 words
|
||||
&2138 = 0002 0f22 0310 081b 0100 8022 0100 b012 04f4 0114 e019 0426 0218 ff2b ff0e 0f00 2618 00e2 bc41
|
||||
|
||||
// patch_hardware_13, PSKEY_PATCH63 (0x2139, 8505), 12 words
|
||||
&2139 = 0002 0d95 0513 0100 b022 0218 ff2b ff0e 0f00 db18 00e2 7a40
|
||||
|
||||
// patch_fsm_shared_patchpoint, PSKEY_PATCH121 (0x2209, 8713), 36 words
|
||||
&2209 = fc0b 0b13 0717 1d00 c184 1df0 081b 0016 6384 05f0 1380 17f0 0114 13e0 6084 13f0 0100 da80 0df0 0d1b 5d9a 0af4 b900 f014 0127 0214 0027 e315 0010 000e 019f 0014 0d1b 5d26 fc0f a1a6
|
||||
|
||||
// patch_sched_get_or_peek_message, PSKEY_PATCH123 (0x220b, 8715), 49 words
|
||||
&220b = fa0b 0717 0484 2cf0 0617 0690 e119 0c00 d438 041a 001a 022b 23f4 0116 0184 20f0 0216 0327 1df4 e119 0016 0784 19f0 e500 ab15 8000 0054 0100 c018 ff2b fe27 0317 ff0e fe9f e199 0cf4 7d00 f214 0127 0014 0027 0317 000e 019f 0014 021b 0226 fa0f 8392
|
||||
|
||||
// patch_spare1, PSKEY_PATCH155 (0x222b, 8747), 60 words
|
||||
&222b = e70b 1627 a100 8514 0227 0214 0127 6b00 d814 0427 0214 0327 0417 fe27 0317 ff27 1613 0230 0814 0027 e415 0534 ff0e fe9f 0513 0009 01a4 e015 7fc4 7f84 1bf0 0617 1584 18f0 161b 0116 010e 029f e119 049a 11f4 0116 4184 0ef0 e500 ac11 8000 0050 0100 c014 ff27 fe23 0816 ff0e fe9f 0114 02e0 0014 e70f 4d65
|
||||
|
||||
// patch_spare2, PSKEY_PATCH156 (0x222c, 8748), 40 words
|
||||
&222c = f40b 0927 2900 d414 0427 0314 0327 3500 ea14 0627 0314 0527 2900 9614 0827 0414 0727 0917 0110 070e 089f 0917 030e 049f 0617 fe27 0517 ff27 7f14 0027 1514 0127 2a14 0227 0114 0913 ff0e fe9f f40f 3478
|
||||
&01fe = 6590
|
||||
//Interface, BCSP
|
||||
//&01f9 = 0001
|
||||
//Interface, H4
|
||||
&01f9 = 0003
|
||||
//Bit rate for 8811, 115200
|
||||
&01ea = 0001 c200
|
||||
@@ -1,29 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=nrf52840
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/nrf52840
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TIP NRF52840 support package
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile/Default
|
||||
|
||||
endef
|
||||
Build/Compile = $(Build/Compile/Default)
|
||||
|
||||
define Package/nrf52840/install
|
||||
$(CP) ./files/* $(1)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,nrf52840))
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
|
||||
boot() {
|
||||
. /lib/functions/system.sh
|
||||
case $(board_name) in
|
||||
edgecore,eap102)
|
||||
echo 54 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio54/direction
|
||||
echo 0 > /sys/class/gpio/gpio54/value
|
||||
echo 1 > /sys/class/gpio/gpio54/value
|
||||
btmgmt --index 0 static-addr FF:02:03:04:05:FF
|
||||
btmgmt --index 0 auto-power
|
||||
hciconfig hci0 up
|
||||
hcitool -i hci0 cmd 0x3f 0x006
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
// =============================================================================
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 Qualcomm Technologies International, Ltd.
|
||||
// All Rights Reserved.
|
||||
// Qualcomm Technologies International, Ltd. Confidential and Proprietary.
|
||||
// report this in case of problems:
|
||||
// $Revision: #8 $
|
||||
// Built Mon Feb 20 11:33:32 2017 GMT
|
||||
// Checked-in $DateTime: 2017/02/20 11:36:26 $
|
||||
// $File: //depot/bc/gemini-a12/dev/patches/10520/pb-207.psr $
|
||||
//
|
||||
// Patch is for build 10520 gem_5hci_rom_bt4.1_gemA12_1407301204_dspm_encr128
|
||||
//
|
||||
// Issues patched: B-158094, B-169261, B-171616, B-174351, B-176411,
|
||||
// B-179448, B-180762, B-184008, B-206751, B-208678,
|
||||
// B-216310, B-220605, B-223811
|
||||
//
|
||||
// Documentation from pb-207.pb
|
||||
// ----------------------------
|
||||
//
|
||||
// General purpose patch and PSKEY bundle for CSR8811
|
||||
// and CSR8311 A12 BT4.2 (build ID 10520).
|
||||
//
|
||||
// Documentation from pb-173-common.pb
|
||||
// -----------------------------------
|
||||
//
|
||||
// General patch bundle for Gemini-A12 (build ID 10520)
|
||||
// Patches and keys in here should be common to all
|
||||
// package variants.
|
||||
//
|
||||
// Documentation from report_bt4p2.pb
|
||||
// ----------------------------------
|
||||
//
|
||||
// Issues patched: B-174351
|
||||
//
|
||||
// Report BT version 4.2
|
||||
//
|
||||
// Documentation from patch_ulp_adv_avg_to_calc.xap
|
||||
// ------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-171616
|
||||
//
|
||||
// BlueCore can be configured through BCCMDVARID_BLE_CONFIG_ADV_RSSI_AVG_PARAM
|
||||
// to report the advertising rssi average through LE ADVERTISING REPORT to the
|
||||
// host for a given PEER LE device.
|
||||
// For more information, See CS-317256-AN.
|
||||
//
|
||||
// If the BlueCore is unable to receive a LE ADVERTISING REPORT from the PEER
|
||||
// before a configured average rssi supervision timeout, then the BlueCore
|
||||
// should send a LE ADVERTISING REPORT with rssi value equal to -127 conveying
|
||||
// that the PEER is out of the range; however, it fails to do this.
|
||||
//
|
||||
// Documentation from patch_ble_scan_deaf.xap
|
||||
// ------------------------------------------
|
||||
//
|
||||
// Issues patched: B-158094
|
||||
//
|
||||
// When BlueCore is asked to do BLE scanning, it scans for a window
|
||||
// approximately 2.5% shorter than asked for. Generally, this does
|
||||
// not cause noticeable effects; sometimes BLE adverts can be missed
|
||||
// making connection initialisation between two BLE devices take
|
||||
// somewhat longer than expected. In pathological cases, especially
|
||||
// if the scan window is long, connections may fail to be made entirely.
|
||||
//
|
||||
// Documentation from patch_usb_suspend_deep_sleep.xap
|
||||
// ---------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-176411
|
||||
//
|
||||
// When BlueCore device is bus powered and is in USB suspend mode,
|
||||
// the current consumption is approximately 8 mA which is higher
|
||||
// than the expected current of 250 uA
|
||||
//
|
||||
// Documentation from patch_tx_if_reduction.xap
|
||||
// --------------------------------------------
|
||||
//
|
||||
// Issues patched: B-169261
|
||||
//
|
||||
// When a BlueCore7 device is configured to use a +/-500 kHz transmit IF, this
|
||||
// can be overridden and a +/-375 kHz IF used instead. This reduces the
|
||||
// bandwidthof the transmit spectrum providing a greater margin in a Chinese
|
||||
// regulatory test.
|
||||
// Only transmit IFs of +/-500 kHz may be reduced; if BlueCore7 is configured to
|
||||
// use a TX IF of +/-1 MHz IF that will remain unchanged.
|
||||
//
|
||||
// Documentation from coex_shutdown.xap
|
||||
// ------------------------------------
|
||||
//
|
||||
// Issues patched: B-208678
|
||||
//
|
||||
// With Coexistence Unity-3 scheme, If the WLAN_DENY signal is asserted during
|
||||
// the initial phase of an adaptive frequency hopping(AFH) scan, the Bluecore
|
||||
// device fails to deassert its BT_ACTIVE signal
|
||||
//
|
||||
// Documentation from patch_access_address.xap
|
||||
// -------------------------------------------
|
||||
//
|
||||
// Issues patched: B-206751
|
||||
//
|
||||
// BlueCore devices may generate access addresses that only
|
||||
// have one bit transition in the 6 most significant bits.
|
||||
// The problem is seen on access addresses that have the most
|
||||
// significant bit set to one and only have one bit transition
|
||||
// in the 6 most significant bits.
|
||||
//
|
||||
// Furthermore, the access address, whilst not identical to the
|
||||
// advertising channel packets’ Access Address, may differ by
|
||||
// only one bit.
|
||||
//
|
||||
// Documentation from patch_sched_get_or_peek_message.c
|
||||
// ----------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-220605
|
||||
//
|
||||
// During the crossover of a locally initiated
|
||||
// LMP_unsniff_req and peer initiated LMP_sniff_subrate_req,
|
||||
// Bluecore responds with LMP_Sniff_Subrate_Rsp even if it
|
||||
// has initiated LMP_unsniff. This probably confuses peer and
|
||||
// peer stops responding, leading to a timeout.
|
||||
//
|
||||
// Documentation from patch_sched_get_or_peek_message_part2.c
|
||||
// ----------------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-220605
|
||||
//
|
||||
// During the crossover of a locally initiated
|
||||
// LMP_unsniff_req and peer initiated LMP_sniff_subrate_req,
|
||||
// Bluecore responds with LMP_Sniff_Subrate_Rsp even if it
|
||||
// has initiated LMP_unsniff. This probably confuses peer and
|
||||
// peer stops responding, leading to a timeout.
|
||||
//
|
||||
// Documentation from patch_ble_advt_restart.xap
|
||||
// ---------------------------------------------
|
||||
//
|
||||
// Issues patched: B-223811
|
||||
//
|
||||
// When advertisements are disabled before the expiry of the interval
|
||||
// and enabled immediately the advertisements are not sent before the
|
||||
// expiry of the advertising interval
|
||||
//
|
||||
// Documentation from patch_whitelist_connection_status.xap
|
||||
// --------------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-180762
|
||||
//
|
||||
// If a BlueCore device attempts but fails to form a Low Energy (LE) connection
|
||||
// to a remote slave using the whitelist, it will make no further attempts to
|
||||
// initiate a connection to that slave until either the BlueCore is reset or the
|
||||
// slave is removed and re-added to the whitelist.
|
||||
//
|
||||
// Documentation from patch_semp2.xap
|
||||
// ----------------------------------
|
||||
//
|
||||
// Issues patched: B-184008
|
||||
//
|
||||
// If HCI_SET_EVENT_MASK_PAGE_2 command is sent with wrong parameters
|
||||
// to Bluecore device, it returns error code
|
||||
// 'INVALID_HCI_COMMAND_PARAMETERS'. It should return error code
|
||||
// 'UNKNOWN_HCI_COMMAND'.
|
||||
//
|
||||
// Documentation from patch_disc_ll_pdu.xap
|
||||
// ----------------------------------------
|
||||
//
|
||||
// Issues patched: B-179448
|
||||
//
|
||||
// If a BlueCore device in the Connection State (regardless if in master or
|
||||
// slave role) receives an unexpected Data Channel PDU from the peer Link Layer
|
||||
// during the encryption start or encryption pause procedure, it does not exit
|
||||
// the Connection State and does not notify the Host with error code
|
||||
// "Connection Terminated Due to MIC Failure (0x3d)".
|
||||
//
|
||||
// Documentation from patch_fsm_shared_patchpoint.c
|
||||
// ------------------------------------------------
|
||||
//
|
||||
// Issues patched: B-216310
|
||||
//
|
||||
// In a particular scenario where the peer device retries a Role Switch
|
||||
// (after a failed Role Switch) without EPR sequence, the Hydra/BlueCore
|
||||
// Devices do not handle the user data Start/Stop operation properly.
|
||||
// As a result the user data does not resume after the procedure is finished.
|
||||
//
|
||||
// Version information for input files
|
||||
// -----------------------------------
|
||||
//
|
||||
// Created by patchmaker.pl Revision: #68 Date: 2016/01/18
|
||||
//
|
||||
// Input file: pb-207.pb
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/pb-207.pb
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: pb-173-common.pb
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/pb-173-common.pb
|
||||
// File revision: 7
|
||||
//
|
||||
// Input file: report_bt4p2.pb
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/report_bt4p2.pb
|
||||
// File revision: 1
|
||||
//
|
||||
// Input file: patch_ulp_adv_avg_to_calc.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_ulp_adv_avg_to_calc.xap
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: ../patch_utils.inc
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/patch_utils.inc
|
||||
// File revision: 1
|
||||
//
|
||||
// Input file: patch_ble_scan_deaf.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_ble_scan_deaf.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_usb_suspend_deep_sleep.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_usb_suspend_deep_sleep.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_tx_if_reduction.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_tx_if_reduction.xap
|
||||
// File revision: 1
|
||||
//
|
||||
// Input file: coex_shutdown.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/coex_shutdown.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_access_address.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_access_address.xap
|
||||
// File revision: 2
|
||||
//
|
||||
// Input file: patch_sched_get_or_peek_message.c
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_sched_get_or_peek_message.c
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_sched_get_or_peek_message_part2.c
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_sched_get_or_peek_message_part2.c
|
||||
// File revision: 2
|
||||
//
|
||||
// Input file: patch_ble_advt_restart.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_ble_advt_restart.xap
|
||||
// File revision: 2
|
||||
//
|
||||
// Input file: patch_whitelist_connection_status.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_whitelist_connection_status.xap
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: patch_semp2.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_semp2.xap
|
||||
// File revision: 3
|
||||
//
|
||||
// Input file: patch_disc_ll_pdu.xap
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_disc_ll_pdu.xap
|
||||
// File revision: 4
|
||||
//
|
||||
// Input file: patch_fsm_shared_patchpoint.c
|
||||
// Depot file: //depot/bc/gemini-a12/dev/patches/10520/patch_fsm_shared_patchpoint.c
|
||||
// File revision: 3
|
||||
|
||||
// explicit, PSKEY_HCI_LMP_LOCAL_VERSION (0x010d, 269), 1 words
|
||||
&010d = 0808
|
||||
|
||||
// explicit, PSKEY_LMP_REMOTE_VERSION (0x010e, 270), 1 words
|
||||
&010e = 0008
|
||||
|
||||
// patch_hardware_0, PSKEY_PATCH50 (0x212c, 8492), 56 words
|
||||
&212c = 0000 f001 0617 0513 0118 ff2b ff0e 1a00 2818 009e 081b f100 8888 24f0 f925 f821 0a17 0184 0cf0 0117 0013 0009 02a4 fb25 fa21 f915 f811 fb55 fa61 09e0 ff84 10f0 0117 0013 0009 02a4 f935 f841 f925 f821 0f1b 0712 10a4 0494 0712 e151 0722 f915 f811 0018 ff2b ff0e f000 0518 00e2 5a79
|
||||
|
||||
// patch_hardware_1, PSKEY_PATCH51 (0x212d, 8493), 21 words
|
||||
&212d = 0002 968a 0863 f925 f821 0757 0663 e099 02ec 05e0 f915 0727 f815 0627 0218 ff2b ff0e 9700 8d18 00e2 7e34
|
||||
|
||||
// patch_hardware_2, PSKEY_PATCH52 (0x212e, 8494), 16 words
|
||||
&212e = 0002 0b5a 0100 7834 0040 0327 0223 f815 e311 0218 ff2b ff0e 0b00 5e18 00e2 59c1
|
||||
|
||||
// patch_hardware_3, PSKEY_PATCH53 (0x212f, 8495), 17 words
|
||||
&212f = 0000 7315 0084 04f0 0800 0014 03e0 f800 1215 0b27 0018 ff2b ff0e 7300 1818 00e2 0549
|
||||
|
||||
// patch_hardware_4, PSKEY_PATCH54 (0x2130, 8496), 21 words
|
||||
&2130 = 0001 53f8 0817 0e27 0c00 6384 07f0 0118 ff2b ff0e 5400 0918 00e2 0917 0118 ff2b ff0e 5400 fb18 00e2 91f6
|
||||
|
||||
// patch_hardware_5, PSKEY_PATCH55 (0x2131, 8497), 49 words
|
||||
&2131 = 0002 c0d5 0423 05f4 031b 0012 0280 1df0 021b 0916 1000 00c4 1ef0 0916 03c4 1bf4 031b 0012 0280 17f4 0380 15f4 0480 13f4 0580 11f4 0680 0ff4 0b80 0df4 0d80 0bf4 019c fb00 6719 0d9e 0218 ff2b ff0e c200 8c18 00e2 0218 ff2b ff0e c100 de18 00e2 c5cf
|
||||
|
||||
// patch_hardware_6, PSKEY_PATCH56 (0x2132, 8498), 42 words
|
||||
&2132 = 0003 243f f40b 0827 0923 e019 0916 01b4 0926 0318 ff2b ff0e 2400 4218 00e2 fa0b 3d14 0327 0114 0227 0014 0127 0027 081b 0816 0218 ff2b ff0e f700 fd18 009e e111 081b 0816 0218 ff2b ff0e 3300 ff18 009e fa0f 40f2
|
||||
|
||||
// patch_hardware_7, PSKEY_PATCH57 (0x2133, 8499), 23 words
|
||||
&2133 = 0003 254e 02c0 0916 1000 00c4 02f4 02b0 0916 fec4 e1b1 0922 0816 0318 ff2b ff0e 2500 5218 8000 00c0 08f2 00e2 e402
|
||||
|
||||
// patch_hardware_8, PSKEY_PATCH58 (0x2134, 8500), 16 words
|
||||
&2134 = 0003 21ca fa0b 0227 0323 e019 0916 01b4 0926 0318 ff2b ff0e 2200 cd18 00e2 22dc
|
||||
|
||||
// patch_hardware_9, PSKEY_PATCH59 (0x2135, 8501), 18 words
|
||||
&2135 = 0000 55e2 09f4 0218 ff2b ff0e 2c00 a718 009e 0314 fc0f 0018 ff2b ff0e 5600 0118 00e2 a008
|
||||
|
||||
// patch_hardware_10, PSKEY_PATCH60 (0x2136, 8502), 30 words
|
||||
&2136 = 0004 0d80 1aa4 0418 ff2b ff0e 1d00 ba18 009e 0184 0d2c 0013 8f00 89d0 0117 bf00 d6d4 0318 ff2b ff0e 2700 4218 009e 0418 ff2b ff0e 0e00 8418 00e2 6855
|
||||
|
||||
// patch_hardware_11, PSKEY_PATCH61 (0x2137, 8503), 22 words
|
||||
&2137 = 0002 4da5 0118 ff2b ff0e 6200 c518 009e 031b 2b22 fcc4 2c26 0114 e700 f025 0218 ff2b ff0e 4e00 a818 00e2 8dfc
|
||||
|
||||
// patch_hardware_12, PSKEY_PATCH62 (0x2138, 8504), 19 words
|
||||
&2138 = 0002 0f22 0310 081b 0100 8022 0100 b012 04f4 0114 e019 0426 0218 ff2b ff0e 0f00 2618 00e2 bc41
|
||||
|
||||
// patch_hardware_13, PSKEY_PATCH63 (0x2139, 8505), 12 words
|
||||
&2139 = 0002 0d95 0513 0100 b022 0218 ff2b ff0e 0f00 db18 00e2 7a40
|
||||
|
||||
// patch_fsm_shared_patchpoint, PSKEY_PATCH121 (0x2209, 8713), 36 words
|
||||
&2209 = fc0b 0b13 0717 1d00 c184 1df0 081b 0016 6384 05f0 1380 17f0 0114 13e0 6084 13f0 0100 da80 0df0 0d1b 5d9a 0af4 b900 f014 0127 0214 0027 e315 0010 000e 019f 0014 0d1b 5d26 fc0f a1a6
|
||||
|
||||
// patch_sched_get_or_peek_message, PSKEY_PATCH123 (0x220b, 8715), 49 words
|
||||
&220b = fa0b 0717 0484 2cf0 0617 0690 e119 0c00 d438 041a 001a 022b 23f4 0116 0184 20f0 0216 0327 1df4 e119 0016 0784 19f0 e500 ab15 8000 0054 0100 c018 ff2b fe27 0317 ff0e fe9f e199 0cf4 7d00 f214 0127 0014 0027 0317 000e 019f 0014 021b 0226 fa0f 8392
|
||||
|
||||
// patch_spare1, PSKEY_PATCH155 (0x222b, 8747), 60 words
|
||||
&222b = e70b 1627 a100 8514 0227 0214 0127 6b00 d814 0427 0214 0327 0417 fe27 0317 ff27 1613 0230 0814 0027 e415 0534 ff0e fe9f 0513 0009 01a4 e015 7fc4 7f84 1bf0 0617 1584 18f0 161b 0116 010e 029f e119 049a 11f4 0116 4184 0ef0 e500 ac11 8000 0050 0100 c014 ff27 fe23 0816 ff0e fe9f 0114 02e0 0014 e70f 4d65
|
||||
|
||||
// patch_spare2, PSKEY_PATCH156 (0x222c, 8748), 40 words
|
||||
&222c = f40b 0927 2900 d414 0427 0314 0327 3500 ea14 0627 0314 0527 2900 9614 0827 0414 0727 0917 0110 070e 089f 0917 030e 049f 0617 fe27 0517 ff27 7f14 0027 1514 0127 2a14 0227 0114 0913 ff0e fe9f f40f 3478
|
||||
&01fe = 6590
|
||||
//Interface, BCSP
|
||||
//&01f9 = 0001
|
||||
//Interface, H4
|
||||
&01f9 = 0003
|
||||
//Bit rate for 8811, 115200
|
||||
&01ea = 0001 c200
|
||||
56
feeds/facebook/fbwifi/Makefile
Normal file
56
feeds/facebook/fbwifi/Makefile
Normal file
@@ -0,0 +1,56 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
#
|
||||
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fbwifi
|
||||
PKG_VERSION:=2
|
||||
PKG_RELEASE:=0
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_MAINTAINER:=Simon Kinane <skinane@fb.com>
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fbwifi
|
||||
SUBMENU:=Captive Portals
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+iptables +luasec +luasocket \
|
||||
+luci-base +libuci-lua +luaposix \
|
||||
+luci-mod-network +luci-mod-status +luci-theme-bootstrap \
|
||||
+lua-cjson +uhttpd
|
||||
TITLE:=Facebook Wi-Fi
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/fbwifi/description
|
||||
Facebook Wi-Fi, an AP authorisation solution
|
||||
endef
|
||||
|
||||
define Package/fbwifi/conffiles
|
||||
/etc/config/fbwifi
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/fbwifi/install
|
||||
$(INSTALL_DIR) $(1)
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fbwifi))
|
||||
55
feeds/facebook/fbwifi/README.md
Normal file
55
feeds/facebook/fbwifi/README.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Facebook Wi-Fi v2.0 Reference Implementation for OpenWrt
|
||||
|
||||
## Getting started
|
||||
|
||||
Case studies for OEM customers are available at the official page of [Facebook Wi-Fi](https://www.facebook.com/facebook-wifi).
|
||||
|
||||
For OEM engineers, start by reading the init script in [files/etc/init.d/fbwifi](https://github.com/facebookincubator/fbc_owrt_feed/blob/master/fbwifi/files/etc/init.d/fbwifi)
|
||||
|
||||
## Contents
|
||||
|
||||
The 'files' subdirectory contains all the configuration, script and code
|
||||
that implements the Facebook Wi-Fi v2.0 standard for OpenWrt.
|
||||
|
||||
The folder structure follows *nix conventions :
|
||||
- 'etc' is the boot time scripts and configuration
|
||||
- 'usr' contains procedural scripts, lua common code module and GUI prototype for luci
|
||||
- 'www' contains the HTTP endpoints as CGI handlers
|
||||
|
||||
```
|
||||
files/
|
||||
├── etc
|
||||
│ ├── config
|
||||
│ │ └── fbwifi
|
||||
│ ├── hotplug.d
|
||||
│ │ └── iface
|
||||
│ │ └── 50-fbwifi
|
||||
│ ├── init.d
|
||||
│ │ └── fbwifi
|
||||
├── usr
|
||||
│ ├── lib
|
||||
│ │ └── lua
|
||||
│ │ ├── fbwifi.lua
|
||||
│ │ └── luci
|
||||
│ │ ├── controller
|
||||
│ │ │ └── fbwifi.lua
|
||||
│ │ └── view
|
||||
│ │ └── fbwifi.htm
|
||||
│ ├── sbin
|
||||
│ │ ├── fbwifi
|
||||
│ │ ├── fbwifi_debug_dump
|
||||
│ │ ├── fbwifi_gateway_info_update
|
||||
│ │ ├── fbwifi_get_config
|
||||
│ │ └── fbwifi_validate_token_db
|
||||
│ └── share
|
||||
│ └── fbwifi
|
||||
│ ├── firewall.include
|
||||
│ └── uhttpd.json
|
||||
└── www
|
||||
└── cgi-bin
|
||||
└── fbwifi
|
||||
└── v2.0
|
||||
├── auth
|
||||
├── capport
|
||||
└── info
|
||||
```
|
||||
6
feeds/facebook/fbwifi/files/etc/config/fbwifi
Normal file
6
feeds/facebook/fbwifi/files/etc/config/fbwifi
Normal file
@@ -0,0 +1,6 @@
|
||||
config fbwifi 'main'
|
||||
option enabled '0'
|
||||
option gateway_token 'FBWIFI:GATEWAY|123456789|0123456789|abcdeABCDE123456789'
|
||||
option http_port '2060'
|
||||
option https_port '2061'
|
||||
option zone 'lan'
|
||||
10
feeds/facebook/fbwifi/files/etc/hotplug.d/iface/50-fbwifi
Normal file
10
feeds/facebook/fbwifi/files/etc/hotplug.d/iface/50-fbwifi
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
/etc/init.d/fbwifi enabled || exit 0
|
||||
|
||||
ip route get fibmatch 1.1.1.1 | grep -q "$DEVICE" || exit 0
|
||||
|
||||
logger -t fbwifi "Reloading fbwifi due to $ACTION of $INTERFACE ($DEVICE)"
|
||||
/etc/init.d/fbwifi restart
|
||||
43
feeds/facebook/fbwifi/files/etc/init.d/fbwifi
Executable file
43
feeds/facebook/fbwifi/files/etc/init.d/fbwifi
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=90
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger fbwifi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
|
||||
config_load fbwifi
|
||||
config_get_bool enabled 'main' 'enabled' '0'
|
||||
[ "$enabled" -eq 0 ] && return
|
||||
|
||||
config_get http_port main http_port
|
||||
[ -z "$http_port" ] && {
|
||||
logger -t fbwifi "required option http_port not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
config_get https_port main https_port
|
||||
[ -z "$https_port" ] && {
|
||||
logger -t fbwifi "required option https_port not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
logger "[fbwifi] Enabled; starting"
|
||||
|
||||
mkdir -p /tmp/fbwifi
|
||||
|
||||
/usr/sbin/fbwifi reload
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/sbin/fbwifi_validate_token_db
|
||||
procd_set_param respawn 1 300 0
|
||||
procd_close_instance
|
||||
}
|
||||
153
feeds/facebook/fbwifi/files/usr/lib/lua/fbwifi.lua
Normal file
153
feeds/facebook/fbwifi/files/usr/lib/lua/fbwifi.lua
Normal file
@@ -0,0 +1,153 @@
|
||||
-- FBWIFI Lua library
|
||||
-- function table
|
||||
local fbwifi = {}
|
||||
|
||||
local http = require("ssl.https")
|
||||
local json = require("cjson")
|
||||
local log = require("posix.syslog")
|
||||
local uci = require("uci")
|
||||
|
||||
function fbwifi.gateway_token()
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
token = state:get("fbwifi", "main", "gateway_token")
|
||||
if token and string.len(token) > 0 then
|
||||
return token
|
||||
else
|
||||
log.syslog( log.LOG_WARNING, "[fbwifi] UCI option fbwifi.main.gateway_token is missing" )
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function fbwifi.validate_token( token )
|
||||
|
||||
local valid = false
|
||||
|
||||
if string.len(token or '' ) > 0 then
|
||||
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/token"
|
||||
BODY="token="..token
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
|
||||
|
||||
if code==200 then
|
||||
valid = true
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] validate_token:"..body)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return valid
|
||||
end
|
||||
|
||||
local mac_to_purge=''
|
||||
function remove_client_by_mac(client)
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
|
||||
for key, value in pairs(client) do
|
||||
if
|
||||
key == 'mac' and
|
||||
value == mac_to_purge
|
||||
then
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] Purging DB entry %s for MAC %s", client['.name'] or 'unknown', mac_to_purge) )
|
||||
state:delete("fbwifi", client['.name'])
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function fbwifi.instate_client_rule( token, client_mac )
|
||||
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Validating client "..client_mac)
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
state_name = "token_" .. token
|
||||
|
||||
RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\""
|
||||
RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb"
|
||||
local RULE
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] Cleaning DB for MAC %s", client_mac) )
|
||||
mac_to_purge = client_mac
|
||||
state:foreach("fbwifi", "client", remove_client_by_mac)
|
||||
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format("[fbwifi] Adding DB entry %s for MAC %s", state_name, client_mac) )
|
||||
state:set("fbwifi", state_name, "client")
|
||||
state:set("fbwifi", state_name, "token", token)
|
||||
state:set("fbwifi", state_name, "mac", client_mac)
|
||||
state:set("fbwifi", state_name, "authenticated", "true")
|
||||
|
||||
-- verify a rule exists for the given client MAC,
|
||||
-- OR install it
|
||||
RULE=string.format(RULE_COND.." || "..RULE_FMT, client_mac, "A", client_mac)
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format( "[fbwifi] Opening iptables for %s", client_mac ) )
|
||||
res = os.execute(RULE)
|
||||
if res ~= 0 then
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) )
|
||||
end
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] "..RULE)
|
||||
|
||||
state:save('fbwifi')
|
||||
end
|
||||
|
||||
function fbwifi.revoke_client_rule( token )
|
||||
|
||||
if (token == nil) then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Invalidating token, but token is Nil")
|
||||
return
|
||||
end
|
||||
|
||||
log.syslog(log.LOG_INFO, string.format( "[fbwifi] Invalidating token (%s)", token) )
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
state_name = "token_" .. token
|
||||
|
||||
client_mac = state:get("fbwifi", state_name, "mac")
|
||||
|
||||
if client_mac then
|
||||
RULE_COND="iptables -w -L FBWIFI_CLIENT_TO_INTERNET -t mangle | grep -i -q \"%s\""
|
||||
RULE_FMT="iptables -w -t mangle -%s FBWIFI_CLIENT_TO_INTERNET -m mac --mac-source \"%s\" -j MARK --set-mark 0xfb"
|
||||
|
||||
-- verify a rule exists for the given client MAC,
|
||||
-- AND delete it
|
||||
RULE=string.format(RULE_COND.." && "..RULE_FMT, client_mac, "D", client_mac)
|
||||
|
||||
res = os.execute(RULE)
|
||||
if res ~= 0 then
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Failed to update iptables (%s)", res ) )
|
||||
end
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] "..RULE)
|
||||
|
||||
state:delete("fbwifi", state_name)
|
||||
state:save('fbwifi')
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, string.format( "[fbwifi] Client MAC not found in DB (%s)", state_name ) )
|
||||
end
|
||||
end
|
||||
|
||||
function fbwifi.reset()
|
||||
|
||||
local success = false
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
URL="https://api.fbwifi.com/v2.0/gateway/reset"
|
||||
BODY="{}"
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, BODY)
|
||||
|
||||
if code==200 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Reset committed")
|
||||
success = true
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Reset failed : "..body)
|
||||
end
|
||||
|
||||
return success
|
||||
end
|
||||
|
||||
--
|
||||
-- Return the function table to the host script
|
||||
--
|
||||
return fbwifi
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Copyright
|
||||
-- Licensed to the public under the GNU General Public License v2.
|
||||
|
||||
module("luci.controller.fbwifi", package.seeall)
|
||||
|
||||
sys = require "luci.sys"
|
||||
ut = require "luci.util"
|
||||
|
||||
function index()
|
||||
entry({"admin", "network", "fbwifi"}, template("fbwifi"), "Facebook Wi-Fi", 90).dependent=false
|
||||
end
|
||||
|
||||
16
feeds/facebook/fbwifi/files/usr/lib/lua/luci/view/fbwifi.htm
Normal file
16
feeds/facebook/fbwifi/files/usr/lib/lua/luci/view/fbwifi.htm
Normal file
@@ -0,0 +1,16 @@
|
||||
<%#
|
||||
Copyright
|
||||
Licensed to the public under the GNU General Public License v2.
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<h1>Facebook Wi-Fi</h1>
|
||||
<%
|
||||
require("uci")
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
url = state:get("fbwifi", "main", "captive_portal_config_url")
|
||||
%>
|
||||
<a href="<% print(url) %>">Configure FB business page</a>
|
||||
|
||||
<%+footer%>
|
||||
57
feeds/facebook/fbwifi/files/usr/sbin/fbwifi
Executable file
57
feeds/facebook/fbwifi/files/usr/sbin/fbwifi
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
disable)
|
||||
uci set fbwifi.main.enabled=0
|
||||
|
||||
uci delete firewall.fbwifi
|
||||
|
||||
uci delete uhttpd.fbwifi_redirect
|
||||
|
||||
uci delete uhttpd.main.json_script
|
||||
uci set uhttpd.main.cert='/etc/uhttpd.crt'
|
||||
uci set uhttpd.main.key='/etc/uhttpd.key'
|
||||
uci set uhttpd.main.rfc1918_filter=1
|
||||
;;
|
||||
enable)
|
||||
uci set fbwifi.main.enabled=1
|
||||
|
||||
uci set firewall.fbwifi=include
|
||||
uci set firewall.fbwifi.enabled=1
|
||||
uci set firewall.fbwifi.family=ipv4
|
||||
uci set firewall.fbwifi.path=/usr/share/fbwifi/firewall.include
|
||||
uci set firewall.fbwifi.reload=1
|
||||
uci set firewall.fbwifi.type=script
|
||||
|
||||
uci set uhttpd.fbwifi_redirect=uhttpd
|
||||
uci set uhttpd.fbwifi_redirect.enabled=1
|
||||
uci set uhttpd.fbwifi_redirect.cert='/tmp/fbwifi/https_server_cert'
|
||||
uci set uhttpd.fbwifi_redirect.json_script='/tmp/fbwifi/uhttpd-redirect.json'
|
||||
uci set uhttpd.fbwifi_redirect.key='/tmp/fbwifi/https_server_key'
|
||||
uci set uhttpd.fbwifi_redirect.listen_http='0.0.0.0:2060'
|
||||
uci set uhttpd.fbwifi_redirect.listen_https='0.0.0.0:2061'
|
||||
|
||||
uci set uhttpd.main.cert='/tmp/fbwifi/https_server_cert'
|
||||
uci set uhttpd.main.json_script='/usr/share/fbwifi/uhttpd.json'
|
||||
uci set uhttpd.main.key='/tmp/fbwifi/https_server_key'
|
||||
uci set uhttpd.main.rfc1918_filter=0
|
||||
;;
|
||||
reload)
|
||||
/usr/sbin/fbwifi_get_config
|
||||
|
||||
login_url=$(uci -p /var/state get fbwifi.main.captive_portal_url)
|
||||
[ -z "$login_url" ] && {
|
||||
logger -t fbwifi "captive_portal_url not available yet"
|
||||
exit 1
|
||||
}
|
||||
printf '{ "request": [ ["redirect", "%s", 302] ] }' "$login_url" > /tmp/fbwifi/uhttpd-redirect.json
|
||||
|
||||
/etc/init.d/uhttpd restart
|
||||
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
uci commit
|
||||
/etc/init.d/uhttpd restart
|
||||
reload_config
|
||||
8
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_debug_dump
Executable file
8
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_debug_dump
Executable file
@@ -0,0 +1,8 @@
|
||||
echo -e "Runtime configuration and token DB\n"
|
||||
uci -p /var/state export fbwifi
|
||||
|
||||
echo -e "\nDynamic firewall flow rules\n"
|
||||
iptables -t mangle -L FBWIFI_CLIENT_TO_INTERNET
|
||||
|
||||
echo -e "\nDHCP leases\n"
|
||||
cat /tmp/dhcp.leases
|
||||
38
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_gateway_info_update
Executable file
38
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_gateway_info_update
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
http = require("ssl.https")
|
||||
json = require("cjson")
|
||||
log = require("posix.syslog")
|
||||
socket = require("socket")
|
||||
require("uci")
|
||||
fbwifi = require("fbwifi")
|
||||
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
|
||||
payload="name="..socket.dns.gethostname()
|
||||
|
||||
function queue_ssid_update(iface)
|
||||
bssid_file="/sys/class/net/br-"..iface["network"].."/address"
|
||||
local file = io.open(bssid_file)
|
||||
if file then
|
||||
for line in file:lines() do
|
||||
payload=payload.."&bssid[]="..line
|
||||
end
|
||||
payload=payload.."ssid[]="..iface["ssid"]
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to find BSSID for interface br-"..iface["network"])
|
||||
end
|
||||
end
|
||||
|
||||
state:foreach("wireless", "wifi-iface", queue_ssid_update)
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/gateway"
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN, payload)
|
||||
if code == 200 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] gateway information updated "..body)
|
||||
os.exit(0)
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] gateway API failed "..body)
|
||||
os.exit(code)
|
||||
end
|
||||
106
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_get_config
Executable file
106
feeds/facebook/fbwifi/files/usr/sbin/fbwifi_get_config
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/lua
|
||||
http = require("ssl.https")
|
||||
json = require("cjson")
|
||||
require("uci")
|
||||
log = require("posix.syslog")
|
||||
fbwifi = require("fbwifi")
|
||||
|
||||
GATEWAY_TOKEN = fbwifi.gateway_token()
|
||||
|
||||
http_port = uci.get("fbwifi.main.http_port")
|
||||
https_port = uci.get("fbwifi.main.https_port")
|
||||
|
||||
state = uci.cursor(nil, "/var/state")
|
||||
|
||||
URL="https://api.fbwifi.com/v2.0/gateway"
|
||||
body, code, headers = http.request(URL.."?access_token="..GATEWAY_TOKEN.."&fields=config,config_version")
|
||||
|
||||
if code == 200 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Got gateway config ("..code..")")
|
||||
else
|
||||
log.syslog(log.LOG_CRIT, "[fbwifi] Failed to get gateway config ("..code..")")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
obj = json.decode(body)
|
||||
|
||||
function save_cert(name, value)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Saving cert "..name)
|
||||
local f = assert(io.open("/tmp/fbwifi/"..name, "w"))
|
||||
f:write(value)
|
||||
f:close()
|
||||
end
|
||||
|
||||
function process_redirect(ix, host)
|
||||
IP_SET = "ip addr replace dev lo "..host
|
||||
local result = os.execute(IP_SET)
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Redirect address applied "..host)
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to apply redirect address "..host)
|
||||
end
|
||||
|
||||
ip = string.match(host, '([0-9\.]*)/([0-9]*)')
|
||||
RULE_FMT="grep -q \"%s\" /etc/hosts || echo \"%s\tstar.fbwifigateway.net\" >> /etc/hosts"
|
||||
HOSTS_RULE = string.format(RULE_FMT, ip, ip)
|
||||
result = os.execute(HOSTS_RULE)
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Cached redirect host for DNS")
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to amend /etc/hosts")
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] "..HOSTS_RULE)
|
||||
end
|
||||
|
||||
result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 80 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..http_port)
|
||||
--print(result)
|
||||
result = os.execute("iptables -t nat -A FBWIFI_HOST_REDIRLIST -p tcp --dport 443 -d "..ip.." -j ACCEPT # REDIRECT --to-ports "..https_port)
|
||||
--print(result)
|
||||
end
|
||||
|
||||
save_cert("https_server_cert", obj['config']['https_server_cert'])
|
||||
save_cert("https_server_key", obj['config']['https_server_key'])
|
||||
|
||||
result = os.execute("iptables -t nat -F FBWIFI_HOST_REDIRLIST")
|
||||
--print(result)
|
||||
table.foreach(obj['config']['host_redirect_ips'], process_redirect)
|
||||
|
||||
RULE_FORMAT = "iptables -t mangle -A FBWIFI_TRAFFIC_ALLOWLIST -d %s -p %s --dport %s -j MARK --set-mark 0xfb"
|
||||
function process_traffic_rule(ix, rule)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix)
|
||||
|
||||
if rule["protocol"] == 6 then
|
||||
PROTO = "tcp"
|
||||
elseif rule["protocol"] == 17 then
|
||||
PROTO = "udp"
|
||||
end
|
||||
RULE = string.format(RULE_FORMAT, rule["ip"], PROTO, rule["port"])
|
||||
local result = os.execute(RULE)
|
||||
if result == 0 then
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Traffic rule "..ix)
|
||||
else
|
||||
log.syslog(log.LOG_WARNING, "[fbwifi] Failed to install traffic rule ; "..RULE)
|
||||
end
|
||||
end
|
||||
|
||||
local cross_origin_list = {}
|
||||
function process_cross_origin_rule(ix, url)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Cross origin rule "..url)
|
||||
table.insert(cross_origin_list, url)
|
||||
end
|
||||
|
||||
function process_url(url_purpose, fqdn)
|
||||
log.syslog(log.LOG_INFO, "[fbwifi] Caching "..url_purpose)
|
||||
state:set("fbwifi", "main", url_purpose, fqdn)
|
||||
end
|
||||
|
||||
state:set("fbwifi", "main", "config")
|
||||
|
||||
result = os.execute("iptables -t mangle -F FBWIFI_TRAFFIC_ALLOWLIST ")
|
||||
--print(result)
|
||||
table.foreach(obj['config']['traffic_allowlist'], process_traffic_rule)
|
||||
table.foreach(obj['config']['cross_origin_allowlist'], process_cross_origin_rule)
|
||||
table.foreach(obj['config']['urls'], process_url)
|
||||
state:set("fbwifi", "main", "cross_origin_allow_rules", cross_origin_list)
|
||||
|
||||
state:set("fbwifi", "main", "config_version", obj['config_version'])
|
||||
state:save('fbwifi')
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user