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

Fix byte order in TOTMR register #49

Merged
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
4 changes: 2 additions & 2 deletions lan867x/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "1.0.1"
version: "1.0.2"
targets:
- esp32
- esp32p4
description: LAN867x Ethernet PHY Driver
url: https://github.com/espressif/esp-eth-drivers/tree/master/lan867x
dependencies:
idf: ">=5.3"
idf: ">=5.3"
4 changes: 2 additions & 2 deletions lan867x/include/esp_eth_phy_lan867x.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ typedef enum {
LAN867X_ETH_CMD_G_PLCA_NCNT, /*!< Get PLCA node count */
LAN867X_ETH_CMD_S_PLCA_ID, /*!< Set PLCA ID */
LAN867X_ETH_CMD_G_PLCA_ID, /*!< Get PLCA ID */
LAN867x_ETH_CMD_S_PLCA_TOT, /*!< Set PLCA Transmit Opportunity Timer in incriments of 100ns */
LAN867x_ETH_CMD_G_PLCA_TOT, /*!< Get PLCA Transmit Opportunity Timer in incriments of 100ns */
LAN867X_ETH_CMD_S_PLCA_TOT, /*!< Set PLCA Transmit Opportunity Timer in incriments of 100ns */
LAN867X_ETH_CMD_G_PLCA_TOT, /*!< Get PLCA Transmit Opportunity Timer in incriments of 100ns */
LAN867X_ETH_CMD_ADD_TX_OPPORTUNITY, /*!< Add additional transmit opportunity for chosen node */
LAN867X_ETH_CMD_RM_TX_OPPORTUNITY, /*!< Remove additional transmit opportunity for chosen node */
LAN867X_ETH_CMD_S_MAX_BURST_COUNT, /*!< Set max count of additional packets, set to 0 to disable */
Expand Down
18 changes: 11 additions & 7 deletions lan867x/src/esp_eth_phy_lan867x.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,37 @@ typedef union {
uint32_t reserved1 : 14; // Reserved
uint32_t rst : 1; // PLCA Reset
uint32_t en : 1; // PLCA Enable
uint16_t padding1; // Padding
};
uint32_t val;
} lan867x_plca_ctrl0_reg_t;
#define ETH_PHY_PLCA_CTRL0_REG_MMD_ADDR (0xCA01)

typedef union {
struct {
uint8_t id; // PLCA ID
uint8_t ncnt; // Node count
uint8_t id; // PLCA ID
uint8_t ncnt; // Node count
uint16_t padding1; // Padding
};
uint32_t val;
} lan867x_plca_ctrl1_reg_t;
#define ETH_PHY_PLCA_CTRL1_REG_MMD_ADDR (0xCA02)

typedef union {
struct {
uint8_t reserved1; // Reserved
uint8_t totmr; // Transmit Opportunity Timer
uint8_t reserved1; // Reserved
uint16_t padding1; // Padding
};
uint32_t val;
} lan867x_plca_totmr_reg_t;
#define ETH_PHY_PLCA_TOTMR_REG_MMD_ADDR (0xCA04)

typedef union {
struct {
uint8_t maxbc; // Maximum burst count
uint8_t btmr; // Burst timer
uint8_t btmr; // Burst timer
uint8_t maxbc; // Maximum burst count
uint16_t padding1; // Padding
};
uint32_t val;
} lan867x_plca_burst_reg_t;
Expand Down Expand Up @@ -254,12 +258,12 @@ static esp_err_t lan867x_custom_ioctl(esp_eth_phy_t *phy, int cmd, void *data)
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_mmd_register(phy_802_3, MISC_REGISTERS_DEVICE, ETH_PHY_PLCA_CTRL1_REG_MMD_ADDR, &plca_ctrl1.val), err, TAG, "read PLCA_CTRL1 failed");
*((uint8_t *) data) = plca_ctrl1.id;
break;
case LAN867x_ETH_CMD_S_PLCA_TOT:
case LAN867X_ETH_CMD_S_PLCA_TOT:
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_mmd_register(phy_802_3, MISC_REGISTERS_DEVICE, ETH_PHY_PLCA_TOTMR_REG_MMD_ADDR, &plca_totmr.val), err, TAG, "read PLCA_TOTMR failed");
plca_totmr.totmr = *((uint8_t *) data);
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_write_mmd_register(phy_802_3, MISC_REGISTERS_DEVICE, ETH_PHY_PLCA_TOTMR_REG_MMD_ADDR, plca_totmr.val), err, TAG, "write PLCA_TOTMR failed");
break;
case LAN867x_ETH_CMD_G_PLCA_TOT:
case LAN867X_ETH_CMD_G_PLCA_TOT:
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_mmd_register(phy_802_3, MISC_REGISTERS_DEVICE, ETH_PHY_PLCA_TOTMR_REG_MMD_ADDR, &plca_totmr.val), err, TAG, "read PLCA_TOTMR failed");
*((uint8_t *) data) = plca_totmr.totmr;
break;
Expand Down
Loading