adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 1 | /** |
| 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 | |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 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. |
adamdunkels | b44b217 | 2003-09-04 19:40:36 +0000 | [diff] [blame] | 26 | * 3. The name of the author may not be used to endorse or promote |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 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 | * |
adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 44 | * $Id: c64-fs.h,v 1.6 2004/02/16 21:00:14 adamdunkels Exp $ |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 45 | * |
| 46 | */ |
| 47 | #ifndef __C64_FS_H__ |
| 48 | #define __C64_FS_H__ |
| 49 | |
| 50 | #include "c64-dio.h" |
| 51 | |
adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 52 | /** |
| 53 | * An opaque structure with no user visible elements that represents |
| 54 | * an open file. |
| 55 | */ |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 56 | struct c64_fs_file { |
| 57 | unsigned char track, sect, ptr; |
| 58 | }; |
| 59 | |
| 60 | int c64_fs_open(const char *name, struct c64_fs_file *f); |
| 61 | void c64_fs_close(struct c64_fs_file *f); |
| 62 | int __fastcall__ c64_fs_read(struct c64_fs_file *f, |
| 63 | char *buf, int len); |
| 64 | |
adamdunkels | 9ec51b3 | 2003-08-06 23:12:06 +0000 | [diff] [blame] | 65 | int __fastcall__ c64_fs_write(struct c64_fs_file *f, |
| 66 | char *buf, int len); |
| 67 | |
adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 68 | /** |
| 69 | * An opaque structure with no user visible elements that represents a |
| 70 | * directory descriptor. |
| 71 | */ |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 72 | struct c64_fs_dir { |
| 73 | unsigned char track, sect, ptr; |
| 74 | }; |
| 75 | |
adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 76 | /** |
| 77 | * A C64 directory entry. |
| 78 | */ |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 79 | struct c64_fs_dirent { |
adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 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, |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 83 | sect; |
| 84 | }; |
| 85 | |
| 86 | |
| 87 | unsigned char c64_fs_opendir(struct c64_fs_dir *d); |
| 88 | |
adamdunkels | ba06249 | 2003-08-20 19:56:16 +0000 | [diff] [blame] | 89 | void c64_fs_readdir_dirent(struct c64_fs_dir *d, |
| 90 | struct c64_fs_dirent *f); |
| 91 | unsigned char c64_fs_readdir_next(struct c64_fs_dir *d); |
| 92 | |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 93 | void c64_fs_closedir(struct c64_fs_dir *d); |
| 94 | |
adamdunkels | 28144b4 | 2004-02-16 21:00:14 +0000 | [diff] [blame] | 95 | /** @} */ |
adamdunkels | 74c1ecb | 2003-08-04 00:12:50 +0000 | [diff] [blame] | 96 | |
| 97 | #endif /* __C64_FS_H__ */ |