diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt new file mode 100644 index 00000000..2ecb72f0 --- /dev/null +++ b/.github/.cSpellWords.txt @@ -0,0 +1,98 @@ +ADDR +ATcmd +Blox +C +CATM +CBMC +CCID +CCLK +CEDRXS +CEREG +CFUN +CG +CGMI +CGMM +CGMR +CGP +CGSN +CIMI +CLK +CMOCK +CPIN +CPINREADY +CRSM +Cbmc +Cmock +Coverity +Cp +Cpsms +DNDEBUG +EDRX +EDRXS +EFHPLM +Edrx +Ftesting +HPLMN +HSDPA +HSDPAHSUPA +HSUPA +Hplmn +IMEI +IMSI +Imsi +MISRA +MQTT +MSI +Misra +Mockv +Mockx +NBIOT +PKTIO +PSMSettings +Pkio +Pktio +Plmn +Psreg +QCCID +QCFG +QIND +QIOPEN +QIRD +QIURC +QP +QPSMS +QSIMSTAT +Quectel +RDYY +RSRP +RSRQ +Rssi +UTRAN +WCDMA +atlib +cbmc +cgreg +cid +coverity +creg +ctest +eidrx +iccid +imei +lcov +misra +nwscanseq +onse +pdpdeact +pkio +pktios +plantuml +plmn +rsrp +rsrq +sinr +sms +ublox +utest +utrhf +utrhfgdghfg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f0c71f4..e4ff8e40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,9 @@ name: CI Checks +env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m on: push: branches: ["**"] @@ -10,70 +15,91 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 - - name: Build + uses: actions/checkout@v3 + - env: + stepName: Build Unit Tests run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + sudo apt-get install -y lcov cmake -S test -B build/ \ -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE=Debug \ -DBUILD_CLONE_SUBMODULES=ON \ -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG' + make -C build/ all - - name: Test - run: | - cd build/ - ctest -E system --output-on-failure - cd .. - - name: Run Coverage + + echo "::endgroup::" + echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}" + + - name: Run Unit Tests + run: ctest --test-dir build -E system --output-on-failure + + - env: + stepName: Line and Branch Coverage Build run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.bashInfo }} Build Coverage Target ${{ env.bashEnd }}" + # Build the coverage target make -C build/ coverage - declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*") - echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info + + echo -e "::group::${{ env.bashInfo }} Generate Coverage Report ${{ env.bashEnd }}" + # Generate coverage report, excluding extra directories + lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info '*test*' '*CMakeCCompilerId*' '*mocks*' + + echo "::endgroup::" lcov --rc lcov_branch_coverage=1 --list build/coverage.info + echo -e "${{ env.bashPass }} ${{env.stepName}} ${{ env.bashEnd }}" - name: Check Coverage uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main with: - path: ./build/coverage.info + coverage-file: ./build/coverage.info + complexity: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check complexity - Common uses: FreeRTOS/CI-CD-Github-Actions/complexity@main with: path: ./ + doxygen: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run doxygen build uses: FreeRTOS/CI-CD-Github-Actions/doxygen@main with: path: ./ + spell-check: runs-on: ubuntu-latest steps: - name: Clone This Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run spellings check uses: FreeRTOS/CI-CD-Github-Actions/spellings@main with: path: ./ + formatting: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check formatting uses: FreeRTOS/CI-CD-Github-Actions/formatting@main with: path: ./ + git-secrets: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Checkout awslabs/git-secrets - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: awslabs/git-secrets ref: master @@ -84,22 +110,49 @@ jobs: run: | git-secrets --register-aws git-secrets --scan + memory_statistics: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: - submodules: 'recursive' + submodules: "recursive" - name: Install Python3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: - python-version: '3.11.0' + python-version: "3.11.0" - name: Measure sizes uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main with: - config: .github/memory_statistics_config.json - check_against: docs/doxygen/include/size_table.md + config: .github/memory_statistics_config.json + check_against: docs/doxygen/include/size_table.md + + link-verifier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check Links + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main + + verify-manifest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + + - name: Run manifest verifier + uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main + with: + path: ./ + fail-on-incorrect-version: true + + proof_ci: + if: ${{ github.event.pull_request }} runs-on: cbmc_ubuntu-latest_64-core steps: - name: Set up CBMC runner diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 00000000..8257adda --- /dev/null +++ b/.github/workflows/formatting.yml @@ -0,0 +1,23 @@ +name: Format Pull Request Files + +on: + issue_comment: + types: [created] + +env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + +jobs: + Formatting: + name: Run Formatting Check + if: ${{ github.event.issue.pull_request }} && + ( ( github.event.comment.body == '/bot run uncrustify' ) || + ( github.event.comment.body == '/bot run formatting' ) ) + runs-on: ubuntu-20.04 + steps: + - name: Apply Formatting Fix + uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main + id: check-formatting diff --git a/.github/workflows/memory_statistics.yml b/.github/workflows/memory_statistics.yml index b986a4ee..e4e0f626 100644 --- a/.github/workflows/memory_statistics.yml +++ b/.github/workflows/memory_statistics.yml @@ -8,15 +8,15 @@ jobs: name: Calculate object sizes runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: - submodules: 'recursive' + submodules: "recursive" - name: Measure sizes uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main with: - config: .github/memory_statistics_config.json + config: .github/memory_statistics_config.json - name: Upload table uses: actions/upload-artifact@v2 with: name: size_table - path: size_table.md \ No newline at end of file + path: size_table.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5a4f346..13808129 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,10 +4,10 @@ on: workflow_dispatch: inputs: commit_id: - description: 'Commit ID to tag and create a release for' + description: "Commit ID to tag and create a release for" required: true version_number: - description: 'Release Version Number (Eg, v1.0.0)' + description: "Release Version Number (Eg, v1.0.0)" required: true jobs: @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.commit_id }} - name: Configure git identity @@ -24,7 +24,9 @@ jobs: git config --global user.name ${{ github.actor }} git config --global user.email ${{ github.actor }}@users.noreply.github.com - name: create a new branch that references commit id - run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }} + run: + git checkout -b ${{ github.event.inputs.version_number }} ${{ + github.event.inputs.commit_id }} - name: Generate SBOM uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main with: @@ -53,7 +55,7 @@ jobs: - name: Install ZIP tools run: sudo apt-get install zip unzip - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.commit_id }} path: FreeRTOS-Cellular-Interface @@ -93,8 +95,12 @@ jobs: - name: Create artifact of ZIP uses: actions/upload-artifact@v2 with: - name: FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number }}.zip - path: zip-check/FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number }}.zip + name: + FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number + }}.zip + path: + zip-check/FreeRTOS-Cellular-Interface-${{ + github.event.inputs.version_number }}.zip deploy-doxygen: needs: tag-commit name: Deploy doxygen documentation @@ -120,13 +126,17 @@ jobs: with: tag_name: ${{ github.event.inputs.version_number }} release_name: ${{ github.event.inputs.version_number }} - body: Release ${{ github.event.inputs.version_number }} of the FreeRTOS-Cellular-Interface Library. + body: + Release ${{ github.event.inputs.version_number }} of the + FreeRTOS-Cellular-Interface Library. draft: false prerelease: false - name: Download ZIP artifact uses: actions/download-artifact@v2 with: - name: FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number }}.zip + name: + FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number + }}.zip - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 @@ -134,6 +144,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number }}.zip - asset_name: FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number }}.zip + asset_path: + ./FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number + }}.zip + asset_name: + FreeRTOS-Cellular-Interface-${{ github.event.inputs.version_number + }}.zip asset_content_type: application/zip diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e3d9274..2f8be459 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,54 +1,105 @@ # Change Log for FreeRTOS Cellular Interface Library ## v1.3.0 (October 2022) + ### Updates - - [#102](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/102) MISRA C:2012 Compliance update. - - [#101](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/101) Add Cellular common AT command timeout. - - [#99](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/99) CBMC Starter kit update. - - [#98](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/98) HL7802 Finish processing packets after remote disconnect. - - [#96](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/96) Add config to disable hardware flow control. - - [#94](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/94) Cellular Socket State design update. - - [#92](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/92) Socket CONNECTING state change. - - [#90](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/90) Handle network registration URC in AT Command response callback. - - [#88](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/88) Set TCP Local Port. - - [#86](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/86) Restore URC String when using generic URC callback. - - [#85](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/85) SARA-R4 socket receive response handling. - - [#84](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/84) HL7802 Signal processing function update. - - [#82](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/82) Add default RAT selection list. - - [#80](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/80) Hl7802 Delay after reboot. - - [#79](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/79) SARA-R4 Get PDN Status. - - [#77](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/77) HL7802 AT command timeout update. - - [#76](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/76) HL7802 band config detection and changes to log messages. - - [#75](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/75) SARA-R4 Reboot on init and changes to log messages. + +- [#102](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/102) MISRA + C:2012 Compliance update. +- [#101](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/101) Add + Cellular common AT command timeout. +- [#99](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/99) CBMC + Starter kit update. +- [#98](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/98) HL7802 + Finish processing packets after remote disconnect. +- [#96](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/96) Add + config to disable hardware flow control. +- [#94](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/94) + Cellular Socket State design update. +- [#92](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/92) Socket + CONNECTING state change. +- [#90](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/90) Handle + network registration URC in AT Command response callback. +- [#88](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/88) Set TCP + Local Port. +- [#86](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/86) Restore + URC String when using generic URC callback. +- [#85](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/85) SARA-R4 + socket receive response handling. +- [#84](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/84) HL7802 + Signal processing function update. +- [#82](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/82) Add + default RAT selection list. +- [#80](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/80) Hl7802 + Delay after reboot. +- [#79](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/79) SARA-R4 + Get PDN Status. +- [#77](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/77) HL7802 + AT command timeout update. +- [#76](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/76) HL7802 + band config detection and changes to log messages. +- [#75](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/75) SARA-R4 + Reboot on init and changes to log messages. ## v1.2.0 (December 2021) + ### Updates - - [#62](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/62) Fix uintptr compile error. - - [#67](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/67) Fix too many arguments log. - - [#64](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/64) Remove strnlen usage. + +- [#62](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/62) Fix + uintptr compile error. +- [#67](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/67) Fix too + many arguments log. +- [#64](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/64) Remove + strnlen usage. ### Other - - [#63](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/63) Fix broken links. - - [#61](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/61) Fix typo in README.md. - - [#69](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/69) Loop invariant update. - - [#65](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/65) Submodule community ports repo to third party folder. - - [#70](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/70) fix CBMC potential issues. + +- [#63](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/63) Fix + broken links. +- [#61](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/61) Fix + typo in README.md. +- [#69](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/69) Loop + invariant update. +- [#65](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/65) + Submodule community ports repo to third party folder. +- [#70](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/70) fix + CBMC potential issues. ## v1.1.0 (November 2021) + ### Updates - - [#40](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/40) Fix the module logging mechanism format. - - [#53](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/53) Use the stdint.h header file for integer types. - - [#55](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/55) Add function for validating the prefix character of cellular module response. - - [#57](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/57) Fix unknown type issue. + +- [#40](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/40) Fix the + module logging mechanism format. +- [#53](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/53) Use the + stdint.h header file for integer types. +- [#55](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/55) Add + function for validating the prefix character of cellular module response. +- [#57](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/57) Fix + unknown type issue. ### Other - - [#52](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/52) Resolve ublox sara r4 build warnings. - - [#42](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/42) Fix spelling check failure in CI tools. - - [#43](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/43) [#46](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/46) [#54](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/54) Minor documentation updates. - - [#48](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/48) Header Guards for C++ linkage. + +- [#52](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/52) Resolve + ublox sara r4 build warnings. +- [#42](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/42) Fix + spelling check failure in CI tools. +- [#43](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/43) + [#46](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/46) + [#54](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/54) Minor + documentation updates. +- [#48](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/pull/48) Header + Guards for C++ linkage. ## v1.0.0 (September 2021) -This is the first release of the FreeRTOS Cellular Interface library in this repository. +This is the first release of the FreeRTOS Cellular Interface library in this +repository. -The FreeRTOS Cellular Interface library provides an implementation of the standard AT commands for the [3GPP TS v27.007](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515) and support for the 3 cellular modems [Quectel BG96](https://www.quectel.com/product/bg96.htm), [Sierra Wireless HL7802](https://www.sierrawireless.com/products-and-solutions/embedded-solutions/products/hl7802/) and [U-Blox Sara-R4](https://www.u-blox.com/en/product/sara-r4-series). +The FreeRTOS Cellular Interface library provides an implementation of the +standard AT commands for the +[3GPP TS v27.007](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515) +and support for the 3 cellular modems +[Quectel BG96](https://devices.amazonaws.com/detail/a3G0h0000077rK6EAI/LTE-BG96-Cat-M1-NB1-EGPRS-Module), +[Sierra Wireless HL7802](https://www.sierrawireless.com/iot-modules/lpwa-modules/hl7802/) +and [U-Blox Sara-R4](https://www.u-blox.com/en/product/sara-r4-series). diff --git a/MISRA.md b/MISRA.md index 5d0d7961..56096d09 100644 --- a/MISRA.md +++ b/MISRA.md @@ -1,113 +1,133 @@ # MISRA Compliance -The FreeRTOS-Cellular-Interface library files conform to the [MISRA C:2012](https://www.misra.org.uk/MISRAHome/MISRAC2012/tabid/196/Default.aspx) -guidelines, with the deviations listed below. Compliance is checked with Coverity static analysis. -The specific deviations, suppressed inline, are listed below. +The FreeRTOS-Cellular-Interface library files conform to the +[MISRA C:2012](https://www.misra.org.uk/) +guidelines, with the deviations listed below. Compliance is checked with +Coverity static analysis. The specific deviations, suppressed inline, are listed +below. -Additionally, [MISRA configuration file](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/tools/coverity/misra.config) contains the project wide deviations. +Additionally, +[MISRA configuration file](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/tools/coverity/misra.config) +contains the project wide deviations. ### Suppressed with Coverity Comments + To find the violation references in the source files run grep on the source code with ( Assuming rule 10.4 violation; with justification in point 1 ): + ``` grep 'MISRA Ref 10.4.1' . -rI ``` #### Directive 4.6 + _Ref 4.6.1_ - MISRA C-2012 Directive 4.6 warns against using types that do not contain size - and sign information. The use of isalpha, isdigit, and isspace set this directive - off since they use base types that don't contain this information. We do not have - control over these functions so we are suppressing these violations. + and sign information. The use of isalpha, isdigit, and isspace set this + directive off since they use base types that don't contain this information. + We do not have control over these functions so we are suppressing these + violations. #### Directive 4.7 + _Ref 4.7.1_ -- MISRA C 2012 Directive 4.7 requires that when a function returns error information, - that error information shall be tested. The following line violates MISRA rule 4.7 - because return value of strtol() is not checked for error. This violation is - justified because error checking by "errno" for any POSIX API is not thread - safe in FreeRTOS unless "configUSE_POSIX_ERRNO" is enabled. In order to avoid the - dependency on this feature, errno variable is not used. +- MISRA C 2012 Directive 4.7 requires that when a function returns error + information, that error information shall be tested. The following line + violates MISRA rule 4.7 because return value of strtol() is not checked for + error. This violation is justified because error checking by "errno" for any + POSIX API is not thread safe in FreeRTOS unless "configUSE_POSIX_ERRNO" is + enabled. In order to avoid the dependency on this feature, errno variable is + not used. #### Rule 10.4 + _Ref 10.4.1_ -- MISRA C-2012 Rule 10.4 warns about using different types in an operation. - This rule is being flagged because of use of the standard library functions - isalpha, isdigit, and isspace. We do not have control over these functions so we - are suppressing these violations. +- MISRA C-2012 Rule 10.4 warns about using different types in an operation. This + rule is being flagged because of use of the standard library functions + isalpha, isdigit, and isspace. We do not have control over these functions so + we are suppressing these violations. #### Rule 10.5 + _Ref 10.5.1_ -- MISRA C-2012 Rule 10.5 Converting to an enum type. The variables - are checked to ensure that they are valid, and within a valid range. - Hence, assigning the value of the variable with a enum cast. +- MISRA C-2012 Rule 10.5 Converting to an enum type. The variables are checked + to ensure that they are valid, and within a valid range. Hence, assigning the + value of the variable with a enum cast. #### Rule 10.8 + _Ref 10.8.1_ -- MISRA C-2012 Rule 10.8 warns about casting from unsigned to signed types. - This rule is being flagged because of use of the standard library functions - isalpha and isdigit. We do not have control over these so we are suppressing - these violations. +- MISRA C-2012 Rule 10.8 warns about casting from unsigned to signed types. This + rule is being flagged because of use of the standard library functions isalpha + and isdigit. We do not have control over these so we are suppressing these + violations. #### Rule 11.3 + _Ref 11.3.1_ -- MISRA C-2012 Rule 11.3 does not allow casting of a pointer to different object types. - We are passing in a length variable which is then checked to determine what to - cast this value to. As such we are not worried about the chance of - misaligned access when using the cast variable. +- MISRA C-2012 Rule 11.3 does not allow casting of a pointer to different object + types. We are passing in a length variable which is then checked to determine + what to cast this value to. As such we are not worried about the chance of + misaligned access when using the cast variable. #### Rule 21.6 + _Ref 21.6.1_ - MISRA C-2012 Rule 21.6 warns about the use of standard library input/output - functions as they might have implementation defined or undefined - behaviour. The max length of the strings are fixed and checked offline. + functions as they might have implementation defined or undefined behaviour. + The max length of the strings are fixed and checked offline. #### Rule 21.9 + _Ref 21.9.1_ -- MISRA C-2012 Rule 21.9 does not allow the use of bsearch. This is becasue of - unspecified behavior, which relates to the treatment of elements that compare as - equal, can be avoided by ensuring that the comparison function never returns 0. - When two elements are otherwise equal, the comparison function could - return a value that indicates their relative order in the initial array. - This the token table must be checked without duplicated string. The return value - is 0 only if the string is exactly the same. +- MISRA C-2012 Rule 21.9 does not allow the use of bsearch. This is because of + unspecified behavior, which relates to the treatment of elements that compare + as equal, can be avoided by ensuring that the comparison function never + returns 0. When two elements are otherwise equal, the comparison function + could return a value that indicates their relative order in the initial array. + This the token table must be checked without duplicated string. The return + value is 0 only if the string is exactly the same. #### Rule 22.8 + _Ref 22.8.1_ -- MISRA C 2012 Rule 22.8 Requires the errno variable must be "zero" before calling - strtol function. This violation is justified because error checking by "errno" - for any POSIX API is not thread safe in FreeRTOS unless "configUSE_POSIX_ERRNO" - is enabled. In order to avoid the dependency on this feature, errno variable is - not used. The function strtol returns LONG_MIN and LONG_MAX in case of underflow - and overflow respectively and sets the errno to ERANGE. It is not possible to - distinguish between valid LONG_MIN and LONG_MAX return values and underflow and - overflow scenarios without checking errno. Therefore, we cannot check return value - of strtol for errors. We ensure that strtol performed a valid conversion by - checking that *pEndPtr is '\0'. strtol stores the address of the first invalid - character in *pEndPtr and therefore, '\0' value of *pEndPtr means that the complete - pToken string passed for conversion was valid and a valid conversion wasperformed. +- MISRA C 2012 Rule 22.8 Requires the errno variable must be "zero" before + calling strtol function. This violation is justified because error checking by + "errno" for any POSIX API is not thread safe in FreeRTOS unless + "configUSE_POSIX_ERRNO" is enabled. In order to avoid the dependency on this + feature, errno variable is not used. The function strtol returns LONG_MIN and + LONG_MAX in case of underflow and overflow respectively and sets the errno to + ERANGE. It is not possible to distinguish between valid LONG_MIN and LONG_MAX + return values and underflow and overflow scenarios without checking errno. + Therefore, we cannot check return value of strtol for errors. We ensure that + strtol performed a valid conversion by checking that *pEndPtr is '\0'. strtol + stores the address of the first invalid character in *pEndPtr and therefore, + '\0' value of \*pEndPtr means that the complete pToken string passed for + conversion was valid and a valid conversion wasperformed. #### Rule 22.9 + _Ref 22.9.1_ -- MISRA C 2012 Rule 22.9 requires that errno must be tested after strtol function is - called.This violation is justified because error checking by "errno" - for any POSIX API is not thread safe in FreeRTOS unless "configUSE_POSIX_ERRNO" - is enabled. In order to avoid the dependency on this feature, errno variable is - not used. The function strtol returns LONG_MIN and LONG_MAX in case of underflow - and overflow respectively and sets the errno to ERANGE. It is not possible to - distinguish between valid LONG_MIN and LONG_MAX return values and underflow and - overflow scenarios without checking errno. Therefore, we cannot check return value - of strtol for errors. We ensure that strtol performed a valid conversion by - checking that *pEndPtr is '\0'. strtol stores the address of the first invalid - character in *pEndPtr and therefore, '\0' value of *pEndPtr means that the complete - pToken string passed for conversion was valid and a valid conversion wasperformed. \ No newline at end of file +- MISRA C 2012 Rule 22.9 requires that errno must be tested after strtol + function is called.This violation is justified because error checking by + "errno" for any POSIX API is not thread safe in FreeRTOS unless + "configUSE_POSIX_ERRNO" is enabled. In order to avoid the dependency on this + feature, errno variable is not used. The function strtol returns LONG_MIN and + LONG_MAX in case of underflow and overflow respectively and sets the errno to + ERANGE. It is not possible to distinguish between valid LONG_MIN and LONG_MAX + return values and underflow and overflow scenarios without checking errno. + Therefore, we cannot check return value of strtol for errors. We ensure that + strtol performed a valid conversion by checking that *pEndPtr is '\0'. strtol + stores the address of the first invalid character in *pEndPtr and therefore, + '\0' value of \*pEndPtr means that the complete pToken string passed for + conversion was valid and a valid conversion wasperformed. diff --git a/README.md b/README.md index c3e58193..386325a1 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,47 @@ # FreeRTOS Cellular Interface ## On this page: -* [Introduction](#Introduction) -* [Getting Started](#Getting-Started) - * [Download the source code](#Download-the-source-code) - * [Folder Structure](#Folder-Structure) -* [Integrate FreeRTOS Cellular Interface with MCU platforms](#Integrate-FreeRTOS-Cellular-Interface-with-MCU-platforms) -* [Adding support for new cellular modems](#Adding-support-for-new-cellular-modems) -* [Integrate FreeRTOS Cellular Interface with Cellular Modules](#integrate-freertos-cellular-interface-with-cellular-modules) -* [Building Unit Tests](#Building-Unit-Tests) -* [Generating documentation](#Generating-documentation) -* [Contributing](#Contributing) -## Introduction - -The Cellular Interface library implement a simple unified [Application Programing Interfaces (APIs)](https://www.freertos.org/Documentation/api-ref/cellular/index.html) that hide the complexity of AT commands. The cellular modems to be interchangeable with the popular options built upon TCP stack and exposes a socket-like interface to C programmers. - -Most cellular modems implement more or less the AT commands defined by the [3GPP TS v27.007](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515) standard. This project provides an implementation of such standard AT commands in a [reusable common component](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/include/common). The three Cellular libraries in this project all take advantage of that common code. The library for each modem only implements the vendor-specific AT commands, then exposes the complete Cellular API. +- [Introduction](#Introduction) +- [Getting Started](#Getting-Started) + - [Download the Source Code](#Download-the-Source-Code) + - [Folder Structure](#Folder-Structure) +- [Implement Comm Interface with MCU Platforms](#Implement-Comm-Interface-with-MCU-Platforms) +- [Adding Support for New Cellular Modems](#Adding-Support-for-New-Cellular-Modems) +- [Integrate FreeRTOS Cellular Interface with Application](#Integrate-FreeRTOS-Cellular-Interface-with-Application) +- [Building Unit Tests](#Building-Unit-Tests) +- [Generating Documentation](#Generating-Documentation) +- [Contributing](#Contributing) -The common component that implements the 3GPP TS v27.007 standard has been written in compliance of the following code quality criteria: - -* GNU Complexity scores are not over 8. -* MISRA coding standard. Any deviations from the MISRA C:2012 guidelines are documented in source code comments marked by "`coverity`". +## Introduction -**FreeRTOS Cellular Interface v1.3.0 [source code](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/v1.3.0/source) is part of the [FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) release.** +The Cellular Interface library implement a simple unified +[Application Programming Interfaces (APIs)](https://www.freertos.org/Documentation/api-ref/cellular/index.html) +that hide the complexity of AT commands. The cellular modems to be +interchangeable with the popular options built upon TCP stack and exposes a +socket-like interface to C programmers. + +Most cellular modems implement more or less the AT commands defined by the +[3GPP TS v27.007](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515) +standard. This project provides an implementation of such standard AT commands +in a +[reusable common component](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/include/common). +The three Cellular libraries in this project all take advantage of that common +code. The library for each modem only implements the vendor-specific AT +commands, then exposes the complete Cellular API. + +The common component that implements the 3GPP TS v27.007 standard has been +written in compliance of the following code quality criteria: + +- GNU Complexity scores are not over 8. +- MISRA coding standard. Any deviations from the MISRA C:2012 guidelines are + documented in source code comments marked by "`coverity`". + +**FreeRTOS Cellular Interface v1.3.0 +[Source Code](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/v1.3.0/source) +is part of the +[FreeRTOS 202210.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202210.00-LTS) +release.** ## Getting Started @@ -45,64 +63,101 @@ git clone git@github.com/FreeRTOS/FreeRTOS-Cellular-Interface.git At the root of this repository are these folders: -* source : reusable common code that implements the standard AT commands defined by 3GPP TS v27.007. -* docs : documentations. -* test : unit test and cbmc. -* tools : tools for Coverity static analysis and CMock. +- source : reusable common code that implements the standard AT commands defined + by 3GPP TS v27.007. +- docs : documentations. +- test : unit test and cbmc. +- tools : tools for Coverity static analysis and CMock. ## Implement Comm Interface with MCU platforms -The FreeRTOS Cellular Interface runs on MCUs. It uses an abstracted interface - the [Comm Interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/interface/cellular_comm_interface.h), to communicate with cellular modems. A Comm Interface must be implemented as well on the MCU platform. The most common implementations of the Comm Interface are over UART hardware, but it can be implemented over other physical interfaces such as SPI as well. The documentation of the Comm Interface is found within the [Cellular API References](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting.html#cellular_porting_comm_if). These are example implementations of the Comm Interface: - -* [FreeRTOS windows simulator comm interface](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/comm_if_windows.c) -* [FreeRTOS Common IO UART comm interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/st/boards/stm32l475_discovery/ports/comm_if/comm_if_uart.c) -* [STM32 L475 discovery board comm interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/st/boards/stm32l475_discovery/ports/comm_if/comm_if_st.c) -* [Sierra Sensor Hub board comm interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/sierra/boards/sensorhub/ports/comm_if/comm_if_sierra.c) - -The FreeRTOS Cellular Interface uses kernel APIs for task synchronization and memory management. - -## Adding support for new cellular modems - -FreeRTOS Cellular Interface now supports AT commands, TCP offloaded Cellular abstraction Layer. In order to add support for a new cellular modem, the developer can use the [common component](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/include/common) that has already implemented the 3GPP standard AT commands. +The FreeRTOS Cellular Interface runs on MCUs. It uses an abstracted interface - +the +[Comm Interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/interface/cellular_comm_interface.h), +to communicate with cellular modems. A Comm Interface must be implemented as +well on the MCU platform. The most common implementations of the Comm Interface +are over UART hardware, but it can be implemented over other physical interfaces +such as SPI as well. The documentation of the Comm Interface is found within the +[Cellular API References](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting.html#cellular_porting_comm_if). +These are example implementations of the Comm Interface: + +- [FreeRTOS Windows Simulator Comm Interface](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator/Common/comm_if_windows.c) +- [FreeRTOS Common IO UART Comm Interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/st/boards/stm32l475_discovery/ports/comm_if/comm_if_uart.c) +- [STM32 L475 Discovery Board Comm Interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/st/boards/stm32l475_discovery/ports/comm_if/comm_if_st.c) +- [Sierra Sensor Hub Board Comm Interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/sierra/boards/sensorhub/ports/comm_if/comm_if_sierra.c) + +The FreeRTOS Cellular Interface uses kernel APIs for task synchronization and +memory management. + +## Adding Support for New Cellular Modems + +FreeRTOS Cellular Interface now supports AT commands, TCP offloaded Cellular +abstraction Layer. In order to add support for a new cellular modem, the +developer can use the +[common component](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/include/common) +that has already implemented the 3GPP standard AT commands. + +In order to port the +[common component](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting_module_guide.html): + +1. Implement the cellular modem porting interface defined in + [cellular_common_portable.h](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/include/common/cellular_common_portable.h) + ([Document](https://www.freertos.org/Documentation/api-ref/cellular/cellular__common__portable_8h.html)). +2. Implement the subset of Cellular Library APIs that use vendor-specific + (non-3GPP) AT commands. The APIs to be implemented are the ones not marked + with an "o" in + [this table](https://www.freertos.org/Documentation/api-ref/cellular/cellular_common__a_p_is.html). +3. Implement Cellular Library callback functions that handle vendor-specific + (non-3GPP) Unsolicited Result Code (URC). The URC handlers to be implemented + are the ones not marked with an "o" in + [this table](https://www.freertos.org/Documentation/api-ref/cellular/cellular_common__u_r_c_handlers.html). + +The +[Cellular Common APIs document](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting_module_guide.html) +provides detail information required in each steps. It is recommended that you +start by cloning the implementation of one of the existing modems, then make +modifications where your modem's vendor-specific (non-3GPP) AT commands are +different. + +Current Example Implementations: + +- [Quectel BG96](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Reference-Quectel-BG96) +- [Sierra Wireless HL7802](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Reference-Sierra-Wireless-HL7802) +- [U-Blox Sara-R4](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Reference-ublox-SARA-R4) + +## Integrate FreeRTOS Cellular Interface with Application + +Once comm interface and cellular module implementation are ready, we can start +to integrate FreeRTOS Cellular Interface. The following diagram depicts the +relationship of these software components: -In order to port the [common component](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting_module_guide.html): - -1. Implement the cellular modem porting interface defined in [cellular_common_portable.h](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source/include/common/cellular_common_portable.h) ([Document](https://www.freertos.org/Documentation/api-ref/cellular/cellular__common__portable_8h.html)). -2. Implement the subset of Cellular Library APIs that use vendor-specific (non-3GPP) AT commands. The APIs to be implemented are the ones not marked with an "o" in [this table](https://www.freertos.org/Documentation/api-ref/cellular/cellular_common__a_p_is.html). -3. Implement Cellular Library callback functions that handle vendor-specific (non-3GPP) Unsolicited Result Code (URC). The URC handlers to be implemented are the ones not marked with an "o" in [this table](https://www.freertos.org/Documentation/api-ref/cellular/cellular_common__u_r_c_handlers.html). - -The [Cellular common APIs document](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting_module_guide.html) provides detail information required in each steps. -It is recommended that you start by cloning the implementation of one of the existing modems, then make modifications where your modem's vendor-specific (non-3GPP) AT commands are different. - - Current Example Implementations: - -* [Quectel BG96](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Reference-Quectel-BG96) -* [Sierra Wireless HL7802](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Reference-Sierra-Wireless-HL7802) -* [U-Blox Sara-R4](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface-Reference-ublox-SARA-R4) - -## Integrate FreeRTOS Cellular Interface with application - -Once comm interface and cellular module implementation are ready, we can start to integrate -FreeRTOS Cellular Interface. The following diagram depicts the relationship of these software components:


