Ethernet Communication

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Ethernet Communication

跳至解决方案
4,358 次查看
Govind89
Contributor II

I am new to i.MX RT1170 development and using the EVKBMIMXRT1170 board. I'm working with the built-in example code evkbmimxrt1170_enet_txrx_transfer_cm7 for Ethernet functionality, but I'm finding it difficult to understand how it works.

I would like to request a simpler, bare-metal code example that focuses just on basic Ethernet operations:

  • Ethernet configuration

  • Ethernet initialization

  • Ethernet frame transmission

  • Ethernet frame reception

I need this in API-style simple code without RTOS, using MCUXpresso IDE. Please provide guidance and the simplest base code for Ethernet functionality on my EVKBMIMXRT1170 development board.
i.MX-RT1170 MCUXpresso-IDE 

标记 (2)
0 项奖励
回复
1 解答
4,250 次查看
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

I suggest you can check the example in SDK import Wizard.

mayliu1_0-1746098335143.png

Best Regards

MayLiu

在原帖中查看解决方案

0 项奖励
回复
5 回复数
4,329 次查看
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

Thank you so much for your interest in our products and for using our community.

I think the project you imported is already without FREERTOS, if you want more Ethernet demo, you can check by import  SDK example. 

mayliu1_0-1745898661549.png

If you want know more about the SDK API. you can refer to the document "MCUXpresso SDK API Reference Manual"

https://mcuxpresso.nxp.com/api_doc/dev/329/index.html

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

Best Regards
MayLiu

0 项奖励
回复
4,321 次查看
Govind89
Contributor II
helle @mayliu1
Thanks for replay

Based on the example, I tried, but I am unable to receive and transmit the frame.

I modified the code to create a simpler version. using evkbmimxrt1170_enet_txrx_transfer_cm7 example code please guide me what will be need to change. i am attech project file.



#include "fsl_debug_console.h"

#include "fsl_silicon_id.h"

#include "fsl_enet.h"

#include "fsl_phy.h"

#include "board.h"



#include "fsl_phyrtl8201.h"



#include "fsl_enet.h"

#include "board.h"



#define EXAMPLE_ENET ENET

#define EXAMPLE_CLOCK_FREQ CLOCK_GetRootClockFreq(kCLOCK_Root_Bus)

#define ENET_RXBD_NUM 4

#define ENET_TXBD_NUM 4

#define ENET_RXBUFF_SIZE ENET_FRAME_MAX_FRAMELEN

#define ENET_TXBUFF_SIZE ENET_FRAME_MAX_FRAMELEN

#define ENET_DATA_LENGTH 1000



/* Buffer descriptors */

AT_NONCACHEABLE_SECTION_ALIGN(enet_rx_bd_struct_t g_rxBuffDescrip[ENET_RXBD_NUM], ENET_BUFF_ALIGNMENT);

AT_NONCACHEABLE_SECTION_ALIGN(enet_tx_bd_struct_t g_txBuffDescrip[ENET_TXBD_NUM], ENET_BUFF_ALIGNMENT);



/* Data buffers */

SDK_ALIGN(uint8_t g_rxDataBuff[ENET_RXBD_NUM][ENET_RXBUFF_SIZE], ENET_BUFF_ALIGNMENT);

SDK_ALIGN(uint8_t g_txDataBuff[ENET_TXBD_NUM][ENET_TXBUFF_SIZE], ENET_BUFF_ALIGNMENT);



/* MAC address */

uint8_t g_macAddr[6] =

{ 0x02, 0x12, 0x13, 0x14, 0x15, 0x16 };



/* ENET handle */

static enet_handle_t g_handle;



static void BuildTestFrame(uint8_t *frame)

{

/* Destination MAC (broadcast) */

for (int i = 0; i < 6; i++)

{

frame[i] = 0xFF;

}



/* Source MAC */

memcpy(&frame[6], g_macAddr, 6);



/* EtherType/Length */

frame[12] = 0x08; // IPv4

frame[13] = 0x00;



/* Simple payload */

for (int i = 14; i < ENET_DATA_LENGTH; i++)

{

frame[i] = i % 256;

}

}



void InitEthernet(void)

