1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7typedef unsigned int uint32_t; 8typedef unsigned char uint8_t; 9typedef unsigned long word_t; 10 11struct blob { 12 uint32_t words[2]; 13}; 14typedef struct blob blob_t; 15 16enum _bool { 17 false = 0, 18 true = 1 19}; 20 21typedef struct range_blob { 22 word_t start; 23 word_t end; 24} range_blob_t; 25 26typedef struct struct_blob { 27 word_t index; 28 uint8_t data1; 29 uint8_t data2; 30 uint8_t data3; 31 uint8_t data4; 32} struct_blob_t; 33 34typedef struct { 35 word_t id; 36 word_t index; 37 38 range_blob_t index_range; 39 range_blob_t free_index_range; 40 41 void *ptr_to_stuff; /* pointer to initial thread's IPC buffer */ 42 range_blob_t range_in_stuff; 43 range_blob_t next_range_in_stuff; 44 45 struct_blob_t list_of_data[192]; 46 47 range_blob_t used_part_of_list; 48} big_struct_t; 49 50typedef struct toplevel_struct { 51 range_blob_t a_range; 52 int config_data1; 53 int config_data2; 54 55 big_struct_t *things; 56} toplevel_struct_t; 57 58int a_modified_global; 59int another_global; 60extern toplevel_struct_t toplevel; 61 62void modify_toplevel(int x) 63{ 64 toplevel.config_data1 = x; 65} 66 67void add_a_thing(int thing_num, int data_num) 68{ 69 if (data_num < 192) { 70 toplevel.things[thing_num].list_of_data[data_num].index = 1; 71 } else { 72 toplevel.things[thing_num].range_in_stuff.end = -1; 73 } 74} 75 76void update_a_global(int x) 77{ 78 a_modified_global = x; 79} 80 81/* small const global array */ 82typedef int reference_val; 83 84static const reference_val a_reference_array[] = { 85 12 86}; 87 88static int get_num_reference_vals(void) 89{ 90 return sizeof(a_reference_array) / sizeof(reference_val); 91} 92 93static reference_val get_reference_val(int i, int extra_param) 94{ 95 reference_val ref = a_reference_array[i]; 96 97 if (ref < extra_param) { 98 return 0; 99 } else { 100 return ref; 101 } 102} 103 104 105