From b82867ea12aa42bb53d93049867070ed565ee5c1 Mon Sep 17 00:00:00 2001 From: algin Date: Wed, 21 Feb 2024 10:41:56 +0300 Subject: [PATCH] =?UTF-8?q?chore():=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BD=D0=B0=20UTF-8.=20=D0=A3=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=B1=D0=B8=D1=82=D1=8B=D0=B5=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/free_rtos/base/swap.h | 2 +- components/free_rtos/clock/clock.cpp | 2 +- components/free_rtos/clock/clock.hpp | 4 +- components/free_rtos/ethernet/eth.cpp | 14 +++---- components/free_rtos/ethernet/eth.hpp | 36 +++++++++--------- components/free_rtos/ethernet/eth_frame.h | 10 ++--- components/free_rtos/ethernet/eth_ioctl.c | 4 +- components/free_rtos/ethernet/eth_ioctl.h | 2 +- components/free_rtos/ethernet/eth_rx_flow.cpp | 17 ++------- components/free_rtos/ethernet/eth_rx_flow.hpp | 22 +++++------ .../free_rtos/ethernet/eth_ti_enet_inst.c | 14 +++---- components/free_rtos/ethernet/eth_tx_flow.cpp | 13 ++----- components/free_rtos/ethernet/eth_tx_flow.hpp | 6 +-- .../free_rtos/ethernet/eth_tx_flow_iface.hpp | 2 +- components/free_rtos/ethernet/eth_types.h | 2 +- components/free_rtos/ethernet/eth_vlan.c | 4 +- components/free_rtos/ethernet/eth_vlan.h | 2 +- .../free_rtos/ethernet_industry/eth_ecat.cpp | 2 +- .../free_rtos/ethernet_industry/eth_ecat.hpp | 6 +-- .../ethernet_industry/eth_ecat_buffer.hpp | 8 ---- .../ethernet_industry/eth_ecat_telegram.cpp | 2 +- .../ethernet_industry/eth_ecat_types.h | 12 ++---- components/free_rtos/ethernet_ip/eth_arp.cpp | 37 +++++++++---------- components/free_rtos/ethernet_ip/eth_arp.hpp | 12 +++--- .../free_rtos/ethernet_ip/eth_arp_iface.hpp | 2 +- .../free_rtos/ethernet_ip/eth_checksum.c | 2 +- .../free_rtos/ethernet_ip/eth_checksum.h | 2 +- components/free_rtos/ethernet_ip/eth_icmp.cpp | 2 +- components/free_rtos/ethernet_ip/eth_icmp.hpp | 2 +- .../free_rtos/ethernet_ip/eth_icmp_types.h | 2 +- components/free_rtos/ethernet_ip/eth_ip.cpp | 11 ++---- components/free_rtos/ethernet_ip/eth_ip.hpp | 6 +-- .../free_rtos/ethernet_ip/eth_ip_checksum.c | 3 +- .../free_rtos/ethernet_ip/eth_ip_checksum.h | 2 +- .../free_rtos/ethernet_ip/eth_ip_iface.hpp | 4 +- .../free_rtos/ethernet_ip/eth_ip_prots_id.h | 2 +- .../free_rtos/ethernet_ip/eth_ip_types.h | 2 +- .../free_rtos/ethernet_ip/eth_prots_id.h | 4 +- .../free_rtos/ethernet_ip/eth_stack.cpp | 22 +++++------ .../free_rtos/ethernet_ip/eth_stack.hpp | 8 ++-- .../free_rtos/ethernet_ip/eth_stack_iface.hpp | 18 +++------ .../free_rtos/ethernet_ip/eth_udp_client.cpp | 4 +- .../free_rtos/ethernet_ip/eth_udp_client.hpp | 2 +- .../free_rtos/ethernet_ip/eth_udp_server.cpp | 2 +- .../free_rtos/ethernet_ip/eth_udp_server.hpp | 2 +- .../ethernet_ip/eth_udp_server_iface.hpp | 2 +- .../free_rtos/ethernet_ip/eth_udp_types.h | 2 +- components/free_rtos/gpio/gpio.cpp | 2 +- components/free_rtos/gpio/gpio.hpp | 8 ++-- components/free_rtos/mutex/mutex.cpp | 2 +- components/free_rtos/mutex/mutex.hpp | 12 +++--- components/free_rtos/semaphore/semaphore.hpp | 2 +- components/free_rtos/task/task.cpp | 4 +- components/free_rtos/task/task.hpp | 16 ++++---- components/free_rtos/timer/timer.cpp | 3 +- components/free_rtos/timer/timer.hpp | 28 ++++++-------- components/free_rtos/timer_sw/timer_sw.cpp | 2 +- components/free_rtos/timer_sw/timer_sw.hpp | 2 +- 58 files changed, 185 insertions(+), 239 deletions(-) diff --git a/components/free_rtos/base/swap.h b/components/free_rtos/base/swap.h index 6478d1a..800f90e 100644 --- a/components/free_rtos/base/swap.h +++ b/components/free_rtos/base/swap.h @@ -1,7 +1,7 @@ /* * swap.h * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/clock/clock.cpp b/components/free_rtos/clock/clock.cpp index 3ac4134..b95c474 100644 --- a/components/free_rtos/clock/clock.cpp +++ b/components/free_rtos/clock/clock.cpp @@ -1,7 +1,7 @@ /* * clock.cpp * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ #include "free_rtos/clock/clock.hpp" diff --git a/components/free_rtos/clock/clock.hpp b/components/free_rtos/clock/clock.hpp index ef05a46..3212e14 100644 --- a/components/free_rtos/clock/clock.hpp +++ b/components/free_rtos/clock/clock.hpp @@ -1,7 +1,7 @@ /* * clock.hpp * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ @@ -29,7 +29,7 @@ public: ~Clock(); private: ClockP_Object obj_; - uint32_t prd_ms_; /// + uint32_t prd_ms_; /// Период в мс }; diff --git a/components/free_rtos/ethernet/eth.cpp b/components/free_rtos/ethernet/eth.cpp index f562936..600cbe9 100644 --- a/components/free_rtos/ethernet/eth.cpp +++ b/components/free_rtos/ethernet/eth.cpp @@ -1,7 +1,7 @@ /* * eth.cpp * - * Created on: 9 ���. 2023 �. + * Created on: 9 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet/eth.hpp" @@ -14,10 +14,6 @@ #include /*----------------------------------------------------------------------*/ -/** - * ����� ������������ sysconfig. - * ������������ ����� ������� � ���������� � ����� /syscfg - */ #include "ti_enet_config.h" #ifdef __cplusplus @@ -80,7 +76,7 @@ bool free_rtos::Eth::Init(Settings& sett) return true; } -/// Callback ���������� ������ ioctl + static void eth_asyncIoctlCb(Enet_Event evt, uint32_t evtNum, void *evtCbArgs, @@ -212,7 +208,7 @@ void free_rtos::Eth::link_task() continue; } - /// ����� �������� ������ ����(����� SWITCH) + if (!tx_flow_.open((TEthMacPorts)macPort_[i], ENET_DMA_TX_CH0)) { EnetAppUtils_print("link_task: %s: Failed to open tx flow\n", name_.c_str()); @@ -234,7 +230,7 @@ void free_rtos::Eth::link_task() } } else if (macPort_[i] == ENET_MAC_PORT_2) { - //rx_flow_[i].set_passive(); /// ���� � �������� ���������� �� - ���������, �� ������������ ������ + //rx_flow_[i].set_passive(); } tx_flow_.enable((TEthMacPorts)macPort_[i]); @@ -248,7 +244,7 @@ void free_rtos::Eth::link_task() } - ClockP_usleep(100000); // 100ms /// ������ 10�� ���������� ��������� ����� + ClockP_usleep(100000); // 100ms } } diff --git a/components/free_rtos/ethernet/eth.hpp b/components/free_rtos/ethernet/eth.hpp index 644f972..b97c498 100644 --- a/components/free_rtos/ethernet/eth.hpp +++ b/components/free_rtos/ethernet/eth.hpp @@ -1,7 +1,7 @@ /* * eth.hpp * - * Created on: 6 ���. 2023 �. + * Created on: 6 мар. 2023 г. * Author: sychev */ @@ -31,13 +31,13 @@ namespace free_rtos { class Eth { public: typedef enum { - e_ethInstSwitch = 1, /// �������������� - e_ethInstDualMac_1, /// �� �������������� - e_ethInstDualMac_2 /// �� �������������� + e_ethInstSwitch = 1, + e_ethInstDualMac_1, + e_ethInstDualMac_2 }TEthInstId; struct Settings { - uint32_t id; /// ������������� ����� + uint32_t id; /* Peripheral type */ Enet_Type enetType; @@ -87,7 +87,7 @@ private: private: enum SignalsId { - e_signalIoctl, /// ���������� �������� �� ioctl + e_signalIoctl, e_signalTotal }; @@ -96,32 +96,32 @@ private: e_taskTotal }; - uint32_t id_; /// ������������� ����� - std::string name_; /// ��� ����� + uint32_t id_; + std::string name_; - uint32_t core_id_; /// ������������� ���� + uint32_t core_id_; + + Enet_Type enetType_; - Enet_Type enetType_; /// ��� ����� - /// ������������� ��������� mac: 1 - ��� ������ SWITCH, 2 � 3 ��� ������ DUAL MAC ( ��� mac1 � mac2 ��������������) uint32_t instId_; - /// �������������� mac ������ + Enet_MacPort macPort_[e_ethMacTotal]; UBaseType_t rxTaskPriority_[e_ethMacTotal]; UBaseType_t rxTaskStackSize_[e_ethMacTotal]; - /// ���������� MAC ������ + uint32_t macPortNum_; - /// �������� ���������� � ����������� ��� ������������� ���������� ???? + EnetPer_AttachCoreOutArgs attachInfo_; - /// Enet � Udma ���������� ���������� ��� ������������� ����������. + EnetApp_HandleInfo handleInfo_; EthTxFlow tx_flow_; /// - EthRxFlow rx_flow_[e_ethMacTotal]; /// ��� ������ ������ � ������ SWITCH + EthRxFlow rx_flow_[e_ethMacTotal]; Semaphore sem_[e_signalTotal]; @@ -131,11 +131,11 @@ private: bool host_ready_; - TEthFrameMacAddr hostMacAddr_; /// ����������� ��� ����� + TEthFrameMacAddr hostMacAddr_; uint32_t vlan_id_; - EthStack eth_stack_; /// ���� ���������� ���������� + EthStack eth_stack_; }; } diff --git a/components/free_rtos/ethernet/eth_frame.h b/components/free_rtos/ethernet/eth_frame.h index 97d2e81..e782b07 100644 --- a/components/free_rtos/ethernet/eth_frame.h +++ b/components/free_rtos/ethernet/eth_frame.h @@ -1,7 +1,7 @@ /* * eth_frame.h * - * Created on: 7 ���. 2023 �. + * Created on: 7 мар. 2023 г. * Author: sychev */ @@ -12,13 +12,13 @@ #define ETH_FRAME_MAC_ADDR_LEN_BYTES (6u) -#define ETH_FRAME_MAC_ADDR_MASK (0xFFFFFFFFFFFFul) /// 6 ���� +#define ETH_FRAME_MAC_ADDR_MASK (0xFFFFFFFFFFFFul) -#define ETH_FRAME_MAC_ADDR_BROADCAST (0xFFFFFFFFFFFFul) /// ����������������� ����� +#define ETH_FRAME_MAC_ADDR_BROADCAST (0xFFFFFFFFFFFFul) -#define ETH_FRAME_MIN_LEN (14u) /// ����������� ����� ������ +#define ETH_FRAME_MIN_LEN (14u) -#define ETH_FRAME_MAX_LEN (1518u) /// ������������ ����� ������ +#define ETH_FRAME_MAX_LEN (1518u) typedef union { uint64_t addr; diff --git a/components/free_rtos/ethernet/eth_ioctl.c b/components/free_rtos/ethernet/eth_ioctl.c index 520f183..c5df339 100644 --- a/components/free_rtos/ethernet/eth_ioctl.c +++ b/components/free_rtos/ethernet/eth_ioctl.c @@ -1,7 +1,7 @@ /* * eth_ioctl.c * - * Created on: 10 . 2023 . + * Created on: 10 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet/eth_ioctl.h" @@ -12,7 +12,7 @@ int32_t eth_ioctl(Enet_Handle handle, uint32_t core_id, uint32_t cmd, Enet_Ioctl { int32_t status = ENET_SOK; /** - * , . + * Если нужны другие команды, то добавить сюда. */ switch(cmd) { diff --git a/components/free_rtos/ethernet/eth_ioctl.h b/components/free_rtos/ethernet/eth_ioctl.h index ef0b6e6..2c0259e 100644 --- a/components/free_rtos/ethernet/eth_ioctl.h +++ b/components/free_rtos/ethernet/eth_ioctl.h @@ -1,7 +1,7 @@ /* * eth_ioctl.h * - * Created on: 10 . 2023 . + * Created on: 10 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet/eth_rx_flow.cpp b/components/free_rtos/ethernet/eth_rx_flow.cpp index fd06a8b..d85146d 100644 --- a/components/free_rtos/ethernet/eth_rx_flow.cpp +++ b/components/free_rtos/ethernet/eth_rx_flow.cpp @@ -1,7 +1,7 @@ /* * eth_rx_flow.cpp * - * Created on: 7 ���. 2023 �. + * Created on: 7 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet/eth_rx_flow.hpp" @@ -14,18 +14,11 @@ #include /*----------------------------------------------------------------------*/ -/** - * ����� ������������ sysconfig. - * ������������ ����� ������� � ���������� � ����� /syscfg - */ #include "ti_enet_config.h" /*----------------------------------------------------------------------*/ using namespace free_rtos; -/** - * ���������� ������ ������ - */ void free_rtos::rxIsrHandler(void *appData) { EthRxFlow * rx_flow = (EthRxFlow *)appData; @@ -168,13 +161,12 @@ bool free_rtos::EthRxFlow::open(TEthMacPorts port_id, int32_t enetDmaRxChId, UBa default_port_id_ = port_id; enetDmaRxChId_ = enetDmaRxChId; - /// ������������ ���������� �� ������ ������ - rxInArgs.notifyCb = rxIsrHandler; /// ������� ���������� - rxInArgs.cbArg = this; /// �������� ������ + // Регистрация обработчика прерывания модуля DMA + rxInArgs.notifyCb = rxIsrHandler; + rxInArgs.cbArg = this; EnetApp_getRxDmaHandle(enetDmaRxChId, &rxInArgs, &rxChInfo); - /// ��������� ������ rx_start_flow_idx_ = rxChInfo.rxFlowStartIdx; rx_flow_idx_ = rxChInfo.rxFlowIdx; dma_handle_ = rxChInfo.hRxCh; @@ -187,7 +179,6 @@ bool free_rtos::EthRxFlow::open(TEthMacPorts port_id, int32_t enetDmaRxChId, UBa eth_stack_.set_mac_address(mac_addr_.addr); } - /// �������� ������ EnetAppUtils_assert(rxChInfo.useGlobalEvt == true); EnetAppUtils_assert(rxChInfo.sizeThreshEn == 0U); EnetAppUtils_assert(rxChInfo.maxNumRxPkts >= numPkts[enetDmaRxChId]); diff --git a/components/free_rtos/ethernet/eth_rx_flow.hpp b/components/free_rtos/ethernet/eth_rx_flow.hpp index d39519a..dca706e 100644 --- a/components/free_rtos/ethernet/eth_rx_flow.hpp +++ b/components/free_rtos/ethernet/eth_rx_flow.hpp @@ -1,7 +1,7 @@ /* * eth_rx_dma.hpp * - * Created on: 6 ���. 2023 �. + * Created on: 6 мар. 2023 г. * Author: sychev */ @@ -36,31 +36,31 @@ public: private: - friend void rxIsrHandler(void *appData); /// ���������� ���������� �� ������ + friend void rxIsrHandler(void *appData); - friend void rxTaskHandler(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(); ///������� ��������� �������� ������� + void rxProcessPktTask(); private: enum SignalsId { - e_signalRxPkt, /// ����� ������ + e_signalRxPkt, e_signalTotal }; - TEthMacPorts default_port_id_; /// ������������� ������ + TEthMacPorts default_port_id_; int32_t enetDmaRxChId_; - bool open_; /// ���� ����, ��� dma ����� ��� ������ + bool open_; - Semaphore sem_[e_signalTotal]; /// �������� ������� + Semaphore sem_[e_signalTotal]; - Task rx_task; /// ������ ������ + Task rx_task; - TEthFrameMacAddr& mac_addr_; /// mac ����� + TEthFrameMacAddr& mac_addr_; EthStackIface& eth_stack_; @@ -69,7 +69,7 @@ private: EnetDma_RxChHandle dma_handle_; EnetDma_PktQ rx_ready_pktq_; - bool passive_mode_; /// ��������� �����, ������ �����������, �� �� ���������� � ���� ��������� + bool passive_mode_; }; diff --git a/components/free_rtos/ethernet/eth_ti_enet_inst.c b/components/free_rtos/ethernet/eth_ti_enet_inst.c index ab21ff7..13b8372 100644 --- a/components/free_rtos/ethernet/eth_ti_enet_inst.c +++ b/components/free_rtos/ethernet/eth_ti_enet_inst.c @@ -1,18 +1,18 @@ /* * app_enet_open_close.c * - * Created on: 1 . 2023 . + * Created on: 1 мар. 2023 г. * Author: sychev - * - * ti_enet_open_close.h ti_enet_open_close. + * Файл реализует функции объявленные в сгенеренном файле + * ti_enet_open_close.h и вызываемые в сгенеренном файле ti_enet_open_close.с */ #include #include #include -#define ETH_TYPES_MAC_PORT_MAX (2u) /// mac- +#define ETH_TYPES_MAC_PORT_MAX (2u) /// Количество mac-портов -/// +/// Сгенеренные файлы #include #include @@ -22,7 +22,7 @@ static void eth_macMode2MacMii(emac_mode macMode, EnetMacPort_Interface *mii); static int32_t eth_getSubsPortIdx(Enet_Type enetType, uint32_t instId, uint32_t *subsportIdx); /* - * ti_enet_open_close.h + * Объявлена и используется в сгенеренном файле ti_enet_open_close.h */ void EnetApp_initLinkArgs(Enet_Type enetType, uint32_t instId, @@ -110,7 +110,7 @@ void EnetApp_initLinkArgs(Enet_Type enetType, } /* - * ti_enet_open_close.h + * Объявлена и используется в сгенеренном файле ti_enet_open_close.h */ void EnetApp_updateIcssgInitCfg(Enet_Type enetType, uint32_t instId, Icssg_Cfg *icssgCfg) { diff --git a/components/free_rtos/ethernet/eth_tx_flow.cpp b/components/free_rtos/ethernet/eth_tx_flow.cpp index 1ce1155..9ebe304 100644 --- a/components/free_rtos/ethernet/eth_tx_flow.cpp +++ b/components/free_rtos/ethernet/eth_tx_flow.cpp @@ -1,7 +1,7 @@ /* * eth_tx_flow.cpp * - * Created on: 7 ���. 2023 �. + * Created on: 7 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet/eth_tx_flow.hpp" @@ -18,16 +18,9 @@ #include /*----------------------------------------------------------------------*/ -/** - * ����� ������������ sysconfig. - * ������������ ����� ������� � ���������� � ����� /syscfg - */ #include "ti_enet_config.h" /*----------------------------------------------------------------------*/ -/** - * �������� ������ ��� ��������� ������ � ������ �� � ������� p_packet_queue - */ static void eth_initTxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, uint32_t qCount) { EnetDma_Pkt *pPktInfo; @@ -41,9 +34,9 @@ static void eth_initTxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, ui ENET_MEM_LARGE_POOL_PKT_SIZE, ENETDMA_CACHELINE_ALIGNMENT); EnetAppUtils_assert(pPktInfo != NULL); - /// ��������� ��� ���� ����� �������� + ENET_UTILS_SET_PKT_APP_STATE(&pPktInfo->pktState, ENET_PKTSTATE_APP_WITH_FREEQ); - /// ������ ����� � ������� p_packet_queue + EnetQueue_enq(p_packet_queue, &pPktInfo->node); } diff --git a/components/free_rtos/ethernet/eth_tx_flow.hpp b/components/free_rtos/ethernet/eth_tx_flow.hpp index 6a04627..60dcdcb 100644 --- a/components/free_rtos/ethernet/eth_tx_flow.hpp +++ b/components/free_rtos/ethernet/eth_tx_flow.hpp @@ -1,7 +1,7 @@ /* * eth_tx_flow.hpp * - * Created on: 7 ���. 2023 �. + * Created on: 7 мар. 2023 г. * Author: sychev */ @@ -51,8 +51,8 @@ private: //------------------------------------------------- uint32_t tx_ch_num_; - EnetDma_TxChHandle dma_handle_; /// ���������� ����� DMA - EnetDma_PktQ tx_free_pktq_; /// ������� ��������� ������� + EnetDma_TxChHandle dma_handle_; + EnetDma_PktQ tx_free_pktq_; PortData port_data_[e_ethMacTotal]; diff --git a/components/free_rtos/ethernet/eth_tx_flow_iface.hpp b/components/free_rtos/ethernet/eth_tx_flow_iface.hpp index 856542b..0aa33ea 100644 --- a/components/free_rtos/ethernet/eth_tx_flow_iface.hpp +++ b/components/free_rtos/ethernet/eth_tx_flow_iface.hpp @@ -1,7 +1,7 @@ /* * eth_tx_iface.hpp * - * Created on: 13 ���. 2023 �. + * Created on: 13 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet/eth_types.h b/components/free_rtos/ethernet/eth_types.h index 7f08846..8345c64 100644 --- a/components/free_rtos/ethernet/eth_types.h +++ b/components/free_rtos/ethernet/eth_types.h @@ -1,7 +1,7 @@ /* * eth_types.hpp * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet/eth_vlan.c b/components/free_rtos/ethernet/eth_vlan.c index aba0c9a..0017eb5 100644 --- a/components/free_rtos/ethernet/eth_vlan.c +++ b/components/free_rtos/ethernet/eth_vlan.c @@ -1,7 +1,7 @@ /* * eth_vlan.c * - * Created on: 9 . 2023 . + * Created on: 9 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet/eth_vlan.h" @@ -184,7 +184,7 @@ int32_t eth_vlan_init(Enet_Handle handle, prioMap[i] = 0U; } - /* IOCTL, PORT1 , PORT2 . */ + /* Установите команду IOCTL, чтобы сделать PORT1 граничным портом, а PORT2 принимать все типы пакетов. */ eth_vlan_setPriorityRegMapping(handle, core_id, ENET_MAC_PORT_1, prioRegenMap); eth_vlan_setPriorityMapping(handle, core_id, ENET_MAC_PORT_1, prioMap); diff --git a/components/free_rtos/ethernet/eth_vlan.h b/components/free_rtos/ethernet/eth_vlan.h index 42fd64c..b75175c 100644 --- a/components/free_rtos/ethernet/eth_vlan.h +++ b/components/free_rtos/ethernet/eth_vlan.h @@ -1,7 +1,7 @@ /* * eth_vlan.hpp * - * Created on: 9 . 2023 . + * Created on: 9 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_industry/eth_ecat.cpp b/components/free_rtos/ethernet_industry/eth_ecat.cpp index bdcbd86..d92cd5a 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat.cpp +++ b/components/free_rtos/ethernet_industry/eth_ecat.cpp @@ -1,7 +1,7 @@ /* * eth_ecat.cpp * - * Created on: 16 ���. 2023 �. + * Created on: 16 апр. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_industry/eth_ecat.hpp b/components/free_rtos/ethernet_industry/eth_ecat.hpp index cd92ccd..ddc4170 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat.hpp +++ b/components/free_rtos/ethernet_industry/eth_ecat.hpp @@ -1,8 +1,8 @@ /* * eth_ecat.hpp * - * Created on: 16 ���. 2023 �. - * Author: sychev, algin + * Created on: 16 апр. 2023 г. + * Author: algin */ #ifndef FREE_RTOS_ETHERNET_INDUSTRY_ETH_ECAT_HPP_ @@ -264,7 +264,7 @@ private: telegram::EcatTelegram telegram_; eeprom::EEPROM eeprom_; - TEthMacPorts port_id_; /// ���� ���� ����� ���������� ������ + TEthMacPorts port_id_; bool ready_; diff --git a/components/free_rtos/ethernet_industry/eth_ecat_buffer.hpp b/components/free_rtos/ethernet_industry/eth_ecat_buffer.hpp index 8c6bf8d..9971d64 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_buffer.hpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_buffer.hpp @@ -217,10 +217,6 @@ public: buffer_regs_[MailboxesRegs::AVAILABLE] = sync_manager_read.offset + 0x05; return telegram.transfer(queue); -/* - telegram.transfer(datagram_write); - telegram.transfer(datagram_read); -*/ } template @@ -332,10 +328,6 @@ public: auto queue = datagram_write + datagram_read; return telegram.transfer(queue); -/* - telegram.transfer(datagram_write); - telegram.transfer(datagram_read); -*/ } private: diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp index 638c062..d301aba 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp @@ -64,7 +64,7 @@ uint8_t* EcatTelegram::pack(uint8_t *raw) { {0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, ETH_PROT_ECAT_LE }; TEcatFrameHeader *p_hdr = new(raw + sizeof(TEthFrameHeader)) TEcatFrameHeader{ .bits = { .length = 0, - .type = static_cast(ec_network::PROTOCOL_TYPE) } }; + .type = static_cast(ec_network::PROTOCOL_TYPE) } }; uint8_t *p_datagram_first = raw + sizeof(TEthFrameHeader) + sizeof(TEcatFrameHeader); uint8_t *p_datagram_last = p_datagram_first; auto first = datagram_queue_.get_first(); diff --git a/components/free_rtos/ethernet_industry/eth_ecat_types.h b/components/free_rtos/ethernet_industry/eth_ecat_types.h index 2db7505..0622850 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_types.h +++ b/components/free_rtos/ethernet_industry/eth_ecat_types.h @@ -13,7 +13,7 @@ #define ETH_PROT_ECAT_LE 0xa488 /// ETHERCAT #define ETH_PROT_ECAT_BE 0x88a4 /// ETHERCAT -/// ����������� ��������( ������� ��� ������� ��� be) + typedef struct { uint16_t length : 11; /// ������� 11 @@ -21,9 +21,7 @@ typedef struct uint16_t type : 4; }TEcatFrameHeaderBits; -/** - * ��������� ��������� ������ ethercat - */ + typedef union { uint16_t all; @@ -43,11 +41,7 @@ typedef union { TEcatDgLenBits bits; }TEcatDgLen; -/** - * ��������� ��������� ���������� ethercat - * ����������� ��������( ������� ����� ������� ��� be), - * �� ��� �� ��������� ��� ����� ����� ������� 8 ���. - */ + typedef struct { uint8_t cmd; diff --git a/components/free_rtos/ethernet_ip/eth_arp.cpp b/components/free_rtos/ethernet_ip/eth_arp.cpp index bd52d68..c197791 100644 --- a/components/free_rtos/ethernet_ip/eth_arp.cpp +++ b/components/free_rtos/ethernet_ip/eth_arp.cpp @@ -1,7 +1,7 @@ /* * eth_arp.cpp * - * Created on: 13 ���. 2023 �. + * Created on: 13 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_arp.hpp" @@ -17,7 +17,7 @@ void free_rtos::clock_timeout(ClockP_Object * obj, void * arg) { EthArp * p_arp = ( EthArp *)arg; - /// ����������� ����������� ip + if (p_arp->tmrGratuitous_.tick(100)) { if (p_arp->table_mac_.empty()) { @@ -37,7 +37,7 @@ void free_rtos::clock_timeout(ClockP_Object * obj, void * arg) } else { - p_arp->request(item.first); /// ������ mac ������ �� ip + p_arp->request(item.first); } } } @@ -58,9 +58,9 @@ bool free_rtos::EthArp::init(TEthMacPorts eth_port_id, uint64_t self_mac, uint32 init_request_pkt(self_mac_, self_ip_); - clock_.init(100, free_rtos::clock_timeout, this); /// 100�� + clock_.init(100, free_rtos::clock_timeout, this); - tmrGratuitous_.start(1000); /// 1 ��� � ������� + tmrGratuitous_.start(1000); clock_.start(); @@ -71,7 +71,7 @@ void free_rtos::EthArp::init_request_pkt(uint64_t self_mac, uint32_t self_ip) { TArpHeader * arp_hdr = (TArpHeader *)(request_pkt_.data + sizeof(TEthFrameHeader)); - /// ��������� ��������� ARP + memcpy(arp_hdr->ar_sha, &self_mac_, ETH_FRAME_MAC_ADDR_LEN_BYTES); memset(arp_hdr->ar_tha, 0, ETH_FRAME_MAC_ADDR_LEN_BYTES); memcpy(arp_hdr->ar_spa, &self_ip_, ETH_IP_ADDR_LEN); @@ -89,12 +89,12 @@ bool free_rtos::EthArp::request(uint32_t ip) { TArpHeader * arp_hdr = (TArpHeader *)(request_pkt_.data + sizeof(TEthFrameHeader)); - /// �������� ip-����� ��� ������� + memcpy(arp_hdr->ar_tpa, &ip, ETH_IP_ADDR_LEN); request_pkt_.length = sizeof(TArpHeader); - /// ����������������� ������ + return eth_stack_.send_pkt(eth_port_id_, ETH_FRAME_MAC_ADDR_BROADCAST, ETH_PROT_ARP_BE, request_pkt_); } @@ -111,16 +111,16 @@ bool free_rtos::EthArp::try_request(uint32_t ip) { p_ip_req_data = &item->second; if (p_ip_req_data->mac != 0) { - return true; /// ��� ����� ��� �������� + return true; } else if (p_ip_req_data->tmr.is_started()) { - return true; /// ����� ��� ���� + return true; } } p_ip_req_data->attemps = 0; - p_ip_req_data->tmr.start(1000); /// ����� 1 ���� � ��� + p_ip_req_data->tmr.start(1000); return request(ip); } @@ -171,14 +171,11 @@ int32_t free_rtos::EthArp::Process(uint8_t * p_data, uint32_t len) memcpy(&mac_sender, arp_hdr->ar_sha, ETH_FRAME_MAC_ADDR_LEN_BYTES); memcpy(&ip_sender, arp_hdr->ar_spa, ETH_IP_ADDR_LEN); - /** - * ���� ip == 0, �� ��� ������ "Who has....". - * �������� �� ���� �� �����. - */ + if (ip_sender == 0) { return 0; } - /// ��������� ������ � arp-������� + add(mac_sender, ip_sender); if ( type == arp_opr_be_[e_oprRequest]) @@ -188,16 +185,16 @@ int32_t free_rtos::EthArp::Process(uint8_t * p_data, uint32_t len) if (ip_target == self_ip_) { - /// ��� ������ - ����� + arp_hdr->ar_op = arp_opr_be_[e_oprReply]; - /// ������ ������� mac ����� + memcpy(arp_hdr->ar_tha, arp_hdr->ar_sha, ETH_FRAME_MAC_ADDR_LEN_BYTES); memcpy(arp_hdr->ar_sha, &self_mac_, ETH_FRAME_MAC_ADDR_LEN_BYTES); - /// ������ ������� ip ����� + memcpy(arp_hdr->ar_tpa, arp_hdr->ar_spa, ETH_IP_ADDR_LEN); memcpy(arp_hdr->ar_spa, &self_ip_, ETH_IP_ADDR_LEN); - /// ���������� ������ ������ ��� �������� + return len; } } diff --git a/components/free_rtos/ethernet_ip/eth_arp.hpp b/components/free_rtos/ethernet_ip/eth_arp.hpp index 6238020..2e4345a 100644 --- a/components/free_rtos/ethernet_ip/eth_arp.hpp +++ b/components/free_rtos/ethernet_ip/eth_arp.hpp @@ -1,7 +1,7 @@ /* * eth_arp.hpp * - * Created on: 13 ���. 2023 �. + * Created on: 13 мар. 2023 г. * Author: sychev */ @@ -49,9 +49,9 @@ private: }; struct ArpIpReqData { - uint64_t mac = 0; /// ���-����� - uint32_t attemps = 0; /// ����������� ������� ������� - TimerSw tmr; /// ������ �������� + uint64_t mac = 0; + uint32_t attemps = 0; + TimerSw tmr; }; static const uint32_t pkt_len = 42; @@ -60,8 +60,8 @@ private: TEthPkt request_pkt_; - std::map table_mac_; /// ���� mac, �������� ip - std::map table_ip_; /// ���� ip, + std::map table_mac_; + std::map table_ip_; uint64_t self_mac_; uint32_t self_ip_; diff --git a/components/free_rtos/ethernet_ip/eth_arp_iface.hpp b/components/free_rtos/ethernet_ip/eth_arp_iface.hpp index 51020c4..e07a19b 100644 --- a/components/free_rtos/ethernet_ip/eth_arp_iface.hpp +++ b/components/free_rtos/ethernet_ip/eth_arp_iface.hpp @@ -1,7 +1,7 @@ /* * eth_arp_iface.hpp * - * Created on: 14 . 2023 . + * Created on: 14 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_checksum.c b/components/free_rtos/ethernet_ip/eth_checksum.c index aaeeb7a..a434035 100644 --- a/components/free_rtos/ethernet_ip/eth_checksum.c +++ b/components/free_rtos/ethernet_ip/eth_checksum.c @@ -1,7 +1,7 @@ /* * eth_checksum.c * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_checksum.h" diff --git a/components/free_rtos/ethernet_ip/eth_checksum.h b/components/free_rtos/ethernet_ip/eth_checksum.h index 5b2f118..b861c69 100644 --- a/components/free_rtos/ethernet_ip/eth_checksum.h +++ b/components/free_rtos/ethernet_ip/eth_checksum.h @@ -1,7 +1,7 @@ /* * eth_checksum.h * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_icmp.cpp b/components/free_rtos/ethernet_ip/eth_icmp.cpp index 82adc79..89571a8 100644 --- a/components/free_rtos/ethernet_ip/eth_icmp.cpp +++ b/components/free_rtos/ethernet_ip/eth_icmp.cpp @@ -1,7 +1,7 @@ /* * eth_icmp.cpp * - * Created on: 14 ���. 2023 �. + * Created on: 14 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_icmp.hpp" diff --git a/components/free_rtos/ethernet_ip/eth_icmp.hpp b/components/free_rtos/ethernet_ip/eth_icmp.hpp index 17d112f..0cd5f83 100644 --- a/components/free_rtos/ethernet_ip/eth_icmp.hpp +++ b/components/free_rtos/ethernet_ip/eth_icmp.hpp @@ -1,7 +1,7 @@ /* * eth_icmp.hpp * - * Created on: 14 ���. 2023 �. + * Created on: 14 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_icmp_types.h b/components/free_rtos/ethernet_ip/eth_icmp_types.h index ed730cf..aa9d81c 100644 --- a/components/free_rtos/ethernet_ip/eth_icmp_types.h +++ b/components/free_rtos/ethernet_ip/eth_icmp_types.h @@ -1,7 +1,7 @@ /* * eth_icmp_types.h * - * Created on: 14 . 2023 . + * Created on: 14 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_ip.cpp b/components/free_rtos/ethernet_ip/eth_ip.cpp index 9629dda..dc0e8fd 100644 --- a/components/free_rtos/ethernet_ip/eth_ip.cpp +++ b/components/free_rtos/ethernet_ip/eth_ip.cpp @@ -1,7 +1,7 @@ /* * eth_ip.cpp * - * Created on: 13 ���. 2023 �. + * Created on: 13 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_ip.hpp" @@ -41,12 +41,9 @@ bool free_rtos::EthIp::send(TEthMacPorts port_id, uint32_t dest_ip, uint8_t prot { uint64_t mac_dst; - /// ����� mac-����� �� arp ������� + if (!arp_.getMacAddr(dest_ip, mac_dst)) { - /* - * ���� ������ � arp-������� ���, �� ��������� ����������� arp-������ - * (���� ������ ������ ������� getMacAddr) - */ + return false; } @@ -85,7 +82,7 @@ bool free_rtos::EthIp::send(TEthMacPorts port_id, uint32_t dest_ip, uint8_t prot ip_header->ip_sum = BASE_SWAP16(cksum); - /// �������� ������ + return eth_stack_.send_pkt(port_id, mac_dst, ETH_PROT_IP_BE, pkt); } diff --git a/components/free_rtos/ethernet_ip/eth_ip.hpp b/components/free_rtos/ethernet_ip/eth_ip.hpp index cce0864..fd9c51f 100644 --- a/components/free_rtos/ethernet_ip/eth_ip.hpp +++ b/components/free_rtos/ethernet_ip/eth_ip.hpp @@ -1,7 +1,7 @@ /* * eth_ip.hpp * - * Created on: 13 ���. 2023 �. + * Created on: 13 мар. 2023 г. * Author: sychev */ @@ -43,10 +43,10 @@ private: EthStackIface& eth_stack_; EthArpIface& arp_; - uint32_t self_ip_; /// ����������� ip-����� + uint32_t self_ip_; uint64_t self_mac_; - uint16_t ip_indet_; /// \u043f\u0457\u0405\u043f\u0457\u0405\u043f\u0457\u0405\u043f\u0457\u0405 ip_id + uint16_t ip_indet_; inline uint16_t fillIpHeader(IpHandlerArgs& ipHandlerArgs); inline uint16_t fillEthFrameHeader(IpHandlerArgs& ipHandlerArgs); diff --git a/components/free_rtos/ethernet_ip/eth_ip_checksum.c b/components/free_rtos/ethernet_ip/eth_ip_checksum.c index f41bc51..132e27d 100644 --- a/components/free_rtos/ethernet_ip/eth_ip_checksum.c +++ b/components/free_rtos/ethernet_ip/eth_ip_checksum.c @@ -1,7 +1,7 @@ /* * eth_ip_checksum.c * - * Created on: 14 . 2023 . + * Created on: 14 мар. 2023 г. * Author: sychev */ #include "eth_ip_checksum.h" @@ -19,4 +19,3 @@ uint16_t eth_ip_calcChecksum(uint16_t * const data, uint32_t length) return (uint16_t) (~crc); } - diff --git a/components/free_rtos/ethernet_ip/eth_ip_checksum.h b/components/free_rtos/ethernet_ip/eth_ip_checksum.h index b454635..f17e750 100644 --- a/components/free_rtos/ethernet_ip/eth_ip_checksum.h +++ b/components/free_rtos/ethernet_ip/eth_ip_checksum.h @@ -1,7 +1,7 @@ /* * eth_ip_checksum.h * - * Created on: 14 . 2023 . + * Created on: 14 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_ip_iface.hpp b/components/free_rtos/ethernet_ip/eth_ip_iface.hpp index 205c02a..6e115e8 100644 --- a/components/free_rtos/ethernet_ip/eth_ip_iface.hpp +++ b/components/free_rtos/ethernet_ip/eth_ip_iface.hpp @@ -1,7 +1,7 @@ /* * eth_ip_iface.hpp * - * Created on: 15 . 2023 . + * Created on: 15 мар. 2023 г. * Author: sychev */ @@ -26,7 +26,7 @@ struct IpHandlerArgs : public EthStackHandlerArgs { class EthIpIface { public: /** - * + * Передача пакета */ virtual bool send(TEthMacPorts port_id, uint32_t dest_ip, uint8_t prot_id, TEthPkt& pkt) = 0; virtual bool send(IpHandlerArgs& handlerArgs) = 0; diff --git a/components/free_rtos/ethernet_ip/eth_ip_prots_id.h b/components/free_rtos/ethernet_ip/eth_ip_prots_id.h index d57fa14..f2aa29c 100644 --- a/components/free_rtos/ethernet_ip/eth_ip_prots_id.h +++ b/components/free_rtos/ethernet_ip/eth_ip_prots_id.h @@ -1,7 +1,7 @@ /* * eth_ip_prots_id.h * - * Created on: 14 . 2023 . + * Created on: 14 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_ip_types.h b/components/free_rtos/ethernet_ip/eth_ip_types.h index 8d5bfda..5924c98 100644 --- a/components/free_rtos/ethernet_ip/eth_ip_types.h +++ b/components/free_rtos/ethernet_ip/eth_ip_types.h @@ -1,7 +1,7 @@ /* * eth_ip_types.h * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_prots_id.h b/components/free_rtos/ethernet_ip/eth_prots_id.h index 482ef34..8b81d48 100644 --- a/components/free_rtos/ethernet_ip/eth_prots_id.h +++ b/components/free_rtos/ethernet_ip/eth_prots_id.h @@ -1,9 +1,9 @@ /* * eth_prot.h * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev - * Ethernet + * Идентификаторы протоколов Ethernet */ #ifndef FREE_RTOS_ETHERNET_ETH_PROTS_ID_H_ diff --git a/components/free_rtos/ethernet_ip/eth_stack.cpp b/components/free_rtos/ethernet_ip/eth_stack.cpp index 7d3b01d..67d12c8 100644 --- a/components/free_rtos/ethernet_ip/eth_stack.cpp +++ b/components/free_rtos/ethernet_ip/eth_stack.cpp @@ -1,7 +1,7 @@ /* * eth_stack.cpp * - * Created on: 14 ���. 2023 �. + * Created on: 14 мар. 2023 г. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_stack.hpp" @@ -73,16 +73,16 @@ bool free_rtos::EthStack::send_pkt(EthStackHandlerArgs& handlerArgs) void free_rtos::EthStack::rx_handler(uint8_t * p_data, uint32_t len) { - /// ����������� ����� eth-������ = 60 ���� + if ( len < ETH_FRAME_MIN_LEN) { return; } - /// ��������� ����� ���������� - uint64_t dest_addr = *((uint64_t*)p_data); - dest_addr &= ETH_FRAME_MAC_ADDR_MASK; /// ��������� 6 ������� ���� - /// ��������� ������ ����� ��� ����� ����������������� ��� ��� ����������� + uint64_t dest_addr = *((uint64_t*)p_data); + dest_addr &= ETH_FRAME_MAC_ADDR_MASK; + + if ((ETH_FRAME_MAC_ADDR_BROADCAST != dest_addr) && (eth_.self_mac_ != dest_addr)) { return; @@ -90,21 +90,21 @@ void free_rtos::EthStack::rx_handler(uint8_t * p_data, uint32_t len) TEthFrameHeader * p_eth_hdr = (TEthFrameHeader *)p_data; - /// �������� ���������� + int32_t reply_len = rx_pkt_handler_.Process(p_eth_hdr->prot_id, p_data + sizeof(TEthFrameHeader), len - sizeof(TEthFrameHeader)); - /// ���������� ����� + if (reply_len > 0) { - /// �������� ����� ���������� mac-������� ����������� + memcpy(p_eth_hdr->mac_dest, p_eth_hdr->mac_src, ETH_FRAME_MAC_ADDR_LEN_BYTES); - /// �������� ����� ��������� ����� mac-������� + memcpy(p_eth_hdr->mac_src, ð_.self_mac_, ETH_FRAME_MAC_ADDR_LEN_BYTES); reply_len+=sizeof(TEthFrameHeader); - /// ���������� ������ + tx_flow_.send(eth_.mac_port_, p_data, reply_len); } } diff --git a/components/free_rtos/ethernet_ip/eth_stack.hpp b/components/free_rtos/ethernet_ip/eth_stack.hpp index 7555a8b..a54e449 100644 --- a/components/free_rtos/ethernet_ip/eth_stack.hpp +++ b/components/free_rtos/ethernet_ip/eth_stack.hpp @@ -1,7 +1,7 @@ /* * eth_stack.hpp * - * Created on: 14 ���. 2023 �. + * Created on: 14 мар. 2023 г. * Author: sychev */ @@ -43,14 +43,12 @@ public: EthUdpServerIface * getUdpServerPtr() {return &udp_;} - /* - * ����������� ����������� ��������� �� ������ ethernet - */ + virtual bool Register(uint32_t prot_id, Handler * p_handler) override; private: struct EthData { - uint64_t self_mac_; /// ����������� ��� ����� + uint64_t self_mac_; TEthMacPorts mac_port_; uint32_t self_ip_; }; diff --git a/components/free_rtos/ethernet_ip/eth_stack_iface.hpp b/components/free_rtos/ethernet_ip/eth_stack_iface.hpp index d48eb41..3f2f529 100644 --- a/components/free_rtos/ethernet_ip/eth_stack_iface.hpp +++ b/components/free_rtos/ethernet_ip/eth_stack_iface.hpp @@ -1,7 +1,7 @@ /* * eth_stack_iface.hpp * - * Created on: 14 ���. 2023 �. + * Created on: 14 мар. 2023 г. * Author: sychev */ @@ -20,26 +20,18 @@ struct EthStackHandlerArgs : public TxFlowHandlerArgs { class EthStackIface { public: - /** - * ��������� ������������ mac-������ - */ + virtual void set_mac_address(uint64_t mac_addr_be) = 0; - /** - * ���������� eth ������� - */ + virtual void rx_handler(uint8_t * p_data, uint32_t len) = 0; - /** - * �������� ������ - */ + virtual bool send_pkt(TEthMacPorts port_id, uint64_t mac_dst, uint16_t prot_id, TEthPkt& pkt) = 0; virtual bool send_pkt(EthStackHandlerArgs& handlerArgs) = 0; - /** - * ����������� ����������� eth-������ - */ + virtual bool Register(uint32_t prot_id, Handler * p_handler) = 0; virtual ~EthStackIface() {}; diff --git a/components/free_rtos/ethernet_ip/eth_udp_client.cpp b/components/free_rtos/ethernet_ip/eth_udp_client.cpp index c9e9c76..cd2d1b7 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_client.cpp +++ b/components/free_rtos/ethernet_ip/eth_udp_client.cpp @@ -1,7 +1,7 @@ /* * eth_udp_client.cpp * - * Created on: 15 ���. 2023 �. + * Created on: 15 апреля. 2023 год. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_udp_client.hpp" @@ -189,7 +189,7 @@ uint16_t free_rtos::EthUpdClient::fill_udp_header(UDPHandlerArgs& udpHandlerArgs chk_sum32 += IP_PROT_UDP + 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); - // ! + //Расчет контрольной суммы совмещен с копированием данных ! uint16_t chk_sum16 = eth_calcChksum3(udp_hdr, chk_sum32, &udp_header, sizeof(TUdpHeader), udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len); diff --git a/components/free_rtos/ethernet_ip/eth_udp_client.hpp b/components/free_rtos/ethernet_ip/eth_udp_client.hpp index 2d9e158..f94bdb8 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_client.hpp +++ b/components/free_rtos/ethernet_ip/eth_udp_client.hpp @@ -1,7 +1,7 @@ /* * eth_udp_client.hpp * - * Created on: 15 ���. 2023 �. + * Created on: 15 апр. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_udp_server.cpp b/components/free_rtos/ethernet_ip/eth_udp_server.cpp index 6130c43..e0eb4f4 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_server.cpp +++ b/components/free_rtos/ethernet_ip/eth_udp_server.cpp @@ -1,7 +1,7 @@ /* * eth_udp.cpp * - * Created on: 15 ���. 2023 �. + * Created on: 15 апр. 2023 г. * Author: sychev */ #include "free_rtos/ethernet_ip/eth_udp_server.hpp" diff --git a/components/free_rtos/ethernet_ip/eth_udp_server.hpp b/components/free_rtos/ethernet_ip/eth_udp_server.hpp index 624802d..8e2e005 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_server.hpp +++ b/components/free_rtos/ethernet_ip/eth_udp_server.hpp @@ -1,7 +1,7 @@ /* * eth_udp.hpp * - * Created on: 15 ���. 2023 �. + * Created on: 15 апр. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_udp_server_iface.hpp b/components/free_rtos/ethernet_ip/eth_udp_server_iface.hpp index 11b3a2b..f79b722 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_server_iface.hpp +++ b/components/free_rtos/ethernet_ip/eth_udp_server_iface.hpp @@ -1,7 +1,7 @@ /* * eth_udp_server_iface.hpp * - * Created on: 15 ���. 2023 �. + * Created on: 15 апр. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/ethernet_ip/eth_udp_types.h b/components/free_rtos/ethernet_ip/eth_udp_types.h index bf49753..9df1b5a 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_types.h +++ b/components/free_rtos/ethernet_ip/eth_udp_types.h @@ -1,7 +1,7 @@ /* * eth_udp_types.h * - * Created on: 15 . 2023 . + * Created on: 15 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/gpio/gpio.cpp b/components/free_rtos/gpio/gpio.cpp index f0d8c5e..2a491de 100644 --- a/components/free_rtos/gpio/gpio.cpp +++ b/components/free_rtos/gpio/gpio.cpp @@ -1,7 +1,7 @@ /* * gpio.cpp * - * Created on: 6 . 2023 . + * Created on: 6 мар. 2023 г. * Author: sychev */ diff --git a/components/free_rtos/gpio/gpio.hpp b/components/free_rtos/gpio/gpio.hpp index cb569d2..a8f76c4 100644 --- a/components/free_rtos/gpio/gpio.hpp +++ b/components/free_rtos/gpio/gpio.hpp @@ -1,9 +1,9 @@ /* * gpio.hpp * - * Created on: 6 . 2023 . + * Created on: 6 мар. 2023 г. * Author: sychev - * SysConfig GPIO + * Пины должны быть предварительно сконфигурированы в SysConfig в разделе GPIO */ #ifndef FREE_RTOS_GPIO_GPIO_HPP_ @@ -20,8 +20,8 @@ public: e_gpioDirInput }; /* - * num - - * Dir - / + * num - номер пина + * Dir - направление вход/выход */ Gpio(uint32_t num, Dir dir, uint32_t base_address); diff --git a/components/free_rtos/mutex/mutex.cpp b/components/free_rtos/mutex/mutex.cpp index 8a06b08..5f550db 100644 --- a/components/free_rtos/mutex/mutex.cpp +++ b/components/free_rtos/mutex/mutex.cpp @@ -1,7 +1,7 @@ /* * mutex.cpp * - * Created on: 26 . 2022 . + * Created on: 26 сент. 2022 г. * Author: sychev */ #include "free_rtos/mutex/mutex.hpp" diff --git a/components/free_rtos/mutex/mutex.hpp b/components/free_rtos/mutex/mutex.hpp index 58fa736..1509cae 100644 --- a/components/free_rtos/mutex/mutex.hpp +++ b/components/free_rtos/mutex/mutex.hpp @@ -1,7 +1,7 @@ /* * mutex.hpp * - * Created on: 26 . 2022 . + * Created on: 26 сент. 2022 г. * Author: sychev */ @@ -14,7 +14,7 @@ namespace free_rtos { /** - * @brief ++ ti rtos + * @brief С++ обертка на мьютексом из ti rtos * */ class Mutex { @@ -22,9 +22,9 @@ public: Mutex(); /** - * wait - , - * portMAX_DELAY - , 0 - - * pdTRUE + * wait - время ожидания в тиках, по умолчанию + * portMAX_DELAY - ожидание бесконечно, 0 - ожидание отсутствует + * Вызвращает pdTRUE если удалось получить семафор */ BaseType_t lock(TickType_t wait = portMAX_DELAY); @@ -37,7 +37,7 @@ private: }; /** - * @brief LockGuard + * @brief Реализация паттерна LockGuard * */ class LockGuard { diff --git a/components/free_rtos/semaphore/semaphore.hpp b/components/free_rtos/semaphore/semaphore.hpp index b0f4ca1..41cacac 100644 --- a/components/free_rtos/semaphore/semaphore.hpp +++ b/components/free_rtos/semaphore/semaphore.hpp @@ -7,7 +7,7 @@ namespace free_rtos { /** - * @brief ++ free rtos + * @brief С++ обертка семафора в free rtos * */ class Semaphore { diff --git a/components/free_rtos/task/task.cpp b/components/free_rtos/task/task.cpp index ee4e63e..333a9f7 100644 --- a/components/free_rtos/task/task.cpp +++ b/components/free_rtos/task/task.cpp @@ -1,7 +1,7 @@ /* * task.cpp * - * Created on: 6 . 2023 . + * Created on: 6 мар. 2023 г. * Author: sychev */ #include "free_rtos/task/task.hpp" @@ -18,7 +18,7 @@ bool free_rtos::Task::Create(std::string name, uint32_t priority, TaskFunction t stack_size_bytes = defStackSize_; } - /// 32 + /// Стек должен быть выровнен по границе 32 байта if (stack_size_bytes % 32) { return false; } diff --git a/components/free_rtos/task/task.hpp b/components/free_rtos/task/task.hpp index faa3e8e..5f03fd2 100644 --- a/components/free_rtos/task/task.hpp +++ b/components/free_rtos/task/task.hpp @@ -1,12 +1,12 @@ /* * task.hpp * - * Created on: 6 . 2023 . + * Created on: 6 мар. 2023 г. * Author: sychev - * FreeRtos : - * xTaskCreate - - * xTaskCreateStatic - - * xTaskCreate + * Во FreeRtos есть два способа создать задачу: + * xTaskCreate - стэк выделяется динамически при создании задачи + * xTaskCreateStatic - стек выделяется статически + * Данный модуль реализован на основе xTaskCreate */ #ifndef FREE_RTOS_TASK_TASK_HPP_ @@ -20,12 +20,12 @@ namespace free_rtos { /** - * @brief free_rtos. + * @brief  Класс обертка реализующий создание задачи во free_rtos. */ class Task { public: /** - * @brief + * @brief Тип указателя на функцию задачи * */ using TaskFunction = TaskFunction_t; @@ -41,7 +41,7 @@ public: } private: - static const uint32_t defStackSize_ = 8192; /// - + static const uint32_t defStackSize_ = 8192; /// Размер стека по-умолчанию TaskHandle_t taskHandle_; }; diff --git a/components/free_rtos/timer/timer.cpp b/components/free_rtos/timer/timer.cpp index ce10559..4d291a3 100644 --- a/components/free_rtos/timer/timer.cpp +++ b/components/free_rtos/timer/timer.cpp @@ -1,9 +1,10 @@ /* * timer.cpp * - * Created on: 10 . 2023 . + * Created on: 10 мар. 2023 г. * Author: sychev */ + #include "free_rtos/timer/timer.hpp" #include diff --git a/components/free_rtos/timer/timer.hpp b/components/free_rtos/timer/timer.hpp index d3d500f..b7bba39 100644 --- a/components/free_rtos/timer/timer.hpp +++ b/components/free_rtos/timer/timer.hpp @@ -1,7 +1,7 @@ /* * timer.hpp * - * Created on: 10 ���. 2023 �. + * Created on: 10 мар. 2023 г. * Author: sychev */ @@ -19,22 +19,18 @@ namespace free_rtos { class Timer { public: struct Settings { - uint32_t input_clk_Hz; /// �������� ������� � �� - uint32_t base_address; /// ������� ����� - uint32_t clock_src_mux_addr; /// ����� ����� - uint32_t int_num; /// ����� ���������� - uint32_t int_priority; /// ��������� ���������� - uint32_t period_us; /// ������ ������� � ��� + uint32_t input_clk_Hz; + uint32_t base_address; + uint32_t clock_src_mux_addr; + uint32_t int_num; + uint32_t int_priority; + uint32_t period_us; }; - /** - * ������������� ������� - */ + bool Init(Settings& sett); - /** - * �������� ������������ �������. �����������. - */ + uint32_t Wait(); void Start(); @@ -48,9 +44,9 @@ private: friend void timer_isr_callback(void * arg); private: - uint32_t base_addr_; /// ������� ����� ��������� ������� - uint32_t int_num_; /// ����� ���������� - HwiP_Object hwi_obj_; /// ���������� ������������ �� ������� + uint32_t base_addr_; + uint32_t int_num_; + HwiP_Object hwi_obj_; Semaphore sem_; uint32_t tick_counter_{0x00000000}; diff --git a/components/free_rtos/timer_sw/timer_sw.cpp b/components/free_rtos/timer_sw/timer_sw.cpp index dea0763..06ed31e 100644 --- a/components/free_rtos/timer_sw/timer_sw.cpp +++ b/components/free_rtos/timer_sw/timer_sw.cpp @@ -1,7 +1,7 @@ /* * timer_sw.cpp * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */ #include "free_rtos/timer_sw/timer_sw.hpp" diff --git a/components/free_rtos/timer_sw/timer_sw.hpp b/components/free_rtos/timer_sw/timer_sw.hpp index 0eb88b1..6d8b6e0 100644 --- a/components/free_rtos/timer_sw/timer_sw.hpp +++ b/components/free_rtos/timer_sw/timer_sw.hpp @@ -1,7 +1,7 @@ /* * timer_sw.hpp * - * Created on: 13 . 2023 . + * Created on: 13 мар. 2023 г. * Author: sychev */