See Quick Start Guide for the XMEGA EBI Driver .
This is a driver for configuring, enabling, disabling and use of the on-chip external bus interface (EBI).
The external bus interface depends on the following modules:
See Quick Start Guide for the XMEGA EBI Driver
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the External Bus Interface (EBI). | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the External Bus Interface (EBI). | |
EBI port/pin configuration | |
This is a driver for configuring the external bus interface port. | |
Common EBI test functions | |
This module contains common functions for testing of External Bus Interface (EBI) and the setup of external RAM devices. | |
Data Structures | |
struct | ebi_cs_config |
External bus interface chip select configuration. More... | |
struct | ebi_sdram_config |
External bus interface SDRAM configuration. More... | |
Macros | |
#define | EBI_SDRAM_CS 3 |
Chip select on the EBI that can be configured for SDRAM operation. More... | |
External Bus Interface management | |
void | ebi_cs_write_config (const uint8_t cs, const struct ebi_cs_config *config) |
Write EBI chip select configuration to hardware. More... | |
void | ebi_cs_read_config (const uint8_t cs, struct ebi_cs_config *config) |
Read EBI chip select configuration from hardware. More... | |
void | ebi_sdram_write_config (const struct ebi_sdram_config *config) |
Write EBI SDRAM configuration to hardware. More... | |
void | ebi_sdram_read_config (struct ebi_sdram_config *config) |
Read EBI SDRAM configuration from hardware. More... | |
void | ebi_enable_cs (const uint8_t cs, const struct ebi_cs_config *config) |
Enable an EBI chip select. More... | |
void | ebi_disable_cs (const uint8_t cs) |
Disable an EBI chip select. More... | |
static bool | ebi_sdram_is_ready (void) |
Check if SDRAM is ready for access. More... | |
External Bus Interface Chip Select configuration helper functions | |
static void | ebi_cs_set_mode (struct ebi_cs_config *config, EBI_CS_MODE_t mode) |
Set chip select mode. More... | |
static void | ebi_cs_set_address_size (struct ebi_cs_config *config, EBI_CS_ASPACE_t size) |
Set chip select address size. More... | |
static void | ebi_cs_set_sram_wait_states (struct ebi_cs_config *config, EBI_CS_SRWS_t cycles) |
Set chip select SRAM wait states. More... | |
static void | ebi_cs_set_base_address (struct ebi_cs_config *config, uint32_t address) |
Set chip select base address. More... | |
External Bus Interface SDRAM configuration helper functions | |
static void | ebi_sdram_set_mode (struct ebi_cs_config *config, EBI_CS_SDMODE_t mode) |
Set SDRAM mode. More... | |
static void | ebi_sdram_set_cas_latency (struct ebi_sdram_config *config, const uint8_t cas) |
Set SDRAM CAS latency. More... | |
static void | ebi_sdram_set_row_bits (struct ebi_sdram_config *config, const uint8_t bits) |
Set number of SDRAM row bits. More... | |
static void | ebi_sdram_set_col_bits (struct ebi_sdram_config *config, const uint8_t bits) |
Set number of SDRAM column bits. More... | |
static void | ebi_sdram_set_refresh_period (struct ebi_sdram_config *config, const uint16_t period) |
Set SDRAM refresh period. More... | |
static void | ebi_sdram_set_initialization_delay (struct ebi_sdram_config *config, const uint16_t delay) |
Set SDRAM initialization delay. More... | |
static void | ebi_sdram_set_mode_delay (struct ebi_sdram_config *config, const EBI_MRDLY_t delay) |
Set SDRAM mode delay. More... | |
static void | ebi_sdram_set_row_cycle_delay (struct ebi_sdram_config *config, const EBI_ROWCYCDLY_t delay) |
Set SDRAM row cycle delay. More... | |
static void | ebi_sdram_set_row_to_precharge_delay (struct ebi_sdram_config *config, const EBI_RPDLY_t delay) |
Set SDRAM row to pre-charge delay. More... | |
static void | ebi_sdram_set_write_recovery_delay (struct ebi_sdram_config *config, const EBI_WRDLY_t delay) |
Set SDRAM write recovery delay. More... | |
static void | ebi_sdram_set_self_refresh_to_active_delay (struct ebi_sdram_config *config, const EBI_ESRDLY_t delay) |
Set SDRAM exit self refresh to active delay. More... | |
static void | ebi_sdram_set_row_to_col_delay (struct ebi_sdram_config *config, const EBI_ROWCOLDLY_t delay) |
Set SDRAM row to column delay. More... | |
External Bus Interface SDRAM power management | |
static void | ebi_sdram_enable_self_refresh (void) |
Enable SDRAM self refresh mode. More... | |
static void | ebi_sdram_disable_self_refresh (void) |
Disable SDRAM self refresh mode. More... | |
#define EBI_SDRAM_CS 3 |
Chip select on the EBI that can be configured for SDRAM operation.
Referenced by main(), and memories_initialization().
void ebi_cs_read_config | ( | const uint8_t | cs, |
struct ebi_cs_config * | config | ||
) |
Read EBI chip select configuration from hardware.
This function will read the EBI chip select hardware configuration and put it into the ebi_cs_config argument.
cs | Chip select number to read configuration from |
config | Pointer to an ebi_cs_config variable |
References ebi_cs_config::base_address, cpu_irq_restore(), cpu_irq_save(), ebi_cs_config::ctrla, ebi_cs_config::ctrlb, ebi_get_cs_addr_from_cs_num(), sysclk_disable_module(), SYSCLK_EBI, sysclk_enable_module(), sysclk_module_is_enabled(), and SYSCLK_PORT_GEN.
|
inlinestatic |
Set chip select address size.
This function helps the caller setting the chip select address size. The different sizes are provided by an EBI_CS_ASPACE_t type from the toolchain header files.
config | Pointer to an ebi_cs_config variable |
size | Chip select address size given by an EBI_CS_ASPACE_t type |
References ebi_cs_config::ctrla, and EBI_CS_ASPACE_gm.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set chip select base address.
This function helps the caller setting the chip select base address, e.g., the lowest address space enabled by the chip select.
config | Pointer to an ebi_cs_config variable |
address | The chip select base address |
References ebi_cs_config::base_address.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set chip select mode.
This function helps the caller setting the chip select mode. The different modes are provided by an EBI_CS_MODE_t type from the toolchain header files.
config | Pointer to an ebi_cs_config variable |
mode | Chip select mode given by an EBI_CS_MODE_t type |
References ebi_cs_config::ctrla.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set chip select SRAM wait states.
This function helps the caller setting the chip select SRAM wait states. The different SRAM wait states (cycles) are provided by an EBI_CS_SRWS_t type from the toolchain header files.
config | Pointer to an ebi_cs_config variable |
cycles | Chip select SRAM wait states given by an EBI_CS_SRWS_t type |
References ebi_cs_config::ctrlb.
Referenced by main().
void ebi_cs_write_config | ( | const uint8_t | cs, |
const struct ebi_cs_config * | config | ||
) |
Write EBI chip select configuration to hardware.
This function will write an ebi_cs_config struct to the selected chip select hardware.
cs | Chip select number to write configuration for |
config | Pointer to an ebi_cs_config variable |
References ebi_cs_config::base_address, cpu_irq_restore(), cpu_irq_save(), ebi_cs_config::ctrla, ebi_cs_config::ctrlb, ebi_get_cs_addr_from_cs_num(), sysclk_disable_module(), SYSCLK_EBI, sysclk_enable_module(), sysclk_module_is_enabled(), and SYSCLK_PORT_GEN.
Referenced by main(), and memories_initialization().
void ebi_disable_cs | ( | const uint8_t | cs | ) |
Disable an EBI chip select.
cs | Chip select number to disable |
References cpu_irq_restore(), cpu_irq_save(), ebi_enabled_chip_selects, ebi_get_cs_addr_from_cs_num(), SLEEPMGR_IDLE, sleepmgr_unlock_mode(), sysclk_disable_module(), SYSCLK_EBI, and SYSCLK_PORT_GEN.
void ebi_enable_cs | ( | const uint8_t | cs, |
const struct ebi_cs_config * | config | ||
) |
Enable an EBI chip select.
cs | Chip select number to enable |
config | Pointer to an ebi_cs_config variable |
References cpu_irq_restore(), cpu_irq_save(), ebi_cs_config::ctrla, ebi_enabled_chip_selects, ebi_get_cs_addr_from_cs_num(), SLEEPMGR_IDLE, sleepmgr_lock_mode(), SYSCLK_EBI, sysclk_enable_module(), and SYSCLK_PORT_GEN.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Disable SDRAM self refresh mode.
This function makes the EBI hardware send a command to the SDRAM to leave self refresh mode.
References cpu_irq_restore(), cpu_irq_save(), SLEEPMGR_IDLE, and sleepmgr_lock_mode().
|
inlinestatic |
Enable SDRAM self refresh mode.
This function makes the EBI hardware send a command to the SDRAM to enter self refresh mode.
References cpu_irq_restore(), cpu_irq_save(), SLEEPMGR_IDLE, and sleepmgr_unlock_mode().
|
inlinestatic |
Check if SDRAM is ready for access.
This function must be checked after the SDRAM chip select has been enabled. It will return true when the SDRAM is initialized.
true | when SDRAM is ready, false otherwise |
Referenced by main(), and memories_initialization().
void ebi_sdram_read_config | ( | struct ebi_sdram_config * | config | ) |
Read EBI SDRAM configuration from hardware.
This function will read the SDRAM EBI hardware configuration and put it into the ebi_cs_config argument.
config | Pointer to an ebi_sdram_config variable |
References cpu_irq_restore(), cpu_irq_save(), ebi_sdram_config::init_delay, ebi_sdram_config::refresh_period, ebi_sdram_config::sdramctrla, ebi_sdram_config::sdramctrlb, ebi_sdram_config::sdramctrlc, sysclk_disable_module(), SYSCLK_EBI, sysclk_enable_module(), sysclk_module_is_enabled(), and SYSCLK_PORT_GEN.
|
inlinestatic |
Set SDRAM CAS latency.
This function helps the caller setting the SDRAM CAS latency.
config | Pointer to an ebi_sdram_config variable |
cas | SDRAM CAS latency, 2 or 3 |
References Assert, and ebi_sdram_config::sdramctrla.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set number of SDRAM column bits.
This function helps the caller setting the number of SDRAM column bits.
config | Pointer to an ebi_sdram_config variable |
bits | Number of column bits, 8 to 11 |
References Assert, and ebi_sdram_config::sdramctrla.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM initialization delay.
This function helps the caller setting the SDRAM initialization delay as a number of peripheral 2x clock cycles (CLKper2).
config | Pointer to an ebi_sdram_config variable |
delay | SDREAM initialization delay, number of CLKper2 cycles |
References ebi_sdram_config::init_delay.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM mode.
This function helps the caller setting the SDRAM mode. The different modes are provided by an EBI_CS_SDMODE_t type from the toolchain header files.
config | Pointer to an ebi_cs_config variable |
mode | SDRAM mode given by an EBI_CS_SDMODE_t type |
References ebi_cs_config::ctrlb.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM mode delay.
This function helps the caller setting the SDRAM mode delay as a number of peripheral 2x clock cycles (CLKper2). The different modes are provided by an EBI_MRDLY_t type from the toolchain header files.
config | Pointer to an ebi_sdram_config variable |
delay | SDRAM mode delay given by an EBI_MRDLY_t type |
References ebi_sdram_config::sdramctrlb.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM refresh period.
This function helps the caller setting the SDRAM refresh period as a number of peripheral 2x clock cycles (CLKper2).
config | Pointer to an ebi_sdram_config variable |
period | SDREAM refresh period, number of CLKper2 cycles |
References ebi_sdram_config::refresh_period.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set number of SDRAM row bits.
This function helps the caller setting the number of SDRAM row bits.
config | Pointer to an ebi_sdram_config variable |
bits | Number of row bits, 11 or 12 |
References Assert, and ebi_sdram_config::sdramctrla.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM row cycle delay.
This function helps the caller setting the SDRAM row cycle delay as a number of peripheral clock 2x cycles (CLKper2). The different delays are provided by an EBI_ROWCYCDLY_t type from the toolchain header files.
config | Pointer to an ebi_sdram_config variable |
delay | SDRAM row cycle delay given by an EBI_ROWCYCDLY_t type |
References ebi_sdram_config::sdramctrlb.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM row to column delay.
This function helps the caller setting the SDRAM row to column delay as a number of peripheral clock 2x cycles (CLKper2). The different delays are provided by an EBI_ROWCOLDLY_t type from the toolchain header files.
config | Pointer to an ebi_sdram_config variable |
delay | SDRAM row to column delay given by an EBI_ROWCOLDLY_t type |
References ebi_sdram_config::sdramctrlc.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM row to pre-charge delay.
This function helps the caller setting the SDRAM row to pre-charge delay as a number of peripheral clock 2x cycles (CLKper2). The different delays are provided by an EBI_RPDLY_t type from the toolchain header files.
config | Pointer to an ebi_sdram_config variable |
delay | SDRAM row to pre-charge delay given by an EBI_ROWCYCDLY_t type |
References ebi_sdram_config::sdramctrlb.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM exit self refresh to active delay.
This function helps the caller setting the SDRAM exit self refresh to active delay as a number of peripheral clock 2x cycles (CLKper2). The different delays are provided by an EBI_ESRDLY_t type from the toolchain header files.
config | Pointer to an ebi_sdram_config variable |
delay | SDRAM exit self refresh to active delay given by an EBI_ESRDLY_t type |
References ebi_sdram_config::sdramctrlc.
Referenced by main(), and memories_initialization().
|
inlinestatic |
Set SDRAM write recovery delay.
This function helps the caller setting the SDRAM write recovery delay as a number of peripheral clock 2x cycles (CLKper2). The different delays are provided by an EBI_WRDLY_t type from the toolchain header files.
config | Pointer to an ebi_sdram_config variable |
delay | SDRAM write recovery delay given by an EBI_WRDLY_t type |
References ebi_sdram_config::sdramctrlc.
Referenced by main(), and memories_initialization().
void ebi_sdram_write_config | ( | const struct ebi_sdram_config * | config | ) |
Write EBI SDRAM configuration to hardware.
This function will write an ebi_sdram_config struct to the SDRAM part of the EBI hardware.
config | Pointer to an ebi_sdram_config variable |
References cpu_irq_restore(), cpu_irq_save(), ebi_sdram_config::init_delay, ebi_sdram_config::refresh_period, ebi_sdram_config::sdramctrla, ebi_sdram_config::sdramctrlb, ebi_sdram_config::sdramctrlc, sysclk_disable_module(), SYSCLK_EBI, sysclk_enable_module(), sysclk_module_is_enabled(), and SYSCLK_PORT_GEN.
Referenced by main(), and memories_initialization().