增加双网口配置选项,增加phy8211F 驱动 (#6278)
* Update Kconfig 增加RT1170双路网络选项 * Update SConscript 增加RTL8211F驱动选项支持 * Update SConstruct 去掉外设目录 * Add files via upload 增加PHY芯片RTL8211F驱动 * Update drv_rtl8211f.c * format code Co-authored-by: Meco Man <920369182@qq.com>
This commit is contained in:
parent
ff310443b8
commit
814b1abb08
|
@ -66,8 +66,5 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SCons
|
|||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
|
||||
# include peripherals
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'peripherals', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
|
|
@ -6,17 +6,17 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -3,19 +3,19 @@ menu "Hardware Drivers"
|
|||
config BSP_USING_QSPIFLASH
|
||||
bool
|
||||
default y
|
||||
|
||||
|
||||
config SOC_IMXRT1021DAG5A
|
||||
bool
|
||||
bool
|
||||
select SOC_MIMXRT1020_SERIES
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
select SOC_IMXRT1020_SERIES
|
||||
select SOC_IMXRT1020_SERIES
|
||||
default y
|
||||
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
|
||||
config BSP_USING_DMA
|
||||
config BSP_USING_DMA
|
||||
bool "Enable DMA"
|
||||
default n
|
||||
|
||||
|
@ -23,7 +23,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
default y
|
||||
|
||||
|
||||
menuconfig BSP_USING_CAN
|
||||
bool "Enable CAN"
|
||||
select RT_USING_CAN
|
||||
|
@ -39,7 +39,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
|
||||
if BSP_USING_LPUART
|
||||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
|
@ -69,19 +69,19 @@ menu "On-chip Peripheral Drivers"
|
|||
int "Set LPUART1 TX DMA channel (0-32)"
|
||||
default 1
|
||||
endif
|
||||
menuconfig BSP_USING_HWTIMER
|
||||
bool "Enable GPT"
|
||||
default n
|
||||
select RT_USING_HWTIMER
|
||||
if BSP_USING_TIM
|
||||
config BSP_USING_HWTIMER1
|
||||
bool "Enable GPT1"
|
||||
default n
|
||||
menuconfig BSP_USING_HWTIMER
|
||||
bool "Enable GPT"
|
||||
default n
|
||||
select RT_USING_HWTIMER
|
||||
if BSP_USING_TIM
|
||||
config BSP_USING_HWTIMER1
|
||||
bool "Enable GPT1"
|
||||
default n
|
||||
|
||||
config BSP_USING_HWTIMER2
|
||||
bool "Enable GPT2"
|
||||
default n
|
||||
endif
|
||||
config BSP_USING_HWTIMER2
|
||||
bool "Enable GPT2"
|
||||
default n
|
||||
endif
|
||||
menuconfig BSP_USING_PWM
|
||||
bool "Enable PWM"
|
||||
default n
|
||||
|
@ -138,7 +138,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_ADC1
|
||||
bool "Enable ADC1"
|
||||
default n
|
||||
endif
|
||||
endif
|
||||
config BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
select RT_USING_RTC
|
||||
|
@ -147,47 +147,47 @@ menu "On-chip Peripheral Drivers"
|
|||
endmenu
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
config BSP_USING_RGB
|
||||
bool "Enable RGB LED (PWM1_CH3A, PWM4_CH0A and PWM4_CH1A)"
|
||||
select BSP_USING_PWM1
|
||||
select BSP_USING_PWM4
|
||||
select BSP_USING_PWM1_CH3
|
||||
select BSP_USING_PWM4_CH0
|
||||
select BSP_USING_PWM4_CH1
|
||||
default n
|
||||
config BSP_USING_RGB
|
||||
bool "Enable RGB LED (PWM1_CH3A, PWM4_CH0A and PWM4_CH1A)"
|
||||
select BSP_USING_PWM1
|
||||
select BSP_USING_PWM4
|
||||
select BSP_USING_PWM1_CH3
|
||||
select BSP_USING_PWM4_CH0
|
||||
select BSP_USING_PWM4_CH1
|
||||
default n
|
||||
|
||||
config BSP_USING_MPU6050
|
||||
bool "Enable MPU6050 (I2C1:J11 --> SCL; K11 --> SDA)"
|
||||
select BSP_USING_I2C1
|
||||
select PKG_USING_MPU6XXX
|
||||
default n
|
||||
config BSP_USING_MPU6050
|
||||
bool "Enable MPU6050 (I2C1:J11 --> SCL; K11 --> SDA)"
|
||||
select BSP_USING_I2C1
|
||||
select PKG_USING_MPU6XXX
|
||||
default n
|
||||
|
||||
menuconfig BSP_USING_AP3216C
|
||||
bool "Enable AP3216C (I2C1:J11 --> SCL; K11 --> SDA)"
|
||||
select BSP_USING_I2C1
|
||||
select PKG_USING_AP3216C
|
||||
default n
|
||||
if BSP_USING_AP3216C
|
||||
config AP3216C_USING_HW_INT
|
||||
bool "Enable interrupt"
|
||||
default n
|
||||
endif
|
||||
menuconfig BSP_USING_AP3216C
|
||||
bool "Enable AP3216C (I2C1:J11 --> SCL; K11 --> SDA)"
|
||||
select BSP_USING_I2C1
|
||||
select PKG_USING_AP3216C
|
||||
default n
|
||||
if BSP_USING_AP3216C
|
||||
config AP3216C_USING_HW_INT
|
||||
bool "Enable interrupt"
|
||||
default n
|
||||
endif
|
||||
|
||||
config BSP_USING_EEPROM
|
||||
bool "Enable I2C EEPROM (I2C1:J11 --> SCL; K11 --> SDA)"
|
||||
select BSP_USING_I2C1
|
||||
select PKG_USING_AT24CXX
|
||||
default n
|
||||
config BSP_USING_EEPROM
|
||||
bool "Enable I2C EEPROM (I2C1:J11 --> SCL; K11 --> SDA)"
|
||||
select BSP_USING_I2C1
|
||||
select PKG_USING_AT24CXX
|
||||
default n
|
||||
|
||||
config BSP_USING_RS232
|
||||
bool "Enable RS232"
|
||||
select BSP_USING_LPUART2
|
||||
default n
|
||||
config BSP_USING_RS232
|
||||
bool "Enable RS232"
|
||||
select BSP_USING_LPUART2
|
||||
default n
|
||||
|
||||
config BSP_USING_RS485
|
||||
bool "Enable RS485"
|
||||
select BSP_USING_LPUART5
|
||||
default n
|
||||
config BSP_USING_RS485
|
||||
bool "Enable RS485"
|
||||
select BSP_USING_LPUART5
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ CPPDEFINES = ['CPU_MIMXRT1021DAG5A', 'ENDIANNESS', 'STD=C99', 'SKIP_SYSCLK_INIT'
|
|||
|
||||
if rtconfig.CROSS_TOOL == 'keil':
|
||||
CPPDEFINES.append('__FPU_PRESENT=1')
|
||||
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -13,11 +13,11 @@ if GetDepend('BSP_USING_QSPIFLASH'):
|
|||
LINKFLAGS += '--keep=*(.boot_hdr.dcd_data)'
|
||||
LINKFLAGS += '--keep=*(.boot_hdr.conf)'
|
||||
else:
|
||||
LINKFLAGS = ''
|
||||
LINKFLAGS = ''
|
||||
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
|
||||
if GetDepend('BSP_USING_HYPERFLASH'):
|
||||
if GetDepend('BSP_USING_HYPERFLASH'):
|
||||
group = []
|
||||
Return('group')
|
||||
Return('group')
|
||||
|
|
|
@ -6,17 +6,17 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_IMXRT1052CVL5B
|
||||
bool
|
||||
bool
|
||||
select SOC_MIMXRT1050_SERIES
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
|
@ -12,7 +12,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_DMA
|
||||
bool "Enable DMA"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
|
@ -22,7 +22,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
|
||||
if BSP_USING_LPUART
|
||||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
|
@ -112,14 +112,14 @@ menu "On-chip Peripheral Drivers"
|
|||
endmenu
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
|
||||
config BSP_USING_SPI_FLASH
|
||||
bool "Enable SPI FLASH (W25Q256 spi3)"
|
||||
select BSP_USING_SPI3
|
||||
select RT_USING_SFUD
|
||||
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_SDRAM
|
||||
bool "Enable SDRAM"
|
||||
default n
|
||||
|
|
|
@ -6,17 +6,17 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_IMXRT1052CVL5B
|
||||
bool
|
||||
bool
|
||||
select SOC_MIMXRT1050_SERIES
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
|
@ -12,7 +12,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_DMA
|
||||
bool "Enable DMA"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
|
@ -33,7 +33,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
|
||||
if BSP_USING_LPUART
|
||||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
|
|
|
@ -67,8 +67,5 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SCons
|
|||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
|
||||
# include peripherals
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'peripherals', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
|
|
@ -6,17 +6,17 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -17,7 +17,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_DMA
|
||||
bool "Enable DMA"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
|
@ -27,7 +27,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
|
||||
if BSP_USING_LPUART
|
||||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
|
@ -114,19 +114,19 @@ menu "Onboard Peripheral Drivers"
|
|||
default n
|
||||
|
||||
menuconfig BSP_USING_ETH
|
||||
bool "Enable Ethernet"
|
||||
select RT_USING_NETDEV
|
||||
select RT_USING_LWIP
|
||||
default n
|
||||
|
||||
bool "Enable Ethernet"
|
||||
select RT_USING_NETDEV
|
||||
select RT_USING_LWIP
|
||||
default n
|
||||
|
||||
if BSP_USING_ETH
|
||||
config BSP_USING_PHY
|
||||
|
||||
if BSP_USING_ETH
|
||||
config BSP_USING_PHY
|
||||
select RT_USING_PHY
|
||||
bool "Enable ethernet phy"
|
||||
default y
|
||||
bool "Enable ethernet phy"
|
||||
default y
|
||||
|
||||
if BSP_USING_PHY
|
||||
if BSP_USING_PHY
|
||||
config PHY_DEVICE_ADDRESS
|
||||
int "Specify address of phy device"
|
||||
default 2
|
||||
|
@ -143,7 +143,7 @@ menu "Onboard Peripheral Drivers"
|
|||
config PHY_RESET_PIN
|
||||
int "indicate pin of reset"
|
||||
default 9
|
||||
|
||||
|
||||
config FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE
|
||||
bool "Enable the PHY ksz8081 RMII50M mode"
|
||||
depends on PHY_USING_KSZ8081
|
||||
|
@ -151,14 +151,14 @@ menu "Onboard Peripheral Drivers"
|
|||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_AUDIO
|
||||
bool "Enable AUDIO (WM8960)"
|
||||
select BSP_USING_I2C1
|
||||
select RT_USING_AUDIO
|
||||
default n
|
||||
|
||||
|
||||
if BSP_USING_AUDIO
|
||||
config BSP_USING_AUDIO_PLAY
|
||||
bool "Enable Audio Play"
|
||||
|
@ -177,8 +177,8 @@ menu "Onboard Peripheral Drivers"
|
|||
config BSP_AUDIO_USING_DMA
|
||||
bool "Enable AUDIO DMA"
|
||||
default n
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
|
|
@ -15,9 +15,9 @@ if GetDepend('BSP_USING_HYPERFLASH'):
|
|||
else:
|
||||
LINKFLAGS = ''
|
||||
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
group = []
|
||||
Return('group')
|
||||
Return('group')
|
||||
|
|
|
@ -6,12 +6,12 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_IMXRT1052CVL5B
|
||||
bool
|
||||
bool
|
||||
select SOC_MIMXRT1050_SERIES
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
|
||||
config BSP_USING_SDRAM
|
||||
bool "Enable SDRAM"
|
||||
default n
|
||||
|
@ -20,7 +20,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_DMA
|
||||
bool "Enable DMA"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
|
@ -30,7 +30,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
|
||||
if BSP_USING_LPUART
|
||||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
|
|
|
@ -66,8 +66,5 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SCons
|
|||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
|
||||
# include peripherals
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'peripherals', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
|
|
@ -6,17 +6,17 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -18,7 +18,7 @@ config SOC_MIMXRT1062DVL6A
|
|||
default y
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
|
||||
config BSP_USING_SDRAM
|
||||
bool "Enable SDRAM"
|
||||
default n
|
||||
|
@ -175,7 +175,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_CACHE
|
||||
bool "Enable CACHE"
|
||||
default n
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
|
|
@ -21,7 +21,7 @@ CPPDEFINES = ['CPU_MIMXRT1062DVL6A', 'SKIP_SYSCLK_INIT', 'EVK_MCIMXRM', 'FSL_SDK
|
|||
|
||||
if rtconfig.PLATFORM in ['armcc', 'armclang']:
|
||||
CPPDEFINES.append('__FPU_PRESENT=1')
|
||||
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -17,9 +17,9 @@ if GetDepend('BSP_USING_4MFLASH'):
|
|||
else:
|
||||
LINKFLAGS = ''
|
||||
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
group = []
|
||||
Return('group')
|
||||
Return('group')
|
||||
|
|
|
@ -66,8 +66,5 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SCons
|
|||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
|
||||
# include peripherals
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'peripherals', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
|
|
@ -6,12 +6,12 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
|
|
|
@ -78,7 +78,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config LCD_WIDTH
|
||||
int "width"
|
||||
default 480
|
||||
|
||||
|
||||
config LCD_HEIGHT
|
||||
int "height"
|
||||
default 272
|
||||
|
@ -112,24 +112,24 @@ menu "On-chip Peripheral Drivers"
|
|||
endmenu
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
|
||||
config BSP_USING_SDRAM
|
||||
bool "Enable SDRAM"
|
||||
default n
|
||||
|
||||
menuconfig BSP_USING_ETH
|
||||
bool "Enable Ethernet"
|
||||
select RT_USING_NETDEV
|
||||
default n
|
||||
|
||||
bool "Enable Ethernet"
|
||||
select RT_USING_NETDEV
|
||||
default n
|
||||
|
||||
if BSP_USING_ETH
|
||||
config BSP_USING_PHY
|
||||
|
||||
if BSP_USING_ETH
|
||||
config BSP_USING_PHY
|
||||
select RT_USING_PHY
|
||||
bool "Enable ethernet phy"
|
||||
default y
|
||||
bool "Enable ethernet phy"
|
||||
default y
|
||||
|
||||
if BSP_USING_PHY
|
||||
if BSP_USING_PHY
|
||||
config PHY_DEVICE_ADDRESS
|
||||
int "Specify address of phy device"
|
||||
default 2
|
||||
|
@ -146,7 +146,7 @@ menu "Onboard Peripheral Drivers"
|
|||
config PHY_RESET_PIN
|
||||
int "indicate pin of reset"
|
||||
default 9
|
||||
|
||||
|
||||
config FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE
|
||||
bool "Enable the PHY ksz8081 RMII50M mode"
|
||||
depends on PHY_USING_KSZ8081
|
||||
|
@ -154,7 +154,7 @@ menu "Onboard Peripheral Drivers"
|
|||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
|
|
@ -17,7 +17,7 @@ CPPDEFINES = ['CPU_MIMXRT1064DVL6A', 'SKIP_SYSCLK_INIT', 'EVK_MCIMXRM', 'FSL_SDK
|
|||
|
||||
if rtconfig.PLATFORM in ['armcc', 'armclang']:
|
||||
CPPDEFINES.append('__FPU_PRESENT=1')
|
||||
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -15,9 +15,9 @@ if GetDepend('BSP_USING_4MFLASH'):
|
|||
else:
|
||||
LINKFLAGS = ''
|
||||
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
group = []
|
||||
Return('group')
|
||||
Return('group')
|
||||
|
|
|
@ -66,8 +66,5 @@ objs.extend(SConscript(os.path.join(libraries_path_prefix, imxrt_library, 'SCons
|
|||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
|
||||
# include peripherals
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'peripherals', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
|
|
|
@ -6,17 +6,17 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -107,20 +107,20 @@ menu "Onboard Peripheral Drivers"
|
|||
default y
|
||||
|
||||
if BSP_USING_PHY
|
||||
config PHY_DEVICE_ADDRESS
|
||||
int "Specify address of phy device"
|
||||
default 2
|
||||
|
||||
config PHY_USING_KSZ8081
|
||||
bool "i.MX RT1064EVK uses ksz8081 phy"
|
||||
bool "i.MX RT1176EVK uses ksz8081 phy"
|
||||
default y
|
||||
|
||||
if PHY_USING_KSZ8081
|
||||
config PHY_RESET_PORT
|
||||
config PHY_KSZ8081_ADDRESS
|
||||
int "Specify address of phy device"
|
||||
default 2
|
||||
|
||||
config PHY_RESET_KSZ8081_PORT
|
||||
int "indicate port of reset"
|
||||
default 6
|
||||
|
||||
config PHY_RESET_PIN
|
||||
config PHY_RESET_KSZ8081_PIN
|
||||
int "indicate pin of reset"
|
||||
default 12
|
||||
|
||||
|
@ -129,10 +129,29 @@ menu "Onboard Peripheral Drivers"
|
|||
depends on PHY_USING_KSZ8081
|
||||
default y
|
||||
endif
|
||||
endif
|
||||
|
||||
if BSP_USING_PHY
|
||||
config PHY_USING_RTL8211F
|
||||
bool "i.MX RT1176EVK uses rtl8211f phy"
|
||||
default y
|
||||
|
||||
if PHY_USING_RTL8211F
|
||||
config PHY_RTL8211F_ADDRESS
|
||||
int "Specify address of phy device"
|
||||
default 1
|
||||
|
||||
config PHY_RESET_RTL8211F_PORT
|
||||
int "indicate port of reset"
|
||||
default 11
|
||||
|
||||
config PHY_RESET_RTL8211F_PIN
|
||||
int "indicate pin of reset"
|
||||
default 14
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
|
|
@ -16,5 +16,5 @@ if GetDepend('BSP_USING_QSPIFLASH'):
|
|||
else:
|
||||
LINKFLAGS = ''
|
||||
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
|
|
|
@ -22,8 +22,8 @@ config SOC_IMXRT1064_SERIES
|
|||
bool
|
||||
select ARCH_ARM_CORTEX_M7
|
||||
select ARCH_ARM_CORTEX_FPU
|
||||
|
||||
|
||||
config SOC_IMXRT1170_SERIES
|
||||
bool
|
||||
select ARCH_ARM_CORTEX_M7
|
||||
select ARCH_ARM_CORTEX_FPU
|
||||
select ARCH_ARM_CORTEX_FPU
|
||||
|
|
|
@ -61,7 +61,7 @@ if GetDepend(['BSP_USING_ETH']):
|
|||
|
||||
if GetDepend(['BSP_USING_SDIO']):
|
||||
src += ['MIMXRT1052/drivers/fsl_usdhc.c']
|
||||
|
||||
|
||||
if GetDepend(['RT_USING_AUDIO']):
|
||||
src += ['MIMXRT1052/drivers/fsl_sai.c']
|
||||
src += ['MIMXRT1052/drivers/fsl_sai_edma.c']
|
||||
|
@ -75,7 +75,7 @@ if GetDepend(['BSP_USING_DMA']):
|
|||
src += ['MIMXRT1052/drivers/fsl_lpuart_edma.c']
|
||||
if GetDepend(['BSP_USING_SPI']):
|
||||
src += ['MIMXRT1052/drivers/fsl_lpspi_edma.c']
|
||||
|
||||
|
||||
if GetDepend(['BSP_USING_PULSE_ENCODER']):
|
||||
src += ['MIMXRT1052/drivers/fsl_enc.c']
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ if GetDepend(['BSP_USING_ETH']):
|
|||
|
||||
if GetDepend(['BSP_USING_SDIO']):
|
||||
src += ['MIMXRT1060/drivers/fsl_usdhc.c']
|
||||
|
||||
|
||||
if GetDepend(['RT_USING_AUDIO']):
|
||||
src += ['MIMXRT1060/drivers/fsl_sai.c']
|
||||
src += ['MIMXRT1060/drivers/fsl_sai_edma.c']
|
||||
|
@ -88,7 +88,7 @@ if GetDepend(['BSP_USING_DMA']):
|
|||
src += ['MIMXRT1060/drivers/fsl_lpuart_edma.c']
|
||||
if GetDepend(['BSP_USING_SPI']):
|
||||
src += ['MIMXRT1060/drivers/fsl_lpspi_edma.c']
|
||||
|
||||
|
||||
if GetDepend(['BSP_USING_PULSE_ENCODER']):
|
||||
src += ['MIMXRT1060/drivers/fsl_enc.c']
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ if GetDepend(['RT_USING_AUDIO']):
|
|||
|
||||
if GetDepend(['BSP_USING_LTDC']):
|
||||
src += ['MIMXRT1064/drivers/']
|
||||
|
||||
|
||||
if GetDepend(["BSP_USING_LCD"]):
|
||||
src += ['MIMXRT1064/drivers/fsl_elcdif.c']
|
||||
|
||||
|
|
|
@ -26,20 +26,20 @@ if GetDepend(['BSP_USING_GPIO']):
|
|||
|
||||
if GetDepend(['BSP_USING_LPUART']):
|
||||
src += ['MIMXRT1176/drivers/fsl_lpuart.c']
|
||||
|
||||
|
||||
if GetDepend(['BSP_USING_RTC']):
|
||||
src += ['MIMXRT1176/drivers/fsl_snvs_hp.c']
|
||||
src += ['MIMXRT1176/drivers/fsl_snvs_lp.c']
|
||||
|
||||
|
||||
if GetDepend(['BSP_USING_HWTIMER']) or GetDepend(['BSP_USING_PWM']):
|
||||
src += ['MIMXRT1176/drivers/fsl_gpt.c']
|
||||
|
||||
if GetDepend(['BSP_USING_PWM']):
|
||||
src += ['MIMXRT1176/drivers/fsl_pwm.c']
|
||||
|
||||
src += ['MIMXRT1176/drivers/fsl_pwm.c']
|
||||
|
||||
if GetDepend(['BSP_USING_SDIO']):
|
||||
src += ['MIMXRT1176/drivers/fsl_usdhc.c']
|
||||
|
||||
|
||||
if rtconfig.CROSS_TOOL == 'gcc':
|
||||
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS')
|
||||
else:
|
||||
|
|
|
@ -32,13 +32,13 @@ if GetDepend('BSP_USING_PWM'):
|
|||
|
||||
if GetDepend('BSP_USING_ADC'):
|
||||
src += ['drv_adc.c']
|
||||
|
||||
|
||||
if GetDepend('BSP_USING_LPADC'):
|
||||
src += ['drv_lpadc.c']
|
||||
|
||||
|
||||
if GetDepend('BSP_USING_CAN'):
|
||||
src += ['drv_can.c']
|
||||
|
||||
|
||||
if GetDepend('BSP_USING_SDRAM'):
|
||||
src += ['drv_sdram.c']
|
||||
|
||||
|
@ -47,19 +47,21 @@ if GetDepend('BSP_USING_LCD'):
|
|||
|
||||
if GetDepend('BSP_USING_ETH'):
|
||||
src += ['drv_eth.c']
|
||||
|
||||
|
||||
if GetDepend('BSP_USING_PHY'):
|
||||
src += ['drv_mdio.c']
|
||||
if GetDepend('PHY_USING_KSZ8081'):
|
||||
src += ['drv_ksz8081.c']
|
||||
if GetDepend('PHY_USING_RTL8211F'):
|
||||
src += ['drv_rtl8211f.c']
|
||||
|
||||
if GetDepend('BSP_USING_AUDIO'):
|
||||
src += ['drv_sai.c']
|
||||
src += ['bsp_wm8960.c']
|
||||
|
||||
|
||||
if GetDepend('BSP_USING_SDIO'):
|
||||
src += ['drv_sdio.c']
|
||||
|
||||
src += ['drv_sdio.c']
|
||||
|
||||
if GetDepend('BSP_USING_USB_DEVICE'):
|
||||
src += ['drv_usbd.c']
|
||||
src += Glob('usb/device/*.c')
|
||||
|
@ -67,7 +69,7 @@ if GetDepend('BSP_USING_USB_DEVICE'):
|
|||
if GetDepend('BSP_USING_USB_DEVICE') or GetDepend('RT_USING_USB_HOST'):
|
||||
src += Glob('usb/phy/*.c')
|
||||
CPPDEFINES += ['ENDIANNESS','USE_RTOS']
|
||||
|
||||
|
||||
if GetDepend('RT_USING_USB_HOST'):
|
||||
src += ['drv_usbh.c']
|
||||
src += Glob('usb/host/*.c')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2020, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -168,7 +168,7 @@ static rt_phy_status rt_phy_init(void *object, rt_uint32_t phy_addr, rt_uint32_t
|
|||
#endif /* FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE */
|
||||
|
||||
/* Set the negotiation. */
|
||||
result = phy_ksz8081.ops->write(PHY_AUTONEG_ADVERTISE_REG,
|
||||
result = phy_ksz8081.ops->write(PHY_AUTONEG_ADVERTISE_REG,
|
||||
(PHY_100BASETX_FULLDUPLEX_MASK | PHY_100BASETX_HALFDUPLEX_MASK |
|
||||
PHY_10BASETX_FULLDUPLEX_MASK | PHY_10BASETX_HALFDUPLEX_MASK | 0x1U));
|
||||
if (PHY_STATUS_OK == result)
|
||||
|
|
|
@ -0,0 +1,462 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-08-15 xjy198903 the first version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef PHY_USING_RTL8211F
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include "drv_gpio.h"
|
||||
#include "drv_mdio.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Definitions
|
||||
******************************************************************************/
|
||||
|
||||
/*! @note The following PHY registers are the IEEE802.3 standard definition, same register and bit field may
|
||||
have different names in various PHYs, but the feature they represent should be same or very similar. */
|
||||
|
||||
/*! @brief Defines the IEEE802.3 standard PHY registers. */
|
||||
#define PHY_BASICCONTROL_REG 0x00U /*!< The PHY basic control register. */
|
||||
#define PHY_BASICSTATUS_REG 0x01U /*!< The PHY basic status register. */
|
||||
#define PHY_ID1_REG 0x02U /*!< The PHY ID one register. */
|
||||
#define PHY_ID2_REG 0x03U /*!< The PHY ID two register. */
|
||||
#define PHY_AUTONEG_ADVERTISE_REG 0x04U /*!< The PHY auto-negotiate advertise register. */
|
||||
#define PHY_AUTONEG_LINKPARTNER_REG 0x05U /*!< The PHY auto negotiation link partner ability register. */
|
||||
#define PHY_AUTONEG_EXPANSION_REG 0x06U /*!< The PHY auto negotiation expansion register. */
|
||||
#define PHY_1000BASET_CONTROL_REG 0x09U /*!< The PHY 1000BASE-T control register. */
|
||||
#define PHY_MMD_ACCESS_CONTROL_REG 0x0DU /*!< The PHY MMD access control register. */
|
||||
#define PHY_MMD_ACCESS_DATA_REG 0x0EU /*!< The PHY MMD access data register. */
|
||||
|
||||
/*! @brief Defines the mask flag in basic control register(Address 0x00). */
|
||||
#define PHY_BCTL_SPEED1_MASK 0x0040U /*!< The PHY speed bit mask(MSB).*/
|
||||
#define PHY_BCTL_ISOLATE_MASK 0x0400U /*!< The PHY isolate mask.*/
|
||||
#define PHY_BCTL_DUPLEX_MASK 0x0100U /*!< The PHY duplex bit mask. */
|
||||
#define PHY_BCTL_RESTART_AUTONEG_MASK 0x0200U /*!< The PHY restart auto negotiation mask. */
|
||||
#define PHY_BCTL_AUTONEG_MASK 0x1000U /*!< The PHY auto negotiation bit mask. */
|
||||
#define PHY_BCTL_SPEED0_MASK 0x2000U /*!< The PHY speed bit mask(LSB). */
|
||||
#define PHY_BCTL_LOOP_MASK 0x4000U /*!< The PHY loop bit mask. */
|
||||
#define PHY_BCTL_RESET_MASK 0x8000U /*!< The PHY reset bit mask. */
|
||||
|
||||
/*! @brief Defines the mask flag in basic status register(Address 0x01). */
|
||||
#define PHY_BSTATUS_LINKSTATUS_MASK 0x0004U /*!< The PHY link status mask. */
|
||||
#define PHY_BSTATUS_AUTONEGABLE_MASK 0x0008U /*!< The PHY auto-negotiation ability mask. */
|
||||
#define PHY_BSTATUS_SPEEDUPLX_MASK 0x001CU /*!< The PHY speed and duplex mask. */
|
||||
#define PHY_BSTATUS_AUTONEGCOMP_MASK 0x0020U /*!< The PHY auto-negotiation complete mask. */
|
||||
|
||||
/*! @brief Defines the mask flag in PHY auto-negotiation advertise register(Address 0x04). */
|
||||
#define PHY_100BaseT4_ABILITY_MASK 0x200U /*!< The PHY have the T4 ability. */
|
||||
#define PHY_100BASETX_FULLDUPLEX_MASK 0x100U /*!< The PHY has the 100M full duplex ability.*/
|
||||
#define PHY_100BASETX_HALFDUPLEX_MASK 0x080U /*!< The PHY has the 100M full duplex ability.*/
|
||||
#define PHY_10BASETX_FULLDUPLEX_MASK 0x040U /*!< The PHY has the 10M full duplex ability.*/
|
||||
#define PHY_10BASETX_HALFDUPLEX_MASK 0x020U /*!< The PHY has the 10M full duplex ability.*/
|
||||
#define PHY_IEEE802_3_SELECTOR_MASK 0x001U /*!< The message type being sent by Auto-Nego.*/
|
||||
|
||||
/*! @brief Defines the mask flag in the 1000BASE-T control register(Address 0x09). */
|
||||
#define PHY_1000BASET_FULLDUPLEX_MASK 0x200U /*!< The PHY has the 1000M full duplex ability.*/
|
||||
#define PHY_1000BASET_HALFDUPLEX_MASK 0x100U /*!< The PHY has the 1000M half duplex ability.*/
|
||||
|
||||
/*! @brief Defines the PHY RTL8211F vendor defined registers. */
|
||||
#define PHY_SPECIFIC_STATUS_REG 0x1AU /*!< The PHY specific status register. */
|
||||
#define PHY_PAGE_SELECT_REG 0x1FU /*!< The PHY page select register. */
|
||||
|
||||
/*! @brief Defines the PHY RTL8211F ID number. */
|
||||
#define PHY_CONTROL_ID1 0x001CU /*!< The PHY ID1 . */
|
||||
|
||||
/*! @brief Defines the mask flag in specific status register. */
|
||||
#define PHY_SSTATUS_LINKSTATUS_MASK 0x04U /*!< The PHY link status mask. */
|
||||
#define PHY_SSTATUS_LINKSPEED_MASK 0x30U /*!< The PHY link speed mask. */
|
||||
#define PHY_SSTATUS_LINKDUPLEX_MASK 0x08U /*!< The PHY link duplex mask. */
|
||||
#define PHY_SSTATUS_LINKSPEED_SHIFT 4U /*!< The link speed shift */
|
||||
|
||||
/*! @brief Defines the PHY RTL8211F extra page and the registers in specified page. */
|
||||
#define PHY_PAGE_RGMII_TXRX_DELAY_ADDR 0xD08U /*!< The register page including RGMII TX/RX delay setting. */
|
||||
#define PHY_RGMII_TX_DELAY_REG 0x11U /*!< The RGMII TXC delay register. */
|
||||
#define PHY_RGMII_RX_DELAY_REG 0x15U /*!< The RGMII RXC delay register. */
|
||||
#define PHY_RGMII_TX_DELAY_MASK 0x100U /*!< The RGMII TXC delay mask. */
|
||||
#define PHY_RGMII_RX_DELAY_MASK 0x8U /*!< The RGMII RXC delay mask. */
|
||||
|
||||
/*! @brief MDIO MMD Devices .*/
|
||||
#define PHY_MDIO_MMD_PCS 3U
|
||||
#define PHY_MDIO_MMD_AN 7U
|
||||
|
||||
/*! @brief MDIO MMD Physical Coding layer device registers .*/
|
||||
#define PHY_MDIO_PCS_EEE_CAP 0x14U /* EEE capability */
|
||||
|
||||
/*! @brief MDIO MMD AutoNegotiation device registers .*/
|
||||
#define PHY_MDIO_AN_EEE_ADV 0x3CU /* EEE advertisement */
|
||||
|
||||
/*! @brief MDIO MMD EEE mask flags. (common for adv and cap) */
|
||||
#define PHY_MDIO_EEE_100TX 0x2U
|
||||
#define PHY_MDIO_EEE_1000T 0x4U
|
||||
|
||||
/*! @brief Defines the timeout macro. */
|
||||
#define PHY_READID_TIMEOUT_COUNT 1000U
|
||||
|
||||
/* defined the Reset pin, PORT and PIN config by menuconfig */
|
||||
#define RESET_PIN GET_PIN(PHY_RESET_RTL8211F_PORT, PHY_RESET_RTL8211F_PIN)
|
||||
|
||||
/*! @brief Defines the PHY MMD data access mode. */
|
||||
typedef enum _phy_mmd_access_mode
|
||||
{
|
||||
kPHY_MMDAccessNoPostIncrement = (1U << 14), /*!< ENET PHY MMD access data with no address post increment. */
|
||||
kPHY_MMDAccessRdWrPostIncrement =
|
||||
(2U << 14), /*!< ENET PHY MMD access data with Read/Write address post increment. */
|
||||
kPHY_MMDAccessWrPostIncrement = (3U << 14), /*!< ENET PHY MMD access data with Write address post increment. */
|
||||
} phy_mmd_access_mode_t;
|
||||
|
||||
/*******************************************************************************
|
||||
* Prototypes
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Variables
|
||||
******************************************************************************/
|
||||
|
||||
static struct rt_phy_device phy_rtl8211f;
|
||||
|
||||
/*******************************************************************************
|
||||
* Code
|
||||
******************************************************************************/
|
||||
|
||||
static inline rt_bool_t read_reg(rt_mdio_t *bus, rt_uint32_t addr, rt_uint32_t reg_id, rt_uint32_t *value)
|
||||
{
|
||||
if (4 != bus->ops->read(bus, addr, reg_id, value, 4))
|
||||
{
|
||||
return RT_FALSE;
|
||||
}
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static inline rt_bool_t write_reg(rt_mdio_t *bus, rt_uint32_t addr, rt_uint32_t reg_id, rt_uint32_t value)
|
||||
{
|
||||
if (4 != bus->ops->write(bus, addr, reg_id, &value, 4))
|
||||
{
|
||||
return RT_FALSE;
|
||||
}
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static inline status_t PHY_RTL8211F_MMD_WriteData(uint32_t data)
|
||||
{
|
||||
return phy_rtl8211f.ops->write(PHY_MMD_ACCESS_DATA_REG, data);
|
||||
}
|
||||
|
||||
static status_t PHY_RTL8211F_MMD_SetDevice(uint8_t device,
|
||||
uint16_t addr,
|
||||
phy_mmd_access_mode_t mode)
|
||||
{
|
||||
status_t result = PHY_STATUS_OK;
|
||||
|
||||
/* Set Function mode of address access(b00) and device address. */
|
||||
result = phy_rtl8211f.ops->write(PHY_MMD_ACCESS_CONTROL_REG, device);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set register address. */
|
||||
result = phy_rtl8211f.ops->write(PHY_MMD_ACCESS_DATA_REG, addr);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set Function mode of data access(b01~11) and device address. */
|
||||
result = phy_rtl8211f.ops->write(PHY_MMD_ACCESS_CONTROL_REG, (uint32_t)mode | (uint32_t)device);
|
||||
return result;
|
||||
}
|
||||
|
||||
static status_t PHY_RTL8211F_MMD_Write(uint8_t device, uint16_t addr, uint32_t data)
|
||||
{
|
||||
status_t result = PHY_STATUS_OK;
|
||||
|
||||
result = PHY_RTL8211F_MMD_SetDevice(device, addr, kPHY_MMDAccessNoPostIncrement);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
result = PHY_RTL8211F_MMD_WriteData(data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static rt_phy_status rt_phy_init(void *object, rt_uint32_t phy_addr, rt_uint32_t src_clock_hz)
|
||||
{
|
||||
rt_bool_t ret;
|
||||
rt_phy_status result;
|
||||
rt_uint32_t counter = PHY_READID_TIMEOUT_COUNT;
|
||||
rt_uint32_t regValue = 0U;
|
||||
|
||||
// reset phy device by gpio
|
||||
rt_pin_mode(RESET_PIN, PIN_MODE_OUTPUT);
|
||||
rt_pin_write(RESET_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(10);
|
||||
rt_pin_write(RESET_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(30);
|
||||
|
||||
rt_mdio_t *mdio_bus = rt_hw_mdio_register(object, "phy_mdio");
|
||||
if (RT_NULL == mdio_bus)
|
||||
{
|
||||
return PHY_STATUS_FAIL;
|
||||
}
|
||||
phy_rtl8211f.bus = mdio_bus;
|
||||
phy_rtl8211f.addr = phy_addr;
|
||||
ret = mdio_bus->ops->init(mdio_bus, src_clock_hz);
|
||||
if (!ret)
|
||||
{
|
||||
return PHY_STATUS_FAIL;
|
||||
}
|
||||
|
||||
/* Check PHY ID. */
|
||||
do
|
||||
{
|
||||
result = phy_rtl8211f.ops->read(PHY_ID1_REG, ®Value);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
counter--;
|
||||
} while ((regValue != PHY_CONTROL_ID1) && (counter != 0U));
|
||||
|
||||
if (counter == 0U)
|
||||
{
|
||||
return PHY_STATUS_FAIL;
|
||||
}
|
||||
|
||||
/* Reset PHY. */
|
||||
result = phy_rtl8211f.ops->write(PHY_BASICCONTROL_REG, PHY_BCTL_RESET_MASK);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* The RGMII specifies output TXC/RXC and TXD/RXD without any clock skew. Need to add skew on clock line
|
||||
to make sure the other side sample right data. This can also be done in PCB traces. */
|
||||
result = phy_rtl8211f.ops->write(PHY_PAGE_SELECT_REG, PHY_PAGE_RGMII_TXRX_DELAY_ADDR);
|
||||
if (PHY_STATUS_OK != result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set Tx Delay */
|
||||
result = phy_rtl8211f.ops->read(PHY_RGMII_TX_DELAY_REG, ®Value);
|
||||
if (PHY_STATUS_OK == result)
|
||||
{
|
||||
regValue |= PHY_RGMII_TX_DELAY_MASK;
|
||||
result = phy_rtl8211f.ops->write(PHY_RGMII_TX_DELAY_REG, regValue);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set Rx Delay */
|
||||
result = phy_rtl8211f.ops->read(PHY_RGMII_RX_DELAY_REG, ®Value);
|
||||
if (PHY_STATUS_OK == result)
|
||||
{
|
||||
regValue |= PHY_RGMII_RX_DELAY_MASK;
|
||||
result = phy_rtl8211f.ops->write(PHY_RGMII_RX_DELAY_REG, regValue);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Restore to default page 0 */
|
||||
result = phy_rtl8211f.ops->write(PHY_PAGE_SELECT_REG, 0x0);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
// disabled EEE
|
||||
result = PHY_RTL8211F_MMD_Write(PHY_MDIO_MMD_AN, PHY_MDIO_AN_EEE_ADV, 0);
|
||||
if (result != PHY_STATUS_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Set the auto-negotiation. */
|
||||
result = phy_rtl8211f.ops->write(PHY_AUTONEG_ADVERTISE_REG,
|
||||
PHY_100BASETX_FULLDUPLEX_MASK | PHY_100BASETX_HALFDUPLEX_MASK | PHY_10BASETX_FULLDUPLEX_MASK |
|
||||
PHY_10BASETX_HALFDUPLEX_MASK | PHY_IEEE802_3_SELECTOR_MASK);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
result = phy_rtl8211f.ops->write(PHY_1000BASET_CONTROL_REG, PHY_1000BASET_FULLDUPLEX_MASK);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
result = phy_rtl8211f.ops->read(PHY_BASICCONTROL_REG, ®Value);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
result = phy_rtl8211f.ops->write(PHY_BASICCONTROL_REG, (regValue | PHY_BCTL_AUTONEG_MASK | PHY_BCTL_RESTART_AUTONEG_MASK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static rt_phy_status rt_phy_read(rt_uint32_t reg, rt_uint32_t *data)
|
||||
{
|
||||
rt_mdio_t *mdio_bus = phy_rtl8211f.bus;
|
||||
rt_uint32_t device_id = phy_rtl8211f.addr;
|
||||
|
||||
if (read_reg(mdio_bus, device_id, reg, data))
|
||||
{
|
||||
return PHY_STATUS_OK;
|
||||
}
|
||||
return PHY_STATUS_FAIL;
|
||||
}
|
||||
|
||||
static rt_phy_status rt_phy_write(rt_uint32_t reg, rt_uint32_t data)
|
||||
{
|
||||
rt_mdio_t *mdio_bus = phy_rtl8211f.bus;
|
||||
rt_uint32_t device_id = phy_rtl8211f.addr;
|
||||
|
||||
if (write_reg(mdio_bus, device_id, reg, data))
|
||||
{
|
||||
return PHY_STATUS_OK;
|
||||
}
|
||||
return PHY_STATUS_FAIL;
|
||||
}
|
||||
|
||||
static rt_phy_status rt_phy_loopback(rt_uint32_t mode, rt_uint32_t speed, rt_bool_t enable)
|
||||
{
|
||||
/* This PHY only supports local loopback. */
|
||||
// rt_assert(mode == PHY_LOCAL_LOOP);
|
||||
|
||||
status_t result;
|
||||
uint32_t regValue;
|
||||
|
||||
/* Set the loop mode. */
|
||||
if (enable)
|
||||
{
|
||||
if (speed == PHY_SPEED_1000M)
|
||||
{
|
||||
regValue = PHY_BCTL_SPEED1_MASK | PHY_BCTL_DUPLEX_MASK | PHY_BCTL_LOOP_MASK;
|
||||
}
|
||||
else if (speed == PHY_SPEED_100M)
|
||||
{
|
||||
regValue = PHY_BCTL_SPEED0_MASK | PHY_BCTL_DUPLEX_MASK | PHY_BCTL_LOOP_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
regValue = PHY_BCTL_DUPLEX_MASK | PHY_BCTL_LOOP_MASK;
|
||||
}
|
||||
result = phy_rtl8211f.ops->write(PHY_BASICCONTROL_REG, regValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First read the current status in control register. */
|
||||
result = phy_rtl8211f.ops->read(PHY_BASICCONTROL_REG, ®Value);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
regValue &= ~PHY_BCTL_LOOP_MASK;
|
||||
result = phy_rtl8211f.ops->write(PHY_BASICCONTROL_REG, (regValue | PHY_BCTL_RESTART_AUTONEG_MASK));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static rt_phy_status get_link_status(rt_bool_t *status)
|
||||
{
|
||||
// assert(status);
|
||||
|
||||
status_t result;
|
||||
uint32_t regValue;
|
||||
|
||||
/* Read the basic status register. */
|
||||
result = phy_rtl8211f.ops->read(PHY_SPECIFIC_STATUS_REG, ®Value);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
if ((PHY_SSTATUS_LINKSTATUS_MASK & regValue) != 0U)
|
||||
{
|
||||
/* Link up. */
|
||||
*status = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Link down. */
|
||||
*status = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static rt_phy_status get_link_speed_duplex(rt_uint32_t *speed, rt_uint32_t *duplex)
|
||||
{
|
||||
// assert(!((speed == NULL) && (duplex == NULL)));
|
||||
|
||||
status_t result;
|
||||
uint32_t regValue;
|
||||
|
||||
/* Read the status register. */
|
||||
result = phy_rtl8211f.ops->read(PHY_SPECIFIC_STATUS_REG, ®Value);
|
||||
if (result == PHY_STATUS_OK)
|
||||
{
|
||||
if (speed != NULL)
|
||||
{
|
||||
switch ((regValue & PHY_SSTATUS_LINKSPEED_MASK) >> PHY_SSTATUS_LINKSPEED_SHIFT)
|
||||
{
|
||||
case (uint32_t)PHY_SPEED_10M:
|
||||
*speed = PHY_SPEED_10M;
|
||||
break;
|
||||
case (uint32_t)PHY_SPEED_100M:
|
||||
*speed = PHY_SPEED_100M;
|
||||
break;
|
||||
case (uint32_t)PHY_SPEED_1000M:
|
||||
*speed = PHY_SPEED_1000M;
|
||||
break;
|
||||
default:
|
||||
*speed = PHY_SPEED_10M;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (duplex != NULL)
|
||||
{
|
||||
if ((regValue & PHY_SSTATUS_LINKDUPLEX_MASK) != 0U)
|
||||
{
|
||||
*duplex = PHY_FULL_DUPLEX;
|
||||
}
|
||||
else
|
||||
{
|
||||
*duplex = PHY_HALF_DUPLEX;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct rt_phy_ops phy_ops =
|
||||
{
|
||||
.init = rt_phy_init,
|
||||
.read = rt_phy_read,
|
||||
.write = rt_phy_write,
|
||||
.loopback = rt_phy_loopback,
|
||||
.get_link_status = get_link_status,
|
||||
.get_link_speed_duplex = get_link_speed_duplex,
|
||||
};
|
||||
|
||||
static int rt_phy_rtl8211f_register(void)
|
||||
{
|
||||
phy_rtl8211f.ops = &phy_ops;
|
||||
rt_hw_phy_register(&phy_rtl8211f, "rtl8211f");
|
||||
return 1;
|
||||
}
|
||||
|
||||
INIT_DEVICE_EXPORT(rt_phy_rtl8211f_register);
|
||||
#endif /* PHY_USING_RTL8211F */
|
|
@ -5,12 +5,12 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_IMXRT1052CVL5B
|
||||
bool
|
||||
bool
|
||||
select SOC_MIMXRT1050_SERIES
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
|
@ -12,7 +12,7 @@ menu "On-chip Peripheral Drivers"
|
|||
config BSP_USING_DMA
|
||||
bool "Enable DMA"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_GPIO
|
||||
bool "Enable GPIO"
|
||||
select RT_USING_PIN
|
||||
|
@ -22,7 +22,7 @@ menu "On-chip Peripheral Drivers"
|
|||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
|
||||
if BSP_USING_LPUART
|
||||
config BSP_USING_LPUART1
|
||||
bool "Enable LPUART1"
|
||||
|
|
|
@ -5,12 +5,12 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
# add for startup script
|
||||
# add for startup script
|
||||
if rtconfig.PLATFORM in ['gcc']:
|
||||
CPPDEFINES = ['__START=entry']
|
||||
else:
|
||||
CPPDEFINES = []
|
||||
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -15,9 +15,9 @@ if GetDepend('BSP_USING_4MFLASH'):
|
|||
else:
|
||||
LINKFLAGS = ''
|
||||
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
group = DefineGroup('xip', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
|
||||
Return('group')
|
||||
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
if GetDepend('BSP_USING_QSPIFLASH'):
|
||||
group = []
|
||||
Return('group')
|
||||
Return('group')
|
||||
|
|
Loading…
Reference in New Issue