bf0_hal_pinmux.h
Defines
-
PIN_NOPULL
No Pull-up or Pull-down activation
-
PIN_PULLUP
Pull-up activation
-
PIN_PULLDOWN
Pull-down activation
-
HAL_PIN_SetXT32()
-
PIN_SAVE_PINMUX_INSTANCE_SIZE
-
PIN_SAVE_PINMUX_EXT_INSTANCE_SIZE
Enums
-
enum PIN_DrivingStrengthTypeDef
Pin output driving capability.
Level
DS0
DS1
Capability
0
0
0
2mA
1
0
1
4mA
2
1
0
8mA
3
1
1
12mA
备注
DS1 and DS0 form the 2-bit driving strength field, DS1 is the low bit and DS0 the high bit. The capability of each level is defined by the chip datasheet and the definitions below must be kept consistent with it.
Values:
-
enumerator PIN_DS_2MA
2mA, DS0 = 0, DS1 = 0
-
enumerator PIN_DS_4MA
4mA, DS0 = 0, DS1 = 1
-
enumerator PIN_DS_8MA
8mA, DS0 = 1, DS1 = 0
-
enumerator PIN_DS_12MA
12mA, DS0 = 1, DS1 = 1
-
enumerator PIN_DS_2MA
Functions
-
void HAL_PIN_Select(int pad, int func, int hcpu)
Select pin function only.
- 参数:
pad – physical pin, pin_pad
func – Pin function.
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
-
int HAL_PIN_Set(int pad, pin_function func, int flags, int hcpu)
Set pin function.
- 参数:
pad – physical pin, pin_pad
func – Pin function.
flags – flag of the pin (pullup/pulldown), PIN pull flag
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
- 返回值:
-1 – fail
0 – success
- 返回:
whether pin function set succeed
-
int HAL_PIN_Set_Analog(int pad, int hcpu)
Set pin for analog function, fix for ROM patch, avoid pin_const update.
- 参数:
pad – physical pin, pin_pad
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
- 返回值:
-1 – if invalid, otherwise 0
-
int HAL_PIN_Update(int pad, uint32_t flags, uint32_t mask, int hcpu)
Update pin flags.
- 参数:
pad – physical pin, pin_pad
flags – Flags for the pin to update
mask – Mask of the flags
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
- 返回值:
-1 – if invalid, otherwise 0
-
int HAL_PIN_Get(int pad, pin_function *p_func, PIN_ModeTypeDef *p_mode, int hcpu)
Get pin function.
- 参数:
pad – physical pin, refer pin_pad
p_func – Pointer of variable to save pin function.
p_mode – Pointer of varibale to save flag of the pin mode, see PIN_ModeTypeDef
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
- 返回值:
-1 – if invalid, else function idx(>= 0)
-
int HAL_PIN_Set_DS0(int pad, int hcpu, uint8_t set)
Set pin DS0.
- 参数:
pad – physical pin, pin_pad
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
set – 1: select, 0: deselect
- 返回值:
-1 – if invalid, otherwise 0
-
int HAL_PIN_Set_DS1(int pad, int hcpu, uint8_t set)
Set pin DS1.
- 参数:
pad – physical pin, refer pin_pad
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
set – 1: select, 0: deselect
- 返回值:
-1 – if invalid, otherwise 0
-
HAL_StatusTypeDef HAL_PIN_SetDS(int pad, PIN_DrivingStrengthTypeDef ds)
Set pin driving capability.
Wrapper of HAL_PIN_Set_DS0() and HAL_PIN_Set_DS1(), so that the four driving strength levels can be selected by name instead of by the raw DS0/DS1 bit pair. Prefer this over calling the two functions directly.
- 参数:
pad – physical pin, pin_pad
ds – driving capability, see PIN_DrivingStrengthTypeDef
- 返回值:
HAL_OK – if success, HAL_ERROR if pad is invalid
-
int HAL_PIN_SetMode(int pad, int hcpu, PIN_ModeTypeDef mode)
Set pin mode.
- 参数:
pad – physical pin, refer pin_pad
hcpu – 1: pin for hcpu; 0: pin for lcpu. It’s obsolete, not used anymore
- 返回值:
-1 – if invalid, otherwise 0
-
void HAL_PIN_Set_Dual_flash1(void)
Set pinmux of dual mode of flash1.
-
void HAL_PIN_Set_Single_flash2(void)
Set pinmux of single mode of flash2.
-
void HAL_PIN_Set_Dual_flash2(void)
Set pinmux of dual mode of flash2.
-
void HAL_PIN_Set_Dual_flash1_default(void)
Reset dual mode of flash1 to default configuration.
-
void HAL_PIN_Set_Single_flash2_default(void)
Reset single mode of flash2 to default configuration.
-
void HAL_PIN_Set_Dual_flash2_default(void)
Reset dual mode of flash2 to default configuration.
-
void HAL_PIN_SetSipFlash1(PIN_MpiPinmapMode pinmap_mode)
Set SiP MPI1 flash pinmux.
- 参数:
pinmap_mode – pinmap mode
-
void HAL_PIN_SetSipFlash2(PIN_MpiPinmapMode pinmap_mode)
Set SiP MPI2 flash pinmux.
- 参数:
pinmap_mode – pinmap mode
-
void HAL_PIN_SetSipFlash3(PIN_MpiPinmapMode pinmap_mode)
Set SiP MPI3 flash pinmux.
- 参数:
pinmap_mode – pinmap mode
-
void HAL_PIN_SetFlash3(void)
Set pinmux for flash3.
-
void HAL_PIN_SetFlash4(void)
Set pinmux for flash4.
-
void HAL_PIN_SetSipPsram1(PIN_MpiPinmapMode pinmap_mode)
Set SiP MPI1 psram pinmux.
- 参数:
pinmap_mode – pinmap mode
-
void HAL_PIN_SetSipPsram2(PIN_MpiPinmapMode pinmap_mode)
Set SiP MPI2 psram pinmux.
- 参数:
pinmap_mode – pinmap mode
-
void HAL_PIN_SetFlash1_WithMode(int mode)
Set pinmux for mpi1 with input mode.
- 参数:
mode – MPI1 pin mode, e.g. MPI1_PIN_HPSRAM for sf32lb58x
-
void HAL_PIN_SetFlash2_WithMode(int mode)
Set pinmux for mpi2 with input mode, for 58x, only HPSRAM and OPSRAM support.
- 参数:
mode – MPI2 pin mode, e.g. MPI2_PIN_HPSRAM for sf32lb58x
-
HAL_StatusTypeDef HAL_PIN_Backup(PIN_BackupBufTypeDef *buf)
Backup pinmux register.
- 参数:
buf – [in] buffer to save pinmux register value, it will be used by HAL_PIN_Restore to restore pinmux registe, the buffer should be in Retention RAM
- 返回:
status
-
HAL_StatusTypeDef HAL_PIN_Restore(PIN_BackupBufTypeDef *buf)
Restore pinmux register.
- 参数:
buf – [in] buffer which is used by HAL_PIN_Backup to save pinmux register value, the buffer should be in Retention RAM
- 返回:
status
-
struct PIN_BackupBufTypeDef