2023-05-03 14:01:32 +03:00
|
|
|
|
/*
|
|
|
|
|
|
* eth_rx_dma.hpp
|
|
|
|
|
|
*
|
2024-02-21 10:41:56 +03:00
|
|
|
|
* Created on: 6 мар. 2023 г.
|
2023-05-03 14:01:32 +03:00
|
|
|
|
* 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>
|
2023-09-22 10:59:11 +03:00
|
|
|
|
#include <networking/enet/core/include/core/enet_dma.h>
|
|
|
|
|
|
#include <networking/enet/core/include/core/enet_queue.h>
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2023-06-26 18:22:30 +03:00
|
|
|
|
#include "free_rtos/handler_store/handler_store.hpp"
|
|
|
|
|
|
#include "free_rtos/semaphore/semaphore.hpp"
|
|
|
|
|
|
#include "free_rtos/task/task.hpp"
|
2023-10-06 10:44:37 +03:00
|
|
|
|
#include "free_rtos/profiler/quick_profiler_static.hpp"
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2023-06-26 18:22:30 +03:00
|
|
|
|
#include "free_rtos/ethernet/eth_task_settings.hpp"
|
|
|
|
|
|
#include "free_rtos/ethernet/eth_frame.h"
|
|
|
|
|
|
#include "free_rtos/ethernet_ip/eth_stack_iface.hpp"
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
namespace free_rtos {
|
|
|
|
|
|
|
|
|
|
|
|
class EthRxFlow {
|
|
|
|
|
|
public:
|
|
|
|
|
|
EthRxFlow(TEthFrameMacAddr& mac_addr, EthStackIface& eth_stack);
|
|
|
|
|
|
|
2024-02-16 17:06:59 +03:00
|
|
|
|
bool open(TEthMacPorts port_id, int32_t enetDmaRxChId, UBaseType_t task_priority, UBaseType_t task_stack_size);
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
bool is_open() {return open_;}
|
|
|
|
|
|
|
|
|
|
|
|
void set_passive() { passive_mode_ = true; }
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
friend void rxIsrHandler(void *appData);
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
friend void rxTaskHandler(void *appData);
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2023-10-27 13:20:33 +03:00
|
|
|
|
void initRxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, uint32_t qCount);
|
2024-02-16 17:06:59 +03:00
|
|
|
|
void retrieveReadyRxPktQ();
|
|
|
|
|
|
void submitFreeRxPktQ(EnetDma_PktQ * p_packet_queue);
|
2023-09-22 10:59:11 +03:00
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
void rxProcessPktTask();
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
enum SignalsId {
|
2024-02-21 10:41:56 +03:00
|
|
|
|
e_signalRxPkt,
|
2023-05-03 14:01:32 +03:00
|
|
|
|
e_signalTotal
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
TEthMacPorts default_port_id_;
|
2023-11-01 11:48:36 +03:00
|
|
|
|
int32_t enetDmaRxChId_;
|
2024-02-21 10:41:56 +03:00
|
|
|
|
bool open_;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
Semaphore sem_[e_signalTotal];
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
Task rx_task;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
TEthFrameMacAddr& mac_addr_;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
|
|
|
|
|
EthStackIface& eth_stack_;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t rx_start_flow_idx_;
|
|
|
|
|
|
uint32_t rx_flow_idx_;
|
|
|
|
|
|
EnetDma_RxChHandle dma_handle_;
|
2024-02-16 17:06:59 +03:00
|
|
|
|
EnetDma_PktQ rx_ready_pktq_;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
|
2024-02-21 10:41:56 +03:00
|
|
|
|
bool passive_mode_;
|
2023-05-03 14:01:32 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* FREE_RTOS_ETHERNET_ETH_RX_DMA_HPP_ */
|