2023-05-03 14:01:32 +03:00
|
|
|
|
/*
|
|
|
|
|
|
* eth_tx_flow.hpp
|
|
|
|
|
|
*
|
2024-02-21 10:41:56 +03:00
|
|
|
|
* Created on: 7 мар. 2023 г.
|
2023-05-03 14:01:32 +03:00
|
|
|
|
* 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>
|
|
|
|
|
|
|
2023-06-26 18:22:30 +03:00
|
|
|
|
#include "free_rtos/ethernet/eth_tx_flow_iface.hpp"
|
|
|
|
|
|
#include "free_rtos/handler_store/handler_store.hpp"
|
2024-02-16 17:06:59 +03:00
|
|
|
|
#include "free_rtos/semaphore/semaphore.hpp"
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
namespace free_rtos {
|
|
|
|
|
|
|
|
|
|
|
|
class EthTxFlow : public EthTxFlowIface {
|
|
|
|
|
|
public:
|
|
|
|
|
|
EthTxFlow();
|
|
|
|
|
|
|
2024-02-16 17:06:59 +03:00
|
|
|
|
bool open(TEthMacPorts port_id, int32_t enetDmaTxChId);
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
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;
|
2023-10-24 14:02:04 +03:00
|
|
|
|
virtual bool send(TxFlowHandlerArgs& handlerArgs, uint32_t numScatterSegments) override;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
private:
|
2024-02-16 17:06:59 +03:00
|
|
|
|
friend void txIsrHandler(void *appData);
|
|
|
|
|
|
|
|
|
|
|
|
enum SignalsId {
|
|
|
|
|
|
e_signalTxPkt,
|
|
|
|
|
|
e_signalTotal
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2023-05-03 14:01:32 +03:00
|
|
|
|
struct PortData {
|
|
|
|
|
|
bool tx_enable;
|
|
|
|
|
|
uint32_t tx_pkt_counter;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-02-16 17:06:59 +03:00
|
|
|
|
TEthMacPorts default_port_id_;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
bool open_;
|
|
|
|
|
|
|
2024-02-16 17:06:59 +03:00
|
|
|
|
Semaphore sem_[e_signalTotal];
|
|
|
|
|
|
|
2023-05-03 14:01:32 +03:00
|
|
|
|
//-------------------------------------------------
|
|
|
|
|
|
uint32_t tx_ch_num_;
|
2024-02-21 10:41:56 +03:00
|
|
|
|
EnetDma_TxChHandle dma_handle_;
|
|
|
|
|
|
EnetDma_PktQ tx_free_pktq_;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
PortData port_data_[e_ethMacTotal];
|
2024-02-16 17:06:59 +03:00
|
|
|
|
|
|
|
|
|
|
void retrieveFreeTxPktQ();
|
|
|
|
|
|
EnetDma_Pkt* getTxPktInfo();
|
2023-05-03 14:01:32 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FREE_RTOS_ETHERNET_ETH_TX_FLOW_HPP_ */
|