blob: 804c2f24d9965f990a79d1803f133344f6a1c250 [file] [log] [blame]
adamdunkels28144b42004-02-16 21:00:14 +00001/**
2 * \addtogroup c64fs
3 * @{
4 */
5
6/**
7 * \file
8 * Header file for the C64 filesystem functions.
9 * \author Adam Dunkels <adam@dunkels.com>
10 *
11 */
12
adamdunkels74c1ecb2003-08-04 00:12:50 +000013/*
14 * Copyright (c) 2003, Adam Dunkels.
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials provided
25 * with the distribution.
adamdunkelsb44b2172003-09-04 19:40:36 +000026 * 3. The name of the author may not be used to endorse or promote
adamdunkels74c1ecb2003-08-04 00:12:50 +000027 * products derived from this software without specific prior
28 * written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
31 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
34 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
36 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *
42 * This file is part of the Contiki desktop environment
43 *
adamdunkels28144b42004-02-16 21:00:14 +000044 * $Id: c64-fs.h,v 1.6 2004/02/16 21:00:14 adamdunkels Exp $
adamdunkels74c1ecb2003-08-04 00:12:50 +000045 *
46 */
47#ifndef __C64_FS_H__
48#define __C64_FS_H__
49
50#include "c64-dio.h"
51
adamdunkels28144b42004-02-16 21:00:14 +000052/**
53 * An opaque structure with no user visible elements that represents
54 * an open file.
55 */
adamdunkels74c1ecb2003-08-04 00:12:50 +000056struct c64_fs_file {
57 unsigned char track, sect, ptr;
58};
59
60int c64_fs_open(const char *name, struct c64_fs_file *f);
61void c64_fs_close(struct c64_fs_file *f);
62int __fastcall__ c64_fs_read(struct c64_fs_file *f,
63 char *buf, int len);
64
adamdunkels9ec51b32003-08-06 23:12:06 +000065int __fastcall__ c64_fs_write(struct c64_fs_file *f,
66 char *buf, int len);
67
adamdunkels28144b42004-02-16 21:00:14 +000068/**
69 * An opaque structure with no user visible elements that represents a
70 * directory descriptor.
71 */
adamdunkels74c1ecb2003-08-04 00:12:50 +000072struct c64_fs_dir {
73 unsigned char track, sect, ptr;
74};
75
adamdunkels28144b42004-02-16 21:00:14 +000076/**
77 * A C64 directory entry.
78 */
adamdunkels74c1ecb2003-08-04 00:12:50 +000079struct c64_fs_dirent {
adamdunkels28144b42004-02-16 21:00:14 +000080 char name[17]; /**< The name of the directory entry. */
81 unsigned short size; /**< The size of the directory entry in 256 byte blocks. */
82 unsigned char track,
adamdunkels74c1ecb2003-08-04 00:12:50 +000083 sect;
84};
85
86
87unsigned char c64_fs_opendir(struct c64_fs_dir *d);
88
adamdunkelsba062492003-08-20 19:56:16 +000089void c64_fs_readdir_dirent(struct c64_fs_dir *d,
90 struct c64_fs_dirent *f);
91unsigned char c64_fs_readdir_next(struct c64_fs_dir *d);
92
adamdunkels74c1ecb2003-08-04 00:12:50 +000093void c64_fs_closedir(struct c64_fs_dir *d);
94
adamdunkels28144b42004-02-16 21:00:14 +000095/** @} */
adamdunkels74c1ecb2003-08-04 00:12:50 +000096
97#endif /* __C64_FS_H__ */