{

enet_config_t config;



/* Prepare buffer configuration */

enet_buffer_config_t buffConfig =

{

ENET_RXBD_NUM,

ENET_TXBD_NUM,

ENET_RXBUFF_SIZE,

ENET_TXBUFF_SIZE, g_rxBuffDescrip, g_txBuffDescrip, &g_rxDataBuff[0][0], &g_txDataBuff[0][0],

true,

true,

NULL };



/* Get default ENET configuration */

ENET_GetDefaultConfig(&config);

config.miiMode = kENET_RmiiMode;

config.miiSpeed = kENET_MiiSpeed100M;

config.miiDuplex = kENET_MiiFullDuplex;



/* Initialize ENET */

ENET_Init(EXAMPLE_ENET, &g_handle, &config, &buffConfig, g_macAddr, EXAMPLE_CLOCK_FREQ);

ENET_ActiveRead(EXAMPLE_ENET);

}



int main(void)

{

uint8_t txFrame[ENET_DATA_LENGTH];

uint8_t rxBuffer[ENET_RXBUFF_SIZE];



/* Initialize hardware */

BOARD_InitHardware();



/* Initialize Ethernet */

InitEthernet();



/* Build test frame */

BuildTestFrame(txFrame);



while (1)

{

uint32_t frameLength = 0;



/* Check for received frames */

if (ENET_GetRxFrameSize(&g_handle, &frameLength, 0) == kStatus_Success)

{

if (frameLength > 0)

{

/* Read the frame */

if (ENET_ReadFrame(EXAMPLE_ENET, &g_handle, rxBuffer, frameLength, 0, NULL) == kStatus_Success)

{

/* Process received frame here */

}

}

}



/* Send test frame */

status_t ENET_SendFrame(ENET_Type *base, enet_handle_t *handle, const uint8_t *data, uint32_t length, uint8_t ringId,

bool tsFlag, void *context);



ENET_SendFrame(EXAMPLE_ENET, &g_handle, txFrame, ENET_DATA_LENGTH, 0, false, NULL);



/* Small delay */

for (volatile int i = 0; i < 1000000; i++);

}

}











