Skip to content

Conversation

@htibosch
Copy link
Contributor

@htibosch htibosch commented Jun 1, 2020

This is a copy of # #57, just renewed it to have it properly rebased.

Description

As the title says, this PR is adding a FreeRTOS+TCP driver for 2 platforms: SAM4E and SAME70.

The driver makes use of the module ../Common/phyHandler.c, which initialises and polls the Ethernet PHY.

Related Issue

A user on the FreeRTOS forum asked for this driver. He had found a reference on SourceForge, but the ZIP file had been deleted.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AniruddhaKanhere AniruddhaKanhere self-requested a review June 10, 2020 21:14
@AniruddhaKanhere
Copy link
Member

/bot run checks

@AniruddhaKanhere AniruddhaKanhere requested a review from cobusve June 25, 2020 20:01
@AniruddhaKanhere AniruddhaKanhere merged commit c720c18 into FreeRTOS:master Jul 13, 2020
@marekr
Copy link

marekr commented Jul 22, 2020

Well, it appears this was never actually tested on the SAM4E.
Bad define of GMAC_UR_RMIIMII
and appears the non ipconfigZERO_COPY_TX_DRIVER (SAM4E) mode wasn't tested, for example theres code that looks for p_tx_buffer which is definitely not a member of gmac_device_t

	switch (mode) {
		case GMAC_PHY_MII:
		case GMAC_PHY_RMII:
			p_gmac->GMAC_UR |= GMAC_UR_RMIIMII;
		break;

		default:
			p_gmac->GMAC_UR &= ~GMAC_UR_RMIIMII;
		break;
	}

@htibosch
Copy link
Contributor Author

@marekr : thanks for having a look at the driver.

Well, it appears this was never actually tested on the SAM4E.

Sure it was tested. Very recently once again, both on a SAM4E and a SAME70.

Bad define of GMAC_UR_RMIIMII

That depends on which version of the driver that you are using.

These 2 are equivalent:

#define GMAC_UR_RMIIMII (0x1u << 0) /**< \brief (GMAC_UR)  */
#define GMAC_UR_MII (0x1u << 0) /**< \brief (GMAC_UR) MII Mode */

I don't know which one is the newest.

and appears the non ipconfigZERO_COPY_TX_DRIVER (SAM4E) mode
wasn't tested, for example theres code that looks for p_tx_buffer which
is definitely not a member of gmac_device_t

In the earlier version, the non-zero-copy mode was still allowed. p_tx_buffer was used to hold ( a copy of ) the outgoing data.

The current driver only compiles if zero-copy is chosen:

#if( ipconfigZERO_COPY_RX_DRIVER == 0 )
    #error This driver works optimal if ipconfigZERO_COPY_RX_DRIVER is defined as 1
#endif

#if( ipconfigZERO_COPY_TX_DRIVER == 0 )
    #error This driver works optimal if ipconfigZERO_COPY_TX_DRIVER is defined as 1
#endif

You're right, it is confusing to see code that is never compiled.

About this function ingmac_SAM.h:

switch (mode) {
    case GMAC_PHY_MII:
    case GMAC_PHY_RMII:
        p_gmac->GMAC_UR |= GMAC_UR_RMIIMII;
    break;

    default:
        p_gmac->GMAC_UR &= ~GMAC_UR_RMIIMII;
    break;
}

This function was provided by Atmel as it is. It looks strange but the reason is probably: SAM4E does not support RMII. See e.g. [here](https://microchipsupport.force.com/s/article/RMII-support-on-SAM4E-devices).
And mind you, for the SAM4E: The checksum offload feature is available only for the receiver, and not for the transmitter.

AniruddhaKanhere added a commit that referenced this pull request Jul 28, 2020
* Fixed Imports for Infineon XMC1100 Board (#88)

Co-authored-by: RichardBarry <[email protected]>

* FreeRTOS+TCP : add memory statistics and dump packets, v3 (#83)

* FreeRTOS+TCP : add memory statistics and dump packets, v3

* Two changes as requested by Aniruddha

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>

* Folder structure change + Fix broken Projects (#103)

* Update folder structure

* Correct project files

* Move test folder

* Some changes after Yuki's comments

* Add checks in FreeRTOS_Socket.c (#104)

* Add fail-safes to FreeRTOS_Socket.c

* Use all 'pd' errors

* Correction after Hein's comments

* Correction after Hein's comments v2

* Changes after Hein's comments

* Update after Gary's comments

* Add VeriFast kernel queue proofs (#117)

* Remove unnecessary semicolon from the linker file (#121)

This was creating problem with the onboard LPCLink debug probe.

Signed-off-by: Gaurav Aggarwal <[email protected]>

* Add Full TCP test suite - not using secure sockets (#131)

* Add Full-TCP suite

* delete unnecessary files

* Change after Joshua's comments

* Add changes from 2225-2227 amazon-FreeRTOS (#134)

* FreeRTOS+TCP Adding the combined driver for SAM4E and SAME70 v2 (#78)

* Adding a combined +TCP driver for SAM4E and SAME70

* Changes after review from Aniruddha

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>

* Prove buffer lemmas (#124)

* Prove buffer lemmas

* Update queue proofs to latest kernel source

All changes were syntactic due to uncrustify code-formatting

* Strengthen prvCopyDataToQueue proof

* Add extract script for diff comparison

Co-authored-by: Yuhui Zheng <[email protected]>

* Sync with +TCP amazon-FreeRTOS (#158)

* DNS.c commit

* IP.c commit

* Add various source & header files

* Add Uncrustify file used for Kernel. (#163)

* Add Atmel Studio projects for ATMega4809 and AVR128DA48 (#159)

* Added explicit cast to allow roll over and avoid integer promotion during cycles counters comparison in recmutex.c.

* Fixed type mismatch between declaration and definition of function xAreSemaphoreTasksStillRunning( void ).

* Added Atmel Studio demo projects for ATMega4809 and AVR128DA48.

* Per https://www.freertos.org/upgrading-to-FreeRTOS-V8.html, I'm updating portBASE_TYPE to BaseType_t.

Signed-off-by: Yuhui Zheng <[email protected]>

* Update register test for ATmega4809
- to cover r28, r29, r31.
- call public API taskYIELD() instead of portYIELD().

* Update ATmega4809 readme.md to include info for serial port setup, and minor wording fix.

Co-authored-by: Alexandru Niculae - M17336 <[email protected]>

Co-authored-by: S.Burch <[email protected]>
Co-authored-by: RichardBarry <[email protected]>
Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Nathan Chong <[email protected]>
Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]>
Co-authored-by: Yuhui Zheng <[email protected]>
Co-authored-by: Carl Lundin <[email protected]>
Co-authored-by: Alexandru Niculae - M17336 <[email protected]>
moninom1 pushed a commit that referenced this pull request Sep 14, 2022
* Adding a combined +TCP driver for SAM4E and SAME70

* Changes after review from Aniruddha

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>
Zangetsu112 pushed a commit to Zangetsu112/FreeRTOS-evpp that referenced this pull request Aug 18, 2025
…RTOS#78)

* Adding a combined +TCP driver for SAM4E and SAME70

* Changes after review from Aniruddha

Co-authored-by: Hein Tibosch <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>
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