Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixes and improvements from Micropython #120

Open
wants to merge 6 commits into
base: micropython
Choose a base branch
from

Conversation

andrewleech
Copy link

An earlier version of this Wiznet driver has been in use in micropython (primarily on the stm32 port) since 2014, with a few additions being made to it since.

As part of my work in micropython/micropython#8540 I'm updating the driver to use the current version from here, preferably as a submodule to make future updates easier to maintain. For this to happen smoothly though, I'm hoping to submit a clean version of the micropython patches here.

There are a couple of commits here that as-is will present no change, but instead allow third part projects like micropython to integrate the library more smoothly.

A couple of other commits add features / bug fixes found previously. Hopefully the commit descriptions provide enough context for these changes.

pi-anl added 5 commits April 27, 2022 06:27
No change to any function names by default.

3rd party projects can set a compiler define of
WIZCHIP_PREFIXED_EXPORTS=1
to rename all exported names from socket, eg
"close" becomes "wizchip_close".

Originally by @dpgeorge from:
micropython/micropython@9d2bf9c
#define WIZCHIP_YIELD() can be globally set to yield from
thread to improve the performance of connect, send, recv,
sento and recvfrom.

Originally by liweiwei@yeweitech.com from:
micropython/micropython@73e387c
Enabling WIZCHIP_USE_MAX_BUFFER will make the TX/RX buffers the maximum
available size, for use with MACRAW mode.

Adapted from original version by @dpgeorge at:
micropython/micropython@cd9de63
@irinakim12
Copy link
Contributor

irinakim12 commented May 22, 2022

Sorry. We can't merge micropython related code here.
This repository is a library for C language.
For that code, it seems that we need to create a separate library for MicroPython.

@andrewleech
Copy link
Author

Hi @irinakim12 this PR does not include any micropython specific code, it was carefully cleaned up to only include C changes that should be relevant to any users of this library. I listed micropython in the title simply because these were commits / changes originally done by other's under the micropython project.

@jimmo
Copy link

jimmo commented Jul 21, 2022

Hi @irinakim12 I'm from the MicroPython project. We're currently using @andrewleech's fork of this repo but would prefer to point our submodule to the official repo instead.

As Andrew said, this PR doesn't include anything MicroPython-specific, rather it's just general improvements that make it easy for a project (such as MicroPython) to embed this library. (In particular, avoiding name collisions with other functions).

@irinakim12
Copy link
Contributor

@andrewleech Could I ask you for an answer ? :)

@andrewleech
Copy link
Author

andrewleech commented Dec 9, 2022

Sure, what's the question?

@irinakim12
Copy link
Contributor

Sure, what's the question?

I write the review about your Pull request last week.
I ask you for an answer and code fix for this.

@andrewleech
Copy link
Author

I write the review about your Pull request last week. I ask you for an answer and code fix for this.

Sorry I can't see any review comments on this PR?
Do you mean a discussion on one/some of the "Change MICROPY_PY_LWIP setting" PR's in micropython?

#include "socket.h"
#include "wizchip_conf.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. "#inlclude wizchip_conf.h" is already assigned in the socket.h
  2. we didn't use the memset.
    Please delete this phrase.

// socket, and trying to get POSIX behaviour we return 0 because:
// "If no messages are available to be received and the peer has per?
// formed an orderly shutdown, recv() shall return 0".
// TODO this return value clashes with SOCK_BUSY in non-blocking mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete the comments

@@ -278,7 +294,7 @@ typedef struct __WIZCHIP
uint8_t (*_read_byte) (void);
void (*_write_byte) (uint8_t wb);
void (*_read_burst) (uint8_t* pBuf, uint16_t len);
void (*_write_burst) (uint8_t* pBuf, uint16_t len);
void (*_write_burst) (const uint8_t* pBuf, uint16_t len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use const values only when using write_bust function?
Any special reason?

@@ -100,9 +103,21 @@ uint8_t sock_pack_info[_WIZCHIP_SOCK_NUM_] = {0,};
if(len == 0) return SOCKERR_DATALEN; \
}while(0); \

void WIZCHIP_EXPORT(socket_reset)(void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to use a reset function?

@@ -496,6 +501,9 @@ int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize)
}
#endif
}

WIZCHIP_EXPORT(socket_reset)();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the reset function only used here?

@irinakim12
Copy link
Contributor

I write the review about your Pull request last week. I ask you for an answer and code fix for this.

Sorry I can't see any review comments on this PR? Do you mean a discussion on one/some of the "Change MICROPY_PY_LWIP setting" PR's in micropython?

sorry. Review of this PR has been put on hold. Now you can check out my comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants