mirror of
https://github.com/eclipse-threadx/threadx.git
synced 2025-11-16 04:24:48 +00:00
Compare commits
102 Commits
v6.1.1_rel
...
v6.4.0_rel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39f3c86c61 | ||
|
|
9f3e35d3dc | ||
|
|
d9ffb0f97d | ||
|
|
e73843f6d4 | ||
|
|
dbfad5d126 | ||
|
|
23aa67c948 | ||
|
|
776ea213ce | ||
|
|
55673c2410 | ||
|
|
ebe373b1f3 | ||
|
|
a8e5d0946c | ||
|
|
cad6c42ecc | ||
|
|
e420e2fa02 | ||
|
|
5f9c713c48 | ||
|
|
11a7db22b4 | ||
|
|
d17d7bdcbd | ||
|
|
2362271d4b | ||
|
|
57c251cd39 | ||
|
|
cd87763dbd | ||
|
|
13b700fd3e | ||
|
|
9ee2738aec | ||
|
|
bc4bd804d5 | ||
|
|
d43cba10b2 | ||
|
|
a0a0ef9385 | ||
|
|
6aeefea8e6 | ||
|
|
cd9007712b | ||
|
|
bc8bed494d | ||
|
|
7fa087d061 | ||
|
|
1ffd7c2cde | ||
|
|
fd2bf7c19a | ||
|
|
8ff9910ddc | ||
|
|
08380caa77 | ||
|
|
1b2995cea8 | ||
|
|
25a8fa2362 | ||
|
|
71cc95eaed | ||
|
|
361590dc40 | ||
|
|
d66a519685 | ||
|
|
6b8ece0ff2 | ||
|
|
6d9f25fac9 | ||
|
|
e2a8334f96 | ||
|
|
7a3bb8311b | ||
|
|
b11d1be6ac | ||
|
|
390c5ce1b7 | ||
|
|
672c5e953e | ||
|
|
23680f5e5f | ||
|
|
d64ef2ab06 | ||
|
|
4c4547d5d5 | ||
|
|
0d308c7ae6 | ||
|
|
487ca45752 | ||
|
|
5f430f22e2 | ||
|
|
ebeb02b958 | ||
|
|
ac3b6b326c | ||
|
|
dac41f6015 | ||
|
|
f4d6b638de | ||
|
|
2aa19f3de0 | ||
|
|
745395d6a2 | ||
|
|
9bf9fbd86f | ||
|
|
37f6d0b39c | ||
|
|
4e62226eea | ||
|
|
b42c5acd8b | ||
|
|
35a301ad3b | ||
|
|
e23b09fe0b | ||
|
|
aea1a3d8f9 | ||
|
|
ee892502ec | ||
|
|
3e8e85cdc1 | ||
|
|
b871c33620 | ||
|
|
b6fb0b8e09 | ||
|
|
35cfbfbd58 | ||
|
|
8c3c08f108 | ||
|
|
54cda6ee9e | ||
|
|
83b57acde9 | ||
|
|
e11c166a40 | ||
|
|
408f9fa1b7 | ||
|
|
cef9cb22a5 | ||
|
|
f851772ce0 | ||
|
|
cd4e736a44 | ||
|
|
11303a0e1b | ||
|
|
db11aba063 | ||
|
|
fd403521e9 | ||
|
|
f7f0957188 | ||
|
|
b216ceb25e | ||
|
|
1af8404c54 | ||
|
|
215df45d4b | ||
|
|
06064828ef | ||
|
|
d0dab58250 | ||
|
|
244365fc6a | ||
|
|
a891c3f903 | ||
|
|
db7a3972a8 | ||
|
|
f5056f4923 | ||
|
|
d759e6bb9e | ||
|
|
b12bd44faa | ||
|
|
6ffaf848a0 | ||
|
|
c8ed70019e | ||
|
|
10a7932b9d | ||
|
|
32e3b3b25f | ||
|
|
f108ebdbaf | ||
|
|
b0e9b132b5 | ||
|
|
848e7d8169 | ||
|
|
69287b8bb4 | ||
|
|
1777796996 | ||
|
|
64b4d510ba | ||
|
|
609c75a2e5 | ||
|
|
9b050d00ed |
13
.devcontainer/devcontainer.json
Normal file
13
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"image": "ghcr.io/tiejunms/azure_rtos_docker",
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cmake-tools"
|
||||
],
|
||||
|
||||
"remoteUser": "vscode",
|
||||
|
||||
"runArgs": [ "--cap-add=NET_ADMIN"]
|
||||
}
|
||||
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
@azure-rtos/admins
|
||||
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve Azure RTOS.
|
||||
title: ''
|
||||
labels: bug, hardware
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
Please also mention any information which could help others to understand
|
||||
the problem you're facing:
|
||||
- What target device are you using?
|
||||
- Which version of Azure RTOS?
|
||||
- What toolchain and environment?
|
||||
- What have you tried to diagnose or workaround this issue?
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Build my project in IAR Workbench.
|
||||
1. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Impact**
|
||||
What impact does this issue have on your progress (e.g., annoyance, showstopper)
|
||||
|
||||
**Logs and console output**
|
||||
If applicable, add console logs or other types of debug information like Wireshark capture as `.zip` file.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea or enhancement to existing feature for Azure RTOS.
|
||||
title: ''
|
||||
labels: feature
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
19
.github/ISSUE_TEMPLATE/hardware-or-architecture-support.md
vendored
Normal file
19
.github/ISSUE_TEMPLATE/hardware-or-architecture-support.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Hardware or architecture support
|
||||
about: Suggest adding hardware or new architecture support.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is this request related to a particular hardware platform, SoC, board? Please describe.**
|
||||
Describe in details the hardware support being requested and why this support benefits Azure RTOS.
|
||||
|
||||
**Describe why you are asking for this support?**
|
||||
Describe why you are asking for this support.
|
||||
|
||||
If this is a new board or SoC, please state whether you are willing to maintain the Azure RTOS support together with you.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or graphics (drag-and-drop an image) about the hardware here.
|
||||
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
## PR checklist
|
||||
<!--- Put an `x` in all the boxes that apply. -->
|
||||
- [ ] Updated function header with a short description and version number
|
||||
- [ ] Added test case for bug fix or new feature
|
||||
- [ ] Validated on real hardware <!-- hardware - toolchain -->
|
||||
28
.github/workflows/cache-update.yml
vendored
28
.github/workflows/cache-update.yml
vendored
@@ -1,28 +0,0 @@
|
||||
name: cache-update
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 */3 * *' # every 30m for testing
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps: # Cache location for arm tools
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
77
.github/workflows/ci_cortex_m.yml
vendored
Normal file
77
.github/workflows/ci_cortex_m.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: cortex_m
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- ".github/workflows/ci_cortex_m.yml"
|
||||
- 'common/**'
|
||||
- 'utility/**'
|
||||
- 'ports/cortex_m0/gnu/**'
|
||||
- 'ports/cortex_m3/gnu/**'
|
||||
- 'ports/cortex_m4/gnu/**'
|
||||
- 'ports/cortex_m7/gnu/**'
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
port: [0, 3, 4, 7]
|
||||
|
||||
name: Cortex M${{ matrix.port }} build
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
# Store the arm compilers in the cache to speed up builds
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
|
||||
# Get CMake into the environment
|
||||
- name: Install cmake 3.19.1
|
||||
uses: lukka/get-cmake@v3.19.1
|
||||
|
||||
# Get Ninja into the environment
|
||||
- name: Install ninja-build
|
||||
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||
|
||||
# Prepare the build system
|
||||
- name: Prepare build system
|
||||
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m${{ matrix.port }}.cmake -GNinja .
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Compile and link
|
||||
run: cmake --build ./build
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
|
||||
64
.github/workflows/ci_cortex_m0.yml
vendored
64
.github/workflows/ci_cortex_m0.yml
vendored
@@ -1,64 +0,0 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: cortex_m0
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout sources recursively
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
submodules: true
|
||||
|
||||
# Store the arm compilers in the cache to speed up builds
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
|
||||
# Get CMake into the environment
|
||||
- name: Install cmake 3.17.1
|
||||
uses: lukka/get-cmake@v3.17.1
|
||||
|
||||
# Get Ninja into the environment
|
||||
- name: Install ninja-build
|
||||
uses: seanmiddleditch/gha-setup-ninja@v1
|
||||
|
||||
# Prepare the build system
|
||||
- name: Prepare build system
|
||||
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m0.cmake -GNinja .
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Compile and link
|
||||
run: cmake --build ./build
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
|
||||
64
.github/workflows/ci_cortex_m3.yml
vendored
64
.github/workflows/ci_cortex_m3.yml
vendored
@@ -1,64 +0,0 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: cortex_m3
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout sources recursively
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
submodules: true
|
||||
|
||||
# Store the arm compilers in the cache to speed up builds
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
|
||||
# Get CMake into the environment
|
||||
- name: Install cmake 3.17.1
|
||||
uses: lukka/get-cmake@v3.17.1
|
||||
|
||||
# Get Ninja into the environment
|
||||
- name: Install ninja-build
|
||||
uses: seanmiddleditch/gha-setup-ninja@v1
|
||||
|
||||
# Prepare the build system
|
||||
- name: Prepare build system
|
||||
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m3.cmake -GNinja .
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Compile and link
|
||||
run: cmake --build ./build
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
|
||||
64
.github/workflows/ci_cortex_m4.yml
vendored
64
.github/workflows/ci_cortex_m4.yml
vendored
@@ -1,64 +0,0 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: cortex_m4
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout sources recursively
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
submodules: true
|
||||
|
||||
# Store the arm compilers in the cache to speed up builds
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
|
||||
# Get CMake into the environment
|
||||
- name: Install cmake 3.17.1
|
||||
uses: lukka/get-cmake@v3.17.1
|
||||
|
||||
# Get Ninja into the environment
|
||||
- name: Install ninja-build
|
||||
uses: seanmiddleditch/gha-setup-ninja@v1
|
||||
|
||||
# Prepare the build system
|
||||
- name: Prepare build system
|
||||
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m4.cmake -GNinja .
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Compile and link
|
||||
run: cmake --build ./build
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
|
||||
64
.github/workflows/ci_cortex_m7.yml
vendored
64
.github/workflows/ci_cortex_m7.yml
vendored
@@ -1,64 +0,0 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: cortex_m7
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout sources recursively
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
submodules: true
|
||||
|
||||
# Store the arm compilers in the cache to speed up builds
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
|
||||
# Get CMake into the environment
|
||||
- name: Install cmake 3.17.1
|
||||
uses: lukka/get-cmake@v3.17.1
|
||||
|
||||
# Get Ninja into the environment
|
||||
- name: Install ninja-build
|
||||
uses: seanmiddleditch/gha-setup-ninja@v1
|
||||
|
||||
# Prepare the build system
|
||||
- name: Prepare build system
|
||||
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m7.cmake -GNinja .
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Compile and link
|
||||
run: cmake --build ./build
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
|
||||
110
.github/workflows/codeql.yml
vendored
Normal file
110
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '33 1 * * 6'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
#- name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v2
|
||||
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
#- run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./scripts/install.sh
|
||||
# ./test/tx/cmake/run.sh build
|
||||
|
||||
# Store the arm compilers in the cache to speed up builds
|
||||
- name: Cache arm-none-eabi-gcc tools
|
||||
id: cache-arm-gcc
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
key: ${{ runner.os }}-arm-gcc-9-2019-q4
|
||||
|
||||
# Get the arm-non-eabi-gcc toolchain
|
||||
- name: Install arm-none-eabi-gcc
|
||||
uses: fiam/arm-none-eabi-gcc@v1
|
||||
if: steps.cache-arm-gcc.outputs.cache-hit != 'true'
|
||||
with:
|
||||
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
|
||||
directory: $HOME/arm-none-eabi-gcc-9-2019-q4
|
||||
|
||||
# Get CMake into the environment
|
||||
- name: Install cmake 3.19.1
|
||||
uses: lukka/get-cmake@v3.19.1
|
||||
|
||||
# Get Ninja into the environment
|
||||
- name: Install ninja-build
|
||||
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||
|
||||
# Prepare the build system
|
||||
- name: Prepare build system
|
||||
run: cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./cmake/cortex_m0.cmake -GNinja .
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Compile and link
|
||||
run: cmake --build ./build
|
||||
env:
|
||||
PATH: "$HOME/arm-none-eabi-gcc-9-2019-q4/bin:$PATH"
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
73
.github/workflows/ports_arch_check.yml
vendored
Normal file
73
.github/workflows/ports_arch_check.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: ports_arch_check
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- ".github/workflows/ports_arch_check.yml"
|
||||
- 'common/**'
|
||||
- 'common_modules/**'
|
||||
- 'common_smp/**'
|
||||
- 'ports/**'
|
||||
- 'ports_modules/**'
|
||||
- 'ports_smp/**'
|
||||
- 'ports_arch/**'
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# Check ports for cortex-m
|
||||
cortex-m:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout sources recursively
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
submodules: true
|
||||
|
||||
# Copy ports arch
|
||||
- name: Copy ports arch
|
||||
run: |
|
||||
scripts/copy_armv7_m.sh && scripts/copy_armv8_m.sh && scripts/copy_module_armv7_m.sh
|
||||
if [[ -n $(git status --porcelain -uno) ]]; then
|
||||
echo "Ports for ARM architecture is not updated"
|
||||
git status
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cortex-a:
|
||||
# Check ports for cortex-a
|
||||
runs-on: windows-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- name: Checkout sources recursively
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.REPO_SCOPED_TOKEN }}
|
||||
submodules: true
|
||||
|
||||
# Copy ports arch
|
||||
- name: Copy ports arch
|
||||
run: |
|
||||
cd ports_arch/ARMv7-A
|
||||
pwsh -Command ./update.ps1 -PortSets tx -CopyCommonFiles -CopyPortFiles -CopyExample -PatchFiles
|
||||
cd ../../ports_arch/ARMv8-A
|
||||
pwsh -Command ./update.ps1 -PortSets tx,tx_smp -CopyCommonFiles -CopyPortFiles -CopyExample -PatchFiles
|
||||
if ((git status --porcelain -uno) -ne $null) {
|
||||
Write-Host "Ports for ARM architecture is not updated"
|
||||
git status
|
||||
Exit 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
197
.github/workflows/regression_template.yml
vendored
Normal file
197
.github/workflows/regression_template.yml
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
# This is a basic workflow that is manually triggered
|
||||
|
||||
name: regression_template
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
install_script:
|
||||
default: './scripts/install.sh'
|
||||
required: false
|
||||
type: string
|
||||
build_script:
|
||||
default: './scripts/build.sh'
|
||||
required: false
|
||||
type: string
|
||||
test_script:
|
||||
default: './scripts/test.sh'
|
||||
required: false
|
||||
type: string
|
||||
cmake_path:
|
||||
default: './test/cmake'
|
||||
required: false
|
||||
type: string
|
||||
skip_test:
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
skip_coverage:
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
coverage_name:
|
||||
default: 'default_build_coverage'
|
||||
required: false
|
||||
type: string
|
||||
skip_deploy:
|
||||
default: false
|
||||
required: false
|
||||
type: boolean
|
||||
deploy_list:
|
||||
default: ''
|
||||
required: false
|
||||
type: string
|
||||
result_affix:
|
||||
default: ''
|
||||
required: false
|
||||
type: string
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "linux_job"
|
||||
run_tests:
|
||||
if: ${{ !inputs.skip_test}}
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
checks: write
|
||||
pull-requests: write
|
||||
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
- name: Check out the repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install softwares
|
||||
run: ${{ inputs.install_script }}
|
||||
|
||||
- name: Build
|
||||
run: ${{ inputs.build_script }}
|
||||
|
||||
- name: Test
|
||||
run: ${{ inputs.test_script }}
|
||||
|
||||
- name: Publish Test Results
|
||||
uses: EnricoMi/publish-unit-test-result-action@v2.11.0
|
||||
if: always()
|
||||
with:
|
||||
check_name: Test Results ${{ inputs.result_affix }}
|
||||
files: |
|
||||
${{ inputs.cmake_path }}/build/*/*.xml
|
||||
|
||||
- name: Upload Test Results
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3.1.3
|
||||
with:
|
||||
name: test_reports ${{ inputs.result_affix }}
|
||||
path: |
|
||||
${{ inputs.cmake_path }}/build/*.txt
|
||||
${{ inputs.cmake_path }}/build/*/Testing/**/*.xml
|
||||
${{ inputs.cmake_path }}/build/**/regression/output_files/*.bin
|
||||
|
||||
- name: Configure GitHub Pages
|
||||
uses: actions/configure-pages@v3.0.6
|
||||
|
||||
- name: Generate Code Coverage Results Summary
|
||||
if: (!inputs.skip_coverage)
|
||||
uses: irongut/CodeCoverageSummary@v1.3.0
|
||||
with:
|
||||
filename: ${{ inputs.cmake_path }}/coverage_report/${{ inputs.coverage_name }}.xml
|
||||
format: markdown
|
||||
badge: true
|
||||
hide_complexity: true
|
||||
output: file
|
||||
|
||||
- name: Write Code Coverage Summary
|
||||
if: (!inputs.skip_coverage)
|
||||
run: |
|
||||
echo "## Coverage Report ${{ inputs.result_affix }}" >> $GITHUB_STEP_SUMMARY
|
||||
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Create CheckRun for Code Coverage
|
||||
if: ((github.event_name == 'push') || (github.event_name == 'workflow_dispatch') || (github.event.pull_request.head.repo.full_name == github.repository)) && (!inputs.skip_coverage)
|
||||
uses: LouisBrunner/checks-action@v1.6.2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: Code Coverage ${{ inputs.result_affix }}
|
||||
conclusion: ${{ job.status }}
|
||||
output: |
|
||||
{"summary":"Coverage Report"}
|
||||
output_text_description_file: code-coverage-results.md
|
||||
|
||||
- name: Add Code Coverage PR Comment
|
||||
if: ((github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)) && (!inputs.skip_coverage)
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
header: Code Coverage ${{ inputs.result_affix }}
|
||||
path: code-coverage-results.md
|
||||
|
||||
# Add sudo to move coverage folder created by root user
|
||||
- name: Prepare Coverage GitHub Pages
|
||||
if: (!inputs.skip_coverage)
|
||||
run: >-
|
||||
if [ "${{ inputs.result_affix }}" != "" ] && ${{ inputs.skip_deploy }}; then
|
||||
sudo mv ${{ inputs.cmake_path }}/coverage_report/${{ inputs.coverage_name }} \
|
||||
${{ inputs.cmake_path }}/coverage_report/${{ inputs.result_affix }}
|
||||
fi
|
||||
|
||||
- name: Upload Code Coverage Artifacts
|
||||
uses: actions/upload-artifact@v3.1.3
|
||||
if: (inputs.skip_deploy && !inputs.skip_coverage)
|
||||
with:
|
||||
name: coverage_report
|
||||
path: ${{ inputs.cmake_path }}/coverage_report
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload Code Coverage Pages
|
||||
uses: actions/upload-pages-artifact@v2.0.0
|
||||
if: (!inputs.skip_deploy && !inputs.skip_coverage)
|
||||
with:
|
||||
path: ${{ inputs.cmake_path }}/coverage_report/${{ inputs.coverage_name }}
|
||||
|
||||
deploy_code_coverage:
|
||||
runs-on: ubuntu-latest
|
||||
if: ((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && !inputs.skip_coverage && !inputs.skip_deploy && !failure() && !cancelled()
|
||||
needs: run_tests
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
permissions:
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
if: ${{ inputs.skip_test }}
|
||||
with:
|
||||
name: coverage_report
|
||||
|
||||
- name: Upload Code Coverage Pages
|
||||
uses: actions/upload-pages-artifact@v2.0.0
|
||||
if: ${{ inputs.skip_test }}
|
||||
with:
|
||||
path: .
|
||||
|
||||
- name: Delete Duplicate Code Coverage Artifact
|
||||
uses: geekyeggo/delete-artifact@v2
|
||||
with:
|
||||
name: coverage_report
|
||||
|
||||
- name: Deploy GitHub Pages site
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1.2.9
|
||||
|
||||
- name: Write Code Coverage Report URL
|
||||
run: >-
|
||||
if [ "${{ inputs.deploy_list }}" != "" ]; then
|
||||
for i in ${{ inputs.deploy_list }}; do
|
||||
echo 'Coverage report for ' $i ':${{ steps.deployment.outputs.page_url }}'$i >> $GITHUB_STEP_SUMMARY
|
||||
done
|
||||
else
|
||||
echo 'Coverage report: ${{ steps.deployment.outputs.page_url }}' >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
35
.github/workflows/regression_test.yml
vendored
Normal file
35
.github/workflows/regression_test.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: regression_test
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
tx:
|
||||
uses: ./.github/workflows/regression_template.yml
|
||||
with:
|
||||
build_script: ./scripts/build_tx.sh
|
||||
test_script: ./scripts/test_tx.sh
|
||||
cmake_path: ./test/tx/cmake
|
||||
result_affix: ThreadX
|
||||
skip_deploy: true
|
||||
smp:
|
||||
uses: ./.github/workflows/regression_template.yml
|
||||
with:
|
||||
build_script: ./scripts/build_smp.sh
|
||||
test_script: ./scripts/test_smp.sh
|
||||
cmake_path: ./test/smp/cmake
|
||||
result_affix: SMP
|
||||
skip_deploy: true
|
||||
deploy:
|
||||
needs: [tx, smp]
|
||||
uses: ./.github/workflows/regression_template.yml
|
||||
with:
|
||||
skip_test: true
|
||||
deploy_list: "ThreadX SMP"
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,6 +1,9 @@
|
||||
.vscode/
|
||||
.settings/
|
||||
.metadata/
|
||||
_deps/
|
||||
build/
|
||||
Debug/
|
||||
CMakeFiles/
|
||||
CMakeScripts/
|
||||
CMakeLists.txt.user
|
||||
@@ -11,4 +14,10 @@ cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
*.dep
|
||||
*.o
|
||||
*.axf
|
||||
*.map
|
||||
*.a
|
||||
*.htm
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
|
||||
|
||||
# Set up the project
|
||||
project(threadx
|
||||
VERSION 6.0.0
|
||||
LANGUAGES C ASM
|
||||
)
|
||||
|
||||
@@ -12,6 +11,8 @@ endif()
|
||||
if(NOT DEFINED THREADX_TOOLCHAIN)
|
||||
message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
|
||||
endif()
|
||||
message(STATUS "THREADX_ARCH: ${THREADX_ARCH}")
|
||||
message(STATUS "THREADX_TOOLCHAIN: ${THREADX_TOOLCHAIN}")
|
||||
|
||||
# Define our target library and an alias for consumers
|
||||
add_library(${PROJECT_NAME})
|
||||
@@ -21,13 +22,26 @@ add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
|
||||
set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
|
||||
|
||||
# Pick up the port specific variables and apply them
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
|
||||
if(DEFINED THREADX_CUSTOM_PORT)
|
||||
add_subdirectory(${THREADX_CUSTOM_PORT} threadx_port)
|
||||
else()
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
|
||||
endif()
|
||||
|
||||
# Pick up the common stuff
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
|
||||
|
||||
|
||||
|
||||
# Define the FreeRTOS adaptation layer
|
||||
add_library(freertos-threadx EXCLUDE_FROM_ALL)
|
||||
target_include_directories(freertos-threadx
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility/rtos_compatibility_layers/FreeRTOS
|
||||
)
|
||||
target_sources(freertos-threadx
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility/rtos_compatibility_layers/FreeRTOS/tx_freertos.c
|
||||
)
|
||||
target_link_libraries(freertos-threadx PUBLIC threadx)
|
||||
|
||||
# If the user provided an override, copy it to the custom directory
|
||||
if (NOT TX_USER_FILE)
|
||||
|
||||
45
LICENSE.txt
45
LICENSE.txt
@@ -2,7 +2,6 @@ MICROSOFT SOFTWARE LICENSE TERMS
|
||||
|
||||
MICROSOFT AZURE RTOS
|
||||
|
||||
Shape
|
||||
|
||||
These license terms are an agreement between you and Microsoft Corporation (or
|
||||
one of its affiliates). They apply to the software named above and any Microsoft
|
||||
@@ -14,10 +13,11 @@ HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS.
|
||||
|
||||
1. INSTALLATION AND USE RIGHTS.
|
||||
|
||||
a) General. You may install and use the software and the included Microsoft
|
||||
applications solely for internal development, testing and evaluation purposes.
|
||||
Any distribution or production use requires a separate license as set forth in
|
||||
Section 2.
|
||||
a) General. You may (I) install, use and modify the software and (ii) install and use the included Microsoft
|
||||
Applications (if any), each solely for internal development, testing and evaluation purposes.
|
||||
Distribution or production use is governed by the license terms set forth in
|
||||
Section 2. You may also obtain distribution or production use rights through a separate agreement with
|
||||
Microsoft.
|
||||
|
||||
b) Contributions. Microsoft welcomes contributions to this software. In the event
|
||||
that you make a contribution to this software you will be required to agree to a
|
||||
@@ -25,7 +25,7 @@ Contributor License Agreement (CLA) declaring that you have the right to, and
|
||||
actually do, grant Microsoft the rights to use your contribution. For details,
|
||||
visit https://cla.microsoft.com.
|
||||
|
||||
c) Included Microsoft Applications. The software includes other Microsoft
|
||||
c) Included Microsoft Applications. The software may include other Microsoft
|
||||
applications which are governed by the licenses embedded in or made available
|
||||
with those applications.
|
||||
|
||||
@@ -57,7 +57,6 @@ i. You may use the software in production (e.g. program the modified or unmodifi
|
||||
software to devices you own or control) and distribute (i.e. make available to
|
||||
third parties) the modified or unmodified binary image produced from this code.
|
||||
|
||||
|
||||
ii. You may permit your device distributors or developers to copy and distribute the
|
||||
binary image as programmed or to be programmed to your devices.
|
||||
|
||||
@@ -70,17 +69,12 @@ b) Requirements. For any code you distribute, you must:
|
||||
|
||||
i. when distributed in binary form, except as embedded in a device, include with
|
||||
such distribution the terms of this agreement;
|
||||
|
||||
ii. when distributed in source code form to distributors or developers of your
|
||||
devices, include with such distribution the terms of this agreement; and
|
||||
|
||||
iii. indemnify, defend and hold harmless Microsoft from any claims, including
|
||||
attorneys’ fees, related to the distribution or use of your devices, except to
|
||||
the extent that any claim is based solely on the unmodified software.
|
||||
iii. indemnify, defend and hold harmless Microsoft from any claims, including claims arising from any High Risk Uses, and inclusive of attorneys’ fees, related to the distribution or use of your devices that include the software, except to the extent that any intellectual property claim is based solely on the unmodified software.
|
||||
|
||||
c) Restrictions. You may not:
|
||||
|
||||
i. use or modify the software to create a competing real time operating system
|
||||
i. use or modify the software to create competing real time operating system
|
||||
software;
|
||||
|
||||
ii. remove any copyright notices or licenses contained in the software;
|
||||
@@ -179,12 +173,13 @@ breach of which would endanger the purpose of this agreement and the compliance
|
||||
with which a party may constantly trust in (so-called "cardinal obligations").
|
||||
In other cases of slight negligence, Microsoft will not be liable for slight
|
||||
negligence.
|
||||
|
||||
12. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF
|
||||
12. DISCLAIMER OF WARRANTY.
|
||||
a) THE SOFTWARE IS LICENSED “AS IS.” YOU BEAR THE RISK OF
|
||||
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. TO
|
||||
THE EXTENT PERMITTED UNDER APPLICABLE LAWS, MICROSOFT EXCLUDES ALL IMPLIED
|
||||
WARRANTIES, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
|
||||
NON-INFRINGEMENT.
|
||||
b) HIGH RISK USE DISCLAIMER. WARNING: THE SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE WHERE FAILURE OR FAULT OF ANY KIND OF THE SOFTWARE COULD RESULT IN DEATH OR SERIOUS BODILY INJURY, OR IN PHYSICAL OR ENVIRONMENTAL DAMAGE (“collectively High Risk Use”). Accordingly, You must design and implement your hardware and software such that, in the event of any interruption, defect, error, or other failure of the software, the safety of people, property, and the environment are not reduced below a level that is reasonable, appropriate, and legal, whether in general or for a specific industry. Your High Risk Use of the software is at Your own risk.
|
||||
|
||||
13. LIMITATION ON AND EXCLUSION OF DAMAGES. IF YOU HAVE ANY BASIS FOR RECOVERING
|
||||
DAMAGES DESPITE THE PRECEDING DISCLAIMER OF WARRANTY, YOU CAN RECOVER FROM
|
||||
@@ -203,21 +198,29 @@ possibility of the damages. The above limitation or exclusion may not apply to
|
||||
you because your state, province, or country may not allow the exclusion or
|
||||
limitation of incidental, consequential, or other damages.
|
||||
|
||||
|
||||
|
||||
Please note: As this software is distributed in Canada, some of the clauses in
|
||||
Please note: As this software is distributed in Canada, some of the clauses in
|
||||
this agreement are provided below in French.
|
||||
|
||||
Remarque: Ce logiciel étant distribué au Canada, certaines des clauses dans ce
|
||||
contrat sont fournies ci-dessous en français.
|
||||
|
||||
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel
|
||||
EXONÉRATION DE GARANTIE.
|
||||
a) Le logiciel visé par une licence est offert « tel quel
|
||||
». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft
|
||||
n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits
|
||||
additionnels en vertu du droit local sur la protection des consommateurs, que ce
|
||||
contrat ne peut modifier. La ou elles sont permises par le droit locale, les
|
||||
garanties implicites de qualité marchande, d’adéquation à un usage particulier
|
||||
et d’absence de contrefaçon sont exclues.
|
||||
b) CLAUSE D’EXCLUSION DE RESPONSABILITÉ RELATIVE À L’UTILISATION À HAUT RISQUE.
|
||||
AVERTISSEMENT: LE LOGICIEL N’EST PAS CONÇU OU DESTINÉ À ÊTRE UTILISÉ LORSQU’UNE
|
||||
DÉFAILLANCE OU UN DÉFAUT DE QUELQUE NATURE QUE CE SOIT POURRAIT ENTRAÎNER LA
|
||||
MORT OU DES BLESSURES CORPORELLES GRAVES, OU DES DOMMAGES PHYSIQUES OU
|
||||
ENVIRONNEMENTAUX (« Utilisation à haut risque »). Par conséquent, vous devez concevoir et mettre en
|
||||
œuvre votre équipement et votre logiciel de manière à ce que, en cas d’interruption, de défaut, d’erreur
|
||||
ou de toute autre défaillance du logiciel, la sécurité des personnes, des biens et de l’environnement ne
|
||||
soit pas réduite en dessous d’un niveau raisonnable, approprié et légal, que ce soit en général ou pour
|
||||
un secteur spécifique. Votre utilisation à haut risque du logiciel est à vos propres risques.
|
||||
|
||||
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES
|
||||
DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une
|
||||
@@ -243,4 +246,4 @@ ci-dessus ne s’appliquera pas à votre égard.
|
||||
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous
|
||||
pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent
|
||||
contrat ne modifie pas les droits que vous confèrent les lois de votre pays si
|
||||
celles-ci ne le permettent pas.
|
||||
celles-ci ne le permettent pas.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
LICENSED HARDWARE LIST
|
||||
|
||||
Last Updated: 2020-10-15
|
||||
Last Updated: 2023-02-10
|
||||
|
||||
Microsoft has entered into OEM Agreements with manufacturers of the following
|
||||
microprocessors and microcontrollers (the “hardware”) to enable those
|
||||
@@ -11,6 +11,16 @@ Production Use” rights in Section 2 of the Microsoft Software License Terms fo
|
||||
Microsoft Azure RTOS. If hardware is not listed below, you do not have those
|
||||
rights.
|
||||
|
||||
|
||||
STMicroelectronics:
|
||||
|
||||
STM32 MCUs
|
||||
STM32 MPUs
|
||||
|
||||
MediaTek:
|
||||
|
||||
MT3620 MCU (Azure Sphere)
|
||||
|
||||
Microchip:
|
||||
|
||||
PIC 32-bit MCUs
|
||||
@@ -18,14 +28,18 @@ Microchip:
|
||||
SAM 32-bit MPUs
|
||||
|
||||
NXP:
|
||||
i.MX RT105x/6x cross over MCUs
|
||||
|
||||
i.MX RT10xx and RT116x/7x series crossover MCUs
|
||||
LPC5500 series
|
||||
MCX N series
|
||||
|
||||
Renesas:
|
||||
|
||||
Synergy Platform
|
||||
RX Family of MCUs
|
||||
RA Family of MCUs
|
||||
RZ Family of MPUs
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
More coming soon. Please check back frequently for updates.
|
||||
More coming soon. Please check back frequently for updates.
|
||||
|
||||
307
README.md
307
README.md
@@ -1,111 +1,236 @@
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# Azure RTOS ThreadX
|
||||
|
||||
This advanced real-time operating system (RTOS) is designed specifically for deeply embedded applications. Among the multiple benefits it provides are advanced scheduling facilities, message passing, interrupt management, and messaging services. Azure RTOS ThreadX has many advanced features, including picokernel architecture, preemption threshold, event chaining, and a rich set of system services.
|
||||
|
||||
## Documentation
|
||||
Here are the key features and modules of ThreadX:
|
||||
|
||||
Documentation for this library can be found here: http://docs.microsoft.com/azure/rtos/threadx
|
||||

|
||||
|
||||
## Getting Started
|
||||
|
||||
Azure RTOS has been integrated to the semiconductor's SDKs and development environment. You can develop using the tools of choice from [STMicroelectronics](https://www.st.com/content/st_com/en/campaigns/x-cube-azrtos-azure-rtos-stm32.html), [NXP](https://www.nxp.com/design/software/embedded-software/azure-rtos-for-nxp-microcontrollers:AZURE-RTOS), [Renesas](https://github.com/renesas/azure-rtos) and [Microchip](https://mu.microchip.com/get-started-simplifying-your-iot-design-with-azure-rtos).
|
||||
|
||||
We also provide [getting started guide](https://github.com/azure-rtos/getting-started) and [samples](https://github.com/azure-rtos/samples) using hero development boards from semiconductors you can build and test with.
|
||||
|
||||
See [Overview of Azure RTOS ThreadX](https://learn.microsoft.com/en-us/azure/rtos/threadx/overview-threadx) for the high-level overview, and all documentation and APIs can be found in: [Azure RTOS ThreadX documentation](https://learn.microsoft.com/en-us/azure/rtos/threadx/).
|
||||
|
||||
Also there is dedicated [learning path of Azure RTOS ThreadX](https://learn.microsoft.com/training/paths/azure-rtos-threadx/) for learning systematically.
|
||||
|
||||
|
||||
# Understanding inter-component dependencies
|
||||
## Repository Structure and Usage
|
||||
### Directory layout
|
||||
|
||||
The main components of Azure RTOS are each provided in their own repository, but there are dependencies between them--shown in the following graph--that are important to understand when setting up your builds.
|
||||
.
|
||||
├── cmake # CMakelist files for building the project
|
||||
├── common # Core ThreadX files
|
||||
├── common_modules # Core ThreadX module files
|
||||
├── common_smp # Core ThreadX SMP files
|
||||
├── docs # Documentation supplements
|
||||
├── ports # Architecture and compiler specific files. See below for directory breakdown
|
||||
│ ├── cortex_m7
|
||||
│ │ ├── iar # Example IAR compiler sample project
|
||||
│ │ │ ├── example build # IAR workspace and sample project files
|
||||
│ │ │ ├── inc # tx_port.h for this architecture
|
||||
│ │ │ └── src # Source files for this architecture
|
||||
│ │ ├── ac6 # Example ac6/Keil sample project
|
||||
│ │ ├── gnu # Example gnu sample project
|
||||
│ │ └── ...
|
||||
│ └── ...
|
||||
├── ports_modules # Architecture and compiler specific files for threadX modules
|
||||
├── ports_smp # Architecture and compiler specific files for threadX SMP
|
||||
├── samples # demo_threadx.c
|
||||
└── utility # Test cases and utilities
|
||||
|
||||

|
||||
|
||||
# Building and using the library
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Install the following tools:
|
||||
|
||||
* [CMake](https://cmake.org/download/) version 3.0 or later
|
||||
* [GCC compilers for arm-none-eabi](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
|
||||
* [Ninja](https://ninja-build.org/)
|
||||
|
||||
## Cloning the repo
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/azure-rtos/threadx.git
|
||||
```
|
||||
|
||||
## Building as a static library
|
||||
|
||||
Each component of Azure RTOS comes with a composible CMake-based build system that supports many different MCUs and host systems. Integrating any of these components into your device app code is as simple as adding a git submodule and then including it in your build using the CMake command `add_subdirectory()`.
|
||||
|
||||
While the typical usage pattern is to include threadx into your device code source tree to be built & linked with your code, you can compile this project as a standalone static library to confirm your build is set up correctly.
|
||||
|
||||
```bash
|
||||
$ cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=cmake/cortex_m4.cmake -GNinja .
|
||||
|
||||
$ cmake --build ./build
|
||||
```
|
||||
|
||||
NOTE: You will have to take the dependency graph above into account when building anything other than threadx itself.
|
||||
|
||||
# Repository Structure and Usage
|
||||
|
||||
## Branches & Releases
|
||||
|
||||
The master branch has the most recent code with all new features and bug fixes. It does not represent the latest General Availability (GA) release of the library.
|
||||
|
||||
## Releases
|
||||
|
||||
Each official release (preview or GA) will be tagged to mark the commit and push it into the Github releases tab, e.g. `v6.0-rel`.
|
||||
|
||||
## Directory layout
|
||||
The master branch has the most recent code with all new features and bug fixes. It does not represent the latest General Availability (GA) release of the library. Each official release (preview or GA) will be tagged to mark the commit and push it into the Github releases tab, e.g. `v6.2-rel`.
|
||||
|
||||
> When you see xx-xx-xxxx, 6.x or x.x in function header, this means the file is not officially released yet. They will be updated in the next release. See example below.
|
||||
```
|
||||
- cmake
|
||||
- common
|
||||
- inc
|
||||
- src
|
||||
- ports
|
||||
- cortex_m0/gnu
|
||||
- inc
|
||||
- src
|
||||
- cortex_m3/gnu
|
||||
- inc
|
||||
- src
|
||||
- cortex_m4/gnu
|
||||
- inc
|
||||
- src
|
||||
- cortex_m7/gnu
|
||||
- inc
|
||||
- src
|
||||
- samples
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_low_level Cortex-M23/GNU */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is responsible for any low-level processor */
|
||||
/* initialization, including setting up interrupt vectors, setting */
|
||||
/* up a periodic timer interrupt source, saving the system stack */
|
||||
/* pointer for use in ISR processing later, and finding the first */
|
||||
/* available RAM memory address for tx_application_define. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _tx_initialize_kernel_enter ThreadX entry function */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* xx-xx-xxxx Scott Larson Include tx_user.h, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
```
|
||||
|
||||
# Security
|
||||
## Supported Architecture Ports
|
||||
|
||||
### ThreadX
|
||||
```
|
||||
arc_em cortex_a12 cortex_m0 cortex_r4
|
||||
arc_hs cortex_a15 cortex_m23 cortex_r5
|
||||
arm11 cortex_a17 cortex_m3 cortex_r7
|
||||
arm9 cortex_a34 cortex_m33
|
||||
c667x cortex_a35 cortex_m4
|
||||
linux cortex_a5 cortex_m55
|
||||
risc-v32 cortex_a53 cortex_m7
|
||||
rxv1 cortex_a55 cortex_m85
|
||||
rxv2 cortex_a57
|
||||
rxv3 cortex_a5x
|
||||
win32 cortex_a65
|
||||
xtensa cortex_a65ae
|
||||
cortex_a7
|
||||
cortex_a72
|
||||
cortex_a73
|
||||
cortex_a75
|
||||
cortex_a76
|
||||
cortex_a76ae
|
||||
cortex_a77
|
||||
cortex_a8
|
||||
cortex_a9
|
||||
```
|
||||
|
||||
### ThreadX Modules
|
||||
[Azure RTOS ThreadX Modules](https://learn.microsoft.com/azure/rtos/threadx-modules/chapter1) component provides an infrastructure for applications to dynamically load modules that are built separately from the resident portion of the application.
|
||||
```
|
||||
cortex_a35
|
||||
cortex_a35_smp
|
||||
cortex_a7
|
||||
cortex_m0+
|
||||
cortex_m23
|
||||
cortex_m3
|
||||
cortex_m33
|
||||
cortex_m4
|
||||
cortex_m7
|
||||
cortex_r4
|
||||
rxv2
|
||||
```
|
||||
|
||||
### ThreadX SMP
|
||||
[Azure RTOS ThreadX SMP](https://learn.microsoft.com/azure/rtos/threadx/threadx-smp/chapter1) is a high-performance real-time SMP kernel designed specifically for embedded applications.
|
||||
```
|
||||
arc_hs_smp
|
||||
cortex_a34_smp
|
||||
cortex_a35_smp
|
||||
cortex_a53_smp
|
||||
cortex_a55_smp
|
||||
cortex_a57_smp
|
||||
cortex_a5x_smp
|
||||
cortex_a5_smp
|
||||
cortex_a65ae_smp
|
||||
cortex_a65_smp
|
||||
cortex_a72_smp
|
||||
cortex_a73_smp
|
||||
cortex_a75_smp
|
||||
cortex_a76ae_smp
|
||||
cortex_a76_smp
|
||||
cortex_a77_smp
|
||||
cortex_a78_smp
|
||||
cortex_a7_smp
|
||||
cortex_a9_smp
|
||||
linux
|
||||
```
|
||||
|
||||
## Adaptation layer for ThreadX
|
||||
|
||||
Azure RTOS ThreadX is an advanced real-time operating system (RTOS) designed specifically for deeply embedded applications. To help ease application migration to Azure RTOS, ThreadX provides [adaption layers](https://github.com/azure-rtos/threadx/tree/master/utility/rtos_compatibility_layers) for various legacy RTOS APIs (FreeRTOS, POSIX, OSEK, etc.).
|
||||
|
||||
## Component dependencies
|
||||
|
||||
The main components of Azure RTOS are each provided in their own repository, but there are dependencies between them, as shown in the following graph. This is important to understand when setting up your builds.
|
||||
|
||||

|
||||
|
||||
> You will have to take the dependency graph above into account when building anything other than ThreadX itself.
|
||||
|
||||
### Building and using the library
|
||||
|
||||
Instruction for building the ThreadX as static library using Arm GNU Toolchain and CMake. If you are using toolchain and IDE from semiconductor, you might follow its own instructions to use Azure RTOS components as explained in the [Getting Started](#getting-started) section.
|
||||
|
||||
1. Install the following tools:
|
||||
|
||||
* [CMake](https://cmake.org/download/) version 3.0 or later
|
||||
* [Arm GNU Toolchain for arm-none-eabi](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads)
|
||||
* [Ninja](https://ninja-build.org/)
|
||||
|
||||
1. Cloning the repo
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/azure-rtos/threadx.git
|
||||
```
|
||||
|
||||
1. Define the features and addons you need in `tx_user.h` and build together with the component source code. You can refer to [`tx_user_sample.h`](https://github.com/azure-rtos/threadx/blob/master/common/inc/tx_user_sample.h) as an example.
|
||||
|
||||
1. Building as a static library
|
||||
|
||||
Each component of Azure RTOS comes with a composable CMake-based build system that supports many different MCUs and host systems. Integrating any of these components into your device app code is as simple as adding a git submodule and then including it in your build using the CMake `add_subdirectory()`.
|
||||
|
||||
While the typical usage pattern is to include ThreadX into your device code source tree to be built & linked with your code, you can compile this project as a standalone static library to confirm your build is set up correctly.
|
||||
|
||||
An example of building the library for Cortex-M4:
|
||||
|
||||
```bash
|
||||
$ cmake -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/cortex_m4.cmake .
|
||||
|
||||
$ cmake --build ./build
|
||||
```
|
||||
|
||||
## Professional support
|
||||
|
||||
[Professional support plans](https://azure.microsoft.com/support/options/) are available from Microsoft. For community support and others, see the [Resources](#resources) section below.
|
||||
|
||||
## Licensing
|
||||
|
||||
License terms for using Azure RTOS are defined in the LICENSE.txt file of this repo. Please refer to this file for all definitive licensing information. No additional license fees are required for deploying Azure RTOS on hardware defined in the LICENSED-HARDWARE.txt file. If you are using hardware not defined in the LICENSED-HARDWARE.txt file or have licensing questions in general, please contact Microsoft directly at https://aka.ms/azrtos-license.
|
||||
|
||||
## Resources
|
||||
|
||||
The following are references to additional Azure RTOS resources:
|
||||
|
||||
- **Product introduction and white papers**: https://azure.com/rtos
|
||||
- **General technical questions**: https://aka.ms/QnA/azure-rtos
|
||||
- **Product issues and bugs, or feature requests**: https://github.com/azure-rtos/threadx/issues
|
||||
- **Licensing and sales questions**: https://aka.ms/azrtos-license
|
||||
- **Product roadmap and support policy**: https://aka.ms/azrtos/lts
|
||||
- **Blogs and videos**: http://msiotblog.com and https://aka.ms/iotshow
|
||||
- **Azure RTOS TraceX Installer**: https://aka.ms/azrtos-tracex-installer
|
||||
|
||||
You can also check [previous questions](https://stackoverflow.com/questions/tagged/azure-rtos+threadx) or ask new ones on StackOverflow using the `azure-rtos` and `threadx` tags.
|
||||
|
||||
## Security
|
||||
|
||||
Azure RTOS provides OEMs with components to secure communication and to create code and data isolation using underlying MCU/MPU hardware protection mechanisms. It is ultimately the responsibility of the device builder to ensure the device fully meets the evolving security requirements associated with its specific use case.
|
||||
|
||||
# Licensing
|
||||
## Contribution
|
||||
|
||||
License terms for using Azure RTOS are defined in the LICENSE.txt file of this repo. Please refer to this file for all definitive licensing information. No additional license fees are required for deploying Azure RTOS on hardware defined in the LICENSED-HARDWARE.txt file. If you are using hardware not defined in the LICENSED-HARDWARE.txt file or have licensing questions in general, please contact Microsoft directly at https://azure-rtos.ms-iot-contact.com/
|
||||
|
||||
# Contribution, feedback, issues, and professional support
|
||||
|
||||
If you encounter any bugs, have suggestions for new features, or if you would like to become an active contributor to this project, please follow the instructions provided in the contribution guideline for the corresponding repo.
|
||||
|
||||
For basic support, click Issues in the command bar or post a question to [Stack Overflow](http://stackoverflow.com/questions/tagged/azure-rtos+threadx) using the `threadx` and `azure-rtos` tags.
|
||||
|
||||
Professional support plans (https://azure.microsoft.com/en-us/support/options/) are available from Microsoft.
|
||||
|
||||
# Additional Resources
|
||||
|
||||
The following are references to additional Azure RTOS and Azure IoT in general:
|
||||
| | |
|
||||
|---|---|
|
||||
| TraceX Installer | https://aka.ms/azrtos-tracex-installer |
|
||||
| Azure RTOS Documenation and Guides: | https://docs.microsoft.com/azure/rtos |
|
||||
| Azure RTOS Website: | https://azure.microsoft.com/services/rtos/ |
|
||||
| Azure RTOS Sales Questions: | https://azure-rtos.ms-iot-contact.com/ |
|
||||
| For technical questions check out Microsoft Q/A for Azure IoT: | https://aka.ms/QnA/azure-rtos |
|
||||
| Internet of Things Show for latest announcements and online training: | https://aka.ms/iotshow |
|
||||
| IoT Tech Community: | https://aka.ms/community/azure-rtos |
|
||||
Please follow the instructions provided in the [CONTRIBUTING.md](./CONTRIBUTING.md) for the corresponding repository.
|
||||
@@ -17,7 +17,7 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
set(CMAKE_C_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} ${SPEC_FLAGS} -fdata-sections -ffunction-sections -mlong-calls" CACHE INTERNAL "c compiler flags")
|
||||
set(CMAKE_CXX_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -fdata-sections -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls" CACHE INTERNAL "cxx compiler flags")
|
||||
set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
|
||||
set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${MCPU_FLAGS} ${LD_FLAGS} -Wl,--gc-sections" CACHE INTERNAL "exe link flags")
|
||||
|
||||
SET(CMAKE_C_FLAGS_DEBUG "-Og -g -ggdb3" CACHE INTERNAL "c debug compiler flags")
|
||||
|
||||
@@ -202,6 +202,7 @@ target_sources(${PROJECT_NAME}
|
||||
|
||||
# Add the Common/inc directory to the project include list
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
SYSTEM
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/inc
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_api.h PORTABLE C */
|
||||
/* 6.1.1 */
|
||||
/* 6.4.0 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -43,17 +43,67 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* updated product constants, */
|
||||
/* added new thread execution */
|
||||
/* state TX_PRIORITY_CHANGE, */
|
||||
/* added macros for casting */
|
||||
/* pointers to ALIGN_TYPE, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 10-16-2020 William E. Lamie Modified comment(s), and */
|
||||
/* 10-16-2020 William E. Lamie Modified comment(s), and */
|
||||
/* increased patch version, */
|
||||
/* resulting in version 6.1.1 */
|
||||
/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
|
||||
/* moved TX_THREAD_GET_SYSTEM_ */
|
||||
/* STATE to tx_api.h, */
|
||||
/* resulting in version 6.1.2 */
|
||||
/* 12-31-2020 William E. Lamie Modified comment(s), and */
|
||||
/* increased patch version, */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* 03-02-2021 Scott Larson Modified comment(s), and */
|
||||
/* order defines numerically, */
|
||||
/* add option to remove FileX */
|
||||
/* pointer, */
|
||||
/* resulting in version 6.1.5 */
|
||||
/* 04-02-2021 Scott Larson Modified comment(s), and */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.6 */
|
||||
/* 06-02-2021 Yuxin Zhou Modified comment(s), added */
|
||||
/* Execution Profile support, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 08-02-2021 Scott Larson Modified comment(s), and */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* 10-15-2021 Yuxin Zhou Modified comment(s), */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.9 */
|
||||
/* 01-31-2022 Scott Larson Modified comment(s), */
|
||||
/* add unused parameter macro, */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.10 */
|
||||
/* 04-25-2022 Wenhui Xie Modified comment(s), */
|
||||
/* optimized the definition of */
|
||||
/* TX_TIMER_TICKS_PER_SECOND, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* 07-29-2022 Scott Larson Modified comment(s), */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* 10-31-2022 Scott Larson Modified comment(s), */
|
||||
/* add extension macros, */
|
||||
/* update EPK typedef, */
|
||||
/* update version numbers, */
|
||||
/* resulting in version 6.2.0 */
|
||||
/* 03-08-2023 Tiejun Zhou Modified comment(s), */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.2.1 */
|
||||
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
|
||||
/* added option for random */
|
||||
/* number stack filling, */
|
||||
/* resulting in version 6.3.0 */
|
||||
/* 12-31-2023 Tiejun Zhou Modified comment(s), */
|
||||
/* update version number, */
|
||||
/* resulting in version 6.4.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -71,22 +121,29 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
/* Disable warning of parameter not used. */
|
||||
#ifndef TX_PARAMETER_NOT_USED
|
||||
#define TX_PARAMETER_NOT_USED(p) ((void)(p))
|
||||
#endif /* TX_PARAMETER_NOT_USED */
|
||||
|
||||
/* Include the port-specific data type file. */
|
||||
|
||||
#include "tx_port.h"
|
||||
|
||||
#if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY))
|
||||
#include "tx_execution_profile.h"
|
||||
#endif
|
||||
|
||||
/* Define basic constants for the ThreadX kernel. */
|
||||
|
||||
|
||||
/* Define the major/minor version information that can be used by the application
|
||||
/* Define the major/minor version information that can be used by the application
|
||||
and the ThreadX source as well. */
|
||||
|
||||
|
||||
#define AZURE_RTOS_THREADX
|
||||
#define THREADX_MAJOR_VERSION 6
|
||||
#define THREADX_MINOR_VERSION 1
|
||||
#define THREADX_PATCH_VERSION 1
|
||||
#define THREADX_MINOR_VERSION 4
|
||||
#define THREADX_PATCH_VERSION 0
|
||||
|
||||
/* Define the following symbol for backward compatibility */
|
||||
#define EL_PRODUCT_THREADX
|
||||
@@ -121,7 +178,11 @@ extern "C" {
|
||||
#define TX_NO_MESSAGES ((UINT) 0)
|
||||
#define TX_EMPTY ((ULONG) 0)
|
||||
#define TX_CLEAR_ID ((ULONG) 0)
|
||||
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
|
||||
#define TX_STACK_FILL (thread_ptr -> tx_thread_stack_fill_value)
|
||||
#else
|
||||
#define TX_STACK_FILL ((ULONG) 0xEFEFEFEFUL)
|
||||
#endif
|
||||
|
||||
|
||||
/* Thread execution state values. */
|
||||
@@ -147,7 +208,6 @@ extern "C" {
|
||||
|
||||
#define TX_SUCCESS ((UINT) 0x00)
|
||||
#define TX_DELETED ((UINT) 0x01)
|
||||
#define TX_NO_MEMORY ((UINT) 0x10)
|
||||
#define TX_POOL_ERROR ((UINT) 0x02)
|
||||
#define TX_PTR_ERROR ((UINT) 0x03)
|
||||
#define TX_WAIT_ERROR ((UINT) 0x04)
|
||||
@@ -162,6 +222,7 @@ extern "C" {
|
||||
#define TX_NO_INSTANCE ((UINT) 0x0D)
|
||||
#define TX_THREAD_ERROR ((UINT) 0x0E)
|
||||
#define TX_PRIORITY_ERROR ((UINT) 0x0F)
|
||||
#define TX_NO_MEMORY ((UINT) 0x10)
|
||||
#define TX_START_ERROR ((UINT) 0x10)
|
||||
#define TX_DELETE_ERROR ((UINT) 0x11)
|
||||
#define TX_RESUME_ERROR ((UINT) 0x12)
|
||||
@@ -184,25 +245,95 @@ extern "C" {
|
||||
#define TX_FEATURE_NOT_ENABLED ((UINT) 0xFF)
|
||||
|
||||
|
||||
#ifdef TX_64_BIT
|
||||
|
||||
#ifndef TX_THREAD_EXTENSION_PTR_SET
|
||||
#define TX_THREAD_EXTENSION_PTR_SET(a, b) { \
|
||||
TX_THREAD *thread_ptr; \
|
||||
thread_ptr = (TX_THREAD *) (a); \
|
||||
(thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \
|
||||
}
|
||||
#endif /* TX_THREAD_EXTENSION_PTR_SET */
|
||||
|
||||
#ifndef TX_THREAD_EXTENSION_PTR_GET
|
||||
#define TX_THREAD_EXTENSION_PTR_GET(a, b, c) { \
|
||||
TX_PARAMETER_NOT_USED(c); \
|
||||
TX_THREAD *thread_ptr; \
|
||||
thread_ptr = tx_thread_identify(); \
|
||||
while(1)\
|
||||
{ \
|
||||
if (thread_ptr -> tx_thread_extension_ptr) \
|
||||
{ \
|
||||
(a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \
|
||||
break; \
|
||||
} \
|
||||
tx_thread_sleep(1); \
|
||||
} \
|
||||
}
|
||||
#endif /* TX_THREAD_EXTENSION_PTR_GET */
|
||||
|
||||
#ifndef TX_TIMER_EXTENSION_PTR_SET
|
||||
#define TX_TIMER_EXTENSION_PTR_SET(a, b) { \
|
||||
TX_TIMER *timer_ptr; \
|
||||
timer_ptr = (TX_TIMER *) (a); \
|
||||
(timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \
|
||||
}
|
||||
#endif /* TX_TIMER_EXTENSION_PTR_SET */
|
||||
|
||||
#ifndef TX_TIMER_EXTENSION_PTR_GET
|
||||
#define TX_TIMER_EXTENSION_PTR_GET(a, b, c) { \
|
||||
TX_PARAMETER_NOT_USED(c); \
|
||||
if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \
|
||||
return; \
|
||||
(a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \
|
||||
}
|
||||
#endif /* TX_TIMER_EXTENSION_PTR_GET */
|
||||
|
||||
#else /* not 64 bit */
|
||||
|
||||
#ifndef TX_THREAD_EXTENSION_PTR_SET
|
||||
#define TX_THREAD_EXTENSION_PTR_SET(a, b)
|
||||
#endif /* TX_THREAD_EXTENSION_PTR_SET */
|
||||
|
||||
#ifndef TX_THREAD_EXTENSION_PTR_GET
|
||||
#define TX_THREAD_EXTENSION_PTR_GET(a, b, c) { \
|
||||
(a) = (b *)(c); \
|
||||
}
|
||||
#endif /* TX_THREAD_EXTENSION_PTR_GET */
|
||||
|
||||
#ifndef TX_TIMER_EXTENSION_PTR_SET
|
||||
#define TX_TIMER_EXTENSION_PTR_SET(a, b)
|
||||
#endif /* TX_TIMER_EXTENSION_PTR_SET */
|
||||
|
||||
#ifndef TX_TIMER_EXTENSION_PTR_GET
|
||||
#define TX_TIMER_EXTENSION_PTR_GET(a, b, c) { \
|
||||
(a) = (b *)(c); \
|
||||
}
|
||||
#endif /* TX_TIMER_EXTENSION_PTR_GET */
|
||||
|
||||
#endif /* TX_64_BIT */
|
||||
|
||||
|
||||
|
||||
/* Define the common timer tick reference for use by other middleware components. The default
|
||||
value is 10ms, but may be replaced by a port specific version in tx_port.h or by the user
|
||||
as a compilation option. */
|
||||
|
||||
#ifndef TX_TIMER_TICKS_PER_SECOND
|
||||
#define TX_TIMER_TICKS_PER_SECOND ((ULONG) 100)
|
||||
#define TX_TIMER_TICKS_PER_SECOND (100UL)
|
||||
#endif
|
||||
|
||||
|
||||
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
|
||||
|
||||
ThreadX events: 1-199
|
||||
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
|
||||
|
||||
ThreadX events: 1-199
|
||||
FileX events: 200-299
|
||||
NetX events: 300-599
|
||||
USBX events: 600-999
|
||||
GUIX events: 1000-1500
|
||||
|
||||
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
|
||||
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
|
||||
|
||||
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
|
||||
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
|
||||
on these constants in case the user event number assignment is changed in future releases. */
|
||||
|
||||
#define TX_TRACE_USER_EVENT_START 4096 /* I1, I2, I3, I4 are user defined */
|
||||
@@ -228,7 +359,7 @@ extern "C" {
|
||||
|
||||
/* Define basic alignment type used in block and byte pool operations. This data type must
|
||||
be at least 32-bits in size and also be large enough to hold a pointer type. */
|
||||
|
||||
|
||||
#ifndef ALIGN_TYPE_DEFINED
|
||||
#define ALIGN_TYPE ULONG
|
||||
#endif
|
||||
@@ -237,10 +368,10 @@ extern "C" {
|
||||
/* Define the control block definitions for all system objects. */
|
||||
|
||||
|
||||
/* Define the basic timer management structures. These are the structures
|
||||
/* Define the basic timer management structures. These are the structures
|
||||
used to manage thread sleep, timeout, and user timer requests. */
|
||||
|
||||
/* Determine if the internal timer control block has an extension defined. If not,
|
||||
/* Determine if the internal timer control block has an extension defined. If not,
|
||||
define the extension to whitespace. */
|
||||
|
||||
#ifndef TX_TIMER_INTERNAL_EXTENSION
|
||||
@@ -278,7 +409,7 @@ typedef struct TX_TIMER_INTERNAL_STRUCT
|
||||
} TX_TIMER_INTERNAL;
|
||||
|
||||
|
||||
/* Determine if the timer control block has an extension defined. If not,
|
||||
/* Determine if the timer control block has an extension defined. If not,
|
||||
define the extension to whitespace. */
|
||||
|
||||
#ifndef TX_TIMER_EXTENSION
|
||||
@@ -337,7 +468,7 @@ typedef struct TX_TIMER_STRUCT
|
||||
typedef struct TX_THREAD_STRUCT
|
||||
{
|
||||
/* The first section of the control block contains critical
|
||||
information that is referenced by the port-specific
|
||||
information that is referenced by the port-specific
|
||||
assembly language code. Any changes in this section could
|
||||
necessitate changes in the assembly language. */
|
||||
|
||||
@@ -357,38 +488,38 @@ typedef struct TX_THREAD_STRUCT
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
/* Define the first port extension in the thread control block. This
|
||||
/* Define the first port extension in the thread control block. This
|
||||
is typically defined to whitespace or a pointer type in tx_port.h. */
|
||||
TX_THREAD_EXTENSION_0
|
||||
|
||||
|
||||
CHAR *tx_thread_name; /* Pointer to thread's name */
|
||||
UINT tx_thread_priority; /* Priority of thread (0-1023) */
|
||||
UINT tx_thread_state; /* Thread's execution state */
|
||||
UINT tx_thread_delayed_suspend; /* Delayed suspend flag */
|
||||
UINT tx_thread_suspending; /* Thread suspending flag */
|
||||
UINT tx_thread_preempt_threshold; /* Preemption threshold */
|
||||
|
||||
/* Define the thread schedule hook. The usage of this is port/application specific,
|
||||
|
||||
/* Define the thread schedule hook. The usage of this is port/application specific,
|
||||
but when used, the function pointer designated is called whenever the thread is
|
||||
scheduled and unscheduled. */
|
||||
VOID (*tx_thread_schedule_hook)(struct TX_THREAD_STRUCT *thread_ptr, ULONG id);
|
||||
|
||||
/* Nothing after this point is referenced by the target-specific
|
||||
assembly language. Hence, information after this point can
|
||||
be added to the control block providing the complete system
|
||||
assembly language. Hence, information after this point can
|
||||
be added to the control block providing the complete system
|
||||
is recompiled. */
|
||||
|
||||
/* Define the thread's entry point and input parameter. */
|
||||
VOID (*tx_thread_entry)(ULONG id);
|
||||
ULONG tx_thread_entry_parameter;
|
||||
|
||||
/* Define the thread's timer block. This is used for thread
|
||||
/* Define the thread's timer block. This is used for thread
|
||||
sleep and timeout requests. */
|
||||
TX_TIMER_INTERNAL tx_thread_timer;
|
||||
|
||||
/* Define the thread's cleanup function and associated data. This
|
||||
is used to cleanup various data structures when a thread
|
||||
suspension is lifted or terminated either by the user or
|
||||
is used to cleanup various data structures when a thread
|
||||
suspension is lifted or terminated either by the user or
|
||||
a timeout. */
|
||||
VOID (*tx_thread_suspend_cleanup)(struct TX_THREAD_STRUCT *thread_ptr, ULONG suspension_sequence);
|
||||
VOID *tx_thread_suspend_control_block;
|
||||
@@ -400,30 +531,32 @@ typedef struct TX_THREAD_STRUCT
|
||||
UINT tx_thread_suspend_option;
|
||||
UINT tx_thread_suspend_status;
|
||||
|
||||
/* Define the second port extension in the thread control block. This
|
||||
/* Define the second port extension in the thread control block. This
|
||||
is typically defined to whitespace or a pointer type in tx_port.h. */
|
||||
TX_THREAD_EXTENSION_1
|
||||
|
||||
/* Define pointers to the next and previous threads in the
|
||||
/* Define pointers to the next and previous threads in the
|
||||
created list. */
|
||||
struct TX_THREAD_STRUCT
|
||||
*tx_thread_created_next,
|
||||
*tx_thread_created_previous;
|
||||
|
||||
/* Define the third port extension in the thread control block. This
|
||||
/* Define the third port extension in the thread control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_THREAD_EXTENSION_2
|
||||
|
||||
/* Define a pointer type for FileX extensions. */
|
||||
#ifndef TX_NO_FILEX_POINTER
|
||||
VOID *tx_thread_filex_ptr;
|
||||
#endif
|
||||
|
||||
/* Define the priority inheritance variables. These will be used
|
||||
to manage priority inheritance changes applied to this thread
|
||||
to manage priority inheritance changes applied to this thread
|
||||
as a result of mutex get operations. */
|
||||
UINT tx_thread_user_priority;
|
||||
UINT tx_thread_user_preempt_threshold;
|
||||
UINT tx_thread_inherit_priority;
|
||||
|
||||
|
||||
/* Define the owned mutex count and list head pointer. */
|
||||
UINT tx_thread_owned_mutex_count;
|
||||
struct TX_MUTEX_STRUCT
|
||||
@@ -437,7 +570,7 @@ typedef struct TX_THREAD_STRUCT
|
||||
/* Define the number of times this thread suspends. */
|
||||
ULONG tx_thread_performance_suspend_count;
|
||||
|
||||
/* Define the number of times this thread is preempted by calling
|
||||
/* Define the number of times this thread is preempted by calling
|
||||
a ThreadX API service. */
|
||||
ULONG tx_thread_performance_solicited_preemption_count;
|
||||
|
||||
@@ -472,22 +605,39 @@ typedef struct TX_THREAD_STRUCT
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
|
||||
/* Define the application callback routine used to notify the application when
|
||||
/* Define the application callback routine used to notify the application when
|
||||
the thread is entered or exits. */
|
||||
VOID (*tx_thread_entry_exit_notify)(struct TX_THREAD_STRUCT *thread_ptr, UINT type);
|
||||
#endif
|
||||
|
||||
/* Define the fourth port extension in the thread control block. This
|
||||
/* Define the fourth port extension in the thread control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_THREAD_EXTENSION_3
|
||||
|
||||
/* Define suspension sequence number. This is used to ensure suspension is still valid when
|
||||
|
||||
/* Define variables for supporting execution profile. */
|
||||
/* Note that in ThreadX 5.x, user would define TX_ENABLE_EXECUTION_CHANGE_NOTIFY and use TX_THREAD_EXTENSION_3
|
||||
to define the following two variables.
|
||||
For Azure RTOS 6, user shall use TX_EXECUTION_PROFILE_ENABLE instead of TX_ENABLE_EXECUTION_CHANGE_NOTIFY,
|
||||
and SHALL NOT add variables to TX_THREAD_EXTENSION_3. */
|
||||
#if (defined(TX_EXECUTION_PROFILE_ENABLE) && !defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY))
|
||||
EXECUTION_TIME tx_thread_execution_time_total;
|
||||
EXECUTION_TIME_SOURCE_TYPE tx_thread_execution_time_last_start;
|
||||
#endif
|
||||
|
||||
/* Define suspension sequence number. This is used to ensure suspension is still valid when
|
||||
cleanup routine executes. */
|
||||
ULONG tx_thread_suspension_sequence;
|
||||
|
||||
/* Define the user extension field. This typically is defined
|
||||
to white space, but some ports of ThreadX may need to have
|
||||
additional fields in the thread control block. This is
|
||||
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
|
||||
|
||||
/* Define the random stack fill number. This can be used to detect stack overflow. */
|
||||
ULONG tx_thread_stack_fill_value;
|
||||
#endif
|
||||
|
||||
/* Define the user extension field. This typically is defined
|
||||
to white space, but some ports of ThreadX may need to have
|
||||
additional fields in the thread control block. This is
|
||||
defined in the file tx_port.h. */
|
||||
TX_THREAD_USER_EXTENSION
|
||||
|
||||
@@ -549,14 +699,14 @@ typedef struct TX_BLOCK_POOL_STRUCT
|
||||
ULONG tx_block_pool_performance_timeout_count;
|
||||
#endif
|
||||
|
||||
/* Define the port extension in the block pool control block. This
|
||||
/* Define the port extension in the block pool control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_BLOCK_POOL_EXTENSION
|
||||
|
||||
} TX_BLOCK_POOL;
|
||||
|
||||
|
||||
/* Determine if the byte allocate extension is defined. If not, define the
|
||||
/* Determine if the byte allocate extension is defined. If not, define the
|
||||
extension to whitespace. */
|
||||
|
||||
#ifndef TX_BYTE_ALLOCATE_EXTENSION
|
||||
@@ -564,7 +714,7 @@ typedef struct TX_BLOCK_POOL_STRUCT
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if the byte release extension is defined. If not, define the
|
||||
/* Determine if the byte release extension is defined. If not, define the
|
||||
extension to whitespace. */
|
||||
|
||||
#ifndef TX_BYTE_RELEASE_EXTENSION
|
||||
@@ -644,7 +794,7 @@ typedef struct TX_BYTE_POOL_STRUCT
|
||||
ULONG tx_byte_pool_performance_timeout_count;
|
||||
#endif
|
||||
|
||||
/* Define the port extension in the byte pool control block. This
|
||||
/* Define the port extension in the byte pool control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_BYTE_POOL_EXTENSION
|
||||
|
||||
@@ -662,7 +812,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
|
||||
/* Define the event flags group's name. */
|
||||
CHAR *tx_event_flags_group_name;
|
||||
|
||||
/* Define the actual current event flags in this group. A zero in a
|
||||
/* Define the actual current event flags in this group. A zero in a
|
||||
particular bit indicates the event flag is not set. */
|
||||
ULONG tx_event_flags_group_current;
|
||||
|
||||
@@ -701,19 +851,19 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
|
||||
/* Define the application callback routine used to notify the application when
|
||||
/* Define the application callback routine used to notify the application when
|
||||
an event flag is set. */
|
||||
VOID (*tx_event_flags_group_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *group_ptr);
|
||||
#endif
|
||||
|
||||
/* Define the port extension in the event flags group control block. This
|
||||
/* Define the port extension in the event flags group control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_EVENT_FLAGS_GROUP_EXTENSION
|
||||
|
||||
} TX_EVENT_FLAGS_GROUP;
|
||||
|
||||
|
||||
/* Determine if the mutex put extension 1 is defined. If not, define the
|
||||
/* Determine if the mutex put extension 1 is defined. If not, define the
|
||||
extension to whitespace. */
|
||||
|
||||
#ifndef TX_MUTEX_PUT_EXTENSION_1
|
||||
@@ -721,7 +871,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if the mutex put extension 2 is defined. If not, define the
|
||||
/* Determine if the mutex put extension 2 is defined. If not, define the
|
||||
extension to whitespace. */
|
||||
|
||||
#ifndef TX_MUTEX_PUT_EXTENSION_2
|
||||
@@ -729,7 +879,7 @@ typedef struct TX_EVENT_FLAGS_GROUP_STRUCT
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if the mutex priority change extension is defined. If not, define the
|
||||
/* Determine if the mutex priority change extension is defined. If not, define the
|
||||
extension to whitespace. */
|
||||
|
||||
#ifndef TX_MUTEX_PRIORITY_CHANGE_EXTENSION
|
||||
@@ -803,7 +953,7 @@ typedef struct TX_MUTEX_STRUCT
|
||||
ULONG tx_mutex_performance__priority_inheritance_count;
|
||||
#endif
|
||||
|
||||
/* Define the port extension in the mutex control block. This
|
||||
/* Define the port extension in the mutex control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_MUTEX_EXTENSION
|
||||
|
||||
@@ -832,7 +982,7 @@ typedef struct TX_QUEUE_STRUCT
|
||||
UINT tx_queue_enqueued;
|
||||
UINT tx_queue_available_storage;
|
||||
|
||||
/* Define pointers that represent the start and end for the queue's
|
||||
/* Define pointers that represent the start and end for the queue's
|
||||
message area. */
|
||||
ULONG *tx_queue_start;
|
||||
ULONG *tx_queue_end;
|
||||
@@ -877,12 +1027,12 @@ typedef struct TX_QUEUE_STRUCT
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
|
||||
/* Define the application callback routine used to notify the application when
|
||||
/* Define the application callback routine used to notify the application when
|
||||
the a message is sent to the queue. */
|
||||
VOID (*tx_queue_send_notify)(struct TX_QUEUE_STRUCT *queue_ptr);
|
||||
#endif
|
||||
|
||||
/* Define the port extension in the queue control block. This
|
||||
/* Define the port extension in the queue control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_QUEUE_EXTENSION
|
||||
|
||||
@@ -932,29 +1082,29 @@ typedef struct TX_SEMAPHORE_STRUCT
|
||||
|
||||
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
|
||||
|
||||
/* Define the application callback routine used to notify the application when
|
||||
/* Define the application callback routine used to notify the application when
|
||||
the a semaphore is put. */
|
||||
VOID (*tx_semaphore_put_notify)(struct TX_SEMAPHORE_STRUCT *semaphore_ptr);
|
||||
#endif
|
||||
|
||||
/* Define the port extension in the semaphore control block. This
|
||||
/* Define the port extension in the semaphore control block. This
|
||||
is typically defined to whitespace in tx_port.h. */
|
||||
TX_SEMAPHORE_EXTENSION
|
||||
|
||||
} TX_SEMAPHORE;
|
||||
|
||||
|
||||
/* Define the system API mappings based on the error checking
|
||||
selected by the user. Note: this section is only applicable to
|
||||
/* Define the system API mappings based on the error checking
|
||||
selected by the user. Note: this section is only applicable to
|
||||
application source code, hence the conditional that turns off this
|
||||
stuff when the include file is processed by the ThreadX source. */
|
||||
|
||||
#ifndef TX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Determine if error checking is desired. If so, map API functions
|
||||
/* Determine if error checking is desired. If so, map API functions
|
||||
to the appropriate error checking front-ends. Otherwise, map API
|
||||
functions to the core functions that actually perform the work.
|
||||
functions to the core functions that actually perform the work.
|
||||
Note: error checking is enabled by default. */
|
||||
|
||||
#ifdef TX_DISABLE_ERROR_CHECKING
|
||||
@@ -1085,7 +1235,6 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
|
||||
|
||||
#ifdef TX_ENABLE_MULTI_ERROR_CHECKING
|
||||
|
||||
|
||||
/* Services with MULTI runtime error checking ThreadX. */
|
||||
|
||||
#define tx_block_allocate _txr_block_allocate
|
||||
@@ -1329,8 +1478,8 @@ UINT _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG
|
||||
UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
|
||||
VOID *pool_start, ULONG pool_size);
|
||||
UINT _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
|
||||
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
|
||||
UINT _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
|
||||
ULONG *suspensions, ULONG *timeouts);
|
||||
@@ -1340,15 +1489,15 @@ UINT _tx_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
|
||||
UINT _tx_block_release(VOID *block_ptr);
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option);
|
||||
UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
|
||||
VOID *pool_start, ULONG pool_size, UINT pool_control_block_size);
|
||||
UINT _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
|
||||
UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
|
||||
UINT _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
|
||||
UINT _txe_block_release(VOID *block_ptr);
|
||||
@@ -1357,8 +1506,8 @@ UINT _txr_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG
|
||||
UINT _txr_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size,
|
||||
VOID *pool_start, ULONG pool_size, UINT pool_control_block_size);
|
||||
UINT _txr_block_pool_delete(TX_BLOCK_POOL *pool_ptr);
|
||||
UINT _txr_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
UINT _txr_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BLOCK_POOL **next_pool);
|
||||
UINT _txr_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr);
|
||||
UINT _txr_block_release(VOID *block_ptr);
|
||||
@@ -1372,8 +1521,8 @@ UINT _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG m
|
||||
UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
|
||||
ULONG pool_size);
|
||||
UINT _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
|
||||
UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BYTE_POOL **next_pool);
|
||||
UINT _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
|
||||
ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts);
|
||||
@@ -1383,7 +1532,7 @@ UINT _tx_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
|
||||
UINT _tx_byte_release(VOID *memory_ptr);
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size,
|
||||
@@ -1391,8 +1540,8 @@ UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG
|
||||
UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
|
||||
ULONG pool_size, UINT pool_control_block_size);
|
||||
UINT _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
|
||||
UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BYTE_POOL **next_pool);
|
||||
UINT _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
|
||||
UINT _txe_byte_release(VOID *memory_ptr);
|
||||
@@ -1402,8 +1551,8 @@ UINT _txr_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG
|
||||
UINT _txr_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start,
|
||||
ULONG pool_size, UINT pool_control_block_size);
|
||||
UINT _txr_byte_pool_delete(TX_BYTE_POOL *pool_ptr);
|
||||
UINT _txr_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
UINT _txr_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BYTE_POOL **next_pool);
|
||||
UINT _txr_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr);
|
||||
UINT _txr_byte_release(VOID *memory_ptr);
|
||||
@@ -1416,29 +1565,29 @@ UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_p
|
||||
UINT _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
|
||||
UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
|
||||
UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
|
||||
UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_EVENT_FLAGS_GROUP **next_group);
|
||||
UINT _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets,
|
||||
ULONG *suspensions, ULONG *timeouts);
|
||||
UINT _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets,
|
||||
ULONG *suspensions, ULONG *timeouts);
|
||||
UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
|
||||
UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
|
||||
UINT set_option);
|
||||
UINT _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size);
|
||||
UINT _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
|
||||
UINT _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
|
||||
UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
|
||||
UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_EVENT_FLAGS_GROUP **next_group);
|
||||
UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
|
||||
UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
|
||||
UINT set_option);
|
||||
UINT _txe_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
|
||||
#ifdef TX_ENABLE_MULTI_ERROR_CHECKING
|
||||
@@ -1446,10 +1595,10 @@ UINT _txr_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_
|
||||
UINT _txr_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr);
|
||||
UINT _txr_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
|
||||
UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option);
|
||||
UINT _txr_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _txr_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_EVENT_FLAGS_GROUP **next_group);
|
||||
UINT _txr_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
|
||||
UINT _txr_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set,
|
||||
UINT set_option);
|
||||
UINT _txr_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr));
|
||||
#endif
|
||||
@@ -1465,8 +1614,8 @@ VOID _tx_initialize_kernel_enter(VOID);
|
||||
UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit);
|
||||
UINT _tx_mutex_delete(TX_MUTEX *mutex_ptr);
|
||||
UINT _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
|
||||
UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_MUTEX **next_mutex);
|
||||
UINT _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets,
|
||||
ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances);
|
||||
@@ -1476,14 +1625,14 @@ UINT _tx_mutex_prioritize(TX_MUTEX *mutex_ptr);
|
||||
UINT _tx_mutex_put(TX_MUTEX *mutex_ptr);
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
|
||||
UINT _txe_mutex_delete(TX_MUTEX *mutex_ptr);
|
||||
UINT _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
|
||||
UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_MUTEX **next_mutex);
|
||||
UINT _txe_mutex_prioritize(TX_MUTEX *mutex_ptr);
|
||||
UINT _txe_mutex_put(TX_MUTEX *mutex_ptr);
|
||||
@@ -1491,8 +1640,8 @@ UINT _txe_mutex_put(TX_MUTEX *mutex_ptr);
|
||||
UINT _txr_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size);
|
||||
UINT _txr_mutex_delete(TX_MUTEX *mutex_ptr);
|
||||
UINT _txr_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option);
|
||||
UINT _txr_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _txr_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_MUTEX **next_mutex);
|
||||
UINT _txr_mutex_prioritize(TX_MUTEX *mutex_ptr);
|
||||
UINT _txr_mutex_put(TX_MUTEX *mutex_ptr);
|
||||
@@ -1501,7 +1650,7 @@ UINT _txr_mutex_put(TX_MUTEX *mutex_ptr);
|
||||
|
||||
/* Define queue management function prototypes. */
|
||||
|
||||
UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
VOID *queue_start, ULONG queue_size);
|
||||
UINT _tx_queue_delete(TX_QUEUE *queue_ptr);
|
||||
UINT _tx_queue_flush(TX_QUEUE *queue_ptr);
|
||||
@@ -1518,10 +1667,10 @@ UINT _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)
|
||||
UINT _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
VOID *queue_start, ULONG queue_size, UINT queue_control_block_size);
|
||||
UINT _txe_queue_delete(TX_QUEUE *queue_ptr);
|
||||
UINT _txe_queue_flush(TX_QUEUE *queue_ptr);
|
||||
@@ -1533,7 +1682,7 @@ UINT _txe_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_op
|
||||
UINT _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr));
|
||||
UINT _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option);
|
||||
#ifdef TX_ENABLE_MULTI_ERROR_CHECKING
|
||||
UINT _txr_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
UINT _txr_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
VOID *queue_start, ULONG queue_size, UINT queue_control_block_size);
|
||||
UINT _txr_queue_delete(TX_QUEUE *queue_ptr);
|
||||
UINT _txr_queue_flush(TX_QUEUE *queue_ptr);
|
||||
@@ -1553,8 +1702,8 @@ UINT _tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling
|
||||
UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count);
|
||||
UINT _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
|
||||
UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
|
||||
UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_SEMAPHORE **next_semaphore);
|
||||
UINT _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets,
|
||||
ULONG *suspensions, ULONG *timeouts);
|
||||
@@ -1564,15 +1713,15 @@ UINT _tx_semaphore_put(TX_SEMAPHORE *semaphore_ptr);
|
||||
UINT _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr));
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling);
|
||||
UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
|
||||
UINT _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
|
||||
UINT _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
|
||||
UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_SEMAPHORE **next_semaphore);
|
||||
UINT _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr);
|
||||
UINT _txe_semaphore_put(TX_SEMAPHORE *semaphore_ptr);
|
||||
@@ -1582,8 +1731,8 @@ UINT _txr_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceilin
|
||||
UINT _txr_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size);
|
||||
UINT _txr_semaphore_delete(TX_SEMAPHORE *semaphore_ptr);
|
||||
UINT _txr_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option);
|
||||
UINT _txr_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _txr_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_SEMAPHORE **next_semaphore);
|
||||
UINT _txr_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr);
|
||||
UINT _txr_semaphore_put(TX_SEMAPHORE *semaphore_ptr);
|
||||
@@ -1595,19 +1744,19 @@ UINT _txr_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaph
|
||||
|
||||
VOID _tx_thread_context_save(VOID);
|
||||
VOID _tx_thread_context_restore(VOID);
|
||||
UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
VOID (*entry_function)(ULONG entry_input), ULONG entry_input,
|
||||
VOID *stack_start, ULONG stack_size,
|
||||
UINT priority, UINT preempt_threshold,
|
||||
VOID *stack_start, ULONG stack_size,
|
||||
UINT priority, UINT preempt_threshold,
|
||||
ULONG time_slice, UINT auto_start);
|
||||
UINT _tx_thread_delete(TX_THREAD *thread_ptr);
|
||||
UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
|
||||
TX_THREAD *_tx_thread_identify(VOID);
|
||||
UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
|
||||
UINT _tx_thread_interrupt_control(UINT new_posture);
|
||||
UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions,
|
||||
UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions,
|
||||
ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions,
|
||||
ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by);
|
||||
UINT _tx_thread_performance_system_info_get(ULONG *resumptions, ULONG *suspensions,
|
||||
@@ -1629,18 +1778,18 @@ UINT _tx_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_s
|
||||
UINT _tx_thread_wait_abort(TX_THREAD *thread_ptr);
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
VOID (*entry_function)(ULONG entry_input), ULONG entry_input,
|
||||
VOID *stack_start, ULONG stack_size,
|
||||
UINT priority, UINT preempt_threshold,
|
||||
VOID *stack_start, ULONG stack_size,
|
||||
UINT priority, UINT preempt_threshold,
|
||||
ULONG time_slice, UINT auto_start, UINT thread_control_block_size);
|
||||
UINT _txe_thread_delete(TX_THREAD *thread_ptr);
|
||||
UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
|
||||
UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
|
||||
UINT _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
|
||||
UINT *old_threshold);
|
||||
@@ -1654,15 +1803,15 @@ UINT _txe_thread_terminate(TX_THREAD *thread_ptr);
|
||||
UINT _txe_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice);
|
||||
UINT _txe_thread_wait_abort(TX_THREAD *thread_ptr);
|
||||
#ifdef TX_ENABLE_MULTI_ERROR_CHECKING
|
||||
UINT _txr_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
UINT _txr_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
VOID (*entry_function)(ULONG entry_input), ULONG entry_input,
|
||||
VOID *stack_start, ULONG stack_size,
|
||||
UINT priority, UINT preempt_threshold,
|
||||
VOID *stack_start, ULONG stack_size,
|
||||
UINT priority, UINT preempt_threshold,
|
||||
ULONG time_slice, UINT auto_start, UINT thread_control_block_size);
|
||||
UINT _txr_thread_delete(TX_THREAD *thread_ptr);
|
||||
UINT _txr_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
|
||||
UINT _txr_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
UINT _txr_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread);
|
||||
UINT _txr_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold,
|
||||
UINT *old_threshold);
|
||||
@@ -1681,12 +1830,12 @@ UINT _txr_thread_wait_abort(TX_THREAD *thread_ptr);
|
||||
|
||||
UINT _tx_timer_activate(TX_TIMER *timer_ptr);
|
||||
UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
|
||||
UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
|
||||
UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
|
||||
VOID (*expiration_function)(ULONG input), ULONG expiration_input,
|
||||
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate);
|
||||
UINT _tx_timer_deactivate(TX_TIMER *timer_ptr);
|
||||
UINT _tx_timer_delete(TX_TIMER *timer_ptr);
|
||||
UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
|
||||
UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
|
||||
ULONG *reschedule_ticks, TX_TIMER **next_timer);
|
||||
UINT _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates,
|
||||
ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts);
|
||||
@@ -1697,27 +1846,27 @@ ULONG _tx_time_get(VOID);
|
||||
VOID _tx_time_set(ULONG new_time);
|
||||
|
||||
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
/* Define error checking shells for API services. These are only referenced by the
|
||||
application. */
|
||||
|
||||
UINT _txe_timer_activate(TX_TIMER *timer_ptr);
|
||||
UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
|
||||
UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
|
||||
UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
|
||||
VOID (*expiration_function)(ULONG input), ULONG expiration_input,
|
||||
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
|
||||
UINT _txe_timer_deactivate(TX_TIMER *timer_ptr);
|
||||
UINT _txe_timer_delete(TX_TIMER *timer_ptr);
|
||||
UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
|
||||
UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
|
||||
ULONG *reschedule_ticks, TX_TIMER **next_timer);
|
||||
#ifdef TX_ENABLE_MULTI_ERROR_CHECKING
|
||||
UINT _txr_timer_activate(TX_TIMER *timer_ptr);
|
||||
UINT _txr_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks);
|
||||
UINT _txr_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
|
||||
UINT _txr_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr,
|
||||
VOID (*expiration_function)(ULONG input), ULONG expiration_input,
|
||||
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
|
||||
UINT _txr_timer_deactivate(TX_TIMER *timer_ptr);
|
||||
UINT _txr_timer_delete(TX_TIMER *timer_ptr);
|
||||
UINT _txr_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
|
||||
UINT _txr_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks,
|
||||
ULONG *reschedule_ticks, TX_TIMER **next_timer);
|
||||
#endif
|
||||
|
||||
@@ -1738,13 +1887,13 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
|
||||
/* Add a default macro that can be re-defined in tx_port.h to add default processing when a thread starts. Common usage
|
||||
would be for enabling floating point for a thread by default, however, the additional processing could be anything
|
||||
defined in tx_port.h. */
|
||||
|
||||
|
||||
#ifndef TX_THREAD_STARTED_EXTENSION
|
||||
#define TX_THREAD_STARTED_EXTENSION(thread_ptr)
|
||||
#endif
|
||||
|
||||
|
||||
/* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function.
|
||||
/* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function.
|
||||
By default, this is simply defined as whitespace. */
|
||||
|
||||
#ifndef TX_THREAD_STACK_ANALYZE_EXTENSION
|
||||
@@ -1752,7 +1901,7 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
|
||||
#endif
|
||||
|
||||
|
||||
/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function.
|
||||
/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function.
|
||||
By default, this is simply defined as whitespace. */
|
||||
|
||||
#ifndef TX_INITIALIZE_KERNEL_ENTER_EXTENSION
|
||||
@@ -1760,6 +1909,21 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
|
||||
#endif
|
||||
|
||||
|
||||
/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize random number generator.
|
||||
By default, this is simply defined as whitespace. */
|
||||
|
||||
#ifndef TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION
|
||||
#define TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the TX_RAND macro to the standard library function, if not already defined. */
|
||||
|
||||
#ifndef TX_RAND
|
||||
#define TX_RAND() rand()
|
||||
#endif
|
||||
|
||||
|
||||
/* Check for MISRA compliance requirements. */
|
||||
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
@@ -1783,7 +1947,6 @@ VOID _tx_misra_user_timer_pointer_get(TX_TIMER_INTERNAL *inte
|
||||
VOID _tx_misra_thread_stack_check(TX_THREAD *thread_ptr, VOID **highest_stack);
|
||||
VOID _tx_misra_trace_event_insert(ULONG event_id, VOID *info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, ULONG time_stamp);
|
||||
UINT _tx_misra_always_true(void);
|
||||
|
||||
UCHAR **_tx_misra_indirect_void_to_uchar_pointer_convert(VOID **pointer);
|
||||
UCHAR **_tx_misra_uchar_to_indirect_uchar_pointer_convert(UCHAR *pointer);
|
||||
UCHAR *_tx_misra_block_pool_to_uchar_pointer_convert(TX_BLOCK_POOL *pool);
|
||||
@@ -1816,7 +1979,6 @@ VOID _tx_misra_semaphore_put_notify_not_used(VOID (*semaphore
|
||||
VOID _tx_misra_thread_not_used(TX_THREAD *thread_ptr);
|
||||
VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT id));
|
||||
|
||||
|
||||
#define TX_MEMSET(a,b,c) _tx_misra_memset((a), (UINT) (b), (UINT) (c))
|
||||
#define TX_UCHAR_POINTER_ADD(a,b) _tx_misra_uchar_pointer_add((UCHAR *) (a), (ULONG) (b))
|
||||
#define TX_UCHAR_POINTER_SUB(a,b) _tx_misra_uchar_pointer_sub((UCHAR *) (a), (ULONG) (b))
|
||||
@@ -1835,8 +1997,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa
|
||||
#define TX_TRACE_IN_LINE_INSERT(i,a,b,c,d,e) _tx_misra_trace_event_insert((ULONG) (i), (VOID *) (a), (ULONG) (b), (ULONG) (c), (ULONG) (d), (ULONG) (e), ((ULONG) TX_TRACE_TIME_SOURCE));
|
||||
#endif
|
||||
#define TX_LOOP_FOREVER (_tx_misra_always_true() == TX_TRUE)
|
||||
|
||||
|
||||
#define TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_indirect_void_to_uchar_pointer_convert((a))
|
||||
#define TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) _tx_misra_uchar_to_indirect_uchar_pointer_convert((a))
|
||||
#define TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_block_pool_to_uchar_pointer_convert((a))
|
||||
@@ -1872,7 +2032,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa
|
||||
#define TX_THREAD_NOT_USED(a) _tx_misra_thread_not_used((a))
|
||||
#define TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED(a) _tx_misra_thread_entry_exit_notify_not_used((a))
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* Define the TX_MEMSET macro to the standard library function, if not already defined. */
|
||||
@@ -1901,8 +2060,6 @@ VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*threa
|
||||
(b) = (TX_TIMER *) working_ptr; \
|
||||
}
|
||||
#define TX_LOOP_FOREVER ((UINT) 1)
|
||||
|
||||
|
||||
#define TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a)))
|
||||
#define TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a)))
|
||||
#define TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a)))
|
||||
@@ -2213,6 +2370,13 @@ void __ghs_rnerr(char *errMsg, int stackLevels, int stackTraceDisplay, void *hex
|
||||
|
||||
#endif
|
||||
|
||||
/* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state. */
|
||||
/* Note that prior to Azure RTOS 6.1, this symbol was defined in tx_thread.h. */
|
||||
#ifndef TX_THREAD_GET_SYSTEM_STATE
|
||||
#define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_system_state
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Determine if a C++ compiler is being used. If so, complete the standard
|
||||
|
||||
@@ -56,12 +56,12 @@
|
||||
#define TX_BLOCK_POOL_ID ((ULONG) 0x424C4F43)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the block memory pool
|
||||
/* Yes, in-line initialization is supported, remap the block memory pool
|
||||
initialization function. */
|
||||
|
||||
#ifndef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
@@ -68,12 +68,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the byte memory pool
|
||||
/* Yes, in-line initialization is supported, remap the byte memory pool
|
||||
initialization function. */
|
||||
|
||||
#ifndef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
@@ -58,11 +58,11 @@
|
||||
#define TX_EVENT_FLAGS_CLEAR_MASK ((UINT) 0x1)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the event flag initialization
|
||||
/* Yes, in-line initialization is supported, remap the event flag initialization
|
||||
function. */
|
||||
|
||||
#ifndef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
@@ -67,15 +67,15 @@ VOID _tx_initialize_low_level(VOID);
|
||||
|
||||
/* Define the macro for adding additional port-specific global data. This macro is defined
|
||||
as white space, unless defined by tx_port.h. */
|
||||
|
||||
|
||||
#ifndef TX_PORT_SPECIFIC_DATA
|
||||
#define TX_PORT_SPECIFIC_DATA
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the macro for adding additional port-specific pre and post initialization processing.
|
||||
/* Define the macro for adding additional port-specific pre and post initialization processing.
|
||||
These macros is defined as white space, unless defined by tx_port.h. */
|
||||
|
||||
|
||||
#ifndef TX_PORT_SPECIFIC_PRE_INITIALIZATION
|
||||
#define TX_PORT_SPECIFIC_PRE_INITIALIZATION
|
||||
#endif
|
||||
@@ -102,9 +102,9 @@ VOID _tx_initialize_low_level(VOID);
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the unused memory pointer. The value of the first available
|
||||
/* Define the unused memory pointer. The value of the first available
|
||||
memory address is placed in this variable in the low-level
|
||||
initialization function. The content of this variable is passed
|
||||
initialization function. The content of this variable is passed
|
||||
to the application's system definition function. */
|
||||
|
||||
INITIALIZE_DECLARE VOID *_tx_initialize_unused_memory;
|
||||
|
||||
@@ -56,12 +56,12 @@
|
||||
#define TX_MUTEX_ID ((ULONG) 0x4D555445)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the mutex initialization
|
||||
/* Yes, in-line initialization is supported, remap the mutex initialization
|
||||
function. */
|
||||
|
||||
#ifndef TX_MUTEX_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
@@ -56,11 +56,11 @@
|
||||
#define TX_QUEUE_ID ((ULONG) 0x51554555)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
|
||||
/* Yes, in-line initialization is supported, remap the queue initialization
|
||||
/* Yes, in-line initialization is supported, remap the queue initialization
|
||||
function. */
|
||||
|
||||
#ifndef TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
@@ -85,7 +85,7 @@ VOID _tx_queue_initialize(VOID);
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the message copy macro. Note that the source and destination
|
||||
/* Define the message copy macro. Note that the source and destination
|
||||
pointers must be modified since they are used subsequently. */
|
||||
|
||||
#ifndef TX_QUEUE_MESSAGE_COPY
|
||||
|
||||
@@ -56,10 +56,10 @@
|
||||
#define TX_SEMAPHORE_ID ((ULONG) 0x53454D41)
|
||||
|
||||
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
/* Determine if in-line component initialization is supported by the
|
||||
caller. */
|
||||
#ifdef TX_INVOKE_INLINE_INITIALIZATION
|
||||
/* Yes, in-line initialization is supported, remap the
|
||||
/* Yes, in-line initialization is supported, remap the
|
||||
semaphore initialization function. */
|
||||
#ifndef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
|
||||
#define _tx_semaphore_initialize() \
|
||||
@@ -76,7 +76,7 @@
|
||||
#endif
|
||||
#define TX_SEMAPHORE_INIT
|
||||
#else
|
||||
/* No in-line initialization is supported, use standard
|
||||
/* No in-line initialization is supported, use standard
|
||||
function call. */
|
||||
VOID _tx_semaphore_initialize(VOID);
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_thread.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.9 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -44,6 +44,13 @@
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 11-09-2020 Yuxin Zhou Modified comment(s), and */
|
||||
/* moved TX_THREAD_GET_SYSTEM_ */
|
||||
/* STATE to tx_api.h, */
|
||||
/* resulting in version 6.1.2 */
|
||||
/* 10-15-2021 Scott Larson Modified comment(s), improved */
|
||||
/* stack check error handling, */
|
||||
/* resulting in version 6.1.9 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -86,36 +93,37 @@
|
||||
|
||||
/* Define state change macro that can be used by run-mode debug agents to keep track of thread
|
||||
state changes. By default, it is mapped to white space. */
|
||||
|
||||
|
||||
#ifndef TX_THREAD_STATE_CHANGE
|
||||
#define TX_THREAD_STATE_CHANGE(a, b)
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the macro to get the current thread pointer. This is particularly useful in SMP
|
||||
/* Define the macro to get the current thread pointer. This is particularly useful in SMP
|
||||
versions of ThreadX to add additional processing. The default implementation is to simply
|
||||
access the global current thread pointer directly. */
|
||||
|
||||
|
||||
#ifndef TX_THREAD_GET_CURRENT
|
||||
#define TX_THREAD_GET_CURRENT(a) (a) = _tx_thread_current_ptr;
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the macro to set the current thread pointer. This is particularly useful in SMP
|
||||
/* Define the macro to set the current thread pointer. This is particularly useful in SMP
|
||||
versions of ThreadX to add additional processing. The default implementation is to simply
|
||||
access the global current thread pointer directly. */
|
||||
|
||||
|
||||
#ifndef TX_THREAD_SET_CURRENT
|
||||
#define TX_THREAD_SET_CURRENT(a) _tx_thread_current_ptr = (a);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Define the get system state macro. By default, it simply maps to the variable _tx_thread_system_state. */
|
||||
|
||||
/* This symbol is moved to tx_api.h. Therefore removed from this file.
|
||||
#ifndef TX_THREAD_GET_SYSTEM_STATE
|
||||
#define TX_THREAD_GET_SYSTEM_STATE() _tx_thread_system_state
|
||||
#endif
|
||||
|
||||
*/
|
||||
|
||||
/* Define the check for whether or not to call the _tx_thread_system_return function. A non-zero value
|
||||
indicates that _tx_thread_system_return should not be called. */
|
||||
@@ -140,10 +148,10 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the lowest bit set macro. Note, that this may be overridden
|
||||
/* Define the lowest bit set macro. Note, that this may be overridden
|
||||
by a port specific definition if there is supporting assembly language
|
||||
instructions in the architecture. */
|
||||
|
||||
|
||||
#ifndef TX_LOWEST_SET_BIT_CALCULATE
|
||||
#define TX_LOWEST_SET_BIT_CALCULATE(m, b) \
|
||||
(b) = ((ULONG) 0); \
|
||||
@@ -208,9 +216,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the default thread stack checking. This can be overridden by
|
||||
a particular port, which is necessary if the stack growth is from
|
||||
low address to high address (the default logic is for stacks that
|
||||
/* Define the default thread stack checking. This can be overridden by
|
||||
a particular port, which is necessary if the stack growth is from
|
||||
low address to high address (the default logic is for stacks that
|
||||
grow from high address to low address. */
|
||||
|
||||
#ifndef TX_THREAD_STACK_CHECK
|
||||
@@ -307,7 +315,7 @@ THREAD_DECLARE TX_THREAD * _tx_thread_current_ptr;
|
||||
|
||||
|
||||
/* Define the variable that holds the next thread to execute. It is important
|
||||
to remember that this is not necessarily equal to the current thread
|
||||
to remember that this is not necessarily equal to the current thread
|
||||
pointer. */
|
||||
|
||||
THREAD_DECLARE TX_THREAD * _tx_thread_execute_ptr;
|
||||
@@ -324,7 +332,7 @@ THREAD_DECLARE ULONG _tx_thread_created_count;
|
||||
|
||||
|
||||
/* Define the current state variable. When this value is 0, a thread
|
||||
is executing or the system is idle. Other values indicate that
|
||||
is executing or the system is idle. Other values indicate that
|
||||
interrupt or initialization processing is active. This variable is
|
||||
initialized to TX_INITIALIZE_IN_PROGRESS to indicate initialization is
|
||||
active. */
|
||||
@@ -333,15 +341,15 @@ THREAD_DECLARE volatile ULONG _tx_thread_system_state;
|
||||
|
||||
|
||||
/* Define the 32-bit priority bit-maps. There is one priority bit map for each
|
||||
32 priority levels supported. If only 32 priorities are supported there is
|
||||
only one bit map. Each bit within a priority bit map represents that one
|
||||
32 priority levels supported. If only 32 priorities are supported there is
|
||||
only one bit map. Each bit within a priority bit map represents that one
|
||||
or more threads at the associated thread priority are ready. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_priority_maps[TX_MAX_PRIORITIES/32];
|
||||
|
||||
|
||||
/* Define the priority map active bit map that specifies which of the previously
|
||||
defined priority maps have something set. This is only necessary if more than
|
||||
/* Define the priority map active bit map that specifies which of the previously
|
||||
defined priority maps have something set. This is only necessary if more than
|
||||
32 priorities are supported. */
|
||||
|
||||
#if TX_MAX_PRIORITIES > 32
|
||||
@@ -351,17 +359,17 @@ THREAD_DECLARE ULONG _tx_thread_priority_map_active;
|
||||
|
||||
#ifndef TX_DISABLE_PREEMPTION_THRESHOLD
|
||||
|
||||
/* Define the 32-bit preempt priority bit maps. There is one preempt bit map
|
||||
for each 32 priority levels supported. If only 32 priorities are supported
|
||||
there is only one bit map. Each set set bit corresponds to a preempted priority
|
||||
level that had preemption-threshold active to protect against preemption of a
|
||||
/* Define the 32-bit preempt priority bit maps. There is one preempt bit map
|
||||
for each 32 priority levels supported. If only 32 priorities are supported
|
||||
there is only one bit map. Each set set bit corresponds to a preempted priority
|
||||
level that had preemption-threshold active to protect against preemption of a
|
||||
range of relatively higher priority threads. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_preempted_maps[TX_MAX_PRIORITIES/32];
|
||||
|
||||
|
||||
/* Define the preempt map active bit map that specifies which of the previously
|
||||
defined preempt maps have something set. This is only necessary if more than
|
||||
/* Define the preempt map active bit map that specifies which of the previously
|
||||
defined preempt maps have something set. This is only necessary if more than
|
||||
32 priorities are supported. */
|
||||
|
||||
#if TX_MAX_PRIORITIES > 32
|
||||
@@ -369,7 +377,7 @@ THREAD_DECLARE ULONG _tx_thread_preempted_map_active;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define the variable that holds the highest priority group ready for
|
||||
/* Define the variable that holds the highest priority group ready for
|
||||
execution. It is important to note that this is not necessarily the same
|
||||
as the priority of the thread pointed to by _tx_execute_thread. */
|
||||
|
||||
@@ -385,13 +393,13 @@ THREAD_DECLARE TX_THREAD * _tx_thread_priority_list[TX_MAX_PRIORITIES];
|
||||
|
||||
|
||||
/* Define the global preempt disable variable. If this is non-zero, preemption is
|
||||
disabled. It is used internally by ThreadX to prevent preemption of a thread in
|
||||
disabled. It is used internally by ThreadX to prevent preemption of a thread in
|
||||
the middle of a service that is resuming or suspending another thread. */
|
||||
|
||||
THREAD_DECLARE volatile UINT _tx_thread_preempt_disable;
|
||||
|
||||
|
||||
/* Define the global function pointer for mutex cleanup on thread completion or
|
||||
/* Define the global function pointer for mutex cleanup on thread completion or
|
||||
termination. This pointer is setup during mutex initialization. */
|
||||
|
||||
THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_ptr);
|
||||
@@ -403,7 +411,7 @@ THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_pt
|
||||
Bit(s) Meaning
|
||||
|
||||
31 TX_NOT_INTERRUPTABLE defined
|
||||
30 TX_INLINE_THREAD_RESUME_SUSPEND define
|
||||
30 TX_INLINE_THREAD_RESUME_SUSPEND define
|
||||
29-24 Priority groups 1 -> 32 priorities
|
||||
2 -> 64 priorities
|
||||
3 -> 96 priorities
|
||||
@@ -433,10 +441,10 @@ THREAD_DECLARE VOID (*_tx_thread_mutex_release)(TX_THREAD *thread_pt
|
||||
THREAD_DECLARE ULONG _tx_build_options;
|
||||
|
||||
|
||||
#ifdef TX_ENABLE_STACK_CHECKING
|
||||
#if defined(TX_ENABLE_STACK_CHECKING) || defined(TX_PORT_THREAD_STACK_ERROR_HANDLING)
|
||||
|
||||
/* Define the global function pointer for stack error handling. If a stack error is
|
||||
detected and the application has registered a stack error handler, it will be
|
||||
/* Define the global function pointer for stack error handling. If a stack error is
|
||||
detected and the application has registered a stack error handler, it will be
|
||||
called via this function pointer. */
|
||||
|
||||
THREAD_DECLARE VOID (*_tx_thread_application_stack_error_handler)(TX_THREAD *thread_ptr);
|
||||
@@ -451,20 +459,20 @@ THREAD_DECLARE VOID (*_tx_thread_application_stack_error_handler)(TX
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_resume_count;
|
||||
|
||||
|
||||
/* Define the total number of thread suspensions. Each time a thread enters a
|
||||
/* Define the total number of thread suspensions. Each time a thread enters a
|
||||
suspended state this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_suspend_count;
|
||||
|
||||
|
||||
/* Define the total number of solicited thread preemptions. Each time a thread is
|
||||
/* Define the total number of solicited thread preemptions. Each time a thread is
|
||||
preempted by directly calling a ThreadX service, this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_solicited_preemption_count;
|
||||
|
||||
|
||||
/* Define the total number of interrupt thread preemptions. Each time a thread is
|
||||
preempted as a result of an ISR calling a ThreadX service, this variable is
|
||||
/* Define the total number of interrupt thread preemptions. Each time a thread is
|
||||
preempted as a result of an ISR calling a ThreadX service, this variable is
|
||||
incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_interrupt_preemption_count;
|
||||
@@ -476,45 +484,45 @@ THREAD_DECLARE ULONG _tx_thread_performance_interrupt_preemption_coun
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_priority_inversion_count;
|
||||
|
||||
|
||||
/* Define the total number of time-slices. Each time a time-slice operation is
|
||||
actually performed (another thread is setup for running) this variable is
|
||||
/* Define the total number of time-slices. Each time a time-slice operation is
|
||||
actually performed (another thread is setup for running) this variable is
|
||||
incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_time_slice_count;
|
||||
|
||||
|
||||
/* Define the total number of thread relinquish operations. Each time a thread
|
||||
/* Define the total number of thread relinquish operations. Each time a thread
|
||||
relinquish operation is actually performed (another thread is setup for running)
|
||||
this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_relinquish_count;
|
||||
|
||||
|
||||
/* Define the total number of thread timeouts. Each time a thread has a
|
||||
/* Define the total number of thread timeouts. Each time a thread has a
|
||||
timeout this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_timeout_count;
|
||||
|
||||
|
||||
/* Define the total number of thread wait aborts. Each time a thread's suspension
|
||||
/* Define the total number of thread wait aborts. Each time a thread's suspension
|
||||
is lifted by the tx_thread_wait_abort call this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_wait_abort_count;
|
||||
|
||||
|
||||
/* Define the total number of idle system thread returns. Each time a thread returns to
|
||||
/* Define the total number of idle system thread returns. Each time a thread returns to
|
||||
an idle system (no other thread is ready to run) this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_idle_return_count;
|
||||
|
||||
|
||||
/* Define the total number of non-idle system thread returns. Each time a thread returns to
|
||||
/* Define the total number of non-idle system thread returns. Each time a thread returns to
|
||||
a non-idle system (another thread is ready to run) this variable is incremented. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance_non_idle_return_count;
|
||||
|
||||
|
||||
/* Define the last TX_THREAD_EXECUTE_LOG_SIZE threads scheduled in ThreadX. This
|
||||
/* Define the last TX_THREAD_EXECUTE_LOG_SIZE threads scheduled in ThreadX. This
|
||||
is a circular list, where the index points to the oldest entry. */
|
||||
|
||||
THREAD_DECLARE ULONG _tx_thread_performance__execute_log_index;
|
||||
|
||||
@@ -79,7 +79,7 @@ VOID _tx_timer_thread_entry(ULONG timer_thread_input);
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the system clock value that is continually incremented by the
|
||||
/* Define the system clock value that is continually incremented by the
|
||||
periodic timer interrupt processing. */
|
||||
|
||||
TIMER_DECLARE volatile ULONG _tx_timer_system_clock;
|
||||
@@ -116,7 +116,7 @@ TIMER_DECLARE TX_TIMER_INTERNAL **_tx_timer_list_end;
|
||||
TIMER_DECLARE TX_TIMER_INTERNAL **_tx_timer_current_ptr;
|
||||
|
||||
|
||||
/* Define the timer expiration flag. This is used to indicate that a timer
|
||||
/* Define the timer expiration flag. This is used to indicate that a timer
|
||||
has expired. */
|
||||
|
||||
TIMER_DECLARE UINT _tx_timer_expired;
|
||||
@@ -195,8 +195,8 @@ TIMER_DECLARE ULONG _tx_timer_performance_expiration_count;
|
||||
|
||||
|
||||
/* Define the total number of timer expiration adjustments. These are required
|
||||
if the expiration time is greater than the size of the timer list. In such
|
||||
cases, the timer is placed at the end of the list and then reactivated
|
||||
if the expiration time is greater than the size of the timer list. In such
|
||||
cases, the timer is placed at the end of the list and then reactivated
|
||||
as many times as necessary to finally achieve the resulting timeout. */
|
||||
|
||||
TIMER_DECLARE ULONG _tx_timer_performance__expiration_adjust_count;
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the default clock source for trace event entry time stamp. The following two item are port specific.
|
||||
For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock
|
||||
/* Define the default clock source for trace event entry time stamp. The following two item are port specific.
|
||||
For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock
|
||||
source constants would be:
|
||||
|
||||
#define TX_TRACE_TIME_SOURCE *((ULONG *) 0x0a800024)
|
||||
@@ -101,8 +101,8 @@
|
||||
|
||||
|
||||
/* ThreadX Trace Description. The ThreadX Trace feature is designed to capture
|
||||
events in real-time in a circular event buffer. This buffer may be analyzed by other
|
||||
tools. The high-level format of the Trace structure is:
|
||||
events in real-time in a circular event buffer. This buffer may be analyzed by other
|
||||
tools. The high-level format of the Trace structure is:
|
||||
|
||||
[Trace Control Header ]
|
||||
[Trace Object Registry - Entry 0 ]
|
||||
@@ -115,23 +115,23 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Trace Control Header. The Trace Control Header contains information that
|
||||
defines the format of the Trace Object Registry as well as the location and
|
||||
current entry of the Trace Buffer itself. The high-level format of the
|
||||
/* Trace Control Header. The Trace Control Header contains information that
|
||||
defines the format of the Trace Object Registry as well as the location and
|
||||
current entry of the Trace Buffer itself. The high-level format of the
|
||||
Trace Control Header is:
|
||||
|
||||
Entry Size Description
|
||||
|
||||
[Trace ID] 4 This 4-byte field contains the ThreadX Trace
|
||||
Identification. If the trace buffer is valid, the
|
||||
contents are 0x54585442 (TXTB). Since it is written as
|
||||
contents are 0x54585442 (TXTB). Since it is written as
|
||||
a 32-bit unsigned word, this value is also used to
|
||||
determine if the event trace information is in
|
||||
determine if the event trace information is in
|
||||
little or big endian format.
|
||||
[Timer Valid Mask] 4 Mask of valid bits in the 32-bit time stamp. This
|
||||
[Timer Valid Mask] 4 Mask of valid bits in the 32-bit time stamp. This
|
||||
enables use of 32, 24, 16, or event 8-bit timers.
|
||||
If the time source is 32-bits, the mask is
|
||||
0xFFFFFFFF. If the time source is 16-bits, the
|
||||
If the time source is 32-bits, the mask is
|
||||
0xFFFFFFFF. If the time source is 16-bits, the
|
||||
mask is 0x0000FFFF.
|
||||
[Trace Base Address] 4 The base address for all trace pointer. Subtracting
|
||||
the pointer and this address will yield the proper
|
||||
@@ -143,7 +143,7 @@
|
||||
[Trace Buffer Start Pointer] 4 Pointer to the start of the Trace Buffer Area
|
||||
[Trace Buffer End Pointer] 4 Pointer to the end of the Trace Buffer Area
|
||||
[Trace Buffer Current Pointer] 4 Pointer to the oldest entry in the Trace Buffer.
|
||||
This entry will be overwritten on the next event and
|
||||
This entry will be overwritten on the next event and
|
||||
incremented to the next event (wrapping to the top
|
||||
if the buffer end pointer is exceeded).
|
||||
[Reserved] 4 Reserved 4 bytes, should be 0xAAAAAAAA
|
||||
@@ -173,7 +173,7 @@ typedef struct TX_TRACE_HEADER_STRUCT
|
||||
} TX_TRACE_HEADER;
|
||||
|
||||
|
||||
/* Trace Object Registry. The Trace Object Registry is used to map the object pointer in the trace buffer to
|
||||
/* Trace Object Registry. The Trace Object Registry is used to map the object pointer in the trace buffer to
|
||||
the application's name for the object (defined during object creation in ThreadX). */
|
||||
|
||||
#ifndef TX_TRACE_OBJECT_REGISTRY_NAME
|
||||
@@ -181,7 +181,7 @@ typedef struct TX_TRACE_HEADER_STRUCT
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the object name types as well as the contents of any additional parameters that might be useful in
|
||||
/* Define the object name types as well as the contents of any additional parameters that might be useful in
|
||||
trace analysis. */
|
||||
|
||||
#define TX_TRACE_OBJECT_TYPE_NOT_VALID ((UCHAR) 0) /* Object is not valid */
|
||||
@@ -214,27 +214,27 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT
|
||||
|
||||
Entry Size Description
|
||||
|
||||
[Thread Pointer] 4 This 4-byte field contains the pointer to the
|
||||
ThreadX thread running that caused the event.
|
||||
[Thread Pointer] 4 This 4-byte field contains the pointer to the
|
||||
ThreadX thread running that caused the event.
|
||||
If this field is NULL, the entry hasn't been used
|
||||
yet. If this field is 0xFFFFFFFF, the event occurred
|
||||
from within an ISR. If this entry is 0xF0F0F0F0, the
|
||||
from within an ISR. If this entry is 0xF0F0F0F0, the
|
||||
event occurred during initialization.
|
||||
[Thread Priority or 4 This 4-byte field contains the current thread pointer for interrupt
|
||||
Current Thread events or the thread preemption-threshold/priority for thread events.
|
||||
Preemption-Threshold/
|
||||
Priority]
|
||||
[Event ID] 4 This 4-byte field contains the Event ID of the event. A value of
|
||||
[Event ID] 4 This 4-byte field contains the Event ID of the event. A value of
|
||||
0xFFFFFFFF indicates the event is invalid. All events are marked
|
||||
as invalid during initialization.
|
||||
[Time Stamp] 4 This 4-byte field contains the time stamp of the event.
|
||||
[Information Field 1] 4 This 4-byte field contains the first 4-bytes of information
|
||||
[Information Field 1] 4 This 4-byte field contains the first 4-bytes of information
|
||||
specific to the event.
|
||||
[Information Field 2] 4 This 4-byte field contains the second 4-bytes of information
|
||||
[Information Field 2] 4 This 4-byte field contains the second 4-bytes of information
|
||||
specific to the event.
|
||||
[Information Field 3] 4 This 4-byte field contains the third 4-bytes of information
|
||||
[Information Field 3] 4 This 4-byte field contains the third 4-bytes of information
|
||||
specific to the event.
|
||||
[Information Field 4] 4 This 4-byte field contains the fourth 4-bytes of information
|
||||
[Information Field 4] 4 This 4-byte field contains the fourth 4-bytes of information
|
||||
specific to the event.
|
||||
*/
|
||||
|
||||
@@ -244,15 +244,15 @@ typedef struct TX_TRACE_OBJECT_ENTRY_STRUCT
|
||||
/* Define ThreadX Trace Events, along with a brief description of the additional information fields,
|
||||
where I1 -> Information Field 1, I2 -> Information Field 2, etc. */
|
||||
|
||||
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
|
||||
|
||||
ThreadX events: 1-199
|
||||
/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:
|
||||
|
||||
ThreadX events: 1-199
|
||||
FileX events: 200-299
|
||||
NetX events: 300-599
|
||||
USBX events: 600-999
|
||||
|
||||
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
|
||||
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
|
||||
|
||||
User-defined event numbers start at 4096 and continue through 65535, as defined by the constants
|
||||
TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based
|
||||
on these constants in case the user event number assignment is changed in future releases. */
|
||||
|
||||
/* Define the basic ThreadX thread scheduling events first. */
|
||||
@@ -417,7 +417,7 @@ TRACE_DECLARE TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_end_ptr;
|
||||
TRACE_DECLARE TX_TRACE_BUFFER_ENTRY *_tx_trace_buffer_current_ptr;
|
||||
|
||||
|
||||
/* Define the trace event enable bits, where each bit represents a type of event that can be enabled
|
||||
/* Define the trace event enable bits, where each bit represents a type of event that can be enabled
|
||||
or disabled dynamically by the application. */
|
||||
|
||||
TRACE_DECLARE ULONG _tx_trace_event_enable_bits;
|
||||
@@ -429,9 +429,9 @@ TRACE_DECLARE ULONG _tx_trace_event_enable_bits;
|
||||
TRACE_DECLARE ULONG _tx_trace_simulated_time;
|
||||
|
||||
|
||||
/* Define the function pointer used to call the application when the trace buffer wraps. If NULL,
|
||||
/* Define the function pointer used to call the application when the trace buffer wraps. If NULL,
|
||||
the application has not registered a callback function. */
|
||||
|
||||
|
||||
TRACE_DECLARE VOID (*_tx_trace_full_notify_function)(VOID *buffer);
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/* PORT SPECIFIC C INFORMATION RELEASE */
|
||||
/* */
|
||||
/* tx_user.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.3.0 */
|
||||
/* */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
@@ -44,9 +44,28 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 03-02-2021 Scott Larson Modified comment(s), */
|
||||
/* added option to remove */
|
||||
/* FileX pointer, */
|
||||
/* resulting in version 6.1.5 */
|
||||
/* 06-02-2021 Scott Larson Added options for multiple */
|
||||
/* block pool search & delay, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 10-15-2021 Yuxin Zhou Modified comment(s), added */
|
||||
/* user-configurable symbol */
|
||||
/* TX_TIMER_TICKS_PER_SECOND */
|
||||
/* resulting in version 6.1.9 */
|
||||
/* 04-25-2022 Wenhui Xie Modified comment(s), */
|
||||
/* optimized the definition of */
|
||||
/* TX_TIMER_TICKS_PER_SECOND, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
|
||||
/* added option for random */
|
||||
/* number stack filling, */
|
||||
/* resulting in version 6.3.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -55,9 +74,9 @@
|
||||
|
||||
|
||||
/* Define various build options for the ThreadX port. The application should either make changes
|
||||
here by commenting or un-commenting the conditional compilation defined OR supply the defines
|
||||
though the compiler's equivalent of the -D option.
|
||||
|
||||
here by commenting or un-commenting the conditional compilation defined OR supply the defines
|
||||
though the compiler's equivalent of the -D option.
|
||||
|
||||
For maximum speed, the following should be defined:
|
||||
|
||||
TX_MAX_PRIORITIES 32
|
||||
@@ -69,21 +88,22 @@
|
||||
TX_REACTIVATE_INLINE
|
||||
TX_DISABLE_STACK_FILLING
|
||||
TX_INLINE_THREAD_RESUME_SUSPEND
|
||||
|
||||
|
||||
For minimum size, the following should be defined:
|
||||
|
||||
|
||||
TX_MAX_PRIORITIES 32
|
||||
TX_DISABLE_PREEMPTION_THRESHOLD
|
||||
TX_DISABLE_REDUNDANT_CLEARING
|
||||
TX_DISABLE_NOTIFY_CALLBACKS
|
||||
TX_NO_FILEX_POINTER
|
||||
TX_NOT_INTERRUPTABLE
|
||||
TX_TIMER_PROCESS_IN_ISR
|
||||
|
||||
|
||||
Of course, many of these defines reduce functionality and/or change the behavior of the
|
||||
system in ways that may not be worth the trade-off. For example, the TX_TIMER_PROCESS_IN_ISR
|
||||
results in faster and smaller code, however, it increases the amount of processing in the ISR.
|
||||
In addition, some services that are available in timers are not available from ISRs and will
|
||||
therefore return an error if this option is used. This may or may not be desirable for a
|
||||
therefore return an error if this option is used. This may or may not be desirable for a
|
||||
given application. */
|
||||
|
||||
|
||||
@@ -98,9 +118,28 @@
|
||||
#define TX_TIMER_THREAD_PRIORITY ????
|
||||
*/
|
||||
|
||||
/* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls
|
||||
should be processed within the a system timer thread or directly in the timer ISR.
|
||||
By default, the timer thread is used. When the following is defined, the timer expiration
|
||||
/* Define the common timer tick reference for use by other middleware components. The default
|
||||
value is 10ms (i.e. 100 ticks, defined in tx_api.h), but may be replaced by a port-specific
|
||||
version in tx_port.h or here.
|
||||
Note: the actual hardware timer value may need to be changed (usually in tx_initialize_low_level). */
|
||||
|
||||
/*
|
||||
#define TX_TIMER_TICKS_PER_SECOND (100UL)
|
||||
*/
|
||||
|
||||
/* Determine if there is a FileX pointer in the thread control block.
|
||||
By default, the pointer is there for legacy/backwards compatibility.
|
||||
The pointer must also be there for applications using FileX.
|
||||
Define this to save space in the thread control block.
|
||||
*/
|
||||
|
||||
/*
|
||||
#define TX_NO_FILEX_POINTER
|
||||
*/
|
||||
|
||||
/* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls
|
||||
should be processed within the a system timer thread or directly in the timer ISR.
|
||||
By default, the timer thread is used. When the following is defined, the timer expiration
|
||||
processing is done directly from the timer ISR, thereby eliminating the timer thread control
|
||||
block, stack, and context switching to activate it. */
|
||||
|
||||
@@ -125,7 +164,7 @@
|
||||
#define TX_DISABLE_STACK_FILLING
|
||||
*/
|
||||
|
||||
/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
|
||||
/* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
|
||||
disabled. When the following is defined, ThreadX thread stack checking is enabled. If stack
|
||||
checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
|
||||
define is negated, thereby forcing the stack fill which is necessary for the stack checking
|
||||
@@ -135,7 +174,15 @@
|
||||
#define TX_ENABLE_STACK_CHECKING
|
||||
*/
|
||||
|
||||
/* Determine if preemption-threshold should be disabled. By default, preemption-threshold is
|
||||
/* Determine if random number is used for stack filling. By default, ThreadX uses a fixed
|
||||
pattern for stack filling. When the following is defined, ThreadX uses a random number
|
||||
for stack filling. This is effective only when TX_ENABLE_STACK_CHECKING is defined. */
|
||||
|
||||
/*
|
||||
#define TX_ENABLE_RANDOM_NUMBER_STACK_FILLING
|
||||
*/
|
||||
|
||||
/* Determine if preemption-threshold should be disabled. By default, preemption-threshold is
|
||||
enabled. If the application does not use preemption-threshold, it may be disabled to reduce
|
||||
code size and improve performance. */
|
||||
|
||||
@@ -143,7 +190,7 @@
|
||||
#define TX_DISABLE_PREEMPTION_THRESHOLD
|
||||
*/
|
||||
|
||||
/* Determine if global ThreadX variables should be cleared. If the compiler startup code clears
|
||||
/* Determine if global ThreadX variables should be cleared. If the compiler startup code clears
|
||||
the .bss section prior to ThreadX running, the define can be used to eliminate unnecessary
|
||||
clearing of ThreadX global variables. */
|
||||
|
||||
@@ -151,9 +198,9 @@
|
||||
#define TX_DISABLE_REDUNDANT_CLEARING
|
||||
*/
|
||||
|
||||
/* Determine if no timer processing is required. This option will help eliminate the timer
|
||||
processing when not needed. The user will also have to comment out the call to
|
||||
tx_timer_interrupt, which is typically made from assembly language in
|
||||
/* Determine if no timer processing is required. This option will help eliminate the timer
|
||||
processing when not needed. The user will also have to comment out the call to
|
||||
tx_timer_interrupt, which is typically made from assembly language in
|
||||
tx_initialize_low_level. Note: if TX_NO_TIMER is used, the define TX_TIMER_PROCESS_IN_ISR
|
||||
must also be used and tx_timer_initialize must be removed from ThreadX library. */
|
||||
|
||||
@@ -173,8 +220,8 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal
|
||||
code in-line. This results in a larger image, but improves the performance of the thread
|
||||
/* Determine if the tx_thread_resume and tx_thread_suspend services should have their internal
|
||||
code in-line. This results in a larger image, but improves the performance of the thread
|
||||
resume and suspend services. */
|
||||
|
||||
/*
|
||||
@@ -182,7 +229,7 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Determine if the internal ThreadX code is non-interruptable. This results in smaller code
|
||||
/* Determine if the internal ThreadX code is non-interruptable. This results in smaller code
|
||||
size and less processing overhead, but increases the interrupt lockout time. */
|
||||
|
||||
/*
|
||||
@@ -190,8 +237,8 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Determine if the trace event logging code should be enabled. This causes slight increases in
|
||||
code size and overhead, but provides the ability to generate system trace information which
|
||||
/* Determine if the trace event logging code should be enabled. This causes slight increases in
|
||||
code size and overhead, but provides the ability to generate system trace information which
|
||||
is available for viewing in TraceX. */
|
||||
|
||||
/*
|
||||
@@ -255,5 +302,17 @@
|
||||
#define TX_TIMER_ENABLE_PERFORMANCE_INFO
|
||||
*/
|
||||
|
||||
/* Override options for byte pool searches of multiple blocks. */
|
||||
|
||||
/*
|
||||
#define TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH 20
|
||||
*/
|
||||
|
||||
/* Override options for byte pool search delay to avoid thrashing. */
|
||||
|
||||
/*
|
||||
#define TX_BYTE_POOL_DELAY_VALUE 3
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ ULONG lower_tbu;
|
||||
/* Save the pool's address in the block for when it is released! */
|
||||
temp_ptr = TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(pool_ptr);
|
||||
*next_block_ptr = temp_ptr;
|
||||
|
||||
|
||||
#ifdef TX_ENABLE_EVENT_TRACE
|
||||
|
||||
/* Check that the event time stamp is unchanged. A different
|
||||
@@ -182,7 +182,7 @@ ULONG lower_tbu;
|
||||
/* Is the time stamp the same? */
|
||||
if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp)
|
||||
{
|
||||
|
||||
|
||||
/* Timestamp is the same, update the entry with the address. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*block_ptr);
|
||||
@@ -200,7 +200,7 @@ ULONG lower_tbu;
|
||||
|
||||
/* Set status to success. */
|
||||
status = TX_SUCCESS;
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
}
|
||||
@@ -229,7 +229,7 @@ ULONG lower_tbu;
|
||||
{
|
||||
|
||||
/* Prepare for suspension of this thread. */
|
||||
|
||||
|
||||
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
/* Increment the total suspensions counter. */
|
||||
@@ -261,7 +261,7 @@ ULONG lower_tbu;
|
||||
|
||||
/* Pickup the number of suspended threads. */
|
||||
suspended_count = (pool_ptr -> tx_block_pool_suspended_count);
|
||||
|
||||
|
||||
/* Increment the number of suspended threads. */
|
||||
(pool_ptr -> tx_block_pool_suspended_count)++;
|
||||
|
||||
@@ -322,11 +322,11 @@ ULONG lower_tbu;
|
||||
allocate event. In that case, do nothing here. */
|
||||
if (entry_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Is the time-stamp the same? */
|
||||
if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp)
|
||||
{
|
||||
|
||||
|
||||
/* Timestamp is the same, update the entry with the address. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*block_ptr);
|
||||
|
||||
@@ -87,7 +87,7 @@ UINT suspended_count;
|
||||
TX_THREAD *next_thread;
|
||||
TX_THREAD *previous_thread;
|
||||
|
||||
|
||||
|
||||
#ifndef TX_NOT_INTERRUPTABLE
|
||||
|
||||
/* Disable interrupts to remove the suspended thread from the block pool. */
|
||||
@@ -96,7 +96,7 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if the cleanup is still required. */
|
||||
if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_block_pool_cleanup))
|
||||
{
|
||||
|
||||
|
||||
/* Check for valid suspension sequence. */
|
||||
if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ TX_THREAD *previous_thread;
|
||||
/* Check for a NULL byte pool pointer. */
|
||||
if (pool_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Check for valid pool ID. */
|
||||
if (pool_ptr -> tx_block_pool_id == TX_BLOCK_POOL_ID)
|
||||
{
|
||||
@@ -133,13 +133,13 @@ TX_THREAD *previous_thread;
|
||||
suspended_count = pool_ptr -> tx_block_pool_suspended_count;
|
||||
|
||||
/* Remove the suspended thread from the list. */
|
||||
|
||||
|
||||
/* See if this is the only suspended thread on the list. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
/* Yes, the only suspended thread. */
|
||||
|
||||
|
||||
/* Update the head pointer. */
|
||||
pool_ptr -> tx_block_pool_suspension_list = TX_NULL;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if we need to update the head pointer. */
|
||||
if (pool_ptr -> tx_block_pool_suspension_list == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Update the list head pointer. */
|
||||
pool_ptr -> tx_block_pool_suspension_list = next_thread;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ TX_THREAD *previous_thread;
|
||||
if (thread_ptr -> tx_thread_state == TX_BLOCK_MEMORY)
|
||||
{
|
||||
|
||||
/* Timeout condition and the thread still suspended on the block pool.
|
||||
/* Timeout condition and the thread still suspended on the block pool.
|
||||
Setup return error status and resume the thread. */
|
||||
|
||||
#ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
@@ -97,7 +97,7 @@ TX_BLOCK_POOL *previous_pool;
|
||||
an ALIGN_TYPE (typically this is a 32-bit ULONG). This helps guarantee proper alignment. */
|
||||
block_size = (((block_size + (sizeof(ALIGN_TYPE))) - ((ALIGN_TYPE) 1))/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE));
|
||||
|
||||
/* Round the pool size down to something that is evenly divisible by
|
||||
/* Round the pool size down to something that is evenly divisible by
|
||||
an ALIGN_TYPE (typically this is a 32-bit ULONG). */
|
||||
pool_size = (pool_size/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE));
|
||||
|
||||
@@ -106,7 +106,7 @@ TX_BLOCK_POOL *previous_pool;
|
||||
pool_ptr -> tx_block_pool_start = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
|
||||
pool_ptr -> tx_block_pool_size = pool_size;
|
||||
pool_ptr -> tx_block_pool_block_size = (UINT) block_size;
|
||||
|
||||
|
||||
/* Calculate the total number of blocks. */
|
||||
total_blocks = pool_size/(block_size + (sizeof(UCHAR *)));
|
||||
|
||||
@@ -145,7 +145,7 @@ TX_BLOCK_POOL *previous_pool;
|
||||
/* Set the last block's forward pointer to NULL. */
|
||||
block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(block_ptr);
|
||||
*block_link_ptr = TX_NULL;
|
||||
|
||||
|
||||
/* Setup the starting pool address. */
|
||||
pool_ptr -> tx_block_pool_available_list = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
|
||||
|
||||
@@ -180,7 +180,7 @@ TX_BLOCK_POOL *previous_pool;
|
||||
pool_ptr -> tx_block_pool_created_previous = previous_pool;
|
||||
pool_ptr -> tx_block_pool_created_next = next_pool;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the created count. */
|
||||
_tx_block_pool_created_count++;
|
||||
|
||||
@@ -208,7 +208,7 @@ TX_BLOCK_POOL *previous_pool;
|
||||
/* Not enough memory for one block, return appropriate error. */
|
||||
status = TX_SIZE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ TX_BLOCK_POOL *previous_pool;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_block_pool_created_ptr == pool_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_block_pool_created_ptr = next_pool;
|
||||
}
|
||||
@@ -148,14 +148,14 @@ TX_BLOCK_POOL *previous_pool;
|
||||
on this block pool. */
|
||||
while (suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
|
||||
ULONG *total_blocks, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BLOCK_POOL **next_pool)
|
||||
{
|
||||
|
||||
@@ -100,42 +100,42 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the block pool. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = pool_ptr -> tx_block_pool_name;
|
||||
}
|
||||
|
||||
/* Retrieve the number of available blocks in the block pool. */
|
||||
if (available_blocks != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*available_blocks = (ULONG) pool_ptr -> tx_block_pool_available;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of blocks in the block pool. */
|
||||
if (total_blocks != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*total_blocks = (ULONG) pool_ptr -> tx_block_pool_total;
|
||||
}
|
||||
|
||||
/* Retrieve the first thread suspended on this block pool. */
|
||||
if (first_suspended != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*first_suspended = pool_ptr -> tx_block_pool_suspension_list;
|
||||
}
|
||||
|
||||
/* Retrieve the number of threads suspended on this block pool. */
|
||||
if (suspended_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspended_count = (ULONG) pool_ptr -> tx_block_pool_suspended_count;
|
||||
}
|
||||
|
||||
/* Retrieve the pointer to the next block pool created. */
|
||||
if (next_pool != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_pool = pool_ptr -> tx_block_pool_created_next;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ UINT status;
|
||||
/* Determine if this is a legal request. */
|
||||
if (pool_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Block pool pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -101,13 +101,13 @@ UINT status;
|
||||
/* Determine if the pool ID is invalid. */
|
||||
else if (pool_ptr -> tx_block_pool_id != TX_BLOCK_POOL_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Block pool pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
@@ -123,28 +123,28 @@ UINT status;
|
||||
/* Retrieve the number of allocations from this block pool. */
|
||||
if (allocates != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*allocates = pool_ptr -> tx_block_pool_performance_allocate_count;
|
||||
}
|
||||
|
||||
/* Retrieve the number of blocks released to this block pool. */
|
||||
if (releases != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*releases = pool_ptr -> tx_block_pool_performance_release_count;
|
||||
}
|
||||
|
||||
/* Retrieve the number of thread suspensions on this block pool. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = pool_ptr -> tx_block_pool_performance_suspension_count;
|
||||
}
|
||||
|
||||
/* Retrieve the number of thread timeouts on this block pool. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = pool_ptr -> tx_block_pool_performance_timeout_count;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ UINT status;
|
||||
#else
|
||||
UINT status;
|
||||
|
||||
|
||||
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (pool_ptr != TX_NULL)
|
||||
{
|
||||
@@ -191,7 +191,7 @@ UINT status;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
@@ -100,28 +100,28 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the total number of block allocations. */
|
||||
if (allocates != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*allocates = _tx_block_pool_performance_allocate_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of blocks released. */
|
||||
if (releases != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*releases = _tx_block_pool_performance_release_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of block pool thread suspensions. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = _tx_block_pool_performance_suspension_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of block pool thread timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = _tx_block_pool_performance_timeout_count;
|
||||
}
|
||||
|
||||
@@ -139,35 +139,35 @@ UINT status;
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (allocates != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (releases != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,7 @@ UINT list_changed;
|
||||
|
||||
/* Remember the suspension count and head pointer. */
|
||||
head_ptr = pool_ptr -> tx_block_pool_suspension_list;
|
||||
|
||||
|
||||
/* Default the highest priority thread to the thread at the front of the list. */
|
||||
priority_thread_ptr = head_ptr;
|
||||
|
||||
@@ -142,7 +142,7 @@ UINT list_changed;
|
||||
|
||||
/* Set the list changed flag to false. */
|
||||
list_changed = TX_FALSE;
|
||||
|
||||
|
||||
/* Search through the list to find the highest priority thread. */
|
||||
do
|
||||
{
|
||||
@@ -160,33 +160,33 @@ UINT list_changed;
|
||||
|
||||
/* Disable interrupts again. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Determine if any changes to the list have occurred while
|
||||
|
||||
/* Determine if any changes to the list have occurred while
|
||||
interrupts were enabled. */
|
||||
|
||||
|
||||
/* Is the list head the same? */
|
||||
if (head_ptr != pool_ptr -> tx_block_pool_suspension_list)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Is the suspended count the same? */
|
||||
if (suspended_count != pool_ptr -> tx_block_pool_suspended_count)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the list has changed. */
|
||||
if (list_changed == TX_FALSE)
|
||||
{
|
||||
|
||||
|
||||
/* Move the thread pointer to the next thread. */
|
||||
thread_ptr = thread_ptr -> tx_thread_suspended_next;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ UINT list_changed;
|
||||
|
||||
/* Setup search pointer. */
|
||||
thread_ptr = priority_thread_ptr -> tx_thread_suspended_next;
|
||||
|
||||
|
||||
/* Reset the list changed flag. */
|
||||
list_changed = TX_FALSE;
|
||||
}
|
||||
@@ -212,12 +212,12 @@ UINT list_changed;
|
||||
/* Release preemption. */
|
||||
_tx_thread_preempt_disable--;
|
||||
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
of the list. */
|
||||
if (priority_thread_ptr != head_ptr)
|
||||
{
|
||||
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
front of the list. */
|
||||
|
||||
/* First, remove the highest priority thread by updating the
|
||||
|
||||
@@ -90,7 +90,7 @@ TX_THREAD *previous_thread;
|
||||
/* Disable interrupts to put this block back in the pool. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Pickup the pool pointer which is just previous to the starting
|
||||
/* Pickup the pool pointer which is just previous to the starting
|
||||
address of the block that the caller sees. */
|
||||
work_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(block_ptr);
|
||||
work_ptr = TX_UCHAR_POINTER_SUB(work_ptr, (sizeof(UCHAR *)));
|
||||
@@ -121,7 +121,7 @@ TX_THREAD *previous_thread;
|
||||
|
||||
/* Decrement the number of threads suspended. */
|
||||
(pool_ptr -> tx_block_pool_suspended_count)--;
|
||||
|
||||
|
||||
/* Pickup the suspended count. */
|
||||
suspended_count = (pool_ptr -> tx_block_pool_suspended_count);
|
||||
|
||||
@@ -148,7 +148,7 @@ TX_THREAD *previous_thread;
|
||||
next_thread -> tx_thread_suspended_previous = previous_thread;
|
||||
previous_thread -> tx_thread_suspended_next = next_thread;
|
||||
}
|
||||
|
||||
|
||||
/* Prepare for resumption of the first thread. */
|
||||
|
||||
/* Clear cleanup routine to avoid timeout. */
|
||||
|
||||
@@ -181,17 +181,17 @@ ULONG lower_tbu;
|
||||
/* Determine if we are finished. */
|
||||
if (work_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, we have found a block the search is finished. */
|
||||
finished = TX_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* No block was found, does this thread still own the pool? */
|
||||
if (pool_ptr -> tx_byte_pool_owner == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, then we have looked through the entire pool and haven't found the memory. */
|
||||
finished = TX_TRUE;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ ULONG lower_tbu;
|
||||
/* Is the timestamp the same? */
|
||||
if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp)
|
||||
{
|
||||
|
||||
|
||||
/* Timestamp is the same, update the entry with the address. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*memory_ptr);
|
||||
@@ -242,7 +242,7 @@ ULONG lower_tbu;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Set the status to success. */
|
||||
status = TX_SUCCESS;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ ULONG lower_tbu;
|
||||
|
||||
/* Increment the suspension count. */
|
||||
(pool_ptr -> tx_byte_pool_suspended_count)++;
|
||||
|
||||
|
||||
/* Setup suspension list. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
@@ -366,7 +366,7 @@ ULONG lower_tbu;
|
||||
/* Is the timestamp the same? */
|
||||
if (time_stamp == entry_ptr -> tx_trace_buffer_entry_time_stamp)
|
||||
{
|
||||
|
||||
|
||||
/* Timestamp is the same, update the entry with the address. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
entry_ptr -> tx_trace_buffer_entry_info_2 = TX_POINTER_TO_ULONG_CONVERT(*memory_ptr);
|
||||
@@ -396,7 +396,7 @@ ULONG lower_tbu;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ UINT suspended_count;
|
||||
TX_THREAD *next_thread;
|
||||
TX_THREAD *previous_thread;
|
||||
|
||||
|
||||
|
||||
#ifndef TX_NOT_INTERRUPTABLE
|
||||
|
||||
/* Disable interrupts to remove the suspended thread from the byte pool. */
|
||||
@@ -96,7 +96,7 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if the cleanup is still required. */
|
||||
if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_byte_pool_cleanup))
|
||||
{
|
||||
|
||||
|
||||
/* Check for valid suspension sequence. */
|
||||
if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ TX_THREAD *previous_thread;
|
||||
/* Check for a NULL byte pool pointer. */
|
||||
if (pool_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Check for valid pool ID. */
|
||||
if (pool_ptr -> tx_byte_pool_id == TX_BYTE_POOL_ID)
|
||||
{
|
||||
@@ -126,18 +126,18 @@ TX_THREAD *previous_thread;
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
pool_ptr -> tx_byte_pool_suspended_count--;
|
||||
|
||||
|
||||
/* Pickup the suspended count. */
|
||||
suspended_count = pool_ptr -> tx_byte_pool_suspended_count;
|
||||
|
||||
/* Remove the suspended thread from the list. */
|
||||
|
||||
|
||||
/* See if this is the only suspended thread on the list. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
/* Yes, the only suspended thread. */
|
||||
|
||||
|
||||
/* Update the head pointer. */
|
||||
pool_ptr -> tx_byte_pool_suspension_list = TX_NULL;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if we need to update the head pointer. */
|
||||
if (pool_ptr -> tx_byte_pool_suspension_list == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Update the list head pointer. */
|
||||
pool_ptr -> tx_byte_pool_suspension_list = next_thread;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ TX_THREAD *previous_thread;
|
||||
if (thread_ptr -> tx_thread_state == TX_BYTE_MEMORY)
|
||||
{
|
||||
|
||||
/* Timeout condition and the thread still suspended on the byte pool.
|
||||
/* Timeout condition and the thread still suspended on the byte pool.
|
||||
Setup return error status and resume the thread. */
|
||||
|
||||
#ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
@@ -89,7 +89,7 @@ ALIGN_TYPE *free_ptr;
|
||||
/* Initialize the byte pool control block to all zeros. */
|
||||
TX_MEMSET(pool_ptr, 0, (sizeof(TX_BYTE_POOL)));
|
||||
|
||||
/* Round the pool size down to something that is evenly divisible by
|
||||
/* Round the pool size down to something that is evenly divisible by
|
||||
an ULONG. */
|
||||
pool_size = (pool_size/(sizeof(ALIGN_TYPE))) * (sizeof(ALIGN_TYPE));
|
||||
|
||||
@@ -104,17 +104,17 @@ ALIGN_TYPE *free_ptr;
|
||||
pool_ptr -> tx_byte_pool_list = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
|
||||
pool_ptr -> tx_byte_pool_search = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
|
||||
|
||||
/* Initially, the pool will have two blocks. One large block at the
|
||||
/* Initially, the pool will have two blocks. One large block at the
|
||||
beginning that is available and a small allocated block at the end
|
||||
of the pool that is there just for the algorithm. Be sure to count
|
||||
the available block's header in the available bytes count. */
|
||||
pool_ptr -> tx_byte_pool_available = pool_size - ((sizeof(VOID *)) + (sizeof(ALIGN_TYPE)));
|
||||
pool_ptr -> tx_byte_pool_fragments = ((UINT) 2);
|
||||
|
||||
|
||||
/* Each block contains a "next" pointer that points to the next block in the pool followed by a ALIGN_TYPE
|
||||
field that contains either the constant TX_BYTE_BLOCK_FREE (if the block is free) or a pointer to the
|
||||
owning pool (if the block is allocated). */
|
||||
|
||||
|
||||
/* Calculate the end of the pool's memory area. */
|
||||
block_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(pool_start);
|
||||
block_ptr = TX_UCHAR_POINTER_ADD(block_ptr, pool_size);
|
||||
@@ -177,7 +177,7 @@ ALIGN_TYPE *free_ptr;
|
||||
|
||||
/* Increment the number of created byte pools. */
|
||||
_tx_byte_pool_created_count++;
|
||||
|
||||
|
||||
/* Optional byte pool create extended processing. */
|
||||
TX_BYTE_POOL_CREATE_EXTENSION(pool_ptr)
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ TX_BYTE_POOL *previous_pool;
|
||||
|
||||
/* Decrement the number of byte pools created. */
|
||||
_tx_byte_pool_created_count--;
|
||||
|
||||
|
||||
/* See if the byte pool is the only one on the list. */
|
||||
if (_tx_byte_pool_created_count == TX_EMPTY)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ TX_BYTE_POOL *previous_pool;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_byte_pool_created_ptr == pool_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_byte_pool_created_ptr = next_pool;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ TX_BYTE_POOL *previous_pool;
|
||||
pool_ptr -> tx_byte_pool_suspension_list = TX_NULL;
|
||||
suspended_count = pool_ptr -> tx_byte_pool_suspended_count;
|
||||
pool_ptr -> tx_byte_pool_suspended_count = TX_NO_SUSPENSIONS;
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
@@ -152,14 +152,14 @@ TX_BYTE_POOL *previous_pool;
|
||||
on this byte pool. */
|
||||
while (suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes,
|
||||
ULONG *fragments, TX_THREAD **first_suspended,
|
||||
ULONG *suspended_count, TX_BYTE_POOL **next_pool)
|
||||
{
|
||||
|
||||
@@ -100,42 +100,42 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the byte pool. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = pool_ptr -> tx_byte_pool_name;
|
||||
}
|
||||
|
||||
/* Retrieve the number of available bytes in the byte pool. */
|
||||
if (available_bytes != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*available_bytes = pool_ptr -> tx_byte_pool_available;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of bytes in the byte pool. */
|
||||
if (fragments != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*fragments = (ULONG) pool_ptr -> tx_byte_pool_fragments;
|
||||
}
|
||||
|
||||
/* Retrieve the first thread suspended on this byte pool. */
|
||||
if (first_suspended != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*first_suspended = pool_ptr -> tx_byte_pool_suspension_list;
|
||||
}
|
||||
|
||||
/* Retrieve the number of threads suspended on this byte pool. */
|
||||
if (suspended_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspended_count = (ULONG) pool_ptr -> tx_byte_pool_suspended_count;
|
||||
}
|
||||
|
||||
/* Retrieve the pointer to the next byte pool created. */
|
||||
if (next_pool != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_pool = pool_ptr -> tx_byte_pool_created_next;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,15 +102,15 @@ UINT status;
|
||||
/* Determine if this is a legal request. */
|
||||
if (pool_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Byte pool pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the pool ID is invalid. */
|
||||
else if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Byte pool pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ UINT status;
|
||||
/* Retrieve the number of allocates on this byte pool. */
|
||||
if (allocates != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*allocates = pool_ptr -> tx_byte_pool_performance_allocate_count;
|
||||
}
|
||||
|
||||
@@ -146,35 +146,35 @@ UINT status;
|
||||
/* Retrieve the number of fragments searched in this byte pool. */
|
||||
if (fragments_searched != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*fragments_searched = pool_ptr -> tx_byte_pool_performance_search_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of fragments merged on this byte pool. */
|
||||
if (merges != TX_NULL)
|
||||
{
|
||||
|
||||
*merges = pool_ptr -> tx_byte_pool_performance_merge_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of fragment splits on this byte pool. */
|
||||
if (splits != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*splits = pool_ptr -> tx_byte_pool_performance_split_count;
|
||||
}
|
||||
|
||||
/* Retrieve the number of suspensions on this byte pool. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = pool_ptr -> tx_byte_pool_performance_suspension_count;
|
||||
}
|
||||
|
||||
/* Retrieve the number of timeouts on this byte pool. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = pool_ptr -> tx_byte_pool_performance_timeout_count;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ UINT status;
|
||||
/* Return completion status. */
|
||||
status = TX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
#else
|
||||
@@ -195,55 +195,55 @@ UINT status;
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (pool_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (allocates != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (releases != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (fragments_searched != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (merges != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (splits != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
@@ -109,58 +109,58 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the total number of byte pool allocates. */
|
||||
if (allocates != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*allocates = _tx_byte_pool_performance_allocate_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of byte pool releases. */
|
||||
if (releases != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*releases = _tx_byte_pool_performance_release_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of byte pool fragments searched. */
|
||||
if (fragments_searched != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*fragments_searched = _tx_byte_pool_performance_search_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of byte pool fragments merged. */
|
||||
if (merges != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*merges = _tx_byte_pool_performance_merge_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of byte pool fragment splits. */
|
||||
if (splits != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*splits = _tx_byte_pool_performance_split_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of byte pool suspensions. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = _tx_byte_pool_performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of byte pool timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = _tx_byte_pool_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Return completion status. */
|
||||
return(TX_SUCCESS);
|
||||
|
||||
|
||||
#else
|
||||
|
||||
UINT status;
|
||||
@@ -215,7 +215,7 @@ UINT status;
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
#endif
|
||||
|
||||
@@ -161,19 +161,19 @@ UINT list_changed;
|
||||
/* Disable interrupts again. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Determine if any changes to the list have occurred while
|
||||
/* Determine if any changes to the list have occurred while
|
||||
interrupts were enabled. */
|
||||
|
||||
|
||||
/* Is the list head the same? */
|
||||
if (head_ptr != pool_ptr -> tx_byte_pool_suspension_list)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Is the suspended count the same? */
|
||||
if (suspended_count != pool_ptr -> tx_byte_pool_suspended_count)
|
||||
{
|
||||
@@ -212,12 +212,12 @@ UINT list_changed;
|
||||
/* Release preemption. */
|
||||
_tx_thread_preempt_disable--;
|
||||
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
of the list. */
|
||||
if (priority_thread_ptr != head_ptr)
|
||||
{
|
||||
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
front of the list. */
|
||||
|
||||
/* First, remove the highest priority thread by updating the
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_byte_pool_search PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.7 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -76,9 +76,12 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 06-02-2021 Scott Larson Improve possible free bytes */
|
||||
/* calculation, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UCHAR *_tx_byte_pool_search(TX_BYTE_POOL *pool_ptr, ULONG memory_size)
|
||||
@@ -96,13 +99,16 @@ UINT first_free_block_found = TX_FALSE;
|
||||
TX_THREAD *thread_ptr;
|
||||
ALIGN_TYPE *free_ptr;
|
||||
UCHAR *work_ptr;
|
||||
ULONG total_theoretical_available;
|
||||
|
||||
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* First, determine if there are enough bytes in the pool. */
|
||||
if (memory_size >= pool_ptr -> tx_byte_pool_available)
|
||||
/* Theoretical bytes available = free bytes + ((fragments-2) * overhead of each block) */
|
||||
total_theoretical_available = pool_ptr -> tx_byte_pool_available + ((pool_ptr -> tx_byte_pool_fragments - 2) * ((sizeof(UCHAR *)) + (sizeof(ALIGN_TYPE))));
|
||||
if (memory_size >= total_theoretical_available)
|
||||
{
|
||||
|
||||
/* Restore interrupts. */
|
||||
@@ -146,10 +152,9 @@ UCHAR *work_ptr;
|
||||
/* Determine if this is the first free block. */
|
||||
if (first_free_block_found == TX_FALSE)
|
||||
{
|
||||
|
||||
/* This is the first free block. */
|
||||
pool_ptr->tx_byte_pool_search = current_ptr;
|
||||
|
||||
|
||||
/* Set the flag to indicate we have found the first free
|
||||
block. */
|
||||
first_free_block_found = TX_TRUE;
|
||||
@@ -178,7 +183,7 @@ UCHAR *work_ptr;
|
||||
/* Clear the available bytes variable. */
|
||||
available_bytes = ((ULONG) 0);
|
||||
|
||||
/* Not enough memory, check to see if the neighbor is
|
||||
/* Not enough memory, check to see if the neighbor is
|
||||
free and can be merged. */
|
||||
work_ptr = TX_UCHAR_POINTER_ADD(next_ptr, (sizeof(UCHAR *)));
|
||||
free_ptr = TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(work_ptr);
|
||||
@@ -207,14 +212,12 @@ UCHAR *work_ptr;
|
||||
/* See if the search pointer is affected. */
|
||||
if (pool_ptr -> tx_byte_pool_search == next_ptr)
|
||||
{
|
||||
|
||||
/* Yes, update the search pointer. */
|
||||
pool_ptr -> tx_byte_pool_search = current_ptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Neighbor is not free so we can skip over it! */
|
||||
next_block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(next_ptr);
|
||||
current_ptr = *next_block_link_ptr;
|
||||
@@ -222,7 +225,6 @@ UCHAR *work_ptr;
|
||||
/* Decrement the examined block count to account for this one. */
|
||||
if (examine_blocks != ((UINT) 0))
|
||||
{
|
||||
|
||||
examine_blocks--;
|
||||
|
||||
#ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
|
||||
@@ -297,7 +299,7 @@ UCHAR *work_ptr;
|
||||
|
||||
/* Update the current pointer to point at the newly created block. */
|
||||
*this_block_link_ptr = next_ptr;
|
||||
|
||||
|
||||
/* Set available equal to memory size for subsequent calculation. */
|
||||
available_bytes = memory_size;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ UCHAR **suspend_info_ptr;
|
||||
|
||||
/* Default to successful status. */
|
||||
status = TX_SUCCESS;
|
||||
|
||||
|
||||
/* Set the pool pointer to NULL. */
|
||||
pool_ptr = TX_NULL;
|
||||
|
||||
@@ -109,7 +109,7 @@ UCHAR **suspend_info_ptr;
|
||||
work_ptr = TX_VOID_TO_UCHAR_POINTER_CONVERT(memory_ptr);
|
||||
if (work_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Back off the memory pointer to pickup its header. */
|
||||
work_ptr = TX_UCHAR_POINTER_SUB(work_ptr, ((sizeof(UCHAR *)) + (sizeof(ALIGN_TYPE))));
|
||||
|
||||
@@ -127,7 +127,7 @@ UCHAR **suspend_info_ptr;
|
||||
/* See if we have a valid pool pointer. */
|
||||
if (pool_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Return pointer error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -137,10 +137,10 @@ UCHAR **suspend_info_ptr;
|
||||
/* See if we have a valid pool. */
|
||||
if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Return pointer error. */
|
||||
status = TX_PTR_ERROR;
|
||||
|
||||
|
||||
/* Reset the pool pointer is NULL. */
|
||||
pool_ptr = TX_NULL;
|
||||
}
|
||||
@@ -163,13 +163,13 @@ UCHAR **suspend_info_ptr;
|
||||
/* Determine if the pointer is valid. */
|
||||
if (pool_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* At this point, we know that the pointer is valid. */
|
||||
|
||||
/* Pickup thread pointer. */
|
||||
@@ -201,7 +201,7 @@ UCHAR **suspend_info_ptr;
|
||||
/* Update the number of available bytes in the pool. */
|
||||
block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(work_ptr);
|
||||
next_block_ptr = *block_link_ptr;
|
||||
pool_ptr -> tx_byte_pool_available =
|
||||
pool_ptr -> tx_byte_pool_available =
|
||||
pool_ptr -> tx_byte_pool_available + TX_UCHAR_POINTER_DIF(next_block_ptr, work_ptr);
|
||||
|
||||
/* Determine if the free block is prior to current search pointer. */
|
||||
@@ -215,8 +215,8 @@ UCHAR **suspend_info_ptr;
|
||||
/* Determine if there are threads suspended on this byte pool. */
|
||||
if (pool_ptr -> tx_byte_pool_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
/* Now examine the suspension list to find threads waiting for
|
||||
|
||||
/* Now examine the suspension list to find threads waiting for
|
||||
memory. Maybe it is now available! */
|
||||
while (pool_ptr -> tx_byte_pool_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
@@ -245,7 +245,7 @@ UCHAR **suspend_info_ptr;
|
||||
/* If there is not enough memory, break this loop! */
|
||||
if (work_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Break out of the loop. */
|
||||
break;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ UCHAR **suspend_info_ptr;
|
||||
/* Also, makes sure the memory size is the same. */
|
||||
if (susp_thread_ptr -> tx_thread_suspend_info == memory_size)
|
||||
{
|
||||
|
||||
|
||||
/* Remove the suspended thread from the list. */
|
||||
|
||||
/* Decrement the number of threads suspended. */
|
||||
@@ -302,7 +302,7 @@ UCHAR **suspend_info_ptr;
|
||||
|
||||
/* Clear the memory pointer to indicate that it was given to the suspended thread. */
|
||||
work_ptr = TX_NULL;
|
||||
|
||||
|
||||
/* Put return status into the thread control block. */
|
||||
susp_thread_ptr -> tx_thread_suspend_status = TX_SUCCESS;
|
||||
|
||||
@@ -328,11 +328,11 @@ UCHAR **suspend_info_ptr;
|
||||
TX_DISABLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the memory was given to the suspended thread. */
|
||||
if (work_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* No, it wasn't given to the suspended thread. */
|
||||
|
||||
/* Put the memory back on the available list since this thread is no longer
|
||||
@@ -345,7 +345,7 @@ UCHAR **suspend_info_ptr;
|
||||
/* Update the number of available bytes in the pool. */
|
||||
block_link_ptr = TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(work_ptr);
|
||||
next_block_ptr = *block_link_ptr;
|
||||
pool_ptr -> tx_byte_pool_available =
|
||||
pool_ptr -> tx_byte_pool_available =
|
||||
pool_ptr -> tx_byte_pool_available + TX_UCHAR_POINTER_DIF(next_block_ptr, work_ptr);
|
||||
|
||||
/* Determine if the current pointer is before the search pointer. */
|
||||
@@ -357,7 +357,7 @@ UCHAR **suspend_info_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
@@ -366,7 +366,7 @@ UCHAR **suspend_info_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* No, threads suspended, restore interrupts. */
|
||||
TX_RESTORE
|
||||
}
|
||||
|
||||
@@ -104,11 +104,11 @@ TX_THREAD *previous_thread;
|
||||
|
||||
/* Setup pointer to event flags control block. */
|
||||
group_ptr = TX_VOID_TO_EVENT_FLAGS_POINTER_CONVERT(thread_ptr -> tx_thread_suspend_control_block);
|
||||
|
||||
|
||||
/* Check for a NULL event flags control block pointer. */
|
||||
if (group_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Is the group pointer ID valid? */
|
||||
if (group_ptr -> tx_event_flags_group_id == TX_EVENT_FLAGS_ID)
|
||||
{
|
||||
@@ -133,9 +133,9 @@ TX_THREAD *previous_thread;
|
||||
/* Pickup the suspension head. */
|
||||
suspension_head = group_ptr -> tx_event_flags_group_suspension_list;
|
||||
|
||||
/* Determine if the cleanup is being done while a set operation was interrupted. If the
|
||||
/* Determine if the cleanup is being done while a set operation was interrupted. If the
|
||||
suspended count is non-zero and the suspension head is NULL, the list is being processed
|
||||
and cannot be touched from here. The suspension list removal will instead take place
|
||||
and cannot be touched from here. The suspension list removal will instead take place
|
||||
inside the event flag set code. */
|
||||
if (suspension_head != TX_NULL)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ TX_THREAD *previous_thread;
|
||||
|
||||
/* Decrement the local suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
|
||||
/* Store the updated suspended count. */
|
||||
group_ptr -> tx_event_flags_group_suspended_count = suspended_count;
|
||||
|
||||
@@ -153,7 +153,7 @@ TX_THREAD *previous_thread;
|
||||
{
|
||||
|
||||
/* Yes, the only suspended thread. */
|
||||
|
||||
|
||||
/* Update the head pointer. */
|
||||
group_ptr -> tx_event_flags_group_suspension_list = TX_NULL;
|
||||
}
|
||||
@@ -161,17 +161,17 @@ TX_THREAD *previous_thread;
|
||||
{
|
||||
|
||||
/* At least one more thread is on the same suspension list. */
|
||||
|
||||
|
||||
/* Update the links of the adjacent threads. */
|
||||
next_thread = thread_ptr -> tx_thread_suspended_next;
|
||||
previous_thread = thread_ptr -> tx_thread_suspended_previous;
|
||||
next_thread -> tx_thread_suspended_previous = previous_thread;
|
||||
previous_thread -> tx_thread_suspended_next = next_thread;
|
||||
|
||||
|
||||
/* Determine if we need to update the head pointer. */
|
||||
if (suspension_head == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Update the list head pointer. */
|
||||
group_ptr -> tx_event_flags_group_suspension_list = next_thread;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ TX_THREAD *previous_thread;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* In this case, the search pointer in an interrupted event flag set must be reset. */
|
||||
group_ptr -> tx_event_flags_group_reset_search = TX_TRUE;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ TX_THREAD *previous_thread;
|
||||
if (thread_ptr -> tx_thread_state == TX_EVENT_FLAG)
|
||||
{
|
||||
|
||||
/* Timeout condition and the thread still suspended on the event flags group.
|
||||
/* Timeout condition and the thread still suspended on the event flags group.
|
||||
Setup return error status and resume the thread. */
|
||||
|
||||
#ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
|
||||
@@ -216,8 +216,8 @@ TX_THREAD *previous_thread;
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Resume the thread! Check for preemption even though we are executing
|
||||
from the system timer thread right now which normally executes at the
|
||||
/* Resume the thread! Check for preemption even though we are executing
|
||||
from the system timer thread right now which normally executes at the
|
||||
highest priority. */
|
||||
_tx_thread_system_resume(thread_ptr);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ TX_EVENT_FLAGS_GROUP *previous_group;
|
||||
|
||||
/* Setup the basic event flags group fields. */
|
||||
group_ptr -> tx_event_flags_group_name = name_ptr;
|
||||
|
||||
|
||||
/* Disable interrupts to put the event flags group on the created list. */
|
||||
TX_DISABLE
|
||||
|
||||
@@ -121,7 +121,7 @@ TX_EVENT_FLAGS_GROUP *previous_group;
|
||||
|
||||
/* Increment the number of created event flag groups. */
|
||||
_tx_event_flags_created_count++;
|
||||
|
||||
|
||||
/* Optional event flag group create extended processing. */
|
||||
TX_EVENT_FLAGS_GROUP_CREATE_EXTENSION(group_ptr)
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ TX_EVENT_FLAGS_GROUP *previous_group;
|
||||
|
||||
/* Decrement the number of created event flag groups. */
|
||||
_tx_event_flags_created_count--;
|
||||
|
||||
|
||||
/* See if this group is the only one on the list. */
|
||||
if (_tx_event_flags_created_count == TX_EMPTY)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ TX_EVENT_FLAGS_GROUP *previous_group;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_event_flags_created_ptr == group_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_event_flags_created_ptr = next_group;
|
||||
}
|
||||
@@ -144,18 +144,18 @@ TX_EVENT_FLAGS_GROUP *previous_group;
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Walk through the event flag suspension list to resume any and all threads
|
||||
/* Walk through the event flag suspension list to resume any and all threads
|
||||
suspended on this group. */
|
||||
while (suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the number of suspended threads. */
|
||||
suspended_count--;
|
||||
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_event_flags_get PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.2.0 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -73,9 +73,15 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 04-25-2022 Scott Larson Modified comment(s), */
|
||||
/* handle 0 flags case, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* 10-31-2022 Scott Larson Modified comment(s), always */
|
||||
/* return actual flags, */
|
||||
/* resulting in version 6.2.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags,
|
||||
@@ -122,6 +128,9 @@ UINT interrupted_set_request;
|
||||
/* Pickup current flags. */
|
||||
current_flags = group_ptr -> tx_event_flags_group_current;
|
||||
|
||||
/* Return the actual event flags and apply delayed clearing. */
|
||||
*actual_flags_ptr = current_flags & ~group_ptr -> tx_event_flags_group_delayed_clear;
|
||||
|
||||
/* Apply the event flag option mask. */
|
||||
and_request = (get_option & TX_AND);
|
||||
|
||||
@@ -130,16 +139,16 @@ UINT interrupted_set_request;
|
||||
/* Check for AND condition. All flags must be present to satisfy request. */
|
||||
if (and_request == TX_AND)
|
||||
{
|
||||
|
||||
|
||||
/* AND request is present. */
|
||||
|
||||
|
||||
/* Calculate the flags present. */
|
||||
flags_satisfied = (current_flags & requested_flags);
|
||||
|
||||
|
||||
/* Determine if they satisfy the AND request. */
|
||||
if (flags_satisfied != requested_flags)
|
||||
{
|
||||
|
||||
|
||||
/* No, not all the requested flags are present. Clear the flags present variable. */
|
||||
flags_satisfied = ((ULONG) 0);
|
||||
}
|
||||
@@ -150,21 +159,18 @@ UINT interrupted_set_request;
|
||||
/* OR request is present. Simply or the requested flags and the current flags. */
|
||||
flags_satisfied = (current_flags & requested_flags);
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the request is satisfied. */
|
||||
if (flags_satisfied != ((ULONG) 0))
|
||||
{
|
||||
|
||||
/* Return the actual event flags that satisfied the request. */
|
||||
*actual_flags_ptr = current_flags;
|
||||
|
||||
/* Pickup the clear bit. */
|
||||
clear_request = (get_option & TX_EVENT_FLAGS_CLEAR_MASK);
|
||||
|
||||
/* Determine whether or not clearing needs to take place. */
|
||||
if (clear_request == TX_TRUE)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, clear the flags that satisfied this request. */
|
||||
group_ptr -> tx_event_flags_group_current =
|
||||
group_ptr -> tx_event_flags_group_current & (~requested_flags);
|
||||
@@ -190,16 +196,16 @@ UINT interrupted_set_request;
|
||||
/* Check for AND condition. All flags must be present to satisfy request. */
|
||||
if (and_request == TX_AND)
|
||||
{
|
||||
|
||||
|
||||
/* AND request is present. */
|
||||
|
||||
|
||||
/* Calculate the flags present. */
|
||||
flags_satisfied = (current_flags & requested_flags);
|
||||
|
||||
|
||||
/* Determine if they satisfy the AND request. */
|
||||
if (flags_satisfied != requested_flags)
|
||||
{
|
||||
|
||||
|
||||
/* No, not all the requested flags are present. Clear the flags present variable. */
|
||||
flags_satisfied = ((ULONG) 0);
|
||||
}
|
||||
@@ -211,16 +217,13 @@ UINT interrupted_set_request;
|
||||
to see if any are present. */
|
||||
flags_satisfied = (current_flags & requested_flags);
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the request is satisfied. */
|
||||
if (flags_satisfied != ((ULONG) 0))
|
||||
{
|
||||
|
||||
/* Yes, this request can be handled immediately. */
|
||||
|
||||
/* Return the actual event flags that satisfied the request. */
|
||||
*actual_flags_ptr = current_flags;
|
||||
|
||||
/* Pickup the clear bit. */
|
||||
clear_request = (get_option & TX_EVENT_FLAGS_CLEAR_MASK);
|
||||
|
||||
@@ -235,7 +238,7 @@ UINT interrupted_set_request;
|
||||
set request. */
|
||||
if (group_ptr -> tx_event_flags_group_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
if (group_ptr -> tx_event_flags_group_suspension_list == TX_NULL)
|
||||
{
|
||||
|
||||
@@ -252,7 +255,7 @@ UINT interrupted_set_request;
|
||||
event clearing until the set operation is complete. */
|
||||
|
||||
/* Remember the events to clear. */
|
||||
group_ptr -> tx_event_flags_group_delayed_clear =
|
||||
group_ptr -> tx_event_flags_group_delayed_clear =
|
||||
group_ptr -> tx_event_flags_group_delayed_clear | requested_flags;
|
||||
}
|
||||
else
|
||||
@@ -271,16 +274,17 @@ UINT interrupted_set_request;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
|
||||
/* flags_satisfied is 0. */
|
||||
/* Determine if the request specifies suspension. */
|
||||
if (wait_option != TX_NO_WAIT)
|
||||
{
|
||||
|
||||
/* Determine if the preempt disable flag is non-zero. */
|
||||
if (_tx_thread_preempt_disable != ((UINT) 0))
|
||||
/* Determine if the preempt disable flag is non-zero OR the requested events is 0. */
|
||||
if ((_tx_thread_preempt_disable != ((UINT) 0)) || (requested_flags == (UINT) 0))
|
||||
{
|
||||
|
||||
/* Suspension is not allowed if the preempt disable flag is non-zero at this point, return error completion. */
|
||||
|
||||
/* Suspension is not allowed if the preempt disable flag is non-zero at this point,
|
||||
or if requested_flags is 0, return error completion. */
|
||||
status = TX_NO_EVENTS;
|
||||
}
|
||||
else
|
||||
@@ -296,7 +300,7 @@ UINT interrupted_set_request;
|
||||
/* Increment the number of event flags suspensions on this semaphore. */
|
||||
group_ptr -> tx_event_flags_group___performance_suspension_count++;
|
||||
#endif
|
||||
|
||||
|
||||
/* Pickup thread pointer. */
|
||||
TX_THREAD_GET_CURRENT(thread_ptr)
|
||||
|
||||
@@ -325,7 +329,7 @@ UINT interrupted_set_request;
|
||||
|
||||
/* Pickup the suspended count. */
|
||||
suspended_count = group_ptr -> tx_event_flags_group_suspended_count;
|
||||
|
||||
|
||||
/* Setup suspension list. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
@@ -350,7 +354,7 @@ UINT interrupted_set_request;
|
||||
|
||||
/* Increment the number of threads suspended. */
|
||||
group_ptr -> tx_event_flags_group_suspended_count++;
|
||||
|
||||
|
||||
/* Set the state to suspended. */
|
||||
thread_ptr -> tx_thread_state = TX_EVENT_FLAG;
|
||||
|
||||
@@ -377,10 +381,10 @@ UINT interrupted_set_request;
|
||||
|
||||
/* Call actual thread suspension routine. */
|
||||
_tx_thread_system_suspend(thread_ptr);
|
||||
|
||||
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
|
||||
/* Return the completion status. */
|
||||
status = thread_ptr -> tx_thread_suspend_status;
|
||||
#endif
|
||||
@@ -388,7 +392,7 @@ UINT interrupted_set_request;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Immediate return, return error completion. */
|
||||
status = TX_NO_EVENTS;
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_EVENT_FLAGS_GROUP **next_group)
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the event flag group. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = group_ptr -> tx_event_flags_group_name;
|
||||
}
|
||||
|
||||
@@ -111,31 +111,31 @@ TX_INTERRUPT_SAVE_AREA
|
||||
{
|
||||
|
||||
/* Pickup the current flags and apply delayed clearing. */
|
||||
*current_flags = group_ptr -> tx_event_flags_group_current &
|
||||
*current_flags = group_ptr -> tx_event_flags_group_current &
|
||||
~group_ptr -> tx_event_flags_group_delayed_clear;
|
||||
}
|
||||
|
||||
/* Retrieve the first thread suspended on this event flag group. */
|
||||
if (first_suspended != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*first_suspended = group_ptr -> tx_event_flags_group_suspension_list;
|
||||
}
|
||||
|
||||
/* Retrieve the number of threads suspended on this event flag group. */
|
||||
if (suspended_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspended_count = (ULONG) group_ptr -> tx_event_flags_group_suspended_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the pointer to the next event flag group created. */
|
||||
if (next_group != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_group = group_ptr -> tx_event_flags_group_created_next;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
@@ -94,15 +94,15 @@ UINT status;
|
||||
/* Determine if this is a legal request. */
|
||||
if (group_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Event flags group pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the event group ID is invalid. */
|
||||
else if (group_ptr -> tx_event_flags_group_id != TX_EVENT_FLAGS_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Event flags group pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -124,34 +124,34 @@ UINT status;
|
||||
/* Retrieve the number of set operations on this event flag group. */
|
||||
if (sets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*sets = group_ptr -> tx_event_flags_group_performance_set_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of get operations on this event flag group. */
|
||||
if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*gets = group_ptr -> tx_event_flags_group__performance_get_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of thread suspensions on this event flag group. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = group_ptr -> tx_event_flags_group___performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of thread timeouts on this event flag group. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = group_ptr -> tx_event_flags_group____performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Return successful completion. */
|
||||
status = TX_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -101,37 +101,37 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the total number of event flag set operations. */
|
||||
if (sets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*sets = _tx_event_flags_performance_set_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of event flag get operations. */
|
||||
if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*gets = _tx_event_flags_performance_get_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of event flag thread suspensions. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = _tx_event_flags_performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of event flag thread timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = _tx_event_flags_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Return completion status. */
|
||||
return(TX_SUCCESS);
|
||||
|
||||
|
||||
#else
|
||||
|
||||
UINT status;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_event_flags_set PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.11 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -72,9 +72,13 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 04-25-2022 William E. Lamie Modified comment(s), and */
|
||||
/* added corrected preemption */
|
||||
/* check logic, resulting in */
|
||||
/* version 6.1.11 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, UINT set_option)
|
||||
@@ -137,7 +141,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
set request. */
|
||||
if (group_ptr -> tx_event_flags_group_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
if (group_ptr -> tx_event_flags_group_suspension_list == TX_NULL)
|
||||
{
|
||||
|
||||
@@ -154,15 +158,15 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
event clearing until the set operation is complete. */
|
||||
|
||||
/* Remember the events to clear. */
|
||||
group_ptr -> tx_event_flags_group_delayed_clear =
|
||||
group_ptr -> tx_event_flags_group_delayed_clear =
|
||||
group_ptr -> tx_event_flags_group_delayed_clear | ~flags_to_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Previous set operation was not interrupted, simply clear the
|
||||
specified flags by "ANDing" the flags into the current events
|
||||
/* Previous set operation was not interrupted, simply clear the
|
||||
specified flags by "ANDing" the flags into the current events
|
||||
of the group. */
|
||||
group_ptr -> tx_event_flags_group_current =
|
||||
group_ptr -> tx_event_flags_group_current & flags_to_set;
|
||||
@@ -195,7 +199,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
{
|
||||
|
||||
/* Yes, we need to neutralize the delayed clearing as well. */
|
||||
group_ptr -> tx_event_flags_group_delayed_clear =
|
||||
group_ptr -> tx_event_flags_group_delayed_clear =
|
||||
group_ptr -> tx_event_flags_group_delayed_clear & ~flags_to_set;
|
||||
}
|
||||
#endif
|
||||
@@ -210,7 +214,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
if (group_ptr -> tx_event_flags_group_suspension_list != TX_NULL)
|
||||
{
|
||||
|
||||
/* Determine if there is just a single thread waiting on the event
|
||||
/* Determine if there is just a single thread waiting on the event
|
||||
flag group. */
|
||||
if (suspended_count == ((UINT) 1))
|
||||
{
|
||||
@@ -223,7 +227,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
|
||||
/* Pickup the current event flags. */
|
||||
current_event_flags = group_ptr -> tx_event_flags_group_current;
|
||||
|
||||
|
||||
/* Pickup the suspend information. */
|
||||
requested_flags = thread_ptr -> tx_thread_suspend_info;
|
||||
|
||||
@@ -236,16 +240,16 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Check for AND condition. All flags must be present to satisfy request. */
|
||||
if (and_request == TX_AND)
|
||||
{
|
||||
|
||||
|
||||
/* AND request is present. */
|
||||
|
||||
|
||||
/* Calculate the flags present. */
|
||||
flags_satisfied = (current_event_flags & requested_flags);
|
||||
|
||||
|
||||
/* Determine if they satisfy the AND request. */
|
||||
if (flags_satisfied != requested_flags)
|
||||
{
|
||||
|
||||
|
||||
/* No, not all the requested flags are present. Clear the flags present variable. */
|
||||
flags_satisfied = ((ULONG) 0);
|
||||
}
|
||||
@@ -256,7 +260,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* OR request is present. Simply or the requested flags and the current flags. */
|
||||
flags_satisfied = (current_event_flags & requested_flags);
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the request is satisfied. */
|
||||
if (flags_satisfied != ((ULONG) 0))
|
||||
{
|
||||
@@ -264,9 +268,6 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Yes, resume the thread and apply any event flag
|
||||
clearing. */
|
||||
|
||||
/* Set the preempt check flag. */
|
||||
preempt_check = TX_TRUE;
|
||||
|
||||
/* Return the actual event flags that satisfied the request. */
|
||||
suspend_info_ptr = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info);
|
||||
*suspend_info_ptr = current_event_flags;
|
||||
@@ -315,7 +316,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
else
|
||||
{
|
||||
|
||||
/* Otherwise, the event flag requests of multiple threads must be
|
||||
/* Otherwise, the event flag requests of multiple threads must be
|
||||
examined. */
|
||||
|
||||
/* Setup thread pointer, keep a local copy of the head pointer. */
|
||||
@@ -325,7 +326,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Clear the suspended list head pointer to thwart manipulation of
|
||||
the list in ISR's while we are processing here. */
|
||||
group_ptr -> tx_event_flags_group_suspension_list = TX_NULL;
|
||||
|
||||
|
||||
/* Setup the satisfied thread pointers. */
|
||||
satisfied_list = TX_NULL;
|
||||
last_satisfied = TX_NULL;
|
||||
@@ -336,6 +337,11 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Disable preemption while we process the suspended list. */
|
||||
_tx_thread_preempt_disable++;
|
||||
|
||||
/* Since we have temporarily disabled preemption globally, set the preempt
|
||||
check flag to check for any preemption condition - including from
|
||||
unrelated ISR processing. */
|
||||
preempt_check = TX_TRUE;
|
||||
|
||||
/* Loop to examine all of the suspended threads. */
|
||||
do
|
||||
{
|
||||
@@ -382,16 +388,16 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Check for AND condition. All flags must be present to satisfy request. */
|
||||
if (and_request == TX_AND)
|
||||
{
|
||||
|
||||
|
||||
/* AND request is present. */
|
||||
|
||||
|
||||
/* Calculate the flags present. */
|
||||
flags_satisfied = (current_event_flags & requested_flags);
|
||||
|
||||
|
||||
/* Determine if they satisfy the AND request. */
|
||||
if (flags_satisfied != requested_flags)
|
||||
{
|
||||
|
||||
|
||||
/* No, not all the requested flags are present. Clear the flags present variable. */
|
||||
flags_satisfied = ((ULONG) 0);
|
||||
}
|
||||
@@ -402,13 +408,13 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* OR request is present. Simply or the requested flags and the current flags. */
|
||||
flags_satisfied = (current_event_flags & requested_flags);
|
||||
}
|
||||
|
||||
/* Check to see if the thread had a timeout or wait abort during the event search processing.
|
||||
If so, just set the flags satisfied to ensure the processing here removes the thread from
|
||||
|
||||
/* Check to see if the thread had a timeout or wait abort during the event search processing.
|
||||
If so, just set the flags satisfied to ensure the processing here removes the thread from
|
||||
the suspension list. */
|
||||
if (thread_ptr -> tx_thread_state != TX_EVENT_FLAG)
|
||||
{
|
||||
|
||||
|
||||
/* Simply set the satisfied flags to 1 in order to remove the thread from the suspension list. */
|
||||
flags_satisfied = ((ULONG) 1);
|
||||
}
|
||||
@@ -419,9 +425,6 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
|
||||
/* Yes, this request can be handled now. */
|
||||
|
||||
/* Set the preempt check flag. */
|
||||
preempt_check = TX_TRUE;
|
||||
|
||||
/* Determine if the thread is still suspended on the event flag group. If not, a wait
|
||||
abort must have been done from an ISR. */
|
||||
if (thread_ptr -> tx_thread_state == TX_EVENT_FLAG)
|
||||
@@ -437,11 +440,11 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Determine whether or not clearing needs to take place. */
|
||||
if (clear_request == TX_TRUE)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, clear the flags that satisfied this request. */
|
||||
group_ptr -> tx_event_flags_group_current = group_ptr -> tx_event_flags_group_current & ~requested_flags;
|
||||
}
|
||||
|
||||
|
||||
/* Prepare for resumption of the first thread. */
|
||||
|
||||
/* Clear cleanup routine to avoid timeout. */
|
||||
@@ -478,7 +481,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
list. */
|
||||
if (suspended_list == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, head pointer needs to be updated. */
|
||||
suspended_list = thread_ptr -> tx_thread_suspended_next;
|
||||
}
|
||||
@@ -494,7 +497,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* First thread on the satisfied list. */
|
||||
satisfied_list = thread_ptr;
|
||||
last_satisfied = thread_ptr;
|
||||
|
||||
|
||||
/* Setup initial next pointer. */
|
||||
thread_ptr -> tx_thread_suspended_next = TX_NULL;
|
||||
}
|
||||
@@ -502,7 +505,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
{
|
||||
|
||||
/* Not the first thread on the satisfied list. */
|
||||
|
||||
|
||||
/* Link it up at the end. */
|
||||
last_satisfied -> tx_thread_suspended_next = thread_ptr;
|
||||
thread_ptr -> tx_thread_suspended_next = TX_NULL;
|
||||
@@ -515,7 +518,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
|
||||
} while (suspended_count != TX_NO_SUSPENSIONS);
|
||||
|
||||
/* Setup the group's suspension list head again. */
|
||||
@@ -543,7 +546,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
thread_ptr = satisfied_list;
|
||||
while(thread_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Get next pointer first. */
|
||||
next_thread_ptr = thread_ptr -> tx_thread_suspended_next;
|
||||
|
||||
@@ -586,7 +589,7 @@ VOID (*events_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *notify_
|
||||
/* Determine if we need to set the reset search field. */
|
||||
if (group_ptr -> tx_event_flags_group_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* We interrupted a search of an event flag group suspension
|
||||
list. Make sure we reset the search. */
|
||||
group_ptr -> tx_event_flags_group_reset_search = TX_TRUE;
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
#include "tx_byte_pool.h"
|
||||
|
||||
|
||||
/* Define the unused memory pointer. The value of the first available
|
||||
/* Define the unused memory pointer. The value of the first available
|
||||
memory address is placed in this variable in the low-level
|
||||
initialization function. The content of this variable is passed
|
||||
initialization function. The content of this variable is passed
|
||||
to the application's system definition function. */
|
||||
|
||||
VOID *_tx_initialize_unused_memory;
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
#include "tx_thread.h"
|
||||
#include "tx_timer.h"
|
||||
|
||||
#if defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)
|
||||
extern VOID _tx_execution_initialize(VOID);
|
||||
#endif
|
||||
|
||||
/* Define any port-specific scheduling data structures. */
|
||||
|
||||
@@ -46,7 +49,7 @@ TX_SAFETY_CRITICAL_EXCEPTION_HANDLER
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_kernel_enter PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.3.0 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -84,9 +87,16 @@ TX_SAFETY_CRITICAL_EXCEPTION_HANDLER
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
||||
/* resulting in version 6.1 */
|
||||
/* 04-25-2022 Scott Larson Modified comment(s), */
|
||||
/* added EPK initialization, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
|
||||
/* added random generator */
|
||||
/* initialization, */
|
||||
/* resulting in version 6.3.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _tx_initialize_kernel_enter(VOID)
|
||||
@@ -98,8 +108,8 @@ VOID _tx_initialize_kernel_enter(VOID)
|
||||
|
||||
/* No, the initialization still needs to take place. */
|
||||
|
||||
/* Ensure that the system state variable is set to indicate
|
||||
initialization is in progress. Note that this variable is
|
||||
/* Ensure that the system state variable is set to indicate
|
||||
initialization is in progress. Note that this variable is
|
||||
later used to represent interrupt nesting. */
|
||||
_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;
|
||||
|
||||
@@ -109,9 +119,9 @@ VOID _tx_initialize_kernel_enter(VOID)
|
||||
/* Invoke the low-level initialization to handle all processor specific
|
||||
initialization issues. */
|
||||
_tx_initialize_low_level();
|
||||
|
||||
/* Invoke the high-level initialization to exercise all of the
|
||||
ThreadX components and the application's initialization
|
||||
|
||||
/* Invoke the high-level initialization to exercise all of the
|
||||
ThreadX components and the application's initialization
|
||||
function. */
|
||||
_tx_initialize_high_level();
|
||||
|
||||
@@ -122,22 +132,30 @@ VOID _tx_initialize_kernel_enter(VOID)
|
||||
/* Optional processing extension. */
|
||||
TX_INITIALIZE_KERNEL_ENTER_EXTENSION
|
||||
|
||||
/* Ensure that the system state variable is set to indicate
|
||||
initialization is in progress. Note that this variable is
|
||||
/* Ensure that the system state variable is set to indicate
|
||||
initialization is in progress. Note that this variable is
|
||||
later used to represent interrupt nesting. */
|
||||
_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;
|
||||
|
||||
/* Optional random number generator initialization. */
|
||||
TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION
|
||||
|
||||
/* Call the application provided initialization function. Pass the
|
||||
first available memory address to it. */
|
||||
tx_application_define(_tx_initialize_unused_memory);
|
||||
|
||||
/* Set the system state in preparation for entering the thread
|
||||
/* Set the system state in preparation for entering the thread
|
||||
scheduler. */
|
||||
_tx_thread_system_state = TX_INITIALIZE_IS_FINISHED;
|
||||
|
||||
/* Call any port specific pre-scheduler processing. */
|
||||
TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION
|
||||
|
||||
#if defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE)
|
||||
/* Initialize Execution Profile Kit. */
|
||||
_tx_execution_initialize();
|
||||
#endif
|
||||
|
||||
/* Enter the scheduling loop to start executing threads! */
|
||||
_tx_thread_schedule();
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
VOID _tx_initialize_kernel_setup(VOID)
|
||||
{
|
||||
|
||||
/* Ensure that the system state variable is set to indicate
|
||||
initialization is in progress. Note that this variable is
|
||||
/* Ensure that the system state variable is set to indicate
|
||||
initialization is in progress. Note that this variable is
|
||||
later used to represent interrupt nesting. */
|
||||
_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;
|
||||
|
||||
@@ -87,9 +87,9 @@ VOID _tx_initialize_kernel_setup(VOID)
|
||||
/* Invoke the low-level initialization to handle all processor specific
|
||||
initialization issues. */
|
||||
_tx_initialize_low_level();
|
||||
|
||||
/* Invoke the high-level initialization to exercise all of the
|
||||
ThreadX components and the application's initialization
|
||||
|
||||
/* Invoke the high-level initialization to exercise all of the
|
||||
ThreadX components and the application's initialization
|
||||
function. */
|
||||
_tx_initialize_high_level();
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2)
|
||||
{
|
||||
|
||||
ULONG value;
|
||||
|
||||
|
||||
value = (ULONG)(ptr1 - ptr2);
|
||||
return(value);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ ULONG *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount)
|
||||
ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2)
|
||||
{
|
||||
ULONG value;
|
||||
|
||||
|
||||
value = (ULONG)(ptr1 - ptr2);
|
||||
return(value);
|
||||
}
|
||||
@@ -362,7 +362,7 @@ TX_THREAD *trace_thread_ptr;
|
||||
#endif
|
||||
trace_event_ptr++;
|
||||
if (trace_event_ptr >= _tx_trace_buffer_end_ptr)
|
||||
{
|
||||
{
|
||||
trace_event_ptr = _tx_trace_buffer_start_ptr;
|
||||
_tx_trace_buffer_current_ptr = trace_event_ptr;
|
||||
_tx_trace_header_ptr -> tx_trace_header_buffer_current_pointer = (ULONG) trace_event_ptr;
|
||||
@@ -813,7 +813,7 @@ UCHAR *_tx_misra_entry_to_uchar_pointer_convert(TX_TRACE_BUFFER_ENTRY *pointer)
|
||||
/* Return a UCHAR pointer. */
|
||||
return((UCHAR *) ((VOID *) pointer));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -100,14 +100,14 @@ TX_THREAD *previous_thread;
|
||||
/* Check for valid suspension sequence. */
|
||||
if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence)
|
||||
{
|
||||
|
||||
|
||||
/* Setup pointer to mutex control block. */
|
||||
mutex_ptr = TX_VOID_TO_MUTEX_POINTER_CONVERT(thread_ptr -> tx_thread_suspend_control_block);
|
||||
|
||||
|
||||
/* Check for NULL mutex pointer. */
|
||||
if (mutex_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Determine if the mutex ID is valid. */
|
||||
if (mutex_ptr -> tx_mutex_id == TX_MUTEX_ID)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ TX_THREAD *previous_thread;
|
||||
suspended_count = mutex_ptr -> tx_mutex_suspended_count;
|
||||
|
||||
/* Remove the suspended thread from the list. */
|
||||
|
||||
|
||||
/* See if this is the only suspended thread on the list. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ TX_THREAD *previous_thread;
|
||||
{
|
||||
|
||||
/* At least one more thread is on the same suspension list. */
|
||||
|
||||
|
||||
/* Update the links of the adjacent threads. */
|
||||
next_thread = thread_ptr -> tx_thread_suspended_next;
|
||||
previous_thread = thread_ptr -> tx_thread_suspended_previous;
|
||||
@@ -157,18 +157,18 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if we need to update the head pointer. */
|
||||
if (mutex_ptr -> tx_mutex_suspension_list == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Update the list head pointer. */
|
||||
mutex_ptr -> tx_mutex_suspension_list = next_thread;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Now we need to determine if this cleanup is from a terminate, timeout,
|
||||
or from a wait abort. */
|
||||
if (thread_ptr -> tx_thread_state == TX_MUTEX_SUSP)
|
||||
{
|
||||
|
||||
/* Timeout condition and the thread still suspended on the mutex.
|
||||
/* Timeout condition and the thread still suspended on the mutex.
|
||||
Setup return error status and resume the thread. */
|
||||
|
||||
#ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
|
||||
@@ -194,7 +194,7 @@ TX_THREAD *previous_thread;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Resume the thread! */
|
||||
_tx_thread_system_resume(thread_ptr);
|
||||
|
||||
@@ -208,7 +208,7 @@ TX_THREAD *previous_thread;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
#endif
|
||||
@@ -269,21 +269,21 @@ UINT status;
|
||||
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
|
||||
/* Temporarily disable preemption. */
|
||||
_tx_thread_preempt_disable++;
|
||||
|
||||
/* Loop to look at all the mutexes. */
|
||||
do
|
||||
{
|
||||
|
||||
|
||||
/* Pickup the mutex head pointer. */
|
||||
mutex_ptr = thread_ptr -> tx_thread_owned_mutex_list;
|
||||
|
||||
/* Determine if there is a mutex. */
|
||||
if (mutex_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, set the ownership count to 1. */
|
||||
mutex_ptr -> tx_mutex_ownership_count = ((UINT) 1);
|
||||
|
||||
@@ -307,10 +307,10 @@ UINT status;
|
||||
mutex_ptr = thread_ptr -> tx_thread_owned_mutex_list;
|
||||
}
|
||||
} while (mutex_ptr != TX_NULL);
|
||||
|
||||
|
||||
/* Restore preemption. */
|
||||
_tx_thread_preempt_disable--;
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ TX_MUTEX *previous_mutex;
|
||||
/* Setup the basic mutex fields. */
|
||||
mutex_ptr -> tx_mutex_name = name_ptr;
|
||||
mutex_ptr -> tx_mutex_inherit = inherit;
|
||||
|
||||
|
||||
/* Disable interrupts to place the mutex on the created list. */
|
||||
TX_DISABLE
|
||||
|
||||
@@ -126,7 +126,7 @@ TX_MUTEX *previous_mutex;
|
||||
|
||||
/* Increment the ownership count. */
|
||||
_tx_mutex_created_count++;
|
||||
|
||||
|
||||
/* Optional mutex create extended processing. */
|
||||
TX_MUTEX_CREATE_EXTENSION(mutex_ptr)
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ UINT status;
|
||||
|
||||
/* Decrement the created count. */
|
||||
_tx_mutex_created_count--;
|
||||
|
||||
|
||||
/* See if the mutex is the only one on the list. */
|
||||
if (_tx_mutex_created_count == TX_EMPTY)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ UINT status;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_mutex_created_ptr == mutex_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_mutex_created_ptr = next_mutex;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ UINT status;
|
||||
{
|
||||
|
||||
/* Yes, remove this mutex from the owned list. */
|
||||
|
||||
|
||||
/* Set the ownership count to 1. */
|
||||
mutex_ptr -> tx_mutex_ownership_count = ((UINT) 1);
|
||||
|
||||
@@ -184,14 +184,14 @@ UINT status;
|
||||
on this mutex. */
|
||||
while (suspended_count != ((ULONG) 0))
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
@@ -215,7 +215,7 @@ UINT status;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Resume the thread. */
|
||||
_tx_thread_system_resume(thread_ptr);
|
||||
#endif
|
||||
|
||||
@@ -126,7 +126,7 @@ UINT status;
|
||||
/* Determine if priority inheritance is required. */
|
||||
if (mutex_ptr -> tx_mutex_inherit == TX_TRUE)
|
||||
{
|
||||
|
||||
|
||||
/* Remember the current priority of thread. */
|
||||
mutex_ptr -> tx_mutex_original_priority = thread_ptr -> tx_thread_priority;
|
||||
|
||||
@@ -178,7 +178,7 @@ UINT status;
|
||||
else if (mutex_ptr -> tx_mutex_owner == thread_ptr)
|
||||
{
|
||||
|
||||
/* The owning thread is requesting the mutex again, just
|
||||
/* The owning thread is requesting the mutex again, just
|
||||
increment the ownership count. */
|
||||
mutex_ptr -> tx_mutex_ownership_count++;
|
||||
|
||||
@@ -279,7 +279,7 @@ UINT status;
|
||||
previous_thread -> tx_thread_suspended_next = thread_ptr;
|
||||
next_thread -> tx_thread_suspended_previous = thread_ptr;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the suspension count. */
|
||||
mutex_ptr -> tx_mutex_suspended_count++;
|
||||
|
||||
@@ -288,7 +288,7 @@ UINT status;
|
||||
|
||||
#ifdef TX_NOT_INTERRUPTABLE
|
||||
|
||||
/* Determine if we need to raise the priority of the thread
|
||||
/* Determine if we need to raise the priority of the thread
|
||||
owning the mutex. */
|
||||
if (mutex_ptr -> tx_mutex_inherit == TX_TRUE)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ UINT status;
|
||||
/* Determine if we have to update inherit priority level of the mutex owner. */
|
||||
if (thread_ptr -> tx_thread_priority < mutex_owner -> tx_thread_inherit_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Remember the new priority inheritance priority. */
|
||||
mutex_owner -> tx_thread_inherit_priority = thread_ptr -> tx_thread_priority;
|
||||
}
|
||||
@@ -347,7 +347,7 @@ UINT status;
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Determine if we need to raise the priority of the thread
|
||||
/* Determine if we need to raise the priority of the thread
|
||||
owning the mutex. */
|
||||
if (mutex_ptr -> tx_mutex_inherit == TX_TRUE)
|
||||
{
|
||||
@@ -363,7 +363,7 @@ UINT status;
|
||||
/* Determine if we have to update inherit priority level of the mutex owner. */
|
||||
if (thread_ptr -> tx_thread_priority < mutex_owner -> tx_thread_inherit_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Remember the new priority inheritance priority. */
|
||||
mutex_owner -> tx_thread_inherit_priority = thread_ptr -> tx_thread_priority;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_MUTEX **next_mutex)
|
||||
{
|
||||
|
||||
@@ -101,45 +101,45 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the mutex. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = mutex_ptr -> tx_mutex_name;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the current ownership count of the mutex. */
|
||||
if (count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*count = ((ULONG) mutex_ptr -> tx_mutex_ownership_count);
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the current owner of the mutex. */
|
||||
if (owner != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*owner = mutex_ptr -> tx_mutex_owner;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the first thread suspended on this mutex. */
|
||||
if (first_suspended != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*first_suspended = mutex_ptr -> tx_mutex_suspension_list;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of threads suspended on this mutex. */
|
||||
if (suspended_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspended_count = (ULONG) mutex_ptr -> tx_mutex_suspended_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the pointer to the next mutex created. */
|
||||
if (next_mutex != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_mutex = mutex_ptr -> tx_mutex_created_next;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
@@ -99,15 +99,15 @@ UINT status;
|
||||
/* Determine if this is a legal request. */
|
||||
if (mutex_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Mutex pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the mutex ID is invalid. */
|
||||
else if (mutex_ptr -> tx_mutex_id != TX_MUTEX_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Mutex pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -129,45 +129,45 @@ UINT status;
|
||||
/* Retrieve the number of puts on this mutex. */
|
||||
if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*puts = mutex_ptr -> tx_mutex_performance_put_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of gets on this mutex. */
|
||||
if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*gets = mutex_ptr -> tx_mutex_performance_get_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of suspensions on this mutex. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = mutex_ptr -> tx_mutex_performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of timeouts on this mutex. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = mutex_ptr -> tx_mutex_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of priority inversions on this mutex. */
|
||||
if (inversions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*inversions = mutex_ptr -> tx_mutex_performance_priority_inversion_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of priority inheritances on this mutex. */
|
||||
if (inheritances != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*inheritances = mutex_ptr -> tx_mutex_performance__priority_inheritance_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
}
|
||||
@@ -225,7 +225,7 @@ UINT status;
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions,
|
||||
UINT _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions,
|
||||
ULONG *timeouts, ULONG *inversions, ULONG *inheritances)
|
||||
{
|
||||
|
||||
@@ -106,51 +106,51 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the total number of mutex puts. */
|
||||
if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*puts = _tx_mutex_performance_put_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of mutex gets. */
|
||||
if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*gets = _tx_mutex_performance_get_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of mutex suspensions. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = _tx_mutex_performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of mutex timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = _tx_mutex_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of mutex priority inversions. */
|
||||
if (inversions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*inversions = _tx_mutex_performance_priority_inversion_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of mutex priority inheritances. */
|
||||
if (inheritances != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*inheritances = _tx_mutex_performance__priority_inheritance_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Return completion status. */
|
||||
return(TX_SUCCESS);
|
||||
|
||||
|
||||
#else
|
||||
|
||||
UINT status;
|
||||
@@ -159,43 +159,43 @@ UINT status;
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (inversions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (inheritances != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
@@ -164,28 +164,28 @@ UINT status;
|
||||
/* Disable interrupts again. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Determine if any changes to the list have occurred while
|
||||
/* Determine if any changes to the list have occurred while
|
||||
interrupts were enabled. */
|
||||
|
||||
|
||||
/* Is the list head the same? */
|
||||
if (head_ptr != mutex_ptr -> tx_mutex_suspension_list)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Is the suspended count the same? */
|
||||
if (suspended_count != mutex_ptr -> tx_mutex_suspended_count)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the list has changed. */
|
||||
if (list_changed == TX_FALSE)
|
||||
{
|
||||
@@ -215,12 +215,12 @@ UINT status;
|
||||
/* Release preemption. */
|
||||
_tx_thread_preempt_disable--;
|
||||
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
of the list. */
|
||||
if (priority_thread_ptr != head_ptr)
|
||||
{
|
||||
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
front of the list. */
|
||||
|
||||
/* First, remove the highest priority thread by updating the
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_mutex_priority_change PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.1.6 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -70,14 +70,18 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* change thread state from */
|
||||
/* TX_SUSPENDED to */
|
||||
/* TX_PRIORITY_CHANGE before */
|
||||
/* calling */
|
||||
/* _tx_thread_system_suspend, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 04-02-2021 Scott Larson Modified comments, fixed */
|
||||
/* mapping current thread's */
|
||||
/* priority rather than next, */
|
||||
/* resulting in version 6.1.6 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
VOID _tx_mutex_priority_change(TX_THREAD *thread_ptr, UINT new_priority)
|
||||
@@ -112,17 +116,17 @@ UINT map_index;
|
||||
|
||||
/* Change thread priority to the new mutex priority-inheritance priority. */
|
||||
thread_ptr -> tx_thread_priority = new_priority;
|
||||
|
||||
|
||||
/* Determine how to setup the thread's preemption-threshold. */
|
||||
if (thread_ptr -> tx_thread_user_preempt_threshold < new_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Change thread preemption-threshold to the user's preemption-threshold. */
|
||||
thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_user_preempt_threshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Change the thread preemption-threshold to the new threshold. */
|
||||
thread_ptr -> tx_thread_preempt_threshold = new_priority;
|
||||
}
|
||||
@@ -152,22 +156,22 @@ UINT map_index;
|
||||
/* Call actual non-interruptable thread suspension routine. */
|
||||
_tx_thread_system_ni_suspend(thread_ptr, ((ULONG) 0));
|
||||
|
||||
/* At this point, the preempt disable flag is still set, so we still have
|
||||
/* At this point, the preempt disable flag is still set, so we still have
|
||||
protection against all preemption. */
|
||||
|
||||
/* Change thread priority to the new mutex priority-inheritance priority. */
|
||||
thread_ptr -> tx_thread_priority = new_priority;
|
||||
|
||||
|
||||
/* Determine how to setup the thread's preemption-threshold. */
|
||||
if (thread_ptr -> tx_thread_user_preempt_threshold < new_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Change thread preemption-threshold to the user's preemption-threshold. */
|
||||
thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_user_preempt_threshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Change the thread preemption-threshold to the new threshold. */
|
||||
thread_ptr -> tx_thread_preempt_threshold = new_priority;
|
||||
}
|
||||
@@ -194,29 +198,29 @@ UINT map_index;
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* The thread is ready and must first be removed from the list. Call the
|
||||
/* The thread is ready and must first be removed from the list. Call the
|
||||
system suspend function to accomplish this. */
|
||||
_tx_thread_system_suspend(thread_ptr);
|
||||
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* At this point, the preempt disable flag is still set, so we still have
|
||||
/* At this point, the preempt disable flag is still set, so we still have
|
||||
protection against all preemption. */
|
||||
|
||||
/* Change thread priority to the new mutex priority-inheritance priority. */
|
||||
thread_ptr -> tx_thread_priority = new_priority;
|
||||
|
||||
|
||||
/* Determine how to setup the thread's preemption-threshold. */
|
||||
if (thread_ptr -> tx_thread_user_preempt_threshold < new_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Change thread preemption-threshold to the user's preemption-threshold. */
|
||||
thread_ptr -> tx_thread_preempt_threshold = thread_ptr -> tx_thread_user_preempt_threshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Change the thread preemption-threshold to the new threshold. */
|
||||
thread_ptr -> tx_thread_preempt_threshold = new_priority;
|
||||
}
|
||||
@@ -236,14 +240,14 @@ UINT map_index;
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
#endif
|
||||
|
||||
|
||||
/* Pickup the next thread to execute. */
|
||||
next_execute_ptr = _tx_thread_execute_ptr;
|
||||
|
||||
/* Determine if this thread is not the next thread to execute. */
|
||||
if (thread_ptr != next_execute_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Make sure the thread is still ready. */
|
||||
if (thread_ptr -> tx_thread_state == TX_READY)
|
||||
{
|
||||
@@ -265,7 +269,7 @@ UINT map_index;
|
||||
/* Determine if we moved to a lower priority. If so, move the thread to the front of its priority list. */
|
||||
if (original_priority < new_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Ensure that this thread is placed at the front of the priority list. */
|
||||
_tx_thread_priority_list[thread_ptr -> tx_thread_priority] = thread_ptr;
|
||||
}
|
||||
@@ -283,7 +287,7 @@ UINT map_index;
|
||||
/* Compare the next thread to execute thread's priority against the thread's preemption-threshold. */
|
||||
if (thread_ptr -> tx_thread_preempt_threshold <= next_execute_ptr -> tx_thread_priority)
|
||||
{
|
||||
|
||||
|
||||
/* We must swap execute pointers to enforce the preemption-threshold of a thread coming out of
|
||||
priority inheritance. */
|
||||
_tx_thread_execute_ptr = thread_ptr;
|
||||
@@ -291,7 +295,7 @@ UINT map_index;
|
||||
/* Determine if we moved to a lower priority. If so, move the thread to the front of its priority list. */
|
||||
if (original_priority < new_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Ensure that this thread is placed at the front of the priority list. */
|
||||
_tx_thread_priority_list[thread_ptr -> tx_thread_priority] = thread_ptr;
|
||||
}
|
||||
@@ -308,15 +312,15 @@ UINT map_index;
|
||||
#if TX_MAX_PRIORITIES > 32
|
||||
|
||||
/* Calculate the index into the bit map array. */
|
||||
map_index = (next_execute_ptr -> tx_thread_priority)/ ((UINT) 32);
|
||||
map_index = (thread_ptr -> tx_thread_priority)/ ((UINT) 32);
|
||||
|
||||
/* Set the active bit to remember that the preempt map has something set. */
|
||||
TX_DIV32_BIT_SET(next_execute_ptr -> tx_thread_priority, priority_bit)
|
||||
TX_DIV32_BIT_SET(thread_ptr -> tx_thread_priority, priority_bit)
|
||||
_tx_thread_preempted_map_active = _tx_thread_preempted_map_active | priority_bit;
|
||||
#endif
|
||||
|
||||
/* Remember that this thread was preempted by a thread above the thread's threshold. */
|
||||
TX_MOD32_BIT_SET(next_execute_ptr -> tx_thread_priority, priority_bit)
|
||||
TX_MOD32_BIT_SET(thread_ptr -> tx_thread_priority, priority_bit)
|
||||
_tx_thread_preempted_maps[MAP_INDEX] = _tx_thread_preempted_maps[MAP_INDEX] | priority_bit;
|
||||
}
|
||||
#endif
|
||||
@@ -326,7 +330,7 @@ UINT map_index;
|
||||
}
|
||||
|
||||
#ifndef TX_NOT_INTERRUPTABLE
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
#endif
|
||||
|
||||
@@ -131,8 +131,8 @@ UINT inheritance_priority;
|
||||
/* Check to see if the mutex is owned by the calling thread. */
|
||||
if (mutex_ptr -> tx_mutex_owner != current_thread)
|
||||
{
|
||||
|
||||
/* Determine if the preempt disable flag is set, indicating that
|
||||
|
||||
/* Determine if the preempt disable flag is set, indicating that
|
||||
the caller is not the application but from ThreadX. In such
|
||||
cases, the thread mutex owner does not need to match. */
|
||||
if (_tx_thread_preempt_disable == ((UINT) 0))
|
||||
@@ -147,11 +147,11 @@ UINT inheritance_priority;
|
||||
status = TX_NOT_OWNED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if we should continue. */
|
||||
if (status == TX_NOT_DONE)
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the mutex ownership count. */
|
||||
mutex_ptr -> tx_mutex_ownership_count--;
|
||||
|
||||
@@ -182,9 +182,9 @@ UINT inheritance_priority;
|
||||
{
|
||||
|
||||
/* The mutex is now available. */
|
||||
|
||||
|
||||
/* Remove this mutex from the owned mutex list. */
|
||||
|
||||
|
||||
/* Decrement the ownership count. */
|
||||
thread_ptr -> tx_thread_owned_mutex_count--;
|
||||
|
||||
@@ -218,14 +218,14 @@ UINT inheritance_priority;
|
||||
/* Determine if the simple, non-suspension, non-priority inheritance case is present. */
|
||||
if (mutex_ptr -> tx_mutex_suspension_list == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Is this a priority inheritance mutex? */
|
||||
if (mutex_ptr -> tx_mutex_inherit == TX_FALSE)
|
||||
{
|
||||
|
||||
/* Yes, we are done - set the mutex owner to NULL. */
|
||||
mutex_ptr -> tx_mutex_owner = TX_NULL;
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
@@ -233,11 +233,11 @@ UINT inheritance_priority;
|
||||
status = TX_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the processing is complete. */
|
||||
if (status == TX_NOT_DONE)
|
||||
{
|
||||
|
||||
|
||||
/* Initialize original owner and thread priority. */
|
||||
old_owner = TX_NULL;
|
||||
old_priority = thread_ptr -> tx_thread_user_priority;
|
||||
@@ -257,8 +257,8 @@ UINT inheritance_priority;
|
||||
|
||||
/* Default the inheritance priority to disabled. */
|
||||
inheritance_priority = ((UINT) TX_MAX_PRIORITIES);
|
||||
|
||||
/* Search the owned mutexes for this thread to determine the highest priority for this
|
||||
|
||||
/* Search the owned mutexes for this thread to determine the highest priority for this
|
||||
former mutex owner to return to. */
|
||||
next_mutex = thread_ptr -> tx_thread_owned_mutex_list;
|
||||
while (next_mutex != TX_NULL)
|
||||
@@ -267,8 +267,8 @@ UINT inheritance_priority;
|
||||
/* Does this mutex support priority inheritance? */
|
||||
if (next_mutex -> tx_mutex_inherit == TX_TRUE)
|
||||
{
|
||||
|
||||
/* Determine if highest priority field of the mutex is higher than the priority to
|
||||
|
||||
/* Determine if highest priority field of the mutex is higher than the priority to
|
||||
restore. */
|
||||
if (next_mutex -> tx_mutex_highest_priority_waiting < inheritance_priority)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ UINT inheritance_priority;
|
||||
/* Are we at the end of the list? */
|
||||
if (next_mutex == thread_ptr -> tx_thread_owned_mutex_list)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, set the next mutex to NULL. */
|
||||
next_mutex = TX_NULL;
|
||||
}
|
||||
@@ -298,14 +298,14 @@ UINT inheritance_priority;
|
||||
/* Undo the temporarily preemption disable. */
|
||||
_tx_thread_preempt_disable--;
|
||||
#endif
|
||||
|
||||
|
||||
/* Set the inherit priority to that of the highest priority thread waiting on the mutex. */
|
||||
thread_ptr -> tx_thread_inherit_priority = inheritance_priority;
|
||||
|
||||
|
||||
/* Determine if the inheritance priority is less than the default old priority. */
|
||||
if (inheritance_priority < old_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, update the old priority. */
|
||||
old_priority = inheritance_priority;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ UINT inheritance_priority;
|
||||
TX_RESTORE
|
||||
#endif
|
||||
|
||||
/* Call the mutex prioritize processing to ensure the
|
||||
/* Call the mutex prioritize processing to ensure the
|
||||
highest priority thread is resumed. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
do
|
||||
@@ -375,17 +375,17 @@ UINT inheritance_priority;
|
||||
TX_RESTORE
|
||||
#endif
|
||||
|
||||
/* Mutex is not owned, but it is possible that a thread that
|
||||
/* Mutex is not owned, but it is possible that a thread that
|
||||
caused a priority inheritance to occur is no longer waiting
|
||||
on the mutex. */
|
||||
|
||||
/* Setup the highest priority waiting thread. */
|
||||
mutex_ptr -> tx_mutex_highest_priority_waiting = (UINT) TX_MAX_PRIORITIES;
|
||||
|
||||
|
||||
/* Determine if we need to restore priority. */
|
||||
if ((mutex_ptr -> tx_mutex_owner) -> tx_thread_priority != old_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, restore the priority of thread. */
|
||||
_tx_mutex_priority_change(mutex_ptr -> tx_mutex_owner, old_priority);
|
||||
}
|
||||
@@ -424,7 +424,7 @@ UINT inheritance_priority;
|
||||
|
||||
/* Remember the old mutex owner. */
|
||||
old_owner = mutex_ptr -> tx_mutex_owner;
|
||||
|
||||
|
||||
/* Setup owner thread priority information. */
|
||||
mutex_ptr -> tx_mutex_original_priority = thread_ptr -> tx_thread_priority;
|
||||
|
||||
@@ -473,7 +473,7 @@ UINT inheritance_priority;
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
mutex_ptr -> tx_mutex_suspended_count--;
|
||||
|
||||
|
||||
/* Pickup the suspended count. */
|
||||
suspended_count = mutex_ptr -> tx_mutex_suspended_count;
|
||||
|
||||
@@ -482,7 +482,7 @@ UINT inheritance_priority;
|
||||
{
|
||||
|
||||
/* Yes, the only suspended thread. */
|
||||
|
||||
|
||||
/* Update the head pointer. */
|
||||
mutex_ptr -> tx_mutex_suspension_list = TX_NULL;
|
||||
}
|
||||
@@ -536,7 +536,7 @@ UINT inheritance_priority;
|
||||
_tx_mutex_prioritize(mutex_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Now, pickup the list head and set the priority. */
|
||||
|
||||
/* Determine if there still are threads suspended for this mutex. */
|
||||
@@ -551,11 +551,11 @@ UINT inheritance_priority;
|
||||
|
||||
/* Restore previous priority needs to be restored after priority
|
||||
inheritance. */
|
||||
|
||||
|
||||
/* Determine if we need to restore priority. */
|
||||
if (old_owner -> tx_thread_priority != old_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Restore priority of thread. */
|
||||
_tx_mutex_priority_change(old_owner, old_priority);
|
||||
}
|
||||
@@ -579,7 +579,7 @@ UINT inheritance_priority;
|
||||
{
|
||||
|
||||
/* Yes, priority inheritance is requested. */
|
||||
|
||||
|
||||
/* Determine if there are any more threads still suspended on the mutex. */
|
||||
if (mutex_ptr -> tx_mutex_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
@@ -594,7 +594,7 @@ UINT inheritance_priority;
|
||||
#else
|
||||
_tx_mutex_prioritize(mutex_ptr);
|
||||
#endif
|
||||
|
||||
|
||||
/* Now, pickup the list head and set the priority. */
|
||||
|
||||
/* Optional processing extension. */
|
||||
@@ -618,11 +618,11 @@ UINT inheritance_priority;
|
||||
|
||||
/* Restore previous priority needs to be restored after priority
|
||||
inheritance. */
|
||||
|
||||
|
||||
/* Is the priority different? */
|
||||
if (old_owner -> tx_thread_priority != old_priority)
|
||||
{
|
||||
|
||||
|
||||
/* Restore the priority of thread. */
|
||||
_tx_mutex_priority_change(old_owner, old_priority);
|
||||
}
|
||||
@@ -631,7 +631,7 @@ UINT inheritance_priority;
|
||||
/* Resume thread. */
|
||||
_tx_thread_system_resume(thread_ptr);
|
||||
#endif
|
||||
|
||||
|
||||
/* Return a successful status. */
|
||||
status = TX_SUCCESS;
|
||||
}
|
||||
@@ -645,7 +645,7 @@ UINT inheritance_priority;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Caller does not own the mutex. */
|
||||
status = TX_NOT_OWNED;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ UINT suspended_count;
|
||||
TX_THREAD *next_thread;
|
||||
TX_THREAD *previous_thread;
|
||||
|
||||
|
||||
|
||||
#ifndef TX_NOT_INTERRUPTABLE
|
||||
|
||||
/* Disable interrupts to remove the suspended thread from the queue. */
|
||||
@@ -96,7 +96,7 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if the cleanup is still required. */
|
||||
if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_queue_cleanup))
|
||||
{
|
||||
|
||||
|
||||
/* Check for valid suspension sequence. */
|
||||
if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ TX_THREAD *previous_thread;
|
||||
#endif
|
||||
|
||||
/* Yes, we still have thread suspension! */
|
||||
|
||||
|
||||
/* Clear the suspension cleanup flag. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
@@ -168,7 +168,7 @@ TX_THREAD *previous_thread;
|
||||
if (thread_ptr -> tx_thread_state == TX_QUEUE_SUSP)
|
||||
{
|
||||
|
||||
/* Timeout condition and the thread still suspended on the queue.
|
||||
/* Timeout condition and the thread still suspended on the queue.
|
||||
Setup return error status and resume the thread. */
|
||||
|
||||
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
@@ -183,17 +183,17 @@ TX_THREAD *previous_thread;
|
||||
/* Setup return status. */
|
||||
if (queue_ptr -> tx_queue_enqueued != TX_NO_MESSAGES)
|
||||
{
|
||||
|
||||
|
||||
/* Queue full timeout! */
|
||||
thread_ptr -> tx_thread_suspend_status = TX_QUEUE_FULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Queue empty timeout! */
|
||||
thread_ptr -> tx_thread_suspend_status = TX_QUEUE_EMPTY;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TX_NOT_INTERRUPTABLE
|
||||
|
||||
/* Resume the thread! */
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size,
|
||||
VOID *queue_start, ULONG queue_size)
|
||||
{
|
||||
|
||||
@@ -91,7 +91,7 @@ TX_QUEUE *previous_queue;
|
||||
|
||||
/* Setup the basic queue fields. */
|
||||
queue_ptr -> tx_queue_name = name_ptr;
|
||||
|
||||
|
||||
/* Save the message size in the control block. */
|
||||
queue_ptr -> tx_queue_message_size = message_size;
|
||||
|
||||
@@ -100,7 +100,7 @@ TX_QUEUE *previous_queue;
|
||||
capacity = (UINT) (queue_size / ((ULONG) (((ULONG) message_size) * (sizeof(ULONG)))));
|
||||
used_words = capacity * message_size;
|
||||
|
||||
/* Save the starting address and calculate the ending address of
|
||||
/* Save the starting address and calculate the ending address of
|
||||
the queue. Note that the ending address is really one past the
|
||||
end! */
|
||||
queue_ptr -> tx_queue_start = TX_VOID_TO_ULONG_POINTER_CONVERT(queue_start);
|
||||
|
||||
@@ -125,7 +125,7 @@ TX_QUEUE *previous_queue;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_queue_created_ptr == queue_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_queue_created_ptr = next_queue;
|
||||
}
|
||||
@@ -147,14 +147,14 @@ TX_QUEUE *previous_queue;
|
||||
on this queue. */
|
||||
while (suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ TX_THREAD *thread_ptr;
|
||||
if (queue_ptr -> tx_queue_suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
/* Yes, there are threads suspended on this queue, they must be
|
||||
/* Yes, there are threads suspended on this queue, they must be
|
||||
resumed! */
|
||||
|
||||
/* Copy the information into temporary variables. */
|
||||
@@ -141,24 +141,24 @@ TX_THREAD *thread_ptr;
|
||||
thread_ptr = suspension_list;
|
||||
while (suspended_count != ((ULONG) 0))
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
/* Check for a NULL thread pointer. */
|
||||
if (thread_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Get out of the loop. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Resume the next suspended thread. */
|
||||
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
@@ -182,7 +182,7 @@ TX_THREAD *thread_ptr;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Resume the thread. */
|
||||
_tx_thread_system_resume(thread_ptr -> tx_thread_suspended_previous);
|
||||
#endif
|
||||
|
||||
@@ -123,7 +123,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
if (queue_ptr -> tx_queue_available_storage != ((UINT) 0))
|
||||
{
|
||||
|
||||
/* Yes there is room in the queue. Now determine if there is a thread waiting
|
||||
/* Yes there is room in the queue. Now determine if there is a thread waiting
|
||||
for a message. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
@@ -137,20 +137,20 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
/* See if the read pointer is at the beginning of the queue area. */
|
||||
if (queue_ptr -> tx_queue_read == queue_ptr -> tx_queue_start)
|
||||
{
|
||||
|
||||
|
||||
/* Adjust the read pointer to the last message at the end of the
|
||||
queue. */
|
||||
queue_ptr -> tx_queue_read = TX_ULONG_POINTER_SUB(queue_ptr -> tx_queue_end, queue_ptr -> tx_queue_message_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not at the beginning of the queue, just move back one message. */
|
||||
queue_ptr -> tx_queue_read = TX_ULONG_POINTER_SUB(queue_ptr -> tx_queue_read, queue_ptr -> tx_queue_message_size);
|
||||
}
|
||||
|
||||
/* Simply place the message in the queue. */
|
||||
|
||||
|
||||
/* Reduce the amount of available storage. */
|
||||
queue_ptr -> tx_queue_available_storage--;
|
||||
|
||||
@@ -162,7 +162,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
destination = queue_ptr -> tx_queue_read;
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
@@ -241,7 +241,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info);
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
@@ -300,7 +300,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
/* Yes, suspension is requested. */
|
||||
|
||||
/* Prepare for suspension of this thread. */
|
||||
|
||||
|
||||
/* Pickup thread pointer. */
|
||||
TX_THREAD_GET_CURRENT(thread_ptr)
|
||||
|
||||
@@ -345,7 +345,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
next_thread -> tx_thread_suspended_previous = thread_ptr;
|
||||
|
||||
/* Update the suspension list to put this thread in front, which will put
|
||||
the message that was removed in the proper relative order when room is
|
||||
the message that was removed in the proper relative order when room is
|
||||
made in the queue. */
|
||||
queue_ptr -> tx_queue_suspension_list = thread_ptr;
|
||||
}
|
||||
|
||||
@@ -99,45 +99,45 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the queue. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = queue_ptr -> tx_queue_name;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of messages currently in the queue. */
|
||||
if (enqueued != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*enqueued = (ULONG) queue_ptr -> tx_queue_enqueued;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of messages that will still fit in the queue. */
|
||||
if (available_storage != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*available_storage = (ULONG) queue_ptr -> tx_queue_available_storage;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the first thread suspended on this queue. */
|
||||
if (first_suspended != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*first_suspended = queue_ptr -> tx_queue_suspension_list;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of threads suspended on this queue. */
|
||||
if (suspended_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspended_count = (ULONG) queue_ptr -> tx_queue_suspended_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the pointer to the next queue created. */
|
||||
if (next_queue != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_queue = queue_ptr -> tx_queue_created_next;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
@@ -95,15 +95,15 @@ UINT status;
|
||||
/* Determine if this is a legal request. */
|
||||
if (queue_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Queue pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the queue ID is invalid. */
|
||||
else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Queue pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -125,45 +125,45 @@ UINT status;
|
||||
/* Retrieve the number of messages sent to this queue. */
|
||||
if (messages_sent != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*messages_sent = queue_ptr -> tx_queue_performance_messages_sent_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of messages received from this queue. */
|
||||
if (messages_received != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*messages_received = queue_ptr -> tx_queue_performance_messages_received_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of empty queue suspensions on this queue. */
|
||||
if (empty_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*empty_suspensions = queue_ptr -> tx_queue_performance_empty_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of full queue suspensions on this queue. */
|
||||
if (full_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*full_suspensions = queue_ptr -> tx_queue_performance_full_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of full errors (no suspension!) on this queue. */
|
||||
if (full_errors != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*full_errors = queue_ptr -> tx_queue_performance_full_error_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of timeouts on this queue. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = queue_ptr -> tx_queue_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
@@ -106,51 +106,51 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the total number of queue messages sent. */
|
||||
if (messages_sent != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*messages_sent = _tx_queue_performance_messages_sent_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of queue messages received. */
|
||||
if (messages_received != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*messages_received = _tx_queue_performance__messages_received_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of empty queue suspensions. */
|
||||
if (empty_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*empty_suspensions = _tx_queue_performance_empty_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of full queue suspensions. */
|
||||
if (full_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*full_suspensions = _tx_queue_performance_full_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of full errors. */
|
||||
if (full_errors != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*full_errors = _tx_queue_performance_full_error_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of queue timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = _tx_queue_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Return completion status. */
|
||||
return(TX_SUCCESS);
|
||||
|
||||
|
||||
#else
|
||||
|
||||
UINT status;
|
||||
|
||||
@@ -161,28 +161,28 @@ UINT list_changed;
|
||||
/* Disable interrupts again. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Determine if any changes to the list have occurred while
|
||||
/* Determine if any changes to the list have occurred while
|
||||
interrupts were enabled. */
|
||||
|
||||
|
||||
/* Is the list head the same? */
|
||||
if (head_ptr != queue_ptr -> tx_queue_suspension_list)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Is the suspended count the same? */
|
||||
if (suspended_count != queue_ptr -> tx_queue_suspended_count)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the list has changed. */
|
||||
if (list_changed == TX_FALSE)
|
||||
{
|
||||
@@ -212,12 +212,12 @@ UINT list_changed;
|
||||
/* Release preemption. */
|
||||
_tx_thread_preempt_disable--;
|
||||
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
of the list. */
|
||||
if (priority_thread_ptr != head_ptr)
|
||||
{
|
||||
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
front of the list. */
|
||||
|
||||
/* First, remove the highest priority thread by updating the
|
||||
|
||||
@@ -118,7 +118,7 @@ UINT status;
|
||||
|
||||
/* Pickup the thread suspension count. */
|
||||
suspended_count = queue_ptr -> tx_queue_suspended_count;
|
||||
|
||||
|
||||
/* Determine if there is anything in the queue. */
|
||||
if (queue_ptr -> tx_queue_enqueued != TX_NO_MESSAGES)
|
||||
{
|
||||
@@ -128,13 +128,13 @@ UINT status;
|
||||
{
|
||||
|
||||
/* There is a message waiting in the queue and there are no suspensi. */
|
||||
|
||||
|
||||
/* Setup source and destination pointers. */
|
||||
source = queue_ptr -> tx_queue_read;
|
||||
destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr);
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
@@ -145,10 +145,10 @@ UINT status;
|
||||
/* Yes, wrap around to the beginning. */
|
||||
source = queue_ptr -> tx_queue_start;
|
||||
}
|
||||
|
||||
|
||||
/* Setup the queue read pointer. */
|
||||
queue_ptr -> tx_queue_read = source;
|
||||
|
||||
|
||||
/* Increase the amount of available storage. */
|
||||
queue_ptr -> tx_queue_available_storage++;
|
||||
|
||||
@@ -160,18 +160,18 @@ UINT status;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* At this point we know the queue is full. */
|
||||
|
||||
/* Pickup thread suspension list head pointer. */
|
||||
thread_ptr = queue_ptr -> tx_queue_suspension_list;
|
||||
|
||||
/* Now determine if there is a queue front suspension active. */
|
||||
|
||||
|
||||
/* Is the front suspension flag set? */
|
||||
if (thread_ptr -> tx_thread_suspend_option == TX_TRUE)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, a queue front suspension is present. */
|
||||
|
||||
/* Return the message associated with this suspension. */
|
||||
@@ -181,11 +181,11 @@ UINT status;
|
||||
destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr);
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
/* Message is now in the caller's destination. See if this is the only suspended thread
|
||||
/* Message is now in the caller's destination. See if this is the only suspended thread
|
||||
on the list. */
|
||||
suspended_count--;
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
@@ -244,7 +244,7 @@ UINT status;
|
||||
else
|
||||
{
|
||||
|
||||
/* At this point, we know that the queue is full and there
|
||||
/* At this point, we know that the queue is full and there
|
||||
are one or more threads suspended trying to send another
|
||||
message to this queue. */
|
||||
|
||||
@@ -253,7 +253,7 @@ UINT status;
|
||||
destination = TX_VOID_TO_ULONG_POINTER_CONVERT(destination_ptr);
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
@@ -267,7 +267,7 @@ UINT status;
|
||||
|
||||
/* Setup the queue read pointer. */
|
||||
queue_ptr -> tx_queue_read = source;
|
||||
|
||||
|
||||
/* Disable preemption. */
|
||||
_tx_thread_preempt_disable++;
|
||||
|
||||
@@ -291,14 +291,14 @@ UINT status;
|
||||
destination = queue_ptr -> tx_queue_write;
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
/* Determine if we are at the end. */
|
||||
if (destination == queue_ptr -> tx_queue_end)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, wrap around to the beginning. */
|
||||
destination = queue_ptr -> tx_queue_start;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ UINT status;
|
||||
/* Pickup thread pointer. */
|
||||
thread_ptr = queue_ptr -> tx_queue_suspension_list;
|
||||
|
||||
/* Message is now in the queue. See if this is the only suspended thread
|
||||
/* Message is now in the queue. See if this is the only suspended thread
|
||||
on the list. */
|
||||
suspended_count--;
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
@@ -378,7 +378,7 @@ UINT status;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Suspension is not allowed if the preempt disable flag is non-zero at this point - return error completion. */
|
||||
status = TX_QUEUE_EMPTY;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ UINT status;
|
||||
/* Increment the number of empty suspensions on this queue. */
|
||||
queue_ptr -> tx_queue_performance_empty_suspension_count++;
|
||||
#endif
|
||||
|
||||
|
||||
/* Pickup thread pointer. */
|
||||
TX_THREAD_GET_CURRENT(thread_ptr)
|
||||
|
||||
@@ -477,7 +477,7 @@ UINT status;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Immediate return, return error completion. */
|
||||
status = TX_QUEUE_EMPTY;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ UINT _tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option)
|
||||
{
|
||||
|
||||
TX_INTERRUPT_SAVE_AREA
|
||||
|
||||
|
||||
TX_THREAD *thread_ptr;
|
||||
ULONG *source;
|
||||
ULONG *destination;
|
||||
@@ -128,9 +128,9 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
/* Determine if there are suspended on this queue. */
|
||||
if (suspended_count == TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* No suspended threads, simply place the message in the queue. */
|
||||
|
||||
|
||||
/* Reduce the amount of available storage. */
|
||||
queue_ptr -> tx_queue_available_storage--;
|
||||
|
||||
@@ -142,7 +142,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
destination = queue_ptr -> tx_queue_write;
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
@@ -182,7 +182,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
else
|
||||
{
|
||||
|
||||
/* There is a thread suspended on an empty queue. Simply
|
||||
/* There is a thread suspended on an empty queue. Simply
|
||||
copy the message to the suspended thread's destination
|
||||
pointer. */
|
||||
|
||||
@@ -230,7 +230,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info);
|
||||
size = queue_ptr -> tx_queue_message_size;
|
||||
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
/* Copy message. Note that the source and destination pointers are
|
||||
incremented by the macro. */
|
||||
TX_QUEUE_MESSAGE_COPY(source, destination, size)
|
||||
|
||||
@@ -274,7 +274,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* At this point, the queue is full. Determine if suspension is requested. */
|
||||
else if (wait_option != TX_NO_WAIT)
|
||||
{
|
||||
@@ -302,7 +302,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
|
||||
/* Increment the number of full suspensions on this queue. */
|
||||
queue_ptr -> tx_queue_performance_full_suspension_count++;
|
||||
#endif
|
||||
|
||||
|
||||
/* Pickup thread pointer. */
|
||||
TX_THREAD_GET_CURRENT(thread_ptr)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ UINT suspended_count;
|
||||
TX_THREAD *next_thread;
|
||||
TX_THREAD *previous_thread;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef TX_NOT_INTERRUPTABLE
|
||||
|
||||
@@ -97,7 +97,7 @@ TX_THREAD *previous_thread;
|
||||
/* Determine if the cleanup is still required. */
|
||||
if (thread_ptr -> tx_thread_suspend_cleanup == &(_tx_semaphore_cleanup))
|
||||
{
|
||||
|
||||
|
||||
/* Check for valid suspension sequence. */
|
||||
if (suspension_sequence == thread_ptr -> tx_thread_suspension_sequence)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ TX_THREAD *previous_thread;
|
||||
/* Setup pointer to semaphore control block. */
|
||||
semaphore_ptr = TX_VOID_TO_SEMAPHORE_POINTER_CONVERT(thread_ptr -> tx_thread_suspend_control_block);
|
||||
#endif
|
||||
|
||||
|
||||
/* Yes, we still have thread suspension! */
|
||||
|
||||
/* Clear the suspension cleanup flag. */
|
||||
@@ -140,7 +140,7 @@ TX_THREAD *previous_thread;
|
||||
{
|
||||
|
||||
/* Yes, the only suspended thread. */
|
||||
|
||||
|
||||
/* Update the head pointer. */
|
||||
semaphore_ptr -> tx_semaphore_suspension_list = TX_NULL;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ TX_THREAD *previous_thread;
|
||||
previous_thread = thread_ptr -> tx_thread_suspended_previous;
|
||||
next_thread -> tx_thread_suspended_previous = previous_thread;
|
||||
previous_thread -> tx_thread_suspended_next = next_thread;
|
||||
|
||||
|
||||
/* Determine if we need to update the head pointer. */
|
||||
if (semaphore_ptr -> tx_semaphore_suspension_list == thread_ptr)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ TX_SEMAPHORE *previous_semaphore;
|
||||
/* Setup the basic semaphore fields. */
|
||||
semaphore_ptr -> tx_semaphore_name = name_ptr;
|
||||
semaphore_ptr -> tx_semaphore_count = initial_count;
|
||||
|
||||
|
||||
/* Disable interrupts to place the semaphore on the created list. */
|
||||
TX_DISABLE
|
||||
|
||||
@@ -119,7 +119,7 @@ TX_SEMAPHORE *previous_semaphore;
|
||||
semaphore_ptr -> tx_semaphore_created_previous = previous_semaphore;
|
||||
semaphore_ptr -> tx_semaphore_created_next = next_semaphore;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the created count. */
|
||||
_tx_semaphore_created_count++;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ TX_SEMAPHORE *previous_semaphore;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_semaphore_created_ptr == semaphore_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_semaphore_created_ptr = next_semaphore;
|
||||
}
|
||||
@@ -148,14 +148,14 @@ TX_SEMAPHORE *previous_semaphore;
|
||||
on this semaphore. */
|
||||
while (suspended_count != TX_NO_SUSPENSIONS)
|
||||
{
|
||||
|
||||
|
||||
/* Decrement the suspension count. */
|
||||
suspended_count--;
|
||||
|
||||
/* Lockout interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
/* Clear the cleanup pointer, this prevents the timeout from doing
|
||||
anything. */
|
||||
thread_ptr -> tx_thread_suspend_cleanup = TX_NULL;
|
||||
|
||||
@@ -179,7 +179,7 @@ TX_SEMAPHORE *previous_semaphore;
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
/* Resume the thread. */
|
||||
_tx_thread_system_resume(thread_ptr);
|
||||
#endif
|
||||
|
||||
@@ -77,7 +77,7 @@ UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option)
|
||||
{
|
||||
|
||||
TX_INTERRUPT_SAVE_AREA
|
||||
|
||||
|
||||
TX_THREAD *thread_ptr;
|
||||
TX_THREAD *next_thread;
|
||||
TX_THREAD *previous_thread;
|
||||
@@ -123,7 +123,7 @@ UINT status;
|
||||
/* Determine if the preempt disable flag is non-zero. */
|
||||
if (_tx_thread_preempt_disable != ((UINT) 0))
|
||||
{
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
@@ -143,7 +143,7 @@ UINT status;
|
||||
/* Increment the number of suspensions on this semaphore. */
|
||||
semaphore_ptr -> tx_semaphore_performance_suspension_count++;
|
||||
#endif
|
||||
|
||||
|
||||
/* Pickup thread pointer. */
|
||||
TX_THREAD_GET_CURRENT(thread_ptr)
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value,
|
||||
TX_THREAD **first_suspended, ULONG *suspended_count,
|
||||
TX_SEMAPHORE **next_semaphore)
|
||||
{
|
||||
|
||||
@@ -100,38 +100,38 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the semaphore. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = semaphore_ptr -> tx_semaphore_name;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the current value of the semaphore. */
|
||||
if (current_value != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*current_value = semaphore_ptr -> tx_semaphore_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the first thread suspended on this semaphore. */
|
||||
if (first_suspended != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*first_suspended = semaphore_ptr -> tx_semaphore_suspension_list;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of threads suspended on this semaphore. */
|
||||
if (suspended_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspended_count = (ULONG) semaphore_ptr -> tx_semaphore_suspended_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the pointer to the next semaphore created. */
|
||||
if (next_semaphore != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_semaphore = semaphore_ptr -> tx_semaphore_created_next;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
@@ -93,15 +93,15 @@ UINT status;
|
||||
/* Determine if this is a legal request. */
|
||||
if (semaphore_ptr == TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Semaphore pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the semaphore ID is invalid. */
|
||||
else if (semaphore_ptr -> tx_semaphore_id != TX_SEMAPHORE_ID)
|
||||
{
|
||||
|
||||
|
||||
/* Semaphore pointer is illegal, return error. */
|
||||
status = TX_PTR_ERROR;
|
||||
}
|
||||
@@ -123,31 +123,31 @@ UINT status;
|
||||
/* Retrieve the number of puts on this semaphore. */
|
||||
if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*puts = semaphore_ptr -> tx_semaphore_performance_put_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of gets on this semaphore. */
|
||||
if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*gets = semaphore_ptr -> tx_semaphore_performance_get_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of suspensions on this semaphore. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = semaphore_ptr -> tx_semaphore_performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the number of timeouts on this semaphore. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = semaphore_ptr -> tx_semaphore_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
@@ -161,37 +161,37 @@ UINT status;
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (semaphore_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
@@ -101,37 +101,37 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the total number of semaphore puts. */
|
||||
if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*puts = _tx_semaphore_performance_put_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of semaphore gets. */
|
||||
if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*gets = _tx_semaphore_performance_get_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of semaphore suspensions. */
|
||||
if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*suspensions = _tx_semaphore_performance_suspension_count;
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the total number of semaphore timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*timeouts = _tx_semaphore_performance_timeout_count;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Return completion status. */
|
||||
return(TX_SUCCESS);
|
||||
|
||||
|
||||
#else
|
||||
|
||||
UINT status;
|
||||
@@ -140,31 +140,31 @@ UINT status;
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (puts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (gets != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
@@ -161,28 +161,28 @@ UINT list_changed;
|
||||
/* Disable interrupts again. */
|
||||
TX_DISABLE
|
||||
|
||||
/* Determine if any changes to the list have occurred while
|
||||
/* Determine if any changes to the list have occurred while
|
||||
interrupts were enabled. */
|
||||
|
||||
|
||||
/* Is the list head the same? */
|
||||
if (head_ptr != semaphore_ptr -> tx_semaphore_suspension_list)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
/* Is the suspended count the same? */
|
||||
if (suspended_count != semaphore_ptr -> tx_semaphore_suspended_count)
|
||||
{
|
||||
|
||||
|
||||
/* The list head has changed, set the list changed flag. */
|
||||
list_changed = TX_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Determine if the list has changed. */
|
||||
if (list_changed == TX_FALSE)
|
||||
{
|
||||
@@ -214,12 +214,12 @@ UINT list_changed;
|
||||
/* Release preemption. */
|
||||
_tx_thread_preempt_disable--;
|
||||
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
/* Now determine if the highest priority thread is at the front
|
||||
of the list. */
|
||||
if (priority_thread_ptr != head_ptr)
|
||||
{
|
||||
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
/* No, we need to move the highest priority suspended thread to the
|
||||
front of the list. */
|
||||
|
||||
/* First, remove the highest priority thread by updating the
|
||||
|
||||
@@ -139,7 +139,7 @@ TX_THREAD *previous_thread;
|
||||
{
|
||||
|
||||
/* A thread is suspended on this semaphore. */
|
||||
|
||||
|
||||
/* Pickup the pointer to the first suspended thread. */
|
||||
thread_ptr = semaphore_ptr -> tx_semaphore_suspension_list;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_create PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* 6.3.0 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -79,11 +79,19 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* changed stack calculations */
|
||||
/* to use ALIGN_TYPE integers, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 06-02-2021 William E. Lamie Modified comment(s), and */
|
||||
/* supported TX_MISRA_ENABLE, */
|
||||
/* 08-02-2021 Scott Larson Removed unneeded cast, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
|
||||
/* added option for random */
|
||||
/* number stack filling, */
|
||||
/* resulting in version 6.3.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG id), ULONG entry_input,
|
||||
@@ -105,6 +113,17 @@ ALIGN_TYPE updated_stack_start;
|
||||
#endif
|
||||
|
||||
#ifndef TX_DISABLE_STACK_FILLING
|
||||
#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING)
|
||||
|
||||
/* Initialize the stack fill value to a 8-bit random value. */
|
||||
thread_ptr -> tx_thread_stack_fill_value = ((ULONG) TX_RAND()) & 0xFFUL;
|
||||
|
||||
/* Duplicate the random value in each of the 4 bytes of the stack fill value. */
|
||||
thread_ptr -> tx_thread_stack_fill_value = thread_ptr -> tx_thread_stack_fill_value |
|
||||
(thread_ptr -> tx_thread_stack_fill_value << 8) |
|
||||
(thread_ptr -> tx_thread_stack_fill_value << 16) |
|
||||
(thread_ptr -> tx_thread_stack_fill_value << 24);
|
||||
#endif
|
||||
|
||||
/* Set the thread stack to a pattern prior to creating the initial
|
||||
stack frame. This pattern is used by the stack checking routines
|
||||
@@ -114,25 +133,33 @@ ALIGN_TYPE updated_stack_start;
|
||||
|
||||
#ifdef TX_ENABLE_STACK_CHECKING
|
||||
|
||||
/* Ensure that there are two ULONG of 0xEF patterns at the top and
|
||||
/* Ensure that there are two ULONG of 0xEF patterns at the top and
|
||||
bottom of the thread's stack. This will be used to check for stack
|
||||
overflow conditions during run-time. */
|
||||
stack_size = ((stack_size/(sizeof(ULONG))) * (sizeof(ULONG))) - (sizeof(ULONG));
|
||||
|
||||
/* Ensure the starting stack address is evenly aligned. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
new_stack_start = TX_POINTER_TO_ULONG_CONVERT(stack_start);
|
||||
#else
|
||||
new_stack_start = TX_POINTER_TO_ALIGN_TYPE_CONVERT(stack_start);
|
||||
updated_stack_start = ((((ULONG) new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
|
||||
#endif /* TX_MISRA_ENABLE */
|
||||
updated_stack_start = (((new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
|
||||
|
||||
/* Determine if the starting stack address is different. */
|
||||
if (new_stack_start != updated_stack_start)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, subtract another ULONG from the size to avoid going past the stack area. */
|
||||
stack_size = stack_size - (sizeof(ULONG));
|
||||
}
|
||||
|
||||
/* Update the starting stack pointer. */
|
||||
#ifdef TX_MISRA_ENABLE
|
||||
stack_start = TX_ULONG_TO_POINTER_CONVERT(updated_stack_start);
|
||||
#else
|
||||
stack_start = TX_ALIGN_TYPE_TO_POINTER_CONVERT(updated_stack_start);
|
||||
#endif /* TX_MISRA_ENABLE */
|
||||
#endif
|
||||
|
||||
/* Prepare the thread control block prior to placing it on the created
|
||||
@@ -192,7 +219,7 @@ ALIGN_TYPE updated_stack_start;
|
||||
/* Perform any additional thread setup activities for tool or user purpose. */
|
||||
TX_THREAD_CREATE_INTERNAL_EXTENSION(thread_ptr)
|
||||
|
||||
/* Call the target specific stack frame building routine to build the
|
||||
/* Call the target specific stack frame building routine to build the
|
||||
thread's initial stack and to setup the actual stack pointer in the
|
||||
control block. */
|
||||
_tx_thread_stack_build(thread_ptr, _tx_thread_shell_entry);
|
||||
@@ -234,7 +261,7 @@ ALIGN_TYPE updated_stack_start;
|
||||
thread_ptr -> tx_thread_created_previous = previous_thread;
|
||||
thread_ptr -> tx_thread_created_next = next_thread;
|
||||
}
|
||||
|
||||
|
||||
/* Increment the thread created count. */
|
||||
_tx_thread_created_count++;
|
||||
|
||||
@@ -268,22 +295,22 @@ ALIGN_TYPE updated_stack_start;
|
||||
/* Yes, this create call was made from initialization. */
|
||||
|
||||
/* Pickup the current thread execute pointer, which corresponds to the
|
||||
highest priority thread ready to execute. Interrupt lockout is
|
||||
not required, since interrupts are assumed to be disabled during
|
||||
highest priority thread ready to execute. Interrupt lockout is
|
||||
not required, since interrupts are assumed to be disabled during
|
||||
initialization. */
|
||||
saved_thread_ptr = _tx_thread_execute_ptr;
|
||||
|
||||
/* Determine if there is thread ready for execution. */
|
||||
if (saved_thread_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, a thread is ready for execution when initialization completes. */
|
||||
|
||||
/* Save the current preemption-threshold. */
|
||||
saved_threshold = saved_thread_ptr -> tx_thread_preempt_threshold;
|
||||
|
||||
/* For initialization, temporarily set the preemption-threshold to the
|
||||
priority level to make sure the highest-priority thread runs once
|
||||
/* For initialization, temporarily set the preemption-threshold to the
|
||||
priority level to make sure the highest-priority thread runs once
|
||||
initialization is complete. */
|
||||
saved_thread_ptr -> tx_thread_preempt_threshold = saved_thread_ptr -> tx_thread_priority;
|
||||
}
|
||||
@@ -316,7 +343,7 @@ ALIGN_TYPE updated_stack_start;
|
||||
/* Call the resume thread function to make this thread ready. */
|
||||
_tx_thread_system_resume(thread_ptr);
|
||||
#endif
|
||||
|
||||
|
||||
/* Determine if the thread's preemption-threshold needs to be restored. */
|
||||
if (saved_thread_ptr != TX_NULL)
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ UINT status;
|
||||
|
||||
/* Default status to success. */
|
||||
status = TX_SUCCESS;
|
||||
|
||||
|
||||
/* Lockout interrupts while the thread is being deleted. */
|
||||
TX_DISABLE
|
||||
|
||||
@@ -106,7 +106,7 @@ UINT status;
|
||||
/* Determine if the delete operation is okay. */
|
||||
if (status == TX_SUCCESS)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, continue with deleting the thread. */
|
||||
|
||||
/* Perform any additional activities for tool or user purpose. */
|
||||
@@ -129,7 +129,7 @@ UINT status;
|
||||
|
||||
/* Decrement the number of created threads. */
|
||||
_tx_thread_created_count--;
|
||||
|
||||
|
||||
/* See if the thread is the only one on the list. */
|
||||
if (_tx_thread_created_count == TX_EMPTY)
|
||||
{
|
||||
@@ -149,7 +149,7 @@ UINT status;
|
||||
/* See if we have to update the created list head pointer. */
|
||||
if (_tx_thread_created_ptr == thread_ptr)
|
||||
{
|
||||
|
||||
|
||||
/* Yes, move the head pointer to the next link. */
|
||||
_tx_thread_created_ptr = next_thread;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ TX_THREAD *thread_ptr;
|
||||
|
||||
TX_INTERRUPT_SAVE_AREA
|
||||
|
||||
|
||||
|
||||
/* Disable interrupts to put the timer on the created list. */
|
||||
TX_DISABLE
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count,
|
||||
UINT *priority, UINT *preemption_threshold, ULONG *time_slice,
|
||||
TX_THREAD **next_thread, TX_THREAD **next_suspended_thread)
|
||||
{
|
||||
|
||||
@@ -103,59 +103,59 @@ TX_INTERRUPT_SAVE_AREA
|
||||
/* Retrieve the name of the thread. */
|
||||
if (name != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*name = thread_ptr -> tx_thread_name;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the thread's current state. */
|
||||
if (state != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*state = thread_ptr -> tx_thread_state;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the number of times the thread has been scheduled. */
|
||||
if (run_count != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*run_count = thread_ptr -> tx_thread_run_count;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the thread's priority. */
|
||||
if (priority != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*priority = thread_ptr -> tx_thread_user_priority;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the thread's preemption-threshold. */
|
||||
if (preemption_threshold != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*preemption_threshold = thread_ptr -> tx_thread_user_preempt_threshold;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the thread's current time-slice. */
|
||||
if (time_slice != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*time_slice = thread_ptr -> tx_thread_time_slice;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the next created thread. */
|
||||
if (next_thread != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_thread = thread_ptr -> tx_thread_created_next;
|
||||
}
|
||||
|
||||
|
||||
/* Pickup the next thread suspended. */
|
||||
if (next_suspended_thread != TX_NULL)
|
||||
{
|
||||
|
||||
|
||||
*next_suspended_thread = thread_ptr -> tx_thread_suspended_next;
|
||||
}
|
||||
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user