#ifndef PRL_RENESAS_FI_H
#define PRL_RENESAS_FI_H

#pragma PRQA_NO_RETURN _Assert
#pragma PRQA_MACRO_MESSAGES_OFF "assert"

#ifdef __CCRX__
/* 4.2.2 Keywords */
#define __evenaccess
#define far
#define _far
#define near
#define _near
/* 4.2.7 Section Address Operators */
#define __sectop(X) 0
#define __secend(X) 0
#define __secsize(X) 0
 
signed long __max(signed long data1, signed long data2);
signed long __min(signed long data1, signed long data2);
unsigned long __revl(unsigned long data);
unsigned long __revw(unsigned long data);
void __xchg(signed long *data1, signed long *data2);
long long __rmpab(long long init, unsigned long count, signed char *addr1, signed char *addr2);
long long __rmpaw(long long init, unsigned long count, short *addr1, short *addr2);
long long __rmpal(long long init, unsigned long count, long *addr1, long *addr2);
unsigned long __rolc(unsigned long data);
unsigned long __rorc(unsigned long data);
unsigned long __rotl(unsigned long data, unsigned long num);
unsigned long __rotr(unsigned long data, unsigned long num);
void __brk(void);
void __int_exception(signed long num);
void __wait(void);
void __nop(void);
void __set_ipl(signed long level);
unsigned char __get_ipl(void);
void __set_psw(unsigned long data);
unsigned long __get_psw(void);
void __set_fpsw(unsigned long data);
unsigned long __get_fpsw(void);
void __set_usp(void *data);
void *__get_usp(void);
void __set_isp(void *data);
void *__get_isp(void);
void __set_intb(void *data);
void *__get_intb(void);
void __set_bpsw(unsigned long data);
unsigned long __get_bpsw(void);
void __set_bpc(void *data);
void *__get_bpc(void);
void __set_fintv(void *data);
void *__get_fintv(void);
signed long long __emul(signed long data1, signed long data2);
unsigned long long __emulu(unsigned long data1, unsigned long data2);
void __chg_pmusr(void);
void __set_acc(signed long long data);
signed long long __get_acc(void);
void __setpsw_i(void);
void __clrpsw_i(void);
long __macl(short *data1, short *data2, unsigned long count);
short __macw1(short *data1, short *data2, unsigned long count);
short __macw2(short *data1, short *data2, unsigned long count);
void __set_extb(void *data);
void *__get_extb(void);
void __bclr(unsigned char *data, unsigned long bit);
void __bset(unsigned char *data, unsigned long bit);
void __bnot(unsigned char *data, unsigned long bit);
void __set_dpsw(unsigned long data);
unsigned long __get_dpsw(void);
void __set_decnt(unsigned long data);
unsigned long __get_decnt(void);
void __set_depc(void *data);
void *__get_depc(void);
#endif /* __CCRX__*/

#ifdef __CCRH__
extern void __DI(void);
extern void __EI(void);
void __set_il_rh(int NUM, void *ADDR);
extern void __nop(void);
extern void __halt(void);
extern long __satadd(long a, long b);
extern long __satsub(long a, long b);
extern long __bsh(long a);
extern long __bsw(long a);
extern long __hsw(long a);
extern long __mul32(long a, long b);
extern unsigned long __mul32u(unsigned long a, unsigned long b);
extern long __sch0l(long a);
extern long __sch0r(long a);
extern long __sch1l(long a);
extern long __sch1r(long a);
extern void __ldsr(long regID, unsigned long a);
extern void __ldsr_rh(long regID, long selID, unsigned long a);
extern unsigned long   __stsr(long regID);
extern unsigned long   __stsr_rh(long regID, long selID);
extern long __caxi(long *a, long b, long c);
extern void __clr1(unsigned char *a, long bit);
extern void __set1(unsigned char *a, long bit);
extern void __not1(unsigned char *a, long bit);
extern long __ldlw(long *a);
#if __RENESAS_VERSION__ < 0x01050000
extern void __stcw(long *a, long b);
#else
extern long __stcw(long *a, long b);
#endif
extern void __synce(void);
extern void __synci(void);
extern void __syncm(void);
extern void __syncp(void);
extern void __dbcp(void);
extern void __dbpush(long regID1, long regID2);
void __dbtag(long a);
#endif /* __CCRH__*/

#ifdef __CCRL__
#define __BASE_FILE__ __FILE__
/* 4.2.6 */
#define __saddr
#define __callt
#define __far
#define __near
#define __inline inline
#define __sectop(X) 0
#define __secend(X) 0

void __DI(void);
void __EI(void);
void __halt(void);
void __stop(void);
void __brk(void);
void __nop(void);
unsigned char __rolb(unsigned char x, unsigned char y);
unsigned char __rorb(unsigned char x, unsigned char y);
unsigned int __rolw(unsigned int x, unsigned char y);
unsigned int __rorw(unsigned int x, unsigned char y);
unsigned int __mulu(unsigned char x, unsigned char y);
unsigned long __mului(unsigned int x, unsigned int y);
signed long __mulsi(signed int x, signed int y);
unsigned long long __mulul(unsigned long x, unsigned long y);
signed long long __mulsl(signed long x, signed long y);
unsigned int __divui(unsigned int x, unsigned char y);
unsigned long __divul(unsigned long x, unsigned int y);
unsigned char __remui(unsigned int x, unsigned char y);
unsigned int __remul(unsigned long x, unsigned int y);
unsigned long __macui(unsigned int x, unsigned int y, unsigned long z);
signed long __macsi(signed int x, signed int y, signed long z);
unsigned char __get_psw(void);
void __set_psw(unsigned char x);
void __set1(unsigned char* x, unsigned char y);
void __clr1(unsigned char* x, unsigned char y);
void __not1(unsigned char* x, unsigned char y);
#endif /* __CCRL__ */

#ifdef __CA850__
#define __interrupt
#define __multi_interrupt
#define __rtos_interrupt
#define _asm asm
#define __asm asm
#endif /* __CA850__ */

#if defined(__CA78K0__) || defined(__CA78K0R__)
#define near
#define far
#define __near
#define __far
#define __callt
#define callt
#define __callf
#define callf
#define __sreg
#define sreg
#define noauto
#define __leaf
#define norec
#define __interrupt
#define __interrupt_brk
#define __pascal
#define __flash
#define __flashf
#define __directmap
#define __temp
#define __mxcall
#define __rtos_interrupt
#endif /* __CA78K0__ || __CA78K0R__ */

#ifdef __CX__
#define _asm asm
#define __asm asm
#endif /* __CX__ */

#endif
