-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sw: Create addressability test for Hyperbus
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2024 ETH Zurich and University of Bologna. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Sergio Mazzola <smazzola@iis.ee.ethz.ch> | ||
|
||
// Test HyperRAM addressability through the Hyperbus peripheral | ||
|
||
#include <soc_addr_map.h> | ||
#include <stdint.h> | ||
|
||
#define HYPER_BASE 0x40A00000 | ||
#define TESTVAL (uint32_t)0x1234ABCD | ||
|
||
int main() { | ||
volatile uint32_t *hyperMemPtr = (volatile uint32_t *)HYPER_BASE; | ||
volatile uint32_t result; | ||
volatile uint32_t golden = TESTVAL; | ||
|
||
// write | ||
*(hyperMemPtr) = TESTVAL; | ||
// read | ||
result = *(hyperMemPtr); | ||
|
||
// verify | ||
if (result == TESTVAL) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} |