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 "HIF_api.h"
21 //#include "vbuf_api.h"
22 //#include "vdesc_api.h"
23 //#include "htc_api.h"
24 #include "Magpie_api.h"
32 /* WMI Adaptive API - required for WMI SVCs as they refer some of them*/
35 /* WLAN WMI API - required for WMI SVCs and others...*/
38 #define A_INDIR(sym) _A_OS_INDIRECTION_TABLE->sym
41 #define HIF_MODULE_INSTALL() hif_module_install(&_A_OS_INDIRECTION_TABLE->hif)
42 #define HIF_init(pConfig) A_INDIR(hif._init(pConfig))
43 #define HIF_start() A_INDIR(hif._start())
44 #define HIF_config_pipe(pipe, desc_list) A_INDIR(hif._config_pipe(pipe, desc_list))
45 #define HIF_send_buffer(pipe, buf) A_INDIR(hif._send_buffer(pipe, buf))
46 #define HIF_return_recv_buf(pipe, buf) A_INDIR(hif._return_recv_buf(pipe, buf))
47 #define HIF_isr_handler() A_INDIR(hif._isr_handler())
48 #define HIF_is_pipe_supported(pipe) A_INDIR(hif._is_pipe_supported(pipe))
51 #define VBUF_MODULE_INSTALL() vbuf_module_install(&_A_OS_INDIRECTION_TABLE->vbuf)
52 #define VBUF_init(dataAddr, nBuf) A_INDIR(vbuf._init(dataAddr, nBuf))
53 #define VBUF_alloc_vbuf() A_INDIR(vbuf._alloc_vbuf())
54 #define VBUF_free_vbuf(buf) A_INDIR(vbuf._free_vbuf(buf))
57 #define VDESC_MODULE_INSTALL() vdesc_module_install(&_A_OS_INDIRECTION_TABLE->vdesc)
58 #define VDESC_init(dataAddr, nTxDesc, nRxDesc) A_INDIR(vdesc._init(dataAddr, nTxDesc, nRxDesc))
59 #define VDESC_alloc_vdesc(type) A_INDIR(vdesc._alloc_vdesc(type))
60 #define VDESC_get_hw_desc(type, desc) A_INDIR(vdesc._get_hw_desc(type, desc))
61 //#define VDESC_free_vdesc(buf) A_INDIR(vdesc._free_vdesc(buf))
63 #define HTC_MODULE_INSTALL() htc_module_install(&_A_OS_INDIRECTION_TABLE->htc)
64 //#define HTC_init(dataAddr, SetupComplete, RecvBufferSize) A_INDIR(htc._HTC_Init(dataAddr, SetupComplete, RecvBufferSize))
65 #define HTC_init(dataAddr, SetupComplete, pConfig) A_INDIR(htc._HTC_Init(dataAddr, SetupComplete, pConfig))
66 #define HTC_RegisterService(s) A_INDIR(htc._HTC_RegisterService(s))
67 #define HTC_Ready() A_INDIR(htc._HTC_Ready())
68 #define HTC_SendMsg(endpt, buf) A_INDIR(htc._HTC_SendMsg(endpt, buf))
69 #define HTC_ReturnBuffers(endpt, buf) A_INDIR(htc._HTC_ReturnBuffers(endpt, buf))
73 #define WMI_SERVICE_MODULE_INSTALL() WMI_service_module_install(&_A_OS_INDIRECTION_TABLE->wmi_svc_api)
74 #define WMI_Init(dataAddr, pCfg) A_INDIR(wmi_svc_api._WMI_Init(dataAddr, pCfg))
75 #define WMI_RegisterDispatchTable(pT) A_INDIR(wmi_svc_api._WMI_RegisterDispatchTable(pT))
76 #define WMI_AllocEvent(ec,len) A_INDIR(wmi_svc_api._WMI_AllocEvent(ec, len))
77 #define WMI_SendEvent(ev,id,seq,len) A_INDIR(wmi_svc_api._WMI_SendEvent(ev, id, seq, len))
78 #define WMI_GetPendingEventsCount() A_INDIR(wmi_svc_api._WMI_GetPendingEventsCount())
79 #define WMI_GetControlEp() A_INDIR(wmi_svc_api._WMI_GetControlEp())
80 #define WMI_SendCompleteHandler(ep, buf) A_INDIR(wmi_svc_api._WMI_SendCompleteHandler(ep, buf))
84 * This defines the layout of the indirection table, which
85 * is used to access exported APIs of various modules. The
86 * layout is shared across ROM and RAM code. RAM code may
87 * call into ROM and ROM code may call into RAM. Because
88 * of the latter, existing offsets must not change for the
89 * lifetime of a revision of ROM; but new members may be
92 typedef struct _A_athos_indirection_table {
93 _A_cmnos_indirection_table_t cmnos;
95 /* TBD: to be added */
98 struct vdesc_api vdesc;
100 //WMI_SVC_APIS wmi_svc_api;
101 } _A_athos_indirection_table_t;
104 extern _A_athos_indirection_table_t _indir_tbl;
105 #define _A_OS_INDIRECTION_TABLE_SIZE sizeof(_A_athos_indirection_table_t)
106 #define _A_OS_INDIRECTION_TABLE (&_indir_tbl)
110 extern unsigned int _data_start_in_rom;
111 extern unsigned int _data_start;
112 extern unsigned int _data_end;
113 extern unsigned int _bss_start;
114 extern unsigned int _bss_end;
115 extern unsigned int _stack_sentry;
116 extern unsigned int __stack;
117 extern unsigned int _fw_image_end;
119 #if defined(__XTENSA__)
120 #define START_DATA _data_start
121 #define END_DATA _data_end
122 #define START_BSS _bss_start
123 #define END_BSS _bss_end
125 #define STACK_START _stack_sentry
126 #define STACK_END __stack
130 struct _A_os_linkage_check {
137 * A_INIT() handles any initialization needed by the OS abstraction,
138 * and it clears the application's BSS, if necessary. (Application BSS
139 * is not cleared if the application is linked into a single image that
142 * A_INIT() must be called first thing in the application (from app_start)
143 * in order to guarantee that BSS has been cleared properly.
148 struct _A_os_linkage_check link_check;
149 unsigned int *clrptr;
151 if (&START_BSS != _A_MAGPIE_INDIRECTION_TABLE->cmnos.start_bss) {
153 for (clrptr = &START_BSS; clrptr < &END_BSS; clrptr++) {
159 /* Copy writable data from flash to RAM. */
160 unsigned int *srcptr, *destptr;
163 * The _data_start symbol points to the start of data IN FLASH.
164 * It is defined by flash.ld at application link time. If flash.ld
165 * is not used, it is defined (on the link line) as 0.
167 static int *data_start_addr = &_data_start;
169 if (data_start_addr != 0) {
170 for (srcptr = &_data_start, destptr = &START_DATA;
179 #define OS_LINKAGE_VERSION 4
180 link_check.version = OS_LINKAGE_VERSION;
181 link_check.table = _A_MAGPIE_INDIRECTION_TABLE_SIZE;
183 return A_CMN(hal_linkage_check(sizeof(link_check), &link_check));
187 #endif /* __ATHOS_API_H__ */