Skip to content

Commit 4f5fc28

Browse files
author
Brian Campuzano
authored
Merge branch 'nasa:devel' into extern_params
2 parents e988223 + 6e0b70d commit 4f5fc28

135 files changed

Lines changed: 1443 additions & 2641 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/spelling/expect.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ ASTRING
4848
ATester
4949
ATL
5050
ATMs
51+
ATSAM
5152
atypes
5253
AUTOBRIEF
5354
autocode
@@ -86,9 +87,9 @@ BUFFERALLOCATIONFAILED
8687
BUFFERGETOUT
8788
BUFFERMANAGERCOMPONENTIMPLCFG
8889
BUFFERMGR
90+
BUFFERQUEUEIN
8991
BUFFERTOOSMALLFORDATA
9092
BUFFERTOOSMALLFORPACKET
91-
BUFFQUEUEIN
9293
buffsize
9394
BUGLIST
9495
bugprone
@@ -156,6 +157,7 @@ COMMANDDISPATCHERIMPLCFG
156157
commandline
157158
commasepitem
158159
COMPACKET
160+
COMPACKETQUEUEIN
159161
COMPONENTTESTERIMPL
160162
COMQUEUE
161163
COMQUEUEIN
@@ -435,6 +437,7 @@ hidecallgraph
435437
hideinitializer
436438
hlp
437439
HLTH
440+
HPSC
438441
htags
439442
HTH
440443
htmlfile
@@ -699,6 +702,7 @@ pbuild
699702
pcmake
700703
pcomp
701704
pdflatex
705+
PEB
702706
Peet
703707
penv
704708
PERLMOD
@@ -1070,6 +1074,7 @@ viewcontent
10701074
viewforum
10711075
vla
10721076
vlist
1077+
VOXL
10731078
vtype
10741079
vuejs
10751080
vwong

.github/actions/spelling/patterns.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,12 @@ TeX/AMS
137137

