KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
fs_dcload.h
Go to the documentation of this file.
1 /* KallistiOS ##version##
2 
3  kernel/arch/dreamcast/include/dc/fs_dcload.h
4  (c)2002 Andrew Kieschnick
5 
6 */
7 
8 /** \file dc/fs_dcload.h
9  \brief Implementation of dcload "filesystem".
10 
11  This file contains declarations related to using dcload, both in its -ip and
12  -serial forms. This is only used for dcload-ip support if the internal
13  network stack is not initialized at start via KOS_INIT_FLAGS().
14 
15  \author Andrew Kieschnick
16  \see dc/fs_dclsocket.h
17 */
18 
19 #ifndef __DC_FS_DCLOAD_H
20 #define __DC_FS_DCLOAD_H
21 
22 /* Definitions for the "dcload" file system */
23 
24 #include <sys/cdefs.h>
25 __BEGIN_DECLS
26 
27 #include <arch/types.h>
28 #include <kos/limits.h>
29 #include <kos/fs.h>
30 #include <kos/dbgio.h>
31 
32 /* \cond */
33 extern dbgio_handler_t dbgio_dcload;
34 /* \endcond */
35 
36 /* dcload magic value */
37 /** \brief The dcload magic value! */
38 #define DCLOADMAGICVALUE 0xdeadbeef
39 
40 /** \brief The address of the dcload magic value */
41 #define DCLOADMAGICADDR (unsigned int *)0x8c004004
42 
43 /* Are we using dc-load-serial or dc-load-ip? */
44 #define DCLOAD_TYPE_NONE -1 /**< \brief No dcload connection */
45 #define DCLOAD_TYPE_SER 0 /**< \brief dcload-serial connection */
46 #define DCLOAD_TYPE_IP 1 /**< \brief dcload-ip connection */
47 
48 /** \brief What type of dcload connection do we have? */
49 extern int dcload_type;
50 
51 /* \cond */
52 /* Available dcload console commands */
53 
54 #define DCLOAD_READ 0
55 #define DCLOAD_WRITE 1
56 #define DCLOAD_OPEN 2
57 #define DCLOAD_CLOSE 3
58 #define DCLOAD_CREAT 4
59 #define DCLOAD_LINK 5
60 #define DCLOAD_UNLINK 6
61 #define DCLOAD_CHDIR 7
62 #define DCLOAD_CHMOD 8
63 #define DCLOAD_LSEEK 9
64 #define DCLOAD_FSTAT 10
65 #define DCLOAD_TIME 11
66 #define DCLOAD_STAT 12
67 #define DCLOAD_UTIME 13
68 #define DCLOAD_ASSIGNWRKMEM 14
69 #define DCLOAD_EXIT 15
70 #define DCLOAD_OPENDIR 16
71 #define DCLOAD_CLOSEDIR 17
72 #define DCLOAD_READDIR 18
73 #define DCLOAD_GETHOSTINFO 19
74 #define DCLOAD_GDBPACKET 20
75 
76 /* dcload syscall function */
77 
78 int dcloadsyscall(unsigned int syscall, ...);
79 
80 /* dcload dirent */
81 
82 struct dcload_dirent {
83  long d_ino; /* inode number */
84  off_t d_off; /* offset to the next dirent */
85  unsigned short d_reclen;/* length of this record */
86  unsigned char d_type; /* type of file */
87  char d_name[256]; /* filename */
88 };
89 
90 typedef struct dcload_dirent dcload_dirent_t;
91 
92 /* dcload stat */
93 
94 struct dcload_stat {
95  unsigned short st_dev;
96  unsigned short st_ino;
97  int st_mode;
98  unsigned short st_nlink;
99  unsigned short st_uid;
100  unsigned short st_gid;
101  unsigned short st_rdev;
102  long st_size;
103  long st_atime;
104  long st_spare1;
105  long st_mtime;
106  long st_spare2;
107  long st_ctime;
108  long st_spare3;
109  long st_blksize;
110  long st_blocks;
111  long st_spare4[2];
112 };
113 
114 typedef struct dcload_stat dcload_stat_t;
115 
116 /* Printk replacement */
117 void dcload_printk(const char *str);
118 
119 /* GDB tunnel */
120 size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_t out_size);
121 
122 /* File functions */
123 void* dcload_open(vfs_handler_t * vfs, const char *fn, int mode);
124 int dcload_close(void * hnd);
125 ssize_t dcload_read(void * hnd, void *buf, size_t cnt);
126 off_t dcload_seek(void * hnd, off_t offset, int whence);
127 off_t dcload_tell(void * hnd);
128 size_t dcload_total(void * hnd);
129 dirent_t* dcload_readdir(void * hnd);
130 int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2);
131 int dcload_unlink(vfs_handler_t * vfs, const char *fn);
132 
133 /* Init func */
134 void fs_dcload_init_console();
135 int fs_dcload_init();
136 int fs_dcload_shutdown();
137 
138 /* Init func for dcload-ip + lwIP */
139 int fs_dcload_init_lwip(void *p);
140 
141 /* \endcond */
142 
143 __END_DECLS
144 
145 #endif /* __KALLISTI_FS_DCLOAD_H */
146 
147 
Common integer types.
Debug I/O Interface.
Definition: dbgio.h:37
Virtual filesystem support.
int dcload_type
What type of dcload connection do we have?
Debug I/O.
VFS handler interface.
Definition: fs.h:97
Limits.
Directory entry.
Definition: fs.h:44