/*---------------------------------------------------------------------------*
  Project:  WiiConnect24
  File:     NWC24Ipc.h

  Copyright 2006 Nintendo.  All rights reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law.  They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Log: NWC24Ipc.h,v $
  Revision 1.2  2008/05/23 18:08:22  horti
  dos2unix a bunch of STM files.

  Revision 1.1  2008/05/23 17:55:14  horti
  Add new stm header.

  Revision 1.7  2007/06/07 13:36:29  hirose_kazuki
  Added definition of NWC24_IPC_REQUEST_SET_SCRIPTMODE.

  Revision 1.6  2006/10/21 10:21:50  adachi_hiroaki
  Added function for waking up from stand-by mode.

  Revision 1.5  2006/10/20 04:42:18  adachi_hiroaki
  Added NWC24_IPC_REQUEST_SET_DEBUGMODE and NWC24_IPC_OPENFLAGS_* .

  Revision 1.4  2006/10/18 13:27:12  hirose_kazuki
  Added NWC24_IPC_REQUEST_SET_FILTER.

  Revision 1.3  2006/10/18 04:56:52  adachi_hiroaki
  Changed name of IPC functions, and Added argment to Open.
  Added functions for asynchronous operation.

  Revision 1.2  2006/09/11 05:28:41  hirose_kazuki
  Added definition of NWC24_IPC_REQUEST_GET_STAT.

  Revision 1.1  2006/09/08 04:28:06  adachi_hiroaki
  Initial check in.


 *---------------------------------------------------------------------------*/

#ifndef NWC24IPC_H_
#define NWC24IPC_H_

#ifdef  __cplusplus
extern "C" {
#endif

#ifdef RVL_OS
#include <private/iostypes.h>
#include <private/iosresclt.h>
#endif //RVL_OS

//#include <revolution/nwc24/NWC24Err.h>

/*---------------------------------------------------------------------------*
    IPC uitility functions
 *---------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------*
    Macros
 *---------------------------------------------------------------------------*/

/* IPC resource manager path */
#define     NWC24_PATH_RESOURCEMANAGER                  "/dev/net/kd/request"
#define     NWC24_PATH_RESOURCEMANAGER_TIME             "/dev/net/kd/time"

/* IPC request ID */
#define     NWC24_IPC_REQUEST_SUSPEND_SCHEDULER         1
#define     NWC24_IPC_REQUEST_TRY_SUSPEND_SCHEDULER     2
#define     NWC24_IPC_REQUEST_RESUME_SCHEDULER          3
#define     NWC24_IPC_REQUEST_GET_SCHEDULE              4
#define     NWC24_IPC_REQUEST_SET_SCHEDULE              5
#define     NWC24_IPC_REQUEST_STARTUP_SOCKET            6
#define     NWC24_IPC_REQUEST_CLEANUP_SOCKET            7
#define     NWC24_IPC_REQUEST_LOCK_SOCKET               8
#define     NWC24_IPC_REQUEST_UNLOCK_SOCKET             9

#define     NWC24_IPC_REQUEST_CHECK_MAIL_NOW            10
#define     NWC24_IPC_REQUEST_SEND_MAIL_NOW             11
#define     NWC24_IPC_REQUEST_RECEIVE_MAIL_NOW          12
#define     NWC24_IPC_REQUEST_SAVE_MAIL_NOW             13
#define     NWC24_IPC_REQUEST_DOWNLOAD_NOW              14

#define     NWC24_IPC_REQUEST_GENERATE_ID               15
#define     NWC24_IPC_REQUEST_REGISTER_ID               16

#define     NWC24_IPC_REQUEST_GET_TIME                  20
#define     NWC24_IPC_REQUEST_SET_TIME                  21
#define     NWC24_IPC_REQUEST_GET_RTC_COUNTER           22
#define     NWC24_IPC_REQUEST_SET_RTC_COUNTER           23
#define     NWC24_IPC_REQUEST_GET_TIME_DIFFERENCE       24

#define     NWC24_IPC_REQUEST_GET_STAT                  30
#define     NWC24_IPC_REQUEST_SET_FILTER                31
#define     NWC24_IPC_REQUEST_SET_DEBUGMODE             32
#define     NWC24_IPC_REQUEST_SET_WAKEUP_ALARM          33
#define     NWC24_IPC_REQUEST_SET_SCRIPTMODE            34

#define     NWC24_IPC_REQUEST_SHUTDOWN                  40

#define     NWC24_IPC_OPENFLAGS_NORMAL                  0
#define     NWC24_IPC_OPENFLAGS_PPCSHUTDOWN             1
#define     NWC24_IPC_OPENFLAGS_STMSHUTDOWN             2

/*---------------------------------------------------------------------------*
    Type definitions
 *---------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------*
    Function prototypes
 *---------------------------------------------------------------------------*/

#ifdef RVL_OS
NWC24Err NWC24iOpenResourceManager( const char* funcName,
                                    const char* path,
                                    IOSFd* pFd,
                                    u32 flags );
NWC24Err NWC24iCloseResourceManager( const char* funcName, IOSFd fd );
NWC24Err NWC24iCloseResourceManagerAsync( const char* funcName, IOSFd fd, IOSError* ret );
NWC24Err NWC24iIoctlResourceManager( const char* funcName, 
                                     IOSFd fd, s32 cmd, 
                                     void *input, u32 input_bytes, 
                                     void *output, u32 output_bytes);

NWC24Err NWC24iIoctlResourceManagerAsync( const char* funcName, 
                                          IOSFd fd, s32 cmd, 
                                          void *input, u32 input_bytes, 
                                          void *output, u32 output_bytes,
                                          IOSError* ret );
                                          
BOOL     NWC24iIsAsyncRequestPending( void );
#endif //RVL_OS


/*---------------------------------------------------------------------------*/
#ifdef  __cplusplus
}       /* extern "C" */
#endif  /* __cplusplus */

#endif  /* NWC24IPC_H_ */

/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