138138
# ignore long runs of a single character:
139139
\b([A-Za-z])\g{-1}{3,}\b
140+
141+
142+
##########################################
143+
###### F Prime specific patterns ######
144+
##########################################
145+
146+
# .get...() .set...() autocoded functions
147+
\.get\w+\(
148+
\.set\w+\(
Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,22 @@
11
module Drv {
22

33
@ Status returned by the send call
4-
enum SendStatus {
5-
SEND_OK = 0 @< Send worked as expected
6-
SEND_RETRY = 1 @< Data send should be retried
7-
SEND_ERROR = 2 @< Send error occurred retrying may succeed
4+
enum ByteStreamStatus {
5+
OP_OK @< Operation worked as expected
6+
SEND_RETRY @< Data send should be retried
7+
RECV_NO_DATA @< Receive worked, but there was no data
8+
OTHER_ERROR @< Error occurred, retrying may succeed
89
}
910

10-
@ Send data out through the byte stream
11-
port ByteStreamSend(
12-
ref sendBuffer: Fw.Buffer @< Data to send
13-
) -> SendStatus
14-
15-
@ Status associated with the received data
16-
enum RecvStatus {
17-
RECV_OK = 0 @< Receive worked as expected
18-
RECV_NO_DATA = 1 @< Receive worked, but there was no data
19-
RECV_ERROR = 2 @< Receive error occurred retrying may succeed
20-
}
21-
22-
@ Carries the received bytes stream driver
23-
port ByteStreamRecv(
24-
ref recvBuffer: Fw.Buffer
25-
recvStatus: RecvStatus
11+
@ Port to exchange buffer and status with the ByteStreamDriver model
12+
@ This port is used for receiving data from the driver as well as on
13+
@ callback of a send call
14+
port ByteStreamData(
15+
ref buffer: Fw.Buffer,
16+
status: ByteStreamStatus
2617
)
2718

28-
enum PollStatus {
29-
POLL_OK = 0 @< Poll successfully received data
30-
POLL_RETRY = 1 @< No data available, retry later
31-
POLL_ERROR = 2 @< Error received when polling
32-
}
33-
34-
port ByteStreamPoll(
35-
ref pollBuffer: Fw.Buffer
36-
) -> PollStatus
37-
3819
@ Signal indicating the driver is ready to send and received data
3920
port ByteStreamReady()
21+
4022
}

Drv/ByteStreamDriverModel/changed-symbols.txt

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,40 @@
11
# Drv::ByteStreamDriverModel Byte Stream Driver Model
22

3-
The byte stream driver is a generic model for drivers implementing a "stream of bytes" interface. Typically these
4-
drivers operate with an outgoing stream and an incoming stream. The outgoing stream is represented by the "send" port
5-
and the incoming stream is either polled using the "poll" port or return asynchronously via the "readCallback" port.
3+
The byte stream driver is a generic model for drivers implementing a "stream of bytes" interface. Typically these drivers operate with an outgoing stream and an incoming stream.
4+
The outgoing stream is represented by the input `send` port; other components can invoke this port to send data through the driver. The incoming stream is represented by the output `recv` port; the driver will call this port to send data to the component that is receiving data from the driver.
65

76
## Design
87

9-
The manager component (typically the ground interface) initiates the transfer of send data by calling the "send" port.
10-
The caller will provide a `Fw::Buffer` containing the data to send and the port call will return a status of that send.
8+
### Send
9+
10+
The manager component (for example a radio manager) initiates the transfer of send data by calling the "send" port.
11+
The caller will provide a `Fw::Buffer` containing the data to send. The driver component **must** perform a callback on its `dataReturnOut` port to return the status of that send as well as returning ownership of the `Fw::Buffer` to the caller.
1112
These responses are an enumeration whose values are described in the following table:
1213

1314
| Value | Description | Buffer Ownership |
1415
|---|---|---|
15-
| Drv::SEND_OK | Send functioned normally. | Ownership of the `Fw::Buffer` passes to the byte stream driver. |
16-
| Drv::SEND_RETRY | Send should be retried, but a subsequent send should return SEND_OK. | The caller retains ownership of the `Fw::Buffer`. |
17-
| Drv::SEND_ERROR | Send produced an error, future sends likely to fail. | Ownership of the `Fw::Buffer` passes to the byte stream driver. |
18-
19-
**Note:** in either formation described below, send will operate as described here.
16+
| ByteStreamStatus::OP_OK | Send functioned normally. | Ownership of the `Fw::Buffer` passes to the byte stream driver. |
17+
| ByteStreamStatus::SEND_RETRY | Send should be retried, but a subsequent send should return OP_OK. | The caller retains ownership of the `Fw::Buffer`. |
18+
| ByteStreamStatus::OTHER_ERROR | Send produced an error, future sends likely to fail. | Ownership of the `Fw::Buffer` passes to the byte stream driver. |
2019

21-
### Callback Formation
20+
### Receive
2221

2322
![Callback](./img/canvas-callback.png)
2423

2524
In the callback formation, the byte stream driver component initiates the transfer of received data by calling the
26-
"readCallback" output port. This port transfers any read data in a `Fw::Buffer` along with a status for the receive.
25+
"recv" output port. This port transfers any read data in a `Fw::Buffer` along with a status for the receive.
2726
This status is an enumeration whose values are described in the following table:
2827

2928
| Value | Description |
3029
|---|---|
31-
| Drv::RECV_OK | Receive functioned normally buffer contains valid data. |
32-
| Drv::RECV_ERROR | Receive produced an error and buffer contains no valid data. |
30+
| ByteStreamStatus::OP_OK | Receive functioned normally and buffer contains valid data. |
31+
| ByteStreamStatus::RECV_NO_DATA | Receive worked, but there was no data |
32+
| ByteStreamStatus::OTHER_ERROR | Receive produced an error and buffer contains no valid data. |
3333

3434
The following components implement the byte stream model using a callback formation:
35-
- `DrvTcpClient`: a F´ component wrapper of the tcp client
36-
- `DrvTcpServer`: a F´ component wrapper of the tcp server
37-
- `DrvUdp`: a F´ component wrapper of the udp
38-
39-
### Polling Formation
40-
41-
![Poll](./img/canvas-poll.png)
42-
43-
In the polling formation, the manager component (typically the ground interface) initiates the transfer of received
44-
data by calling the "poll" input port. This port fills in the provided `Fw::Buffer` along with a status for the poll.
45-
This status is an enumeration whose values are described in the following table:
46-
47-
| Value | Description |
48-
|---|---|
49-
| Drv::POLL_OK | Poll functioned normally buffer contains valid data. |
50-
| Drv::POLL_RETRY | Poll should be retried and a subsequent send should return POLL_OK. |
51-
| Drv::POLL_ERROR | Poll produced an error and buffer contains no valid data. |
52-
53-
**Note:** there are no known implementers of the polling formation, although this formation is best suited for
54-
implementations running on baremetal machines.
35+
- [`Drv::TcpClient`](../../TcpClient/docs/sdd.md): a F´ component wrapper of the tcp client
36+
- [`Drv::TcpServer`](../../TcpServer/docs/sdd.md): a F´ component wrapper of the tcp server
37+
- [`Drv::Udp`](../../Udp/docs/sdd.md): a F´ component wrapper of the udp
5538

5639
## Class Diagram
5740
![classdiagram](./img/class_diagram.png)
@@ -61,5 +44,4 @@ implementations running on baremetal machines.
6144
| Name | Description | Validation |
6245
|---|---|---|
6346
| BYTEDRV-001 | The ByteStreamDriverModel shall provide the capability to send bytes | inspection |
64-
| BYTEDRV-002 | The ByteStreamDriverModel shall provide the capability to poll for bytes | inspection |
65-
| BYTEDRV-003 | The ByteStreamDriverModel shall provide the capability to produce bytes | inspection |
47+
| BYTEDRV-002 | The ByteStreamDriverModel shall provide the capability to produce bytes | inspection |

Drv/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver/")
1010
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxUartDriver/")
1111
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxSpiDriver/")
1212
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxI2cDriver/")
13-
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/StreamCrossover/")
1413

1514
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ip/")
1615
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpClient/")
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
@ Port invoked when the driver is ready to send/receive data
22
output port ready: Drv.ByteStreamReady
33

4-
@ Port invoked when driver has received data
5-
output port $recv: Drv.ByteStreamRecv
4+
@ Port invoked by the driver when it receives data
5+
output port $recv: Drv.ByteStreamData
66

7-
@ Port invoked to send data out the driver
8-
guarded input port $send: Drv.ByteStreamSend
7+
@ Invoke this port to send data out the driver
8+
guarded input port $send: Fw.BufferSend
9+
10+
@ Port invoked to return ownership of sent data back to the sender
11+
output port dataReturnOut: Drv.ByteStreamData

Drv/LinuxUartDriver/LinuxUartDriver.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,10 @@ LinuxUartDriver ::~LinuxUartDriver() {
292292
// Handler implementations for user-defined typed input ports
293293
// ----------------------------------------------------------------------
294294

295-
Drv::SendStatus LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) {
296-
Drv::SendStatus status = Drv::SendStatus::SEND_OK;
295+
void LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) {
296+
Drv::ByteStreamStatus status = Drv::ByteStreamStatus::OP_OK;
297297
if (this->m_fd == -1 || serBuffer.getData() == nullptr || serBuffer.getSize() == 0) {
298-
status = Drv::SendStatus::SEND_ERROR;
298+
status = Drv::ByteStreamStatus::OTHER_ERROR;
299299
} else {
300300
unsigned char *data = serBuffer.getData();
301301
FW_ASSERT(static_cast<size_t>(serBuffer.getSize()) <= std::numeric_limits<size_t>::max(),
@@ -307,28 +307,25 @@ Drv::SendStatus LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Bu
307307
if (-1 == stat || static_cast<size_t>(stat) != xferSize) {
308308
Fw::LogStringArg _arg = this->m_device;
309309
this->log_WARNING_HI_WriteError(_arg, static_cast<I32>(stat));
310-
status = Drv::SendStatus::SEND_ERROR;
310+
status = Drv::ByteStreamStatus::OTHER_ERROR;
311311
}
312312
}
313-
// Deallocate when necessary
314-
if (isConnected_deallocate_OutputPort(0)) {
315-
deallocate_out(0, serBuffer);
316-
}
317-
return status;
313+
// Return the buffer back to the caller
314+
dataReturnOut_out(0, serBuffer, status);
318315
}
319316

320317
void LinuxUartDriver ::serialReadTaskEntry(void* ptr) {
321318
FW_ASSERT(ptr != nullptr);
322-
Drv::RecvStatus status = RecvStatus::RECV_ERROR; // added by m.chase 03.06.2017
319+
Drv::ByteStreamStatus status = ByteStreamStatus::OTHER_ERROR; // added by m.chase 03.06.2017
323320
LinuxUartDriver* comp = reinterpret_cast<LinuxUartDriver*>(ptr);
324321
while (!comp->m_quitReadThread) {
325322
Fw::Buffer buff = comp->allocate_out(0,comp->m_allocationSize);
326323

327-
// On failed allocation, error and deallocate
324+
// On failed allocation, error
328325
if (buff.getData() == nullptr) {
329326
Fw::LogStringArg _arg = comp->m_device;
330327
comp->log_WARNING_HI_NoBuffers(_arg);
331-
status = RecvStatus::RECV_ERROR;
328+
status = ByteStreamStatus::OTHER_ERROR;
332329
comp->recv_out(0, buff, status);
333330
// to avoid spinning, wait 50 ms
334331
Os::Task::delay(Fw::TimeInterval(0, 50000));
@@ -350,12 +347,12 @@ void LinuxUartDriver ::serialReadTaskEntry(void* ptr) {
350347
if (stat == -1) {
351348
Fw::LogStringArg _arg = comp->m_device;
352349
comp->log_WARNING_HI_ReadError(_arg, stat);
353-
status = RecvStatus::RECV_ERROR;
350+
status = ByteStreamStatus::OTHER_ERROR;
354351
} else if (stat > 0) {
355352
buff.setSize(static_cast<U32>(stat));
356-
status = RecvStatus::RECV_OK; // added by m.chase 03.06.2017
353+
status = ByteStreamStatus::OP_OK; // added by m.chase 03.06.2017
357354
} else {
358-
status = RecvStatus::RECV_ERROR; // Simply to return the buffer
355+
status = ByteStreamStatus::OTHER_ERROR; // Simply to return the buffer
359356
}
360357
comp->recv_out(0, buff, status); // added by m.chase 03.06.2017
361358
}

Drv/LinuxUartDriver/LinuxUartDriver.fpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ module Drv {
1111
@ Allocation port used for allocating memory in the receive task
1212
output port allocate: Fw.BufferGet
1313

14-
@ Deallocates buffers passed to the "send" port
15-
output port deallocate: Fw.BufferSend
16-
1714
# ----------------------------------------------------------------------
1815
# Special ports
1916
# ----------------------------------------------------------------------

Drv/LinuxUartDriver/LinuxUartDriver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class LinuxUartDriver final : public LinuxUartDriverComponentBase {
9393

9494
//! Handler implementation for serialSend
9595
//!
96-
Drv::SendStatus send_handler(FwIndexType portNum, /*!< The port number*/
96+
void send_handler(FwIndexType portNum, /*!< The port number*/
9797
Fw::Buffer& serBuffer);
9898

9999

0 commit comments

Comments
 (0)