Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
21905bff
Commit
21905bff
authored
9 years ago
by
Alan Carvalho de Assis
Committed by
Gregory Nutt
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
AMDL: Add support to Peripheral as Output with Read back. From Alan Carvalho de Assis.
parent
5ace3311
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arch/arm/src/samdl/sam_port.c
+15
-0
15 additions, 0 deletions
arch/arm/src/samdl/sam_port.c
arch/arm/src/samdl/sam_port.h
+19
-2
19 additions, 2 deletions
arch/arm/src/samdl/sam_port.h
with
34 additions
and
2 deletions
arch/arm/src/samdl/sam_port.c
+
15
−
0
View file @
21905bff
...
...
@@ -310,11 +310,26 @@ static inline void sam_configperiph(uintptr_t base, port_pinset_t pinset)
pin
=
(
pinset
&
PORT_PIN_MASK
)
>>
PORT_PIN_SHIFT
;
bit
=
(
1
<<
pin
);
/* If pin is output with readback then set the pin as output */
if
((
pinset
&
PORT_OUTREADBACK_MASK
)
==
PORT_OUTREADBACK_ENABLE
)
{
putreg32
(
bit
,
base
+
SAM_PORT_DIRSET_OFFSET
);
}
/* Set the pin configuration. This will be an peripheral with the
* selected function.
*/
regval
=
(
PORT_WRCONFIG_WRPINCFG
|
PORT_WRCONFIG_WRPMUX
|
PORT_WRCONFIG_PMUXEN
);
/* If pin is output with readback then enable the input buffer */
if
((
pinset
&
PORT_OUTREADBACK_MASK
)
==
PORT_OUTREADBACK_ENABLE
)
{
regval
|=
PORT_WRCONFIG_INEN
;
}
if
(
pin
>
16
)
{
/* Select the upper half word and adjust the bit setting */
...
...
This diff is collapsed.
Click to expand it.
arch/arm/src/samdl/sam_port.h
+
19
−
2
View file @
21905bff
...
...
@@ -76,9 +76,9 @@
* ------------ -----------------------------
* PORT Input: MMRR .... .S.. .... ..PB BBBB
* PORT Output: MM.. .... D..V .... ..PB BBBB
* Peripheral: MM.. FFF
.
.... II.. ..PB BBBB
* Peripheral: MM.. FFF
O
.... II.. ..PB BBBB
* ------------ -----------------------------
* MMRR FFF
.
DS.V II.. ..PB BBBB
* MMRR FFF
O
DS.V II.. ..PB BBBB
*/
/* Input/output/peripheral mode:
...
...
@@ -162,6 +162,23 @@
#define PORT_FUNCG (PORT_PERIPHERAL | _PORT_FUNCG)
/* Function G */
#define PORT_FUNCH (PORT_PERIPHERAL | _PORT_FUNCH)
/* Function H */
/* Output and Input Buffer both enabled to let readback
*
* MODE BITFIELDS
* ------------ -----------------------------
* 2222 1111 1111 1100 0000 0000
* 3210 9876 5432 1098 7654 3210
* ------------ -----------------------------
* PORT Input: .... .... .... .... .... ....
* PORT Output: .... .... .... .... .... ....
* Peripheral: .... ...O .... .... .... ....
*/
#define PORT_OUTREADBACK_SHIFT (16)
/* Bit 16: Pin output and input buffer enabled */
#define PORT_OUTREADBACK_MASK (1 << PORT_OUTREADBACK_SHIFT)
# define PORT_OUTREADBACK_DISABLE (0 << PORT_OUTREADBACK_SHIFT)
# define PORT_OUTREADBACK_ENABLE (1 << PORT_OUTREADBACK_SHIFT)
/* Output drive control
*
* MODE BITFIELDS
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment