Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PolyORB-HI-C
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TASTE
PolyORB-HI-C
Commits
4e7e9650
Commit
4e7e9650
authored
Mar 19, 2020
by
Rafal Babski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linux_serial_minimal driver - Support for multiple sporadic interfaces
parent
1a325479
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
src/drivers/linux_serial_minimal.c
src/drivers/linux_serial_minimal.c
+12
-9
No files found.
src/drivers/linux_serial_minimal.c
View file @
4e7e9650
...
...
@@ -195,12 +195,17 @@ static uint32_t encode_packet(uint8_t* data, const uint32_t data_length, const u
return
0
;
}
// first four bytes of msg_content - port number
uint8_t
*
data_ptr
=
(
uint8_t
*
)
(
msg_content
+
4
);
// skip port number to access data
// last four bytes of msg_content - actual msg length
// structure of the msg_content:
// - first four bytes of msg_content - port number
// - next - actual data
// - double word before dummy bytes - length of data
// - last double word - dummy bytes
uint32_t
*
length_ptr
=
(
uint32_t
*
)(
msg_content
+
(
msg_length
-
4
));
if
(
data_length
<
*
length_ptr
*
2
+
2
)
uint32_t
bytes_to_copy
=
(
*
length_ptr
)
+
sizeof
(
uint32_t
);
if
(
data_length
<
(
*
length_ptr
+
sizeof
(
uint32_t
))
*
2
+
2
)
{
__PO_HI_DEBUG_CRITICAL
(
"Encoding packet - not enough data_length, at least %d bytes is required, got %d
\n
"
,
*
length_ptr
,
data_length
);
return
0
;
...
...
@@ -211,9 +216,9 @@ static uint32_t encode_packet(uint8_t* data, const uint32_t data_length, const u
data
[
length
++
]
=
PACKET_START_BYTE
;
uint32_t
iter
;
for
(
iter
=
0
;
iter
<
*
length_ptr
;
++
iter
)
for
(
iter
=
0
;
iter
<
bytes_to_copy
;
++
iter
)
{
uint8_t
msg_byte
=
data_ptr
[
iter
];
uint8_t
msg_byte
=
msg_content
[
iter
];
if
(
msg_byte
==
PACKET_START_BYTE
||
msg_byte
==
PACKET_STOP_BYTE
||
msg_byte
==
PACKET_ESCAPE_BYTE
)
{
...
...
@@ -362,13 +367,11 @@ static enum PACKET_DECODER_STATE packet_decoder_state;
static
void
process_packet
(
uint8_t
*
data
,
int
size
)
{
uint32_t
port
=
7
;
uint32_t
length
=
size
;
__PO_HI_DEBUG_DEBUG
(
"[LINUX SERIAL] Processing packet
\n
"
);
__po_hi_msg_reallocate
(
&
__po_hi_c_driver_serial_linux_poller_msg
);
memcpy
(
__po_hi_c_driver_serial_linux_poller_msg
.
content
,
&
port
,
4
);
memcpy
(
__po_hi_c_driver_serial_linux_poller_msg
.
content
+
4
,
data
,
size
);
memcpy
(
__po_hi_c_driver_serial_linux_poller_msg
.
content
,
data
,
size
);
memcpy
(
__po_hi_c_driver_serial_linux_poller_msg
.
content
+
(
__PO_HI_MESSAGES_MAX_SIZE
-
8
),
&
length
,
4
);
__po_hi_c_driver_serial_linux_poller_msg
.
length
=
__PO_HI_MESSAGES_MAX_SIZE
;
...
...
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