1/* 2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <camkes.h> 8#include <sel4/sel4.h> 9#include <stdio.h> 10 11int run(void) { 12 const char *name = get_instance_name(); 13 printf("%s: Started\n", name); 14 15 printf("%s: Trying to acquire the lock...\n", name); 16 lock_lock(); 17 printf("%s: Got it!\n", name); 18 19 printf("%s: Let's do some long running calculation (or more accurately, waste time)...\n", name); 20 for (int i = 0; i < 10000; i++) 21 asm volatile (""); 22 23 printf("%s: Releasing the lock...\n", name); 24 lock_unlock(); 25 printf("%s: Done; let's spin.\n", name); 26 while (1); 27 28 return 0; 29} 30 31