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
93380d81
Commit
93380d81
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
SAM3/4 Serial: Fix a mysterious multi-tasking bug that can lock up the serial port
parent
3c3506bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arch/arm/src/sam34/sam_lowputc.c
+47
-4
47 additions, 4 deletions
arch/arm/src/sam34/sam_lowputc.c
arch/arm/src/sam34/sam_serial.c
+0
-58
0 additions, 58 deletions
arch/arm/src/sam34/sam_serial.c
with
47 additions
and
62 deletions
arch/arm/src/sam34/sam_lowputc.c
+
47
−
4
View file @
93380d81
...
...
@@ -279,14 +279,57 @@
void
up_lowputc
(
char
ch
)
{
#ifdef HAVE_CONSOLE
/* Wait for the transmitter to be available */
irqstate_t
flags
;
while
((
getreg32
(
SAM_CONSOLE_BASE
+
SAM_UART_SR_OFFSET
)
&
UART_INT_TXEMPTY
)
==
0
);
for
(;;)
{
/* Wait for the transmitter to be available */
/* Send the character */
while
((
getreg32
(
SAM_CONSOLE_BASE
+
SAM_UART_SR_OFFSET
)
&
UART_INT_TXEMPTY
)
==
0
);
putreg32
((
uint32_t
)
ch
,
SAM_CONSOLE_BASE
+
SAM_UART_THR_OFFSET
);
/* Disable interrupts so that the test and the transmission are
* atomic.
*/
flags
=
irqsave
();
if
((
getreg32
(
SAM_CONSOLE_BASE
+
SAM_UART_SR_OFFSET
)
&
UART_INT_TXEMPTY
)
!=
0
)
{
/* Send the character */
putreg32
((
uint32_t
)
ch
,
SAM_CONSOLE_BASE
+
SAM_UART_THR_OFFSET
);
irqrestore
(
flags
);
return
;
}
irqrestore
(
flags
);
}
#endif
}
/****************************************************************************
* Name: up_putc
*
* Description:
* Provide priority, low-level access to support OS debug writes
*
****************************************************************************/
int
up_putc
(
int
ch
)
{
#ifdef HAVE_CONSOLE
/* Check for LF */
if
(
ch
==
'\n'
)
{
/* Add CR */
up_lowputc
(
'\r'
);
}
up_lowputc
(
ch
);
#endif
return
ch
;
}
/**************************************************************************
...
...
This diff is collapsed.
Click to expand it.
arch/arm/src/sam34/sam_serial.c
+
0
−
58
View file @
93380d81
...
...
@@ -1219,62 +1219,4 @@ void up_serialinit(void)
#endif
}
/****************************************************************************
* Name: up_putc
*
* Description:
* Provide priority, low-level access to support OS debug writes
*
****************************************************************************/
int
up_putc
(
int
ch
)
{
#ifdef HAVE_CONSOLE
struct
up_dev_s
*
priv
=
(
struct
up_dev_s
*
)
CONSOLE_DEV
.
priv
;
uint32_t
imr
;
up_disableallints
(
priv
,
&
imr
);
/* Check for LF */
if
(
ch
==
'\n'
)
{
/* Add CR */
up_lowputc
(
'\r'
);
}
up_lowputc
(
ch
);
up_restoreusartint
(
priv
,
imr
);
#endif
return
ch
;
}
#else
/* USE_SERIALDRIVER */
/****************************************************************************
* Name: up_putc
*
* Description:
* Provide priority, low-level access to support OS debug writes
*
****************************************************************************/
int
up_putc
(
int
ch
)
{
#ifdef HAVE_CONSOLE
/* Check for LF */
if
(
ch
==
'\n'
)
{
/* Add CR */
up_lowputc
(
'\r'
);
}
up_lowputc
(
ch
);
#endif
return
ch
;
}
#endif
/* USE_SERIALDRIVER */
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