MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / EBI_BankPolaritySet

Function EBI_BankPolaritySet

bsp/efm32/Libraries/emlib/src/em_ebi.c:1035–1115  ·  view source on GitHub ↗

/ * @brief * Configure EBI pin polarity for selected bank(s) for devices with individual * timing support * * @param[in] banks * Mask of memory bank(s) to configure polarity for * * @param[in] line * Which pin/line to configure * * @param[in] polarity * Active high, or active low ******************************************************************************/

Source from the content-addressed store, hash-verified

1033 * Active high, or active low
1034 ******************************************************************************/
1035void EBI_BankPolaritySet(uint32_t banks, EBI_Line_TypeDef line, EBI_Polarity_TypeDef polarity)
1036{
1037 uint32_t bankSet = 0;
1038 volatile uint32_t *polRegister = 0;
1039
1040 /* Verify only valid banks are used */
1041 EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3)) == 0);
1042
1043 while (banks)
1044 {
1045#if defined(_EFM32_GIANT_FAMILY)
1046 if (banks & EBI_BANK0)
1047 {
1048 polRegister = &EBI->POLARITY;
1049 bankSet = EBI_BANK0;
1050 }
1051 if (banks & EBI_BANK1)
1052 {
1053 polRegister = &EBI->POLARITY1;
1054 bankSet = EBI_BANK1;
1055 }
1056 if (banks & EBI_BANK2)
1057 {
1058 polRegister = &EBI->POLARITY2;
1059 bankSet = EBI_BANK2;
1060 }
1061 if (banks & EBI_BANK3)
1062 {
1063 polRegister = &EBI->POLARITY3;
1064 bankSet = EBI_BANK3;
1065 }
1066#else
1067 polRegister = &EBI->POLARITY;
1068 banks = 0;
1069#endif
1070
1071 /* What line to configure */
1072 switch (line)
1073 {
1074 case ebiLineARDY:
1075 BITBAND_Peripheral(polRegister, _EBI_POLARITY_ARDYPOL_SHIFT, polarity);
1076 break;
1077 case ebiLineALE:
1078 BITBAND_Peripheral(polRegister, _EBI_POLARITY_ALEPOL_SHIFT, polarity);
1079 break;
1080 case ebiLineWE:
1081 BITBAND_Peripheral(polRegister, _EBI_POLARITY_WEPOL_SHIFT, polarity);
1082 break;
1083 case ebiLineRE:
1084 BITBAND_Peripheral(polRegister, _EBI_POLARITY_REPOL_SHIFT, polarity);
1085 break;
1086 case ebiLineCS:
1087 BITBAND_Peripheral(polRegister, _EBI_POLARITY_CSPOL_SHIFT, polarity);
1088 break;
1089#if defined(_EFM32_GIANT_FAMILY)
1090 case ebiLineBL:
1091 BITBAND_Peripheral(polRegister, _EBI_POLARITY_BLPOL_SHIFT, polarity);
1092 break;

Callers 1

EBI_InitFunction · 0.85

Calls 1

BITBAND_PeripheralFunction · 0.85

Tested by

no test coverage detected