Accumulated patchsets for bsp/cvitek (#8968)
* bsp: cvitek: kconfig: add wdt for cv18xx_riscv Add Watchdog timer in Kconfig. Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * drv: cvitek: remove using macro from source file Building of source file should be controlled by SConscript, but not in source file itself. Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * bsp: cvitek: kconfig: add i2c for cv18xx_riscv Add I2C in Kconfig for c906B. Note, the IRQ# is different from that of c906L. Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * bsp: cvitek: kconfig: add rtc for cv18xx_riscv Add RTC in Kconfig for c906B. Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * bsp: cvitek: fix channel issue for pwm driver The original code confuses the concepts of controllers and channels. Fixed it and do some code cleanup. Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * bsp:cvitek: add i2c pinmux config for cv18xx_riscv Pinmux in driver code is controlled by SOC type, bcos driver code should be general and support all pins defined by SoC. Pinmux configuration in Kconfig is controlled by BOARD type, bcos when we operate on board, it does not expose all chip-level pin signals and we can only use part of them. Following is I2C signals exported by duo family. Details see https://milkv.io/docs/duo/overview. Note: we have not added support for duo-S. Duo === NAME I2C CV1800B/GPIO <PINNAME>__<FUNCNAME> ---- --- ------------ --------------------- GP0 I2C0_SCL XGPIOA[28] IIC0_SCL__IIC0_SCL GP1 I2C0_SDA XGPIOA[29] IIC0_SDA__IIC0_SDA GP4 I2C1_SCL PWR_GPIO[19] SD1_D2__IIC1_SCL GP9 I2C1_SCL PWR_GPIO[18] SD1_D3__IIC1_SCL GP11 I2C1_SCL XGPIOC[10] PAD_MIPIRX0N__IIC1_SCL GP5 I2C1_SDA PWR_GPIO[20] SD1_D1__IIC1_SDA GP8 I2C1_SDA PWR_GPIO[21] SD1_D0__IIC1_SDA GP10 I2C1_SDA XGPIOC[9] PAD_MIPIRX1P__IIC1_SDA GP7 I2C3_SCL PWR_GPIO[22] SD1_CMD__IIC3_SCL GP6 I2C3_SDA PWR_GPIO[23] SD1_CLK__IIC3_SDA Duo 256m ======== NAME I2C CV1800B/GPIO <PINNAME>__<FUNCNAME> ---- --- ------------ --------------------- GP4 I2C1_SCL PWR_GPIO[19] SD1_D2__IIC1_SCL GP9 I2C1_SCL PWR_GPIO[18] SD1_D3__IIC1_SCL GP5 I2C1_SDA PWR_GPIO[20] SD1_D1__IIC1_SDA GP8 I2C1_SDA PWR_GPIO[21] SD1_D0__IIC1_SDA GP11 I2C2_SCL XGPIOC[15] PAD_MIPI_TXP1__IIC2_SCL GP10 I2C2_SDA XGPIOC[14] PAD_MIPI_TXM1__IIC2_SDA GP7 I2C3_SCL PWR_GPIO[22] SD1_CMD__IIC3_SCL GP6 I2C3_SDA PWR_GPIO[23] SD1_CLK__IIC3_SDA Duo S ===== NAME I2C CV1800B/GPIO <PINNAME>__<FUNCNAME> ---- --- ------------ --------------------- J3-B18 I2C1_SCL XGPIOB[18] VIVO_D3__IIC1_SCL J3-B12 I2C1_SCL XGPIOB[12] VIVO_D9__IIC1_SCL J3-B11 I2C1_SDA XGPIOB[11] VIVO_D10__IIC1_SDA J3-B13 I2C2_SCL XGPIOB[13] VIVO_D8__IIC2_SCL J4-E1 I2C2_SCL PWR_GPIO[1] PWR_GPIO1__IIC2_SCL J3-B14 I2C2_SDA XGPIOB[14] VIVO_D7__IIC2_SDA J4-E2 I2C2_SDA PWR_GPIO[2] PWR_GPIO2__IIC2_SDA J3-B20 I2C4_SCL XGPIOB[20] VIVO_D1__IIC4_SCL J4-B1 I2C4_SCL XGPIOB[1] ADC3__IIC4_SCL J3-B21 I2C4_SDA XGPIOB[21] VIVO_D0__IIC4_SDA J4-B2 I2C4_SDA XGPIOB[2] ADC2__IIC4_SDA Signed-off-by: Chen Wang <unicorn_wang@outlook.com> Signed-off-by: flyingcys <flyingcys@163.com> * bsp:cvitek: remove using macro from source file for i2c Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * bsp:cvitek: unify menu message text for i2c as other drivers Other dirvers has no extra word "HW". Signed-off-by: Chen Wang <unicorn_wang@outlook.com> * bsp:cvitek: add i2c pinmux config for c906_little Porting what we have done in commit "bsp:cvitek: add i2c pinmux config for cv18xx_riscv" to c906_little. Signed-off-by: Chen Wang <unicorn_wang@outlook.com> --------- Signed-off-by: Chen Wang <unicorn_wang@outlook.com> Signed-off-by: flyingcys <flyingcys@163.com> Co-authored-by: flyingcys <flyingcys@163.com>
This commit is contained in:
parent
adf2b35ec6
commit
5dd3b7427a
|
@ -39,20 +39,32 @@ config TIMER_CLK_FREQ
|
||||||
int
|
int
|
||||||
default 25000000
|
default 25000000
|
||||||
|
|
||||||
|
config SOC_TYPE_CV180X
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
|
config SOC_TYPE_SG2002
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Board Type"
|
prompt "Board Type"
|
||||||
default BOARD_TYPE_MILKV_DUO256M
|
default BOARD_TYPE_MILKV_DUO256M
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO
|
config BOARD_TYPE_MILKV_DUO
|
||||||
|
select SOC_TYPE_CV180X
|
||||||
bool "milkv-duo"
|
bool "milkv-duo"
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO_SPINOR
|
config BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
select SOC_TYPE_CV180X
|
||||||
bool "milkv-duo-spinor"
|
bool "milkv-duo-spinor"
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO256M
|
config BOARD_TYPE_MILKV_DUO256M
|
||||||
|
select SOC_TYPE_SG2002
|
||||||
bool "milkv-duo256m"
|
bool "milkv-duo256m"
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO256M_SPINOR
|
config BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
select SOC_TYPE_SG2002
|
||||||
bool "milkv-duo256m-spinor"
|
bool "milkv-duo256m-spinor"
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
|
@ -20,7 +20,7 @@ menu "General Drivers Configuration"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C
|
menuconfig BSP_USING_I2C
|
||||||
bool "Using HW I2C"
|
bool "Using I2C"
|
||||||
select RT_USING_I2C
|
select RT_USING_I2C
|
||||||
select RT_USING_I2C_BITOPS
|
select RT_USING_I2C_BITOPS
|
||||||
select RT_USING_PIN
|
select RT_USING_PIN
|
||||||
|
@ -29,15 +29,130 @@ menu "General Drivers Configuration"
|
||||||
if BSP_USING_I2C
|
if BSP_USING_I2C
|
||||||
config BSP_USING_I2C0
|
config BSP_USING_I2C0
|
||||||
bool "Enable I2C0"
|
bool "Enable I2C0"
|
||||||
|
depends on BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C0
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
config BSP_USING_IIC0_SCL__IIC0_SCL
|
||||||
|
bool "IIC0_SCL/GP0"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
config BSP_USING_IIC0_SDA__IIC0_SDA
|
||||||
|
bool "IIC0_SDA/GP1"
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
config BSP_USING_I2C1
|
config BSP_USING_I2C1
|
||||||
bool "Enable I2C1"
|
bool "Enable I2C1"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C1
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_D2__IIC1_SCL
|
||||||
|
bool "SD1_D2/GP4"
|
||||||
|
config BSP_USING_SD1_D3__IIC1_SCL
|
||||||
|
bool "SD1_D3/GP9"
|
||||||
|
config BSP_USING_PAD_MIPIRX0N__IIC1_SCL
|
||||||
|
bool "PAD_MIPIRX0N/GP11"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_D2__IIC1_SCL
|
||||||
|
bool "SD1_D2/GP4"
|
||||||
|
config BSP_USING_SD1_D3__IIC1_SCL
|
||||||
|
bool "SD1_D3/GP9"
|
||||||
|
endif
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_D1__IIC1_SDA
|
||||||
|
bool "SD1_D1/GP5"
|
||||||
|
config BSP_USING_SD1_D0__IIC1_SDA
|
||||||
|
bool "SD1_D0/GP8"
|
||||||
|
config BSP_USING_PAD_MIPIRX1P__IIC1_SDA
|
||||||
|
bool "PAD_MIPIRX1P/GP10"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_D1__IIC1_SDA
|
||||||
|
bool "SD1_D1/GP5"
|
||||||
|
config BSP_USING_SD1_D0__IIC1_SDA
|
||||||
|
bool "SD1_D0/GP8"
|
||||||
|
endif
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_I2C2
|
||||||
|
bool "Enable I2C2"
|
||||||
|
depends on BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C2
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
config BSP_USING_PAD_MIPI_TXP1__IIC2_SCL
|
||||||
|
bool "PAD_MIPI_TXP1/GP11"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
config BSP_USING_PAD_MIPI_TXM1__IIC2_SDA
|
||||||
|
bool "PAD_MIPI_TXM1/GP10"
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_I2C3
|
||||||
|
bool "Enable I2C3"
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C3
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_CMD__IIC3_SCL
|
||||||
|
bool "SD1_CMD/GP7"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_CMD__IIC3_SCL
|
||||||
|
bool "SD1_CMD/GP7"
|
||||||
|
endif
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_CLK__IIC3_SDA
|
||||||
|
bool "SD1_CLK/GP6"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_CLK__IIC3_SDA
|
||||||
|
bool "SD1_CLK/GP6"
|
||||||
|
endif
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
config I2C_IRQ_BASE
|
config I2C_IRQ_BASE
|
||||||
int
|
int
|
||||||
default 32
|
default 32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config BSP_USING_ADC
|
config BSP_USING_ADC
|
||||||
|
|
|
@ -46,20 +46,32 @@ config __STACKSIZE__
|
||||||
int "stack size for interrupt"
|
int "stack size for interrupt"
|
||||||
default 4096
|
default 4096
|
||||||
|
|
||||||
|
config SOC_TYPE_CV180X
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
|
config SOC_TYPE_SG2002
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Board Type"
|
prompt "Board Type"
|
||||||
default BOARD_TYPE_MILKV_DUO256M
|
default BOARD_TYPE_MILKV_DUO256M
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO
|
config BOARD_TYPE_MILKV_DUO
|
||||||
|
select SOC_TYPE_CV180X
|
||||||
bool "milkv-duo"
|
bool "milkv-duo"
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO_SPINOR
|
config BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
select SOC_TYPE_CV180X
|
||||||
bool "milkv-duo-spinor"
|
bool "milkv-duo-spinor"
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO256M
|
config BOARD_TYPE_MILKV_DUO256M
|
||||||
|
select SOC_TYPE_SG2002
|
||||||
bool "milkv-duo256m"
|
bool "milkv-duo256m"
|
||||||
|
|
||||||
config BOARD_TYPE_MILKV_DUO256M_SPINOR
|
config BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
select SOC_TYPE_SG2002
|
||||||
bool "milkv-duo256m-spinor"
|
bool "milkv-duo256m-spinor"
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
|
@ -31,7 +31,143 @@ menu "General Drivers Configuration"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
menuconfig BSP_USING_I2C
|
||||||
|
bool "Using I2C"
|
||||||
|
select RT_USING_I2C
|
||||||
|
select RT_USING_I2C_BITOPS
|
||||||
|
select RT_USING_PIN
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C
|
||||||
|
config BSP_USING_I2C0
|
||||||
|
bool "Enable I2C0"
|
||||||
|
depends on BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C0
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
config BSP_USING_IIC0_SCL__IIC0_SCL
|
||||||
|
bool "IIC0_SCL/GP0"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
config BSP_USING_IIC0_SDA__IIC0_SDA
|
||||||
|
bool "IIC0_SDA/GP1"
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_I2C1
|
||||||
|
bool "Enable I2C1"
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C1
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_D2__IIC1_SCL
|
||||||
|
bool "SD1_D2/GP4"
|
||||||
|
config BSP_USING_SD1_D3__IIC1_SCL
|
||||||
|
bool "SD1_D3/GP9"
|
||||||
|
config BSP_USING_PAD_MIPIRX0N__IIC1_SCL
|
||||||
|
bool "PAD_MIPIRX0N/GP11"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_D2__IIC1_SCL
|
||||||
|
bool "SD1_D2/GP4"
|
||||||
|
config BSP_USING_SD1_D3__IIC1_SCL
|
||||||
|
bool "SD1_D3/GP9"
|
||||||
|
endif
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_D1__IIC1_SDA
|
||||||
|
bool "SD1_D1/GP5"
|
||||||
|
config BSP_USING_SD1_D0__IIC1_SDA
|
||||||
|
bool "SD1_D0/GP8"
|
||||||
|
config BSP_USING_PAD_MIPIRX1P__IIC1_SDA
|
||||||
|
bool "PAD_MIPIRX1P/GP10"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_D1__IIC1_SDA
|
||||||
|
bool "SD1_D1/GP5"
|
||||||
|
config BSP_USING_SD1_D0__IIC1_SDA
|
||||||
|
bool "SD1_D0/GP8"
|
||||||
|
endif
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_I2C2
|
||||||
|
bool "Enable I2C2"
|
||||||
|
depends on BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C2
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
config BSP_USING_PAD_MIPI_TXP1__IIC2_SCL
|
||||||
|
bool "PAD_MIPI_TXP1/GP11"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
config BSP_USING_PAD_MIPI_TXM1__IIC2_SDA
|
||||||
|
bool "PAD_MIPI_TXM1/GP10"
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_I2C3
|
||||||
|
bool "Enable I2C3"
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_I2C3
|
||||||
|
choice
|
||||||
|
prompt "SCL"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_CMD__IIC3_SCL
|
||||||
|
bool "SD1_CMD/GP7"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_CMD__IIC3_SCL
|
||||||
|
bool "SD1_CMD/GP7"
|
||||||
|
endif
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "SDA"
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO || BOARD_TYPE_MILKV_DUO_SPINOR
|
||||||
|
config BSP_USING_SD1_CLK__IIC3_SDA
|
||||||
|
bool "SD1_CLK/GP6"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BOARD_TYPE_MILKV_DUO256M || BOARD_TYPE_MILKV_DUO256M_SPINOR
|
||||||
|
config BSP_USING_SD1_CLK__IIC3_SDA
|
||||||
|
bool "SD1_CLK/GP6"
|
||||||
|
endif
|
||||||
|
endchoice
|
||||||
|
endif
|
||||||
|
|
||||||
|
config I2C_IRQ_BASE
|
||||||
|
int
|
||||||
|
default 49
|
||||||
|
endif
|
||||||
|
|
||||||
config BSP_USING_ADC
|
config BSP_USING_ADC
|
||||||
bool "Using ADC"
|
bool "Using ADC"
|
||||||
select RT_USING_ADC
|
select RT_USING_ADC
|
||||||
|
@ -42,6 +178,25 @@ menu "General Drivers Configuration"
|
||||||
select RT_USING_SPI
|
select RT_USING_SPI
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
menuconfig BSP_USING_WDT
|
||||||
|
bool "Enable Watchdog Timer"
|
||||||
|
select RT_USING_WDT
|
||||||
|
default n
|
||||||
|
|
||||||
|
if BSP_USING_WDT
|
||||||
|
config BSP_USING_WDT0
|
||||||
|
bool "Enable WDT0"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_WDT1
|
||||||
|
bool "Enable WDT1"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_WDT2
|
||||||
|
bool "Enable WDT2"
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_PWM
|
menuconfig BSP_USING_PWM
|
||||||
bool "Using PWM"
|
bool "Using PWM"
|
||||||
select RT_USING_PWM
|
select RT_USING_PWM
|
||||||
|
@ -63,9 +218,13 @@ menu "General Drivers Configuration"
|
||||||
config BSP_USING_PWM3
|
config BSP_USING_PWM3
|
||||||
bool "Enable PWM 3"
|
bool "Enable PWM 3"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_RTC
|
||||||
|
bool "Enable RTC"
|
||||||
|
select RT_USING_RTC
|
||||||
|
default n
|
||||||
|
|
||||||
config BSP_USING_SDH
|
config BSP_USING_SDH
|
||||||
select RT_USING_SDIO
|
select RT_USING_SDIO
|
||||||
select RT_USING_DFS
|
select RT_USING_DFS
|
||||||
|
@ -80,4 +239,5 @@ menu "General Drivers Configuration"
|
||||||
select RT_USING_LWIP
|
select RT_USING_LWIP
|
||||||
select RT_USING_POSIX_FS
|
select RT_USING_POSIX_FS
|
||||||
select RT_USING_POSIX_SOCKET
|
select RT_USING_POSIX_SOCKET
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include "drv_adc.h"
|
#include "drv_adc.h"
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC
|
|
||||||
|
|
||||||
#define DBG_LEVEL DBG_LOG
|
#define DBG_LEVEL DBG_LOG
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
#define LOG_TAG "DRV.ADC"
|
#define LOG_TAG "DRV.ADC"
|
||||||
|
@ -117,5 +115,3 @@ int rt_hw_adc_init(void)
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_adc_init);
|
INIT_BOARD_EXPORT(rt_hw_adc_init);
|
||||||
|
|
||||||
#endif /* BSP_USING_ADC */
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
|
|
||||||
#ifdef RT_USING_I2C
|
|
||||||
|
|
||||||
#define DBG_TAG "drv.i2c"
|
#define DBG_TAG "drv.i2c"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
@ -469,18 +467,327 @@ static const struct rt_i2c_bus_device_ops i2c_ops =
|
||||||
.i2c_bus_control = RT_NULL
|
.i2c_bus_control = RT_NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void rt_hw_i2c_pinmux_config_i2c0()
|
||||||
|
{
|
||||||
|
#ifdef BSP_USING_I2C0
|
||||||
|
|
||||||
|
// SCL
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_IIC0_SCL__IIC0_SCL)
|
||||||
|
PINMUX_CONFIG(IIC0_SCL, IIC0_SCL);
|
||||||
|
#elif defined(BSP_USING_PWR_GPIO2__IIC0_SCL)
|
||||||
|
PINMUX_CONFIG(PWR_GPIO2, IIC0_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX4N__IIC0_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX4N, IIC0_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP2__IIC0_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP2, IIC0_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_IIC0_SCL__IIC0_SCL)
|
||||||
|
PINMUX_CONFIG(IIC0_SCL, IIC0_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
// SDA
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_IIC0_SDA__IIC0_SDA)
|
||||||
|
PINMUX_CONFIG(IIC0_SDA, IIC0_SDA);
|
||||||
|
#elif defined(BSP_USING_PWR_GPIO1__IIC0_SDA)
|
||||||
|
PINMUX_CONFIG(PWR_GPIO1, IIC0_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX4P__IIC0_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX4P, IIC0_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM2__IIC0_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM2, IIC0_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_IIC0_SDA__IIC0_SDA)
|
||||||
|
PINMUX_CONFIG(IIC0_SDA, IIC0_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
#endif /* BSP_USING_I2C0 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rt_hw_i2c_pinmux_config_i2c1()
|
||||||
|
{
|
||||||
|
#ifdef BSP_USING_I2C1
|
||||||
|
|
||||||
|
// SCL
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_SD0_CMD__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD0_CMD, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_SD0_D2__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD0_D2, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_SD1_D3__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD1_D3, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_SD1_D2__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD1_D2, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_MUX_SPI1_MOSI__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(MUX_SPI1_MOSI, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_ETH_TXP__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_ETH_TXP, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX4P__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX4P, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX0N__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP2__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP2, IIC1_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_SD0_CMD__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD0_CMD, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_SD0_D2__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD0_D2, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_SD1_D3__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD1_D3, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_SD1_D2__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(SD1_D2, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_MUX_SPI1_MOSI__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(MUX_SPI1_MOSI, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_ETH_TXP__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_ETH_TXP, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_VIVO_D9__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(VIVO_D9, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_VIVO_D3__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(VIVO_D3, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX4P__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX4P, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX0N__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP4__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP4, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP3__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP3, IIC1_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP2__IIC1_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP2, IIC1_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
// SDA
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_SD0_CLK__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD0_CLK, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_SD0_D1__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD0_D1, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_SD1_D1__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD1_D1, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_SD1_D0__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD1_D0, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_MUX_SPI1_MISO__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(MUX_SPI1_MISO, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_ETH_TXM__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_ETH_TXM, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX4N__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX4N, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX1P__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM2__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM2, IIC1_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_SD0_CLK__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD0_CLK, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_SD0_D1__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD0_D1, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_SD1_D1__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD1_D1, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_SD1_D0__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(SD1_D0, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_MUX_SPI1_MISO__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(MUX_SPI1_MISO, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_ETH_TXM__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_ETH_TXM, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_VIVO_D10__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(VIVO_D10, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_VIVO_D4__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(VIVO_D4, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX4N__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX4N, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX1P__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM4__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM4, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM3__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM3, IIC1_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM2__IIC1_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM2, IIC1_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
#endif /* BSP_USING_I2C1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rt_hw_i2c_pinmux_config_i2c2()
|
||||||
|
{
|
||||||
|
#ifdef BSP_USING_I2C2
|
||||||
|
|
||||||
|
// SCL
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_PWR_GPIO1__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(PWR_GPIO1, IIC2_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP1__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP1, IIC2_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_PWR_GPIO1__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(PWR_GPIO1, IIC2_SCL);
|
||||||
|
#elif defined(BSP_USING_IIC2_SCL__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(IIC2_SCL, IIC2_SCL);
|
||||||
|
#elif defined(BSP_USING_VIVO_D8__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(VIVO_D8, IIC2_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP3__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP3, IIC2_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXP1__IIC2_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXP1, IIC2_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
// SDA
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_PWR_GPIO2__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(PWR_GPIO2, IIC2_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM1__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM1, IIC2_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_PWR_GPIO2__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(PWR_GPIO2, IIC2_SDA);
|
||||||
|
#elif defined(BSP_USING_IIC2_SDA__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(IIC2_SDA, IIC2_SDA);
|
||||||
|
#elif defined(BSP_USING_VIVO_D7__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(VIVO_D7, IIC2_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM3__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM3, IIC2_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPI_TXM1__IIC2_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPI_TXM1, IIC2_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
#endif /* BSP_USING_I2C2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rt_hw_i2c_pinmux_config_i2c3()
|
||||||
|
{
|
||||||
|
#ifdef BSP_USING_I2C3
|
||||||
|
|
||||||
|
// SCL
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_SD1_CMD__IIC3_SCL)
|
||||||
|
PINMUX_CONFIG(SD1_CMD, IIC3_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_IIC3_SCL__IIC3_SCL)
|
||||||
|
PINMUX_CONFIG(IIC3_SCL, IIC3_SCL);
|
||||||
|
#elif defined(BSP_USING_SD1_CMD__IIC3_SCL)
|
||||||
|
PINMUX_CONFIG(SD1_CMD, IIC3_SCL);
|
||||||
|
#elif defined(BSP_USING_VIVO_D0__IIC3_SCL)
|
||||||
|
PINMUX_CONFIG(VIVO_D0, IIC3_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
// SDA
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_SD1_CLK__IIC3_SDA)
|
||||||
|
PINMUX_CONFIG(SD1_CLK, IIC3_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_IIC3_SDA__IIC3_SDA)
|
||||||
|
PINMUX_CONFIG(IIC3_SDA, IIC3_SDA);
|
||||||
|
#elif defined(BSP_USING_SD1_CLK__IIC3_SDA)
|
||||||
|
PINMUX_CONFIG(SD1_CLK, IIC3_SDA);
|
||||||
|
#elif defined(BSP_USING_VIVO_D1__IIC3_SDA)
|
||||||
|
PINMUX_CONFIG(VIVO_D1, IIC3_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
#endif /* BSP_USING_I2C3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rt_hw_i2c_pinmux_config_i2c4()
|
||||||
|
{
|
||||||
|
#ifdef BSP_USING_I2C4
|
||||||
|
|
||||||
|
// SCL
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_PWR_WAKEUP0__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(PWR_WAKEUP0, IIC4_SCL);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX2N__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX2N, IIC4_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_CAM_RST0__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(CAM_RST0, IIC4_SCL);
|
||||||
|
#elif defined(BSP_USING_PWR_WAKEUP0__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(PWR_WAKEUP0, IIC4_SCL);
|
||||||
|
#elif defined(BSP_USING_PWR_WAKEUP1__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(PWR_WAKEUP1, IIC4_SCL);
|
||||||
|
#elif defined(BSP_USING_ADC3__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(ADC3, IIC4_SCL);
|
||||||
|
#elif defined(BSP_USING_VIVO_D1__IIC4_SCL)
|
||||||
|
PINMUX_CONFIG(VIVO_D1, IIC4_SCL);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
// SDA
|
||||||
|
#if defined(SOC_TYPE_CV180X)
|
||||||
|
#if defined(BSP_USING_PWR_BUTTON1__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(PWR_BUTTON1, IIC4_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX2P__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX2P, IIC4_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_CV180X
|
||||||
|
|
||||||
|
#if defined(SOC_TYPE_SG2002)
|
||||||
|
#if defined(BSP_USING_CAM_PD1__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(CAM_PD1, IIC4_SDA);
|
||||||
|
#elif defined(BSP_USING_PWR_BUTTON1__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(PWR_BUTTON1, IIC4_SDA);
|
||||||
|
#elif defined(BSP_USING_PWR_ON__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(PWR_ON, IIC4_SDA);
|
||||||
|
#elif defined(BSP_USING_ADC2__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(ADC2, IIC4_SDA);
|
||||||
|
#elif defined(BSP_USING_VIVO_D0__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(VIVO_D0, IIC4_SDA);
|
||||||
|
#elif defined(BSP_USING_PAD_MIPIRX2P__IIC4_SDA)
|
||||||
|
PINMUX_CONFIG(PAD_MIPIRX2P, IIC4_SDA);
|
||||||
|
#endif
|
||||||
|
#endif // SOC_TYPE_SG2002
|
||||||
|
|
||||||
|
#endif /* BSP_USING_I2C4 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rt_hw_i2c_pinmux_config()
|
||||||
|
{
|
||||||
|
rt_hw_i2c_pinmux_config_i2c0();
|
||||||
|
rt_hw_i2c_pinmux_config_i2c1();
|
||||||
|
rt_hw_i2c_pinmux_config_i2c2();
|
||||||
|
rt_hw_i2c_pinmux_config_i2c3();
|
||||||
|
rt_hw_i2c_pinmux_config_i2c4();
|
||||||
|
}
|
||||||
|
|
||||||
int rt_hw_i2c_init(void)
|
int rt_hw_i2c_init(void)
|
||||||
{
|
{
|
||||||
int result = RT_EOK;
|
int result = RT_EOK;
|
||||||
|
|
||||||
#ifdef BSP_USING_I2C0
|
rt_hw_i2c_pinmux_config();
|
||||||
PINMUX_CONFIG(IIC0_SCL, IIC0_SCL);
|
|
||||||
PINMUX_CONFIG(IIC0_SDA, IIC0_SDA);
|
|
||||||
#endif /* BSP_USING_I2C0 */
|
|
||||||
#ifdef BSP_USING_I2C1
|
|
||||||
PINMUX_CONFIG(PAD_MIPIRX1P, IIC1_SDA);
|
|
||||||
PINMUX_CONFIG(PAD_MIPIRX0N, IIC1_SCL);
|
|
||||||
#endif /* BSP_USING_I2C1 */
|
|
||||||
|
|
||||||
for (rt_size_t i = 0; i < sizeof(_i2c_obj) / sizeof(struct _i2c_bus); i++)
|
for (rt_size_t i = 0; i < sizeof(_i2c_obj) / sizeof(struct _i2c_bus); i++)
|
||||||
{
|
{
|
||||||
|
@ -507,5 +814,3 @@ int rt_hw_i2c_init(void)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_i2c_init);
|
INIT_BOARD_EXPORT(rt_hw_i2c_init);
|
||||||
|
|
||||||
#endif /* RT_USING_I2C */
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include "drv_pwm.h"
|
#include "drv_pwm.h"
|
||||||
|
|
||||||
#ifdef BSP_USING_PWM
|
|
||||||
|
|
||||||
#define DBG_LEVEL DBG_LOG
|
#define DBG_LEVEL DBG_LOG
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
#define LOG_TAG "DRV.PWM"
|
#define LOG_TAG "DRV.PWM"
|
||||||
|
@ -52,6 +50,7 @@ static void cvi_pwm_get_config(rt_ubase_t reg_base, struct rt_pwm_configuration
|
||||||
period_clk = cvi_pwm_get_period_ch(reg_base, (cfg->channel & PWM_MAX_CH));
|
period_clk = cvi_pwm_get_period_ch(reg_base, (cfg->channel & PWM_MAX_CH));
|
||||||
cfg->period = period_clk * NSEC_COUNT / count_unit;
|
cfg->period = period_clk * NSEC_COUNT / count_unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_err_t _pwm_control(struct rt_device_pwm *device, int cmd, void *arg)
|
static rt_err_t _pwm_control(struct rt_device_pwm *device, int cmd, void *arg)
|
||||||
{
|
{
|
||||||
struct rt_pwm_configuration *cfg = (struct rt_pwm_configuration *)arg;
|
struct rt_pwm_configuration *cfg = (struct rt_pwm_configuration *)arg;
|
||||||
|
@ -60,7 +59,7 @@ static rt_err_t _pwm_control(struct rt_device_pwm *device, int cmd, void *arg)
|
||||||
const uint64_t count_unit = 100000000; // 100M count per second
|
const uint64_t count_unit = 100000000; // 100M count per second
|
||||||
const uint64_t NSEC_COUNT = 1000000000; // ns
|
const uint64_t NSEC_COUNT = 1000000000; // ns
|
||||||
|
|
||||||
if (cfg->channel > PWM_MAX_CH)
|
if (cfg->channel >= PWM_CHANNEL_NUM)
|
||||||
return -RT_EINVAL;
|
return -RT_EINVAL;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
|
@ -150,63 +149,5 @@ int rt_hw_pwm_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
#if 0
|
|
||||||
#ifdef BSP_USING_PWM0
|
|
||||||
static struct cvi_pwm_dev cvi_pwm0;
|
|
||||||
|
|
||||||
cvi_pwm0.name = "pwm0";
|
|
||||||
cvi_pwm0.reg_base = CVI_PWM0_BASE;
|
|
||||||
|
|
||||||
result = rt_device_pwm_register(&cvi_pwm0.device, cvi_pwm0.name, &cvi_pwm_ops, &cvi_pwm0);
|
|
||||||
if (result != RT_EOK)
|
|
||||||
{
|
|
||||||
LOG_E("device %s register failed.", cvi_pwm0.name);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BSP_USING_PWM1
|
|
||||||
static struct cvi_pwm_dev cvi_pwm1;
|
|
||||||
cvi_pwm1.name = "pwm1";
|
|
||||||
cvi_pwm1.reg_base = CVI_PWM1_BASE;
|
|
||||||
|
|
||||||
result = rt_device_pwm_register(&cvi_pwm1.device, cvi_pwm1.name, &cvi_pwm_ops, &cvi_pwm1);
|
|
||||||
if (result != RT_EOK)
|
|
||||||
{
|
|
||||||
LOG_E("device %s register failed.", cvi_pwm1.name);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BSP_USING_PWM2
|
|
||||||
static struct cvi_pwm_dev cvi_pwm2;
|
|
||||||
cvi_pwm2.name = "pwm2";
|
|
||||||
cvi_pwm2.reg_base = CVI_PWM2_BASE;
|
|
||||||
|
|
||||||
result = rt_device_pwm_register(&cvi_pwm2.device, cvi_pwm2.name, &cvi_pwm_ops, &cvi_pwm2);
|
|
||||||
if (result != RT_EOK)
|
|
||||||
{
|
|
||||||
LOG_E("device %s register failed.", cvi_pwm2.name);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BSP_USING_PWM3
|
|
||||||
static struct cvi_pwm_dev cvi_pwm3;
|
|
||||||
cvi_pwm3.name = "pwm3";
|
|
||||||
cvi_pwm3.reg_base = CVI_PWM3_BASE;
|
|
||||||
|
|
||||||
result = rt_device_pwm_register(&cvi_pwm3.device, cvi_pwm3.name, &cvi_pwm_ops, &cvi_pwm3);
|
|
||||||
if (result != RT_EOK)
|
|
||||||
{
|
|
||||||
LOG_E("device %s register failed.", cvi_pwm3.name);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return RT_EOK;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_pwm_init);
|
INIT_BOARD_EXPORT(rt_hw_pwm_init);
|
||||||
|
|
||||||
#endif /* BSP_USING_PWM */
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
|
|
||||||
#ifdef BSP_USING_RTC
|
|
||||||
|
|
||||||
#define DBG_TAG "DRV.RTC"
|
#define DBG_TAG "DRV.RTC"
|
||||||
#define DBG_LVL DBG_WARNING
|
#define DBG_LVL DBG_WARNING
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
@ -405,5 +403,3 @@ static int rt_hw_rtc_init(void)
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
INIT_DEVICE_EXPORT(rt_hw_rtc_init);
|
INIT_DEVICE_EXPORT(rt_hw_rtc_init);
|
||||||
|
|
||||||
#endif /* BSP_USING_RTC */
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "drv_spi.h"
|
#include "drv_spi.h"
|
||||||
#ifdef RT_USING_SPI
|
|
||||||
|
|
||||||
#define DBG_TAG "drv.spi"
|
#define DBG_TAG "drv.spi"
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
|
@ -231,5 +230,3 @@ int rt_hw_spi_init(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_spi_init);
|
INIT_BOARD_EXPORT(rt_hw_spi_init);
|
||||||
|
|
||||||
#endif /* RT_USING_SPI */
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include "drv_wdt.h"
|
#include "drv_wdt.h"
|
||||||
|
|
||||||
#ifdef BSP_USING_WDT
|
|
||||||
|
|
||||||
#define DBG_LEVEL DBG_LOG
|
#define DBG_LEVEL DBG_LOG
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
#define LOG_TAG "DRV.WDT"
|
#define LOG_TAG "DRV.WDT"
|
||||||
|
@ -161,5 +159,3 @@ int rt_hw_wdt_init(void)
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_wdt_init);
|
INIT_BOARD_EXPORT(rt_hw_wdt_init);
|
||||||
|
|
||||||
#endif /* BSP_USING_WDT */
|
|
||||||
|
|
Loading…
Reference in New Issue