in that i am getting also error undefined reference to `PHY_LinkStatusChange'
0 项奖励
回复
4,294 次查看
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

Thanks for your updated information.

I don't recommend modifying the NXP SDK demo code ,because it may introduce additional issues.

Since the NXP SDK demo is already well-optimized , and it was rigorously tested to ensure proper functionality, I suggest you refer to the example code as it is(when the demo runs ok, then you can modify the code you want to test).

Additionally, I suggest you check  the README file for this demo to confirm your development environment is correctly configured.

mayliu1_0-1745985202094.png

Wish it helps you.
If you still have question about it, please kindly let me know.

Wish you a nice day!

Best Regards
MayLiu

0 项奖励
回复
4,281 次查看
Govind89
Contributor II
Thank you for your response. Additionally, I would like to inquire about communication between two RT boards using Ethernet. Both boards have 1 Gbps and 100 Mbps ports available. Could you please advise which example I should follow for this setup?
0 项奖励
回复
4,251 次查看
mayliu1
NXP Employee
NXP Employee

Hi @Govind89 ,

 

I suggest you can check the example in SDK import Wizard.

mayliu1_0-1746098335143.png

Best Regards

MayLiu

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2088184%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E4%BB%A5%E5%A4%AA%E7%BD%91%E9%80%9A%E4%BF%A1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2088184%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22%22%3E%E6%88%91%E6%98%AF%20i.MX%20RT1170%20%E5%BC%80%E5%8F%91%E7%9A%84%E6%96%B0%E6%89%8B%EF%BC%8C%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%20EVKBMIMXRT1170%20%E6%9D%BF%E3%80%82%E6%88%91%E6%AD%A3%E5%9C%A8%E4%BD%BF%E7%94%A8%E5%86%85%E7%BD%AE%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eevkbmimxrt1170_enet_txrx_transfer_cm7%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%E7%94%A8%E4%BA%8E%E4%BB%A5%E5%A4%AA%E7%BD%91%E5%8A%9F%E8%83%BD%EF%BC%8C%E4%BD%86%E6%88%91%E5%8F%91%E7%8E%B0%E5%BE%88%E9%9A%BE%E7%90%86%E8%A7%A3%E5%AE%83%E6%98%AF%E5%A6%82%E4%BD%95%E5%B7%A5%E4%BD%9C%E7%9A%84%E3%80%82%3C%2FP%3E%3CP%20class%3D%22%22%3E%E6%88%91%E6%83%B3%E8%A6%81%E4%B8%80%E4%B8%AA%E6%9B%B4%E7%AE%80%E5%8D%95%E7%9A%84%E8%A3%B8%E6%9C%BA%E4%BB%A3%E7%A0%81%E7%A4%BA%E4%BE%8B%EF%BC%8C%E8%AF%A5%E7%A4%BA%E4%BE%8B%E4%BB%85%E5%85%B3%E6%B3%A8%E5%9F%BA%E6%9C%AC%E7%9A%84%E4%BB%A5%E5%A4%AA%E7%BD%91%E6%93%8D%E4%BD%9C%EF%BC%9A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3E%E4%BB%A5%E5%A4%AA%E7%BD%91%E7%9A%84%E9%85%8D%E7%BD%AE%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%E4%BB%A5%E5%A4%AA%E7%BD%91%E5%88%9D%E5%A7%8B%E5%8C%96%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%E4%BB%A5%E5%A4%AA%E7%BD%91%E5%B8%A7%E4%BC%A0%E8%BE%93%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%E4%BB%A5%E5%A4%AA%E7%BD%91%E5%B8%A7%E6%8E%A5%E6%94%B6%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%20class%3D%22%22%3E%E6%88%91%E9%9C%80%E8%A6%81%E4%BD%BF%E7%94%A8%20MCUXpresso%20IDE%EF%BC%8C%E4%BB%A5%E6%B2%A1%E6%9C%89%20RTOS%20%E7%9A%84%20API%20%E6%A0%B7%E5%BC%8F%E7%9A%84%E7%AE%80%E5%8D%95%E4%BB%A3%E7%A0%81%E6%9D%A5%E5%AE%9E%E7%8E%B0%E8%BF%99%E4%B8%80%E7%82%B9%E3%80%82%E8%AF%B7%E6%8F%90%E4%BE%9B%E6%88%91%E7%9A%84%20EVKBMIMXRT1170%20%E5%BC%80%E5%8F%91%E6%9D%BF%E4%B8%8A%E4%BB%A5%E5%A4%AA%E7%BD%91%E5%8A%9F%E8%83%BD%E7%9A%84%E6%8C%87%E5%AF%BC%E5%92%8C%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84%E5%9F%BA%E7%A1%80%E4%BB%A3%E7%A0%81%E3%80%82%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2Fi.MX-RT1170%2Fpd-p%2Fi.MX-RT1170%22%20class%3D%22lia-product-mention%22%20data-product%3D%22519-1%22%20target%3D%22_blank%22%3Ei.MX-RT1170%3C%2FA%3E%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FMCUXpresso-IDE%2Fpd-p%2FMCUXpresso-IDE%22%20class%3D%22lia-product-mention%22%20data-product%3D%223137-1%22%20target%3D%22_blank%22%3EMCUXpresso-IDE%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2089827%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E4%BB%A5%E5%A4%AA%E7%BD%91%E9%80%9A%E4%BF%A1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2089827%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E8%B0%A2%E8%B0%A2%E6%82%A8%E7%9A%84%E5%9B%9E%E5%A4%8D%E3%80%82%E6%AD%A4%E5%A4%96%EF%BC%8C%E6%88%91%E6%83%B3%E8%AF%A2%E9%97%AE%E4%B8%A4%E4%B8%AA%20RT%20%E6%9D%BF%E4%B9%8B%E9%97%B4%E4%BD%BF%E7%94%A8%E4%BB%A5%E5%A4%AA%E7%BD%91%E8%BF%9B%E8%A1%8C%E9%80%9A%E4%BF%A1%E7%9A%84%E6%83%85%E5%86%B5%E3%80%82%E4%B8%A4%E5%9D%97%E4%B8%BB%E6%9D%BF%E5%9D%87%E6%9C%89%201%20Gbps%20%E5%92%8C%20100%20Mbps%20%E7%AB%AF%E5%8F%A3%E5%8F%AF%E7%94%A8%E3%80%82%E6%82%A8%E8%83%BD%E5%90%A6%E5%BB%BA%E8%AE%AE%E6%88%91%E5%BA%94%E8%AF%A5%E9%81%B5%E5%BE%AA%E5%93%AA%E4%B8%AA%E7%A4%BA%E4%BE%8B%E6%9D%A5%E8%BF%9B%E8%A1%8C%E6%AD%A4%E8%AE%BE%E7%BD%AE%EF%BC%9F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2088907%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E4%BB%A5%E5%A4%AA%E7%BD%91%E9%80%9A%E4%BF%A1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2088907%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E4%BD%A0%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239163%22%20target%3D%22_blank%22%3E%40mayliu1%3C%2FA%3E%3CBR%20%2F%3E%E6%84%9F%E8%B0%A2%E9%87%8D%E6%92%AD%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%A0%B9%E6%8D%AE%E7%A4%BA%E4%BE%8B%EF%BC%8C%E6%88%91%E5%B0%9D%E8%AF%95%E8%BF%87%EF%BC%8C%E4%BD%86%E6%97%A0%E6%B3%95%E6%8E%A5%E6%94%B6%E5%92%8C%E4%BC%A0%E8%BE%93%E5%B8%A7%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%88%91%E4%BF%AE%E6%94%B9%E4%BA%86%E4%BB%A3%E7%A0%81%E4%BB%A5%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E6%9B%B4%E7%AE%80%E5%8D%95%E7%9A%84%E7%89%88%E6%9C%AC%E3%80%82%E4%BD%BF%E7%94%A8%20evkbmimxrt1170_enet_txrx_transfer_cm7%20%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%EF%BC%8C%E8%AF%B7%E6%8C%87%E5%AF%BC%E6%88%91%E9%9C%80%E8%A6%81%E8%BF%9B%E8%A1%8C%E5%93%AA%E4%BA%9B%E6%9B%B4%E6%94%B9%E3%80%82%E6%88%91%E6%98%AF%20attech%20%E9%A1%B9%E7%9B%AE%E6%96%87%E4%BB%B6%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23%E5%8C%85%E6%8B%AC%E2%80%9Cfsl_debug_console.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%8C%85%E6%8B%AC%E2%80%9Cfsl_silicon_id.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%8C%85%E6%8B%AC%E2%80%9Cfsl_enet.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%23%E5%8C%85%E6%8B%AC%E2%80%9Cfsl_phy.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%23%E5%8C%85%E6%8B%AC%E2%80%9Cboard.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23%E5%8C%85%E6%8B%AC%E2%80%9Cfsl_phyrtl8201.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%8C%85%E6%8B%AC%E2%80%9Cfsl_enet.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%23%E5%8C%85%E6%8B%AC%E2%80%9Cboard.h%E2%80%9D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%23%E5%AE%9A%E4%B9%89%20EXAMPLE_ENET%20ENET%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%AE%9A%E4%B9%89%20EXAMPLE_CLOCK_FREQ%20CLOCK_GetRootClockFreq%EF%BC%88kCLOCK_Root_Bus%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%AE%9A%E4%B9%89%20ENET_RXBD_NUM%204%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%AE%9A%E4%B9%89%20ENET_TXBD_NUM%204%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%AE%9A%E4%B9%89%20ENET_RXBUFF_SIZE%20ENET_FRAME_MAX_FRAMELEN%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%AE%9A%E4%B9%89%20ENET_TXBUFF_SIZE%20ENET_FRAME_MAX_FRAMELEN%3CBR%20%2F%3E%3CBR%20%2F%3E%20%23%E5%AE%9A%E4%B9%89%20ENET_DATA_LENGTH%201000%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E7%BC%93%E5%86%B2%E5%8C%BA%E6%8F%8F%E8%BF%B0%E7%AC%A6%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20AT_NONCACHEABLE_SECTION_ALIGN%EF%BC%88enet_rx_bd_struct_t%20g_rxBuffDescrip%5BENET_RXBD_NUM%5D%EF%BC%8C%20ENET_BUFF_ALIGNMENT%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%20AT_NONCACHEABLE_SECTION_ALIGN%EF%BC%88enet_tx_bd_struct_t%20g_txBuffDescrip%5BENET_TXBD_NUM%5D%EF%BC%8C%20ENET_BUFF_ALIGNMENT%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E6%95%B0%E6%8D%AE%E7%BC%93%E5%86%B2%E5%8C%BA%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20SDK_ALIGN%EF%BC%88uint8_t%20g_rxDataBuff%5BENET_RXBD_NUM%5D%5BENET_RXBUFF_SIZE%5D%EF%BC%8CENET_BUFF_ALIGNMENT%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%20SDK_ALIGN(uint8_t%20g_txDataBuff%5BENET_TXBD_NUM%5D%5BENET_TXBUFF_SIZE%5D%2C%20ENET_BUFF_ALIGNMENT)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20MAC%E5%9C%B0%E5%9D%80%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20uint8_t%20g_macAddr%5B6%5D%20%3D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%200x02%2C%200x12%2C%200x13%2C%200x14%2C%200x15%2C%200x16%20%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20ENET%20%E5%8F%A5%E6%9F%84%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E9%9D%99%E6%80%81enet_handle_t%20g_handle%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%E9%9D%99%E6%80%81void%20BuildTestFrame%EF%BC%88uint8_t%20*frame%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E7%9B%AE%E6%A0%87%20MAC%EF%BC%88%E5%B9%BF%E6%92%AD%EF%BC%89%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%AF%B9%E4%BA%8E%EF%BC%88int%20i%20%3D%200%EF%BC%9Bi%20%26lt%3B%206%EF%BC%9Bi%20%2B%2B%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%B8%A7%5Bi%5D%20%3D%200xFF%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E6%BA%90%20MAC%20%E5%9C%B0%E5%9D%80%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20memcpy(%26amp%3Bframe%5B6%5D%2C%20g_macAddr%2C%206)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E4%BB%A5%E5%A4%AA%E7%BD%91%E7%B1%BB%E5%9E%8B%2F%E9%95%BF%E5%BA%A6%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%B8%A7%5B12%5D%20%3D%200x08%3B%20%2F%2FIPv4%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%B8%A7%5B13%5D%20%3D%200x00%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E7%AE%80%E5%8D%95%E6%9C%89%E6%95%88%E8%BD%BD%E8%8D%B7%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%AF%B9%E4%BA%8E%EF%BC%88int%20i%20%3D%2014%EF%BC%9Bi%20%26lt%3B%20ENET_DATA_LENGTH%EF%BC%9Bi%20%2B%2B%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%B8%A7%5Bi%5D%20%3D%20i%20%25%20256%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20void%20InitEthernet%EF%BC%88void%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20enet_config_t%20%E9%85%8D%E7%BD%AE%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E5%87%86%E5%A4%87%E7%BC%93%E5%86%B2%E5%8C%BA%E9%85%8D%E7%BD%AE%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20enet_buffer_config_t%20buffConfig%20%3D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_RXBD_NUM%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_TXBD_NUM%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_RXBUFF_SIZE%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_TXBUFF_SIZE%EF%BC%8Cg_rxBuffDescrip%EF%BC%8Cg_txBuffDescrip%EF%BC%8C%26amp%3Bg_rxDataBuff%5B0%5D%5B0%5D%EF%BC%8C%26amp%3Bg_txDataBuff%5B0%5D%5B0%5D%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%E7%9C%9F%E7%9A%84%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%E7%9C%9F%E7%9A%84%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%97%A0%E6%95%88%E7%9A%84%20%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E8%8E%B7%E5%8F%96%E9%BB%98%E8%AE%A4%E7%9A%84%20ENET%20%E9%85%8D%E7%BD%AE%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_GetDefaultConfig%EF%BC%88%26amp%3Bconfig%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%E9%85%8D%E7%BD%AE.mii%E6%A8%A1%E5%BC%8F%3DkENET_Rmii%E6%A8%A1%E5%BC%8F%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%E9%85%8D%E7%BD%AE.miiSpeed%20%3D%20kENET_MiiSpeed100M%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%E9%85%8D%E7%BD%AE.miiDuplex%20%3D%20kENET_MiiFullDuplex%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%E5%88%9D%E5%A7%8B%E5%8C%96ENET*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_Init%EF%BC%88EXAMPLE_ENET%EF%BC%8C%EF%BC%86g_handle%EF%BC%8C%EF%BC%86config%EF%BC%8C%EF%BC%86buffConfig%EF%BC%8Cg_macAddr%EF%BC%8CEXAMPLE_CLOCK_FREQ%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_ActiveRead%EF%BC%88%E7%A4%BA%E4%BE%8B_ENET%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20int%20main%EF%BC%88%E7%A9%BA%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20uint8_t%20txFrame%5BENET_DATA_LENGTH%5D%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%20uint8_t%20rxBuffer%5BENET_RXBUFF_SIZE%5D%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E5%88%9D%E5%A7%8B%E5%8C%96%E7%A1%AC%E4%BB%B6%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E4%B8%BB%E6%9D%BF%E5%88%9D%E5%A7%8B%E5%8C%96%E7%A1%AC%E4%BB%B6%EF%BC%88%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E5%88%9D%E5%A7%8B%E5%8C%96%E4%BB%A5%E5%A4%AA%E7%BD%91%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%88%9D%E5%A7%8B%E5%8C%96%E4%BB%A5%E5%A4%AA%E7%BD%91%EF%BC%88%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E6%9E%84%E5%BB%BA%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%9E%84%E5%BB%BA%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6%EF%BC%88txFrame%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20while%EF%BC%881%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20uint32_t%E5%B8%A7%E9%95%BF%E5%BA%A6%3D0%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E6%A3%80%E6%9F%A5%E6%8E%A5%E6%94%B6%E5%88%B0%E7%9A%84%E5%B8%A7%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ENET_GetRxFrameSize%EF%BC%88%EF%BC%86g_handle%EF%BC%8C%EF%BC%86frameLength%EF%BC%8C0%EF%BC%89%3D%3DkStatus_Success%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88%E5%B8%A7%E9%95%BF%E5%BA%A6%26gt%3B%200%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E8%AF%BB%E5%8F%96%E5%B8%A7%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%A6%82%E6%9E%9C%EF%BC%88ENET_ReadFrame%EF%BC%88EXAMPLE_ENET%EF%BC%8C%EF%BC%86g_handle%EF%BC%8CrxBuffer%EF%BC%8CframeLength%EF%BC%8C0%EF%BC%8CNULL%EF%BC%89%3D%3DkStatus_Success%EF%BC%89%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E5%9C%A8%E6%AD%A4%E5%A4%84%E7%90%86%E6%8E%A5%E6%94%B6%E5%88%B0%E7%9A%84%E5%B8%A7%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E5%8F%91%E9%80%81%E6%B5%8B%E8%AF%95%E5%B8%A7%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%20status_t%20ENET_SendFrame(ENET_Type%20*base%2C%20enet_handle_t%20*handle%2C%20const%20uint8_t%20*data%2C%20uint32_t%20length%2C%20uint8_t%20ringId%2C%3CBR%20%2F%3E%3CBR%20%2F%3E%20bool%20tsFlag%EF%BC%8Cvoid%20*%E4%B8%8A%E4%B8%8B%E6%96%87%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20ENET_SendFrame(EXAMPLE_ENET%EF%BC%8C%26amp%3Bg_handle%EF%BC%8CtxFrame%EF%BC%8CENET_DATA_LENGTH%EF%BC%8C0%EF%BC%8Cfalse%EF%BC%8CNULL)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%20%2F*%20%E5%B0%8F%E5%BB%B6%E8%BF%9F%20*%2F%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%AF%B9%E4%BA%8E%EF%BC%88%E6%8C%A5%E5%8F%91%E6%80%A7%E6%95%B4%E6%95%B0%20i%20%3D%200%EF%BC%9Bi%20%26lt%3B%201000000%EF%BC%9Bi%2B%2B%EF%BC%89%EF%BC%9B%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%20%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%E5%9B%A0%E4%B8%BA%E6%88%91%E8%BF%98%E5%BE%97%E5%88%B0%E4%BA%86%E5%AF%B9%E2%80%9CPHY_LinkStatusChange%E2%80%9D%E7%9A%84%E6%9C%AA%E5%AE%9A%E4%B9%89%E5%BC%95%E7%94%A8%E9%94%99%E8%AF%AF%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E