190 lines
7.1 KiB
C
Executable File
190 lines
7.1 KiB
C
Executable File
/*
|
|
* Copyright 2003-2005 NVIDIA Corporation. All Rights Reserved.
|
|
*
|
|
* BY INSTALLING THE SOFTWARE THE USER AGREES TO THE TERMS BELOW.
|
|
*
|
|
* User agrees to use the software under carefully controlled conditions
|
|
* and to inform all employees and contractors who have access to the software
|
|
* that the source code of the software is confidential and proprietary
|
|
* information of NVIDIA and is licensed to user as such. User acknowledges
|
|
* and agrees that protection of the source code is essential and user shall
|
|
* retain the source code in strict confidence. User shall restrict access to
|
|
* the source code of the software to those employees and contractors of user
|
|
* who have agreed to be bound by a confidentiality obligation which
|
|
* incorporates the protections and restrictions substantially set forth
|
|
* herein, and who have a need to access the source code in order to carry out
|
|
* the business purpose between NVIDIA and user. The software provided
|
|
* herewith to user may only be used so long as the software is used solely
|
|
* with NVIDIA products and no other third party products (hardware or
|
|
* software). The software must carry the NVIDIA copyright notice shown
|
|
* above. User must not disclose, copy, duplicate, reproduce, modify,
|
|
* publicly display, create derivative works of the software other than as
|
|
* expressly authorized herein. User must not under any circumstances,
|
|
* distribute or in any way disseminate the information contained in the
|
|
* source code and/or the source code itself to third parties except as
|
|
* expressly agreed to by NVIDIA. In the event that user discovers any bugs
|
|
* in the software, such bugs must be reported to NVIDIA and any fixes may be
|
|
* inserted into the source code of the software by NVIDIA only. User shall
|
|
* not modify the source code of the software in any way. User shall be fully
|
|
* responsible for the conduct of all of its employees, contractors and
|
|
* representatives who may in any way violate these restrictions.
|
|
*
|
|
* NO WARRANTY
|
|
* THE ACCOMPANYING SOFTWARE (INCLUDING OBJECT AND SOURCE CODE) PROVIDED BY
|
|
* NVIDIA TO USER IS PROVIDED "AS IS." NVIDIA DISCLAIMS ALL WARRANTIES,
|
|
* EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
* WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT.
|
|
|
|
* LIMITATION OF LIABILITY
|
|
* NVIDIA SHALL NOT BE LIABLE TO USER, USER'S CUSTOMERS, OR ANY OTHER PERSON
|
|
* OR ENTITY CLAIMING THROUGH OR UNDER USER FOR ANY LOSS OF PROFITS, INCOME,
|
|
* SAVINGS, OR ANY OTHER CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, DIRECT
|
|
* OR INDIRECT DAMAGES (WHETHER IN AN ACTION IN CONTRACT, TORT OR BASED ON A
|
|
* WARRANTY), EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
* DAMAGES. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF THE
|
|
* ESSENTIAL PURPOSE OF ANY LIMITED REMEDY. IN NO EVENT SHALL NVIDIA'S
|
|
* AGGREGATE LIABILITY TO USER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH
|
|
* OR UNDER USER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY USER TO NVIDIA
|
|
* FOR THE SOFTWARE PROVIDED HEREWITH.
|
|
*/
|
|
|
|
/*
|
|
* File: GFBDev.h
|
|
* GFSDK Block Device API header file.
|
|
*/
|
|
|
|
#ifndef GF_BDEV_H
|
|
#define GF_BDEV_H
|
|
|
|
#include "GF.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif /* __cplusplus */
|
|
|
|
/** @addtogroup groupBDev BDevAPI Block Device API
|
|
*/
|
|
/*@{*/
|
|
|
|
/** Block Device Capability definitions
|
|
Low 12 bits are for device types.
|
|
Matches GFFDEV_CAP_DEVICE_xxx in GFFDev.h
|
|
*/
|
|
#define GFBDEV_CAP_SD GFFDEV_CAP_DEVICE_SD /**< SD Storage Supported */
|
|
#define GFBDEV_CAP_SDIO GFFDEV_CAP_DEVICE_SDIO /***< SDIO Supported */
|
|
#define GFBDEV_CAP_MOUNT 0x00010000 /**< Mount/Unmount Supported */
|
|
#define GFBDEV_CAP_DEVICE_MASK 0x00000FFF
|
|
|
|
/** GFDRV_INFO: File system run-time struct.
|
|
Created when the volume is mounted via GFBDevMount (@see GFBDevMount()).
|
|
sec_total, sec_size, read, and write are filled in by
|
|
GFBDevMount() (or its lower level out-calls).
|
|
|
|
read is mapped to BDevSDRead
|
|
write is mapped to BDevSDWrite
|
|
-- see GFBDevSD.c for details.
|
|
*/
|
|
typedef struct _GFDRV_INFO
|
|
{
|
|
NvU32 dev;
|
|
NvU32 fat_type;
|
|
NvU32 sec_size;
|
|
NvU32 sec_total;
|
|
NvU32 cluster_size;
|
|
NvU32 cluster_total;
|
|
NvU32 rel_sec;
|
|
NvU32 data_sec_count;
|
|
NvU32 fat_sec_count;
|
|
NvU32 dir_count;
|
|
NvU32 root_sec_count;
|
|
NvU32 boot_sec;
|
|
NvU32 fat1_sec;
|
|
NvU32 fat2_sec;
|
|
NvU32 root_sec;
|
|
NvU32 data_sec;
|
|
NvU32 reFormat;
|
|
|
|
NvU32 (*upd_fat)( struct _GFDRV_INFO *drv, NvU32 ndx, NvU32 data );
|
|
NvU32 (*new_fat)( struct _GFDRV_INFO *drv, NvU32 ndx );
|
|
NvU32 (*next_fat)( struct _GFDRV_INFO *drv, NvU32 ndx );
|
|
NvU32 (*get_fat)( struct _GFDRV_INFO *drv, NvU32 ndx );
|
|
NvU32 (*read)( NvU32 dev, NvU32 sec, NvU32 secSize, NvU32 count,
|
|
NvU32 buf );
|
|
NvU32 (*write)( NvU32 dev, NvU32 sec, NvU32 secSize, NvU32 count,
|
|
NvU32 buf );
|
|
|
|
unsigned char *part_tab;
|
|
unsigned char *boot_tab;
|
|
unsigned char *fat_tab;
|
|
unsigned char *dir_tab;
|
|
} GFDRV_INFO;
|
|
|
|
/* Publicly exposed Block Device API function in the table */
|
|
/** @internal */
|
|
typedef struct _GFBDEVTABLE
|
|
{
|
|
GF_RETTYPE (* BDevGetProperty)( GFBDevHandle BDevHandle,
|
|
PGFPROPERTY pBDevProp );
|
|
|
|
GF_RETTYPE (* BDevMount)( GFBDevHandle BDevHandle,
|
|
GFDRV_INFO **pDrvInfo );
|
|
|
|
GF_RETTYPE (* BDevUnmount)( GFBDevHandle BDevHandle );
|
|
|
|
} GFBDEVTABLE, *PGFBDEVTABLE;
|
|
|
|
// Typesafe functions for opening and closing this component
|
|
GF_RETTYPE GFBDevSDOpen(GFRmHandle hRm, GFBDevHandle *phBDev,
|
|
GF_STATE_TYPE state, GFRmChHandle hCh);
|
|
void GFBDevClose(GFRmHandle hRm, GFBDevHandle *phBDev);
|
|
|
|
/** @name Functions
|
|
@{*/
|
|
|
|
/** Gets BDev API properties.
|
|
@param BDevHandle (#GFBDevHandle) Handle to the Block Device API
|
|
@param pBDevProp (#PGFPROPERTY) pointer to property struct.
|
|
|
|
@retval #GF_SUCCESS Success
|
|
@retval #GF_ERROR Error
|
|
*/
|
|
#define GFBDevGetProperty( BDevHandle, pBDevProp ) \
|
|
((PGFBDEVTABLE)BDevHandle)->BDevGetProperty( BDevHandle, pBDevProp )
|
|
|
|
/** Initializes the SD device and run-time support structure.
|
|
@param BDevHandle (#GFBDevHandle) Handle to the Block Device API
|
|
@param pDrvInfo (#GFDRV_INFO) run-time support struct
|
|
|
|
This creates and assigns a #GFDRV_INFO into
|
|
the given BDevHandle (actually a #BDEVSDTABLE).
|
|
Read and Write functions are assinged into the #GFDRV_INFO which
|
|
should be used by higher-level file systems to access the SD
|
|
device.
|
|
|
|
@retval #GF_SUCCESS Success
|
|
@retval #GF_ERROR Error
|
|
*/
|
|
#define GFBDevMount( BDevHandle, pDrvInfo ) \
|
|
((PGFBDEVTABLE)BDevHandle)->BDevMount( BDevHandle, pDrvInfo )
|
|
|
|
/** Uninitializes the SD device.
|
|
@param BDevHandle (#GFBDevHandle) Handle to the Block Device API
|
|
|
|
@retval #GF_SUCCESS Success
|
|
@retval #GF_ERROR Error
|
|
*/
|
|
#define GFBDevUnmount( BDevHandle ) \
|
|
((PGFBDEVTABLE)BDevHandle)->BDevUnmount( BDevHandle )
|
|
|
|
/*@}*/
|
|
/*@}*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* GF_BDEV_H */
|
|
|