Follow these steps to integrate FreeRTOS Cellular Interface into your project: + 1. Clone this repository into your project. -2. Clone one of the refenerce cellular module implementations ( BG96 / HL7802 / SARA-R4 ) -or create your own cellular module implementaion in your project. +2. Clone one of the reference cellular module implementations ( BG96 / HL7802 / + SARA-R4 ) or create your own cellular module implementation in your project. 3. Implement comm interface. 4. Build these software components with your application and execute. -We also provide [Demos for FreeRTOS-Cellular-Interface on Windows simulator](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator) +We also provide +[Demos for FreeRTOS-Cellular-Interface on Windows Simulator](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator) as references for these three cellular modems example implementations. ## Building Unit Tests ### Checkout CMock Submodule -By default, the submodules in this repository are configured with `update=none` in [.gitmodules](.gitmodules) to avoid increasing clone time and disk space usage of other repositories (like [amazon-freertos](https://github.com/aws/amazon-freertos) that submodules this repository). +By default, the submodules in this repository are configured with `update=none` +in [.gitmodules](.gitmodules) to avoid increasing clone time and disk space +usage of other repositories (like +[FreeRTOS](https://github.com/FreeRTOS/FreeRTOS) that submodules this +repository). + +To build unit tests, the submodule dependency of CMock is required. Use the +following command to clone the submodule: -To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule: ``` git submodule update --checkout --init --recursive test/unit-test/CMock ``` @@ -110,14 +165,17 @@ git submodule update --checkout --init --recursive test/unit-test/CMock ### Platform Prerequisites - For building the unit tests, **CMake 3.13.0** or later and a **C90 compiler**. -- For running unit tests, **Ruby 2.0.0** or later is additionally required for the CMock test framework (that we use). -- For running the coverage target, **gcov** and **lcov** are additionally required. +- For running unit tests, **Ruby 2.0.0** or later is additionally required for + the CMock test framework (that we use). +- For running the coverage target, **gcov** and **lcov** are additionally + required. ### Steps to build unit tests -1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule).) +1. Go to the root directory of this repository. (Make sure that the **CMock** + submodule is cloned as described [above](#checkout-cmock-submodule).) -1. Run the *cmake* command: `cmake -S test -B build` +1. Run the _cmake_ command: `cmake -S test -B build` 1. Run this command to build the library and unit tests: `make -C build all` @@ -127,20 +185,27 @@ git submodule update --checkout --init --recursive test/unit-test/CMock ## CBMC -To learn more about CBMC and proofs specifically, review the training material [here](https://model-checking.github.io/cbmc-training). +To learn more about CBMC and proofs specifically, review the training material +[here](https://model-checking.github.io/cbmc-training). The `test/cbmc/proofs` directory contains CBMC proofs. -In order to run these proofs you will need to install CBMC and other tools by following the instructions [here](https://model-checking.github.io/cbmc-training/installation.html). +In order to run these proofs you will need to install CBMC and other tools by +following the instructions +[here](https://model-checking.github.io/cbmc-training/installation.html). ## Reference examples -Please refer to the demos of the Cellular Interface library [here](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator) using FreeRTOS on the Windows simulator platform. These can be used as reference examples for the library API. +Please refer to the demos of the Cellular Interface library +[here](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo/FreeRTOS_Cellular_Interface_Windows_Simulator) +using FreeRTOS on the Windows simulator platform. These can be used as reference +examples for the library API. ## Generating documentation The Doxygen references were created using Doxygen version 1.9.2. To generate the -Doxygen pages, please run the following command from the root of this repository: +Doxygen pages, please run the following command from the root of this +repository: ```shell doxygen docs/doxygen/config.doxyfile @@ -148,4 +213,5 @@ doxygen docs/doxygen/config.doxyfile ## Contributing -See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on contributing. +See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on +contributing. diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 00000000..911ce1d8 --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,31 @@ +--- +$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json +version: '0.2' +# Allows things like stringLength +allowCompoundWords: true + +# Read files not to spell check from the git ignore +useGitignore: true + +# Language settings for C +languageSettings: + - caseSensitive: false + enabled: true + languageId: c + locale: "*" + +# Add a dictionary, and the path to the word list +dictionaryDefinitions: + - name: freertos-words + path: '.github/.cSpellWords.txt' + addWords: true + +dictionaries: + - freertos-words + +# Paths and files to ignore +ignorePaths: + - 'dependency' + - 'docs' + - 'ThirdParty' + - 'History.txt' diff --git a/docs/plantuml/images/cellular_components.svg b/docs/plantuml/images/cellular_components.svg index 42f77152..9763c9ef 100644 --- a/docs/plantuml/images/cellular_components.svg +++ b/docs/plantuml/images/cellular_components.svg @@ -1,4 +1,4 @@ - + diff --git a/lexicon.txt b/lexicon.txt deleted file mode 100644 index e67044d8..00000000 --- a/lexicon.txt +++ /dev/null @@ -1,931 +0,0 @@ -accessmode -activatepdn -activetimevalue -actstatus -af -aka -api -apis -apn -apnname -app -args -async -atcheckerrorcode -atcmddatasend -atcmdqueryregstatus -atcmdrequestwithcallback -atcmdtype -atcmdupdatemccmnc -atcommandraw -atcommandtype -atcore -atdatareqsocketsend -atgetnexttok -atgetspecificnexttok -athexstrtohex -atisprefixpresent -atisstrdigit -atlib -atoi -atparseinit -atremovealldoublequote -atremoveallwhitespaces -atremoveleadingwhitespaces -atremoveoutermostdoublequote -atremoveprefix -atremovetrailingwhitespaces -atreq -atreqgetfirmwareversion -atreqgethplmn -atreqgeticcid -atreqgetimei -atreqgetimsi -atreqgetmanufactureid -atreqgetmodelid -atreqgetnoresult -atreqsocketrecv -atreqsocketsend -atresp -atresptype -atstrdup -atstrstartwith -atstrtoi -attimeoutms -attype -auth -aws -basetype -beginging -ber -bg -blibclosing -blibopened -blibshutdown -bool -bootup -bpktioup -br -bsearch -bufferlength -bytesbeforedata -bytesdata -bytesinbuffer -bytesleft -bytesread -callbackevents -catm -cbevents -cbmc -cclk -cedrxs -cellid -cellularatcommanddataprefixcallback -cellularatcommanddatasendprefixcallback -cellularatcommandline -cellularatcommandresponsereceivedcallback -cellularatcommandtype -cellularatdata -cellularatdatareq -cellularatparsetokenhandler -cellularatparsetokenmap -cellularatreq -cellularcomminterface -cellularcomminterfaceclose -cellularcomminterfaceopen -cellularcomminterfacerecv -cellularcomminterfacesend -cellulareidrxsettings -cellularerror -cellularhandle -cellularipaddress -cellularipaddresstype -cellularlib -cellularnetworkregistrationmode -cellularnetworkregistrationstatus -cellularoperatornameformat -cellularpdnauthtype -cellularpdncontexttype -cellularpdnstatus -cellularpktstatus -cellularplmninfo -cellularprefixtoparsermapsize -cellularpsmsettings -cellularrat -cellularsimcardlockstate -cellularsimcardstate -cellularsocketaccessmode -cellularsocketaddress -cellularsocketclosedcallback -cellularsocketcontext -cellularsocketdatareadycallback -cellularsocketdomain -cellularsocketopencallback -cellularsocketprotocol -cellularsocketstate -cellularsockettype -cellularsrcextratokensuccesstablesize -cellularsrctokenerrortablesize -cellularsrctokensuccesstablesize -cellulartokentable -cellularurchandlertable -cellularurchandlertablesize -cellularurctokenwoprefixtablesize -celular -cereg -cesq -cfun -cgact -cgdcont -cgerep -cgev -cgpaddr -cgreg -charater -checkcrsmmemorystatus -checkcrsmreadstatus -checklibrarystatus -chk -ci -cid -ciev -clearbits -closedcallback -cmakelists -cmd -cmdbuf -cmock -com -comm -commad -comminterfacehandle -commmand -commmon -commnad -commonatcommandraw -commoncleanup -commoncreatesocket -commongeteidrxsettings -commongetipaddress -commongetmodeminfo -commongetnetworktime -commongetpsmsettings -commongetregisterednetwork -commongetservicestatus -commongetsimcardinfo -commongetsimcardlockstatus -commoninit -commonregistermodemeventcallback -commonregisterurcgenericcallback -commonregisterurcnetworkregistrationeventcallback -commonregisterurcpdneventcallback -commonregisterurcsignalstrengthchangedcallback -commonrfoff -commonrfon -commonseteidrxsettings -commonsetpdnconfig -commonsetpsmsettings -commonsocketregisterclosedcallback -commonsocketregisterdatareadycallback -commonsocketregistersocketopencallback -commonsocketsetsockopt -commonurcprocesscereg -commonurcprocesscgreg -commonurcprocesscreg -comparevalue -computesignalbars -cond -config -configuse -const -contextactstate -contextid -contextspresent -convertcsqsignalber -convertcsqsignalrssi -copybrief -copydoc -corehttp -corp -coverity -cpin -cpsms -createatdatamutex -createdetachedthread -createlibstatusmutex -createpktrequestmutex -createpktresponsemutex -createsocket -createsocketdata -creg -crsm -crsmmemorystatus -csq -csqber -csqrssi -csregistrationstatus -csregstatus -csrejcause -csrejectioncause -csrejectiontype -csrejecttype -cts -dataaccessmode -datalen -datalength -datamode -datareadycallback -datarecv -datareq -datatimeoutms -datatypes -db -dbm -de -deact -deactivatepdn -dec -decihours -declar -defgroup -deinitialization -delayms -democonfigmqtt -depndency -deregister -deregistration -descr -destroypktrequestmutex -destroypktresponsemutex -dgram -dns -dnsindex -dnsquerymutex -dnsresultnumber -doxygen -drx -dst -dtr -ecn -ecno -edrx -ef -efhplmnwact -eidrxlist -eidrxsettingslist -emerg -endcode -endcond -endif -endpatternlen -enougth -enum -enums -eof -eps -erange -errno -ethernet -evenggroup -eventbits -eventgroup -eventgrouphandle -evt -fasle -ff -fffe -ffffff -findlineinstream -firmwareversion -freertos -freertosconfig -fucntion -fso -functionpointers -fw -gcc -genericcallback -getbits -getcurrentrat -geteidrxsettings -gethostbyname -getipaddress -getmodeminfo -getmodulecontext -getmsgtype -getnetworktime -getnexttok -getpdnstatus -getpsmsettings -getratpriority -getregisterednetwork -getservicestatus -getsignalinfo -getsimcardinfo -getsimcardstatus -getsocketdata -github -gpp -gprs -gprsreadytimer -gsm -handledata -handleleftoverbuffer -handlepacket -handlepacketcb -hardwareversion -hexdatalen -hl -hpktiocommintf -hplmn -hplmnwact -href -hsdpa -hsdpahsupa -hsupa -html -http -https -hw -iccid -ifndef -imei -implemenation -implementating -imsi -inc -incliudes -ind -indicat -inet -ingroup -inidcate -init -inputbuffercallback -inputline -inputwithprefix -int -interdelayms -intf -io -iot -iotat -iotmutex -ip -ipaddress -ipaddresstype -iptype -ipv -isalpha -isdigit -iso -isr -isspace -isurc -isvalidpdn -isvalidsocket -jan -keepprocess -keylist -keylistlen -kselacq -ktcp -ktcprcv -ktcpsnd -ktcpstat -lac -len -libatdata -libatdatamutex -libcleanup -libinit -libstatusmutex -linelength -liniked -linux -localip -localipaddress -localport -logdebug -logerror -loginfo -logwarn -lte -mainpage -malloc -manufactureid -maxlen -mcc -md -mem -memorystatus -memset -metadata -min -misra -mit -mnc -mno -modelid -modemevent -modemeventcallback -modulecleanup -moduleenableue -moduleenableurc -moduleinit -mqtt -mutex -mutexes -nb -nbiot -netsub -networ -networkregistrationcallback -networkregistrationmode -networkregmode -netwrok -newcmdlen -noninfringement -notif -num -numstatusbuffers -nwprovidededrxvaue -nwscanseq -ok -ommited -opencallback -operatorname -operatornameformat -optionlevel -optionvaluelength -org -os -pagingtimewindow -pakcet -param -params -paramstructs -paremeters -pargument -parsecops -parsecopsnetworknameformattoken -parsecopsnetworknametoken -parsecopsrattoken -parsecopsregmodetoken -parseeidrxtoken -parsehplmn -parseregstatus -parserfunc -parsesocketopen -parsetimeincclkresponse -parsetimezoneincclkresponse -parsetimezoneinfo -parseyearmonthdayincclkresponse -partialdata -partialdatarcvdlen -passcomparestring -patbuf -patcmd -patcommandpayload -patcommandpayloadin -patcommandprefix -patresp -patrspprefix -pbandcfg -pbervalue -pbuf -pbuffer -pbufferlengthhandled -pbytesread -pc -pcallbackcontext -pcellularhandle -pcellularsrcextratokensuccesstable -pcellularsrctokenerrortable -pcellularsrctokensuccesstable -pcellularurchandlertable -pcellularurctokenwoprefixtable -pchead -pchostname -pclosedcallbackcontext -pcomminterface -pcomminterfacehandle -pcommintf -pcommintfrecvcustomstring -pcontext -pcomparestring -pcurrentcmd -pcwriteto -pdata -pdatalength -pdataprefixcbcontext -pdatareadycallbackcontext -pdatareceivedlength -pdatasendprefixcbcontext -pdatasentlength -pdatastart -pdelimiter -pdms -pdn -pdnauthtype -pdncontextid -pdncontexttype -pdneventcallback -pdnsserveraddress -pdnstatusbuffers -pdnsusrdata -pdp -peidrxsettings -peidrxsettingslist -pendpattern -pendpatternline -pendptr -pendstr -periodicrauvalue -periodictauvalue -pgenericcallbackcontext -ph -phexdata -pinputbuf -pinputbuffercallbackcontext -pinputline -pinputptr -pinputstr -pitm -pkio -pkstatus -pkt -pktdataprefixcallback -pktdataprefixcb -pktdatasendprefixcallback -pktdatasendprefixcb -pktdnsqueue -pkthandler -pkthandlercleanup -pkthandlerinit -pkthanlder -pktio -pktioatcmdtype -pktiobuffer -pktioinit -pktioreadbuf -pktioreadthread -pktiosendatcmd -pktiosendbuf -pktiosenddata -pktioshutdown -pktrequestmutex -pktrespcb -pktrespmutex -pktrespprefixbuf -pktrespqueue -pktrxcallback -pktstatus -pktusrdatalen -platformeventgroup -platformeventgrouphandle -platformmutex -platfrommutex -pline -plmn -plmninfo -pmodemdata -pmodemeventcallbackcontext -pmodeminfo -pmodulecontext -pmutex -pnetworkinfo -pnetworkregistrationcallbackcontext -pnetworktime -pnewmutex -pnext -png -pnumstatus -popencallbackcontext -poptionvalue -portings -pos -posix -poutputratprioritieslength -ppatresponse -ppdatastart -ppdnconfig -ppdneventcallbackcontext -ppdnstatusbuffers -ppdptypestr -ppdst -ppkeylist -ppktiocommevent -ppktiohandlepktcb -ppktioreadptr -ppktioshutdowncb -ppktusrdata -ppmodulecontext -ppouttoken -pprefix -ppsmsettings -ppstartofdata -ppstring -pptokoutput -prat -pratpriorities -prawdata -pre -pread -preceiveddatalength -precvdatalength -pregpayload -premotesocketaddress -preprocess -presolvedaddress -presp -prespprefix -presult -printf -prioirty -prl -processmodemrdy -processpowerdown -prssivalue -prvpacketcallbackerror -prvpacketcallbacksuccess -ps -psaveptr -psentdatalength -pservicestatus -psignalinfo -psignalstrengthchangedcallbackcontext -psimcardinfo -psimcardstatus -psm -psmsettings -psocketdata -psockethandle -psrc -psregistrationstatus -psregstatus -psrejcause -psrejectioncause -psrejectiontype -psrejecttype -pstartofdata -pstr -pstring -pstrvalue -ptemp -ptempline -ptempstring -ptestusrdata -ptofree -ptoken -ptokenptr -ptokentable -ptr -puk -pundefinedrespcbcontext -puserdata -pvportmalloc -pwr -px -qccid -qcfg -qird -qisend -qsort -qual -quectel -querynetworkstatus -queuedefinition -queuehandle -queuereturnfail -rac -ratindex -ratprioritieslength -ratselectcmd -rau -rcv -rcvdata -rdy -readline -receivecallback -recognise -recv -recvdmsgtype -recvfuncgeteidrxsettings -recvfuncgethplmn -recvfuncgeticcid -recvfuncgetimsi -recvfuncgetnetworkreg -recvfuncgetnetworktime -recvfuncgetpsmsettings -recvfuncgetsimlockstatus -recvfuncipaddress -recvfuncupdatemccmnc -recvlen -recvtimeout -recvtimeoutms -reg -registermodemeventcallback -registerurcgenericcallback -registerurcnetworkregistrationeventcallback -registerurcpdneventcallback -registerurcsignalstrengthchangedcallback -regpayload -regstatus -regtype -rem -remdata -remotesocketaddress -removesocketdata -reponse -reponses -req -requestededrxvaue -resp -respcallback -respnose -respone -responsereceivedcallback -retruned -rf -rfc -rfoff -rfon -rquest -rscp -rsp -rsrp -rsrq -rssi -rtos -rts -ruese -rx -rxlev -rxqual -sara -saveing -scanseq -sdk -searchcomparefunc -sec -semophores -sendendpatternlen -sendtimeout -sendtimeoutms -sensorhub -seperator -serialnumber -servicestatus -sessionid -setbits -setbitsfromisr -setdns -seteidrxsettings -setpdnconfig -setpsmsettings -setratpriority -setsocketopt -setsockopt -shutdowncallback -signalstrengthchangedcallback -simcardlockstate -simcardstate -simlockstate -sinr -sms -smso -snprintf -socketclose -socketconnect -socketdomain -sockethandle -socketid -socketindex -socketopencallback -socketprotocol -socketrecv -socketrecvdataprefix -socketregisterclosedcallback -socketregisterdatareadycallback -socketregistersocketopencallback -socketsend -socketsenddataprefix -socketsetsockopt -socketstate -sockettype -sockindex -sortcomparefunc -sp -spdx -spi -src -stacksize -stanard -standalone -stat -staticqueue -staticsemaphore -stm -strcat -strchr -strcmp -stringlength -strlen -strncpy -strnlen -strstr -strtok -strtol -struct -subclause -sublicense -sw -tac -tcp -tcpconnectionfailure -tcpnotif -tcpsocketstate -technoloyg -tempvalue -testindex -testresultnumber -threadreturn -threadroutine -ticktype -timeoutatcmddatarecvrequestwithcallback -timeoutatcmddatasendrequestwithcallback -timeoutatcmddatasendsuccesstoken -timeoutatcmdrequestwithcallback -timeoutmilliseconds -timeoutms -timezonenegative -todo -tokentable -tokentabletype -translateatcorestatus -translatepktstatus -trylock -txt -uart -uauthreq -ubandmask -ublox -udp -ue -uint -uknown -umnoprof -undefinedrespcallback -unhandled -unneccessary -upperthreshold -urat -urc -urcevent -urcprocesscgev -urcprocessciev -urcprocessktcpdata -urcprocessktcpind -urcprocessktcpnotif -urcprocessuupsmr -urcprocessuusocl -urcprocessuusoco -urcprocessuusord -urcs -userdata -usocl -usocr -usord -usrod -utc -utest -utran -uupsmr -uusocl -uusoco -uusord -var -veventgroupdelete -vportfree -vtaskdelay -waitbits -wcdma -wifi -wo -www -xab -xeventgroupclearbits -xeventgroupcreate -xeventgroupgetbits -xeventgroupsetbits -xeventgroupsetbitsfromisr -xeventgroupwaitbits -xff -xhigherprioritytaskwoken -xmutex -xqueuecreate -xqueuereceive -xqueuesend -xxxx -yd diff --git a/source/cellular_3gpp_api.c b/source/cellular_3gpp_api.c index 4247bd32..feecbc6c 100644 --- a/source/cellular_3gpp_api.c +++ b/source/cellular_3gpp_api.c @@ -26,7 +26,7 @@ */ /** - * @brief FreeRTOS Cellular Library API implemenation with 3GPP AT command. + * @brief FreeRTOS Cellular Library API implementation with 3GPP AT command. */ /* Standard includes. */ @@ -91,17 +91,17 @@ #define T3412_TIMER_UNIT( x ) ( ( uint32_t ) ( ( ( x ) & 0x000000E0U ) >> 5U ) ) /* Bits 6, 7, 8. */ #define T3412_TIMER_VALUE( x ) ( ( uint32_t ) ( ( x ) & 0x0000001FU ) ) -#define T3412_TIMER_DEACTIVATED ( 0xFFFFFFFFU ) +#define T3412_TIMER_DEACTIVATED ( 0xFFFFFFFFU ) -#define T3412_TIMER_UNIT_10MINUTES ( 0U ) -#define T3412_TIMER_UNIT_1HOURS ( 1U ) -#define T3412_TIMER_UNIT_10HOURS ( 2U ) -#define T3412_TIMER_UNIT_2SECONDS ( 3U ) -#define T3412_TIMER_UNIT_30SECONDS ( 4U ) -#define T3412_TIMER_UNIT_1MINUTES ( 5U ) -#define T3412_TIMER_UNIT_DEACTIVATED ( 7U ) +#define T3412_TIMER_UNIT_10MINUTES ( 0U ) +#define T3412_TIMER_UNIT_1HOURS ( 1U ) +#define T3412_TIMER_UNIT_10HOURS ( 2U ) +#define T3412_TIMER_UNIT_2SECONDS ( 3U ) +#define T3412_TIMER_UNIT_30SECONDS ( 4U ) +#define T3412_TIMER_UNIT_1MINUTES ( 5U ) +#define T3412_TIMER_UNIT_DEACTIVATED ( 7U ) -#define CELULAR_PDN_CONTEXT_TYPE_MAX_SIZE ( 7U ) /* The length of "IPV4V6" + 1. */ +#define CELLULAR_PDN_CONTEXT_TYPE_MAX_SIZE ( 7U ) /* The length of "IPV4V6" + 1. */ /*-----------------------------------------------------------*/ @@ -1268,7 +1268,7 @@ static CellularATError_t parseEidrxToken( char * pToken, if( ( tempValue >= 0 ) && ( tempValue <= ( int32_t ) UINT8_MAX ) ) { - pEidrxSettingsList->eidrxList[ count ].requestedEdrxVaue = ( uint8_t ) tempValue; + pEidrxSettingsList->eidrxList[ count ].requestedEdrxValue = ( uint8_t ) tempValue; } else { @@ -1335,7 +1335,7 @@ static CellularATError_t parseEidrxLine( char * pInputLine, { LogDebug( ( "GetEidrx setting[%d]: RAT: %d, Value: 0x%x", count, pEidrxSettingsList->eidrxList[ count ].rat, - pEidrxSettingsList->eidrxList[ count ].requestedEdrxVaue ) ); + pEidrxSettingsList->eidrxList[ count ].requestedEdrxValue ) ); } else { @@ -1698,7 +1698,7 @@ CellularError_t Cellular_CommonSetEidrxSettings( CellularHandle_t cellularHandle "AT+CEDRXS=", pEidrxSettings->mode, pEidrxSettings->rat, - PRINTF_BYTE_TO_BINARY_INT4( pEidrxSettings->requestedEdrxVaue ) ); + PRINTF_BYTE_TO_BINARY_INT4( pEidrxSettings->requestedEdrxValue ) ); LogDebug( ( "Eidrx setting: %s ", cmdBuf ) ); /* Query the PSMsettings from the network. */ pktStatus = _Cellular_AtcmdRequestWithCallback( pContext, atReqSetEidrx ); @@ -2138,7 +2138,7 @@ CellularError_t Cellular_CommonSetPdnConfig( CellularHandle_t cellularHandle, CellularError_t cellularStatus = CELLULAR_SUCCESS; CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK; char cmdBuf[ CELLULAR_AT_CMD_MAX_SIZE ] = { '\0' }; - char pPdpTypeStr[ CELULAR_PDN_CONTEXT_TYPE_MAX_SIZE ] = { '\0' }; + char pPdpTypeStr[ CELLULAR_PDN_CONTEXT_TYPE_MAX_SIZE ] = { '\0' }; CellularAtReq_t atReqSetPdn = { 0 }; atReqSetPdn.pAtCmd = cmdBuf; @@ -2718,7 +2718,7 @@ CellularError_t Cellular_CommonGetSimCardInfo( CellularHandle_t cellularHandle, atReqGetImsi.pData = pSimCardInfo->imsi; atReqGetImsi.dataLen = CELLULAR_IMSI_MAX_SIZE + 1U; - atReqGetHplmn.pAtCmd = "AT+CRSM=176,28514,0,0,0"; /* READ BINARY commmand. HPLMN Selector with Access Technology( 6F62 ). */ + atReqGetHplmn.pAtCmd = "AT+CRSM=176,28514,0,0,0"; /* READ BINARY command. HPLMN Selector with Access Technology( 6F62 ). */ atReqGetHplmn.atCmdType = CELLULAR_AT_WITH_PREFIX; atReqGetHplmn.pAtRspPrefix = "+CRSM"; atReqGetHplmn.respCallback = _Cellular_RecvFuncGetHplmn; diff --git a/source/cellular_3gpp_urc_handler.c b/source/cellular_3gpp_urc_handler.c index b477189d..8313ed2c 100644 --- a/source/cellular_3gpp_urc_handler.c +++ b/source/cellular_3gpp_urc_handler.c @@ -26,7 +26,7 @@ */ /** - * @brief FreeRTOS Cellular Library URC handler implemenation with 3GPP URC. + * @brief FreeRTOS Cellular Library URC handler implementation with 3GPP URC. */ @@ -141,22 +141,22 @@ static CellularPktStatus_t _parseRegStatusInRegStatusParsing( CellularContext_t if( regStatus == REGISTRATION_STATUS_REGISTERED_HOME ) { - LogDebug( ( "Netowrk registration : HOME" ) ); + LogDebug( ( "Network registration : HOME" ) ); } else if( regStatus == REGISTRATION_STATUS_ROAMING_REGISTERED ) { - LogDebug( ( "Netowrk registration : ROAMING" ) ); + LogDebug( ( "Network registration : ROAMING" ) ); } else if( regStatus == REGISTRATION_STATUS_REGISTRATION_DENIED ) { /* clear the atlib data if the registration failed. */ - LogDebug( ( "Netowrk registration : DEINED" ) ); + LogDebug( ( "Network registration : DEINED" ) ); _Cellular_InitAtData( pContext, 1 ); } else { /* clear the atlib data if the registration failed. */ - LogDebug( ( "Netowrk registration : OTHERS" ) ); + LogDebug( ( "Network registration : OTHERS" ) ); _Cellular_InitAtData( pContext, 1 ); } } @@ -475,7 +475,7 @@ static void _regStatusGenerateEvent( const CellularContext_t * pContext, serviceStatus.psRejectionCause = pLibAtData->psRejCause; serviceStatus.psRejectionType = pLibAtData->psRejectType; - /* Data should be obtained from COPS commmand. User should obtain with APIs. */ + /* Data should be obtained from COPS command. User should obtain with APIs. */ ( void ) strcpy( serviceStatus.plmnInfo.mcc, "FFF" ); ( void ) strcpy( serviceStatus.plmnInfo.mnc, "FFF" ); ( void ) strcpy( serviceStatus.operatorName, "FFF" ); diff --git a/source/cellular_common.c b/source/cellular_common.c index ec92d3f5..eede0608 100644 --- a/source/cellular_common.c +++ b/source/cellular_common.c @@ -102,13 +102,13 @@ static void _Cellular_SetShutdownCallback( CellularContext_t * pContext, /*-----------------------------------------------------------*/ #if ( CELLULAR_CONFIG_STATIC_ALLOCATION_CONTEXT == 1 ) - static CellularContext_t cellularStaticContextTable[ CELLULAR_CONTEXT_MAX ] = { 0 }; +static CellularContext_t cellularStaticContextTable[ CELLULAR_CONTEXT_MAX ] = { 0 }; #endif static CellularContext_t * cellularContextTable[ CELLULAR_CONTEXT_MAX ] = { 0 }; #if ( CELLULAR_CONFIG_STATIC_SOCKET_CONTEXT_ALLOCATION == 1 ) - static CellularSocketContext_t cellularStaticSocketDataTable[ CELLULAR_NUM_SOCKET_MAX ] = { 0 }; +static CellularSocketContext_t cellularStaticSocketDataTable[ CELLULAR_NUM_SOCKET_MAX ] = { 0 }; #endif /*-----------------------------------------------------------*/ @@ -125,13 +125,13 @@ static CellularContext_t * _Cellular_AllocContext( void ) if( cellularContextTable[ i ] == NULL ) { #if ( CELLULAR_CONFIG_STATIC_ALLOCATION_CONTEXT == 1 ) - { - pContext = &cellularStaticContextTable[ i ]; - } + { + pContext = &cellularStaticContextTable[ i ]; + } #else - { - pContext = ( CellularContext_t * ) Platform_Malloc( sizeof( CellularContext_t ) ); - } + { + pContext = ( CellularContext_t * ) Platform_Malloc( sizeof( CellularContext_t ) ); + } #endif if( pContext != NULL ) @@ -163,9 +163,9 @@ static void _Cellular_FreeContext( CellularContext_t * pContext ) { cellularContextTable[ i ] = NULL; #if ( CELLULAR_CONFIG_STATIC_ALLOCATION_CONTEXT == 0 ) - { - Platform_Free( pContext ); - } + { + Platform_Free( pContext ); + } #endif break; } @@ -262,9 +262,9 @@ static void libClose( CellularContext_t * pContext ) if( pContext->pSocketData[ i ] != NULL ) { #if ( CELLULAR_CONFIG_STATIC_SOCKET_CONTEXT_ALLOCATION == 0 ) - { - Platform_Free( pContext->pSocketData[ i ] ); - } + { + Platform_Free( pContext->pSocketData[ i ] ); + } #endif pContext->pSocketData[ i ] = NULL; } @@ -356,19 +356,19 @@ static uint8_t _getSignalBars( int16_t compareValue, if( ( rat == CELLULAR_RAT_GSM ) || ( rat == CELLULAR_RAT_EDGE ) ) { pSignalBarsTable = gsmSignalBarsTable; - tableSize = ( uint8_t ) ARRY_SIZE( gsmSignalBarsTable ); + tableSize = ( uint8_t ) ARRAY_SIZE( gsmSignalBarsTable ); } if( ( rat == CELLULAR_RAT_CATM1 ) || ( rat == CELLULAR_RAT_LTE ) ) { pSignalBarsTable = lteCATMSignalBarsTable; - tableSize = ( uint8_t ) ARRY_SIZE( lteCATMSignalBarsTable ); + tableSize = ( uint8_t ) ARRAY_SIZE( lteCATMSignalBarsTable ); } if( rat == CELLULAR_RAT_NBIOT ) { pSignalBarsTable = lteNBIotSignalBarsTable; - tableSize = ( uint8_t ) ARRY_SIZE( lteNBIotSignalBarsTable ); + tableSize = ( uint8_t ) ARRAY_SIZE( lteNBIotSignalBarsTable ); } for( i = 0; i < tableSize; i++ ) @@ -545,13 +545,13 @@ CellularError_t _Cellular_CreateSocketData( CellularContext_t * pContext, if( pContext->pSocketData[ socketId ] == NULL ) { #if ( CELLULAR_CONFIG_STATIC_SOCKET_CONTEXT_ALLOCATION == 1 ) - { - pSocketData = &cellularStaticSocketDataTable[ socketId ]; - } + { + pSocketData = &cellularStaticSocketDataTable[ socketId ]; + } #else - { - pSocketData = ( CellularSocketContext_t * ) Platform_Malloc( sizeof( CellularSocketContext_t ) ); - } + { + pSocketData = ( CellularSocketContext_t * ) Platform_Malloc( sizeof( CellularSocketContext_t ) ); + } #endif if( pSocketData != NULL ) @@ -721,7 +721,7 @@ CellularError_t _Cellular_ConvertCsqSignalBer( int16_t csqBer, CellularError_t cellularStatus = CELLULAR_SUCCESS; int16_t berValue = 0; - static const uint16_t rxqualValueToBerTable[] = + static const uint16_t rxEqualValueToBerTable[] = { 14, /* Assumed value 0.14%. */ 28, /* Assumed value 0.28%.*/ @@ -750,7 +750,7 @@ CellularError_t _Cellular_ConvertCsqSignalBer( int16_t csqBer, } else { - berValue = ( int16_t ) rxqualValueToBerTable[ csqBer ]; + berValue = ( int16_t ) rxEqualValueToBerTable[ csqBer ]; } } @@ -965,7 +965,7 @@ CellularError_t _Cellular_LibInit( CellularHandle_t * pCellularHandle, } } - /* Defines the Mutexes and Semophores. */ + /* Defines the Mutexes and Semaphores. */ if( cellularStatus == CELLULAR_SUCCESS ) { if( _Cellular_CreateLibStatusMutex( pContext ) != true ) diff --git a/source/cellular_pkthandler.c b/source/cellular_pkthandler.c index 2c6f9d72..a87433bd 100644 --- a/source/cellular_pkthandler.c +++ b/source/cellular_pkthandler.c @@ -780,7 +780,7 @@ CellularPktStatus_t _Cellular_PktHandlerInit( CellularContext_t * pContext ) if( pContext != NULL ) { - /* Create the response queue which is used to post reponses to the sender. */ + /* Create the response queue which is used to post responses to the sender. */ pContext->pktRespQueue = xQueueCreate( 1, ( uint32_t ) sizeof( CellularPktStatus_t ) ); if( pContext->pktRespQueue == NULL ) diff --git a/source/cellular_pktio.c b/source/cellular_pktio.c index 81f32534..1d7dbfb3 100644 --- a/source/cellular_pktio.c +++ b/source/cellular_pktio.c @@ -310,7 +310,7 @@ static void _Cellular_AtResponseFree( CellularATCommandResponse_t * pResp ) pToFree = pCurrLine; pCurrLine = pCurrLine->pNext; - /* Ruese the pktiobuffer. No need to free pToFree->pLine here. */ + /* Reuse the packet io buffer. No need to free pToFree->pLine here. */ Platform_Free( pToFree ); } @@ -562,7 +562,7 @@ static char * _handleLeftoverBuffer( CellularContext_t * pContext ) /*-----------------------------------------------------------*/ /* pBytesRead : bytes read from comm interface. */ -/* partialData : leftover bytes in the pktioreadbuf. Not enougth to be a command. */ +/* partialData : leftover bytes in the pktioreadbuf. Not enough to be a command. */ static char * _Cellular_ReadLine( CellularContext_t * pContext, uint32_t * pBytesRead, const CellularATCommandResponse_t * pAtResp ) @@ -947,7 +947,7 @@ static bool _preprocessLine( CellularContext_t * pContext, if( pktDataSendPrefixCB != NULL ) { /* Check if the AT command response is the data send prefix. - * Data send prefix is an SRC success token for data send AT commmand. + * Data send prefix is an SRC success token for data send AT command. * It is used to indicate modem can receive data now. */ /* This function may fix the data stream if the data send prefix is not a line. */ pktStatus = pktDataSendPrefixCB( pDataSendPrefixCBContext, pTempLine, pBytesRead ); @@ -1126,7 +1126,7 @@ static void _handleAllReceived( CellularContext_t * pContext, } else if( ( pktStatus == CELLULAR_PKT_STATUS_OK ) || ( pktStatus == CELLULAR_PKT_STATUS_PENDING_DATA ) ) { - /* Process AT reponse success. Get the next Line. */ + /* Process AT response success. Get the next Line. */ keepProcess = _getNextLine( pContext, &pTempLine, &bytesRead, currentLineLength, pktStatus ); } else diff --git a/source/include/cellular_config_defaults.h b/source/include/cellular_config_defaults.h index 320af51a..7eb7dfbe 100644 --- a/source/include/cellular_config_defaults.h +++ b/source/include/cellular_config_defaults.h @@ -344,7 +344,7 @@ #endif /** - * @brief Default radio access technoloyg.
+ * @brief Default radio access technology.
* * Possible values:`Any value before CELLULAR_RAT_MAX` ( Reference : @ref CellularRat_t )
* Default value (if undefined): CELLULAR_RAT_CATM1 diff --git a/source/include/cellular_types.h b/source/include/cellular_types.h index 53eeba61..c8e04c09 100644 --- a/source/include/cellular_types.h +++ b/source/include/cellular_types.h @@ -471,7 +471,7 @@ typedef struct CellularServiceStatus */ typedef struct CellularATCommandLine { - struct CellularATCommandLine * pNext; /**< The CellularATCommandLine structure pointer points to the next element of the liniked list. */ + struct CellularATCommandLine * pNext; /**< The CellularATCommandLine structure pointer points to the next element of the linked list. */ char * pLine; /**< The content of the at command. */ } CellularATCommandLine_t; @@ -608,8 +608,8 @@ typedef struct CellularEidrxSettings * 1 1 1 0 5242.88 seconds * 1 1 1 1 10485.76 seconds */ - uint8_t requestedEdrxVaue; /**< Requested eDRX value encoded as per spec (as shown above). */ - uint8_t nwProvidedEdrxVaue; /**< Network provided eDRX value encoded as per spec (as shown above). Only applicable in URC. */ + uint8_t requestedEdrxValue; /**< Requested eDRX value encoded as per spec (as shown above). */ + uint8_t nwProvidedEdrxValue; /**< Network provided eDRX value encoded as per spec (as shown above). Only applicable in URC. */ /* * LTE Cat M1 mode @@ -718,7 +718,7 @@ typedef struct CellularSocketAddress * @param[in] cellularHandle The opaque cellular context pointer created by Cellular_Init. * @param[in] pAtResp The response received for the AT command. * @param[in] pData is pATCommandPayload pointer in Cellular_ATCommandRaw parameters. - * @param[in] dataLen is the string length of pATCommandPayloadin in Cellular_ATCommandRaw parameters. + * @param[in] dataLen is the string length of pATCommandPayload in in Cellular_ATCommandRaw parameters. * * @return CELLULAR_PKT_STATUS_OK if the operation is successful, otherwise an error * code indicating the cause of the error. diff --git a/source/include/common/cellular_at_core.h b/source/include/common/cellular_at_core.h index bfe094db..0518f543 100644 --- a/source/include/common/cellular_at_core.h +++ b/source/include/common/cellular_at_core.h @@ -57,7 +57,7 @@ /** * @brief The array size of an array. */ -#define ARRY_SIZE( x ) ( sizeof( x ) / sizeof( x[ 0 ] ) ) +#define ARRAY_SIZE( x ) ( sizeof( x ) / sizeof( x[ 0 ] ) ) /*-----------------------------------------------------------*/ diff --git a/source/include/common/cellular_common.h b/source/include/common/cellular_common.h index aecc5c5e..3bd8ac49 100644 --- a/source/include/common/cellular_common.h +++ b/source/include/common/cellular_common.h @@ -95,7 +95,7 @@ typedef void ( * CellularAtParseTokenHandler_t )( CellularContext_t * pContext, /** * @ingroup cellular_common_datatypes_paramstructs - * @brief the URC token and URC handler mapping structure used by pkthanlder. + * @brief the URC token and URC handler mapping structure used by pkthandler. */ typedef struct CellularAtParseTokenMap { @@ -444,7 +444,7 @@ CellularError_t _Cellular_ConvertCsqSignalRssi( int16_t csqRssi, int16_t * pRssiValue ); /** - * @brief Convert CSQ command retruned BER value. + * @brief Convert CSQ command returned BER value. * * @param[in] csqBer The CSQ command returned BER index. * @param[out] pBerValue The output parameter to return the converted @@ -584,7 +584,7 @@ CellularPktStatus_t _Cellular_TimeoutAtcmdDataSendRequestWithCallback( CellularC * @param[in] pContext The opaque cellular context pointer created by Cellular_Init. * @param[in] atReq The AT command data structure with send command response callback. * @param[in] dataReq The following data request after the at request. - * @param[in] pktDataSendPrefixCallback The callback function to inidcate the data sending start. + * @param[in] pktDataSendPrefixCallback The callback function to indicate the data sending start. * @param[in] pCallbackContext The callback context pass to pktDataSendPrefixCallback function. * @param[in] atTimeoutMS The timeout value to wait for the AT command response from cellular modem. * @param[in] dataTimeoutMS The timeout value to wait for the data command response from cellular modem. diff --git a/source/include/private/cellular_common_internal.h b/source/include/private/cellular_common_internal.h index c7af9296..dedc296a 100644 --- a/source/include/private/cellular_common_internal.h +++ b/source/include/private/cellular_common_internal.h @@ -159,7 +159,7 @@ struct CellularContext /*-----------------------------------------------------------*/ /** - * @brief Netwrok registration respone parsing function. + * @brief Network registration respone parsing function. * * Parse the network registration response from AT command response or URC. * The result is stored in the pContext. diff --git a/source/include/private/cellular_pkthandler_internal.h b/source/include/private/cellular_pkthandler_internal.h index 9bb6fb81..1598bfbc 100644 --- a/source/include/private/cellular_pkthandler_internal.h +++ b/source/include/private/cellular_pkthandler_internal.h @@ -53,7 +53,7 @@ /** * @brief Create the packet request mutex. * - * Create the mutex for packet rquest in cellular context. + * Create the mutex for packet request in cellular context. * * @param[in] pContext The opaque cellular context pointer created by Cellular_Init. */ @@ -62,7 +62,7 @@ bool _Cellular_CreatePktRequestMutex( CellularContext_t * pContext ); /** * @brief Destroy the packet request mutex. * - * Destroy the mutex for packet rquest in cellular context. + * Destroy the mutex for packet request in cellular context. * * @param[in] pContext The opaque cellular context pointer created by Cellular_Init. */ @@ -101,7 +101,7 @@ CellularPktStatus_t _Cellular_PktHandlerInit( CellularContext_t * pContext ); /** * @brief Packet handler cleanup function. * - * This function cleanup the pakcet handler in FreeRTOS Cellular Library common. + * This function cleanup the packet handler in FreeRTOS Cellular Library common. * * @param[in] pContext The opaque cellular context pointer created by Cellular_Init. */ diff --git a/test/unit-test/cellular_3gpp_api_utest.c b/test/unit-test/cellular_3gpp_api_utest.c index 8ef472f4..233c5422 100644 --- a/test/unit-test/cellular_3gpp_api_utest.c +++ b/test/unit-test/cellular_3gpp_api_utest.c @@ -89,7 +89,7 @@ typedef enum parseTimeConditionState { PARSE_TIME_FIRST_CALL_FAILURE_CONDITION = 6, PARSE_TIME_SECOND_CALL_FAILURE_CONDITION = 7, - PARSE_TIME_THRID_CALL_FAILURE_CONDITION = 8, + PARSE_TIME_THIRD_CALL_FAILURE_CONDITION = 8, PARSE_TIME_FOURTH_CALL_FAILURE_CONDITION = 9, PARSE_TIME_FIFTH_CALL_FAILURE_CONDITION = 10, PARSE_TIME_SIXTH_CALL_FAILURE_CONDITION = 11 @@ -392,7 +392,7 @@ CellularATError_t Mock_Cellular_ATStrtoi( const char * pStr, *pResult = atoi( pStr ); } } - else if( cbCondition == PARSE_TIME_THRID_CALL_FAILURE_CONDITION ) + else if( cbCondition == PARSE_TIME_THIRD_CALL_FAILURE_CONDITION ) { if( cmock_num_calls == 3 ) { @@ -1864,13 +1864,13 @@ void test_Cellular_CommonSetEidrxSettings_Happy_Path( void ) CellularHandle_t cellularHandle = &context; CellularEidrxSettings_t eidrxSettings; - eidrxSettings.requestedEdrxVaue = 0xF; + eidrxSettings.requestedEdrxValue = 0xF; _Cellular_CheckLibraryStatus_IgnoreAndReturn( CELLULAR_SUCCESS ); _Cellular_AtcmdRequestWithCallback_IgnoreAndReturn( CELLULAR_PKT_STATUS_OK ); cellularStatus = Cellular_CommonSetEidrxSettings( cellularHandle, &eidrxSettings ); TEST_ASSERT_EQUAL( CELLULAR_SUCCESS, cellularStatus ); - eidrxSettings.requestedEdrxVaue = 0x0; + eidrxSettings.requestedEdrxValue = 0x0; _Cellular_CheckLibraryStatus_IgnoreAndReturn( CELLULAR_SUCCESS ); _Cellular_AtcmdRequestWithCallback_IgnoreAndReturn( CELLULAR_PKT_STATUS_OK ); cellularStatus = Cellular_CommonSetEidrxSettings( cellularHandle, &eidrxSettings ); @@ -3328,7 +3328,7 @@ void test_Cellular_CommonGetNetworkTime_Bad_Parameter( void ) } /** - * @brief Test that retrieve networ time failure case Cellular_CommonGetNetworkTime to return CELLULAR_SUCCESS. + * @brief Test that retrieve network time failure case Cellular_CommonGetNetworkTime to return CELLULAR_SUCCESS. */ void test_Cellular_CommonGetNetworkTime_Retrieve_Network_Time_Failure( void ) { @@ -3665,7 +3665,7 @@ void test_Cellular_CommonGetNetworkTime_RecvFuncCallback_Parse_TimeZone_InCCLKRe /** * @brief Test that _parseTimeZoneInCCLKResponse negative case in _Cellular_RecvFuncGetNetworkTime to return CELLULAR_INTERNAL_FAILURE. */ -void test_Cellular_CommonGetNetworkTime_RecvFuncCallback_Parse_TimeZone_InCCLKResp_Nagetive( void ) +void test_Cellular_CommonGetNetworkTime_RecvFuncCallback_Parse_TimeZone_InCCLKResp_Negative( void ) { CellularError_t cellularStatus = CELLULAR_SUCCESS; CellularContext_t context; @@ -4046,7 +4046,7 @@ void test_Cellular_CommonGetNetworkTime_RecvFuncCallback_Parse_YearMonthDAy_CCLK _Cellular_CheckLibraryStatus_IgnoreAndReturn( CELLULAR_SUCCESS ); /* parse time failure case condition. */ - cbCondition = PARSE_TIME_THRID_CALL_FAILURE_CONDITION; + cbCondition = PARSE_TIME_THIRD_CALL_FAILURE_CONDITION; _Cellular_AtcmdRequestWithCallback_StubWithCallback( Mock_AtcmdRequestWithCallback__Cellular_RecvFuncGetNetworkTime ); Cellular_ATRemovePrefix_IgnoreAndReturn( CELLULAR_AT_SUCCESS ); @@ -4083,7 +4083,7 @@ void test_Cellular_CommonGetNetworkTime_RecvFuncCallback_Parse_YearMonthDAy_CCLK _Cellular_CheckLibraryStatus_IgnoreAndReturn( CELLULAR_SUCCESS ); /* parse time failure case condition. */ - cbCondition = PARSE_TIME_THRID_CALL_FAILURE_CONDITION; + cbCondition = PARSE_TIME_THIRD_CALL_FAILURE_CONDITION; negativeNumberCase = 1; _Cellular_AtcmdRequestWithCallback_StubWithCallback( Mock_AtcmdRequestWithCallback__Cellular_RecvFuncGetNetworkTime ); @@ -6545,7 +6545,7 @@ void test_Cellular_CommonGetSimCardLockStatus_Cb_Cellular_RecvFuncGetSimLockStat } /** - * @brief Test that SimLockState Uknown case in callback function _Cellular_RecvFuncGetSimLockStatus + * @brief Test that SimLockState Unknown case in callback function _Cellular_RecvFuncGetSimLockStatus * for Cellular_CommonGetSimCardLockStatus to return CELLULAR_INTERNAL_FAILURE. */ void test_Cellular_CommonGetSimCardLockStatus_Cb_Cellular_RecvFuncGetSimLockStatus_SimLockState_Unknown( void ) diff --git a/test/unit-test/cellular_common_utest.c b/test/unit-test/cellular_common_utest.c index 50fe3801..a726ee99 100644 --- a/test/unit-test/cellular_common_utest.c +++ b/test/unit-test/cellular_common_utest.c @@ -124,7 +124,7 @@ static CellularTokenTable_t tokenTable = /* Look up table is maintained here as global scope within this file instead of * block scope to help developers to convert BER value. */ /* coverity[misra_c_2012_rule_8_9_violation] */ -static const uint16_t rxqualValueToBerTable[] = +static const uint16_t rxEqualValueToBerTable[] = { 14, /* Assumed value 0.14%. */ 28, /* Assumed value 0.28%.*/ @@ -667,7 +667,7 @@ void test__Cellular_IsValidSocket_Null_Context( void ) /** * @brief Test that bad socket Index parameter case for _Cellular_IsValidSocket. */ -void test__Cellular_IsValidSocket_Bad_SocketInex_Parameter( void ) +void test__Cellular_IsValidSocket_Bad_SocketIndex_Parameter( void ) { CellularError_t cellularStatus = CELLULAR_SUCCESS; CellularContext_t context; @@ -851,7 +851,7 @@ void test__Cellular_ConvertCsqSignalBer_Happy( void ) cellularStatus = _Cellular_ConvertCsqSignalBer( csqBer, &berValue ); TEST_ASSERT_EQUAL( CELLULAR_SUCCESS, cellularStatus ); - TEST_ASSERT_EQUAL( rxqualValueToBerTable[ csqBer ], berValue ); + TEST_ASSERT_EQUAL( rxEqualValueToBerTable[ csqBer ], berValue ); } /** diff --git a/test/unit-test/cellular_pktio_utest.c b/test/unit-test/cellular_pktio_utest.c index 46097639..5e52a4b6 100644 --- a/test/unit-test/cellular_pktio_utest.c +++ b/test/unit-test/cellular_pktio_utest.c @@ -2915,7 +2915,7 @@ void test__Cellular_PktioShutdown_Null_Parameter( void ) /* Mock null context */ _Cellular_PktioShutdown( NULL ); - /* Mock context exist but member bPktioUp is fasle.*/ + /* Mock context exist but member bPktioUp is false. */ _Cellular_PktioShutdown( &context ); }