| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | // File service command enumeration. |
| 29 | |
| 30 | #ifndef VC_FILESERVICE_DEFS_H |
| 31 | #define VC_FILESERVICE_DEFS_H |
| 32 | |
| 33 | #define VC_FILESERV_VER 1 |
| 34 | /* Definitions (not used by API) */ |
| 35 | #define FS_MAX_DATA 8192 //4096 |
| 36 | |
| 37 | /* Protocol (not used by API) version 1.2 */ |
| 38 | |
| 39 | enum { |
| 40 | /* Over-the-wire file open flags */ |
| 41 | VC_O_RDONLY = 0x01, |
| 42 | VC_O_WRONLY = 0x02, |
| 43 | VC_O_RDWR = 0x04, |
| 44 | VC_O_APPEND = 0x08, |
| 45 | VC_O_CREAT = 0x10, |
| 46 | VC_O_TRUNC = 0x20, |
| 47 | VC_O_EXCL = 0x40, |
| 48 | |
| 49 | /* Request Commands (VC->Host->VC) */ |
| 50 | |
| 51 | /* These commands don't require a pathname */ |
| 52 | VC_FILESYS_RESET = 64, |
| 53 | VC_FILESYS_CLOSE = 65, |
| 54 | VC_FILESYS_CLOSEDIR = 66, |
| 55 | VC_FILESYS_LSEEK = 67, |
| 56 | VC_FILESYS_READ = 68, |
| 57 | VC_FILESYS_READDIR = 69, |
| 58 | VC_FILESYS_SETEND = 70, |
| 59 | VC_FILESYS_WRITE = 71, |
| 60 | |
| 61 | /* These commands require a pathname */ |
| 62 | VC_FILESYS_FORMAT = 72, |
| 63 | VC_FILESYS_FREESPACE = 73, |
| 64 | VC_FILESYS_GET_ATTR = 74, |
| 65 | VC_FILESYS_MKDIR = 75, |
| 66 | VC_FILESYS_OPEN = 76, |
| 67 | VC_FILESYS_OPENDIR = 77, |
| 68 | VC_FILESYS_REMOVE = 78, |
| 69 | VC_FILESYS_RENAME = 79, |
| 70 | VC_FILESYS_SET_ATTR = 80, |
| 71 | VC_FILESYS_SCANDISK = 81, |
| 72 | VC_FILESYS_TOTALSPACE = 82, |
| 73 | VC_FILESYS_DISKWRITABLE=83, |
| 74 | VC_FILESYS_OPEN_DISK_RAW = 84, |
| 75 | VC_FILESYS_CLOSE_DISK_RAW = 85, |
| 76 | VC_FILESYS_NUMSECTORS = 86, |
| 77 | VC_FILESYS_READ_SECTORS = 87, |
| 78 | VC_FILESYS_WRITE_SECTORS = 88, |
| 79 | |
| 80 | VC_FILESYS_MOUNT = 89, |
| 81 | VC_FILESYS_UMOUNT = 90, |
| 82 | VC_FILESYS_FSTYPE = 91, |
| 83 | |
| 84 | VC_FILESYS_READ_DIRECT = 92, |
| 85 | |
| 86 | VC_FILESYS_LSEEK64 = 93, |
| 87 | VC_FILESYS_FREESPACE64 = 94, |
| 88 | VC_FILESYS_TOTALSPACE64= 95, |
| 89 | VC_FILESYS_OPEN_DISK = 96, |
| 90 | VC_FILESYS_CLOSE_DISK = 97, |
| 91 | |
| 92 | /* extra simple functions for mass storage testing */ |
| 93 | VC_FILESYS_READ_SECTOR = 98, //1sect |
| 94 | VC_FILESYS_STREAM_SECTOR_BEGIN = 99, |
| 95 | VC_FILESYS_STREAM_SECTOR_END = 100, |
| 96 | VC_FILESYS_WRITE_SECTOR = 101, |
| 97 | VC_FILESYS_FSTAT = 102, |
| 98 | VC_FILESYS_DIRSIZE = 103, |
| 99 | VC_FILESYS_LIST_DIRS = 104, |
| 100 | VC_FILESYS_LIST_FILES = 105, |
| 101 | VC_FILESYS_NUM_DIRS = 106, |
| 102 | VC_FILESYS_NUM_FILES = 107, |
| 103 | VC_FILESYS_MAX_FILESIZE = 108, |
| 104 | VC_FILESYS_CHKDSK = 109, |
| 105 | }; |
| 106 | |
| 107 | /* Parameters for lseek */ |
| 108 | |
| 109 | #define VC_FILESYS_SEEK_SET 0 /* Set file pointer to "offset" */ |
| 110 | #define VC_FILESYS_SEEK_CUR 1 /* Set file pointer to current plus "offset" */ |
| 111 | #define VC_FILESYS_SEEK_END 2 /* Set file pointer to EOF plus "offset" */ |
| 112 | |
| 113 | /* Return values of vc_filesys_type */ |
| 114 | #define VC_FILESYS_FS_UNKNOWN 0 |
| 115 | #define VC_FILESYS_FS_FAT12 1 |
| 116 | #define VC_FILESYS_FS_FAT16 2 |
| 117 | #define VC_FILESYS_FS_FAT32 3 |
| 118 | |
| 119 | #endif |
| 120 | |