ff_locking.h 3.1 KB

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