#ifndef GENERIC_FI_H
#define GENERIC_FI_H

/* Compilers may use another function within the assert macro to exit the 
 * program. QAC thus does not see an "exit" function and assumes the 
 * function returns, which it does not.
 * The below pragma tells QAC the compiler supplied function does not
 * return.
 */

/* examples - GCC, ICC, BCC 3.1, BCC 5.5, CYGWIN gcc, Watcom 1.6 */
#pragma PRQA_NO_RETURN __assert_fail
#pragma PRQA_NO_RETURN __assert_perror_fail
#pragma PRQA_NO_RETURN __assert

/* SDCC, BCC 5.5, Digital Mars DM 8.4, LCC, Watcom 1.6, Fujitsu F2MM,FR */
#pragma PRQA_NO_RETURN _assert

/* HI-TECH PCCLite */
#pragma PRQA_NO_RETURN _fassert

/* DJGPP, D.J.Delorie gcc DOS port */
#pragma PRQA_NO_RETURN __dj_assert

/* Watcom 1.6, MSVS 08 */
#pragma PRQA_NO_RETURN _wassert
#pragma PRQA_NO_RETURN __wassert
#pragma PRQA_NO_RETURN _assert99
#pragma PRQA_NO_RETURN _wassert99
#pragma PRQA_NO_RETURN __assert99
#pragma PRQA_NO_RETURN __wassert99

/* Renesas M32R compiler */
#pragma PRQA_NO_RETURN _Assert

/* NEC 78K0 series 16bit compiler */
#pragma PRQA_NO_RETURN __assertfail
#pragma PRQA_NO_RETURN __assertfail_n
#pragma PRQA_NO_RETURN __assertfail_f

/* Depending on the code that the compiler maker uses within the assert macro,
 * QAC may issue warnings. It is also possible that when the NDEBUG macro is used
 * to suppress the assertion code, QAC may issue a "no side-effects" warning.
 * To eliminate these, we turn off all warnings for the assert macro.
 */
#pragma PRQA_MACRO_MESSAGES_OFF "assert"

/* Any other items that may be required in a "force-include" file should be placed below. */

/* builtin bank function prototypes */

unsigned long __BANK0(unsigned int addr);
unsigned long __BANK1(unsigned int addr);
unsigned long __BANK2(unsigned int addr);
unsigned long __BANK3(unsigned int addr);
unsigned long __BANK4(unsigned int addr);
unsigned long __BANK5(unsigned int addr);
unsigned long __BANK6(unsigned int addr);
unsigned long __BANK7(unsigned int addr);
unsigned long __BANK8(unsigned int addr);
unsigned long __BANK9(unsigned int addr);
unsigned long __BANK10(unsigned int addr);
unsigned long __BANK11(unsigned int addr);
unsigned long __BANK12(unsigned int addr);
unsigned long __BANK13(unsigned int addr);
unsigned long __BANK14(unsigned int addr);
unsigned long __BANK15(unsigned int addr);

/* functions for absolute address accessing.
 * Used with #pragma realregister directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned char __geta(void);
void __seta(unsigned char x);
unsigned int __getax(void);
void __setax(unsigned int x);
bit __getcy(void);
void __setcy(unsigned char x);
void __set1cy(void);
void __clr1cy(void);
void __not1cy(void);
void __inca(void);
void __deca(void);
void __rora(void);
void __rorca(void);
void __rola(void);
void __rolca(void);
void __shla(void);
void __shra(void);
void __ashra(void);
void __nega(void);
void __coma(void);
void __absa(void);

/* functions for absolute address accessing.
 * Used with #pragma hromcall directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned char __hromcall(unsigned int entryaddr, unsigned char funcno, void *entrydata);
unsigned char __hromcalla(unsigned int entryaddr, unsigned char funcno, void *entrydata);
void __setsp(unsigned int spaddr);

/* functions for absolute address accessing.
 * Used with #pragma access directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned char peekb(unsigned int addr);
unsigned int peekw(unsigned int addr);
void pokeb(unsigned int addr, unsigned char data);
void pokew(unsigned int addr, unsigned int data);

/* functions for absolute address accessing.
 * Used with #pragma rot directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned char rorb(unsigned char x, unsigned char y);
unsigned char rolb(unsigned char x, unsigned char y);
unsigned int rorw(unsigned int x, unsigned char y);
unsigned int rolw(unsigned int x, unsigned char y);

/* functions for absolute address accessing.
 * Used with #pragma mul directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned int mulu(unsigned char x, unsigned char y);

/* functions for absolute address accessing.
 * Used with #pragma div directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned int divuw(unsigned int x, unsigned char y);
unsigned char moduw(unsigned int x, unsigned char y);

/* functions for absolute address accessing.
 * Used with #pragma bcd directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
unsigned char adbcdb(unsigned char x, unsigned char y);
unsigned char sbbcdb(unsigned char x, unsigned char y);
unsigned int adbcdbe(unsigned char x, unsigned char y);
unsigned int sbbcdbe(unsigned char x, unsigned char y);
unsigned int adbcdw(unsigned int x, unsigned int y);
unsigned int sbbcdw(unsigned int x, unsigned int y);
unsigned long adbcdwe(unsigned int x, unsigned int y);
unsigned long sbbcdwe(unsigned int x, unsigned int y);
unsigned char bcdtob(unsigned char x);
unsigned int btobcde(unsigned char x);
unsigned int bcdtow(unsigned int x);
unsigned int wtobcd(unsigned int x);
unsigned char btobcd(unsigned char x);

/* functions for absolute address accessing.
 * Used with #pragma opc directive.
 * If a user supplies the functions, these 
 * prototypes should be removed.
 */
void __OPC(unsigned char x, ...);

void __DI(void);
void __EI(void);
#else
#error "Multiple include"
#endif /* ifndef GENERIC_FI_H */
