25 m_protocol(nullptr), m_in_ring(m_ring_buffer, sizeof(m_ring_buffer))
29 DeframerComponentBase::init(instance);
36 m_protocol = &protocol;
37 protocol.
setup(*
this);
45 void DeframerComponentImpl ::cmdResponseIn_handler(
NATIVE_INT_TYPE portNum,
48 const Fw::CmdResponse& response) {
52 void DeframerComponentImpl ::framedIn_handler(
const NATIVE_INT_TYPE portNum,
54 const Drv::RecvStatus& recvStatus) {
55 if (Drv::RecvStatus::RECV_OK == recvStatus.e) {
56 processBuffer(recvBuffer);
58 framedDeallocate_out(0, recvBuffer);
62 Fw::Buffer buffer(m_poll_buffer,
sizeof(m_poll_buffer));
64 if (isConnected_framedPoll_OutputPort(0)) {
65 Drv::PollStatus status = framedPoll_out(0, buffer);
66 if (status == Drv::PollStatus::POLL_OK) {
67 processBuffer(buffer);
72 Fw::Buffer DeframerComponentImpl ::allocate(
const U32 size) {
73 return bufferAllocate_out(0, size);
76 void DeframerComponentImpl ::route(
Fw::Buffer& data) {
85 bufferDeallocate_out(0, data);
90 switch (packet_type) {
94 comOut_out(0, com, 0);
96 bufferDeallocate_out(0, data);
101 if (isConnected_bufferOut_OutputPort(0)) {
105 bufferOut_out(0, data);
111 bufferDeallocate_out(0, data);
116 void DeframerComponentImpl ::processRing() {
154 void DeframerComponentImpl ::processBuffer(
Fw::Buffer& buffer) {
156 U32 buffer_offset = 0;
158 for (i = 0; (i < (buffer.
getSize() + 1)) and (buffer_offset < buffer.
getSize()); i++) {
159 U32 remaining = buffer.
getSize() - buffer_offset;
164 buffer_offset = buffer_offset + ser_size;