forked from Imagelibrary/rtems
libchip: Relax buffer counts and add fatal error
This commit is contained in:
committed by
Sebastian Huber
parent
fac9da635b
commit
5dc268f96d
@@ -98,7 +98,10 @@ typedef enum {
|
|||||||
MRM332_FATAL_SPURIOUS_INTERRUPT = BSP_FATAL_CODE_BLOCK(6),
|
MRM332_FATAL_SPURIOUS_INTERRUPT = BSP_FATAL_CODE_BLOCK(6),
|
||||||
|
|
||||||
/* PowerPC fatal codes */
|
/* PowerPC fatal codes */
|
||||||
PPC_FATAL_EXCEPTION_INITIALIZATION = BSP_FATAL_CODE_BLOCK(7)
|
PPC_FATAL_EXCEPTION_INITIALIZATION = BSP_FATAL_CODE_BLOCK(7),
|
||||||
|
|
||||||
|
/* Libchip fatal codes */
|
||||||
|
DWMAC_FATAL_TOO_MANY_RBUFS_CONFIGURED = BSP_FATAL_CODE_BLOCK(8)
|
||||||
} bsp_fatal_code;
|
} bsp_fatal_code;
|
||||||
|
|
||||||
RTEMS_COMPILER_NO_RETURN_ATTRIBUTE static inline void
|
RTEMS_COMPILER_NO_RETURN_ATTRIBUTE static inline void
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
|
#include <bsp/fatal.h>
|
||||||
#include <rtems/endian.h>
|
#include <rtems/endian.h>
|
||||||
#include "dwmac-common.h"
|
#include "dwmac-common.h"
|
||||||
#include "dwmac-core.h"
|
#include "dwmac-core.h"
|
||||||
@@ -47,9 +48,9 @@ const dwmac_phy_event PHY_EVENT_REMOTE_FAULT = 0x02;
|
|||||||
const dwmac_phy_event PHY_EVENT_LINK_UP = 0x01;
|
const dwmac_phy_event PHY_EVENT_LINK_UP = 0x01;
|
||||||
|
|
||||||
/* Default values for the number of DMA descriptors and mbufs to be used */
|
/* Default values for the number of DMA descriptors and mbufs to be used */
|
||||||
#define DWMAC_CONFIG_RX_UNIT_COUNT_DEFAULT 256
|
#define DWMAC_CONFIG_RX_UNIT_COUNT_DEFAULT 64
|
||||||
#define DWMAC_CONFIG_RX_UNIT_COUNT_MAX INT_MAX
|
#define DWMAC_CONFIG_RX_UNIT_COUNT_MAX INT_MAX
|
||||||
#define DWMAC_CONFIG_TX_UNIT_COUNT_DEFAULT 256
|
#define DWMAC_CONFIG_TX_UNIT_COUNT_DEFAULT 64
|
||||||
#define DWMAC_CONFIG_TX_UNIT_COUNT_MAX INT_MAX
|
#define DWMAC_CONFIG_TX_UNIT_COUNT_MAX INT_MAX
|
||||||
|
|
||||||
/* Default values for the DMA configuration */
|
/* Default values for the DMA configuration */
|
||||||
@@ -96,6 +97,9 @@ const dwmac_phy_event PHY_EVENT_LINK_UP = 0x01;
|
|||||||
|
|
||||||
#define DWMAC_DMA_THRESHOLD_CONTROL_DEFAULT 64
|
#define DWMAC_DMA_THRESHOLD_CONTROL_DEFAULT 64
|
||||||
|
|
||||||
|
#define DWMAC_GLOBAL_MBUF_CNT (rtems_bsdnet_config.mbuf_bytecount / sizeof(struct mbuf))
|
||||||
|
#define DWMAG_GLOBAL_MCLUST_CNT (rtems_bsdnet_config.mbuf_cluster_bytecount / MCLBYTES)
|
||||||
|
|
||||||
static int dwmac_if_mdio_busy_wait( const volatile uint32_t *gmii_address )
|
static int dwmac_if_mdio_busy_wait( const volatile uint32_t *gmii_address )
|
||||||
{
|
{
|
||||||
rtems_interval timeout = rtems_clock_get_ticks_per_second();
|
rtems_interval timeout = rtems_clock_get_ticks_per_second();
|
||||||
@@ -2168,6 +2172,13 @@ static int dwmac_if_attach(
|
|||||||
DWMAC_CONFIG_TX_UNIT_COUNT_MAX
|
DWMAC_CONFIG_TX_UNIT_COUNT_MAX
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
DWMAC_GLOBAL_MBUF_CNT / 4 < bsd_config->rbuf_count
|
||||||
|
|| DWMAG_GLOBAL_MCLUST_CNT / 4 < bsd_config->rbuf_count
|
||||||
|
) {
|
||||||
|
bsp_fatal( DWMAC_FATAL_TOO_MANY_RBUFS_CONFIGURED );
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy MAC address */
|
/* Copy MAC address */
|
||||||
memcpy(
|
memcpy(
|
||||||
self->arpcom.ac_enaddr,
|
self->arpcom.ac_enaddr,
|
||||||
|
|||||||
Reference in New Issue
Block a user