WHENCE: Update licensing information about the a56 assembler given the GPLed patches...
[linux-libre-firmware.git] / ath9k_htc / target_firmware / magpie_fw_dev / target / inc / k2 / cmnos_api.h
1 /*
2  * Copyright (c) 2013 Qualcomm Atheros, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted (subject to the limitations in the
7  * disclaimer below) provided that the following conditions are met:
8  *
9  *  * Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  *  * Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the
15  *    distribution.
16  *
17  *  * Neither the name of Qualcomm Atheros nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
22  * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
24  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 #ifndef __CMNOS_API_H__
36 #define __CMNOS_API_H__
37
38 /*
39  * This file contains wrappers to OS operating system functions
40  * that are available in all versions of the operating system.
41  *
42  * Target software must always use these wrappers to access OS
43  * services -- it may not access any OS services directly.
44  */
45
46 #include "xtensa/config/core.h"
47 #include "xtensa/hal.h"
48 #include "xtensa/xtruntime.h"
49 #include "sys_cfg.h"
50
51 /* cmnos interface */
52 #include "printf_api.h"
53 #include "uart_api.h"
54 #include "dbg_api.h"
55 #include "mem_api.h"
56 #include "misc_api.h"
57 #include "string_api.h"
58 #include "timer_api.h"
59 #include "romp_api.h"
60 #include "allocram_api.h"
61 #include "tasklet_api.h"
62 #include "clock_api.h"
63 #include "intr_api.h"
64 #include "wdt_api.h"
65 #include "eeprom_api.h"
66 #include "usb_api.h"
67
68 #if defined(PROJECT_K2)
69 #if SYSTEM_MODULE_SFLASH
70 #include "sflash_api.h"
71 #endif
72 #endif
73
74 #define AR6K_ROM_START 0x004e0000
75 #define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset))
76 #define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset)
77
78 #define IML_SIGNAL_UNUSED0_ADDR TARG_ROM_ADDRS(0)   /* Cannot be used -- aligned */
79 #define IML_SIGNAL_ASSERT_ADDR  TARG_ROM_ADDRS(1)   /* Signal an assertion failure */
80 #define IML_SIGNAL_PRINTF_ADDR  TARG_ROM_ADDRS(2)   /* Signal a printf request */
81 #define IML_SIGNAL_UNUSED4_ADDR TARG_ROM_ADDRS(4)   /* Cannot be used -- aligned */
82 #define IML_SIGNAL_UNUSED8_ADDR TARG_ROM_ADDRS(8)   /* Cannot be used -- aligned */
83 #define IML_SIGNAL_UNUSEDC_ADDR TARG_ROM_ADDRS(0xc) /* Cannot be used -- aligned */
84 #define IML_SIGNAL_MASK         0xfffe000f
85 #define IML_LINENUM_SHIFT       4
86
87 #define NOW() xthal_get_ccount()
88
89 #if defined(__XTENSA__)
90 #define _A_BARRIER asm volatile("memw")
91 #else
92 #define _A_BARRIER
93 #endif
94
95 #define A_ASSERT( __bool )                                                  \
96     do {                                                                    \
97         if (0 == (__bool)) {                                                \
98             (void)*((volatile int *)(IML_SIGNAL_ASSERT_ADDR+(__LINE__<<4)));\
99             _A_BARRIER;                                                     \
100         }                                                                   \
101     } while (0)
102
103
104 #define A_IML_IS_ASSERT(vaddr) \
105         (((vaddr) & IML_SIGNAL_MASK) == (IML_SIGNAL_ASSERT_ADDR & IML_SIGNAL_MASK))
106
107
108 #define PRINT_FAILURE_STATE()                                           \
109 do {                                                                    \
110     uint32_t  epc1, epc2, epc3, epc4;                                   \
111                                                                         \
112     asm volatile("rsr %0,%1" : "=r" (epc1) : "n" (EPC_1));              \
113     asm volatile("rsr %0,%1" : "=r" (epc2) : "n" (EPC_2));              \
114     asm volatile("rsr %0,%1" : "=r" (epc3) : "n" (EPC_3));              \
115     asm volatile("rsr %0,%1" : "=r" (epc4) : "n" (EPC_4));              \
116                                                                         \
117     A_PRINTF("\tepc1=0x%x, epc2=0x%x, epc3=0x%x, epc4=0x%x\n",          \
118                 epc1, epc2, epc3, epc4);                                \
119     A_PRINTF("0x%08x, 0x%08x, 0x%08x, \n\r",                            \
120         DEBUG_SYSTEM_STATE, WATCH_DOG_RESET_COUNTER,                    \
121         WATCH_DOG_MAGIC_PATTERN);                                       \
122 } while(0)
123 ////////////////////////////////////////////////////////////////////////////////////
124
125
126 //#define A_CMN(sym)   _A_OS_INDIRECTION_TABLE->cmnos.sym
127 #define A_CMN(sym)   _A_MAGPIE_INDIRECTION_TABLE->cmnos.sym
128
129 #if SYSTEM_MODULE_MEM
130 /* Mem interfaces */
131 #define A_MEMSET(addr, value, size)     \
132     A_CMN(mem._memset((char *)(addr), (int)(value), (int)(size)))
133
134 #define A_MEMZERO(addr, size)           \
135     A_CMN(mem._memset((char *)(addr), (int)0, (int)(size)))
136
137 #define A_MEMCPY(dst, src, size)        \
138     A_CMN(mem._memcpy((char *)(dst), (char *)(src), (int)(size)))
139
140 #define A_MEMMOVE(dst, src, size)       \
141     A_CMN(mem._memmove((char *)(dst), (char *)(src), (int)(size)))
142
143 #define A_MEMCMP(p1, p2, nbytes)        \
144     A_CMN(mem._memcmp)((void *)(p1), (void *)(p2), (int)(nbytes))
145 #else
146 /* Mem interfaces */
147 #define A_MEMSET(addr, value, size)
148
149 #define A_MEMZERO(addr, size)
150
151 #define A_MEMCPY(dst, src, size)
152
153 #define A_MEMMOVE(dst, src, size)
154
155 #define A_MEMCMP(p1, p2, nbytes)
156 #endif
157
158
159 #if 1
160     /* String interfaces */
161     #define A_STRCPY(dst, src)          A_CMN(string._strcpy((dst), (src)))
162     #define A_STRNCPY(dst, src, n)      A_CMN(string._strncpy((dst), (src), (n)))
163     #define A_STRLEN(str)               A_CMN(string._strlen(str))
164     #define A_STRCMP(str1, str2)        A_CMN(string._strcmp((str1), (str2)))
165     #define A_STRNCMP(str1, str2, n)    A_CMN(string._strncmp((str1), (str2), (n)))
166 #endif
167
168 #if SYSTEM_MODULE_PRINT
169 /* Printf support */
170 #define A_PRINTF_INIT()                 A_CMN(printf._printf_init())
171 #define A_PRINTF                        A_CMN(printf._printf)
172 #else
173 #define A_PRINTF_INIT()
174 #define A_PRINTF
175 #endif /* SYSTEM_MODULE_PRINT */
176
177 #if SYSTEM_MODULE_UART
178 /* Serial port support */
179 #define A_UART_INIT()               A_CMN(uart._uart_init())
180
181 #define A_UART_HWINIT(freq, baud)     \
182         A_CMN(uart._uart_hwinit((freq), (baud)))
183
184 #define A_UART_ENABLED()            (HOST_INTEREST->hi_uart_enable)
185
186 #define A_PUTS(str)                 A_CMN(uart._uart_str_out(str))
187
188 #define A_PUTC(ch)                  A_CMN(uart._uart_char_put(ch))
189 #define A_GETC(pCh)                 A_CMN(uart._uart_char_get(pCh))
190
191 #define A_UART_TASK()               A_CMN(uart._uart_task())
192 #define A_UART_CONFIG(x)            A_CMN(uart._uart_config(x))
193
194 #else
195
196 #define A_UART_INIT()
197
198 #define A_UART_HWINIT(freq, baud)
199
200 #define A_UART_ENABLED()
201
202 #define A_PUTS(str)
203
204 #define A_PUTC(ch)
205 #define A_GETC(pCh)
206
207 #define A_UART_TASK()
208 #define A_UART_CONFIG(x)
209
210 #endif
211
212 #if SYSTEM_MODULE_MISC
213 /* Reset Support */
214 #define A_RESET()                        A_CMN(misc._system_reset())
215 #define A_RESET_MAC()                    A_CMN(misc._mac_reset())
216
217 /* Assertion failure */
218 #define A_ASSFAIL(regdump)               A_CMN(misc._assfail((regdump)))
219
220 /* Report a failure to the Host */
221 #define A_REPORT_FAILURE(data, len)      \
222         A_CMN(misc._report_failure_to_host((data), (len)))
223
224 /* UNALIGNED references are used for ASSERTs */
225 #define A_MISALIGNED_LOAD_HANDLER(dump)  A_CMN(misc._misaligned_load_handler(dump))
226
227 /* reture the host interface type */
228 #define A_IS_HOST_PRESENT()             A_CMN(misc._is_host_present())
229 #define A_KBHIT(delay)                  A_CMN(misc._kbhit(delay))
230 #define A_GET_ROM_VER()                 A_CMN(misc._rom_version_get())
231 #else
232 /* Reset Support */
233 #define A_RESET()
234 #define A_RESET_MAC()
235
236 /* Assertion failure */
237 #define A_ASSFAIL(regdump)
238
239 #define A_MISALIGNED_LOAD_HANDLER(dump)
240
241 /* Report a failure to the Host */
242 #define A_REPORT_FAILURE(data, len)
243
244 #define A_IS_HOST_PRESENT()
245 #define A_KBHIT(delay)
246 #define A_GET_ROM_VER()
247 #endif
248
249 #if SYSTEM_MODULE_USB
250 /* debug Support */
251 #define A_USB_INIT()                    A_CMN(usb._usb_init())
252 #define A_USB_ROM_TASK()                A_CMN(usb._usb_rom_task())
253 #define A_USB_FW_TASK()                 A_CMN(usb._usb_fw_task())
254 #define A_USB_INIT_PHY()                A_CMN(usb._usb_init_phy())
255
256 #define A_USB_EP0_SETUP()               A_CMN(usb._usb_ep0_setup())
257 #define A_USB_EP0_TX_DATA()             A_CMN(usb._usb_ep0_tx_data())
258 #define A_USB_EP0_RX_DATA()             A_CMN(usb._usb_ep0_rx_data())
259
260 #define A_USB_GET_CONFIG()              A_CMN(usb._usb_get_configuration())
261 #define A_USB_SET_CONFIG()              A_CMN(usb._usb_set_configuration())
262
263 #define A_USB_GET_INTERFACE()           A_CMN(usb._usb_get_interface())
264 #define A_USB_SET_INTERFACE()           A_CMN(usb._usb_set_interface())
265
266 #define A_USB_STANDARD_CMD()            A_CMN(usb._usb_standard_cmd())
267 #define A_USB_VENDOR_CMD()              A_CMN(usb._usb_vendor_cmd())
268
269 #define A_USB_POWER_OFF()               A_CMN(usb._usb_power_off())
270 #define A_USB_RESET_FIFO()              A_CMN(usb._usb_reset_fifo())
271 #define A_USB_GEN_WDT()                 A_CMN(usb._usb_gen_wdt())
272 #define A_USB_JUMP_BOOT()               A_CMN(usb._usb_jump_boot())
273
274 #define A_USB_GET_DESCRIPTOR()          A_CMN(usb._usb_get_descriptor())
275 #define A_USB_SET_ADDRESS()             A_CMN(usb._usb_set_address())
276 #define A_USB_SET_FEATURE()             A_CMN(usb._usb_set_feature())
277 #define A_USB_CLEAR_FEATURE()           A_CMN(usb._usb_clr_feature())
278
279 #define A_USB_GET_STATUS()              A_CMN(usb._usb_get_status())
280 #define A_USB_SETUP_DESC()              A_CMN(usb._usb_setup_desc())
281 #define A_USB_STATUS_IN()               A_CMN(usb._usb_status_in())
282 #define A_USB_REG_OUT()                 A_CMN(usb._usb_reg_out())
283
284 #define A_USB_EP0_TX()                  A_CMN(usb._usb_ep0_tx())
285 #define A_USB_EP0_RX()                  A_CMN(usb._usb_ep0_rx())
286 #define A_USB_CLK_INIT()                A_CMN(usb._usb_clk_init())
287
288 #else
289 #define A_USB_INIT()
290 #define A_USB_TASK()
291 #define A_USB_INIT_PHY()
292
293 #define A_USB_EP0_SETUP()
294 #define A_USB_EP0_TX()
295 #define A_USB_EP0_RX()
296
297 #define A_USB_GET_CONFIG()
298 #define A_USB_SET_CONFIG()
299
300 #define A_USB_GET_INTERFACE()
301 #define A_USB_SET_INTERFACE()
302
303 #define A_USB_STANDARD_CMD()
304 #define A_USB_VENDOR_CMD()
305
306 #define A_USB_POWER_OFF()
307 #define A_USB_RESET_FIFO()
308 #define A_USB_GEN_WDT()
309 #define A_USB_JUMP_BOOT()
310
311 #define A_USB_GET_DESCRIPTOR()
312 #define A_USB_SET_ADDRESS()
313 #define A_USB_SET_FEATURE()
314 #define A_USB_CLEAR_FEATURE()
315
316 #define A_USB_GET_STATUS()
317 #define A_USB_SETUP_DESC()
318
319
320 #define A_USB_STATUS_IN()
321 #define A_USB_REG_OUT()
322
323 #define A_USB_EP0_TX()
324 #define A_USB_EP0_RX()
325
326 #define A_USB_CLK_INIT()
327 #endif
328
329 #if SYSTEM_MODULE_INTR
330 /* Low-level interrupt support intended for use by OS modules */
331 #define A_INTR_GET_INTRENABLE()         A_CMN(intr._get_intrenable())
332 #define A_INTR_SET_INTRENABLE(val)      A_CMN(intr._set_intrenable(val))
333 #define A_INTR_GET_INTRPENDING()        A_CMN(intr._get_intrpending())
334 #define A_INTR_UNBLOCK_ALL_INTRLVL()    A_CMN(intr._unblock_all_intrlvl())
335
336 /* Interrupt support */
337 #define A_INTR_INIT()                   A_CMN(intr._intr_init())
338
339 #define  A_INTR_DISABLE(pOld)                           \
340     do {                                                \
341         *(pOld) = A_CMN(intr._intr_disable());        \
342     } while (0)
343
344 #define  A_INTR_RESTORE(old)            A_CMN(intr._intr_restore((old)))
345
346 #define A_INVOKE_ISR(inum)              A_CMN(intr._intr_invoke_isr(inum))
347
348 #define A_INTR_MASK(inum)               A_CMN(intr._intr_mask_inum(inum))
349 #define A_INTR_UNMASK(inum)             A_CMN(intr._intr_unmask_inum(inum))
350
351 #define A_ATTACH_ISR(inum, isr, arg)    A_CMN(intr._intr_attach_isr(inum, isr, arg))
352 #else
353 #define A_INTR_INIT()
354 #define  A_INTR_DISABLE(pOld)
355 #define  A_INTR_RESTORE(old)
356
357 #define A_INTR_GET_INTRENABLE()
358 #define A_INTR_SET_INTRENABLE(val)
359 #define A_INTR_GET_INTRPENDING()
360 #define A_INTR_UNBLOCK_ALL_INTRLVL()
361 #define A_INVOKE_ISR(inum)
362 #define A_INTR_MASK(inum)
363 #define A_INTR_UNMASK(inum)
364 #define A_ATTACH_ISR(inum, isr, arg)
365
366 #endif
367
368 /* Tasklet Support */
369 #define A_TASKLET_INIT()                    A_CMN(tasklet._tasklet_init())
370 #define A_TASKLET_INIT_TASK(f, arg, t)      A_CMN(tasklet._tasklet_init_task(f, arg, t))
371 #define A_TASKLET_DISABLE(t)                A_CMN(tasklet._tasklet_disable(t))
372 #define A_TASKLET_SCHEDULE(t)               A_CMN(tasklet._tasklet_schedule(t))
373 #define A_TASKLET_RUN()                     A_CMN(tasklet._tasklet_run())
374
375
376 /* RAM Allocation Support */
377 #if defined(__mips__)
378 #define alloc_arena_start _end
379 #endif
380 #if defined(__XTENSA__)
381 #define alloc_arena_start _end
382 #endif
383
384 #if SYSTEM_MODULE_CLOCK
385
386 #define A_CLOCK_INIT(refclk_guess)      A_CMN(clock._clock_init(refclk_guess))
387 #define A_CLOCK_TICK()                  A_CMN(clock._clock_tick())
388 #define A_CLOCK_GET_TICK()              A_CMN(clock._clock_get_tick())
389
390 /*
391  * Get the number of millisecond ticks since the system was started.
392  * Note that this only approximates 1Ms.  It's actually 32 ticks of
393  * a 32KHz clock.
394  *
395  * Returns a A_UINT32 value.
396  */
397 #define A_MILLISECONDS()                A_CMN(clock._milliseconds())
398
399 /*
400  * Get the frequency of the reference clock, expressed as
401  * an A_refclk_speed_t.
402  */
403 #define A_REFCLK_SPEED_GET()            A_CMN(clock._refclk_speed_get())
404
405 /* Spin delay */
406 #define A_DELAY_USECS(us)               A_CMN(clock._delay_us(us))
407
408 #define A_UART_FREQUENCY()              A_CMN(clock._uart_frequency())
409
410 #define A_CLOCKREGS_INIT()              A_CMN(clock._clockregs_init())
411
412 /* which_band is either A_BAND_24GHZ or A_BAND_5GHZ */
413 #define A_WLAN_BAND_SET(which_band)      \
414         A_CMN(clock._wlan_band_set(which_band))
415
416 /* Called whenever the system clock changes speed */
417 #define A_SYSCLK_CHANGE(mhz)               A_CMN(clock._sysclk_change(mhz))
418
419 #define A_SYSCLK_GET()               A_CMN(clock._sysclk_get())
420
421 #else
422
423 #define A_CLOCK_INIT(refclk_guess)
424 #define A_CLOCK_TICK()
425 #define A_CLOCK_GET_TICK()
426 #define A_MILLISECONDS()
427 #define A_REFCLK_SPEED_GET()
428 #define A_DELAY_USECS(us)
429 #define A_UART_FREQUENCY()
430 #define A_CLOCKREGS_INIT()
431 #define A_WLAN_BAND_SET(which_band)
432 #define A_SYSCLK_CHANGE(mhz)
433 #define A_SYSCLK_GET()
434
435 #endif
436
437 // Timer
438 #define A_INIT_TIMER(pTimer, pFunction, pArg) \
439     A_CMN(timer._timer_setfn((pTimer), (pFunction), (pArg)))
440
441 /* Set a (possibly periodic) timer for "period" Milliseconds. */
442 #define A_TIMEOUT_MS(pTimer, period) \
443     A_CMN(timer._timer_arm((pTimer), (period)))
444
445 #define A_UNTIMEOUT(pTimer) \
446     A_CMN(timer._timer_disarm(pTimer))
447
448 #define A_TIMER_RUN() \
449     A_CMN(timer._timer_run())
450
451 #define A_PCI_BOOT_INIT() \
452     A_CMN(pci.pci_boot_init()) 
453
454 #define A_GMAC_BOOT_INIT() \
455     A_CMN(gmac.gmac_boot_init()) 
456
457 #if SYSTEM_MODULE_ALLOCRAM
458 /* Default size of ALLOCRAM area */
459 #define ARENA_SZ_DEFAULT 12000
460
461 #define A_ALLOCRAM_INIT(arena_start, arena_size)                        \
462         do {                                                            \
463                 extern unsigned int alloc_arena_start;                  \
464                 void *astart;                                           \
465                 int asize;                                              \
466                 astart = (arena_start) ? (void *)(arena_start) : &alloc_arena_start; \
467                 asize = (arena_size) ? (arena_size) : (ARENA_SZ_DEFAULT); \
468                 A_CMN(allocram.cmnos_allocram_init((astart), (asize))); \
469         } while (0)
470
471 #define A_ALLOCRAM(nbytes)      A_CMN(allocram.cmnos_allocram(0, (nbytes)))
472
473 #define A_ALLOCRAM_DEBUG()    A_CMN(allocram.cmnos_allocram_debug())
474
475 #else
476 #define A_ALLOCRAM_INIT(arena_start, arena_size)
477 #define A_ALLOCRAM(nbytes)
478 #define A_ALLOCRAM_DEBUG()
479 #endif
480
481 #if SYSTEM_MODULE_ROM_PATCH
482
483 #define A_ROMP_INIT()           A_CMN(romp._romp_init())
484 #define A_ROMP_DOWNLOAD(x)      A_CMN(romp._romp_download(x))
485 #define A_ROMP_DECODE(addr)     A_CMN(romp._romp_decode(addr))
486 #define A_ROMP_INSTALL()        A_CMN(romp._romp_install())
487 #else
488 #define A_ROMP_INIT()
489 #define A_ROMP_DOWNLOAD(x)
490 #define A_ROMP_DECODE(addr)
491 #define A_ROMP_INSTALL()
492 #endif
493
494 #if SYSTEM_MODULE_WDT
495
496 #define A_WDT_INIT()            A_CMN(wdt_timer._wdt_init())
497 #define A_WDT_ENABLE()          A_CMN(wdt_timer._wdt_enable())
498 #define A_WDT_DISABLE()         A_CMN(wdt_timer._wdt_disable())
499 #define A_WDT_SET(t)            A_CMN(wdt_timer._wdt_set(t))
500 #define A_WDT_TASK()            A_CMN(wdt_timer._wdt_task())
501 #define A_WDT_LASTBOOT()        A_CMN(wdt_timer._wdt_last_boot())
502 #define A_WDT_RESET()           A_CMN(wdt_timer._wdt_reset())
503
504 #else
505 #define A_WDT_INIT()
506 #define A_WDT_ENABLE()
507 #define A_WDT_DISABLE()
508 #define A_WDT_SET(t)
509 #define A_WDT_TASK()
510 #define A_WDT_LASTBOOT()
511 #define A_WDT_RESET()
512 #endif
513
514
515 #if SYSTEM_MODULE_EEPROM
516 #define A_EEP_INIT()                    A_CMN(eep._eep_init())
517 #define A_EEP_READ(off, len, buf)       A_CMN(eep._eep_read(off, len, buf))
518 #define A_EEP_WRITE(off, len, buf)      A_CMN(eep._eep_write(off, len, buf))
519 #define A_EEP_IS_EXIST()                A_CMN(eep._eep_is_exist())
520 #else
521 #define A_EEP_INIT()
522 #define A_EEP_READ(off, len, buf)
523 #define A_EEP_WRITE(off, len, buf)
524 #define A_EEP_IS_EXIST()
525 #endif
526
527
528
529 struct _A_os_linkage_check; /* OS-dependent */
530
531 typedef struct _A_cmnos_indirection_table {
532     int (* hal_linkage_check)(int sz, struct _A_os_linkage_check *);
533     unsigned int *start_bss;
534     void (* app_start)(void);
535
536 #if SYSTEM_MODULE_MEM
537     struct mem_api    mem;
538 #endif
539
540 #if SYSTEM_MODULE_MISC
541     struct misc_api     misc;
542 #endif
543
544 #if SYSTEM_MODULE_PRINT
545     struct printf_api    printf;
546 #endif
547
548 #if SYSTEM_MODULE_UART
549     struct uart_api      uart;
550 #endif
551
552 #if SYSTEM_MODULE_DBG
553 #if !MOVE_DBG_TO_RAM // move to firmware not in cmnos
554     struct dbg_api      dbg;
555 #endif
556 #endif
557 #if SYSTEM_MODULE_PCI
558    struct pci_api pci;
559 #endif
560
561 #if SYSTEM_MODULE_GMAC
562    struct gmac_api gmac;
563 #endif
564
565 #if SYSTEM_MODULE_USB
566     struct usb_api      usb;
567 #endif
568
569 #if SYSTEM_MODULE_CLOCK
570     struct clock_api     clock;
571 #endif
572
573 #if SYSTEM_MODULE_TIMER
574     struct timer_api     timer;
575 #endif
576
577 #if SYSTEM_MODULE_INTR
578     struct intr_api     intr;
579 #endif
580
581 #if SYSTEM_MODULE_ALLOCRAM
582     struct allocram_api     allocram;
583 #endif
584
585 #if SYSTEM_MODULE_ROM_PATCH
586     struct romp_api     romp;
587 #endif
588
589 #if SYSTEM_MODULE_WDT
590     struct wdt_api     wdt_timer;
591 #endif
592
593 #if SYSTEM_MODULE_EEPROM
594     struct eep_api     eep;
595 #endif
596
597     struct string_api   string;
598     struct tasklet_api  tasklet;
599
600 } _A_cmnos_indirection_table_t;
601
602 /* Module installation  for cmnos modules */
603
604 #if SYSTEM_MODULE_MEM
605 extern void cmnos_mem_module_install(struct mem_api *);
606 #endif
607
608 #if SYSTEM_MODULE_MISC
609 extern void cmnos_misc_module_install(struct misc_api *);
610 #endif
611
612 #if SYSTEM_MODULE_PRINT
613 extern void cmnos_printf_module_install(struct printf_api *);
614 #endif
615
616 #if SYSTEM_MODULE_UART
617 extern void cmnos_uart_module_install(struct uart_api *);
618 #endif
619
620 #if SYSTEM_MODULE_DBG
621 extern void cmnos_dbg_module_install(struct dbg_api *);
622 #endif
623
624 #if SYSTEM_MODULE_USB
625 extern void cmnos_usb_module_install(struct usb_api *);
626 #endif
627
628 #if SYSTEM_MODULE_INTR
629 extern void cmnos_intr_module_install(struct intr_api *);
630 #endif
631
632 #if SYSTEM_MODULE_CLOCK
633 extern void cmnos_clock_module_install(struct clock_api *);
634 #endif
635
636 #if SYSTEM_MODULE_TIMER
637 extern void cmnos_timer_module_install(struct timer_api *);
638 #endif
639
640 #if SYSTEM_MODULE_ALLOCRAM
641 extern void cmnos_allocram_module_install(struct allocram_api *);
642 #endif
643
644 #if SYSTEM_MODULE_ROM_PATCH
645 extern void cmnos_romp_module_install(struct romp_api *);
646 #endif
647
648 #if SYSTEM_MODULE_WDT
649 extern void cmnos_wdt_module_install(struct wdt_api *);
650 #endif
651
652 #if SYSTEM_MODULE_EEPROM
653 extern void cmnos_eep_module_install(struct eep_api *);
654 #endif
655
656 #if SYSTEM_MODULE_PCI
657 extern void cmnos_pci_module_install(struct pci_api *);
658 #endif
659
660 extern void cmnos_tasklet_module_install(struct tasklet_api *);
661
662 extern void cmnos_string_module_install(struct string_api *tbl);
663
664 #endif /* __CMNOS_API_H__ */