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

Function EBI_BankReadTimingSet

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

/ * @brief * Configure timing values of read bus accesses * * @param[in] banks * Mask of memory bank(s) to configure timing for * * @param[in] setupCycles * Number of clock cycles for address setup before REn is asserted * * @param[in] strobeCycles * The number of cycles the REn is held active. After the specified number of * cycles, data is read. If set to 0, 1 cycle is inser

Source from the content-addressed store, hash-verified

775 * The number of cycles CSn is held active after the REn is dessarted
776 ******************************************************************************/
777void EBI_BankReadTimingSet(uint32_t banks, int setupCycles, int strobeCycles, int holdCycles)
778{
779 uint32_t readTiming;
780
781 /* Verify only valid banks are used */
782 EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3)) == 0);
783
784 /* Check that timings are within limits */
785 EFM_ASSERT(setupCycles < 4);
786 EFM_ASSERT(strobeCycles < 64);
787 EFM_ASSERT(holdCycles < 4);
788
789 /* Configure timing values */
790 readTiming = (setupCycles << _EBI_RDTIMING_RDSETUP_SHIFT) |
791 (strobeCycles << _EBI_RDTIMING_RDSTRB_SHIFT) |
792 (holdCycles << _EBI_RDTIMING_RDHOLD_SHIFT);
793
794 if (banks & EBI_BANK0)
795 {
796 EBI->RDTIMING = (EBI->RDTIMING &
797 ~(_EBI_RDTIMING_RDSETUP_MASK |
798 _EBI_RDTIMING_RDSTRB_MASK |
799 _EBI_RDTIMING_RDHOLD_MASK)) | readTiming;
800 }
801 if (banks & EBI_BANK1)
802 {
803 EBI->RDTIMING1 = (EBI->RDTIMING1 &
804 ~(_EBI_RDTIMING1_RDSETUP_MASK |
805 _EBI_RDTIMING1_RDSTRB_MASK |
806 _EBI_RDTIMING1_RDHOLD_MASK)) | readTiming;
807 }
808 if (banks & EBI_BANK2)
809 {
810 EBI->RDTIMING2 = (EBI->RDTIMING2 &
811 ~(_EBI_RDTIMING2_RDSETUP_MASK |
812 _EBI_RDTIMING2_RDSTRB_MASK |
813 _EBI_RDTIMING2_RDHOLD_MASK)) | readTiming;
814 }
815 if (banks & EBI_BANK3)
816 {
817 EBI->RDTIMING3 = (EBI->RDTIMING3 &
818 ~(_EBI_RDTIMING3_RDSETUP_MASK |
819 _EBI_RDTIMING3_RDSTRB_MASK |
820 _EBI_RDTIMING3_RDHOLD_MASK)) | readTiming;
821 }
822}
823
824
825/***************************************************************************//**

Callers 1

EBI_InitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected