Verified Commit f2d281a7 authored by Vincent Coubard's avatar Vincent Coubard
Browse files

Cleanup comments and style.


Signed-off-by: Vincent Coubard's avatarVincent Coubard <vincent.coubard@arm.com>
parent bc7ab904
......@@ -25,7 +25,7 @@
*/
/**
* @file iot_platform_types_posix.h
* @file iot_platform_types_freertos.h
* @brief Definitions of platform layer types on POSIX systems.
*/
......
......@@ -122,13 +122,13 @@ bool Iot_CreateDetachedThread( IotThreadRoutine_t threadRoutine,
.priority = priority,
};
osThreadId_t id = osThreadNew(_threadRoutineWrapper, pThreadInfo, &thread_attr);
osThreadId_t id = osThreadNew( _threadRoutineWrapper, pThreadInfo, &thread_attr );
if(id == NULL)
{
/* Task creation failed. */
IotLogWarn( "Failed to create thread." );
IotThreads_Free(pThreadInfo);
IotThreads_Free( pThreadInfo );
status = false;
}
......@@ -275,7 +275,7 @@ void IotSemaphore_Destroy( IotSemaphore_t * pSemaphore )
IotLogDebug( "Destroying semaphore %p.", internalSemaphore );
osSemaphoreDelete(internalSemaphore);
osSemaphoreDelete( internalSemaphore );
}
/*-----------------------------------------------------------*/
......@@ -286,10 +286,10 @@ void IotSemaphore_Wait( IotSemaphore_t * pSemaphore )
configASSERT( internalSemaphore != NULL );
IotLogDebug("Waiting on semaphore %p.", internalSemaphore);
IotLogDebug( "Waiting on semaphore %p.", internalSemaphore );
/* Take the semaphore using the FreeRTOS API. */
if (osSemaphoreAcquire( *internalSemaphore, osWaitForever ) != osOK) {
if ( osSemaphoreAcquire( *internalSemaphore, osWaitForever ) != osOK ) {
IotLogWarn( "Failed to wait on semaphore %p.", pSemaphore );
/* Assert here, debugging we always want to know that this happened because you think
......@@ -321,9 +321,9 @@ bool IotSemaphore_TimedWait( IotSemaphore_t * pSemaphore,
configASSERT( internalSemaphore != NULL );
/* Take the semaphore using the CMSIS RTOS API. */
if (osSemaphoreAcquire( * internalSemaphore, timeoutMs) != osOK ) {
if ( osSemaphoreAcquire( * internalSemaphore, timeoutMs) != osOK ) {
/* Only warn if timeout > 0 */
if (timeoutMs > 0) {
if ( timeoutMs > 0 ) {
IotLogWarn( "Timeout waiting on semaphore %p.", internalSemaphore );
}
......@@ -347,7 +347,7 @@ void IotSemaphore_Post( IotSemaphore_t * pSemaphore )
if ( result == osErrorResource ) {
IotLogDebug( "Unable to give semaphore over maximum", internalSemaphore );
} else if (result == osErrorParameter) {
} else if ( result == osErrorParameter ) {
IotLogDebug( "Semaphore is NULL of invalid", internalSemaphore );
}
}
......
......@@ -152,9 +152,9 @@ static void prvSocketsClose( ss_ctx_t * ctx )
vPortFree( ctx->destination );
}
if (ctx->RefcountLock)
if ( ctx->RefcountLock )
{
osMutexDelete(ctx->RefcountLock);
osMutexDelete( ctx->RefcountLock );
}
vPortFree( ctx );
......@@ -166,7 +166,7 @@ static void prvSocketsClose( ss_ctx_t * ctx )
*/
static void prvDecrementRefCount( ss_ctx_t * ctx )
{
osMutexAcquire(ctx->RefcountLock, osWaitForever);
osMutexAcquire( ctx->RefcountLock, osWaitForever );
ctx->ulRefcount -= 1;
if( ctx->ulRefcount == 0 )
{
......@@ -174,7 +174,7 @@ static void prvDecrementRefCount( ss_ctx_t * ctx )
// do not release lock as it's been removed
return;
}
osMutexRelease(ctx->RefcountLock);
osMutexRelease( ctx->RefcountLock );
}
/*
......@@ -182,9 +182,9 @@ static void prvDecrementRefCount( ss_ctx_t * ctx )
*/
static void prvIncrementRefCount( ss_ctx_t * ctx )
{
osMutexAcquire(ctx->RefcountLock, osWaitForever);
osMutexAcquire( ctx->RefcountLock, osWaitForever );
ctx->ulRefcount += 1;
osMutexRelease(ctx->RefcountLock);
osMutexRelease( ctx->RefcountLock );
}
/*
......@@ -263,7 +263,6 @@ static void vTaskRxSelect( void * param )
ret = iotSocketRecv( s, NULL, 0 );
if ( ret != IOT_SOCKET_EAGAIN )
{
configPRINTF( ( "for ( ; ; ) error %d\n", ret ) );
break;
}
}
......
......@@ -272,7 +272,8 @@ template <typename T> struct CircularSlidingWindow {
size_t first_block = current_stride / strides_per_block();
auto last_block = ((current_stride * stride_size + window_size - 1) / block_size) % block_count;
// Go to sleep if one of the block is not available.
// Go to sleep if one of the block that contains the next stride is being written.
// If the stride is already loaded, copy it into the destination buffer.
while (first_block == get_block_under_write() || last_block == get_block_under_write()) {
osStatus_t status = osSemaphoreAcquire(semaphore, osWaitForever);
if (status != osOK) {
......@@ -298,8 +299,6 @@ template <typename T> struct CircularSlidingWindow {
// Compute the next stride
++current_stride;
current_stride %= stride_count();
// we will be called again and if there are more strides ready to read we will skip trying to get the semaphore
}
// This is called from ISR
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment