Skip to content
Open
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
9 changes: 9 additions & 0 deletions drivers/ra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ zephyr_library_sources_ifdef(CONFIG_USE_RA_FSP_ETHER_PHY
zephyr_library_sources_ifdef(CONFIG_USE_RA_FSP_ETHER
fsp/src/r_ether/r_ether.c)

zephyr_library_sources_ifdef(CONFIG_USE_RA_FSP_RMAC_PHY
fsp/src/r_rmac_phy/r_rmac_phy.c)

zephyr_library_sources_ifdef(CONFIG_USE_RA_FSP_RMAC
fsp/src/r_rmac/r_rmac.c)

zephyr_library_sources_ifdef(CONFIG_USE_RA_FSP_LAYER3_SWITCH
fsp/src/r_layer3_switch/r_layer3_switch.c)

zephyr_library_sources_ifdef(CONFIG_USE_RA_FSP_CRC
fsp/src/r_crc/r_crc.c)

Expand Down
21 changes: 21 additions & 0 deletions drivers/ra/README
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,24 @@ Patch List:
drivers/ra/fsp/src/bsp/mcu/ra8m2/bsp_linker.c
drivers/ra/fsp/src/bsp/mcu/ra8p1/bsp_linker.c
drivers/ra/fsp/src/bsp/mcu/ra8t2/bsp_linker.c

* Remove the static definition in RMAC and RMAC_PHY
Impacted files:
drivers/ra/fsp/src/r_rmac/r_rmac.c
drivers/ra/fsp/src/r_rmac_phy/r_rmac_phy.c

* Add RMAC_CFG_SKIP_PHY_LINK_ABILITY_CHECK to skip checking PHY link state in do-link process.
Impacted files:
drivers/ra/fsp/src/r_rmac/r_rmac.c

* Add RMAC_PHY_CFG_CUSTOM_PHY_INIT to be compatible with muli PHY on the same MDIO bus.
Impacted files:
drivers/ra/fsp/src/r_rmac_phy/r_rmac_phy.c

* Remove crictical section barrier for read function in RMAC
Impacted files:
drivers/ra/fsp/src/r_rmac/r_rmac.c

* Seperate broadcast storm filter reception settings in RMAC
Impacted files:
drivers/ra/fsp/src/r_rmac/r_rmac.c
118 changes: 118 additions & 0 deletions drivers/ra/fsp/inc/api/r_ether_switch_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*******************************************************************************************************************//**
* @ingroup RENESAS_NETWORKING_INTERFACES
* @defgroup ETHER_SWITCH_API Ethernet Switch Interface
* @brief Interface for Ethernet Switch functions.
*
* @section ETHER_SWITCH_API_Summary Summary
* The Ether Switch module provides an API for ethernet switch peripheral.
* And the general ethernet switch peripheral have forwarding functionality.
*
* @{
**********************************************************************************************************************/

#ifndef R_ETHER_SWITCH_API_H
#define R_ETHER_SWITCH_API_H

/***********************************************************************************************************************
* Includes
**********************************************************************************************************************/

/* Register definitions, common services and error codes. */
#include "bsp_api.h"

/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
FSP_HEADER

/**********************************************************************************************************************
* Macro definitions
**********************************************************************************************************************/

/**********************************************************************************************************************
* Typedef definitions
**********************************************************************************************************************/

#ifndef BSP_OVERRIDE_ETHER_SWITCH_EVENT_T

/** Events that can trigger a callback function */
typedef enum e_ether_switch_event
{
ETHER_SWITCH_EVENT_RX_COMPLETE, ///< A descriptor complete to receive a flame.
ETHER_SWITCH_EVENT_TX_COMPLETE, ///< A descriptor complete to transmit a flame.
ETHER_SWITCH_EVENT_RX_QUEUE_FULL, ///< A RX descriptor queue is full.
ETHER_SWITCH_EVENT_RX_MESSAGE_LOST, ///< Receive a frame when a RX descriptor queue is full.
ETHER_SWITCH_EVENT_TAS_ERROR, ///< TAS gate error.
} ether_switch_event_t;
#endif

#ifndef BSP_OVERRIDE_ETHER_SWITCH_CALLBACK_ARGS_T

/** Callback function parameter data */
typedef struct st_ether_switch_callback_args
{
uint32_t channel; ///< Device channel number
uint32_t ports; ///< Bitmap of ports on which the interrupt occurred.
uint32_t queue_index; ///< Queue index where a interrupt occurs.
ether_switch_event_t event; ///< The event can be used to identify what caused the callback.

void * p_context; ///< Placeholder for user data. Set in @ref ether_switch_api_t::open function in @ref ether_switch_cfg_t.
} ether_switch_callback_args_t;
#endif

/** Control block. Allocate an instance specific control block to pass into the API calls.
*/
typedef void ether_switch_ctrl_t;

/** Configuration parameters. */
typedef struct st_ether_switch_cfg
{
uint8_t channel; ///< Channel

IRQn_Type irq; ///< MCU interrupt number
uint8_t ipl; ///< MCU interrupt priority

void (* p_callback)(ether_switch_callback_args_t * p_args); ///< Callback provided when an ISR occurs.

/** Placeholder for user data. Passed to the user callback in ether_switch_callback_args_t. */
void * p_context;
void const * p_extend; ///< Placeholder for user extension.
} ether_switch_cfg_t;

/** Functions implemented at the HAL layer will follow this API. */
typedef struct st_ether_switch_api
{
/** Open driver.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] p_cfg Pointer to pin configuration structure.
*/
fsp_err_t (* open)(ether_switch_ctrl_t * const p_ctrl, ether_switch_cfg_t const * const p_cfg);

/** Close driver.
*
* @param[in] p_ctrl Pointer to control structure.
*/
fsp_err_t (* close)(ether_switch_ctrl_t * const p_ctrl);
} ether_switch_api_t;

/** This structure encompasses everything that is needed to use an instance of this interface. */
typedef struct st_ether_switch_instance
{
ether_switch_ctrl_t * p_ctrl; ///< Pointer to the control structure for this instance
ether_switch_cfg_t const * p_cfg; ///< Pointer to the configuration structure for this instance
ether_switch_api_t const * p_api; ///< Pointer to the API structure for this instance
} ether_switch_instance_t;

/*******************************************************************************************************************//**
* @} (end defgroup ETHER_SWITCH_API)
**********************************************************************************************************************/

/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
FSP_FOOTER

#endif /* R_ETHER_SWITCH_API_H */
161 changes: 161 additions & 0 deletions drivers/ra/fsp/inc/api/r_gptp_api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
/*
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*******************************************************************************************************************//**
* @ingroup RENESAS_NETWORKING_INTERFACES
* @defgroup GPTP_API GPTP Interface
* @brief Interface for gPTP timing.
*
* @section GPTP_API_Summary Summary
* The gPTP API provides a generic interface for gPTP timer operation.
*
* @{
**********************************************************************************************************************/

#ifndef R_GPTP_API_H
#define R_GPTP_API_H

/***********************************************************************************************************************
* Includes
**********************************************************************************************************************/

/* Register definitions, common services and error codes. */
#include "bsp_api.h"

/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
FSP_HEADER

/**********************************************************************************************************************
* Macro definitions
**********************************************************************************************************************/

/**********************************************************************************************************************
* Typedef definitions
**********************************************************************************************************************/

/** Timer value. */
typedef struct st_gptp_timer_value
{
uint16_t time_sec_upper; ///< Second(Upper 16 bit).
uint32_t time_sec_lower; ///< Second(Lower 32 bit).
uint32_t time_nsec; ///< Nanosecond.
} gptp_timer_value_t;

/** Configuration of gPTP timer. */
typedef struct st_gptp_timer_cfg
{
uint8_t clock_period; ///< Timer increment value.
} gptp_timer_cfg_t;

/** Control block. Allocate an instance specific control block to pass into the API calls.
*/
typedef void gptp_ctrl_t;

/** GPTP callback arguments definitions. */
typedef struct st_gptp_callback_args
{
void * p_context; ///< Placeholder for user data. Set in @ref gptp_api_t::open function in @ref gptp_cfg_t.
} gptp_callback_args_t;

/** Configuration parameters. */
typedef struct st_gptp_cfg
{
void (* p_callback)(gptp_callback_args_t * p_args); ///< Pointer to callback function.
void * p_context; ///< Placeholder for user data. Passed to the user callback in @ref gptp_callback_args_t.
void const * p_extend; ///< Placeholder for user extension.
} gptp_cfg_t;

/** Functions implemented at the HAL layer will follow this API. */
typedef struct st_gptp_api
{
/** Open driver.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] p_cfg Pointer to pin configuration structure.
*/
fsp_err_t (* open)(gptp_ctrl_t * const p_ctrl, gptp_cfg_t const * const p_cfg);

/** Close driver.
*
* @param[in] p_ctrl Pointer to control structure.
*/
fsp_err_t (* close)(gptp_ctrl_t * const p_ctrl);

/** Configure gptp timer parameters.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] timer Timer index.
* @param[in] p_timer_cfg Configuration of the timer.
*/
fsp_err_t (* timerCfg)(gptp_ctrl_t * const p_ctrl, uint8_t timer, gptp_timer_cfg_t const * const p_timer_cfg);

/** Start gptp timer.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] timer Timer index.
*/
fsp_err_t (* start)(gptp_ctrl_t * const p_ctrl, uint8_t timer);

/** Stop gptp timer.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] timer Timer index.
*/
fsp_err_t (* stop)(gptp_ctrl_t * const p_ctrl, uint8_t timer);

/** Get the current time value to gptp timer.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] timer Timer index.
* @param[out] p_timer_value Pointer to timer value structure.
*/
fsp_err_t (* timerValueGet)(gptp_ctrl_t * const p_ctrl, uint8_t timer, gptp_timer_value_t * const p_timer_value);

/** Set time offset correction to gptp timer.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] timer Timer index.
* @param[in] offset Time offset value.
*/
fsp_err_t (* timerOffsetSet)(gptp_ctrl_t * const p_ctrl, uint8_t timer, int64_t offset);

/** Set clock rate correction to gptp timer.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] timer Timer index.
* @param[in] rate Clock rate value.
*/
fsp_err_t (* timerRateSet)(gptp_ctrl_t * const p_ctrl, uint8_t timer, uint32_t rate);

/**
* Specify callback function and optional context pointer and working memory pointer.
*
* @param[in] p_ctrl Pointer to control structure.
* @param[in] p_callback Callback function.
* @param[in] p_context Pointer to send to callback function.
* @param[in] p_callback_memory Pointer to volatile memory where callback structure can be allocated.
* Callback arguments allocated here are only valid during the callback.
*/
fsp_err_t (* callbackSet)(gptp_ctrl_t * const p_ctrl, void (* p_callback)(gptp_callback_args_t *),
void * const p_context, gptp_callback_args_t * const p_callback_memory);
} gptp_api_t;

/** This structure encompasses everything that is needed to use an instance of this interface. */
typedef struct st_gptp_instance
{
gptp_ctrl_t * p_ctrl; ///< Pointer to the control structure for this instance
gptp_cfg_t const * p_cfg; ///< Pointer to the configuration structure for this instance
gptp_api_t const * p_api; ///< Pointer to the API structure for this instance
} gptp_instance_t;

/*******************************************************************************************************************//**
* @} (end defgroup GPTP_API)
**********************************************************************************************************************/

/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
FSP_FOOTER

#endif /* R_GPTP_API_H */
Loading