File indexing completed on 2025-05-11 08:23:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef LIBBSP_ARM_LPC24XX_LPC_ETHERNET_CONFIG_H
0037 #define LIBBSP_ARM_LPC24XX_LPC_ETHERNET_CONFIG_H
0038
0039 #include <bsp.h>
0040 #include <bsp/io.h>
0041 #include <bsp/lpc24xx.h>
0042
0043 #include <limits.h>
0044
0045 #ifdef __cplusplus
0046 extern "C" {
0047 #endif
0048
0049 #define LPC_ETH_CONFIG_INTERRUPT LPC24XX_IRQ_ETHERNET
0050
0051 #define LPC_ETH_CONFIG_REG_BASE MAC_BASE_ADDR
0052
0053 #ifdef ARM_MULTILIB_ARCH_V4
0054 #define LPC_ETH_CONFIG_RX_UNIT_COUNT_DEFAULT 16
0055 #define LPC_ETH_CONFIG_RX_UNIT_COUNT_MAX 54
0056
0057 #define LPC_ETH_CONFIG_TX_UNIT_COUNT_DEFAULT 10
0058 #define LPC_ETH_CONFIG_TX_UNIT_COUNT_MAX 10
0059
0060 #define LPC_ETH_CONFIG_UNIT_MULTIPLE 1U
0061
0062 #define LPC24XX_ETH_RAM_BEGIN 0x7fe00000U
0063 #define LPC24XX_ETH_RAM_SIZE (16U * 1024U)
0064 #else
0065 #define LPC_ETH_CONFIG_RX_UNIT_COUNT_DEFAULT 16
0066 #define LPC_ETH_CONFIG_RX_UNIT_COUNT_MAX INT_MAX
0067
0068 #define LPC_ETH_CONFIG_TX_UNIT_COUNT_DEFAULT 32
0069 #define LPC_ETH_CONFIG_TX_UNIT_COUNT_MAX INT_MAX
0070
0071 #define LPC_ETH_CONFIG_UNIT_MULTIPLE 8U
0072
0073 #define LPC_ETH_CONFIG_USE_TRANSMIT_DMA
0074
0075 #define LPC24XX_ETH_RAM_BEGIN 0x20000000U
0076 #define LPC24XX_ETH_RAM_SIZE (32U * 1024U)
0077 #endif
0078
0079 #ifdef LPC24XX_ETHERNET_RMII
0080 #define LPC_ETH_CONFIG_RMII
0081
0082 static void lpc_eth_config_module_enable(void)
0083 {
0084 static const lpc24xx_pin_range pins [] = {
0085 #ifdef LPC24XX_PIN_ETHERNET_POWER_DOWN
0086 LPC24XX_PIN_ETHERNET_POWER_DOWN,
0087 #endif
0088 LPC24XX_PIN_ETHERNET_RMII_0,
0089 LPC24XX_PIN_ETHERNET_RMII_1,
0090 LPC24XX_PIN_ETHERNET_RMII_2,
0091 LPC24XX_PIN_ETHERNET_RMII_3,
0092 LPC24XX_PIN_TERMINAL
0093 };
0094
0095 lpc24xx_module_enable(LPC24XX_MODULE_ETHERNET, LPC24XX_MODULE_PCLK_DEFAULT);
0096 lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
0097
0098 #ifdef LPC24XX_PIN_ETHERNET_POWER_DOWN
0099 {
0100 unsigned pin = lpc24xx_pin_get_first_index(&pins[0]);
0101
0102 lpc24xx_gpio_config(pin, LPC24XX_GPIO_OUTPUT);
0103 lpc24xx_gpio_set(pin);
0104 }
0105 #endif
0106 }
0107 #else
0108 static void lpc_eth_config_module_enable(void)
0109 {
0110 static const lpc24xx_pin_range pins [] = {
0111 LPC24XX_PIN_ETHERNET_MII,
0112 LPC24XX_PIN_TERMINAL
0113 };
0114
0115 lpc24xx_module_enable(LPC24XX_MODULE_ETHERNET, LPC24XX_MODULE_PCLK_DEFAULT);
0116 lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
0117 }
0118 #endif
0119
0120 static void lpc_eth_config_module_disable(void)
0121 {
0122 lpc24xx_module_disable(LPC24XX_MODULE_ETHERNET);
0123 }
0124
0125 static char *lpc_eth_config_alloc_table_area(size_t size)
0126 {
0127 if (size < LPC24XX_ETH_RAM_SIZE) {
0128 return (char *) LPC24XX_ETH_RAM_BEGIN;
0129 } else {
0130 return NULL;
0131 }
0132 }
0133
0134 static void lpc_eth_config_free_table_area(char *table_area)
0135 {
0136
0137 }
0138
0139 #ifdef __cplusplus
0140 }
0141 #endif
0142
0143 #endif