/*---------------------------------------------------------------------------* Project: HIO2 demos - multi File: multi.h (C)2005 HUDSON SOFT $Header: /home/cvsroot/SDK/build/demos/hio2demo/include/multi.h,v 1.4 2007/11/26 13:54:06 iwai_yuma Exp $ $NoKeywords: $ *---------------------------------------------------------------------------*/ #ifndef __MULTI_H__ #define __MULTI_H__ #ifdef __cplusplus extern "C" { #endif #pragma warning(disable: 4996) // Macros #ifdef WIN32 #define SWAP16(w) ((((w) >> 8) & 0x00FF) | (((w) << 8) & 0xFF00)) #else #define SWAP16(w) (w) #endif // Data transfer packet typedef struct { u8 mon; // Months since January [0, 11] u8 mday; // Day of the month [1, 31] u8 hour; // Hours since midnight [0, 23] u8 min; // Minutes after the hour [0, 59] u8 sec; // Seconds after the minute [0, 61] u8 align; u16 msec; // Milliseconds after the second [0,999] char string[24]; // Message } MULTI_PACKET; // EXI-USB memory mapping #define MULTI_BUFFER_SIZE sizeof(MULTI_PACKET) #define MULTI_PC2NNGC_ADDR 0x1000 #define MULTI_NNGC2PC_ADDR (MULTI_PC2NNGC_ADDR + MULTI_BUFFER_SIZE) // Inline function - MULTI_PACKET to string static inline //void MultiPacketToString( char *string, u32 bufSize, MULTI_PACKET* packet ) void MultiPacketToString( char *string, MULTI_PACKET* packet ) { // (void)sprintf_s( string, bufSize, "%s, %02d/%02d %02d:%02d:%02d %03d", // packet->string, // packet->mon, packet->mday, // packet->hour, packet->min, packet->sec, SWAP16(packet->msec) // ); (void)sprintf( string, "%s, %02d/%02d %02d:%02d:%02d %03d", packet->string, packet->mon, packet->mday, packet->hour, packet->min, packet->sec, SWAP16(packet->msec) ); } #ifdef __cplusplus } #endif #endif // __MULTI_H__