bf0_hal_pinmux.h

Header file for pinmux.

Author

Sifli software development team

Attention

Defines

PIN_NOPULL

No Pull-up or Pull-down activation

PIN_PULLUP

Pull-up activation

PIN_PULLDOWN

Pull-down activation

HAL_PIN_SetXT32()

PIN_flags

PIN_SAVE_PINMUX_INSTANCE_SIZE
PIN_SAVE_PINMUX_EXT_INSTANCE_SIZE

Enums

enum PIN_ModeTypeDef

Values:

enumerator PIN_ANALOG_INPUT
enumerator PIN_DIGITAL_IO_NORMAL
enumerator PIN_DIGITAL_IO_PULLUP
enumerator PIN_DIGITAL_IO_PULLDOWN
enumerator PIN_DIGITAL_O_NORMAL
enumerator PIN_DIGITAL_O_PULLUP

Functions

void HAL_PIN_Select(int pad, int func, int hcpu)

Select pin function only.

参数:
  • pad – physical pin

  • func – Pin function.

  • hcpu – 1: pin for hcpu; 0: pin for lcpu

int HAL_PIN_Set(int pad, pin_function func, int flags, int hcpu)

Set pin function.

参数:
  • pad – physical pin, pin_pad_hcpu or pin_pad_lcpu

  • func – Pin function.

  • flags – flag of the pin (pullup/pulldown), PIN pull flag

  • hcpu – 1: pin for hcpu; 0: pin for lcpu

返回值:

-1 – if invalid, otherwise 0

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

  • hcpu – 1: pin for hcpu; 0: pin for lcpu

返回值:

-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

  • flags – Flags for the pin to update

  • mask – Mask of the flags

  • hcpu – 1: pin for hcpu; 0: pin for lcpu

返回值:

-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_hcpu and pin_pad_lcpu

  • 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

返回值:

-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 or pin_pad_lcpu

  • hcpu – 1: pin for hcpu; 0: pin for lcpu

  • 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 and pin_pad_lcpu

  • hcpu – 1: pin for hcpu; 0: pin for lcpu

  • set – 1: select, 0: deselect

返回值:

-1 – if invalid, otherwise 0

int HAL_PIN_SetMode(int pad, int hcpu, PIN_ModeTypeDef mode)
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_SetFlash3(void)

Set pinmux for flash3.

void HAL_PIN_SetFlash4(void)

Set pinmux for flash4.

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

Public Members

uint32_t pad_regs[(HPSYS_PAD_NUM)]
uint32_t ext_regs[(HPSYS_CFG_PINR_SIZE)]