]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-Plus-FAT/include/ff_locking.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-Plus-FAT / include / ff_locking.h
1 /*\r
2  * FreeRTOS+FAT build 191128 - Note:  FreeRTOS+FAT is still in the lab!\r
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  * Authors include James Walmsley, Hein Tibosch and Richard Barry\r
5  *\r
6  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
7  * this software and associated documentation files (the "Software"), to deal in\r
8  * the Software without restriction, including without limitation the rights to\r
9  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
10  * the Software, and to permit persons to whom the Software is furnished to do so,\r
11  * subject to the following conditions:\r
12  *\r
13  * The above copyright notice and this permission notice shall be included in all\r
14  * copies or substantial portions of the Software.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * https://www.FreeRTOS.org\r
24  *\r
25  */\r
26 \r
27 /**\r
28  *      @file           ff_locking.h\r
29  *      @ingroup        LOCKING\r
30  **/\r
31 \r
32 #ifndef _FF_LOCKING_H_\r
33 #define _FF_LOCKING_H_\r
34 \r
35 #ifdef __cplusplus\r
36 extern "C" {\r
37 #endif\r
38 \r
39 #include <stdlib.h>\r
40 \r
41 /*---------- PROTOTYPES (in order of appearance). */\r
42 \r
43 /* PUBLIC: */\r
44 \r
45 \r
46 /* PRIVATE: */\r
47 void            FF_PendSemaphore                ( void *pSemaphore );\r
48 BaseType_t      FF_TrySemaphore                 ( void *pSemaphore, uint32_t TimeMs );\r
49 void            FF_ReleaseSemaphore             ( void *pSemaphore );\r
50 void            FF_Sleep                                ( uint32_t TimeMs );\r
51 \r
52 /* Create an event group and bind it to an I/O manager. */\r
53 BaseType_t      FF_CreateEvents( FF_IOManager_t *pxIOManager );\r
54 \r
55 /* Delete an event group. */\r
56 void FF_DeleteEvents( FF_IOManager_t *pxIOManager );\r
57 \r
58 /* Get a lock on all DIR operations for a given I/O manager. */\r
59 void FF_LockDirectory( FF_IOManager_t *pxIOManager );\r
60 \r
61 /* Release the lock on all DIR operations. */\r
62 void FF_UnlockDirectory( FF_IOManager_t *pxIOManager );\r
63 \r
64 /* Get a lock on all FAT operations for a given I/O manager. */\r
65 void FF_LockFAT( FF_IOManager_t *pxIOManager );\r
66 \r
67 /* Release the lock on all FAT operations. */\r
68 void FF_UnlockFAT( FF_IOManager_t *pxIOManager );\r
69 \r
70 /* Called from FF_GetBuffer() as long as no buffer is available. */\r
71 BaseType_t FF_BufferWait( FF_IOManager_t *pxIOManager, uint32_t xWaitMS );\r
72 \r
73 /* Called from FF_ReleaseBuffer(). */\r
74 void FF_BufferProceed( FF_IOManager_t *pxIOManager );\r
75 \r
76 /* Check if the current task already has locked the FAT. */\r
77 int FF_Has_Lock( FF_IOManager_t *pxIOManager, uint32_t aBits );\r
78 \r
79 /*\r
80  * Throw a configASSERT() in case the FAT has not been locked\r
81  * by this task.\r
82  */\r
83 /* _HT_ This function is only necessary while testing. */\r
84 void FF_Assert_Lock( FF_IOManager_t *pxIOManager, uint32_t aBits );\r
85 \r
86 #ifdef __cplusplus\r
87 } /* extern "C" */\r
88 #endif\r
89 \r
90 #endif  /* _FF_LOCKING_H_ */\r
91 \r