Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Ethernet/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
//#define SOCK_ANY_PORT_NUM 0xC000;
#define SOCK_ANY_PORT_NUM 0xC000

// Static prototypes
static int8_t connect_IO_6(uint8_t sn, uint8_t * addr, uint16_t port, uint8_t addrlen);
static int32_t sendto_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port, uint8_t addrlen);
static int32_t recvfrom_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port, uint8_t *addrlen);

static uint16_t sock_any_port = SOCK_ANY_PORT_NUM;
static uint16_t sock_io_mode = 0;
static uint16_t sock_is_sending = 0;
Expand Down Expand Up @@ -196,8 +201,8 @@ inline uint8_t inline_CheckAddrlen_W6x00(void) {

int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag) {

uint8_t taddr[16];
uint16_t local_port = 0;
//uint8_t taddr[16];
//uint16_t local_port = 0;
CHECK_SOCKNUM();
switch (protocol & 0x0F) {
#ifdef IPV6_AVAILABLE
Expand Down Expand Up @@ -1033,6 +1038,7 @@ static int32_t recvfrom_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t *
while (getSn_CR(sn));

#else
(void)addrlen; // Unused
if (sock_remained_size[sn] == 0) {
wiz_recv_data(sn, head, 8);
setSn_CR(sn, Sn_CR_RECV);
Expand Down
6 changes: 3 additions & 3 deletions Ethernet/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ int8_t listen(uint8_t sn);
In block io mode, it does not return until connection is completed. \n
In Non-block io mode(@ref SF_IO_NONBLOCK), it returns @ref SOCK_BUSY immediately.
*/
static int8_t connect_IO_6(uint8_t sn, uint8_t * addr, uint16_t port, uint8_t addrlen);
//static int8_t connect_IO_6(uint8_t sn, uint8_t * addr, uint16_t port, uint8_t addrlen);
//int8_t connect(uint8_t sn, uint8_t * addr, uint16_t port, uint8_t addrlen);

/**
Expand Down Expand Up @@ -401,7 +401,7 @@ int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len);
In non-block io mode(@ref SF_IO_NONBLOCK), It return @ref SOCK_BUSY immediately when SOCKET transimttable buffer size is not enough.
*/
//int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port, uint8_t addrlen);
static int32_t sendto_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port, uint8_t addrlen);
//static int32_t sendto_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port, uint8_t addrlen);

/**
@ingroup WIZnet_socket_APIs
Expand Down Expand Up @@ -436,7 +436,7 @@ static int32_t sendto_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * ad
In non-block io mode(@ref SF_IO_NONBLOCK), it return @ref SOCK_BUSY immediately when SOCKET RX buffer is empty. \n
*/
//int32_t recvfrom(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port, uint8_t *addrlen);
static int32_t recvfrom_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port, uint8_t *addrlen);
//static int32_t recvfrom_IO_6(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port, uint8_t *addrlen);


/////////////////////////////
Expand Down
14 changes: 8 additions & 6 deletions Ethernet/wizchip_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void wizchip_bus_writedata(uint32_t AddrSel, iodata_t wb) {
@sa wizchip_bus_write_buf()
*/
void wizchip_bus_read_buf(uint32_t AddrSel, iodata_t* buf, int16_t len, uint8_t addrinc) {
uint16_t i;
int16_t i;
if (addrinc) {
addrinc = sizeof(iodata_t);
}
Expand All @@ -151,7 +151,7 @@ void wizchip_bus_read_buf(uint32_t AddrSel, iodata_t* buf, int16_t len, uint8_t
@sa wizchip_bus_read_buf()
*/
void wizchip_bus_write_buf(uint32_t AddrSel, iodata_t* buf, int16_t len, uint8_t addrinc) {
uint16_t i;
int16_t i;
if (addrinc) {
addrinc = sizeof(iodata_t);
}
Expand Down Expand Up @@ -179,7 +179,7 @@ uint8_t wizchip_spi_readbyte(void) {
null function is called.
*/
//void wizchip_spi_writebyte(uint8_t wb) {};
void wizchip_spi_writebyte(uint8_t wb) {}
void wizchip_spi_writebyte(uint8_t wb) { (void)wb; }

/**
@brief Default function to burst read in SPI interface.
Expand Down Expand Up @@ -221,14 +221,14 @@ void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {}
@note This function help not to access wrong address. If you do not describe this function or register any functions,
null function is called.
*/
void wizchip_qspi_read(uint8_t opcode, uint16_t addr, uint8_t* pBuf, uint16_t len) {}
void wizchip_qspi_read(uint8_t opcode, uint16_t addr, uint8_t* pBuf, uint16_t len) { (void)opcode; (void)addr; (void)pBuf; (void)len; }

/**
@brief Default function to write in QSPI interface.
@note This function help not to access wrong address. If you do not describe this function or register any functions,
null function is called.
*/
void wizchip_qspi_write(uint8_t opcode, uint16_t addr, uint8_t* pBuf, uint16_t len) {}
void wizchip_qspi_write(uint8_t opcode, uint16_t addr, uint8_t* pBuf, uint16_t len) { (void)opcode; (void)addr; (void)pBuf; (void)len; }

#endif
/**
Expand Down Expand Up @@ -270,7 +270,9 @@ _WIZCHIP WIZCHIP = {
//wizchip_bus_readbyte,
//wizchip_bus_writebyte
wizchip_bus_readdata,
wizchip_bus_writedata
wizchip_bus_writedata,
NULL,
NULL
},

}
Expand Down
14 changes: 8 additions & 6 deletions Internet/SNMP/snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <ctype.h>
#include <stdarg.h>
#include <time.h>
#include <inttypes.h>

#include "socket.h"
#include "snmp.h"
Expand All @@ -25,10 +26,10 @@ void insertRespLen(int32_t reqStart, int32_t respStart, int32_t size);
int32_t parseVarBind(int32_t reqType, int32_t index);
int32_t parseSequence(int32_t reqType, int32_t index);
int32_t parseSequenceOf(int32_t reqType);
int32_t parseRequest();
int32_t parseCommunity();
int32_t parseVersion();
int32_t parseSNMPMessage();
int32_t parseRequest(void);
int32_t parseCommunity(void);
int32_t parseVersion(void);
int32_t parseSNMPMessage(void);

// Debugging function
#ifdef _SNMP_DEBUG_
Expand Down Expand Up @@ -146,7 +147,7 @@ int32_t snmpd_run(void) {

uint8_t svr_addr[6];
uint16_t svr_port;
#if 1
#if ((_WIZCHIP_ == 6100) || (_WIZCHIP_ == 6300))
// 20231019 taylor
uint8_t addr_len;
#endif
Expand Down Expand Up @@ -713,7 +714,8 @@ void ipToByteArray(int8_t *ip, uint8_t *pDes) {
}
}

sscanf((char const*)buff, "%u %u %u %u", &ip1, &ip2, &ip3, &ip4);
//sscanf((char const*)buff, "%u %u %u %u", &ip1, &ip2, &ip3, &ip4);
sscanf((char const*)buff, "%" PRIu32 " %" PRIu32 " %" PRIu32 " %" PRIu32, &ip1, &ip2, &ip3, &ip4);
pDes[0] = ip1; pDes[1] = ip2; pDes[2] = ip3; pDes[3] = ip4;
}

Expand Down
2 changes: 1 addition & 1 deletion Internet/SNMP/snmp_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern const int32_t maxData;
#define COMMUNITY_SIZE (strlen(COMMUNITY))

/* Predefined function: Response value control */
void initTable();
void initTable(void);

/* User defined functions: LED control examples */
#ifdef _USE_WIZNET_W5500_EVB_
Expand Down