Partition table support
[MMC/SD memory card interface]


Detailed Description

Support for reading partition tables and access to partitions.


Files

file  partition.c
 Partition table implementation (license: GPLv2 or LGPLv2.1).
file  partition.h
 Partition table header (license: GPLv2 or LGPLv2.1).
file  partition_config.h
 Partition configuration (license: GPLv2 or LGPLv2.1).

Modules

 Configuration of partition table support
 Preprocessor defines to configure the partition support.

Data Structures

struct  partition_struct
 Describes a partition. More...

Defines

#define PARTITION_TYPE_FREE
 The partition table entry is not used.
#define PARTITION_TYPE_FAT12
 The partition contains a FAT12 filesystem.
#define PARTITION_TYPE_FAT16_32MB
 The partition contains a FAT16 filesystem with 32MB maximum.
#define PARTITION_TYPE_EXTENDED
 The partition is an extended partition with its own partition table.
#define PARTITION_TYPE_FAT16
 The partition contains a FAT16 filesystem.
#define PARTITION_TYPE_FAT32
 The partition contains a FAT32 filesystem.
#define PARTITION_TYPE_FAT32_LBA
 The partition contains a FAT32 filesystem with LBA.
#define PARTITION_TYPE_FAT16_LBA
 The partition contains a FAT16 filesystem with LBA.
#define PARTITION_TYPE_EXTENDED_LBA
 The partition is an extended partition with LBA.
#define PARTITION_TYPE_UNKNOWN
 The partition has an unknown type.

Typedefs

typedef uint8_t(* device_read_t )(uint32_t offset, uint8_t *buffer, uint16_t length)
 A function pointer used to read from the partition.
typedef uint8_t(* device_read_callback_t )(uint8_t *buffer, uint32_t offset, void *p)
 A function pointer passed to a device_read_interval_t.
typedef uint8_t(* device_read_interval_t )(uint32_t offset, uint8_t *buffer, uint16_t interval, uint16_t length, device_read_callback_t callback, void *p)
 A function pointer used to continuously read units of interval bytes and call a callback function.
typedef uint8_t(* device_write_t )(uint32_t offset, const uint8_t *buffer, uint16_t length)
 A function pointer used to write to the partition.
typedef uint16_t(* device_write_callback_t )(uint8_t *buffer, uint32_t offset, void *p)
 A function pointer passed to a device_write_interval_t.
typedef uint8_t(* device_write_interval_t )(uint32_t offset, uint8_t *buffer, uint16_t length, device_write_callback_t callback, void *p)
 A function pointer used to continuously write a data stream obtained from a callback function.

Functions

struct partition_structpartition_open (device_read_t device_read, device_read_interval_t device_read_interval, device_write_t device_write, device_write_interval_t device_write_interval, int8_t index)
 Opens a partition.
uint8_t partition_close (struct partition_struct *partition)
 Closes a partition.


Typedef Documentation

typedef uint8_t(* device_read_t)(uint32_t offset, uint8_t *buffer, uint16_t length)

A function pointer used to read from the partition.

Parameters:
[in] offset The offset on the device where to start reading.
[out] buffer The buffer into which to place the data.
[in] length The count of bytes to read.

typedef uint8_t(* device_read_callback_t)(uint8_t *buffer, uint32_t offset, void *p)

A function pointer passed to a device_read_interval_t.

Parameters:
[in] buffer The buffer which contains the data just read.
[in] offset The offset from which the data in buffer was read.
[in] p An opaque pointer.
See also:
device_read_interval_t

typedef uint8_t(* device_read_interval_t)(uint32_t offset, uint8_t *buffer, uint16_t interval, uint16_t length, device_read_callback_t callback, void *p)

A function pointer used to continuously read units of interval bytes and call a callback function.

This function starts reading at the specified offset. Every interval bytes, it calls the callback function with the associated data buffer.

By returning zero, the callback may stop reading.

Parameters:
[in] offset Offset from which to start reading.
[in] buffer Pointer to a buffer which is at least interval bytes in size.
[in] interval Number of bytes to read before calling the callback function.
[in] length Number of bytes to read altogether.
[in] callback The function to call every interval bytes.
[in] p An opaque pointer directly passed to the callback function.
Returns:
0 on failure, 1 on success
See also:
device_read_t

typedef uint8_t(* device_write_t)(uint32_t offset, const uint8_t *buffer, uint16_t length)

A function pointer used to write to the partition.

Parameters:
[in] offset The offset on the device where to start writing.
[in] buffer The buffer which to write.
[in] length The count of bytes to write.

typedef uint16_t(* device_write_callback_t)(uint8_t *buffer, uint32_t offset, void *p)

A function pointer passed to a device_write_interval_t.

Parameters:
[in] buffer The buffer which receives the data to write.
[in] offset The offset to which the data in buffer will be written.
[in] p An opaque pointer.
Returns:
The number of bytes put into buffer
See also:
device_write_interval_t

typedef uint8_t(* device_write_interval_t)(uint32_t offset, uint8_t *buffer, uint16_t length, device_write_callback_t callback, void *p)

A function pointer used to continuously write a data stream obtained from a callback function.

This function starts writing at the specified offset. To obtain the next bytes to write, it calls the callback function. The callback fills the provided data buffer and returns the number of bytes it has put into the buffer.

By returning zero, the callback may stop writing.

Parameters:
[in] offset Offset where to start writing.
[in] buffer Pointer to a buffer which is used for the callback function.
[in] length Number of bytes to write in total. May be zero for endless writes.
[in] callback The function used to obtain the bytes to write.
[in] p An opaque pointer directly passed to the callback function.
Returns:
0 on failure, 1 on success
See also:
device_write_t


Function Documentation

struct partition_struct * partition_open ( device_read_t  device_read,
device_read_interval_t  device_read_interval,
device_write_t  device_write,
device_write_interval_t  device_write_interval,
int8_t  index 
) [read]

Opens a partition.

Opens a partition by its index number and returns a partition handle which describes the opened partition.

Note:
This function does not support extended partitions.
Parameters:
[in] device_read A function pointer which is used to read from the disk.
[in] device_read_interval A function pointer which is used to read in constant intervals from the disk.
[in] device_write A function pointer which is used to write to the disk.
[in] device_write_interval A function pointer which is used to write a data stream to disk.
[in] index The index of the partition which should be opened, range 0 to 3. A negative value is allowed as well. In this case, the partition opened is not checked for existance, begins at offset zero, has a length of zero and is of an unknown type.
Returns:
0 on failure, a partition descriptor on success.
See also:
partition_close

uint8_t partition_close ( struct partition_struct partition  ) 

Closes a partition.

This function destroys a partition descriptor which was previously obtained from a call to partition_open(). When this function returns, the given descriptor will be invalid.

Parameters:
[in] partition The partition descriptor to destroy.
Returns:
0 on failure, 1 on success.
See also:
partition_open


Generated on Thu May 22 18:12:37 2008 for mega-eth by  doxygen 1.5.5