New Feature for WIZnet driver - Socket Memory Size Adjustment, please test
Timothy D. Swieter
Posts: 1,613
I've started coding the ability to adjust the socket memory size in the W5100. My work will concentrate on the Indirect driver first and once that is working I will copy over the work to the SPI driver.
My work will be logged regularly to the Google Code repository.
Thus far I have the foundation set and I need to review it with fresh eyes. After the review I will start to modify the rxTCP, txTCP, rxUDP and txUDP and do some testing on my bench. After all appears to be OK, I'll upload for ya'll to hack at.
At this time this feature will be implemented mainly in SPIN. Eventually this feature would be a candidate for migrating to ASM.
My work will be logged regularly to the Google Code repository.
Thus far I have the foundation set and I need to review it with fresh eyes. After the review I will start to modify the rxTCP, txTCP, rxUDP and txUDP and do some testing on my bench. After all appears to be OK, I'll upload for ya'll to hack at.
At this time this feature will be implemented mainly in SPIN. Eventually this feature would be a candidate for migrating to ASM.
Comments
Also updated is the W5100_TCP_Server_Echo_Demo_indirect.spin to include a use of the new PUB.
Please download the latest code and try it out. You don't have to use the new PUB, as the W5100 (and the start/stop method) automatically configure at 2K each socket. Please post any bug or problems here so I can review and help out. Remember this code is only in the Indirect Driver at this time. Once the code has been proven a bit it will be copied to the SPI driver.
Why did you choose to go the template route instead of just using parameters to set the configuration? I can see some value in the simplicity of choosing a pre-defined template. However, this approach requires changing the code to add additional templates. Eventually the driver could become bloated with lots of different configurations.
I personally would prefer to specify the config through arguments to InitSocketMem. For example: InitSocketMem(W5100#_2KB, W5100#_2KB, W5100#_2KB, W5100#_2KB) for the default config where the rx and tx buffers are the same. This obviously could be expanded to 8 arguments allowing complete access to the configuration. More flexibility at the expense of some complexity for the user, but this would probably only be used by advanced users anyway.
Your suggestion for using arguments to run the socket configuration instead of the currently implemented template idea has merit. The template version was the easiest version to get running without overwhelming the user to think about the allocation of memory. Stated another way, one has to understand how the W5100 memory works and that they can't allocate 8k to each receive or send socket so they shouldn't do that. I was protecting the user in a minor way by offering templates. When I coded up the tests I didn't take time to code checking logic which would be needed to verify arguments, so I did the easy template route. However I am certainly open to changing this as I agree that the arguments method would allow for more flexibility (and potentially more trouble) but it would be keep the code small and be extensible from four to eight parameters so there could be the ultimate configuration.
I am wondering if any work has been done on the W5100 SPI driver to incorporate these additional memory allocation features. Currently, the driver goes off into the weeds if used with modified memory allocations. I have not looked at the indirect diver to see if the work has been done there, but will look there and integrate those changes or make my own modifications if no one has already taken the plunge.
Thanks,
Marcus
Thanks,
Marcus
W5100_SPI_Driver 11.14.12.spin