STM32+W5100S以太网芯片程序芯片解密 时间:2026-04-28 来源: 芯片解密 浏览:3次 字号:大 中 小 芯片解密单片机源程序如下:芯片解密#include "socket.h"static uint16 local_port;extern uint16 sent_ptr; #define __MACRAW__/**@brief This Socket function initialize the channel in perticular mode, and set the port and wait for W5200 done it.@return 1 for sucess else 0.*/void setkeepalive(SOCKET s);uint8 socket(SOCKET s, uint8 protocol, uint16 port, uint8 flag) // 2017-07-17{ uint8 ret; if ( ((protocol&0x0F) == Sn_MR_TCP) || ((protocol&0x0F) == Sn_MR_UDP) || ((protocol&0x0F) == Sn_MR_IPRAW) || ((protocol&0x0F) == Sn_MR_MACRAW) ) { close(s); if((protocol&0x0F)==Sn_MR_TCP) { setkeepalive(s); } IINCHIP_WRITE(W5100S_Sn_MR(s) ,protocol | flag); if (port != 0) { IINCHIP_WRITE( W5100S_Sn_PORT0(s) ,(uint8)((port & 0xff00) >> 8)); IINCHIP_WRITE( W5100S_Sn_PORT1(s) ,(uint8)(port & 0x00ff)); } else { local_port++; // if don't set the source port, set local_port number. IINCHIP_WRITE(W5100S_Sn_PORT0(s) ,(uint8)((local_port & 0xff00) >> 8)); IINCHIP_WRITE(W5100S_Sn_PORT1(s) ,(uint8)(local_port & 0x00ff)); } IINCHIP_WRITE( W5100S_Sn_CR(s) ,Sn_CR_OPEN); // run sockinit Sn_CR /* wait to process the command... */ while( IINCHIP_READ(W5100S_Sn_CR(s)) ) ; /* ------- */ ret = 1; } else { ret = 0; } return ret;} 上一篇:STM32逆变器spwm源码+原理图PCB文件芯片解密 下一篇:华大单片机(hc32l073pata)环境搭建芯片解密