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
1651eec1
Commit
1651eec1
authored
Jan 12, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hal/*: fix comparison between signed and unsigned types
This fixes #67 github issue
parent
28dc66e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
13 deletions
+19
-13
smio_thsafe_zmq_client.c
hal/msg/smio_thsafe_ops/smio_thsafe_zmq_client.c
+6
-3
sm_ch_24aa64.c
hal/sm_io/chips/sm_ch_24aa64.c
+5
-4
sm_ch_si57x.c
hal/sm_io/chips/sm_ch_si57x.c
+4
-4
sm_pr_spi.c
hal/sm_io/protocols/ops/sm_pr_spi.c
+2
-2
sm_io_thsafe_codes.h
hal/sm_io/sm_io_thsafe_codes.h
+2
-0
No files found.
hal/msg/smio_thsafe_ops/smio_thsafe_zmq_client.c
View file @
1651eec1
...
...
@@ -496,9 +496,12 @@ static ssize_t _thsafe_zmq_client_recv_rw (smio_t *self, uint8_t *data,
/* Check if the frame has the number of bytes requested.
* For now, we consider a success only when the number of
* bytes requested is the same as the actually read*/
ssize_t
data_frame_size
=
(
ssize_t
)
zframe_size
(
data_frame
);
ASSERT_TEST
(
data_frame_size
==
*
(
THSAFE_RETURN_TYPE
*
)
zframe_data
(
return_frame
),
size_t
data_frame_size
=
zframe_size
(
data_frame
);
THSAFE_RETURN_TYPE
ret_frame_size
=
*
(
THSAFE_RETURN_TYPE
*
)
zframe_data
(
return_frame
);
ASSERT_TEST
(
ret_frame_size
>=
0
&&
(
THSAFE_RETURN_UTYPE
)
ret_frame_size
==
data_frame_size
,
"Received data frame size is wrong"
,
err_data_frame_size
);
ASSERT_TEST
(
data_frame_size
>=
size
,
"Specified buffer size is bigger than the available data"
,
...
...
hal/sm_io/chips/sm_ch_24aa64.c
View file @
1651eec1
...
...
@@ -114,15 +114,16 @@ smch_err_e smch_24aa64_read_8 (smch_24aa64_t *self, uint16_t addr,
smch_err_e
smch_24aa64_write_block
(
smch_24aa64_t
*
self
,
uint16_t
addr
,
const
uint32_t
*
data
,
size_t
size
)
{
return
(
_smch_24aa64_write_generic
(
self
,
addr
,
(
const
uint8_t
*
)
data
,
size
)
==
(
ssize_t
)
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
ssize_t
ret
=
_smch_24aa64_write_generic
(
self
,
addr
,
(
const
uint8_t
*
)
data
,
size
);
return
(
ret
>=
0
&&
(
size_t
)
ret
==
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
}
smch_err_e
smch_24aa64_read_block
(
smch_24aa64_t
*
self
,
uint16_t
addr
,
uint32_t
*
data
,
size_t
size
)
{
return
(
_smch_24aa64_read_generic
(
self
,
addr
,
(
uint8_t
*
)
data
,
size
)
==
(
ssize_t
)
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
ssize_t
ret
=
_smch_24aa64_read_generic
(
self
,
addr
,
(
uint8_t
*
)
data
,
size
);
return
(
ret
>=
0
&&
(
size_t
)
ret
==
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
}
/***************** Static functions *****************/
...
...
hal/sm_io/chips/sm_ch_si57x.c
View file @
1651eec1
...
...
@@ -205,8 +205,8 @@ static smch_err_e _smch_si57x_write_8 (smch_si57x_t *self, uint8_t addr,
static
smch_err_e
_smch_si57x_write_block
(
smch_si57x_t
*
self
,
uint8_t
addr
,
const
uint8_t
*
data
,
size_t
size
)
{
return
(
_smch_si57x_write_generic
(
self
,
addr
,
data
,
size
)
==
(
ssize_t
)
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
ssize_t
ret
=
_smch_si57x_write_generic
(
self
,
addr
,
data
,
size
);
return
(
ret
>=
0
&&
(
size_t
)
ret
==
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
}
static
ssize_t
_smch_si57x_write_generic
(
smch_si57x_t
*
self
,
uint8_t
addr
,
...
...
@@ -265,8 +265,8 @@ static smch_err_e _smch_si57x_read_8 (smch_si57x_t *self, uint8_t addr,
static
smch_err_e
_smch_si57x_read_block
(
smch_si57x_t
*
self
,
uint8_t
addr
,
uint8_t
*
data
,
size_t
size
)
{
return
(
_smch_si57x_read_generic
(
self
,
addr
,
data
,
size
)
==
(
ssize_t
)
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
ssize_t
ret
=
_smch_si57x_read_generic
(
self
,
addr
,
data
,
size
);
return
(
ret
>=
0
&&
(
size_t
)
ret
==
size
)
?
SMCH_SUCCESS
:
SMCH_ERR_RW_SMPR
;
}
static
ssize_t
_smch_si57x_read_generic
(
smch_si57x_t
*
self
,
uint8_t
addr
,
uint8_t
*
data
,
...
...
hal/sm_io/protocols/ops/sm_pr_spi.c
View file @
1651eec1
...
...
@@ -380,8 +380,8 @@ static ssize_t _spi_read_write_generic (smpr_t *self, uint8_t *data,
}
/* Return error if we could not write everything */
ASSERT_TEST
(
err
==
(
ssize_t
)
size
,
"Could not write everything to TX registers"
,
err_exit
,
-
1
);
ASSERT_TEST
(
err
>=
0
&&
(
size_t
)
err
==
size
,
"Could not write everything to TX registers"
,
err_exit
,
-
1
);
}
/* Start transfer */
...
...
hal/sm_io/sm_io_thsafe_codes.h
View file @
1651eec1
...
...
@@ -59,5 +59,7 @@
/* Messaging Return Codes */
#define THSAFE_RETURN_TYPE int32_t
#define THSAFE_RETURN_SIZE (sizeof (THSAFE_RETURN_TYPE))
#define THSAFE_RETURN_UTYPE uint32_t
#define THSAFE_RETURN_USIZE (sizeof (THSAFE_RETURN_TYPE))
#endif
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