diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-02-07 13:12:35 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-02-07 13:12:35 -0500 |
commit | 74c216543cec4cde3c359929abfba8aac75ec5be (patch) | |
tree | 1eea1db1e953bcf62cdde8ddc3de846920dfb54f | |
parent | af8376e203df8b6320c55f22fa00030c74423120 (diff) | |
download | kutter-74c216543cec4cde3c359929abfba8aac75ec5be.tar.gz kutter-74c216543cec4cde3c359929abfba8aac75ec5be.tar.xz kutter-74c216543cec4cde3c359929abfba8aac75ec5be.zip |
atsam: Configure the atsam sram matrix register
The sram matrix configuration is, bizarrely, configured with a slow
default. It will typically add an extra wait state to every memory
access. Set the matrix sram controller to improve the performance.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/atsam/main.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/atsam/main.c b/src/atsam/main.c index 7dba4a2d..b6be2864 100644 --- a/src/atsam/main.c +++ b/src/atsam/main.c @@ -102,11 +102,22 @@ usb_request_bootloader(void) * Startup ****************************************************************/ +static void +matrix_init(void) +{ + // The ATSAM sram is in a "no default master" state at reset + // (despite the specs). That typically adds 1 wait cycle to every + // memory access. Set it to "last access master" to avoid that. + MATRIX->MATRIX_SCFG[0] = (MATRIX_SCFG_SLOT_CYCLE(64) + | MATRIX_SCFG_DEFMSTR_TYPE(1)); +} + // Main entry point int main(void) { SystemInit(); + matrix_init(); sched_main(); return 0; } |