Compare commits
337 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b788ce25f5 | |||
| 1a9a5b82a8 | |||
| cb9f103421 | |||
| 9479cd9ce7 | |||
| c7de99b141 | |||
| 9ad55840bb | |||
| 81011a71b1 | |||
| 832e1ca0e7 | |||
| 83bdfeb5cb | |||
| 6128d61186 | |||
| 6657c44cc7 | |||
| 52c37ee699 | |||
| 134958a535 | |||
| 0f7ef6b586 | |||
| 9cbb6b1512 | |||
| af85a271a5 | |||
| a7eacbcc49 | |||
| 05e2e059e3 | |||
| 2cc52318e3 | |||
| d602fb9421 | |||
| 8c1e4b5250 | |||
| d2a5d2d220 | |||
| 9ff3500dda | |||
| 30e5554171 | |||
| 190204e6b8 | |||
| 9d4aff6eab | |||
| d74ecde544 | |||
| ad4cf3e332 | |||
| 701ab0db8e | |||
| b3f2f44124 | |||
| a03ee01cee | |||
| 9bb87da816 | |||
| 5fbb7cbe6a | |||
| 8af96b8cdd | |||
| 5cdc4527d3 | |||
| 0206af6c07 | |||
| fb5dd40949 | |||
| 9c1366ed99 | |||
| e7c505d415 | |||
| e304aa9da7 | |||
| c1775c9005 | |||
| dbd9321380 | |||
| 7f6622e6ac | |||
| 04ffe9493b | |||
| 6c39286626 | |||
| 86b9e7ee13 | |||
| 6566031ec6 | |||
| e7a6c77d74 | |||
| 2436e2463c | |||
| 9fffe26c20 | |||
| 3ab1c95ab3 | |||
| 7f32519aa9 | |||
| ff91016e81 | |||
| 4615345773 | |||
| 25ff9813c6 | |||
| 8ba8ae85c4 | |||
| dc1cd03897 | |||
| 304ca54aba | |||
| e175f3f729 | |||
| 641fc9c833 | |||
| 6e2597593a | |||
| c29a949a13 | |||
| 26268313c4 | |||
| da8412db6a | |||
| 9bf6c900c4 | |||
| aa6e7b0300 | |||
| 0663c5a372 | |||
| ad42498dfb | |||
| 662d03896b | |||
| 8b09d27cd9 | |||
| d7c8cf3a9e | |||
| c9ae761066 | |||
| 7bed426de3 | |||
| 048de70ee6 | |||
| 6049f226bc | |||
| c02083677a | |||
| 64ed7aff53 | |||
| a694291420 | |||
| 0216e032be | |||
| 2d8aa0cea1 | |||
| d1eb100806 | |||
| 1d3c53ae2f | |||
| 97d5da4c11 | |||
| 359e0641c4 | |||
| 2c4e4edade | |||
| c6ae6c53a8 | |||
| c596e9f3f0 | |||
| 37ebee1cef | |||
| 76cbaeeb2e | |||
| 79b8ad13f1 | |||
| d0a8bc29be | |||
| 10901d9092 | |||
| dddc232294 | |||
| 1419f2637e | |||
| 91b08d2deb | |||
| 2f3af1c9da | |||
| 2d6a5201cf | |||
| a390a348d0 | |||
| b3a732b43a | |||
| bb6d74383e | |||
| 9e8b2121dd | |||
| af91b4d29f | |||
| 609325a8b4 | |||
| 3bd861bf19 | |||
| ed3de53587 | |||
| 82eddcd6e7 | |||
| 3929349c1b | |||
| e095f94f9f | |||
| 9127ec6bd7 | |||
| 7a9d26d1a0 | |||
| af0b517e8f | |||
| aeb062b33e | |||
| 15fe76dd6a | |||
| 7265db1b36 | |||
| c5104c1d2b | |||
| 8b91d1d255 | |||
| 9518cb0f2e | |||
| c2bd4928a5 | |||
| 7120df3b85 | |||
| f25156971b | |||
| 650ca3baa6 | |||
| 3ceb4a5c46 | |||
| 8511d9e781 | |||
| 7aa6d3ef09 | |||
| f7fdbb4eb3 | |||
| 7d0cd9ccf5 | |||
| ead8d29316 | |||
| 58a6d42db6 | |||
| 50833c9836 | |||
| 5d704b8494 | |||
| 3621a0a3f6 | |||
| 10b9e5ca34 | |||
| bcef7ad91b | |||
| 1666980b5b | |||
| 58a6d1b8d4 | |||
| 2151f4c50b | |||
| ee7e532761 | |||
| 4a7665a1e9 | |||
| 1e4d50b6e8 | |||
| 3ae543dd30 | |||
| 041959f903 | |||
| df922ed7c8 | |||
| 41534e78f8 | |||
| fabdb6a51e | |||
| fac1a75596 | |||
| bd5ded15e7 | |||
| 530e807bcd | |||
| 251a0268c4 | |||
| 4fdded0e2d | |||
| f4e26c785f | |||
| 9100ed15fa | |||
| dc82db35d4 | |||
| 610fb6fd35 | |||
| 594882f7a9 | |||
| 4e160fea16 | |||
| 99d5ad3b09 | |||
| a9f6080931 | |||
| 1b0301c89f | |||
| 94798e4465 | |||
| 65b59a6646 | |||
| 09f5b5d00a | |||
| 3487cbad21 | |||
| da8e07b697 | |||
| 402a13a980 | |||
| 56f7a03a5c | |||
| 3113388293 | |||
| eecfc0479a | |||
| 9984643e4c | |||
| 58114b32ba | |||
| 50a6fb637f | |||
| d71b12cd8b | |||
| 42842f71e0 | |||
| 5213de4eaa | |||
| 602c9fffe0 | |||
| 4d73906008 | |||
| 0da50d80ef | |||
| f0bbc163c6 | |||
| 78aec86650 | |||
| 6bd2a602ca | |||
| 6b923de48d | |||
| a645efd189 | |||
| a717a3eacb | |||
| da03b84eff | |||
| aa6d23c7cb | |||
| 2a1826f1ed | |||
| 8e79ea09e4 | |||
| e29dbb946e | |||
| b1f8fa881d | |||
| c2a2d04b50 | |||
| 84d0a5ebd1 | |||
| 6ed5c22d7c | |||
| 07246fdc30 | |||
| 14899ca3f7 | |||
| 2d0972d35d | |||
| c43828b2e3 | |||
| bc13685c46 | |||
| 14d374dc2b | |||
| 5dc45f2ceb | |||
| 8ed81063a2 | |||
| cb92d78a46 | |||
| d94a20e63a | |||
| b2ff518c27 | |||
| 4c1d5e8fcf | |||
| e13d6ba012 | |||
| ec08edd240 | |||
| 1c890a9da0 | |||
| e070ce987f | |||
| 45b75301a8 | |||
| 491cfc6ae0 | |||
| d42b24369f | |||
| 8280cfef43 | |||
| 785da0db6c | |||
| eaad3c451c | |||
| fd751bd3fe | |||
| 0785d312f7 | |||
| 5dc96c7324 | |||
| 2532ef1049 | |||
| dd2d4df3dc | |||
| a583d8998f | |||
| 953cf6f7d6 | |||
| fcd4fa4ab7 | |||
| 123a2b28fc | |||
| 28261437f8 | |||
| c0a48e4fe2 | |||
| 5b2353a2ab | |||
| cafd4ff6a6 | |||
| f98aff039c | |||
| 5e93e09c1a | |||
| ca5c5fdd40 | |||
| 71c1b8ca6d | |||
| e5c2fbd6ac | |||
| 3618b9c7be | |||
| 7ab7cfc96d | |||
| 92db4f2d84 | |||
| e2ce5865c9 | |||
| 6815edf8d6 | |||
| f8ff1c8d6a | |||
| 6ab5745875 | |||
| 8bb6a9b44a | |||
| 52ec2a266f | |||
| 33f6219f06 | |||
| dd6153f317 | |||
| 05af0cbb55 | |||
| ff39019034 | |||
| a5eefa9ffa | |||
| 109e8f88ce | |||
| 00413994dd | |||
| 8e39965b2d | |||
| 87f6e91f51 | |||
| 0cb0df6bee | |||
| 80e2ab6ed6 | |||
| e406791b6f | |||
| 438eb8ebb3 | |||
| 206b5ab014 | |||
| 2ab7fa652c | |||
| 87d1df38de | |||
| c392cb6d9d | |||
| 7ae0805095 | |||
| a2f86e84a4 | |||
| b8a2160f82 | |||
| 99d49108c1 | |||
| e6671b3065 | |||
| df82a0e497 | |||
| 1832269181 | |||
| 8341f282ee | |||
| 4fdf747445 | |||
| 61b6a0ea9f | |||
| 5006ca07be | |||
| 8579af67a2 | |||
| 8f49610d3a | |||
| 8fd08ba1f8 | |||
| c0c4f77c36 | |||
| b6cbad224b | |||
| c765c7484c | |||
| 3242d3dca2 | |||
| 58f774e98d | |||
| 79ff336b2b | |||
| 0d367432e6 | |||
| 959919bcfe | |||
| 4f7289e022 | |||
| af8be03165 | |||
| 88ce2c94f8 | |||
| 0a52d5c032 | |||
| 38286d9805 | |||
| 0ece75536c | |||
| 4b377bb032 | |||
| 0392a56193 | |||
| 58654b3664 | |||
| 8b324e08d9 | |||
| 1bf3881adc | |||
| e2c1ca3bca | |||
| 234b15a12c | |||
| 80a0c3b028 | |||
| e73644f3fe | |||
| 9a6d6a4405 | |||
| 777abb71b5 | |||
| ac4ffdb4e5 | |||
| 691a297b6a | |||
| bec97532ee | |||
| 406cd0cc83 | |||
| 62af625be4 | |||
| 26917ebf96 | |||
| 3d8bfb036d | |||
| a0f0af5da8 | |||
| 27c99f74ad | |||
| 050cef7b48 | |||
| 5d74ace99f | |||
| 3130fd9532 | |||
| f0c531abb6 | |||
| ce2874b732 | |||
| a55cef1165 | |||
| 682b0b440d | |||
| 7025912957 | |||
| bb6b23891c | |||
| 1b211947b8 | |||
| ea15d3edab | |||
| 47c6f8a98b | |||
| ccb2c3bb85 | |||
| e74b9776e5 | |||
| e61bbe1499 | |||
| ffd7062e21 | |||
| 7255ca0bc6 | |||
| f7c56bc5e4 | |||
| e4c973487b | |||
| d4ab268bbf | |||
| b4dbf606b7 | |||
| f6a1d772c2 | |||
| ae208fa92f | |||
| f11d496899 | |||
| a3d0fe53cf | |||
| 395d11b06f | |||
| e79b328103 | |||
| 1c19d9a86a | |||
| 6043f88b35 | |||
| 2087e6fbcf | |||
| c67086bdba | |||
| 24e6dbcf48 |
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app
|
||||||
|
#
|
||||||
|
|
||||||
|
# Number of days of inactivity before a closed issue or pull request is locked
|
||||||
|
daysUntilLock: 60
|
||||||
|
|
||||||
|
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
||||||
|
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
||||||
|
skipCreatedBefore: false
|
||||||
|
|
||||||
|
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable
|
||||||
|
exemptLabels: [ 'no-locking' ]
|
||||||
|
|
||||||
|
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
||||||
|
lockLabel: false
|
||||||
|
|
||||||
|
# Comment to post before locking. Set to `false` to disable
|
||||||
|
lockComment: >
|
||||||
|
This thread has been automatically locked since there has not been
|
||||||
|
any recent activity after it was closed. Please open a new issue for
|
||||||
|
related bugs.
|
||||||
|
|
||||||
|
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
||||||
|
setLockReason: true
|
||||||
|
|
||||||
|
# Limit to only `issues` or `pulls`
|
||||||
|
# only: issues
|
||||||
|
|
||||||
|
# Optionally, specify configuration settings just for `issues` or `pulls`
|
||||||
|
# issues:
|
||||||
|
# exemptLabels:
|
||||||
|
# - help-wanted
|
||||||
|
# lockLabel: outdated
|
||||||
|
|
||||||
|
# pulls:
|
||||||
|
# daysUntilLock: 30
|
||||||
|
|
||||||
|
# Repository to extend settings from
|
||||||
|
# _extends: repo
|
||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out bugfix-2.0.x
|
- name: Check out bugfix-2.0.x
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: bugfix-2.0.x
|
ref: bugfix-2.0.x
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
- name: Check out bugfix-2.1.x
|
- name: Check out bugfix-2.1.x
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: bugfix-2.1.x
|
ref: bugfix-2.1.x
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
- "Needs: Work"
|
- "Needs: Work"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- name: Remove Labels
|
- name: Remove Labels
|
||||||
uses: actions-ecosystem/action-remove-labels@v1
|
uses: actions-ecosystem/action-remove-labels@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v9
|
- uses: actions/stale@v8
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: |
|
stale-issue-message: |
|
||||||
|
|||||||
@@ -17,15 +17,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: dessant/lock-threads@v5
|
- uses: dessant/lock-threads@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
process-only: 'issues'
|
process-only: 'issues'
|
||||||
issue-inactive-days: '60'
|
issue-lock-inactive-days: '60'
|
||||||
exclude-issue-created-before: ''
|
issue-exclude-created-before: ''
|
||||||
exclude-any-issue-labels: 'no-locking'
|
issue-exclude-labels: 'no-locking'
|
||||||
add-issue-labels: ''
|
issue-lock-labels: ''
|
||||||
issue-comment: >
|
issue-lock-comment: >
|
||||||
This issue has been automatically locked since there
|
This issue has been automatically locked since there
|
||||||
has not been any recent activity after it was closed.
|
has not been any recent activity after it was closed.
|
||||||
Please open a new issue for related bugs.
|
Please open a new issue for related bugs.
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Cache pip
|
- name: Cache pip
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pip
|
path: ~/.cache/pip
|
||||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||||
@@ -160,13 +160,13 @@ jobs:
|
|||||||
${{ runner.os }}-pip-
|
${{ runner.os }}-pip-
|
||||||
|
|
||||||
- name: Cache PlatformIO
|
- name: Cache PlatformIO
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio
|
path: ~/.platformio
|
||||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||||
|
|
||||||
- name: Select Python 3.9
|
- name: Select Python 3.9
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ CONTAINER_IMAGE := marlin-dev
|
|||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Tasks for local development:"
|
@echo "Tasks for local development:"
|
||||||
@echo "make marlin : Build marlin for the configured board"
|
@echo "* format-pins: Reformat all pins files"
|
||||||
@echo "make format-pins : Reformat all pins files"
|
@echo "* tests-single-ci: Run a single test from inside the CI"
|
||||||
@echo "make tests-single-ci : Run a single test from inside the CI"
|
@echo "* tests-single-local: Run a single test locally"
|
||||||
@echo "make tests-single-local : Run a single test locally"
|
@echo "* tests-single-local-docker: Run a single test locally, using docker"
|
||||||
@echo "make tests-single-local-docker : Run a single test locally, using docker"
|
@echo "* tests-all-local: Run all tests locally"
|
||||||
@echo "make tests-all-local : Run all tests locally"
|
@echo "* tests-all-local-docker: Run all tests locally, using docker"
|
||||||
@echo "make tests-all-local-docker : Run all tests locally, using docker"
|
@echo "* setup-local-docker: Build the local docker image"
|
||||||
@echo "make setup-local-docker : Build the local docker image"
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Options for testing:"
|
@echo "Options for testing:"
|
||||||
@echo " TEST_TARGET Set when running tests-single-*, to select the"
|
@echo " TEST_TARGET Set when running tests-single-*, to select the"
|
||||||
@@ -25,41 +24,46 @@ help:
|
|||||||
@echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
|
@echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
|
||||||
@echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
|
@echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
|
||||||
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
|
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
|
||||||
|
.PHONY: help
|
||||||
marlin:
|
|
||||||
./buildroot/bin/mftest -a
|
|
||||||
.PHONY: marlin
|
|
||||||
|
|
||||||
tests-single-ci:
|
tests-single-ci:
|
||||||
export GIT_RESET_HARD=true
|
export GIT_RESET_HARD=true
|
||||||
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) PLATFORMIO_BUILD_FLAGS=-DGITHUB_ACTION
|
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) PLATFORMIO_BUILD_FLAGS=-DGITHUB_ACTION
|
||||||
|
.PHONY: tests-single-ci
|
||||||
|
|
||||||
tests-single-local:
|
tests-single-local:
|
||||||
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
|
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
|
||||||
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
||||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||||
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
|
||||||
|
.PHONY: tests-single-local
|
||||||
|
|
||||||
tests-single-local-docker:
|
tests-single-local-docker:
|
||||||
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
|
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
|
||||||
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
||||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
|
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
|
||||||
|
.PHONY: tests-single-local-docker
|
||||||
|
|
||||||
tests-all-local:
|
tests-all-local:
|
||||||
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
|
||||||
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
|
||||||
&& for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
|
&& for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
|
||||||
|
.PHONY: tests-all-local
|
||||||
|
|
||||||
tests-all-local-docker:
|
tests-all-local-docker:
|
||||||
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
|
||||||
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
|
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
|
||||||
|
.PHONY: tests-all-local-docker
|
||||||
|
|
||||||
setup-local-docker:
|
setup-local-docker:
|
||||||
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
||||||
|
.PHONY: setup-local-docker
|
||||||
|
|
||||||
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
|
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
|
||||||
|
|
||||||
|
.PHONY: $(PINS)
|
||||||
|
|
||||||
$(PINS): %:
|
$(PINS): %:
|
||||||
@echo "Formatting $@" && node $(SCRIPTS_DIR)/pinsformat.js $@
|
@echo "Formatting $@" && node buildroot/share/scripts/pinsformat.js $@
|
||||||
|
|
||||||
format-pins: $(PINS)
|
format-pins: $(PINS)
|
||||||
|
|||||||
+458
-193
File diff suppressed because it is too large
Load Diff
+401
-230
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Marlin Firmware
|
Marlin Firmware
|
||||||
|
|
||||||
(c) 2011-2024 MarlinFirmware
|
(c) 2011-2023 MarlinFirmware
|
||||||
Portions of Marlin are (c) by their respective authors.
|
Portions of Marlin are (c) by their respective authors.
|
||||||
All code complies with GPLv2 and/or GPLv3
|
All code complies with GPLv2 and/or GPLv3
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@
|
|||||||
* here we define this default string as the date where the latest release
|
* here we define this default string as the date where the latest release
|
||||||
* version was tagged.
|
* version was tagged.
|
||||||
*/
|
*/
|
||||||
//#define STRING_DISTRIBUTION_DATE "2024-04-07"
|
//#define STRING_DISTRIBUTION_DATE "2024-01-09"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom Bitmap for splashscreen
|
||||||
|
*
|
||||||
|
* You may use one of the following tools to generate the C++ bitmap array from
|
||||||
|
* a black and white image:
|
||||||
|
*
|
||||||
|
* - http://www.marlinfw.org/tools/u8glib/converter.html
|
||||||
|
* - http://www.digole.com/tools/PicturetoC_Hex_converter.php
|
||||||
|
*/
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
|
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
||||||
|
#define CUSTOM_BOOTSCREEN_BMPWIDTH 60
|
||||||
|
#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64
|
||||||
|
|
||||||
|
const unsigned char custom_start_bmp[574] PROGMEM = {
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x12, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x23, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x4c, 0x80, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x5e, 0x80, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x92, 0x40, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0xa1, 0x40, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x1, 0x21, 0x20, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x2, 0x7f, 0x90, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x2, 0x0, 0x10, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x7, 0xff, 0xf8, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x4, 0x0, 0x8, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x8, 0x0, 0x4, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x8, 0x0, 0x6, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x10, 0x0, 0x2, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x30, 0x1e, 0x1, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x20, 0x7f, 0x81, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x41, 0xff, 0xe0, 0x80, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x43, 0xfc, 0xf0, 0x80, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x87, 0x3b, 0x78, 0x40, 0x0, 0x0,
|
||||||
|
0x0, 0x1, 0x8e, 0xdb, 0xfc, 0x60, 0x0, 0x0,
|
||||||
|
0x0, 0x1, 0xf, 0xeb, 0xcc, 0x20, 0x0, 0x0,
|
||||||
|
0x0, 0x2, 0x1f, 0xed, 0xb6, 0x10, 0x0, 0x0,
|
||||||
|
0x0, 0x2, 0x1f, 0xde, 0xb6, 0x10, 0x0, 0x0,
|
||||||
|
0x0, 0x4, 0x39, 0xcd, 0x7f, 0x8, 0x0, 0x0,
|
||||||
|
0x0, 0x4, 0x36, 0xe0, 0xff, 0x8, 0x0, 0x0,
|
||||||
|
0x0, 0x8, 0x7e, 0xc0, 0xbb, 0x84, 0x0, 0x0,
|
||||||
|
0x0, 0x18, 0x7f, 0x0, 0x5d, 0x86, 0x0, 0x0,
|
||||||
|
0x0, 0x10, 0x7f, 0xc0, 0xed, 0x82, 0x0, 0x0,
|
||||||
|
0x0, 0x20, 0x3c, 0xc0, 0x73, 0x1, 0x0, 0x0,
|
||||||
|
0x0, 0x20, 0x3b, 0x33, 0x7f, 0x1, 0x0, 0x0,
|
||||||
|
0x0, 0x70, 0x1b, 0xe7, 0x7e, 0x3, 0x80, 0x0,
|
||||||
|
0x0, 0xc8, 0x1d, 0xee, 0xde, 0x4, 0xc0, 0x0,
|
||||||
|
0x0, 0x88, 0xf, 0xde, 0xdc, 0x4, 0x40, 0x0,
|
||||||
|
0x1, 0x24, 0xf, 0xdf, 0x3c, 0x9, 0x20, 0x0,
|
||||||
|
0x1, 0x26, 0x7, 0xdb, 0xf8, 0x19, 0x20, 0x0,
|
||||||
|
0x2, 0x72, 0x3, 0xe7, 0xf0, 0x13, 0x90, 0x0,
|
||||||
|
0x2, 0x51, 0x1, 0xff, 0xe0, 0x22, 0x90, 0x0,
|
||||||
|
0x4, 0x89, 0x0, 0x7f, 0x80, 0x24, 0x48, 0x0,
|
||||||
|
0x9, 0x4, 0x80, 0x1e, 0x0, 0x48, 0x24, 0x0,
|
||||||
|
0xb, 0xfe, 0x40, 0x0, 0x0, 0xdf, 0xf4, 0x0,
|
||||||
|
0x10, 0x0, 0x40, 0x0, 0x0, 0x80, 0x2, 0x0,
|
||||||
|
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x10, 0x22, 0x10, 0x3c, 0x3c, 0xe, 0x1f, 0x0,
|
||||||
|
0x10, 0x22, 0x10, 0x4, 0x22, 0x11, 0x4, 0x0,
|
||||||
|
0x10, 0x22, 0x10, 0x8, 0x22, 0x11, 0x4, 0x0,
|
||||||
|
0x10, 0x22, 0x10, 0x8, 0x3c, 0x11, 0x4, 0x0,
|
||||||
|
0x10, 0x22, 0x10, 0x10, 0x22, 0x11, 0x4, 0x0,
|
||||||
|
0x10, 0x22, 0x10, 0x20, 0x22, 0x11, 0x4, 0x0,
|
||||||
|
0x1e, 0x1c, 0x1e, 0x3c, 0x3c, 0xe, 0x4, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||||
|
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
|
||||||
|
};
|
||||||
@@ -81,12 +81,6 @@ void MarlinHAL::init() {
|
|||||||
#if HAS_SERVO_3
|
#if HAS_SERVO_3
|
||||||
OUT_WRITE(SERVO3_PIN, LOW);
|
OUT_WRITE(SERVO3_PIN, LOW);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SERVO_4
|
|
||||||
OUT_WRITE(SERVO4_PIN, LOW);
|
|
||||||
#endif
|
|
||||||
#if HAS_SERVO_5
|
|
||||||
OUT_WRITE(SERVO5_PIN, LOW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
init_pwm_timers(); // Init user timers to default frequency - 1000HZ
|
init_pwm_timers(); // Init user timers to default frequency - 1000HZ
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ void spiBegin() {
|
|||||||
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** begin spi transaction */
|
/** begin spi transaction */
|
||||||
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
|
||||||
// Based on Arduino SPI library
|
// Based on Arduino SPI library
|
||||||
@@ -174,6 +175,7 @@ void spiBegin() {
|
|||||||
SPSR = clockDiv | 0x01;
|
SPSR = clockDiv | 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else // SOFTWARE_SPI || FORCE_SOFT_SPI
|
#else // SOFTWARE_SPI || FORCE_SOFT_SPI
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
static volatile int8_t Channel[_Nbr_16timers]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
|
static volatile int8_t Channel[_Nbr_16timers]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
|
||||||
|
|
||||||
|
|
||||||
/************ static functions common to all instances ***********************/
|
/************ static functions common to all instances ***********************/
|
||||||
|
|
||||||
static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
|
static inline void handle_interrupts(const timer16_Sequence_t timer, volatile uint16_t* TCNTn, volatile uint16_t* OCRnA) {
|
||||||
|
|||||||
@@ -35,14 +35,14 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
bool PersistentStore::access_start() { return true; }
|
bool PersistentStore::access_start() { return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
@@ -61,7 +61,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ void endstop_ISR() { endstops.update(); }
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Install Pin change interrupt for a pin. Can be called multiple times.
|
// Install Pin change interrupt for a pin. Can be called multiple times.
|
||||||
void pciSetup(const int8_t pin) {
|
void pciSetup(const int8_t pin) {
|
||||||
if (digitalPinHasPCICR(pin)) {
|
if (digitalPinHasPCICR(pin)) {
|
||||||
|
|||||||
@@ -679,6 +679,7 @@
|
|||||||
#define PF7_PWM 0
|
#define PF7_PWM 0
|
||||||
#define PF7_DDR DDRF
|
#define PF7_DDR DDRF
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
* Some of the pin mapping functions of the Teensduino extension to the Arduino IDE
|
||||||
* do not function the same as the other Arduino extensions.
|
* do not function the same as the other Arduino extensions.
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -163,6 +163,7 @@ bool pwm_status(uint8_t pin) {
|
|||||||
SERIAL_ECHO_SP(2);
|
SERIAL_ECHO_SP(2);
|
||||||
} // pwm_status
|
} // pwm_status
|
||||||
|
|
||||||
|
|
||||||
const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
||||||
{ &TCCR0A, &TCCR0B, &TIMSK0 },
|
{ &TCCR0A, &TCCR0B, &TIMSK0 },
|
||||||
{ &TCCR1A, &TCCR1B, &TIMSK1 },
|
{ &TCCR1A, &TCCR1B, &TIMSK1 },
|
||||||
@@ -180,6 +181,7 @@ const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
||||||
|
|
||||||
#ifdef TIMER0A
|
#ifdef TIMER0A
|
||||||
@@ -215,6 +217,7 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define TCCR_A(T) pgm_read_word(&PWM_other[T][0])
|
#define TCCR_A(T) pgm_read_word(&PWM_other[T][0])
|
||||||
#define TCCR_B(T) pgm_read_word(&PWM_other[T][1])
|
#define TCCR_B(T) pgm_read_word(&PWM_other[T][1])
|
||||||
#define TIMSK(T) pgm_read_word(&PWM_other[T][2])
|
#define TIMSK(T) pgm_read_word(&PWM_other[T][2])
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
|
|||||||
U8G_ATOMIC_END();
|
U8G_ATOMIC_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if ENABLED(FYSETC_MINI_12864)
|
#if ENABLED(FYSETC_MINI_12864)
|
||||||
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
|
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
// Public functions
|
// Public functions
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI)
|
#if ANY(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI)
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Software SPI
|
// Software SPI
|
||||||
|
|||||||
@@ -474,6 +474,7 @@ void MarlinSerial<Cfg>::flushTX() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If not using the USB port as serial port
|
// If not using the USB port as serial port
|
||||||
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
|
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
|
||||||
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
|
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
|
||||||
|
|||||||
@@ -958,14 +958,14 @@ static void ee_Init() {
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
bool PersistentStore::access_start() { ee_Init(); return true; }
|
bool PersistentStore::access_start() { ee_Init(); return true; }
|
||||||
bool PersistentStore::access_finish() { ee_Flush(); return true; }
|
bool PersistentStore::access_finish() { ee_Flush(); return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
if (v != ee_Read(uint32_t(p))) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != ee_Read(uint32_t(p))) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
ee_Write(uint32_t(p), v);
|
ee_Write(uint32_t(p), v);
|
||||||
@@ -984,7 +984,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = ee_Read(uint32_t(REAL_EEPROM_ADDR(pos)));
|
uint8_t c = ee_Read(uint32_t(pos));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -36,14 +36,14 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
@@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ extern volatile uint32_t *SODR_A, *SODR_B, *CODR_A, *CODR_B;
|
|||||||
|
|
||||||
#define PWM_MAP_INIT_ROW(IO,ZZ) { ZZ == 'A' ? SODR_A : SODR_B, ZZ == 'A' ? CODR_A : CODR_B, 1 << _PIN(IO) }
|
#define PWM_MAP_INIT_ROW(IO,ZZ) { ZZ == 'A' ? SODR_A : SODR_B, ZZ == 'A' ? CODR_A : CODR_B, 1 << _PIN(IO) }
|
||||||
|
|
||||||
|
|
||||||
#define PWM_MAP_INIT { PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_X_PIN, 'B'), \
|
#define PWM_MAP_INIT { PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_X_PIN, 'B'), \
|
||||||
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Y_PIN, 'B'), \
|
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Y_PIN, 'B'), \
|
||||||
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Z_PIN, 'B'), \
|
PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Z_PIN, 'B'), \
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ const G2_PinDescription G2_g_APinDescription[] = {
|
|||||||
{ PIOB, PIO_PB21, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 52
|
{ PIOB, PIO_PB21, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 52
|
||||||
{ PIOB, PIO_PB14, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 53
|
{ PIOB, PIO_PB14, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 53
|
||||||
|
|
||||||
|
|
||||||
// 54 .. 65 - Analog pins
|
// 54 .. 65 - Analog pins
|
||||||
// ----------------------
|
// ----------------------
|
||||||
{ PIOA, PIO_PA16X1_AD7, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NOT_ON_PWM, NOT_ON_TIMER }, // AD0
|
{ PIOA, PIO_PA16X1_AD7, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NOT_ON_PWM, NOT_ON_TIMER }, // AD0
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -72,10 +72,10 @@
|
|||||||
|
|
||||||
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
|
||||||
#if ENABLED(TMC_USE_SW_SPI)
|
#if ENABLED(TMC_USE_SW_SPI)
|
||||||
#if DISABLED(SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
#if DISABLED(DUE_SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
|
||||||
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
|
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
|
||||||
#endif
|
#endif
|
||||||
#elif ENABLED(SOFTWARE_SPI)
|
#elif ENABLED(DUE_SOFTWARE_SPI)
|
||||||
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#define SD_MOSI_PIN 75
|
#define SD_MOSI_PIN 75
|
||||||
#else
|
#else
|
||||||
// defaults
|
// defaults
|
||||||
#define SOFTWARE_SPI
|
#define DUE_SOFTWARE_SPI
|
||||||
#ifndef SD_SCK_PIN
|
#ifndef SD_SCK_PIN
|
||||||
#define SD_SCK_PIN 52
|
#define SD_SCK_PIN 52
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -142,6 +142,7 @@
|
|||||||
*/
|
*/
|
||||||
#define COMPILER_PACK_RESET() COMPILER_PRAGMA(pack())
|
#define COMPILER_PACK_RESET() COMPILER_PRAGMA(pack())
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set aligned boundary.
|
* \brief Set aligned boundary.
|
||||||
*/
|
*/
|
||||||
@@ -282,6 +283,7 @@ typedef double F64; //!< 64-bit floating-point number.
|
|||||||
typedef uint32_t iram_size_t;
|
typedef uint32_t iram_size_t;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Status Types
|
/*! \name Status Types
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -289,6 +291,7 @@ typedef bool Status_bool_t; //!< Boolean status.
|
|||||||
typedef U8 Status_t; //!< 8-bit-coded status.
|
typedef U8 Status_t; //!< 8-bit-coded status.
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Aliasing Aggregate Types
|
/*! \name Aliasing Aggregate Types
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -459,6 +462,7 @@ typedef struct
|
|||||||
#endif
|
#endif
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__ // not for assembling.
|
#ifndef __ASSEMBLY__ // not for assembling.
|
||||||
|
|
||||||
//! \name Optimization Control
|
//! \name Optimization Control
|
||||||
@@ -577,6 +581,7 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Zero-Bit Counting
|
/*! \name Zero-Bit Counting
|
||||||
*
|
*
|
||||||
* Under GCC, __builtin_clz and __builtin_ctz behave like macros when
|
* Under GCC, __builtin_clz and __builtin_ctz behave like macros when
|
||||||
@@ -687,6 +692,7 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Bit Reversing
|
/*! \name Bit Reversing
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -726,6 +732,7 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Alignment
|
/*! \name Alignment
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -791,6 +798,7 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
#define Long_call(addr) ((*(void (*)(void))(addr))())
|
#define Long_call(addr) ((*(void (*)(void))(addr))())
|
||||||
|
|
||||||
|
|
||||||
/*! \name MCU Endianism Handling
|
/*! \name MCU Endianism Handling
|
||||||
* ARM is MCU little endianism.
|
* ARM is MCU little endianism.
|
||||||
*/
|
*/
|
||||||
@@ -860,6 +868,7 @@ typedef struct
|
|||||||
#define CPU_TO_BE32(x) swap32(x)
|
#define CPU_TO_BE32(x) swap32(x)
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Endianism Conversion
|
/*! \name Endianism Conversion
|
||||||
*
|
*
|
||||||
* The same considerations as for clz and ctz apply here but GCC's
|
* The same considerations as for clz and ctz apply here but GCC's
|
||||||
@@ -946,6 +955,7 @@ typedef struct
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Target Abstraction
|
/*! \name Target Abstraction
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -987,6 +997,7 @@ typedef U8 Byte; //!< 8-bit unsigned integer.
|
|||||||
|
|
||||||
#endif // #ifndef __ASSEMBLY__
|
#endif // #ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
|
||||||
#ifdef __ICCARM__
|
#ifdef __ICCARM__
|
||||||
#define SHORTENUM __packed
|
#define SHORTENUM __packed
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
#define LUN_0_NAME "\"SD/MMC Card\""
|
#define LUN_0_NAME "\"SD/MMC Card\""
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/*! \name Actions Associated with Memory Accesses
|
/*! \name Actions Associated with Memory Accesses
|
||||||
*
|
*
|
||||||
* Write here the action to associate with each memory access.
|
* Write here the action to associate with each memory access.
|
||||||
@@ -111,4 +112,5 @@
|
|||||||
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
|
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#endif // _CONF_ACCESS_H_
|
#endif // _CONF_ACCESS_H_
|
||||||
|
|||||||
@@ -96,4 +96,5 @@
|
|||||||
// - UPLL frequency: 480MHz
|
// - UPLL frequency: 480MHz
|
||||||
// - USB clock: 480 / 1 = 480MHz
|
// - USB clock: 480 / 1 = 480MHz
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONF_CLOCK_H_INCLUDED */
|
#endif /* CONF_CLOCK_H_INCLUDED */
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
#endif
|
#endif
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USB Device Callbacks definitions (Optional)
|
* USB Device Callbacks definitions (Optional)
|
||||||
* @{
|
* @{
|
||||||
@@ -149,6 +150,7 @@
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USB Interface Configuration
|
* USB Interface Configuration
|
||||||
* @{
|
* @{
|
||||||
@@ -208,6 +210,7 @@
|
|||||||
//@}
|
//@}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration of MSC interface
|
* Configuration of MSC interface
|
||||||
* @{
|
* @{
|
||||||
@@ -242,6 +245,7 @@
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of Composite Device
|
* Description of Composite Device
|
||||||
* @{
|
* @{
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "ctrl_access.h"
|
#include "ctrl_access.h"
|
||||||
|
|
||||||
|
|
||||||
//_____ D E F I N I T I O N S ______________________________________________
|
//_____ D E F I N I T I O N S ______________________________________________
|
||||||
|
|
||||||
#ifdef FREERTOS_USED
|
#ifdef FREERTOS_USED
|
||||||
@@ -111,6 +112,7 @@ static xSemaphoreHandle ctrl_access_semphr = NULL;
|
|||||||
|
|
||||||
#endif // FREERTOS_USED
|
#endif // FREERTOS_USED
|
||||||
|
|
||||||
|
|
||||||
#if MAX_LUN
|
#if MAX_LUN
|
||||||
|
|
||||||
/*! \brief Initializes an entry of the LUN descriptor table.
|
/*! \brief Initializes an entry of the LUN descriptor table.
|
||||||
@@ -240,14 +242,17 @@ static const struct
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if GLOBAL_WR_PROTECT == true
|
#if GLOBAL_WR_PROTECT == true
|
||||||
bool g_wr_protect;
|
bool g_wr_protect;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*! \name Control Interface
|
/*! \name Control Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
#ifdef FREERTOS_USED
|
#ifdef FREERTOS_USED
|
||||||
|
|
||||||
bool ctrl_access_init(void)
|
bool ctrl_access_init(void)
|
||||||
@@ -265,6 +270,7 @@ bool ctrl_access_init(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Locks accesses to LUNs.
|
/*! \brief Locks accesses to LUNs.
|
||||||
*
|
*
|
||||||
* \return \c true if the access was successfully locked, else \c false.
|
* \return \c true if the access was successfully locked, else \c false.
|
||||||
@@ -282,6 +288,7 @@ static bool ctrl_access_lock(void)
|
|||||||
|
|
||||||
#endif // FREERTOS_USED
|
#endif // FREERTOS_USED
|
||||||
|
|
||||||
|
|
||||||
U8 get_nb_lun(void)
|
U8 get_nb_lun(void)
|
||||||
{
|
{
|
||||||
#if MEM_USB == ENABLE
|
#if MEM_USB == ENABLE
|
||||||
@@ -302,11 +309,13 @@ U8 get_nb_lun(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
U8 get_cur_lun(void)
|
U8 get_cur_lun(void)
|
||||||
{
|
{
|
||||||
return LUN_ID_0;
|
return LUN_ID_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status mem_test_unit_ready(U8 lun)
|
Ctrl_status mem_test_unit_ready(U8 lun)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -328,6 +337,7 @@ Ctrl_status mem_test_unit_ready(U8 lun)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
|
Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -349,6 +359,7 @@ Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
U8 mem_sector_size(U8 lun)
|
U8 mem_sector_size(U8 lun)
|
||||||
{
|
{
|
||||||
U8 sector_size;
|
U8 sector_size;
|
||||||
@@ -370,6 +381,7 @@ U8 mem_sector_size(U8 lun)
|
|||||||
return sector_size;
|
return sector_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool mem_unload(U8 lun, bool unload)
|
bool mem_unload(U8 lun, bool unload)
|
||||||
{
|
{
|
||||||
bool unloaded;
|
bool unloaded;
|
||||||
@@ -421,6 +433,7 @@ bool mem_wr_protect(U8 lun)
|
|||||||
return wr_protect;
|
return wr_protect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool mem_removal(U8 lun)
|
bool mem_removal(U8 lun)
|
||||||
{
|
{
|
||||||
bool removal;
|
bool removal;
|
||||||
@@ -445,6 +458,7 @@ bool mem_removal(U8 lun)
|
|||||||
return removal;
|
return removal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *mem_name(U8 lun)
|
const char *mem_name(U8 lun)
|
||||||
{
|
{
|
||||||
#if MAX_LUN==0
|
#if MAX_LUN==0
|
||||||
@@ -461,14 +475,17 @@ const char *mem_name(U8 lun)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_USB == true
|
#if ACCESS_USB == true
|
||||||
|
|
||||||
/*! \name MEM <-> USB Interface
|
/*! \name MEM <-> USB Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
|
Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -488,6 +505,7 @@ Ctrl_status memory_2_usb(U8 lun, U32 addr, U16 nb_sector)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
|
Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -507,16 +525,19 @@ Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
#endif // ACCESS_USB == true
|
#endif // ACCESS_USB == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_MEM_TO_RAM == true
|
#if ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
/*! \name MEM <-> RAM Interface
|
/*! \name MEM <-> RAM Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
|
Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -543,6 +564,7 @@ Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
|
Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
|
||||||
{
|
{
|
||||||
Ctrl_status status;
|
Ctrl_status status;
|
||||||
@@ -569,16 +591,19 @@ Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
#endif // ACCESS_MEM_TO_RAM == true
|
#endif // ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_STREAM == true
|
#if ACCESS_STREAM == true
|
||||||
|
|
||||||
/*! \name Streaming MEM <-> MEM Interface
|
/*! \name Streaming MEM <-> MEM Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_MEM_TO_MEM == true
|
#if ACCESS_MEM_TO_MEM == true
|
||||||
|
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
@@ -600,18 +625,21 @@ Ctrl_status stream_mem_to_mem(U8 src_lun, U32 src_addr, U8 dest_lun, U32 dest_ad
|
|||||||
|
|
||||||
#endif // ACCESS_MEM_TO_MEM == true
|
#endif // ACCESS_MEM_TO_MEM == true
|
||||||
|
|
||||||
|
|
||||||
Ctrl_status stream_state(U8 id)
|
Ctrl_status stream_state(U8 id)
|
||||||
{
|
{
|
||||||
UNUSED(id);
|
UNUSED(id);
|
||||||
return CTRL_GOOD;
|
return CTRL_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
U16 stream_stop(U8 id)
|
U16 stream_stop(U8 id)
|
||||||
{
|
{
|
||||||
UNUSED(id);
|
UNUSED(id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
#endif // ACCESS_STREAM
|
#endif // ACCESS_STREAM
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _CTRL_ACCESS_H_
|
#ifndef _CTRL_ACCESS_H_
|
||||||
#define _CTRL_ACCESS_H_
|
#define _CTRL_ACCESS_H_
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ typedef enum
|
|||||||
CTRL_BUSY = FAIL + 2 //!< Memory not initialized or changed.
|
CTRL_BUSY = FAIL + 2 //!< Memory not initialized or changed.
|
||||||
} Ctrl_status;
|
} Ctrl_status;
|
||||||
|
|
||||||
|
|
||||||
// FYI: Each Logical Unit Number (LUN) corresponds to a memory.
|
// FYI: Each Logical Unit Number (LUN) corresponds to a memory.
|
||||||
|
|
||||||
// Check LUN defines.
|
// Check LUN defines.
|
||||||
@@ -134,6 +136,7 @@ typedef enum
|
|||||||
#define LUN_ID_USB (MAX_LUN) //!< First dynamic LUN (USB host mass storage).
|
#define LUN_ID_USB (MAX_LUN) //!< First dynamic LUN (USB host mass storage).
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
// Include LUN header files.
|
// Include LUN header files.
|
||||||
#if LUN_0 == ENABLE
|
#if LUN_0 == ENABLE
|
||||||
#include LUN_0_INCLUDE
|
#include LUN_0_INCLUDE
|
||||||
@@ -163,11 +166,13 @@ typedef enum
|
|||||||
#include LUN_USB_INCLUDE
|
#include LUN_USB_INCLUDE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Check the configuration of write protection in conf_access.h.
|
// Check the configuration of write protection in conf_access.h.
|
||||||
#ifndef GLOBAL_WR_PROTECT
|
#ifndef GLOBAL_WR_PROTECT
|
||||||
#error GLOBAL_WR_PROTECT must be defined as true or false in conf_access.h
|
#error GLOBAL_WR_PROTECT must be defined as true or false in conf_access.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if GLOBAL_WR_PROTECT == true
|
#if GLOBAL_WR_PROTECT == true
|
||||||
|
|
||||||
//! Write protect.
|
//! Write protect.
|
||||||
@@ -175,6 +180,7 @@ extern bool g_wr_protect;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*! \name Control Interface
|
/*! \name Control Interface
|
||||||
*/
|
*/
|
||||||
//! @{
|
//! @{
|
||||||
@@ -273,6 +279,7 @@ extern const char *mem_name(U8 lun);
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_USB == true
|
#if ACCESS_USB == true
|
||||||
|
|
||||||
/*! \name MEM <-> USB Interface
|
/*! \name MEM <-> USB Interface
|
||||||
@@ -303,6 +310,7 @@ extern Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector);
|
|||||||
|
|
||||||
#endif // ACCESS_USB == true
|
#endif // ACCESS_USB == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_MEM_TO_RAM == true
|
#if ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
/*! \name MEM <-> RAM Interface
|
/*! \name MEM <-> RAM Interface
|
||||||
@@ -333,6 +341,7 @@ extern Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram);
|
|||||||
|
|
||||||
#endif // ACCESS_MEM_TO_RAM == true
|
#endif // ACCESS_MEM_TO_RAM == true
|
||||||
|
|
||||||
|
|
||||||
#if ACCESS_STREAM == true
|
#if ACCESS_STREAM == true
|
||||||
|
|
||||||
/*! \name Streaming MEM <-> MEM Interface
|
/*! \name Streaming MEM <-> MEM Interface
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
#include "preprocessor.h"
|
#include "preprocessor.h"
|
||||||
|
|
||||||
|
|
||||||
//! Maximal number of repetitions supported by MREPEAT.
|
//! Maximal number of repetitions supported by MREPEAT.
|
||||||
#define MREPEAT_LIMIT 256
|
#define MREPEAT_LIMIT 256
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ static inline void osc_enable(uint32_t ul_id) {
|
|||||||
pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS);
|
pmc_switch_sclk_to_32kxtal(PMC_OSC_BYPASS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case OSC_MAINCK_4M_RC:
|
case OSC_MAINCK_4M_RC:
|
||||||
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz);
|
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_4_MHz);
|
||||||
break;
|
break;
|
||||||
@@ -140,6 +141,7 @@ static inline void osc_enable(uint32_t ul_id) {
|
|||||||
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
|
pmc_switch_mainck_to_fastrc(CKGR_MOR_MOSCRCF_12_MHz);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case OSC_MAINCK_XTAL:
|
case OSC_MAINCK_XTAL:
|
||||||
pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*,
|
pmc_switch_mainck_to_xtal(PMC_OSC_XTAL/*,
|
||||||
pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US,
|
pmc_us_to_moscxtst(BOARD_OSC_STARTUP_US,
|
||||||
|
|||||||
@@ -51,4 +51,5 @@
|
|||||||
#include "stringz.h"
|
#include "stringz.h"
|
||||||
#include "mrepeat.h"
|
#include "mrepeat.h"
|
||||||
|
|
||||||
|
|
||||||
#endif // _PREPROCESSOR_H_
|
#endif // _PREPROCESSOR_H_
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ enum scsi_sbc_mode {
|
|||||||
SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page
|
SCSI_MS_MODE_CACHING = 0x08, //!< Caching mode page
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//! \name SBC-2 Device-Specific Parameter
|
//! \name SBC-2 Device-Specific Parameter
|
||||||
//@{
|
//@{
|
||||||
#define SCSI_MS_SBC_WP 0x80 //!< Write Protected
|
#define SCSI_MS_SBC_WP 0x80 //!< Write Protected
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
* Support and FAQ: visit <a href="https://www.atmel.com/design-support/">Atmel Support</a>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _SD_MMC_SPI_MEM_H_
|
#ifndef _SD_MMC_SPI_MEM_H_
|
||||||
#define _SD_MMC_SPI_MEM_H_
|
#define _SD_MMC_SPI_MEM_H_
|
||||||
|
|
||||||
@@ -62,14 +63,17 @@
|
|||||||
#error sd_mmc_spi_mem.h is #included although SD_MMC_SPI_MEM is disabled
|
#error sd_mmc_spi_mem.h is #included although SD_MMC_SPI_MEM is disabled
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "ctrl_access.h"
|
#include "ctrl_access.h"
|
||||||
|
|
||||||
|
|
||||||
//_____ D E F I N I T I O N S ______________________________________________
|
//_____ D E F I N I T I O N S ______________________________________________
|
||||||
|
|
||||||
#define SD_MMC_REMOVED 0
|
#define SD_MMC_REMOVED 0
|
||||||
#define SD_MMC_INSERTED 1
|
#define SD_MMC_INSERTED 1
|
||||||
#define SD_MMC_REMOVING 2
|
#define SD_MMC_REMOVING 2
|
||||||
|
|
||||||
|
|
||||||
//---- CONTROL FUNCTIONS ----
|
//---- CONTROL FUNCTIONS ----
|
||||||
//!
|
//!
|
||||||
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
|
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
|
||||||
@@ -129,6 +133,7 @@ extern bool sd_mmc_spi_wr_protect(void);
|
|||||||
//!
|
//!
|
||||||
extern bool sd_mmc_spi_removal(void);
|
extern bool sd_mmc_spi_removal(void);
|
||||||
|
|
||||||
|
|
||||||
//---- ACCESS DATA FUNCTIONS ----
|
//---- ACCESS DATA FUNCTIONS ----
|
||||||
|
|
||||||
#if ACCESS_USB == true
|
#if ACCESS_USB == true
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ extern "C" {
|
|||||||
#define CONFIG_USBCLK_DIV
|
#define CONFIG_USBCLK_DIV
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern void sysclk_enable_usb(void);
|
extern void sysclk_enable_usb(void);
|
||||||
extern void sysclk_disable_usb(void);
|
extern void sysclk_disable_usb(void);
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ static usb_iface_desc_t UDC_DESC_STORAGE *udc_ptr_iface;
|
|||||||
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! \name Internal structure to store the USB device main strings
|
//! \name Internal structure to store the USB device main strings
|
||||||
//! @{
|
//! @{
|
||||||
|
|
||||||
|
|||||||
@@ -685,4 +685,6 @@ usb_iface_desc_t UDC_DESC_STORAGE *udc_get_interface_desc(void);
|
|||||||
} \endcode
|
} \endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _UDC_H_
|
#endif // _UDC_H_
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ void udd_send_remotewakeup(void);
|
|||||||
*/
|
*/
|
||||||
void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size );
|
void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Endpoint Management
|
* \name Endpoint Management
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -457,6 +457,7 @@ void udi_cdc_data_sof_notify(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//------- Internal routines to control serial line
|
//------- Internal routines to control serial line
|
||||||
|
|
||||||
@@ -519,6 +520,7 @@ static void udi_cdc_ctrl_state_change(uint8_t port, bool b_set, le16_t bit_mask)
|
|||||||
udi_cdc_ctrl_state_notify(port, ep_comm);
|
udi_cdc_ctrl_state_notify(port, ep_comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
|
static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
#if UDI_CDC_PORT_NB == 1 // To optimize code
|
#if UDI_CDC_PORT_NB == 1 // To optimize code
|
||||||
@@ -540,6 +542,7 @@ static void udi_cdc_ctrl_state_notify(uint8_t port, udd_ep_id_t ep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_serial_state_msg_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
static void udi_cdc_serial_state_msg_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t port;
|
uint8_t port;
|
||||||
@@ -575,9 +578,11 @@ static void udi_cdc_serial_state_msg_sent(udd_ep_status_t status, iram_size_t n,
|
|||||||
udi_cdc_ctrl_state_notify(port, ep);
|
udi_cdc_ctrl_state_notify(port, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//------- Internal routines to process data transfer
|
//------- Internal routines to process data transfer
|
||||||
|
|
||||||
|
|
||||||
static bool udi_cdc_rx_start(uint8_t port)
|
static bool udi_cdc_rx_start(uint8_t port)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -627,6 +632,7 @@ static bool udi_cdc_rx_start(uint8_t port)
|
|||||||
udi_cdc_data_received);
|
udi_cdc_data_received);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t buf_sel_trans;
|
uint8_t buf_sel_trans;
|
||||||
@@ -662,6 +668,7 @@ static void udi_cdc_data_received(udd_ep_status_t status, iram_size_t n, udd_ep_
|
|||||||
udi_cdc_rx_start(port);
|
udi_cdc_rx_start(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t port;
|
uint8_t port;
|
||||||
@@ -693,6 +700,7 @@ static void udi_cdc_data_sent(udd_ep_status_t status, iram_size_t n, udd_ep_id_t
|
|||||||
udi_cdc_tx_send(port);
|
udi_cdc_tx_send(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udi_cdc_tx_send(uint8_t port)
|
static void udi_cdc_tx_send(uint8_t port)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -772,9 +780,11 @@ static void udi_cdc_tx_send(uint8_t port)
|
|||||||
udi_cdc_data_sent);
|
udi_cdc_data_sent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//------- Application interface
|
//------- Application interface
|
||||||
|
|
||||||
|
|
||||||
//------- Application interface
|
//------- Application interface
|
||||||
|
|
||||||
void udi_cdc_ctrl_signal_dcd(bool b_set)
|
void udi_cdc_ctrl_signal_dcd(bool b_set)
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ typedef struct {
|
|||||||
usb_ep_desc_t ep_notify;
|
usb_ep_desc_t ep_notify;
|
||||||
} udi_cdc_comm_desc_t;
|
} udi_cdc_comm_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Data Class interface descriptor
|
* \brief Data Class interface descriptor
|
||||||
*
|
*
|
||||||
@@ -120,6 +121,7 @@ typedef struct {
|
|||||||
usb_ep_desc_t ep_out;
|
usb_ep_desc_t ep_out;
|
||||||
} udi_cdc_data_desc_t;
|
} udi_cdc_data_desc_t;
|
||||||
|
|
||||||
|
|
||||||
//! CDC communication endpoints size for all speeds
|
//! CDC communication endpoints size for all speeds
|
||||||
#define UDI_CDC_COMM_EP_SIZE 64
|
#define UDI_CDC_COMM_EP_SIZE 64
|
||||||
//! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B)
|
//! CDC data endpoints size for FS speed (8B, 16B, 32B, 64B)
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
|
|||||||
.bNumConfigurations = 1
|
.bNumConfigurations = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
//! USB Device Qualifier Descriptor for HS
|
//! USB Device Qualifier Descriptor for HS
|
||||||
COMPILER_WORD_ALIGNED
|
COMPILER_WORD_ALIGNED
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {
|
|||||||
.bNumConfigurations = 1
|
.bNumConfigurations = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
//! USB Device Qualifier Descriptor for HS
|
//! USB Device Qualifier Descriptor for HS
|
||||||
COMPILER_WORD_ALIGNED
|
COMPILER_WORD_ALIGNED
|
||||||
@@ -146,6 +147,7 @@ UDC_DESC_STORAGE udc_desc_t udc_desc_hs = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name UDC structures which contains all USB Device definitions
|
* \name UDC structures which contains all USB Device definitions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ UDC_DESC_STORAGE udi_api_t udi_api_msc = {
|
|||||||
};
|
};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup udi_msc_group
|
* \ingroup udi_msc_group
|
||||||
* \defgroup udi_msc_group_internal Implementation of UDI MSC
|
* \defgroup udi_msc_group_internal Implementation of UDI MSC
|
||||||
@@ -136,6 +137,7 @@ volatile bool udi_msc_b_reset_trans = true;
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Internal routines
|
* \name Internal routines
|
||||||
*/
|
*/
|
||||||
@@ -188,6 +190,7 @@ static void udi_msc_cbw_received(udd_ep_status_t status,
|
|||||||
static bool udi_msc_cbw_validate(uint32_t alloc_len, uint8_t dir_flag);
|
static bool udi_msc_cbw_validate(uint32_t alloc_len, uint8_t dir_flag);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines to process small data packet
|
* \name Routines to process small data packet
|
||||||
*/
|
*/
|
||||||
@@ -214,6 +217,7 @@ static void udi_msc_data_sent(udd_ep_status_t status, iram_size_t nb_sent,
|
|||||||
udd_ep_id_t ep);
|
udd_ep_id_t ep);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines to process CSW packet
|
* \name Routines to process CSW packet
|
||||||
*/
|
*/
|
||||||
@@ -246,6 +250,7 @@ static void udi_msc_csw_sent(udd_ep_status_t status, iram_size_t nb_sent,
|
|||||||
udd_ep_id_t ep);
|
udd_ep_id_t ep);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines manage sense data
|
* \name Routines manage sense data
|
||||||
*/
|
*/
|
||||||
@@ -302,6 +307,7 @@ static void udi_msc_sense_fail_cdb_invalid(void);
|
|||||||
static void udi_msc_sense_command_invalid(void);
|
static void udi_msc_sense_command_invalid(void);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Routines manage SCSI Commands
|
* \name Routines manage SCSI Commands
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ do { \
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Power management routine.
|
* \name Power management routine.
|
||||||
*/
|
*/
|
||||||
@@ -309,6 +310,7 @@ static bool udd_b_idle;
|
|||||||
//! State of sleep manager
|
//! State of sleep manager
|
||||||
static bool udd_b_sleep_initialized = false;
|
static bool udd_b_sleep_initialized = false;
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Authorize or not the CPU powerdown mode
|
/*! \brief Authorize or not the CPU powerdown mode
|
||||||
*
|
*
|
||||||
* \param b_enable true to authorize idle mode
|
* \param b_enable true to authorize idle mode
|
||||||
@@ -336,6 +338,7 @@ static void udd_sleep_mode(bool b_idle)
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Control endpoint low level management routine.
|
* \name Control endpoint low level management routine.
|
||||||
*
|
*
|
||||||
@@ -407,6 +410,7 @@ static void udd_ctrl_send_zlp_out(void);
|
|||||||
//! \brief Call callback associated to setup request
|
//! \brief Call callback associated to setup request
|
||||||
static void udd_ctrl_endofrequest(void);
|
static void udd_ctrl_endofrequest(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Main interrupt routine for control endpoint
|
* \brief Main interrupt routine for control endpoint
|
||||||
*
|
*
|
||||||
@@ -418,6 +422,7 @@ static bool udd_ctrl_interrupt(void);
|
|||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Management of bulk/interrupt/isochronous endpoints
|
* \name Management of bulk/interrupt/isochronous endpoints
|
||||||
*
|
*
|
||||||
@@ -455,6 +460,7 @@ typedef struct {
|
|||||||
uint8_t stall_requested:1;
|
uint8_t stall_requested:1;
|
||||||
} udd_ep_job_t;
|
} udd_ep_job_t;
|
||||||
|
|
||||||
|
|
||||||
//! Array to register a job on bulk/interrupt/isochronous endpoint
|
//! Array to register a job on bulk/interrupt/isochronous endpoint
|
||||||
static udd_ep_job_t udd_ep_job[USB_DEVICE_MAX_EP];
|
static udd_ep_job_t udd_ep_job[USB_DEVICE_MAX_EP];
|
||||||
|
|
||||||
@@ -516,6 +522,7 @@ static bool udd_ep_interrupt(void);
|
|||||||
#endif // (0!=USB_DEVICE_MAX_EP)
|
#endif // (0!=USB_DEVICE_MAX_EP)
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//--- INTERNAL ROUTINES TO MANAGED GLOBAL EVENTS
|
//--- INTERNAL ROUTINES TO MANAGED GLOBAL EVENTS
|
||||||
|
|
||||||
@@ -664,11 +671,13 @@ udd_interrupt_sof_end:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_include_vbus_monitoring(void)
|
bool udd_include_vbus_monitoring(void)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_enable(void)
|
void udd_enable(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -755,6 +764,7 @@ void udd_enable(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_disable(void)
|
void udd_disable(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -856,6 +866,7 @@ void udd_attach(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_detach(void)
|
void udd_detach(void)
|
||||||
{
|
{
|
||||||
otg_unfreeze_clock();
|
otg_unfreeze_clock();
|
||||||
@@ -872,6 +883,7 @@ void udd_detach(void)
|
|||||||
udd_sleep_mode(false);
|
udd_sleep_mode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_is_high_speed(void)
|
bool udd_is_high_speed(void)
|
||||||
{
|
{
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
@@ -881,6 +893,7 @@ bool udd_is_high_speed(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_set_address(uint8_t address)
|
void udd_set_address(uint8_t address)
|
||||||
{
|
{
|
||||||
udd_disable_address();
|
udd_disable_address();
|
||||||
@@ -888,11 +901,13 @@ void udd_set_address(uint8_t address)
|
|||||||
udd_enable_address();
|
udd_enable_address();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t udd_getaddress(void)
|
uint8_t udd_getaddress(void)
|
||||||
{
|
{
|
||||||
return udd_get_configured_address();
|
return udd_get_configured_address();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint16_t udd_get_frame_number(void)
|
uint16_t udd_get_frame_number(void)
|
||||||
{
|
{
|
||||||
return udd_frame_number();
|
return udd_frame_number();
|
||||||
@@ -915,12 +930,14 @@ void udd_send_remotewakeup(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size)
|
void udd_set_setup_payload(uint8_t *payload, uint16_t payload_size)
|
||||||
{
|
{
|
||||||
udd_g_ctrlreq.payload = payload;
|
udd_g_ctrlreq.payload = payload;
|
||||||
udd_g_ctrlreq.payload_size = payload_size;
|
udd_g_ctrlreq.payload_size = payload_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (0 != USB_DEVICE_MAX_EP)
|
#if (0 != USB_DEVICE_MAX_EP)
|
||||||
bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
|
bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
|
||||||
uint16_t MaxEndpointSize)
|
uint16_t MaxEndpointSize)
|
||||||
@@ -1044,6 +1061,7 @@ bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_ep_free(udd_ep_id_t ep)
|
void udd_ep_free(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1056,12 +1074,14 @@ void udd_ep_free(udd_ep_id_t ep)
|
|||||||
udd_ep_job[ep_index - 1].stall_requested = false;
|
udd_ep_job[ep_index - 1].stall_requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_is_halted(udd_ep_id_t ep)
|
bool udd_ep_is_halted(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
return Is_udd_endpoint_stall_requested(ep_index);
|
return Is_udd_endpoint_stall_requested(ep_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_set_halt(udd_ep_id_t ep)
|
bool udd_ep_set_halt(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1102,6 +1122,7 @@ bool udd_ep_set_halt(udd_ep_id_t ep)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_clear_halt(udd_ep_id_t ep)
|
bool udd_ep_clear_halt(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1142,6 +1163,7 @@ bool udd_ep_clear_halt(udd_ep_id_t ep)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
|
bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
|
||||||
uint8_t * buf, iram_size_t buf_size,
|
uint8_t * buf, iram_size_t buf_size,
|
||||||
udd_callback_trans_t callback)
|
udd_callback_trans_t callback)
|
||||||
@@ -1208,6 +1230,7 @@ bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_ep_abort(udd_ep_id_t ep)
|
void udd_ep_abort(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
uint8_t ep_index = ep & USB_EP_ADDR_MASK;
|
||||||
@@ -1236,6 +1259,7 @@ void udd_ep_abort(udd_ep_id_t ep)
|
|||||||
udd_ep_abort_job(ep);
|
udd_ep_abort_job(ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
|
bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
|
||||||
udd_callback_halt_cleared_t callback)
|
udd_callback_halt_cleared_t callback)
|
||||||
{
|
{
|
||||||
@@ -1270,6 +1294,7 @@ bool udd_ep_wait_stall_clear(udd_ep_id_t ep,
|
|||||||
}
|
}
|
||||||
#endif // (0 != USB_DEVICE_MAX_EP)
|
#endif // (0 != USB_DEVICE_MAX_EP)
|
||||||
|
|
||||||
|
|
||||||
#ifdef USB_DEVICE_HS_SUPPORT
|
#ifdef USB_DEVICE_HS_SUPPORT
|
||||||
|
|
||||||
void udd_test_mode_j(void)
|
void udd_test_mode_j(void)
|
||||||
@@ -1278,17 +1303,20 @@ void udd_test_mode_j(void)
|
|||||||
udd_enable_hs_test_mode_j();
|
udd_enable_hs_test_mode_j();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_test_mode_k(void)
|
void udd_test_mode_k(void)
|
||||||
{
|
{
|
||||||
udd_enable_hs_test_mode();
|
udd_enable_hs_test_mode();
|
||||||
udd_enable_hs_test_mode_k();
|
udd_enable_hs_test_mode_k();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_test_mode_se0_nak(void)
|
void udd_test_mode_se0_nak(void)
|
||||||
{
|
{
|
||||||
udd_enable_hs_test_mode();
|
udd_enable_hs_test_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void udd_test_mode_packet(void)
|
void udd_test_mode_packet(void)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
@@ -1332,6 +1360,8 @@ void udd_test_mode_packet(void)
|
|||||||
}
|
}
|
||||||
#endif // USB_DEVICE_HS_SUPPORT
|
#endif // USB_DEVICE_HS_SUPPORT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//--- INTERNAL ROUTINES TO MANAGED THE CONTROL ENDPOINT
|
//--- INTERNAL ROUTINES TO MANAGED THE CONTROL ENDPOINT
|
||||||
|
|
||||||
@@ -1381,6 +1411,7 @@ static void udd_ctrl_init(void)
|
|||||||
udd_ep_control_state = UDD_EPCTRL_SETUP;
|
udd_ep_control_state = UDD_EPCTRL_SETUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_setup_received(void)
|
static void udd_ctrl_setup_received(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1442,6 +1473,7 @@ static void udd_ctrl_setup_received(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_in_sent(void)
|
static void udd_ctrl_in_sent(void)
|
||||||
{
|
{
|
||||||
static bool b_shortpacket = false;
|
static bool b_shortpacket = false;
|
||||||
@@ -1525,6 +1557,7 @@ static void udd_ctrl_in_sent(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_out_received(void)
|
static void udd_ctrl_out_received(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1615,6 +1648,7 @@ static void udd_ctrl_out_received(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_underflow(void)
|
static void udd_ctrl_underflow(void)
|
||||||
{
|
{
|
||||||
if (Is_udd_out_received(0))
|
if (Is_udd_out_received(0))
|
||||||
@@ -1631,6 +1665,7 @@ static void udd_ctrl_underflow(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_overflow(void)
|
static void udd_ctrl_overflow(void)
|
||||||
{
|
{
|
||||||
if (Is_udd_in_send(0))
|
if (Is_udd_in_send(0))
|
||||||
@@ -1646,6 +1681,7 @@ static void udd_ctrl_overflow(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_stall_data(void)
|
static void udd_ctrl_stall_data(void)
|
||||||
{
|
{
|
||||||
// Stall all packets on IN & OUT control endpoint
|
// Stall all packets on IN & OUT control endpoint
|
||||||
@@ -1653,6 +1689,7 @@ static void udd_ctrl_stall_data(void)
|
|||||||
udd_enable_stall_handshake(0);
|
udd_enable_stall_handshake(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_send_zlp_in(void)
|
static void udd_ctrl_send_zlp_in(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1670,6 +1707,7 @@ static void udd_ctrl_send_zlp_in(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_send_zlp_out(void)
|
static void udd_ctrl_send_zlp_out(void)
|
||||||
{
|
{
|
||||||
irqflags_t flags;
|
irqflags_t flags;
|
||||||
@@ -1685,6 +1723,7 @@ static void udd_ctrl_send_zlp_out(void)
|
|||||||
cpu_irq_restore(flags);
|
cpu_irq_restore(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ctrl_endofrequest(void)
|
static void udd_ctrl_endofrequest(void)
|
||||||
{
|
{
|
||||||
// If a callback is registered then call it
|
// If a callback is registered then call it
|
||||||
@@ -1693,6 +1732,7 @@ static void udd_ctrl_endofrequest(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool udd_ctrl_interrupt(void)
|
static bool udd_ctrl_interrupt(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1743,6 +1783,7 @@ static bool udd_ctrl_interrupt(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//--- INTERNAL ROUTINES TO MANAGED THE BULK/INTERRUPT/ISOCHRONOUS ENDPOINTS
|
//--- INTERNAL ROUTINES TO MANAGED THE BULK/INTERRUPT/ISOCHRONOUS ENDPOINTS
|
||||||
|
|
||||||
@@ -1757,6 +1798,7 @@ static void udd_ep_job_table_reset(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ep_job_table_kill(void)
|
static void udd_ep_job_table_kill(void)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
@@ -1767,6 +1809,7 @@ static void udd_ep_job_table_kill(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ep_abort_job(udd_ep_id_t ep)
|
static void udd_ep_abort_job(udd_ep_id_t ep)
|
||||||
{
|
{
|
||||||
ep &= USB_EP_ADDR_MASK;
|
ep &= USB_EP_ADDR_MASK;
|
||||||
@@ -1775,6 +1818,7 @@ static void udd_ep_abort_job(udd_ep_id_t ep)
|
|||||||
udd_ep_finish_job(&udd_ep_job[ep - 1], true, ep);
|
udd_ep_finish_job(&udd_ep_job[ep - 1], true, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void udd_ep_finish_job(udd_ep_job_t * ptr_job, bool b_abort, uint8_t ep_num)
|
static void udd_ep_finish_job(udd_ep_job_t * ptr_job, bool b_abort, uint8_t ep_num)
|
||||||
{
|
{
|
||||||
if (ptr_job->busy == false) {
|
if (ptr_job->busy == false) {
|
||||||
@@ -1845,6 +1889,7 @@ static void udd_ep_trans_done(udd_ep_id_t ep)
|
|||||||
udd_dma_ctrl |= UOTGHS_DEVDMACONTROL_END_BUFFIT |
|
udd_dma_ctrl |= UOTGHS_DEVDMACONTROL_END_BUFFIT |
|
||||||
UOTGHS_DEVDMACONTROL_CHANN_ENB;
|
UOTGHS_DEVDMACONTROL_CHANN_ENB;
|
||||||
|
|
||||||
|
|
||||||
// Disable IRQs to have a short sequence
|
// Disable IRQs to have a short sequence
|
||||||
// between read of EOT_STA and DMA enable
|
// between read of EOT_STA and DMA enable
|
||||||
flags = cpu_irq_save();
|
flags = cpu_irq_save();
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ extern "C" {
|
|||||||
#define Is_udd_vbus_transition() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUSTI))
|
#define Is_udd_vbus_transition() (Tst_bits(UOTGHS->UOTGHS_SR, UOTGHS_SR_VBUSTI))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS device attach control
|
//! @name UOTGHS device attach control
|
||||||
//! These macros manage the UOTGHS Device attach.
|
//! These macros manage the UOTGHS Device attach.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -140,6 +141,7 @@ extern "C" {
|
|||||||
#define Is_udd_detached() (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
|
#define Is_udd_detached() (Tst_bits(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_DETACH))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS device bus events control
|
//! @name UOTGHS device bus events control
|
||||||
//! These macros manage the UOTGHS Device bus events.
|
//! These macros manage the UOTGHS Device bus events.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -244,6 +246,7 @@ extern "C" {
|
|||||||
#define udd_get_configured_address() (Rd_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_UADD_Msk))
|
#define udd_get_configured_address() (Rd_bitfield(UOTGHS->UOTGHS_DEVCTRL, UOTGHS_DEVCTRL_UADD_Msk))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS Device endpoint drivers
|
//! @name UOTGHS Device endpoint drivers
|
||||||
//! These macros manage the common features of the endpoints.
|
//! These macros manage the common features of the endpoints.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -327,6 +330,7 @@ extern "C" {
|
|||||||
#define udd_data_toggle(ep) (Rd_bitfield(UOTGHS_ARRAY(UOTGHS_DEVEPTISR[0], ep), UOTGHS_DEVEPTISR_DTSEQ_Msk))
|
#define udd_data_toggle(ep) (Rd_bitfield(UOTGHS_ARRAY(UOTGHS_DEVEPTISR[0], ep), UOTGHS_DEVEPTISR_DTSEQ_Msk))
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS Device control endpoint
|
//! @name UOTGHS Device control endpoint
|
||||||
//! These macros control the endpoints.
|
//! These macros control the endpoints.
|
||||||
//! @{
|
//! @{
|
||||||
@@ -526,6 +530,7 @@ extern "C" {
|
|||||||
//! Tests if IN sending interrupt is enabled
|
//! Tests if IN sending interrupt is enabled
|
||||||
#define Is_udd_in_send_interrupt_enabled(ep) (Tst_bits(UOTGHS_ARRAY(UOTGHS_DEVEPTIMR[0], ep), UOTGHS_DEVEPTIMR_TXINE))
|
#define Is_udd_in_send_interrupt_enabled(ep) (Tst_bits(UOTGHS_ARRAY(UOTGHS_DEVEPTIMR[0], ep), UOTGHS_DEVEPTIMR_TXINE))
|
||||||
|
|
||||||
|
|
||||||
//! Get 64-, 32-, 16- or 8-bit access to FIFO data register of selected endpoint.
|
//! Get 64-, 32-, 16- or 8-bit access to FIFO data register of selected endpoint.
|
||||||
//! @param ep Endpoint of which to access FIFO data register
|
//! @param ep Endpoint of which to access FIFO data register
|
||||||
//! @param scale Data scale in bits: 64, 32, 16 or 8
|
//! @param scale Data scale in bits: 64, 32, 16 or 8
|
||||||
@@ -647,6 +652,7 @@ typedef struct {
|
|||||||
//! @}
|
//! @}
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
|
||||||
/// @cond 0
|
/// @cond 0
|
||||||
/**INDENT-OFF**/
|
/**INDENT-OFF**/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//! \ingroup usb_group
|
//! \ingroup usb_group
|
||||||
//! \defgroup otg_group UOTGHS OTG Driver
|
//! \defgroup otg_group UOTGHS OTG Driver
|
||||||
//! UOTGHS low-level driver for OTG features
|
//! UOTGHS low-level driver for OTG features
|
||||||
@@ -73,6 +74,7 @@ bool otg_dual_enable(void);
|
|||||||
*/
|
*/
|
||||||
void otg_dual_disable(void);
|
void otg_dual_disable(void);
|
||||||
|
|
||||||
|
|
||||||
//! @name UOTGHS OTG ID pin management
|
//! @name UOTGHS OTG ID pin management
|
||||||
//! The ID pin come from the USB OTG connector (A and B receptable) and
|
//! The ID pin come from the USB OTG connector (A and B receptable) and
|
||||||
//! allows to select the USB mode host or device.
|
//! allows to select the USB mode host or device.
|
||||||
|
|||||||
@@ -374,6 +374,7 @@ typedef struct {
|
|||||||
uint8_t bNumDeviceCaps;
|
uint8_t bNumDeviceCaps;
|
||||||
} usb_dev_bos_desc_t;
|
} usb_dev_bos_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief USB Device Capabilities - USB 2.0 Extension Descriptor structure
|
* \brief USB Device Capabilities - USB 2.0 Extension Descriptor structure
|
||||||
*
|
*
|
||||||
@@ -410,6 +411,7 @@ typedef struct {
|
|||||||
uint8_t iFunction; //!< Index of string descriptor
|
uint8_t iFunction; //!< Index of string descriptor
|
||||||
} usb_association_desc_t;
|
} usb_association_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Standard USB configuration descriptor structure
|
* \brief Standard USB configuration descriptor structure
|
||||||
*/
|
*/
|
||||||
@@ -424,6 +426,7 @@ typedef struct {
|
|||||||
uint8_t bMaxPower;
|
uint8_t bMaxPower;
|
||||||
} usb_conf_desc_t;
|
} usb_conf_desc_t;
|
||||||
|
|
||||||
|
|
||||||
#define USB_CONFIG_ATTR_MUST_SET (1 << 7) //!< Must always be set
|
#define USB_CONFIG_ATTR_MUST_SET (1 << 7) //!< Must always be set
|
||||||
#define USB_CONFIG_ATTR_BUS_POWERED (0 << 6) //!< Bus-powered
|
#define USB_CONFIG_ATTR_BUS_POWERED (0 << 6) //!< Bus-powered
|
||||||
#define USB_CONFIG_ATTR_SELF_POWERED (1 << 6) //!< Self-powered
|
#define USB_CONFIG_ATTR_SELF_POWERED (1 << 6) //!< Self-powered
|
||||||
@@ -472,6 +475,7 @@ typedef struct {
|
|||||||
uint8_t bInterval;
|
uint8_t bInterval;
|
||||||
} usb_ep_desc_t;
|
} usb_ep_desc_t;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A standard USB string descriptor structure
|
* \brief A standard USB string descriptor structure
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ COMPILER_PACK_SET(1)
|
|||||||
//! \name USB CDC Descriptors
|
//! \name USB CDC Descriptors
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
|
||||||
//! CDC Header Functional Descriptor
|
//! CDC Header Functional Descriptor
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t bFunctionLength;
|
uint8_t bFunctionLength;
|
||||||
@@ -202,6 +203,7 @@ typedef struct {
|
|||||||
uint8_t bSlaveInterface0;
|
uint8_t bSlaveInterface0;
|
||||||
} usb_cdc_union_desc_t;
|
} usb_cdc_union_desc_t;
|
||||||
|
|
||||||
|
|
||||||
//! \name USB CDC Call Management Capabilities
|
//! \name USB CDC Call Management Capabilities
|
||||||
//@{
|
//@{
|
||||||
//! Device handles call management itself
|
//! Device handles call management itself
|
||||||
@@ -276,6 +278,7 @@ typedef struct {
|
|||||||
//@}
|
//@}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
//! \name USB CDC notification message
|
//! \name USB CDC notification message
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#ifndef _USB_PROTOCOL_MSC_H_
|
#ifndef _USB_PROTOCOL_MSC_H_
|
||||||
#define _USB_PROTOCOL_MSC_H_
|
#define _USB_PROTOCOL_MSC_H_
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup usb_protocol_group
|
* \ingroup usb_protocol_group
|
||||||
* \defgroup usb_msc_protocol USB Mass Storage Class (MSC) protocol definitions
|
* \defgroup usb_msc_protocol USB Mass Storage Class (MSC) protocol definitions
|
||||||
@@ -88,6 +89,7 @@
|
|||||||
#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only
|
#define MSC_PROTOCOL_BULK 0x50 //!< Bulk-only
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief MSC USB requests (bRequest)
|
* \brief MSC USB requests (bRequest)
|
||||||
*/
|
*/
|
||||||
@@ -96,6 +98,7 @@ enum usb_reqid_msc {
|
|||||||
USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN
|
USB_REQ_MSC_GET_MAX_LUN = 0xFE //!< Get Max LUN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
COMPILER_PACK_SET(1)
|
COMPILER_PACK_SET(1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,6 +122,7 @@ struct usb_msc_cbw {
|
|||||||
#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength
|
#define USB_CBW_LEN_MASK 0x1F //!< Valid bits in bCBWCBLength
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name A Command Status Wrapper (CSW).
|
* \name A Command Status Wrapper (CSW).
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,28 +31,24 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { return EEPROM.begin(MARLIN_EEPROM_SIZE); }
|
bool PersistentStore::access_start() { return EEPROM.begin(MARLIN_EEPROM_SIZE); }
|
||||||
bool PersistentStore::access_finish() { EEPROM.end(); return true; }
|
bool PersistentStore::access_finish() { EEPROM.end(); return true; }
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
const int p = REAL_EEPROM_ADDR(pos);
|
EEPROM.write(pos++, value[i]);
|
||||||
EEPROM.write(p, value[i]);
|
|
||||||
crc16(crc, &value[i], 1);
|
crc16(crc, &value[i], 1);
|
||||||
++pos;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
const int p = REAL_EEPROM_ADDR(pos);
|
uint8_t c = EEPROM.read(pos++);
|
||||||
uint8_t c = EEPROM.read(p);
|
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
++pos;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Not every MarlinSerial instance should handle emergency parsing, as
|
* Not every MarlinSerial instance should handle emergency parsing, as
|
||||||
* it would not make sense to parse G-Code from TMC responses
|
* it would not make sense to parse GCode from TMC responses
|
||||||
*/
|
*/
|
||||||
constexpr bool serial_handles_emergency(int port) {
|
constexpr bool serial_handles_emergency(int port) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
eeprom_init();
|
eeprom_init();
|
||||||
@@ -49,7 +49,7 @@ bool PersistentStore::access_finish() { return true; }
|
|||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t *const p = (uint8_t *const)pos;
|
||||||
|
|
||||||
// EEPROM has only ~100,000 write cycles,
|
// EEPROM has only ~100,000 write cycles,
|
||||||
// so only write bytes that have changed!
|
// so only write bytes that have changed!
|
||||||
@@ -70,10 +70,16 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size,
|
||||||
|
uint16_t *crc, const bool writing /*=true*/) {
|
||||||
do {
|
do {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
uint8_t *const p = (uint8_t *const)pos;
|
||||||
if (writing) *value = c;
|
uint8_t c = eeprom_read_byte(p);
|
||||||
|
if (writing)
|
||||||
|
{
|
||||||
|
*value = c;
|
||||||
|
}
|
||||||
|
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
value++;
|
value++;
|
||||||
|
|||||||
@@ -38,7 +38,9 @@
|
|||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() {
|
||||||
|
return MARLIN_EEPROM_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
#define _ALIGN(x) __attribute__((aligned(x)))
|
#define _ALIGN(x) __attribute__((aligned(x)))
|
||||||
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
||||||
@@ -83,10 +85,11 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
const uint8_t c = HAL_eeprom_data[pos + i];
|
uint8_t c = HAL_eeprom_data[pos + i];
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += size;
|
pos += size;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ bool PersistentStore::access_start() {
|
|||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t *const p = (uint8_t *const)pos;
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
// EEPROM has only ~100,000 write cycles,
|
// EEPROM has only ~100,000 write cycles,
|
||||||
// so only write bytes that have changed!
|
// so only write bytes that have changed!
|
||||||
@@ -77,8 +77,10 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
||||||
do {
|
do {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t *)REAL_EEPROM_ADDR(pos));
|
uint8_t c = eeprom_read_byte((uint8_t *)pos);
|
||||||
if (writing && value) *value = c;
|
if (writing && value) {
|
||||||
|
*value = c;
|
||||||
|
}
|
||||||
|
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -40,15 +40,9 @@ void endstopIRQHandler() {
|
|||||||
CHECK(X_MAX);
|
CHECK(X_MAX);
|
||||||
CHECK(X_MIN);
|
CHECK(X_MIN);
|
||||||
|
|
||||||
CHECK(X2_MAX);
|
|
||||||
CHECK(X2_MIN);
|
|
||||||
|
|
||||||
CHECK(Y_MAX);
|
CHECK(Y_MAX);
|
||||||
CHECK(Y_MIN);
|
CHECK(Y_MIN);
|
||||||
|
|
||||||
CHECK(Y2_MAX);
|
|
||||||
CHECK(Y2_MIN);
|
|
||||||
|
|
||||||
CHECK(Z_MAX);
|
CHECK(Z_MAX);
|
||||||
CHECK(Z_MIN);
|
CHECK(Z_MIN);
|
||||||
|
|
||||||
@@ -58,9 +52,6 @@ void endstopIRQHandler() {
|
|||||||
CHECK(Z3_MAX);
|
CHECK(Z3_MAX);
|
||||||
CHECK(Z3_MIN);
|
CHECK(Z3_MIN);
|
||||||
|
|
||||||
CHECK(Z4_MAX);
|
|
||||||
CHECK(Z4_MIN);
|
|
||||||
|
|
||||||
CHECK(Z_MIN_PROBE);
|
CHECK(Z_MIN_PROBE);
|
||||||
|
|
||||||
// Update endstops
|
// Update endstops
|
||||||
@@ -78,15 +69,9 @@ void setup_endstop_interrupts() {
|
|||||||
SETUP(X_MAX);
|
SETUP(X_MAX);
|
||||||
SETUP(X_MIN);
|
SETUP(X_MIN);
|
||||||
|
|
||||||
SETUP(X2_MAX);
|
|
||||||
SETUP(X2_MIN);
|
|
||||||
|
|
||||||
SETUP(Y_MAX);
|
SETUP(Y_MAX);
|
||||||
SETUP(Y_MIN);
|
SETUP(Y_MIN);
|
||||||
|
|
||||||
SETUP(Y2_MAX);
|
|
||||||
SETUP(Y2_MIN);
|
|
||||||
|
|
||||||
SETUP(Z_MAX);
|
SETUP(Z_MAX);
|
||||||
SETUP(Z_MIN);
|
SETUP(Z_MIN);
|
||||||
|
|
||||||
@@ -96,9 +81,6 @@ void setup_endstop_interrupts() {
|
|||||||
SETUP(Z3_MAX);
|
SETUP(Z3_MAX);
|
||||||
SETUP(Z3_MIN);
|
SETUP(Z3_MIN);
|
||||||
|
|
||||||
SETUP(Z4_MAX);
|
|
||||||
SETUP(Z4_MIN);
|
|
||||||
|
|
||||||
SETUP(Z_MIN_PROBE);
|
SETUP(Z_MIN_PROBE);
|
||||||
|
|
||||||
#undef SETUP
|
#undef SETUP
|
||||||
@@ -106,7 +88,7 @@ void setup_endstop_interrupts() {
|
|||||||
|
|
||||||
// Ensure 1 - 10 IRQs are registered
|
// Ensure 1 - 10 IRQs are registered
|
||||||
// Disable some endstops if you encounter this error
|
// Disable some endstops if you encounter this error
|
||||||
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE)
|
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_Y_MAX, USE_Y_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z_MIN_PROBE)
|
||||||
#if ENDSTOPS_INTERRUPTS_COUNT > 10
|
#if ENDSTOPS_INTERRUPTS_COUNT > 10
|
||||||
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
|
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
|
||||||
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
|
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -58,9 +58,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TEMP_SENSOR_SOC
|
#if TEMP_SENSOR_SOC
|
||||||
#ifndef TEMP_SOC_PIN
|
#if !defined(TEMP_SOC_PIN)
|
||||||
#error "TEMP_SOC_PIN must be defined to use TEMP_SENSOR_SOC."
|
#error "TEMP_SOC_PIN must be defined to use TEMP_SENSOR_SOC."
|
||||||
#elif IS_GPIO_PIN(TEMP_SOC_PIN)
|
#endif
|
||||||
|
|
||||||
|
#if defined(TEMP_SOC_PIN) && IS_GPIO_PIN(TEMP_SOC_PIN)
|
||||||
#error "TEMP_SOC_PIN must not be a valid GPIO pin to avoid conflicts."
|
#error "TEMP_SOC_PIN must not be a valid GPIO pin to avoid conflicts."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#ifdef ARDUINO_ARCH_HC32
|
#ifdef ARDUINO_ARCH_HC32
|
||||||
#ifdef REDIRECT_PRINTF_TO_SERIAL
|
#ifdef REDIRECT_PRINTF_TO_SERIAL
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#if !defined(__GNUC__)
|
||||||
#error "only GCC is supported"
|
#error "only GCC is supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
uint8_t buffer[MARLIN_EEPROM_SIZE];
|
uint8_t buffer[MARLIN_EEPROM_SIZE];
|
||||||
char filename[] = "eeprom.dat";
|
char filename[] = "eeprom.dat";
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
const char eeprom_erase_value = 0xFF;
|
const char eeprom_erase_value = 0xFF;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
|
|
||||||
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
||||||
|
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../core/macros.h"
|
||||||
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
|
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
|
||||||
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||||
// needed due to the speed and mode required for communicating with each device being different.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
|
|||||||
@@ -111,12 +111,6 @@ void MarlinHAL::init() {
|
|||||||
#if HAS_SERVO_3
|
#if HAS_SERVO_3
|
||||||
INIT_SERVO(3);
|
INIT_SERVO(3);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SERVO_4
|
|
||||||
INIT_SERVO(4);
|
|
||||||
#endif
|
|
||||||
#if HAS_SERVO_5
|
|
||||||
INIT_SERVO(5);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//debug_frmwrk_init();
|
//debug_frmwrk_init();
|
||||||
//_DBG("\n\nDebug running\n");
|
//_DBG("\n\nDebug running\n");
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
|||||||
static bool eeprom_dirty = false;
|
static bool eeprom_dirty = false;
|
||||||
static int current_slot = 0;
|
static int current_slot = 0;
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
uint32_t first_nblank_loc, first_nblank_val;
|
uint32_t first_nblank_loc, first_nblank_val;
|
||||||
@@ -112,8 +112,7 @@ bool PersistentStore::access_finish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
const int p = REAL_EEPROM_ADDR(pos);
|
for (size_t i = 0; i < size; i++) ram_eeprom[pos + i] = value[i];
|
||||||
for (size_t i = 0; i < size; i++) ram_eeprom[p + i] = value[i];
|
|
||||||
eeprom_dirty = true;
|
eeprom_dirty = true;
|
||||||
crc16(crc, value, size);
|
crc16(crc, value, size);
|
||||||
pos += size;
|
pos += size;
|
||||||
@@ -121,9 +120,8 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
const int p = REAL_EEPROM_ADDR(pos);
|
|
||||||
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
||||||
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[p + i];
|
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
||||||
crc16(crc, buff, size);
|
crc16(crc, buff, size);
|
||||||
pos += size;
|
pos += size;
|
||||||
return false; // return true for any error
|
return false; // return true for any error
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ bool eeprom_file_open = false;
|
|||||||
#define MARLIN_EEPROM_SIZE size_t(0x1000) // 4KiB of Emulated EEPROM
|
#define MARLIN_EEPROM_SIZE size_t(0x1000) // 4KiB of Emulated EEPROM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
const char eeprom_erase_value = 0xFF;
|
const char eeprom_erase_value = 0xFF;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
|
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
@@ -45,7 +45,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||||
@@ -64,7 +64,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
// Read from external EEPROM
|
// Read from external EEPROM
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -21,7 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
|
#include "../../core/macros.h"
|
||||||
|
|
||||||
|
#if ALL(HAS_MEDIA, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
|
||||||
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||||
// needed due to the speed and mode required for communicating with each device being different.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
// This requirement can be removed if the SPI access to these devices is updated to use
|
// This requirement can be removed if the SPI access to these devices is updated to use
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ DriverVer =04/14/2008, 5.1.2600.5512
|
|||||||
[Manufacturer]
|
[Manufacturer]
|
||||||
%PROVIDER%=DeviceList,ntamd64
|
%PROVIDER%=DeviceList,ntamd64
|
||||||
|
|
||||||
|
|
||||||
[DeviceList]
|
[DeviceList]
|
||||||
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
||||||
|
|
||||||
[DeviceList.ntamd64]
|
[DeviceList.ntamd64]
|
||||||
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
%DESCRIPTION%=LPC1768USB, USB\VID_1D50&PID_6029&MI_00
|
||||||
|
|
||||||
|
|
||||||
[LPC1768USB]
|
[LPC1768USB]
|
||||||
include=mdmcpq.inf
|
include=mdmcpq.inf
|
||||||
CopyFiles=FakeModemCopyFileSection
|
CopyFiles=FakeModemCopyFileSection
|
||||||
@@ -26,6 +28,7 @@ AddService=usbser, 0x00000002, LowerFilter_Service_Inst
|
|||||||
[SerialPropPageAddReg]
|
[SerialPropPageAddReg]
|
||||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||||
|
|
||||||
|
|
||||||
[Strings]
|
[Strings]
|
||||||
PROVIDER = "marlinfw.org"
|
PROVIDER = "marlinfw.org"
|
||||||
DRIVER.SVC = "Marlin USB Driver"
|
DRIVER.SVC = "Marlin USB Driver"
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
||||||
|
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../core/macros.h"
|
||||||
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
|
#if ALL(HAS_MARLINUI_U8GLIB, HAS_MEDIA) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_EN == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN)
|
||||||
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
#define SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
|
||||||
// needed due to the speed and mode required for communicating with each device being different.
|
// needed due to the speed and mode required for communicating with each device being different.
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
* resulted in using about about 25% of the CPU's time.
|
* resulted in using about about 25% of the CPU's time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
DefaultSerial3 MSerial2(false, Serial2);
|
DefaultSerial3 MSerial2(false, Serial2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define WDT_CONFIG_PER_7_Val 0x9u
|
#define WDT_CONFIG_PER_7_Val 0x9u
|
||||||
#define WDT_CONFIG_PER_Pos 0
|
#define WDT_CONFIG_PER_Pos 0
|
||||||
#define WDT_CONFIG_PER_7 (WDT_CONFIG_PER_7_Val << WDT_CONFIG_PER_Pos)
|
#define WDT_CONFIG_PER_7 (WDT_CONFIG_PER_7_Val << WDT_CONFIG_PER_Pos)
|
||||||
@@ -163,6 +165,7 @@ void MarlinHAL::adc_init() {
|
|||||||
ADC->REFCTRL.reg = ADC_REFCTRL_REFSEL_INTVCC1;
|
ADC->REFCTRL.reg = ADC_REFCTRL_REFSEL_INTVCC1;
|
||||||
ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_32| ADC_AVGCTRL_ADJRES(4);;
|
ADC->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM_32| ADC_AVGCTRL_ADJRES(4);;
|
||||||
|
|
||||||
|
|
||||||
ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV128 |
|
ADC->CTRLB.reg = ADC_CTRLB_PRESCALER_DIV128 |
|
||||||
ADC_CTRLB_RESSEL_16BIT |
|
ADC_CTRLB_RESSEL_16BIT |
|
||||||
ADC_CTRLB_FREERUN;
|
ADC_CTRLB_FREERUN;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
|
|||||||
extern DefaultSerial2 MSerial0;
|
extern DefaultSerial2 MSerial0;
|
||||||
extern DefaultSerial3 MSerial1;
|
extern DefaultSerial3 MSerial1;
|
||||||
|
|
||||||
|
|
||||||
#define __MSERIAL(X) MSerial##X
|
#define __MSERIAL(X) MSerial##X
|
||||||
#define _MSERIAL(X) __MSERIAL(X)
|
#define _MSERIAL(X) __MSERIAL(X)
|
||||||
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
||||||
|
|||||||
@@ -57,6 +57,8 @@
|
|||||||
: (P == 3 && WITHIN(B, 20, 21)) ? 10 + (B) - 20 \
|
: (P == 3 && WITHIN(B, 20, 21)) ? 10 + (B) - 20 \
|
||||||
: -1)
|
: -1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define A2_AIN 3
|
#define A2_AIN 3
|
||||||
#define A3_AIN 4
|
#define A3_AIN 4
|
||||||
#define A4_AIN 5
|
#define A4_AIN 5
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
#define TIMER_TCCHANNEL(t) ((t) & 1)
|
#define TIMER_TCCHANNEL(t) ((t) & 1)
|
||||||
#define TC_COUNTER_START_VAL 0xFFFF
|
#define TC_COUNTER_START_VAL 0xFFFF
|
||||||
|
|
||||||
|
|
||||||
static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval)
|
static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval)
|
||||||
|
|
||||||
FORCE_INLINE static uint16_t getTimerCount() {
|
FORCE_INLINE static uint16_t getTimerCount() {
|
||||||
|
|||||||
@@ -37,24 +37,19 @@ static const uint8_t flashdata[TOTAL_FLASH_SIZE] __attribute__((__aligned__(256
|
|||||||
|
|
||||||
#include "../shared/eeprom_api.h"
|
#include "../shared/eeprom_api.h"
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() {
|
||||||
|
return MARLIN_EEPROM_SIZE;
|
||||||
/*
|
/* const uint8_t psz = NVMCTRL->SEESTAT.bit.PSZ,
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
|
||||||
const uint8_t psz = NVMCTRL->SEESTAT.bit.PSZ,
|
|
||||||
sblk = NVMCTRL->SEESTAT.bit.SBLK;
|
sblk = NVMCTRL->SEESTAT.bit.SBLK;
|
||||||
|
|
||||||
return (
|
return (!psz && !sblk) ? 0
|
||||||
(!psz && !sblk) ? 0
|
: (psz <= 2) ? (0x200 << psz)
|
||||||
: (psz <= 2) ? (0x200 << psz)
|
: (sblk == 1 || psz == 3) ? 4096
|
||||||
: (sblk == 1 || psz == 3) ? 4096
|
: (sblk == 2 || psz == 4) ? 8192
|
||||||
: (sblk == 2 || psz == 4) ? 8192
|
: (sblk <= 4 || psz == 5) ? 16384
|
||||||
: (sblk <= 4 || psz == 5) ? 16384
|
: (sblk >= 9 && psz == 7) ? 65536
|
||||||
: (sblk >= 9 && psz == 7) ? 65536
|
: 32768;*/
|
||||||
: 32768
|
|
||||||
) - eeprom_exclude_size;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
uint32_t PAGE_SIZE;
|
uint32_t PAGE_SIZE;
|
||||||
uint32_t ROW_SIZE;
|
uint32_t ROW_SIZE;
|
||||||
@@ -104,7 +99,8 @@ bool PersistentStore::access_finish() {
|
|||||||
volatile uint32_t *dst_addr = (volatile uint32_t *) &flashdata;
|
volatile uint32_t *dst_addr = (volatile uint32_t *) &flashdata;
|
||||||
|
|
||||||
uint32_t *pointer = (uint32_t *) buffer;
|
uint32_t *pointer = (uint32_t *) buffer;
|
||||||
for (uint32_t i = 0; i < TOTAL_FLASH_SIZE; i += 4) {
|
for (uint32_t i = 0; i < TOTAL_FLASH_SIZE; i+=4) {
|
||||||
|
|
||||||
*dst_addr = (uint32_t) *pointer;
|
*dst_addr = (uint32_t) *pointer;
|
||||||
pointer++;
|
pointer++;
|
||||||
dst_addr ++;
|
dst_addr ++;
|
||||||
@@ -124,19 +120,19 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
if (!hasWritten) {
|
if (!hasWritten) {
|
||||||
// init temp buffer
|
// init temp buffer
|
||||||
buffer = (uint8_t *) malloc(MARLIN_EEPROM_SIZE);
|
buffer = (uint8_t *) malloc(MARLIN_EEPROM_SIZE);
|
||||||
hasWritten = true;
|
hasWritten=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buffer + REAL_EEPROM_ADDR(pos), value, size);
|
memcpy(buffer+pos,value,size);
|
||||||
pos += size;
|
pos += size;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
volatile uint8_t *dst_addr = (volatile uint8_t *) &flashdata;
|
volatile uint8_t *dst_addr = (volatile uint8_t *) &flashdata;
|
||||||
dst_addr += REAL_EEPROM_ADDR(pos);
|
dst_addr += pos;
|
||||||
|
|
||||||
memcpy(value, (const void *)dst_addr, size);
|
memcpy(value,(const void *) dst_addr,size);
|
||||||
pos += size;
|
pos += size;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
static bool initialized;
|
static bool initialized;
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return qspi.size() - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return qspi.size(); }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -56,7 +56,7 @@ bool PersistentStore::access_finish() {
|
|||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t v = *value;
|
const uint8_t v = *value;
|
||||||
qspi.writeByte(REAL_EEPROM_ADDR(pos), v);
|
qspi.writeByte(pos, v);
|
||||||
crc16(crc, &v, 1);
|
crc16(crc, &v, 1);
|
||||||
pos++;
|
pos++;
|
||||||
value++;
|
value++;
|
||||||
@@ -66,7 +66,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t c = qspi.readByte(REAL_EEPROM_ADDR(pos));
|
uint8_t c = qspi.readByte(pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
@@ -51,7 +51,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t v = *value;
|
const uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||||
@@ -69,7 +69,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -85,6 +85,7 @@ void u8g_SetPILevel(u8g_t *u8g, uint8_t pin_index, uint8_t level) {
|
|||||||
|
|
||||||
uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||||
|
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case U8G_COM_MSG_STOP:
|
case U8G_COM_MSG_STOP:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#define TIMER_TCCHANNEL(t) ((t) & 1)
|
#define TIMER_TCCHANNEL(t) ((t) & 1)
|
||||||
#define TC_COUNTER_START_VAL 0xFFFF
|
#define TC_COUNTER_START_VAL 0xFFFF
|
||||||
|
|
||||||
|
|
||||||
static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval)
|
static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval)
|
||||||
|
|
||||||
FORCE_INLINE static uint16_t getTimerCount() {
|
FORCE_INLINE static uint16_t getTimerCount() {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
static bool initialized;
|
static bool initialized;
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return qspi.size() - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return qspi.size(); }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -53,7 +53,7 @@ bool PersistentStore::access_finish() {
|
|||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t v = *value;
|
const uint8_t v = *value;
|
||||||
qspi.writeByte(REAL_EEPROM_ADDR(pos), v);
|
qspi.writeByte(pos, v);
|
||||||
crc16(crc, &v, 1);
|
crc16(crc, &v, 1);
|
||||||
pos++;
|
pos++;
|
||||||
value++;
|
value++;
|
||||||
@@ -63,7 +63,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t c = qspi.readByte(REAL_EEPROM_ADDR(pos));
|
uint8_t c = qspi.readByte(pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
@@ -49,7 +49,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t v = *value;
|
const uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||||
@@ -67,7 +67,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* Based on Sprinter and grbl.
|
|
||||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
void serialEvent2() __attribute__((weak));
|
void serialEvent2() __attribute__((weak));
|
||||||
#endif
|
#endif
|
||||||
#ifdef USING_HW_SERIAL3
|
#ifdef USING_HW_SERIAL3
|
||||||
HAL_HardwareSerial HSerial3(USART3);
|
HAL_HardwareSerial Serial3(USART3);
|
||||||
void serialEvent3() __attribute__((weak));
|
void serialEvent3() __attribute__((weak));
|
||||||
#endif
|
#endif
|
||||||
#ifdef USING_HW_SERIAL4
|
#ifdef USING_HW_SERIAL4
|
||||||
@@ -147,11 +147,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifdef USING_HW_SERIAL6
|
#ifdef USING_HW_SERIAL6
|
||||||
#ifdef USART6
|
#ifdef USART6
|
||||||
HAL_HardwareSerial HSerial6(USART6);
|
HAL_HardwareSerial HSerial5(USART6);
|
||||||
#else
|
#else
|
||||||
HAL_HardwareSerial HSerial6(UART6);
|
HAL_HardwareSerial HSerial5(UART6);
|
||||||
#endif
|
#endif
|
||||||
void serialEvent6() __attribute__((weak));
|
void serialEvent5() __attribute__((weak));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Constructors ////////////////////////////////////////////////////////////////
|
// Constructors ////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
@@ -53,7 +53,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||||
@@ -71,7 +71,8 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
|
uint8_t c = eeprom_read_byte(p);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ static bool eeprom_data_written = false;
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
|
|
||||||
@@ -245,15 +245,14 @@ bool PersistentStore::access_finish() {
|
|||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
const int p = REAL_EEPROM_ADDR(pos);
|
|
||||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||||
if (v != ram_eeprom[p]) {
|
if (v != ram_eeprom[pos]) {
|
||||||
ram_eeprom[p] = v;
|
ram_eeprom[pos] = v;
|
||||||
eeprom_data_written = true;
|
eeprom_data_written = true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (v != eeprom_buffered_read_byte(p)) {
|
if (v != eeprom_buffered_read_byte(pos)) {
|
||||||
eeprom_buffered_write_byte(p, v);
|
eeprom_buffered_write_byte(pos, v);
|
||||||
eeprom_data_written = true;
|
eeprom_data_written = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -266,8 +265,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
const int p = REAL_EEPROM_ADDR(pos);
|
const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[pos], eeprom_buffered_read_byte(pos));
|
||||||
const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[p], eeprom_buffered_read_byte(p));
|
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
#define _ALIGN(x) __attribute__ ((aligned(x)))
|
#define _ALIGN(x) __attribute__ ((aligned(x)))
|
||||||
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { return true; }
|
bool PersistentStore::access_start() { return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#ifndef MARLIN_EEPROM_SIZE
|
#ifndef MARLIN_EEPROM_SIZE
|
||||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||||
#endif
|
#endif
|
||||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
|
|
||||||
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
bool PersistentStore::access_start() { eeprom_init(); return true; }
|
||||||
bool PersistentStore::access_finish() { return true; }
|
bool PersistentStore::access_finish() { return true; }
|
||||||
@@ -47,7 +47,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
uint16_t written = 0;
|
uint16_t written = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t v = *value;
|
uint8_t v = *value;
|
||||||
uint8_t * const p = (uint8_t * const)REAL_EEPROM_ADDR(pos);
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
|
||||||
eeprom_write_byte(p, v);
|
eeprom_write_byte(p, v);
|
||||||
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
|
||||||
@@ -66,7 +66,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
|||||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
// Read from either external EEPROM, program flash or Backup SRAM
|
// Read from either external EEPROM, program flash or Backup SRAM
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)REAL_EEPROM_ADDR(pos));
|
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
crc16(crc, &c, 1);
|
crc16(crc, &c, 1);
|
||||||
pos++;
|
pos++;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user