tmp 1
This commit is contained in:
parent
bc01b1f0e8
commit
3957af107d
235 changed files with 159562 additions and 189150 deletions
|
@ -7,43 +7,17 @@
|
|||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||
* All rights reserved.</center></h2>
|
||||
* Copyright (c) 2017 STMicroelectronics. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
@ -66,9 +40,25 @@ int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object
|
|||
{
|
||||
|
||||
int ret;
|
||||
#if _USE_MUTEX
|
||||
|
||||
#if (osCMSIS < 0x20000U)
|
||||
osMutexDef(MTX);
|
||||
*sobj = osMutexCreate(osMutex(MTX));
|
||||
#else
|
||||
*sobj = osMutexNew(NULL);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if (osCMSIS < 0x20000U)
|
||||
osSemaphoreDef(SEM);
|
||||
*sobj = osSemaphoreCreate(osSemaphore(SEM), 1);
|
||||
#else
|
||||
*sobj = osSemaphoreNew(1, 1, NULL);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
ret = (*sobj != NULL);
|
||||
|
||||
return ret;
|
||||
|
@ -88,7 +78,11 @@ int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any erro
|
|||
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||
)
|
||||
{
|
||||
#if _USE_MUTEX
|
||||
osMutexDelete (sobj);
|
||||
#else
|
||||
osSemaphoreDelete (sobj);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -106,8 +100,23 @@ int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a gran
|
|||
)
|
||||
{
|
||||
int ret = 0;
|
||||
#if (osCMSIS < 0x20000U)
|
||||
|
||||
#if _USE_MUTEX
|
||||
if(osMutexWait(sobj, _FS_TIMEOUT) == osOK)
|
||||
#else
|
||||
if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if _USE_MUTEX
|
||||
if(osMutexAcquire(sobj, _FS_TIMEOUT) == osOK)
|
||||
#else
|
||||
if(osSemaphoreAcquire(sobj, _FS_TIMEOUT) == osOK)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
{
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -127,7 +136,11 @@ void ff_rel_grant (
|
|||
_SYNC_t sobj /* Sync object to be signaled */
|
||||
)
|
||||
{
|
||||
#if _USE_MUTEX
|
||||
osMutexRelease(sobj);
|
||||
#else
|
||||
osSemaphoreRelease(sobj);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue