sitara_depot/components/free_rtos/ethernet/eth_rx_flow.hpp

81 lines
1.8 KiB
C++
Raw Permalink Normal View History

/*
* eth_rx_dma.hpp
*
* Created on: 6 мар. 2023 г.
* Author: sychev
*/
#ifndef FREE_RTOS_ETHERNET_ETH_RX_DMA_HPP_
#define FREE_RTOS_ETHERNET_ETH_RX_DMA_HPP_
#include <cstdint>
#include <networking/enet/core/include/dma/udma/enet_udma.h>
#include <networking/enet/core/include/core/enet_dma.h>
#include <networking/enet/core/include/core/enet_queue.h>
#include "free_rtos/handler_store/handler_store.hpp"
#include "free_rtos/semaphore/semaphore.hpp"
#include "free_rtos/task/task.hpp"
#include "free_rtos/profiler/quick_profiler_static.hpp"
#include "free_rtos/ethernet/eth_task_settings.hpp"
#include "free_rtos/ethernet/eth_frame.h"
#include "free_rtos/ethernet_ip/eth_stack_iface.hpp"
namespace free_rtos {
class EthRxFlow {
public:
EthRxFlow(TEthFrameMacAddr& mac_addr, EthStackIface& eth_stack);
bool open(TEthMacPorts port_id, int32_t enetDmaRxChId, UBaseType_t task_priority, UBaseType_t task_stack_size);
bool is_open() {return open_;}
void set_passive() { passive_mode_ = true; }
private:
friend void rxIsrHandler(void *appData);
friend void rxTaskHandler(void *appData);
void initRxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, uint32_t qCount);
void retrieveReadyRxPktQ();
void submitFreeRxPktQ(EnetDma_PktQ * p_packet_queue);
void rxProcessPktTask();
private:
enum SignalsId {
e_signalRxPkt,
e_signalTotal
};
TEthMacPorts default_port_id_;
int32_t enetDmaRxChId_;
bool open_;
Semaphore sem_[e_signalTotal];
Task rx_task;
TEthFrameMacAddr& mac_addr_;
EthStackIface& eth_stack_;
uint32_t rx_start_flow_idx_;
uint32_t rx_flow_idx_;
EnetDma_RxChHandle dma_handle_;
EnetDma_PktQ rx_ready_pktq_;
bool passive_mode_;
};
}
#endif /* FREE_RTOS_ETHERNET_ETH_RX_DMA_HPP_ */