Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Beam Positoning Monitor - Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
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
Projects
Beam Positoning Monitor - Software
Commits
38d1b030
Commit
38d1b030
authored
10 years ago
by
Lucas Russo
Browse files
Options
Downloads
Patches
Plain Diff
hal/sm_io/modules/acq/*: add channel limit checking
This finishes the quick fix for github issue #21.
parent
45a271f6
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
hal/sm_io/modules/acq/sm_io_acq_codes.h
+2
-1
2 additions, 1 deletion
hal/sm_io/modules/acq/sm_io_acq_codes.h
hal/sm_io/modules/acq/sm_io_acq_exp.c
+13
-1
13 additions, 1 deletion
hal/sm_io/modules/acq/sm_io_acq_exp.c
with
15 additions
and
2 deletions
hal/sm_io/modules/acq/sm_io_acq_codes.h
+
2
−
1
View file @
38d1b030
...
...
@@ -30,6 +30,7 @@
#define ACQ_NUM_SAMPLES_OOR 1
/* Number of samples out of range */
#define ACQ_NOT_COMPLETED 2
/* Acquisition not completed */
#define ACQ_BLOCK_OOR 3
/* Block number out of range */
#define ACQ_REPLY_END 4
/* End marker */
#define ACQ_NUM_CHAN_OOR 4
/* Channel number out of range */
#define ACQ_REPLY_END 5
/* End marker */
#endif
This diff is collapsed.
Click to expand it.
hal/sm_io/modules/acq/sm_io_acq_exp.c
+
13
−
1
View file @
38d1b030
...
...
@@ -107,7 +107,7 @@ static void *_acq_data_acquire (void *owner, void *args)
uint32_t
chan
=
*
(
uint32_t
*
)
zframe_data
(
zmsg_pop
(
*
exp_msg
->
msg
));
/* number of samples required is out of the maximum limit */
if
(
num_samples
>
=
SMIO_ACQ_HANDLER
(
self
)
->
acq_buf
[
chan
].
max_samples
)
{
if
(
num_samples
>
SMIO_ACQ_HANDLER
(
self
)
->
acq_buf
[
chan
].
max_samples
-
1
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_WARN
,
"[sm_io:acq] data_acquire: "
"Number of samples required is out of the maximum limit
\n
"
);
...
...
@@ -118,6 +118,18 @@ static void *_acq_data_acquire (void *owner, void *args)
goto
err_smp_exceeded
;
}
/* channel required is out of the limit */
if
(
chan
>
SMIO_ACQ_NUM_CHANNELS
-
1
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_WARN
,
"[sm_io:acq] data_acquire: "
"Channel required is out of the maximum limit
\n
"
);
/* Message is:
* frame 0: error code */
_send_client_response
(
ACQ_NUM_CHAN_OOR
,
0
,
NULL
,
false
,
self
->
worker
,
exp_msg
->
reply_to
);
goto
err_smp_exceeded
;
}
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:acq] data_acquire: "
"Current acq params: number of samples = %u, channel = %u
\n
"
,
num_samples
,
chan
);
...
...
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