Home | History | Annotate | Download | only in host_src

Lines Matching refs:file

3  * File:
7 * This file contains the host wrapper functions for stdio, stdlib, etc.
9 * The file locator (EAS_FILE_LOCATOR) handle passed to
12 * Modify this file to suit the needs of your particular system.
15 * a MIDI type 1 file that can be played.
17 * EAS_HW_FILE is a structure to support the file I/O functions. It
18 * comprises the file descriptor, the file read pointer, and
19 * the dup flag, which when set, indicates that the file handle has
20 * been duplicated, and offset and length within the file.
25 * you may not use this file except in compliance with the License.
72 // 100 max file handles == 3 * (nb tracks(32) + 1 for the segment) + 1 for jet file
84 * the file size and read position.
110 EAS_HW_FILE *file;
113 /* need to track file opens for duplicate handles */
120 file = (*pHWInstData)->files;
123 file->handle = NULL;
124 file++;
232 * Open a file for read or write
238 EAS_HW_FILE *file;
249 /* find an empty entry in the file table */
250 file = hwInstData->files;
254 if (file->handle == NULL)
256 file->handle = locator->handle;
257 file->readAt = locator->readAt;
258 file->size = locator->size;
259 file->filePos = 0;
260 *pFile = file;
263 file++;
275 * Read data from a file
280 EAS_RESULT EAS_HWReadFile (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *pBuffer, EAS_I32 n, EAS_I32 *pBytesRead)
285 if (file->handle == NULL)
292 count = file->size(file->handle) - file->filePos;
300 count = file->readAt(file->handle, pBuffer, file->filePos, count);
302 file->filePos += count;
315 * Read a byte from a file
320 EAS_RESULT EAS_HWGetByte (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p)
323 return EAS_HWReadFile(hwInstData, file, p, 1, &numread);
330 * Read a 16 bit word from a file
335 EAS_RESULT EAS_HWGetWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst)
340 /* read 2 bytes from the file */
341 if ((result = EAS_HWGetByte(hwInstData, file, &c1)) != EAS_SUCCESS)
343 if ((result = EAS_HWGetByte(hwInstData, file, &c2)) != EAS_SUCCESS)
359 * Returns the current location in the file
364 EAS_RESULT EAS_HWGetDWord (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, void *p, EAS_BOOL msbFirst)
369 /* read 4 bytes from the file */
370 if ((result = EAS_HWGetByte(hwInstData, file, &c1)) != EAS_SUCCESS)
372 if ((result = EAS_HWGetByte(hwInstData, file, &c2)) != EAS_SUCCESS)
374 if ((result = EAS_HWGetByte(hwInstData, file, &c3)) != EAS_SUCCESS)
376 if ((result = EAS_HWGetByte(hwInstData, file, &c4)) != EAS_SUCCESS)
392 * Returns the current location in the file
397 EAS_RESULT EAS_HWFilePos (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 *pPosition)
401 if (file->handle == NULL)
404 *pPosition = file->filePos;
412 * Seek to a specific location in the file
417 EAS_RESULT EAS_HWFileSeek (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position)
421 if (file->handle == NULL)
425 if ((position < 0) || (position > file->size(file->handle)))
429 file->filePos = position;
442 EAS_RESULT EAS_HWFileSeekOfs (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_I32 position)
446 if (file->handle == NULL)
449 /* determine the file position */
450 position += file->filePos;
451 if ((position < 0) || (position > file->size(file->handle)))
455 file->filePos = position;
464 * Duplicate a file handle
468 EAS_RESULT EAS_HWDupHandle (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE file, EAS_FILE_HANDLE *pDupFile)
474 if (file->handle == NULL)
477 /* find an empty entry in the file table */
485 dupFile->handle = file->handle;
486 dupFile->filePos = file->filePos;
487 dupFile->readAt = file->readAt;
488 dupFile->size = file->size;