Simple Packet Builder (build_packet_uc)
Takes in data read from file and encapsulates with header and tail bytes.
Design
A block diagram representation of the component function is given in Figure 21:.
Figure 21: Simple packet structure.
At the start of application, a stream of synchronization bytes (0x55) are passed to the output port. These bytes are intended to stabalize the receiver demodulator. The required number of bytes is set by the ‘num_of_sync_bytes’ parameter. It may be necessary to vary this number dependent of the desired rate. As the rate increases, more synchronization bytes may be required.
The header bytes are then passed to the output port. Both the header and tail bytes are sized to match the pattern specified by the application’s receiver pattern detector component pattern_detector_b. To support the FSK application, these values must match the values define for each pattern detection value.
Then, as unsigned character data bytes are received on the input port, the component forwards the bytes to the output. When an End-of-File (EOF) signal is received, the component passes the tail bytes to the output port and declares the application ‘done’.
The build_packet_uc component is intended to interface with the file_read component found in projects/core. It does not support read_file with embedded messages. The read_file property ‘messagesInFile’ must be set to ‘false’.
Interface
<?xml version="1.0"?>
<componentspec>
<property name="num_of_sync_bytes" type="ushort" writable="true"
default="150" description="Number of sync bytes
'0x55' to prepend to packet"/>
<property name="header_bytes" type="longlong" default="0x5555facefaceface"
writable="true" description="Packet header bytes."/>
<property name="tail_bytes" type="longlong" default="0x5efacefacefa5555"
writable="true" description="Packet tail bytes."/>
<port name="input" producer="false" protocol="uchar_timed_sample-prot" />
<port name="output" producer="true" protocol="uchar_timed_sample-prot"/>
</componentspec>
Opcode Handling
The component does not support processing of OpCodes. It is intended to be a simple component to receive only sample data on its input port. Specifically, it is intended to be used with the file_read component.
Properties
num_of_sync_bytes: Number of sync bytes ‘0x55’ to prepend to packet.Type:
ushortAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
150
header_bytes: Packet header bytes.Type:
longlongAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
0x5555facefaceface
tail_bytes: Packet tail bytes.Type:
longlongAccess:
Parameter:
FalseWritable:
TrueInitial:
FalseVolatile:
False
Default value:
0x5efacefacefa5555
Ports
Inputs:
input: Primary input samples port.Protocol:
uchar_timed_sample-protOptional:
False
Outputs:
output: Primary output samples port.Protocol:
uchar_timed_sample-protOptional:
False
Implementations
build_packet_uc(RCC)Implemented only as an RCC worker.
Example Application
<?xml version="1.0"?>
<application done="file_write">
<instance component="ocpi.core.file_read" connect="build_packet_uc">
<property name="filename" value="input.bin"/>
</instance>
<instance component="ocpi.examples.data_packet_uc" connect="file_write">
</instance>
<instance component="ocpi.core.file_write">
<property name="filename" value="output.bin"/>
</instance>
</application>
Dependencies
The dependencies to other elements in OpenCPI are:
None
Limitations
Limitations of build_packet_uc are:
Input interface requires uchar stream with EOF to terminate.
The messagesInFile is not supported by this component.
Testing
Tested platforms: None