Part Number: PROCESSOR-SDK-AM437X
Tool/software: TI-RTOS
1) EMAC_get_stats_v4 returns garbage when port_num is 1.
EMAC_get_stats_v4 calls EMAC_socGetInitCfg(), which returns -1 and an invalid pointer when "port_num" is 1.
If I call emac_poll() the parameter "port_num" is the EMAC port number. emac_get_statistics() description says that the parameter the "port_num" is EMAC port number too.
The test of port_num is wrong. EMAC_NUM_MAX_MAC_PORTS is used in the definition of the port[EMAC_NUM_MAX_MAC_PORTS] field of EMAC_HwAttrs_V4 structure. The definition of EMACInitCfg is "EMAC_HwAttrs_V4 EMACInitCfg[1]".
int32_t EMAC_socGetInitCfg(uint32_t port_num, EMAC_HwAttrs_V4 *cfg)
{
int32_t ret = 0;
if (port_num < EMAC_NUM_MAX_MAC_PORTS -1U)
{
*cfg = EMACInitCfg[port_num];
}
else
{
ret = -1;
}
return ret;
}
And EMAC_get_stats_v4 does not test the return of EMAC_socGetInitCfg() and always return EMAC_DRV_RESULT_OK.
2) Evaluation of the EMAC_STATISTICS_T:
/*!
* @brief EMAC Statistics
* The statistics structure is used to retrieve the current count
* of various packet events in the system. These values represent the
* delta values from the last time the statistics were read.
*/
In fact EMAC_get_stats_v4 adds the values read from the MPU registers and to the EMAC_STATISTICS_T argument
Installed itens:
CCS 7.2
GCC ARM Compiler 4.9.3
processor_sdk_rtos_am437x 4.00.00.04
am437x PDK v1.0.7
bios 6.46.05.55
xdctools 3.32.02.25_core
Board: AM437x Starter Kit
regards,
Marcio.