Data Structures

kfiledefs.h File Reference


Detailed Description

Defines data types and structures used by KFILE module.

============================================================================

Path:
/gpp/inc/usr/
Version:
1.65.02.09 ============================================================================
Copyright:
Copyright (C) 2002-2012, Texas Instruments Incorporated - https://www.ti.com/

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ============================================================================

#include <dsplink.h>
Include dependency graph for kfiledefs.h:

Go to the source code of this file.

Data Structures

struct  KFILE_Interface_tag
struct  KFileObject_tag

Typedefs

FileName

Definition for identifying files. ============================================================================

============================================================================

typedef Pstr FileName
FnKfileOpen

Signature of the function for opening a handle to a KFILE file.

============================================================================

Parameters:
fileNameName of the file to be opened.
modeMode for opening the file. This argument is case-sensitive. Expected modes are: "r" for read, "w" for write and "a" for append.
fileHandlePointer to the file object.
Returns:
DSP_SOK Operation successfully completed. DSP_EINVALIDARG Invalid arguments. DSP_EFILE File not found. DSP_EMEMORY Out of memory error.
Precondition:
Subcomponent must be initialized. fileName must be valid. mode must be valid. fileHandle must be valid.
Postcondition:
fileHandle contains the fileObject on success.
See also:
FnKfileClose ============================================================================
typedef DSP_STATUS(* FnKfileOpen )(IN CONST FileName fileName, IN CONST Char8 *mode, IN void **fileHandlePtr)
FnKfileClose

Signature of the function for closing a handle to a KFILE file.

============================================================================

Parameters:
fileHandleHandle of file to be closed, returned from KFILE_Open.
Returns:
DSP_SOK Operation successfully completed. DSP_EFILE File is not open. DSP_EPOINTER Invalid file object.
Precondition:
Subcomponent must be initialized. fileHandle must be a valid handle to a file opened earlier.
Postcondition:
Memory allocated for fileHandle is freed.
See also:
FnKfileOpen ============================================================================
typedef DSP_STATUS(* FnKfileClose )(IN void *fileHandle)
FnKfileRead

Signature of the function for reading from a KFILE file.

============================================================================

Parameters:
bufferBuffer in which the contents of file are read.
sizeSize of each object to read from file.
countNumber of objects to read.
fileHandleKFileObject to read from.
Returns:
DSP_SOK Operation successfully completed. DSP_EINVALIDARG Invalid arguments. DSP_EPOINTER Invalid file object. DSP_EFILE File is not open or error reading file. DSP_ERANGE The requested number of bytes is beyond EOF.
Precondition:
Subcomponent must be initialized. fileHandle must be a valid file pointer opened earlier.
Postcondition:
None
See also:
FnKfileOpen ============================================================================
typedef DSP_STATUS(* FnKfileRead )(OUT Char8 *buffer, IN Uint32 size, IN Uint32 count, IN void *fileHandle)
FnKfileSeek

Signature of the function for repositioning the file pointer within a KFILE file.

============================================================================

Parameters:
fileHandleThe fileObject to seek into.
offsetOffset for positioning the file pointer.
originOrigin for calculating absolute position where file pointer is to be positioned. This can take the following values: KFILE_SeekSet KFILE_SeekCur KFILE_SeekEnd
Returns:
DSP_SOK Operation successfully completed. DSP_EINVALIDARG Invalid arguments. DSP_EPOINTER Invalid file object. DSP_EFILE File is not opened. DSP_ERANGE Offset and origin combination is beyond file size range.
Precondition:
Subcomponent must be initialized. fileHandle must be a valid handle to a file opened earlier.
Postcondition:
None
See also:
FnKfileTell ============================================================================
typedef DSP_STATUS(* FnKfileSeek )(IN void *fileHandle, IN Int32 offset, IN KFILE_FileSeek origin)
FnKfileTell

Signature of the function for returning the current file pointer position within a KFILE file.

============================================================================

Parameters:
fileHandleThe fileObject pointer.
posOut argument for holding the current file position indicator value.
Returns:
DSP_SOK Operation successfully completed. DSP_EINVALIDARG Invalid arguments. DSP_EPOINTER Invalid file object. DSP_EFILE file is not opened.
Precondition:
Subcomponent must be initialized. fileHandle must be a valid handle to a file opened earlier.
Postcondition:
None
See also:
FnKfileSeek ============================================================================
typedef DSP_STATUS(* FnKfileTell )(IN void *fileHandle, OUT Int32 *pos)
FnKfileGetSize

Signature of the function for returning the file size of the KFILE file.

============================================================================

Parameters:
fileHandleHandle to the file object.
sizeOut argument for holding the file size.
Returns:
None.
Precondition:
Subcomponent must be initialized. fileHandle must be a valid handle to a file opened earlier.
Postcondition:
None
See also:
FnKfileSeek ============================================================================
typedef void(* FnKfileGetSize )(IN void *fileHandle, OUT Uint32 *size)
KFILE_Interface

Structure containing interface functions exported by the KFILE OSAL subcomponent.

============================================================================

Parameters:
kfileOpenFunction pointer providing the abstraction to the KFILE module's open function
kfileCloseFunction pointer providing the abstraction to the KFILE module's close function.
kfileReadFunction pointer providing the abstraction to the KFILE module's read function.
kfileSeekFunction pointer providing the abstraction to the KFILE module's seek function.
kfileTellFunction pointer providing the abstraction to the KFILE module's tell function.
kfileGetSizeFunction pointer providing the abstraction to the KFILE module's getSize function. ============================================================================
typedef struct KFILE_Interface_tag KFILE_Interface
KFileObject

Definition of the KFILE object used by all KFILE functions.

============================================================================

Parameters:
signatureSignature of the KFILE object.
fnTablePointer to the KFILE function table.
fileObjPointer to the KFILE module-specific KFILE object.
isOpenFlag to track whether the file is isOpen.
See also:
KFILE_Open () ============================================================================
typedef struct KFileObject_tag KFileObject

Enumerations

KFILE_Seek

Enumerates the values used for repositioning the file position indicator.

============================================================================

Parameters:
KFILE_SeekSetSeek from beginning of file.
KFILE_SeekCurSeek from current position.
KFILE_SeekEndSeek from end of file. ============================================================================
enum  KFILE_FileSeek {
  KFILE_SeekSet = 0x00,
  KFILE_SeekCur = 0x01,
  KFILE_SeekEnd = 0x02
}

Typedef Documentation

typedef Pstr FileName
typedef DSP_STATUS(* FnKfileOpen)(IN CONST FileName fileName, IN CONST Char8 *mode, IN void **fileHandlePtr)
typedef DSP_STATUS(* FnKfileClose)(IN void *fileHandle)
typedef DSP_STATUS(* FnKfileRead)(OUT Char8 *buffer, IN Uint32 size, IN Uint32 count, IN void *fileHandle)
typedef DSP_STATUS(* FnKfileSeek)(IN void *fileHandle, IN Int32 offset, IN KFILE_FileSeek origin)
typedef DSP_STATUS(* FnKfileTell)(IN void *fileHandle, OUT Int32 *pos)
typedef void(* FnKfileGetSize)(IN void *fileHandle, OUT Uint32 *size)
typedef struct KFileObject_tag KFileObject

Enumeration Type Documentation

Enumerator:
KFILE_SeekSet 
KFILE_SeekCur 
KFILE_SeekEnd 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2012, Texas Instruments Incorporated