/ * @brief * Configure and enable External Bus Interface * * @param[in] ebiInit * EBI configuration structure * * @note * GPIO lines must be configured as PUSH_PULL for correct operation * GPIO and EBI clocks must be enabled in the CMU ******************************************************************************/
| 58 | * GPIO and EBI clocks must be enabled in the CMU |
| 59 | ******************************************************************************/ |
| 60 | void EBI_Init(const EBI_Init_TypeDef *ebiInit) |
| 61 | { |
| 62 | uint32_t ctrl = EBI->CTRL; |
| 63 | |
| 64 | #if defined(_EFM32_GIANT_FAMILY) |
| 65 | /* Enable Independent Timing for devices that supports it */ |
| 66 | ctrl |= EBI_CTRL_ITS; |
| 67 | |
| 68 | /* Set polarity of address ready */ |
| 69 | EBI_BankPolaritySet(ebiInit->banks, ebiLineARDY, ebiInit->ardyPolarity); |
| 70 | /* Set polarity of address latch enable */ |
| 71 | EBI_BankPolaritySet(ebiInit->banks, ebiLineALE, ebiInit->alePolarity); |
| 72 | /* Set polarity of write enable */ |
| 73 | EBI_BankPolaritySet(ebiInit->banks, ebiLineWE, ebiInit->wePolarity); |
| 74 | /* Set polarity of read enable */ |
| 75 | EBI_BankPolaritySet(ebiInit->banks, ebiLineRE, ebiInit->rePolarity); |
| 76 | /* Set polarity of chip select lines */ |
| 77 | EBI_BankPolaritySet(ebiInit->banks, ebiLineCS, ebiInit->csPolarity); |
| 78 | /* Set polarity of byte lane line */ |
| 79 | EBI_BankPolaritySet(ebiInit->banks, ebiLineBL, ebiInit->blPolarity); |
| 80 | #else |
| 81 | /* Set polarity of address ready */ |
| 82 | EBI_PolaritySet(ebiLineARDY, ebiInit->ardyPolarity); |
| 83 | /* Set polarity of address latch enable */ |
| 84 | EBI_PolaritySet(ebiLineALE, ebiInit->alePolarity); |
| 85 | /* Set polarity of write enable */ |
| 86 | EBI_PolaritySet(ebiLineWE, ebiInit->wePolarity); |
| 87 | /* Set polarity of read enable */ |
| 88 | EBI_PolaritySet(ebiLineRE, ebiInit->rePolarity); |
| 89 | /* Set polarity of chip select lines */ |
| 90 | EBI_PolaritySet(ebiLineCS, ebiInit->csPolarity); |
| 91 | #endif |
| 92 | |
| 93 | /* Configure EBI mode and control settings */ |
| 94 | #if defined(_EFM32_GIANT_FAMILY) |
| 95 | if (ebiInit->banks & EBI_BANK0) |
| 96 | { |
| 97 | ctrl &= ~(_EBI_CTRL_MODE_MASK| |
| 98 | _EBI_CTRL_ARDYEN_MASK| |
| 99 | _EBI_CTRL_ARDYTODIS_MASK| |
| 100 | _EBI_CTRL_BL_MASK| |
| 101 | _EBI_CTRL_NOIDLE_MASK| |
| 102 | _EBI_CTRL_BANK0EN_MASK); |
| 103 | ctrl |= (ebiInit->mode << _EBI_CTRL_MODE_SHIFT); |
| 104 | ctrl |= (ebiInit->ardyEnable << _EBI_CTRL_ARDYEN_SHIFT); |
| 105 | ctrl |= (ebiInit->ardyDisableTimeout << _EBI_CTRL_ARDYTODIS_SHIFT); |
| 106 | ctrl |= (ebiInit->blEnable << _EBI_CTRL_BL_SHIFT); |
| 107 | ctrl |= (ebiInit->noIdle << _EBI_CTRL_NOIDLE_SHIFT); |
| 108 | if ( ebiInit->enable) |
| 109 | { |
| 110 | ctrl |= EBI_CTRL_BANK0EN; |
| 111 | } |
| 112 | } |
| 113 | if (ebiInit->banks & EBI_BANK1) |
| 114 | { |
| 115 | ctrl &= ~(_EBI_CTRL_BL1_MASK| |
| 116 | _EBI_CTRL_MODE1_MASK| |
| 117 | _EBI_CTRL_ARDY1EN_MASK| |
no test coverage detected