1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - tools - loadrun
3   File:     isd_api.h
4 
5   Copyright 2007-2008 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   $Date:: 2008-09-17#$
14   $Rev: 8556 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 #ifndef TWL_LOADRUN_ISD_API_H_
18 #define TWL_LOADRUN_ISD_API_H_
19 
20 #include "ISTWLDLL.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 //---- For versions 0.63 and earlier
27 #ifndef ISD_FUNC_MODEHYBRID
28 #define	ISD_FUNC_MODEHYBRID	 "ISDSetHybridMode"
29 typedef enum { ISDHYBRID_TWL, ISDHYBRID_NTR } ISDHYBRIDMODE;
30 typedef BOOL (_cdecl *ISD_SETHYBRIDMODE)( ISDDEVICEHANDLE hDevice, ISDHYBRIDMODE eMode );
31 #endif
32 
33 // Public functions
34 extern ISD_STREAMRECVCB ISTD_StreamRecvCB;
35 extern ISD_PRINTFRECVCB ISTD_PrintfRecvCB;
36 extern ISD_ENUMDEVICECB ISTD_EnumDeviceCB;
37 extern ISD_GETVERSION   ISTD_GetVersion;
38 extern ISD_FINDOPEN     ISTD_FindOpen;
39 extern ISD_FINDNEXT     ISTD_FindNext;
40 extern ISD_FINDCLOSE    ISTD_FindClose;
41 extern ISD_DEVSELECTOR  ISTD_DevSelector;
42 extern ISD_OPEN         ISTD_Open;
43 extern ISD_OPENEX       ISTD_OpenEx;
44 extern ISD_CLOSE        ISTD_Close;
45 extern ISD_GETDEVICEID  ISTD_GetDeviceID;
46 extern ISD_CHECKCONNECT ISTD_CheckConnect;
47 extern ISD_SETHYBRIDMODE ISTD_SetHybridMode;
48 extern ISD_DOWNLOADGO   ISTD_DownloadGo;
49 extern ISD_RESET        ISTD_Reset;
50 extern ISD_WRITEROM     ISTD_WriteROM;
51 extern ISD_READROM      ISTD_ReadROM;
52 extern ISD_ROMSIZE      ISTD_RomSize;
53 //extern ISD_STREAMSETCB  ISTD_StreamSetCB;
54 extern ISD_PRINTFSETCB  ISTD_PrintfSetCB;
55 extern ISD_GETLASTERROR ISTD_GetLastError;
56 extern ISD_GETERRORMESSAGE ISTD_GetErrorMessage;
57 
58 //---- Device type
59 #define ISTD_DEVICE_NONE                   0
60 #define ISTD_DEVICE_IS_TWL_EMULATOR        1
61 #define ISTD_DEVICE_IS_TWL_DEBUGGER        2
62 #define ISTD_DEVICE_UNKNOWN                3
63 
64 
65 typedef struct ISTDDevice ISTDDevice;
66 struct ISTDDevice
67 {
68     ISDDEVICEID id;
69     int         type;
70     int         host;
71     int         serial;
72 };
73 
74 typedef enum enumTWLArch {
75     TWLArchARM9   = ISDCPUArchARM9,
76     TWLArchARM7   = ISDCPUArchARM7,
77 
78     TWLArchNone   = -1
79 } TWLArch;
80 
81 /*---------------------------------------------------------------------------*
82   Name:         ISTD_InitDll
83 
84   Description:  Initializes DLL.
85 
86   Arguments:    None.
87 
88   Returns:      TRUE   if success
89  *---------------------------------------------------------------------------*/
90 extern BOOL ISTD_InitDll(void);
91 
92 /*---------------------------------------------------------------------------*
93   Name:         ISTD_FreeDll
94 
95   Description:  Frees DLL module.
96 
97   Arguments:    None.
98 
99   Returns:      TRUE   if success
100  *---------------------------------------------------------------------------*/
101 extern BOOL ISTD_FreeDll(void);
102 
103 
104 /*---------------------------------------------------------------------------*
105   Name:         ISTD_GetDeviceList
106 
107   Description:  Gets connecting device list.
108 
109   Arguments:    deviceList: Pointer of list
110                 deviceMax: Max number of list
111 
112   Returns:      -1 if FAIL
113                 >=0 value is num of device which is connected
114  *---------------------------------------------------------------------------*/
115 extern int ISTD_GetDeviceList(ISTDDevice * deviceList, int deviceMax);
116 
117 
118 #ifdef __cplusplus
119 } /* extern "C" */
120 #endif
121 
122 /* TWL_LOADRUN_ISD_API_H_ */
123 #endif
124