1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - include - DBGHOST
3   File:     dbghost.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-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 #ifndef NITRO_DBGHOST_H_
18 #define NITRO_DBGHOST_H_
19 
20 #ifndef _IOREAD
21 #define _IOREAD         0x01
22 #define _IOWRITE        0x02
23 #define _IORW           0x04
24 #define _IOEOF          0x08
25 #define _IOFLUSH        0x10
26 #define _IOERR          0x20
27 #define _IOSTRING       0x40
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 void dbghostInit(void);
35 
36 struct ffblk {
37     char ff_reserved[23];
38     char ff_attrib;
39     unsigned short ff_ftime;
40     unsigned short ff_fdate;
41     struct {
42         unsigned short low,high;
43     } ff_fsize;
44     char  ff_name[255+1];
45 };
46 
47 typedef struct {
48 unsigned year;
49 unsigned mon;
50 unsigned day;
51 unsigned hour;
52 unsigned min;
53 unsigned sec;
54 unsigned msec;
55 } Dbghost_dos_time;
56 
57 int dbghost_dos_put_console(char c);
58 int dbghost_dos_putstring_console(char *str,int size);
59 int dbghost_dos_stat_console(void);
60 int dbghost_dos_get_console(void);
61 int dbghost_dos_open(char *fname,int mode);
62 int dbghost_dos_creat(char *fname,int mode);
63 int dbghost_dos_read(int fd,char *buf,int size);
64 int dbghost_dos_write(int fd,char *buf,int size);
65 int dbghost_dos_close(int fd);
66 int dbghost_dos_lseek(int fd,int ofs,int pos);
67 int dbghost_dos_file_mode(char *fname,int mode,int action);
68 int dbghost_dos_set_dta(struct ffblk *fbp);
69 int dbghost_dos_find_first(char *fname,unsigned attrib);
70 int dbghost_dos_find_next(void);
71 int dbghost_dos_find_close(void);
72 int dbghost_dos_get_ioctl(int fd);
73 int dbghost_dos_get_file_time(int fd,unsigned short *timep);
74 int dbghost_dos_get_time(Dbghost_dos_time *dtp);
75 int dbghost_dos_set_file_time(int fd,unsigned short *timep);
76 int dbghost_dos_mkdir(char *path);
77 int dbghost_dos_rmdir(char *path);
78 int dbghost_dos_remove(char *fname);
79 int dbghost_dos_rename(char *old,char *new);
80 int dbghost_dos_getcwd(char *path,int drvno);
81 int dbghost_dos_chdir(char *path);
82 int dbghost_dos_getcdrv(void);
83 int dbghost_dos_dup(int fd);
84 int dbghost_dos_dup2(int oldfd,int newfd);
85 int dbghost_dos_version(void);
86 int dbghost_dos_exit(int retcode);
87 int dbghost_dos_sleep(int ms);
88 
89 int dbghostRead_VIO_pt(void *dramAddr, int nbytes);
90 int dbghostWrite_VIO_pt(void *dramAddr,int nbytes);
91 
92 int i_dbghost_init_osemu(void);
93 
94 void dbghost_dos_printf(const char *text, ...);
95 void dbghost_dos_fprintf(int fd, const char *text, ...);
96 
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif // NITRO_DBGHOST_H_
103