1/* 2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <assert.h> 8#include <camkes.h> 9#include <stdio.h> 10 11int run(void) { 12#ifdef NDEBUG 13 printf("WARNING: assertions are disabled!\n"); 14#endif 15 16 /* Write something to the first dataport. */ 17 printf("Writing 42...\n"); 18 *(volatile int*)d1 = 42; 19 20 /* Make sure we can read it back from the second. */ 21 int x = *(volatile int*)d2; 22 assert(x == 42); 23 24 /* Chain this through all the others. */ 25 26 *(volatile int*)d2 = 43; 27 x = *(volatile int*)d3; 28 assert(x == 43); 29 30 *(volatile int*)d3 = 44; 31 x = *(volatile int*)d4; 32 assert(x == 44); 33 34 *(volatile int*)d4 = 45; 35 x = *(volatile int*)d1; 36 assert(x == 45); 37 38 printf("All OK\n"); 39 return 0; 40} 41