sitara_depot/components/free_rtos/ethernet/eth_tx_flow.hpp

67 lines
1.6 KiB
C++
Raw Blame History

/*
* eth_tx_flow.hpp
*
* Created on: 7 <20><><EFBFBD>. 2023 <20>.
* Author: sychev
*/
#ifndef FREE_RTOS_ETHERNET_ETH_TX_FLOW_HPP_
#define FREE_RTOS_ETHERNET_ETH_TX_FLOW_HPP_
#include <cstdint>
#include <networking/enet/core/include/core/enet_dma.h>
#include "free_rtos/ethernet/eth_tx_flow_iface.hpp"
#include "free_rtos/handler_store/handler_store.hpp"
#include "free_rtos/semaphore/semaphore.hpp"
namespace free_rtos {
class EthTxFlow : public EthTxFlowIface {
public:
EthTxFlow();
bool open(TEthMacPorts port_id, int32_t enetDmaTxChId);
bool is_open() {return open_;}
void enable(TEthMacPorts port_id);
void disable(TEthMacPorts port_id);
virtual bool send(TEthMacPorts port_id, uint8_t * p_data, uint32_t len) override;
virtual bool send(TxFlowHandlerArgs& handlerArgs, uint32_t numScatterSegments) override;
private:
friend void txIsrHandler(void *appData);
enum SignalsId {
e_signalTxPkt,
e_signalTotal
};
struct PortData {
bool tx_enable;
uint32_t tx_pkt_counter;
};
TEthMacPorts default_port_id_;
bool open_;
Semaphore sem_[e_signalTotal];
//-------------------------------------------------
uint32_t tx_ch_num_;
EnetDma_TxChHandle dma_handle_; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> DMA
EnetDma_PktQ tx_free_pktq_; /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PortData port_data_[e_ethMacTotal];
void retrieveFreeTxPktQ();
EnetDma_Pkt* getTxPktInfo();
};
}
#endif /* FREE_RTOS_ETHERNET_ETH_TX_FLOW_HPP_ */