aboutsummaryrefslogtreecommitdiff
path: root/libmpio/mpio.h
blob: d90591fa9a9a6c389eb7e1e8de236cf6cb4c77e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#/* -*- linux-c -*- */

/* 
 * $Id: mpio.h,v 1.9 2002/09/24 15:38:03 germeier Exp $
 *
 * Library for USB MPIO-*
 *
 * Markus Germeier (mager@tzi.de)
 *
 * uses code from mpio_stat.c by
 * Yuji Touya (salmoon@users.sourceforge.net)
 *
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * */

#ifndef _MPIO_H_
#define _MPIO_H_

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

#include "defs.h"

/* 
 *init and shutdown 
 */

mpio_t *mpio_init(mpio_callback_init_t);
void	mpio_close(mpio_t *);

/*
 * request information
 */

/* get version */
void	mpio_get_info(mpio_t *, mpio_info_t *);
/* print version: deprecated */
//void    mpio_print_version(mpio_t *);
/* retrieves free memory in bytes */
int	mpio_memory_free(mpio_t *, mpio_mem_t, int *free);

/* 
 * directory operations 
 */

/* context, memory bank */
BYTE*	mpio_directory_open(mpio_t *, mpio_mem_t);
/* context, dir context */
BYTE*	mpio_dentry_next(mpio_t *, mpio_mem_t, BYTE *);
/* context, dir context */
int	mpio_dentry_get(mpio_t *, mpio_mem_t, BYTE *, BYTE *, int,WORD *,
			BYTE *, BYTE *, BYTE *, BYTE *, DWORD *);

/* context, memory bank, filename, callback */
int	mpio_file_get(mpio_t *, mpio_mem_t, mpio_filename_t, mpio_callback_t); 

/* context, memory bank, filename, callback */
int	mpio_file_put(mpio_t *, mpio_mem_t, mpio_filename_t, mpio_filetype_t,
		      mpio_callback_t); 

/* context, memory bank, filename, callback */
int	mpio_file_del(mpio_t *, mpio_mem_t, mpio_filename_t, mpio_callback_t); 

/* context, memory bank, callback */
int	mpio_memory_format(mpio_t *, mpio_mem_t, mpio_callback_t); 

/* mpio_sync has to be called after every set of mpio_file_{del,put}
 * operations to write the current state of FAT and root directory.
 * This is done explicitly to avoid writing these informations to often
 * and thereby exhausting the SmartMedia chips
 */
/* context, memory bank */
int	mpio_sync(mpio_t *, mpio_mem_t); 

/* context, memory bank */
int	mpio_memory_dump(mpio_t *, mpio_mem_t); 

/* 
 * error handling
 */

/* returns error code of last error */
int 	mpio_errno(void);

/* returns the description of the error <errno> */
char *	mpio_strerror(int err);

/* prints the error message of the last error*/
void	mpio_perror(char *prefix);

/* 
 * timeline:
 * ---------
 * 2004: some functions to change the order of files
 * 2005: read mp3 tags of the files
 */
  
#endif /* _MPIO_H_ */