下载 FreeRTOS
 

出色的 RTOS & 嵌入式软件

最新资讯
简化任何设备的身份验证云连接。
利用 CoAP 设计节能型云连接 IoT 解决方案。
11.0.0 版 FreeRTOS 内核简介:
FreeRTOS 路线图和代码贡献流程。
使用 FreeRTOS 实现 OPC-UA over TSN。

创建媒体驱动程序: FF_Disk_t 结构体
创建 FreeRTOS-Plus-FAT 媒体驱动程序

FreeRTOS-Plus-FAT 将所有媒体类型的公共信息存储在 FF_Disk_t 类型的结构体中。媒体驱动程序可以扩展 FF_Disk_t 结构体 以包含正在使用媒体的特定附加信息。 例如, FreeRTOS-Plus-FAT 的 RAM 磁盘驱动所使用的初始化函数扩展了 FF_Disk_t 结构体,以包括一个指向用作磁盘的 RAM 缓冲区的指针。

FF_Disk_t 结构体的 pxIOManager 成员通过调用 FF_CreateIOManager() 创建。

建议在分配后将整个结构体清零 - 这样媒体驱动程序将与未来的 FreeRTOS-Plus-FAT 版本兼容,其中 FF_Disk_t 结构体可能包含 额外成员。


/* Structure that contains fields common to all media drivers, and can be
extended to contain additional fields to tailor it for use with a specific media
type. */

struct xFFDisk
{
struct
{
/* Flags that can optionally be used by the media driver to ensure the
disk has been initialised, registered and mounted before it is accessed. */

uint32_t bIsInitialised : 1;
uint32_t bIsRegistered : 1;
uint32_t bIsMounted : 1;
uint32_t spare0 : 5;

/* The partition number on the media described by this structure. */
uint32_t bPartitionNumber : 8;
uint32_t spare1 : 16;
} xStatus;

/* Provided to allow this structure to be extended to include additional
attributes that are specific to a media type. */

void *pvTag;

/* Points to input and output manager used by the disk described by this
structure. */

FF_IOManager_t *pxIOManager;

/* The number of sectors on the disk. */
uint32_t ulNumberOfSectors;

/* Field that can optionally be set to a signature that is unique to the
media. Read and write functions can check the ulSignature field to validate
the media type before they attempt to access the pvTag field, or perform any
read and write operations. */

uint32_t ulSignature;
};

typedef struct xFFDisk FF_Disk_t;

The FF_Disk_t structure







Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.