Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Beam Positoning Monitor - Software
Commits
38d1b030
Commit
38d1b030
authored
Jul 11, 2014
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hal/sm_io/modules/acq/*: add channel limit checking
This finishes the quick fix for github issue #21.
parent
45a271f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
sm_io_acq_codes.h
hal/sm_io/modules/acq/sm_io_acq_codes.h
+2
-1
sm_io_acq_exp.c
hal/sm_io/modules/acq/sm_io_acq_exp.c
+13
-1
No files found.
hal/sm_io/modules/acq/sm_io_acq_codes.h
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
hal/sm_io/modules/acq/sm_io_acq_exp.c
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment