Skip to content

Commit 44c0f93

Browse files
drivers: ethernet: Update the variable type for R_ETHER_CallbackSet
- Update the variable type for R_ETHER_CallbackSet in eth_renesas_ra.c - Update HAL callback event handler to be compatible with FSP 6.0.0 Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com> Signed-off-by: Ta Minh Nhat <nhat-minh.ta.yn@bp.renesas.com>
1 parent bd3ceaf commit 44c0f93

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/ethernet/eth_renesas_ra.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
2727
#include "r_ether_phy.h"
2828

2929
/* Additional configurations to use with hal_renesas */
30-
#define ETHER_DEFAULT NULL
31-
#define ETHER_CHANNEL0 0
32-
#define ETHER_BUF_SIZE 1536
33-
#define ETHER_PADDING_OFFSET 1
34-
#define ETHER_BROADCAST_FILTER 0
35-
#define ETHER_TOTAL_BUF_NUM (CONFIG_ETH_RENESAS_TX_BUF_NUM + CONFIG_ETH_RENESAS_RX_BUF_NUM)
36-
#define ETHER_EE_RECEIVE_EVENT_MASK (0x01070000)
30+
#define ETHER_DEFAULT NULL
31+
#define ETHER_CHANNEL0 0
32+
#define ETHER_BUF_SIZE 1536
33+
#define ETHER_PADDING_OFFSET 1
34+
#define ETHER_BROADCAST_FILTER 0
35+
#define ETHER_TOTAL_BUF_NUM (CONFIG_ETH_RENESAS_TX_BUF_NUM + CONFIG_ETH_RENESAS_RX_BUF_NUM)
36+
#define ETHER_EE_RECEIVE_EVENT_MASK \
37+
(ETHER_EESR_EVENT_MASK_RFOF | ETHER_EESR_EVENT_MASK_RDE | ETHER_EESR_EVENT_MASK_FR | \
38+
ETHER_EESR_EVENT_MASK_RFCOF)
3739

3840
BUILD_ASSERT(DT_INST_ENUM_IDX(0, phy_connection_type) <= 1, "Invalid PHY connection setting");
3941

@@ -79,8 +81,7 @@ LISTIFY(CONFIG_ETH_RENESAS_TX_BUF_NUM, DECLARE_ETHER_TX_BUFFER, (;));
7981

8082
uint8_t *pp_g_ether0_ether_buffers[ETHER_TOTAL_BUF_NUM] = {
8183
LISTIFY(CONFIG_ETH_RENESAS_RX_BUF_NUM, DECLARE_ETHER_RX_BUFFER_PTR, (,)),
82-
LISTIFY(CONFIG_ETH_RENESAS_TX_BUF_NUM, DECLARE_ETHER_TX_BUFFER_PTR, (,))
83-
};
84+
LISTIFY(CONFIG_ETH_RENESAS_TX_BUF_NUM, DECLARE_ETHER_TX_BUFFER_PTR, (,)) };
8485

8586
static __aligned(16) ether_instance_descriptor_t
8687
g_ether0_tx_descriptors[CONFIG_ETH_RENESAS_TX_BUF_NUM];
@@ -90,6 +91,7 @@ static __aligned(16) ether_instance_descriptor_t
9091
const ether_extended_cfg_t g_ether0_extended_cfg_t = {
9192
.p_rx_descriptors = g_ether0_rx_descriptors,
9293
.p_tx_descriptors = g_ether0_tx_descriptors,
94+
.eesr_event_filter = ETHER_EE_RECEIVE_EVENT_MASK,
9395
};
9496

9597
/* Dummy configuration for ether phy as hal layer require */
@@ -142,7 +144,7 @@ void renesas_ra_eth_callback(ether_callback_args_t *p_args)
142144
struct device *dev = (struct device *)p_args->p_context;
143145
struct renesas_ra_eth_context *ctx = dev->data;
144146

145-
if (p_args->status_eesr & ETHER_EE_RECEIVE_EVENT_MASK) {
147+
if (p_args->event == ETHER_EVENT_RX_COMPLETE) {
146148
k_sem_give(&ctx->rx_sem);
147149
}
148150
}
@@ -251,7 +253,7 @@ static void renesas_ra_eth_initialize(struct net_if *iface)
251253
LOG_ERR("Failed to init ether - R_ETHER_Open fail");
252254
}
253255

254-
err = R_ETHER_CallbackSet(&ctx->ctrl, renesas_ra_eth_callback, dev, NULL);
256+
err = R_ETHER_CallbackSet(&ctx->ctrl, renesas_ra_eth_callback, (void *const)dev, NULL);
255257

256258
if (err != FSP_SUCCESS) {
257259
LOG_ERR("Failed to init ether - R_ETHER_CallbackSet fail");

0 commit comments

Comments
 (0)