TI-RTOS Drivers  tidrivers_full_2_20_00_08
USBMSCHFatFs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
103 #ifndef ti_drivers_USBMSCHFATFS__include
104 #define ti_drivers_USBMSCHFATFS__include
105 
106 #ifdef __cplusplus
107 extern "C" {
108 #endif
109 
110 #include <stddef.h>
111 #include <stdint.h>
112 #include <stdbool.h>
113 
131 #define USBMSCHFatFs_CMD_RESERVED 32
132 
145 #define USBMSCHFatFs_STATUS_RESERVED -32
146 
161 #define USBMSCHFatFs_STATUS_SUCCESS 0
162 
169 #define USBMSCHFatFs_STATUS_ERROR -1
170 
178 #define USBMSCHFatFs_STATUS_UNDEFINEDCMD -2
179 
190 /* Add USBMSCHFatFs_CMD_<commands> here */
191 
200 
210 typedef struct USBMSCHFatFs_Params {
211  unsigned int servicePriority;
218  uintptr_t custom;
221 
226 typedef void (*USBMSCHFatFs_InitFxn) (USBMSCHFatFs_Handle handle);
227 
232 typedef USBMSCHFatFs_Handle (*USBMSCHFatFs_OpenFxn) (USBMSCHFatFs_Handle handle,
233  unsigned char drv,
234  USBMSCHFatFs_Params *params);
235 
240 typedef void (*USBMSCHFatFs_CloseFxn) (USBMSCHFatFs_Handle handle);
241 
246 typedef int (*USBMSCHFatFs_ControlFxn) (USBMSCHFatFs_Handle handle,
247  unsigned int cmd,
248  void *arg);
249 
254 typedef bool (*USBMSCHFatFs_waitForconnectFxn) (USBMSCHFatFs_Handle handle,
255  unsigned int timeout);
256 
262 typedef struct USBMSCHFatFs_FxnTable {
265 
268 
271 
274 
278 
290 typedef struct USBMSCHFatFs_Config {
296 
298  void *object;
299 
301  void const *hwAttrs;
303 
318 extern void USBMSCHFatFs_close(USBMSCHFatFs_Handle handle);
319 
359 extern int USBMSCHFatFs_control(USBMSCHFatFs_Handle handle,
360  unsigned int cmd,
361  void *arg);
362 
371 extern void USBMSCHFatFs_init(void);
372 
395 extern USBMSCHFatFs_Handle USBMSCHFatFs_open(unsigned int index,
396  unsigned char drv,
397  USBMSCHFatFs_Params *params);
398 
409 extern void USBMSCHFatFs_Params_init(USBMSCHFatFs_Params *params);
410 
424 extern bool USBMSCHFatFs_waitForConnect(USBMSCHFatFs_Handle handle,
425  unsigned int timeout);
426 
427 #ifdef __cplusplus
428 }
429 #endif
430 
431 #endif /* ti_drivers_USBMSCHFATFS__include */
USBMSCHFatFs Parameters.
Definition: USBMSCHFatFs.h:210
int USBMSCHFatFs_control(USBMSCHFatFs_Handle handle, unsigned int cmd, void *arg)
Function performs implementation specific features on a given USBMSCHFatFs_Handle.
USBMSCHFatFs_FxnTable const * fxnTablePtr
Definition: USBMSCHFatFs.h:295
struct USBMSCHFatFs_Config * USBMSCHFatFs_Handle
USBMSCHFatFs Handler.
Definition: USBMSCHFatFs.h:199
struct USBMSCHFatFs_FxnTable USBMSCHFatFs_FxnTable
The definition of a USBMSCHFatFs function table that contains the required set of functions to contro...
bool(* USBMSCHFatFs_waitForconnectFxn)(USBMSCHFatFs_Handle handle, unsigned int timeout)
A function pointer to a driver specific implementation of USBMSCHFatFs_waitForConnect().
Definition: USBMSCHFatFs.h:254
size_t serviceTaskStackSize
Definition: USBMSCHFatFs.h:215
void USBMSCHFatFs_Params_init(USBMSCHFatFs_Params *params)
Function to initialize the USBMSCHFatFs_Params structure to its defaults.
USBMSCHFatFs_InitFxn initFxn
Definition: USBMSCHFatFs.h:264
struct USBMSCHFatFs_Params USBMSCHFatFs_Params
USBMSCHFatFs Parameters.
unsigned int servicePriority
Definition: USBMSCHFatFs.h:211
USBMSCHFatFs_ControlFxn controlFxn
Definition: USBMSCHFatFs.h:273
USBMSCHFatFs_CloseFxn closeFxn
Definition: USBMSCHFatFs.h:270
USBMSCHFatFs_Handle(* USBMSCHFatFs_OpenFxn)(USBMSCHFatFs_Handle handle, unsigned char drv, USBMSCHFatFs_Params *params)
A function pointer to a driver specific implementation of USBMSCHFatFs_open().
Definition: USBMSCHFatFs.h:232
void USBMSCHFatFs_init(void)
Function to initialize the USBMSCHFatFs module.
USBMSCHFatFs_OpenFxn openFxn
Definition: USBMSCHFatFs.h:267
void * object
Definition: USBMSCHFatFs.h:298
USBMSCHFatFs Global configuration.
Definition: USBMSCHFatFs.h:290
void * serviceTaskStackPtr
Definition: USBMSCHFatFs.h:213
void(* USBMSCHFatFs_InitFxn)(USBMSCHFatFs_Handle handle)
A function pointer to a driver specific implementation of USBMSCHFatFs_init().
Definition: USBMSCHFatFs.h:226
USBMSCHFatFs_waitForconnectFxn waitForConnectFxn
Definition: USBMSCHFatFs.h:276
bool USBMSCHFatFs_waitForConnect(USBMSCHFatFs_Handle handle, unsigned int timeout)
Function blocks task execution while no USB drive is enumerated. After the USBMSCHFatFs driver has be...
The definition of a USBMSCHFatFs function table that contains the required set of functions to contro...
Definition: USBMSCHFatFs.h:262
void(* USBMSCHFatFs_CloseFxn)(USBMSCHFatFs_Handle handle)
A function pointer to a driver specific implementation of USBMSCHFatFs_close().
Definition: USBMSCHFatFs.h:240
uintptr_t custom
Definition: USBMSCHFatFs.h:218
struct USBMSCHFatFs_Config USBMSCHFatFs_Config
USBMSCHFatFs Global configuration.
void const * hwAttrs
Definition: USBMSCHFatFs.h:301
USBMSCHFatFs_Handle USBMSCHFatFs_open(unsigned int index, unsigned char drv, USBMSCHFatFs_Params *params)
This function registers the USBMSCHFatFs driver with BIOS' FatFs module and mounts the FatFs file sys...
int(* USBMSCHFatFs_ControlFxn)(USBMSCHFatFs_Handle handle, unsigned int cmd, void *arg)
A function pointer to a driver specific implementation of USBMSCHFatFs_control(). ...
Definition: USBMSCHFatFs.h:246
void USBMSCHFatFs_close(USBMSCHFatFs_Handle handle)
Function to closes a given USBMSCHFatFs peripheral specified by the USBMSCHFatFs handle. This function unmounts the file system mounted by USBMSCHFatFs_open and unregisters the USBMSCHFatFs driver from BIOS' FatFs module.
Copyright 2016, Texas Instruments Incorporated