1 /*---------------------------------------------------------------------------*
2   Project:  MPDS library
3   File:     mpdsprivate.h
4 
5   Copyright 2007 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: mpdsprivate.h,v $
14   Revision 1.3  2007/10/22 09:41:25  seiki_masashi
15   Moved the MPDSStatus enumerated type.
16 
17   Revision 1.2  2007/10/17 12:48:16  seiki_masashi
18   Changed constants for debug output.
19 
20   Revision 1.1  2007/10/10 08:37:07  seiki_masashi
21   Added the MPDS library.
22 
23   $NoKeywords: $
24  *---------------------------------------------------------------------------*/
25 
26 #ifndef LIBRARIES_MPDS_MPPRIVATE_H__
27 #define LIBRARIES_MPDS_MPPRIVATE_H__
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 /*===========================================================================*/
32 
33 #include <revolution/mp.h>
34 
35 //////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NDEBUG
38 #endif
39 
40 //////////////////////////////////////////////////////////////////////////////
41 
42 // Data Sharing's internal state
43 typedef enum MPDSState
44 {
45     MPDS_STATE_READY = 0,               // Before MPDSSetupPortConfig
46     MPDS_STATE_START,                   // After MPDSStep
47     MPDS_STATE_PAUSING,                 // While transitioning to the pause state
48     MPDS_STATE_PAUSED,                  // Immediately after MPDSSetupPortConfig or during pause
49     MPDS_STATE_RETRY_SEND,              // Resend required because of SEND_QUEUE_FULL
50     MPDS_STATE_ERROR                    // Error generated
51 }
52 MPDSState;
53 
54 //////////////////////////////////////////////////////////////////////////////
55 
56 extern u32 MPDSi_debugLevel;
57 
58 #define MPDSi_IS_DEBUG_LEVEL( level ) ((MPDSi_debugLevel & level) != 0)
59 
60 #define MPDSi_DEBUG_LEVEL_IMPORTANTS (MPDS_DEBUG_LEVEL_WARNING|MPDS_DEBUG_LEVEL_ERROR)
61 
62 //////////////////////////////////////////////////////////////////////////////
63 
64 #ifdef  NDEBUG
65 
66 #define MPDSiLog( level, ... )    ( (void)0 )
67 #define MPDSiError( ... )    ( (void)0 )
68 #define MPDSiWarning( ... )  ( (void)0 )
69 #define MPDSiReport( ... )   ( (void)0 )
70 #define MPDSiTrace( ... )    ( (void)0 )
71 
72 #else   // NDEBUG
73 
74 void    MPDSiLogCore( u32 level, const char* levelString, const char* file, const char* func, int line, const char* fmt, ... );
75 void    MPDSiVLogCore( u32 level, const char* levelString, const char* file, const char* func, int line, const char* fmt, va_list vlist );
76 
77 #define MPDSiLog( level, ... )    MPDSiLogCore( MPDS_DEBUG_LEVEL_##level, #level, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
78 #define MPDSiError( ... )         MPDSiLogCore( MPDS_DEBUG_LEVEL_ERROR, "Error", __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
79 #define MPDSiWarning( ... )       MPDSiLogCore( MPDS_DEBUG_LEVEL_WARNING, "Warning", __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
80 #define MPDSiReport( ... )        MPDSiLogCore( MPDS_DEBUG_LEVEL_REPORT, "Report", __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
81 #define MPDSiTrace( ... )         MPDSiLogCore( MPDS_DEBUG_LEVEL_TRACE, "Trace", __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
82 
83 #endif  // NDEBUG
84 
85 //////////////////////////////////////////////////////////////////////////////
86 
87 
88 /*===========================================================================*/
89 #ifdef __cplusplus
90 }
91 #endif
92 #endif  /* REVOLUTION_MPDS_MPPRIVATE_H__ */
93 
94 /*---------------------------------------------------------------------------*
95   End of file
96  *---------------------------------------------------------------------------*/
97