Hanna
Sourcecode Batteriemanagementsystem
Module | Dateien | Datenstrukturen | Makrodefinitionen | Typdefinitionen | Funktionen | Variablen
Partition table support
Zusammengehörigkeiten von Partition table support:

Module

 Configuration of partition table support
 

Dateien

Datei  partition.c
 SD-Card Reader Bibliothek von Roland Riegel.
 
Datei  partition.h
 SD-Card Reader Bibliothek von Roland Riegel.
 
Datei  partition_config.h
 SD-Card Reader Bibliothek von Roland Riegel.
 

Datenstrukturen

struct  partition_struct
 

Makrodefinitionen

#define PARTITION_TYPE_EXTENDED   0x05
 
#define PARTITION_TYPE_EXTENDED_LBA   0x0f
 
#define PARTITION_TYPE_FAT12   0x01
 
#define PARTITION_TYPE_FAT16   0x06
 
#define PARTITION_TYPE_FAT16_32MB   0x04
 
#define PARTITION_TYPE_FAT16_LBA   0x0e
 
#define PARTITION_TYPE_FAT32   0x0b
 
#define PARTITION_TYPE_FAT32_LBA   0x0c
 
#define PARTITION_TYPE_FREE   0x00
 
#define PARTITION_TYPE_UNKNOWN   0xff
 

Typdefinitionen

typedef uint8_t(* device_read_callback_t) (uint8_t *buffer, offset_t offset, void *p)
 
typedef uint8_t(* device_read_interval_t) (offset_t offset, uint8_t *buffer, uintptr_t interval, uintptr_t length, device_read_callback_t callback, void *p)
 
typedef uint8_t(* device_read_t) (offset_t offset, uint8_t *buffer, uintptr_t length)
 
typedef uintptr_t(* device_write_callback_t) (uint8_t *buffer, offset_t offset, void *p)
 
typedef uint8_t(* device_write_interval_t) (offset_t offset, uint8_t *buffer, uintptr_t length, device_write_callback_t callback, void *p)
 
typedef uint8_t(* device_write_t) (offset_t offset, const uint8_t *buffer, uintptr_t length)
 

Funktionen

uint8_t partition_close (struct partition_struct *partition)
 
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)
 

Variablen

static struct partition_struct partition_handles [PARTITION_COUNT]
 

Ausführliche Beschreibung

Support for reading partition tables and access to partitions.

Makro-Dokumentation

#define PARTITION_TYPE_EXTENDED   0x05

The partition is an extended partition with its own partition table.

Definiert in Zeile 62 der Datei partition.h.

#define PARTITION_TYPE_EXTENDED_LBA   0x0f

The partition is an extended partition with LBA.

Definiert in Zeile 82 der Datei partition.h.

#define PARTITION_TYPE_FAT12   0x01

The partition contains a FAT12 filesystem.

Definiert in Zeile 54 der Datei partition.h.

#define PARTITION_TYPE_FAT16   0x06

The partition contains a FAT16 filesystem.

Definiert in Zeile 66 der Datei partition.h.

#define PARTITION_TYPE_FAT16_32MB   0x04

The partition contains a FAT16 filesystem with 32MB maximum.

Definiert in Zeile 58 der Datei partition.h.

#define PARTITION_TYPE_FAT16_LBA   0x0e

The partition contains a FAT16 filesystem with LBA.

Definiert in Zeile 78 der Datei partition.h.

#define PARTITION_TYPE_FAT32   0x0b

The partition contains a FAT32 filesystem.

Definiert in Zeile 70 der Datei partition.h.

#define PARTITION_TYPE_FAT32_LBA   0x0c

The partition contains a FAT32 filesystem with LBA.

Definiert in Zeile 74 der Datei partition.h.

#define PARTITION_TYPE_FREE   0x00

The partition table entry is not used.

Definiert in Zeile 50 der Datei partition.h.

#define PARTITION_TYPE_UNKNOWN   0xff

The partition has an unknown type.

Definiert in Zeile 86 der Datei partition.h.

Dokumentation der benutzerdefinierten Typen

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

A function pointer passed to a device_read_interval_t.

Parameter
[in]bufferThe buffer which contains the data just read.
[in]offsetThe offset from which the data in buffer was read.
[in]pAn opaque pointer.
Siehe auch
device_read_interval_t

Definiert in Zeile 104 der Datei partition.h.

typedef uint8_t(* device_read_interval_t) (offset_t offset, uint8_t *buffer, uintptr_t interval, uintptr_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.

Parameter
[in]offsetOffset from which to start reading.
[in]bufferPointer to a buffer which is at least interval bytes in size.
[in]intervalNumber of bytes to read before calling the callback function.
[in]lengthNumber of bytes to read altogether.
[in]callbackThe function to call every interval bytes.
[in]pAn opaque pointer directly passed to the callback function.
Rückgabe
0 on failure, 1 on success
Siehe auch
device_read_t

Definiert in Zeile 123 der Datei partition.h.

typedef uint8_t(* device_read_t) (offset_t offset, uint8_t *buffer, uintptr_t length)

A function pointer used to read from the partition.

Parameter
[in]offsetThe offset on the device where to start reading.
[out]bufferThe buffer into which to place the data.
[in]lengthThe count of bytes to read.

Definiert in Zeile 95 der Datei partition.h.

typedef uintptr_t(* device_write_callback_t) (uint8_t *buffer, offset_t offset, void *p)

A function pointer passed to a device_write_interval_t.

Parameter
[in]bufferThe buffer which receives the data to write.
[in]offsetThe offset to which the data in buffer will be written.
[in]pAn opaque pointer.
Rückgabe
The number of bytes put into buffer
Siehe auch
device_write_interval_t

Definiert in Zeile 141 der Datei partition.h.

typedef uint8_t(* device_write_interval_t) (offset_t offset, uint8_t *buffer, uintptr_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.

Parameter
[in]offsetOffset where to start writing.
[in]bufferPointer to a buffer which is used for the callback function.
[in]lengthNumber of bytes to write in total. May be zero for endless writes.
[in]callbackThe function used to obtain the bytes to write.
[in]pAn opaque pointer directly passed to the callback function.
Rückgabe
0 on failure, 1 on success
Siehe auch
device_write_t

Definiert in Zeile 160 der Datei partition.h.

typedef uint8_t(* device_write_t) (offset_t offset, const uint8_t *buffer, uintptr_t length)

A function pointer used to write to the partition.

Parameter
[in]offsetThe offset on the device where to start writing.
[in]bufferThe buffer which to write.
[in]lengthThe count of bytes to write.

Definiert in Zeile 131 der Datei partition.h.

Dokumentation der Funktionen

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.

Parameter
[in]partitionThe partition descriptor to destroy.
Rückgabe
0 on failure, 1 on success.
Siehe auch
partition_open

Definiert in Zeile 149 der Datei partition.c.

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 
)

Opens a partition.

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

Zu beachten
This function does not support extended partitions.
Parameter
[in]device_readA function pointer which is used to read from the disk.
[in]device_read_intervalA function pointer which is used to read in constant intervals from the disk.
[in]device_writeA function pointer which is used to write to the disk.
[in]device_write_intervalA function pointer which is used to write a data stream to disk.
[in]indexThe 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. Use this in case you want to open the whole device as a single partition (e.g. for "super floppy" use).
Rückgabe
0 on failure, a partition descriptor on success.
Siehe auch
partition_close

Definiert in Zeile 77 der Datei partition.c.

Hier ist ein Graph, der zeigt, was diese Funktion aufruft: