Buffers    Files    Tools    Mule
/*
 * modeldef.h
 *
 * common defines model dependent
 *
 * include this before all other includes
 * use it in header files, too
 *
 * you need not include define.h, libc.h or l_libc.h when
 * you use this file, it automatically includes these for you
 *
 */

#ifndef modeldef_h_included
#define modeldef_h_included

#ifdef __HITACHI__ /* Hitachi compiler */

/*
 * Hitachi compiler needs explicit inclusion of these header files
 * if they are left out wrong code for e.g. sprintf is generated
 */

#include <stdio.h>
#include <string.h>

/*
 * these are for the PV related things
 */
#include <hitachi.h>
#include "libc.h"

/*
 * for code compatibility
 *
 * use FAR and NEAR instead of far and near in you projects
 * use far_xxxx whenever LSI compiler requires far variant
 */
#define FAR /* nothing */
#define NEAR /* nothing */
#define far_strcpy strcpy
#define far_strncpy strncpy
#define far_strcmp strcmp
#define far_strncmp strncmp
#define far_memcpy memcpy
#define far_strchr strchr
#define far_strrchr strrchr
#define far_memset memset
#define far_strlen strlen
#define far_strcat strcat
#define far_memcmp memcmp

/* some data access helpers */

/* GetLittleEndianWord works also on uneven addresses */
/* x is a pointer to data */
#define GETLEWORD(x) ( (unsigned short) ((unsigned char *)x)[0] + ( (unsigned short) ((unsigned char *)x)[1] << 8 ))

/* GetLittleEndianDWord works also on uneven addresses */
/* x is a pointer to data */
#define GETLEDWORD(x) ( (unsigned long) GETLEWORD(&((unsigned char *)x)[0]) + ( (unsigned long) GETLEWORD(&((unsigned char *)x)[2]) << 16 ))

#else /* LSI compiler */

/*
 * these are for the PV related things
 */

#include <stdrom.h>
#include "libc.h"
#include "l_libc.h"

/*
 * for code compatibility
 *
 * use FAR and NEAR instead of far and near in you projects
 *
 * there is some confusion about FILE_xxxx_MODE definitions in
 * old and new SDK
 * I prefer to use the new IMB_ defines in both projects
 */

#define FAR far
#define NEAR near

#define IMB_FILE_OPEN_MODE FILE_OPEN_MODE
#define IMB_FILE_SECRET_MODE FILE_SECRET_MODE

/* GetLittleEndianWord works also on uneven addresses */
/* x is a pointer to data */
#define GETLEWORD(x) ( ((unsigned short *)x)[0] )

/* GetLittleEndianDWord works also on uneven addresses */
/* x is a pointer to data */
#define GETLEDWORD(x) ( ((unsigned long *)x)[0] )

#endif /* ifdef __HITACHI__ */

#endif /* ifndef ...included */




--:%%  modeldef.h        (C/ah)--L1--C0--ALL------------
M-x view-file ../index.html