Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
-mat- filid brandy
firmware
Commits
53c66daf
Verified
Commit
53c66daf
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
fix(streams): Allow poll_stream to be NULL
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
8fec99bb
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
epicardium/modules/stream.c
+8
-6
8 additions, 6 deletions
epicardium/modules/stream.c
epicardium/modules/stream.h
+2
-0
2 additions, 0 deletions
epicardium/modules/stream.h
with
10 additions
and
6 deletions
epicardium/modules/stream.c
+
8
−
6
View file @
53c66daf
...
...
@@ -52,20 +52,22 @@ int epic_stream_read(int sd, void *buf, size_t count)
return
-
ENODEV
;
}
/* Poll the stream */
int
ret
=
stream
->
poll_stream
();
if
(
ret
<
0
)
{
return
ret
;
/* Poll the stream, if a poll_stream function exists */
if
(
stream
->
poll_stream
!=
NULL
)
{
int
ret
=
stream
->
poll_stream
();
if
(
ret
<
0
)
{
return
ret
;
}
}
/* Check buffer siz
ing
*/
/* Check buffer siz
e is a multiple of the data packet size
*/
if
(
count
%
stream
->
item_size
!=
0
)
{
return
-
EINVAL
;
}
size_t
i
;
for
(
i
=
0
;
i
<
count
;
i
+=
stream
->
item_size
)
{
if
(
!
xQueueReceive
(
stream
->
queue
,
buf
+
i
,
10
))
{
if
(
!
xQueueReceive
(
stream
->
queue
,
buf
+
i
,
STREAM_QUEUE_WAIT
))
{
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/stream.h
+
2
−
0
View file @
53c66daf
...
...
@@ -7,6 +7,8 @@
#include
"FreeRTOS.h"
#include
"queue.h"
#define STREAM_QUEUE_WAIT pdMS_TO_TICKS(10)
/**
* **Stream Descriptors**:
*
...
...
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