Skip to content

Commit 7fa87a9

Browse files
Check cheri sanity updated with new GPIO
1 parent 1e5b771 commit 7fa87a9

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

sw/cheri/checks/cheri_sanity.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
using namespace CHERI;
1414

15-
#define GPIO_VALUE (0x00000FF0)
15+
#define GPIO_VALUE (0x000000FF)
1616

1717
/**
1818
* C++ entry point for the loader. This is called from assembly, with the
@@ -49,10 +49,9 @@ extern "C" uint32_t entry_point(void *rwRoot) {
4949
while (true) {
5050
gpioValue ^= GPIO_VALUE;
5151
for (int i = 0; i < 2000000; i++) {
52-
inputValue = *((volatile uint32_t *)gpi);
53-
// Shift right to remove joystick, mask to only get 8 switches and shift left to skip LCD controls.
54-
switchValue = ((inputValue >> 5) & 0xFF) << 4;
55-
joystickValue = (inputValue & 0x1F) << 4;
52+
inputValue = *((volatile uint32_t *)gpi);
53+
switchValue = inputValue & 0xFF;
54+
joystickValue = (inputValue >> 8) & 0x1F;
5655
*((volatile uint32_t *)gpo) = (gpioValue ^ switchValue ^ joystickValue) & GPIO_VALUE;
5756
}
5857
}

0 commit comments

Comments
 (0)