blob: bfacb70fb18bca1fb93178b1d3b064896c06ce90 [file] [log] [blame]
kthacker62e146c2006-04-17 15:11:35 +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
13/*
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.
26 * 3. The name of the author may not be used to endorse or promote
27 * 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 *
44 * $Id: c64-fs.h,v 1.1 2006/04/17 15:11:57 kthacker Exp $
45 *
46 */
47#ifndef __C64_FS_H__
48#define __C64_FS_H__
49
50#include "c64-dio.h"
51
52/**
53 * An opaque structure with no user visible elements that represents
54 * an open file.
55 */
56struct 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
65int __fastcall__ c64_fs_write(struct c64_fs_file *f,
66 char *buf, int len);
67
68/**
69 * An opaque structure with no user visible elements that represents a
70 * directory descriptor.
71 */
72struct c64_fs_dir {
73 unsigned char track, sect, ptr;
74};
75
76/**
77 * A C64 directory entry.
78 */
79struct c64_fs_dirent {
80 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,
83 sect;
84};
85
86
87unsigned char c64_fs_opendir(struct c64_fs_dir *d);
88
89void 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
93void c64_fs_closedir(struct c64_fs_dir *d);
94
95/** @} */
96
97#endif /* __C64_FS_H__ */