1 #ifndef __ATHOS_API_H__
2 #define __ATHOS_API_H__
5 * This file contains wrappers to OS operating system functions
6 * that are available in the Athos version of the operating system.
8 * Target software must always use these wrappers to access OS
9 * services -- it may not access any OS services directly.
11 * These wrappers are intended to provide OS-independence for applications.
12 * Using this header file, an application should be able to compile and
13 * fully link without any other OS header files, source files, or
19 #include "cmnos_api.h"
20 #include "Magpie_api.h"
24 /* save the ROM printf function point */
25 extern uint32_t save_cmnos_printf;
27 extern unsigned int _data_start_in_rom;
28 extern unsigned int _data_start;
29 extern unsigned int _data_end;
30 extern unsigned int _bss_start;
31 extern unsigned int _bss_end;
32 extern unsigned int _stack_sentry;
33 extern unsigned int __stack;
34 extern unsigned int _fw_image_end;
36 #if defined(__XTENSA__)
37 #define START_DATA _data_start
38 #define END_DATA _data_end
39 #define START_BSS _bss_start
40 #define END_BSS _bss_end
42 #define STACK_START _stack_sentry
43 #define STACK_END __stack
46 struct _A_os_linkage_check {
52 * A_INIT() handles any initialization needed by the OS abstraction,
53 * and it clears the application's BSS, if necessary. (Application BSS
54 * is not cleared if the application is linked into a single image that
57 * A_INIT() must be called first thing in the application (from app_start)
58 * in order to guarantee that BSS has been cleared properly.
63 struct _A_os_linkage_check link_check;
66 if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
68 for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
73 /* Copy writable data from flash to RAM. */
74 unsigned int *srcptr, *destptr;
77 * The _data_start symbol points to the start of data IN FLASH.
78 * It is defined by flash.ld at application link time. If flash.ld
79 * is not used, it is defined (on the link line) as 0.
81 static int *data_start_addr = &_data_start;
83 if (data_start_addr != 0) {
84 for (srcptr = &_data_start, destptr = &START_DATA;
86 srcptr++, destptr++) {
91 #define OS_LINKAGE_VERSION 4
92 link_check.version = OS_LINKAGE_VERSION;
93 link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
95 return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
98 #endif /* __ATHOS_API_H__ */