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
0f20d458
Commit
0f20d458
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Added FIONREAD and FIONWRITE to CDC/ACM driver. From Lorenz Meier
parent
82b528e0
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
ChangeLog
+3
-0
3 additions, 0 deletions
ChangeLog
drivers/usbdev/cdcacm.c
+46
-0
46 additions, 0 deletions
drivers/usbdev/cdcacm.c
with
49 additions
and
0 deletions
ChangeLog
+
3
−
0
View file @
0f20d458
...
...
@@ -5347,3 +5347,6 @@
added TERMIOS input / output processing support for UART and CDCACM
serial ports. Implemented by Mike Smith, Andrew Tridgell and Lorenz
Meier (2013-8-10).
* drivers/usbdev/cdcacm.c: Added FIONREAD and FIONWRITE to CDC/ACM
driver based on serial.c implementation. From Lorenz Meier
(2013-8-10).
This diff is collapsed.
Click to expand it.
drivers/usbdev/cdcacm.c
+
46
−
0
View file @
0f20d458
...
...
@@ -1937,6 +1937,52 @@ static int cdcuart_ioctl(FAR struct file *filep,int cmd,unsigned long arg)
break
;
#endif
case
FIONREAD
:
{
int
count
;
irqstate_t
state
=
irqsave
();
/* Determine the number of bytes available in the buffer. */
if
(
serdev
->
recv
.
tail
<=
serdev
->
recv
.
head
)
{
count
=
serdev
->
recv
.
head
-
serdev
->
recv
.
tail
;
}
else
{
count
=
serdev
->
recv
.
size
-
(
serdev
->
recv
.
tail
-
serdev
->
recv
.
head
);
}
irqrestore
(
state
);
*
(
int
*
)
arg
=
count
;
ret
=
0
;
}
break
;
case
FIONWRITE
:
{
int
count
;
irqstate_t
state
=
irqsave
();
/* Determine the number of bytes free in the buffer. */
if
(
serdev
->
xmit
.
head
<
serdev
->
xmit
.
tail
)
{
count
=
serdev
->
xmit
.
tail
-
serdev
->
xmit
.
head
-
1
;
}
else
{
count
=
serdev
->
xmit
.
size
-
(
serdev
->
xmit
.
head
-
serdev
->
xmit
.
tail
)
-
1
;
}
irqrestore
(
state
);
*
(
int
*
)
arg
=
count
;
ret
=
0
;
}
break
;
default:
ret
=
-
ENOTTY
;
break
;
...
...
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