[riot-notifications] [RIOT-OS/RIOT] stm32 eth peripheral driver (#10633)

Alexandre Abadie notifications at github.com
Fri Jun 28 19:24:42 CEST 2019


It seems the `eth_conf_t` struct has problems with c++. I also noticed the attributes were not in the same order in the struct definition and in `periph_conf.h` and this is important with c++.
In `cpu/stm32_common/periph_cpu_common.h`, how about defining enums and struct the following way (the order is also fixed, I kept the same one use in periph_conf.h):
```c
/**
 * @brief   Ethernet configuration mode
 */
typedef enum {
    MII = 18,                       /**< Configuration for MII */
    RMII = 9,                       /**< Configuration for RMII */
    SMI = 2,                        /**< Configuration for SMI */
} eth_mode_t;

/**
 * @brief   Speed selection
 */
typedef enum {
    ETH_SPEED_10T_HD = 0x0000,
    ETH_SPEED_10T_FD = 0x0100,
    ETH_SPEED_100TX_HD = 0x2000,
    ETH_SPEED_100TX_FD = 0x2100,
} eth_speed_t;

/**
 * @brief   Ethernet Peripheral configuration
 */
typedef struct {
    eth_mode_t mode;                    /**< Select configuration mode */
    char mac[6];                        /**< Ethernet MAC address */
    eth_speed_t speed;                  /**< Speed selection */
    uint8_t dma;                        /**< Locical CMA Descriptor used for TX */
    uint8_t dma_chan;                   /**< DMA channel used for TX */
    char phy_addr;                      /**< PHY address */
    gpio_t pins[];                      /**< Pins to use. MII requires 18 pins,
                                             RMII 9 and SMI 9. Not all speeds are
                                             supported by all modes. */
} eth_conf_t;
```

There might be better alternatives but this one builds.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10633#issuecomment-506814025
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190628/27ba7f1d/attachment-0001.html>


More information about the notifications mailing list