fix(SF-60): Багфиксы, багфиксы, багфиксы
This commit is contained in:
parent
6f3fe15497
commit
87ccf2c5cc
@ -32,7 +32,7 @@ static void eth_initTxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue)
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int i_max = ENET_SYSCFG_TOTAL_NUM_TX_PKT;
|
int i_max = (ENET_SYSCFG_TOTAL_NUM_TX_PKT);
|
||||||
|
|
||||||
/* Initialize TX EthPkts and queue them to txFreePktInfoQ */
|
/* Initialize TX EthPkts and queue them to txFreePktInfoQ */
|
||||||
for (i = 0U; i < i_max; i++)
|
for (i = 0U; i < i_max; i++)
|
||||||
@ -125,7 +125,7 @@ bool free_rtos::EthTxFlow::open(uint32_t id, int32_t enetDmaTxChId)
|
|||||||
dma_handle_ = txChInfo.hTxCh;
|
dma_handle_ = txChInfo.hTxCh;
|
||||||
|
|
||||||
EnetAppUtils_assert(txChInfo.useGlobalEvt == true);
|
EnetAppUtils_assert(txChInfo.useGlobalEvt == true);
|
||||||
EnetAppUtils_assert(txChInfo.maxNumTxPkts >= ENET_SYSCFG_TOTAL_NUM_TX_PKT);
|
EnetAppUtils_assert(txChInfo.maxNumTxPkts >= (ENET_SYSCFG_TOTAL_NUM_TX_PKT));
|
||||||
|
|
||||||
if (dma_handle_ == nullptr)
|
if (dma_handle_ == nullptr)
|
||||||
{
|
{
|
||||||
@ -173,16 +173,12 @@ bool free_rtos::EthTxFlow::send(TEthMacPorts port_id, uint8_t * p_data, uint32_t
|
|||||||
EnetDma_Pkt *txPktInfo;
|
EnetDma_Pkt *txPktInfo;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
/*
|
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> enet <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> txFreePktInfoQ
|
|
||||||
*/
|
|
||||||
eth_retrieveFreeTxPkts(&dma_handle_, &tx_free_pktq_);
|
|
||||||
|
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> txSubmitQ
|
|
||||||
EnetQueue_initQ(&txSubmitQ);
|
EnetQueue_initQ(&txSubmitQ);
|
||||||
|
|
||||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> TX Eth */
|
eth_retrieveFreeTxPkts(&dma_handle_, &tx_free_pktq_);
|
||||||
|
|
||||||
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
|
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
|
||||||
|
|
||||||
if (txPktInfo != NULL)
|
if (txPktInfo != NULL)
|
||||||
{
|
{
|
||||||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||||
@ -227,10 +223,12 @@ bool free_rtos::EthTxFlow::send(TEthMacPorts port_id, uint8_t * p_data, uint32_t
|
|||||||
bool free_rtos::EthTxFlow::send(TxFlowHandlerArgs& handlerArgs, uint32_t numScatterSegments)
|
bool free_rtos::EthTxFlow::send(TxFlowHandlerArgs& handlerArgs, uint32_t numScatterSegments)
|
||||||
{
|
{
|
||||||
if (handlerArgs.port_id >= e_ethMacTotal) {
|
if (handlerArgs.port_id >= e_ethMacTotal) {
|
||||||
|
EnetAppUtils_print("Wrong port id\r\n");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!port_data_[handlerArgs.port_id].tx_enable) {
|
if (port_data_[handlerArgs.port_id].tx_enable == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,24 +236,25 @@ bool free_rtos::EthTxFlow::send(TxFlowHandlerArgs& handlerArgs, uint32_t numScat
|
|||||||
EnetDma_Pkt *txPktInfo;
|
EnetDma_Pkt *txPktInfo;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
eth_retrieveFreeTxPkts(&dma_handle_, &tx_free_pktq_);
|
|
||||||
|
|
||||||
EnetQueue_initQ(&txSubmitQ);
|
EnetQueue_initQ(&txSubmitQ);
|
||||||
|
|
||||||
|
eth_retrieveFreeTxPkts(&dma_handle_, &tx_free_pktq_);
|
||||||
|
|
||||||
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
|
txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_);
|
||||||
|
|
||||||
if (txPktInfo != NULL)
|
if (txPktInfo != NULL)
|
||||||
{
|
{
|
||||||
for(size_t scatter_segment = 0; scatter_segment < numScatterSegments; scatter_segment++)
|
for(size_t scatter_segment = 0; scatter_segment < numScatterSegments; scatter_segment++)
|
||||||
{
|
{
|
||||||
handlerArgs.buffer = txPktInfo->sgList.list[scatter_segment].bufPtr;
|
handlerArgs.buffer = txPktInfo->sgList.list[scatter_segment].bufPtr;
|
||||||
txPktInfo->sgList.list[scatter_segment].segmentFilledLen = handlerArgs.stack_handler->Sender(handlerArgs, scatter_segment);
|
txPktInfo->sgList.list[scatter_segment].segmentFilledLen = handlerArgs.stack_handler->Sender(handlerArgs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
txPktInfo->sgList.numScatterSegments = numScatterSegments;
|
txPktInfo->sgList.numScatterSegments = 1;
|
||||||
txPktInfo->chkSumInfo = 0U;
|
txPktInfo->chkSumInfo = 0U;
|
||||||
txPktInfo->appPriv = nullptr;
|
txPktInfo->appPriv = nullptr;
|
||||||
txPktInfo->tsInfo.txPktSeqId = 0;
|
txPktInfo->tsInfo.txPktSeqId = 0;
|
||||||
txPktInfo->txPktTc = 0; /// Traffic class <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> IPv6
|
txPktInfo->txPktTc = 0; /// Traffic class IPv6
|
||||||
txPktInfo->tsInfo.enableHostTxTs = false;
|
txPktInfo->tsInfo.enableHostTxTs = false;
|
||||||
txPktInfo->txPortNum = (Enet_MacPort)handlerArgs.port_id;
|
txPktInfo->txPortNum = (Enet_MacPort)handlerArgs.port_id;
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ EthEcat::EthEcat(Eth& eth)
|
|||||||
|
|
||||||
void EthEcat::Init(TEthMacPorts port_id, uint32_t period_microsec = 250) {
|
void EthEcat::Init(TEthMacPorts port_id, uint32_t period_microsec = 250) {
|
||||||
port_id_ = port_id;
|
port_id_ = port_id;
|
||||||
telegram_.init(port_id, period_microsec, 6);
|
telegram_.init(port_id, period_microsec, 4);
|
||||||
|
|
||||||
Timer::Settings ecat_tmr_sett = {
|
Timer::Settings ecat_tmr_sett = {
|
||||||
.input_clk_Hz = 25000000, // 25MHz
|
.input_clk_Hz = 25000000, // 25MHz
|
||||||
|
|||||||
@ -51,7 +51,7 @@ int32_t EcatTelegram::Process(uint8_t *p_data, uint32_t len) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t EcatTelegram::Sender(HandlerArgs& handlerArgs, size_t scatter_segment) {
|
uint16_t EcatTelegram::Sender(HandlerArgs& handlerArgs, size_t scatter_segment) {
|
||||||
uint8_t *raw = pack(handlerArgs.buffer);
|
uint8_t *raw = pack(handlerArgs.buffer);
|
||||||
|
|
||||||
//DebugP_log((char*)"Sender started\r\n");
|
//DebugP_log((char*)"Sender started\r\n");
|
||||||
@ -118,6 +118,7 @@ bool EcatTelegram::transfer() {
|
|||||||
|
|
||||||
txFlowHandlerArgs.port_id = port_id_;
|
txFlowHandlerArgs.port_id = port_id_;
|
||||||
txFlowHandlerArgs.stack_handler = this;
|
txFlowHandlerArgs.stack_handler = this;
|
||||||
|
txFlowHandlerArgs.buffer = nullptr;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
tick_counter_start = ecat_timer_.Wait();
|
tick_counter_start = ecat_timer_.Wait();
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual int32_t Process(uint8_t *p_data, uint32_t len) override;
|
virtual int32_t Process(uint8_t *p_data, uint32_t len) override;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
||||||
|
|
||||||
void init(TEthMacPorts port_id, uint32_t period_microsec, uint32_t max_transfer_attempts) {
|
void init(TEthMacPorts port_id, uint32_t period_microsec, uint32_t max_transfer_attempts) {
|
||||||
port_id_ = port_id;
|
port_id_ = port_id;
|
||||||
|
|||||||
@ -205,7 +205,7 @@ int32_t free_rtos::EthArp::Process(uint8_t * p_data, uint32_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t free_rtos::EthArp::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
uint16_t free_rtos::EthArp::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public:
|
|||||||
bool try_request(uint32_t ip);
|
bool try_request(uint32_t ip);
|
||||||
|
|
||||||
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
||||||
private:
|
private:
|
||||||
bool request(uint32_t ip);
|
bool request(uint32_t ip);
|
||||||
|
|
||||||
|
|||||||
@ -25,3 +25,30 @@ uint16_t eth_calcChksum(uint32_t sum, uint8_t * const data, uint16_t len)
|
|||||||
|
|
||||||
return ~sum;
|
return ~sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t eth_calcChksum2(uint32_t sum, uint8_t * const hdata, uint16_t hlen, uint8_t * const data, uint16_t len)
|
||||||
|
{
|
||||||
|
uint16_t i;
|
||||||
|
uint16_t hsize = hlen - 1;
|
||||||
|
uint16_t size = len - 1;
|
||||||
|
|
||||||
|
if ( (hlen == 0) || (len == 0) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for ( i = 0; i < hsize; i+=2 )
|
||||||
|
sum += ((uint16_t)hdata[i] << 8) + hdata[i+1];
|
||||||
|
|
||||||
|
if (hlen & 0x01)
|
||||||
|
sum += (uint16_t)hdata[i] << 8;
|
||||||
|
|
||||||
|
for ( i = 0; i < size; i+=2 )
|
||||||
|
sum += ((uint16_t)data[i] << 8) + data[i+1];
|
||||||
|
|
||||||
|
if (len & 0x01)
|
||||||
|
sum += (uint16_t)data[i] << 8;
|
||||||
|
|
||||||
|
while ( sum >> 16 )
|
||||||
|
sum = (sum & 0xFFFF) + (sum >> 16);
|
||||||
|
|
||||||
|
return ~sum;
|
||||||
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t eth_calcChksum(uint32_t sum, uint8_t * const data, uint16_t len);
|
uint16_t eth_calcChksum(uint32_t sum, uint8_t * const data, uint16_t len);
|
||||||
|
uint16_t eth_calcChksum2(uint32_t sum, uint8_t * const hdata, uint16_t hlen, uint8_t * const data, uint16_t len);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,7 @@ int32_t free_rtos::EthIcmp::Process(uint8_t * p_data, uint32_t len)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t free_rtos::EthIcmp::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
uint16_t free_rtos::EthIcmp::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace free_rtos {
|
|||||||
class EthIcmp : public Handler {
|
class EthIcmp : public Handler {
|
||||||
public:
|
public:
|
||||||
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
||||||
|
|
||||||
uint32_t getStat() {return rx_cnt_;};
|
uint32_t getStat() {return rx_cnt_;};
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -89,14 +89,44 @@ bool free_rtos::EthIp::send(TEthMacPorts port_id, uint32_t dest_ip, uint8_t prot
|
|||||||
return eth_stack_.send_pkt(port_id, mac_dst, ETH_PROT_IP_BE, pkt);
|
return eth_stack_.send_pkt(port_id, mac_dst, ETH_PROT_IP_BE, pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint16_t free_rtos::EthIp::fillIpHeader(IpHandlerArgs& ipHandlerArgs)
|
||||||
|
{
|
||||||
|
static_assert(sizeof(TIpHeader) == (IP_HEADER_WORD_SIZE * 4), "Ip header size doesn't match version !");
|
||||||
|
|
||||||
|
uint16_t ip_len = sizeof(TIpHeader) + ipHandlerArgs.ip_header_len + ipHandlerArgs.ip_data_len;
|
||||||
|
uint16_t cksum = 0;
|
||||||
|
|
||||||
|
memcpy(ipHandlerArgs.ip_header.ip_src, &self_ip_, ETH_IP_ADDR_LEN);
|
||||||
|
memcpy(ipHandlerArgs.ip_header.ip_dst, &ipHandlerArgs.dest_ip, ETH_IP_ADDR_LEN);
|
||||||
|
|
||||||
|
ipHandlerArgs.ip_header.ip_hl_v = (IP_VER << 4) | IP_HEADER_WORD_SIZE;
|
||||||
|
ipHandlerArgs.ip_header.ip_tos = 0;
|
||||||
|
ipHandlerArgs.ip_header.ip_len = BASE_SWAP16(ip_len);
|
||||||
|
ipHandlerArgs.ip_header.ip_id = BASE_SWAP16(ip_indet_);
|
||||||
|
ipHandlerArgs.ip_header.ip_off = 0;
|
||||||
|
ipHandlerArgs.ip_header.ip_ttl = IP_TIME_TO_LIVE;
|
||||||
|
ipHandlerArgs.ip_header.ip_p = ipHandlerArgs.ip_prot_id;
|
||||||
|
ipHandlerArgs.ip_header.ip_sum = 0;
|
||||||
|
|
||||||
|
cksum = eth_calcChksum(0, (uint8_t *)&ipHandlerArgs.ip_header, sizeof(TIpHeader));
|
||||||
|
|
||||||
|
ipHandlerArgs.ip_header.ip_sum = BASE_SWAP16(cksum);
|
||||||
|
|
||||||
|
++ip_indet_;
|
||||||
|
|
||||||
|
return sizeof(TIpHeader);
|
||||||
|
}
|
||||||
|
|
||||||
bool free_rtos::EthIp::send(IpHandlerArgs& handlerArgs)
|
bool free_rtos::EthIp::send(IpHandlerArgs& handlerArgs)
|
||||||
{
|
{
|
||||||
handlerArgs.stack_handler = this;
|
handlerArgs.stack_handler = this;
|
||||||
|
|
||||||
|
fillIpHeader(handlerArgs);
|
||||||
|
|
||||||
return eth_stack_.send_pkt(handlerArgs);
|
return eth_stack_.send_pkt(handlerArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t free_rtos::EthIp::fillEthFrameHeader(IpHandlerArgs& ipHandlerArgs)
|
inline uint16_t free_rtos::EthIp::fillEthFrameHeader(IpHandlerArgs& ipHandlerArgs)
|
||||||
{
|
{
|
||||||
TEthFrameHeader * p_eth_hdr = (TEthFrameHeader *)ipHandlerArgs.buffer;
|
TEthFrameHeader * p_eth_hdr = (TEthFrameHeader *)ipHandlerArgs.buffer;
|
||||||
uint64_t mac_dst;
|
uint64_t mac_dst;
|
||||||
@ -105,7 +135,7 @@ inline uint32_t free_rtos::EthIp::fillEthFrameHeader(IpHandlerArgs& ipHandlerArg
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_eth_hdr->prot_id = ipHandlerArgs.ip_prot_id;
|
p_eth_hdr->prot_id = ETH_PROT_IP_BE;
|
||||||
|
|
||||||
memcpy(p_eth_hdr->mac_src, &self_mac_, ETH_FRAME_MAC_ADDR_LEN_BYTES);
|
memcpy(p_eth_hdr->mac_src, &self_mac_, ETH_FRAME_MAC_ADDR_LEN_BYTES);
|
||||||
memcpy(p_eth_hdr->mac_dest, &mac_dst, ETH_FRAME_MAC_ADDR_LEN_BYTES);
|
memcpy(p_eth_hdr->mac_dest, &mac_dst, ETH_FRAME_MAC_ADDR_LEN_BYTES);
|
||||||
@ -113,46 +143,20 @@ inline uint32_t free_rtos::EthIp::fillEthFrameHeader(IpHandlerArgs& ipHandlerArg
|
|||||||
return sizeof(TEthFrameHeader);
|
return sizeof(TEthFrameHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t free_rtos::EthIp::fillIpHeader(IpHandlerArgs& ipHandlerArgs, uint32_t ip_len)
|
uint16_t free_rtos::EthIp::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
||||||
{
|
{
|
||||||
TIpHeader * ip_header = (TIpHeader *)(ipHandlerArgs.buffer + sizeof(TEthFrameHeader));
|
|
||||||
uint16_t cksum = 0;
|
|
||||||
|
|
||||||
memcpy(ip_header->ip_src, &self_ip_, ETH_IP_ADDR_LEN);
|
|
||||||
memcpy(ip_header->ip_dst, &ipHandlerArgs.dest_ip, ETH_IP_ADDR_LEN);
|
|
||||||
|
|
||||||
ip_header->ip_hl_v = (IP_VER << 4) | IP_HEADER_WORD_SIZE;
|
|
||||||
ip_header->ip_tos = 0;
|
|
||||||
ip_header->ip_len = BASE_SWAP16(ip_len);
|
|
||||||
ip_header->ip_id = BASE_SWAP16(ip_indet_);
|
|
||||||
ip_header->ip_off = 0;
|
|
||||||
ip_header->ip_ttl = IP_TIME_TO_LIVE;
|
|
||||||
ip_header->ip_p = ipHandlerArgs.ip_prot_id;
|
|
||||||
ip_header->ip_sum = 0;
|
|
||||||
|
|
||||||
cksum = eth_calcChksum(0, (uint8_t *)ip_header, sizeof(TIpHeader));
|
|
||||||
|
|
||||||
ip_header->ip_sum = BASE_SWAP16(cksum);
|
|
||||||
|
|
||||||
++ip_indet_;
|
|
||||||
|
|
||||||
return sizeof(TIpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t free_rtos::EthIp::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
|
||||||
{
|
|
||||||
static_assert(sizeof(TIpHeader) == (IP_HEADER_WORD_SIZE * 4), "Ip header size doesn't match version !");
|
|
||||||
|
|
||||||
IpHandlerArgs& ipHandlerArgs = static_cast<IpHandlerArgs&>(handlerArgs); // downcasting back to derived type
|
IpHandlerArgs& ipHandlerArgs = static_cast<IpHandlerArgs&>(handlerArgs); // downcasting back to derived type
|
||||||
uint32_t ip_len = ipHandlerArgs.ip_handler->Sender(ipHandlerArgs, scatter_segment);
|
|
||||||
|
|
||||||
if(fillEthFrameHeader(ipHandlerArgs) == 0) {
|
if(fillEthFrameHeader(ipHandlerArgs) == 0) {
|
||||||
return 0;
|
//EnetAppUtils_print("Cannot find destination mac\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fillIpHeader(ipHandlerArgs, ip_len);
|
TIpHeader * ip_header = (TIpHeader *)(ipHandlerArgs.buffer + sizeof(TEthFrameHeader));
|
||||||
|
*ip_header = ipHandlerArgs.ip_header;
|
||||||
|
|
||||||
return sizeof(TEthFrameHeader) + sizeof(TIpHeader) + ip_len;
|
ipHandlerArgs.ip_handler->Sender(ipHandlerArgs, scatter_segment);
|
||||||
|
|
||||||
|
return sizeof(TEthFrameHeader) + sizeof(TIpHeader) + ipHandlerArgs.ip_header_len + ipHandlerArgs.ip_data_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t free_rtos::EthIp::Process(uint8_t * p_data, uint32_t len)
|
int32_t free_rtos::EthIp::Process(uint8_t * p_data, uint32_t len)
|
||||||
|
|||||||
@ -33,7 +33,7 @@ public:
|
|||||||
virtual bool send(IpHandlerArgs& handlerArgs) override;
|
virtual bool send(IpHandlerArgs& handlerArgs) override;
|
||||||
|
|
||||||
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
||||||
|
|
||||||
bool Register(uint8_t prot_id, Handler * p_handler);
|
bool Register(uint8_t prot_id, Handler * p_handler);
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ private:
|
|||||||
|
|
||||||
uint16_t ip_indet_; /// \u043f\u0457\u0405\u043f\u0457\u0405\u043f\u0457\u0405\u043f\u0457\u0405 ip_id
|
uint16_t ip_indet_; /// \u043f\u0457\u0405\u043f\u0457\u0405\u043f\u0457\u0405\u043f\u0457\u0405 ip_id
|
||||||
|
|
||||||
inline uint32_t fillEthFrameHeader(IpHandlerArgs& ipHandlerArgs);
|
inline uint16_t fillIpHeader(IpHandlerArgs& handlerArgs);
|
||||||
inline uint32_t fillIpHeader(IpHandlerArgs& ipHandlerArgs, uint32_t ip_len);
|
inline uint16_t fillEthFrameHeader(IpHandlerArgs& ipHandlerArgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,12 +11,16 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "free_rtos/ethernet/eth_types.h"
|
#include "free_rtos/ethernet/eth_types.h"
|
||||||
#include "free_rtos/ethernet/eth_frame.h"
|
#include "free_rtos/ethernet/eth_frame.h"
|
||||||
|
#include "free_rtos/ethernet_ip/eth_ip_types.h"
|
||||||
#include "free_rtos/ethernet_ip/eth_stack_iface.hpp"
|
#include "free_rtos/ethernet_ip/eth_stack_iface.hpp"
|
||||||
|
|
||||||
struct IpHandlerArgs : public EthStackHandlerArgs {
|
struct IpHandlerArgs : public EthStackHandlerArgs {
|
||||||
|
uint16_t ip_header_len;
|
||||||
|
uint16_t ip_data_len;
|
||||||
uint32_t dest_ip;
|
uint32_t dest_ip;
|
||||||
uint8_t ip_prot_id;
|
uint8_t ip_prot_id;
|
||||||
Handler* ip_handler;
|
Handler* ip_handler;
|
||||||
|
TIpHeader ip_header;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EthIpIface {
|
class EthIpIface {
|
||||||
|
|||||||
@ -66,7 +66,7 @@ bool free_rtos::EthStack::send_pkt(TEthMacPorts port_id, uint64_t mac_dst, uint1
|
|||||||
|
|
||||||
bool free_rtos::EthStack::send_pkt(EthStackHandlerArgs& handlerArgs)
|
bool free_rtos::EthStack::send_pkt(EthStackHandlerArgs& handlerArgs)
|
||||||
{
|
{
|
||||||
handlerArgs.port_id = eth_.mac_port_; // overwriting
|
//handlerArgs.port_id = eth_.mac_port_; // overwriting
|
||||||
|
|
||||||
return tx_flow_.send(handlerArgs, 1);
|
return tx_flow_.send(handlerArgs, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "free_rtos/ethernet_ip/eth_udp_client.hpp"
|
#include "free_rtos/ethernet_ip/eth_udp_client.hpp"
|
||||||
#include "free_rtos/base/swap.h"
|
#include "free_rtos/base/swap.h"
|
||||||
#include "free_rtos/ethernet_ip/eth_udp_types.h"
|
|
||||||
#include "free_rtos/ethernet_ip/eth_ip_types.h"
|
#include "free_rtos/ethernet_ip/eth_ip_types.h"
|
||||||
#include "free_rtos/ethernet_ip/eth_checksum.h"
|
#include "free_rtos/ethernet_ip/eth_checksum.h"
|
||||||
#include "free_rtos/ethernet_ip/eth_ip_prots_id.h"
|
#include "free_rtos/ethernet_ip/eth_ip_prots_id.h"
|
||||||
@ -50,10 +49,10 @@ void free_rtos::EthUpdClient::put_data(uint8_t * p_data, uint32_t len)
|
|||||||
rx_sem_.post();
|
rx_sem_.post();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t free_rtos::EthUpdClient::get_data(uint8_t * p_data, uint32_t len)
|
size_t free_rtos::EthUpdClient::get_data(uint8_t * p_data, uint32_t len)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t>& buff = buff_[out_toggle_];
|
std::vector<uint8_t>& buff = buff_[out_toggle_];
|
||||||
uint32_t size = buff.size();
|
size_t size = buff.size();
|
||||||
|
|
||||||
if (size > len) {
|
if (size > len) {
|
||||||
size = len;
|
size = len;
|
||||||
@ -74,23 +73,25 @@ bool free_rtos::EthUpdClient::capture_buffer()
|
|||||||
UDPToggle expected = static_cast<UDPToggle>((desired + 1)%UDPToggle::UDP_BUF_NUM);
|
UDPToggle expected = static_cast<UDPToggle>((desired + 1)%UDPToggle::UDP_BUF_NUM);
|
||||||
|
|
||||||
if(in_toggle_.compare_exchange_weak(expected, desired) == false) {
|
if(in_toggle_.compare_exchange_weak(expected, desired) == false) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
out_toggle_ = expected;
|
out_toggle_ = expected;
|
||||||
|
|
||||||
return buff_[expected].empty();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t free_rtos::EthUpdClient::get_data_size()
|
size_t free_rtos::EthUpdClient::get_data_size()
|
||||||
{
|
{
|
||||||
if (buff_[out_toggle_].empty() == true) {
|
size_t size = buff_[out_toggle_].size();
|
||||||
if(capture_buffer() == true) {
|
|
||||||
return 0;
|
if (size == 0) {
|
||||||
|
if(capture_buffer() != false) {
|
||||||
|
size = buff_[out_toggle_].size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return buff_[out_toggle_].size();
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t free_rtos::EthUpdClient::read(uint8_t * p_data, uint32_t len)
|
int32_t free_rtos::EthUpdClient::read(uint8_t * p_data, uint32_t len)
|
||||||
@ -99,8 +100,8 @@ int32_t free_rtos::EthUpdClient::read(uint8_t * p_data, uint32_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(buff_[out_toggle_].empty() == true) {
|
if(buff_[out_toggle_].size() == 0) {
|
||||||
while (capture_buffer() == true) {
|
while (capture_buffer() == false) {
|
||||||
rx_sem_.pend();
|
rx_sem_.pend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,8 +115,8 @@ int32_t free_rtos::EthUpdClient::read_async(uint8_t * p_data, uint32_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buff_[out_toggle_].empty() == true) {
|
if (buff_[out_toggle_].size() == 0) {
|
||||||
if(capture_buffer() == true) {
|
if(capture_buffer() == false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +127,14 @@ int32_t free_rtos::EthUpdClient::read_async(uint8_t * p_data, uint32_t len)
|
|||||||
void free_rtos::EthUpdClient::clear()
|
void free_rtos::EthUpdClient::clear()
|
||||||
{
|
{
|
||||||
buff_[out_toggle_].clear();
|
buff_[out_toggle_].clear();
|
||||||
|
|
||||||
|
while (capture_buffer() == false) {
|
||||||
|
rx_sem_.pend();
|
||||||
|
}
|
||||||
|
|
||||||
|
buff_[out_toggle_].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32_t len)
|
bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32_t len)
|
||||||
{
|
{
|
||||||
@ -169,42 +177,18 @@ bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32
|
|||||||
return ip_iface_.send(port_id_, ip_dst_be, IP_PROT_UDP, eth_pkt_);
|
return ip_iface_.send(port_id_, ip_dst_be, IP_PROT_UDP, eth_pkt_);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32_t len)
|
|
||||||
{
|
|
||||||
UDPHandlerArgs udpHandlerArgs;
|
|
||||||
|
|
||||||
udpHandlerArgs.port_id = port_id_;
|
uint16_t free_rtos::EthUpdClient::fill_udp_header(UDPHandlerArgs& udpHandlerArgs) {
|
||||||
udpHandlerArgs.dest_ip = ip_dst_be;
|
uint16_t udp_len = udpHandlerArgs.ip_header_len + udpHandlerArgs.ip_data_len;
|
||||||
udpHandlerArgs.ip_prot_id = IP_PROT_UDP;
|
|
||||||
udpHandlerArgs.ip_handler = this;
|
|
||||||
udpHandlerArgs.p_data = p_data;
|
|
||||||
udpHandlerArgs.len = len;
|
|
||||||
|
|
||||||
return ip_iface_.send(udpHandlerArgs);
|
udpHandlerArgs.udp_header.Src_port = port_src_be_;
|
||||||
}
|
udpHandlerArgs.udp_header.Dst_port = port_dst_be_;
|
||||||
|
udpHandlerArgs.udp_header.Length = BASE_SWAP16(udp_len);
|
||||||
uint32_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
udpHandlerArgs.udp_header.Chk_sum = 0;
|
||||||
{
|
|
||||||
UDPHandlerArgs& udpHandlerArgs = static_cast<UDPHandlerArgs&>(handlerArgs); // downcasting back to derived type
|
|
||||||
TUdpHeader * hdr = (TUdpHeader *)(udpHandlerArgs.buffer + sizeof(TEthFrameHeader) + sizeof(TIpHeader));
|
|
||||||
uint8_t * p_udp_data = (uint8_t *)(udpHandlerArgs.buffer + sizeof(TEthFrameHeader) + sizeof(TIpHeader) + sizeof(TUdpHeader));
|
|
||||||
uint32_t udp_len = udpHandlerArgs.len + sizeof(TUdpHeader);
|
|
||||||
|
|
||||||
if (udpHandlerArgs.dest_ip == 0) {
|
|
||||||
udpHandlerArgs.dest_ip = src_ip_;
|
|
||||||
}
|
|
||||||
|
|
||||||
hdr->Src_port = port_src_be_;
|
|
||||||
hdr->Dst_port = port_dst_be_;
|
|
||||||
hdr->Length = BASE_SWAP16(udp_len);
|
|
||||||
hdr->Chk_sum = 0;
|
|
||||||
|
|
||||||
memcpy(p_udp_data, udpHandlerArgs.p_data, udpHandlerArgs.len);
|
|
||||||
|
|
||||||
if (use_checksum_) {
|
if (use_checksum_) {
|
||||||
uint32_t self_ip = ip_iface_.getSelfIpAddr();
|
uint32_t self_ip = ip_iface_.getSelfIpAddr();
|
||||||
uint32_t chk_sum32 = 0;
|
uint32_t chk_sum32 = 0;
|
||||||
|
|
||||||
uint8_t * const dst_ip = (uint8_t *)&udpHandlerArgs.dest_ip;
|
uint8_t * const dst_ip = (uint8_t *)&udpHandlerArgs.dest_ip;
|
||||||
uint8_t * const src_ip = (uint8_t *)&self_ip;
|
uint8_t * const src_ip = (uint8_t *)&self_ip;
|
||||||
|
|
||||||
@ -216,12 +200,47 @@ uint32_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatte
|
|||||||
|
|
||||||
chk_sum32 += IP_PROT_UDP + udp_len;
|
chk_sum32 += IP_PROT_UDP + udp_len;
|
||||||
|
|
||||||
uint16_t chk_sum16 = eth_calcChksum(chk_sum32, (uint8_t *)hdr, udp_len);
|
uint16_t chk_sum16 = eth_calcChksum2(chk_sum32, (uint8_t *)&udpHandlerArgs.udp_header, sizeof(TUdpHeader), (uint8_t *)udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len);
|
||||||
|
|
||||||
hdr->Chk_sum = BASE_SWAP16(chk_sum16);
|
udpHandlerArgs.udp_header.Chk_sum = BASE_SWAP16(chk_sum16);
|
||||||
}
|
}
|
||||||
|
|
||||||
return udp_len;
|
return sizeof(TUdpHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32_t len)
|
||||||
|
{
|
||||||
|
UDPHandlerArgs udpHandlerArgs;
|
||||||
|
|
||||||
|
if (ip_dst_be == 0) {
|
||||||
|
ip_dst_be = src_ip_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//udpHandlerArgs.buffer = nullptr;
|
||||||
|
udpHandlerArgs.port_id = port_id_;
|
||||||
|
//udpHandlerArgs.stack_handler = nullptr;
|
||||||
|
udpHandlerArgs.ip_header_len = sizeof(TUdpHeader);
|
||||||
|
udpHandlerArgs.ip_data_len = len;
|
||||||
|
udpHandlerArgs.dest_ip = ip_dst_be;
|
||||||
|
udpHandlerArgs.ip_prot_id = IP_PROT_UDP;
|
||||||
|
udpHandlerArgs.ip_handler = this;
|
||||||
|
udpHandlerArgs.p_data = p_data;
|
||||||
|
|
||||||
|
fill_udp_header(udpHandlerArgs);
|
||||||
|
|
||||||
|
return ip_iface_.send(udpHandlerArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
||||||
|
{
|
||||||
|
UDPHandlerArgs& udpHandlerArgs = static_cast<UDPHandlerArgs&>(handlerArgs); // downcasting back to derived type
|
||||||
|
TUdpHeader * hdr = (TUdpHeader *)(udpHandlerArgs.buffer + sizeof(TEthFrameHeader) + sizeof(TIpHeader));
|
||||||
|
uint8_t * p_udp_data = (uint8_t *)(udpHandlerArgs.buffer + sizeof(TEthFrameHeader) + sizeof(TIpHeader) + sizeof(TUdpHeader));
|
||||||
|
|
||||||
|
*hdr = udpHandlerArgs.udp_header;
|
||||||
|
memcpy(p_udp_data, udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len);
|
||||||
|
|
||||||
|
return udpHandlerArgs.ip_header_len + udpHandlerArgs.ip_data_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t free_rtos::EthUpdClient::Process(uint8_t * p_data, uint32_t len)
|
int32_t free_rtos::EthUpdClient::Process(uint8_t * p_data, uint32_t len)
|
||||||
|
|||||||
@ -21,13 +21,14 @@
|
|||||||
#include "free_rtos/ethernet/eth_frame.h"
|
#include "free_rtos/ethernet/eth_frame.h"
|
||||||
#include "free_rtos/ethernet_ip/eth_ip_iface.hpp"
|
#include "free_rtos/ethernet_ip/eth_ip_iface.hpp"
|
||||||
#include "free_rtos/ethernet/eth_types.h"
|
#include "free_rtos/ethernet/eth_types.h"
|
||||||
|
#include "free_rtos/ethernet_ip/eth_udp_types.h"
|
||||||
#include "free_rtos/handler_store/handler_store.hpp"
|
#include "free_rtos/handler_store/handler_store.hpp"
|
||||||
|
|
||||||
namespace free_rtos {
|
namespace free_rtos {
|
||||||
|
|
||||||
struct UDPHandlerArgs : public IpHandlerArgs {
|
struct UDPHandlerArgs : public IpHandlerArgs {
|
||||||
void * p_data;
|
void * p_data;
|
||||||
uint32_t len;
|
TUdpHeader udp_header;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum UDPToggle : uint32_t {
|
enum UDPToggle : uint32_t {
|
||||||
@ -46,9 +47,8 @@ public:
|
|||||||
bool use_chksum);
|
bool use_chksum);
|
||||||
|
|
||||||
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
||||||
|
|
||||||
bool capture_buffer();
|
|
||||||
size_t get_data_size();
|
size_t get_data_size();
|
||||||
|
|
||||||
int32_t read(uint8_t * p_data, uint32_t len);
|
int32_t read(uint8_t * p_data, uint32_t len);
|
||||||
@ -61,8 +61,8 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buff_[toggle_].empty() == true) {
|
if (buff_[toggle_].size() == 0) {
|
||||||
if(capture_buffer() == true) {
|
if(capture_buffer() == false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,9 +79,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
void clear_async() {
|
||||||
|
buff_[out_toggle_].clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const uint32_t max_buf_size = 0x1800; // 0x1800 - 6144, 0x4000 - 16384, 32768, 0x10000 - 65536, 0x11CA - 4554, 0x0BDC - 3036, 0x100000 - 1Mb
|
const uint32_t max_buf_size = 0x0C00; // 0x0C00 - 3072, 0x1800 - 6144, 0x4000 - 16384, 32768, 0x10000 - 65536, 0x11CA - 4554, 0x0BDC - 3036, 0x100000 - 1Mb
|
||||||
|
|
||||||
const uint16_t port_dst_be_; /// big endian
|
const uint16_t port_dst_be_; /// big endian
|
||||||
const uint16_t port_src_be_; /// big endian
|
const uint16_t port_src_be_; /// big endian
|
||||||
@ -102,13 +105,14 @@ private:
|
|||||||
Semaphore rx_sem_;
|
Semaphore rx_sem_;
|
||||||
|
|
||||||
void put_data(uint8_t * p_data, uint32_t len);
|
void put_data(uint8_t * p_data, uint32_t len);
|
||||||
int32_t get_data(uint8_t * p_data, uint32_t len);
|
size_t get_data(uint8_t * p_data, uint32_t len);
|
||||||
|
bool capture_buffer();
|
||||||
|
|
||||||
template<class T, class Allocator>
|
template<class T, class Allocator>
|
||||||
int32_t get_data(std::vector<T, Allocator>& data, uint32_t len)
|
size_t get_data(std::vector<T, Allocator>& data, uint32_t len)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t>& buff = buff_[toggle_];
|
std::vector<uint8_t>& buff = buff_[out_toggle_];
|
||||||
uint32_t size = buff.size();
|
size_t size = buff.size();
|
||||||
|
|
||||||
if (size > len) {
|
if (size > len) {
|
||||||
size = len;
|
size = len;
|
||||||
@ -126,6 +130,8 @@ private:
|
|||||||
void set_src_ip(uint32_t src_ip) {
|
void set_src_ip(uint32_t src_ip) {
|
||||||
src_ip_ = src_ip;
|
src_ip_ = src_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint16_t fill_udp_header(UDPHandlerArgs& udpHandlerArgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ int32_t free_rtos::EthUdpServer::Process(uint8_t * p_data, uint32_t len)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t free_rtos::EthUdpServer::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
uint16_t free_rtos::EthUdpServer::Sender(HandlerArgs& handlerArgs, size_t scatter_segment)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public:
|
|||||||
bool use_chksum) override;
|
bool use_chksum) override;
|
||||||
|
|
||||||
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
virtual int32_t Process(uint8_t * p_data, uint32_t len) override;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) override;
|
||||||
|
|
||||||
virtual int32_t select(uint32_t ticks = SystemP_WAIT_FOREVER) override
|
virtual int32_t select(uint32_t ticks = SystemP_WAIT_FOREVER) override
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,7 +18,7 @@ struct HandlerArgs {
|
|||||||
class Handler {
|
class Handler {
|
||||||
public:
|
public:
|
||||||
virtual int32_t Process(uint8_t * p_data, uint32_t len) = 0;
|
virtual int32_t Process(uint8_t * p_data, uint32_t len) = 0;
|
||||||
virtual uint32_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) = 0;
|
virtual uint16_t Sender(HandlerArgs& handlerArgs, size_t scatter_segment) = 0;
|
||||||
|
|
||||||
~Handler() {};
|
~Handler() {};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user