Skip to content

Commit

Permalink
[Cellular Library] Correct memory estimation.
Browse files Browse the repository at this point in the history
  • Loading branch information
andysun2015 committed Sep 1, 2021
1 parent 804c8dd commit b5c3a17
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 41 deletions.
4 changes: 2 additions & 2 deletions common/src/cellular_pktio.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void _saveData( char * pLine,
LogDebug( ( "_saveData : Save data %p with length %d", pLine, dataLen ) );

pNew = ( CellularATCommandLine_t * ) Platform_Malloc( sizeof( CellularATCommandLine_t ) );
configASSERT( ( int32_t ) ( pNew != NULL ) );
configASSERT( ( pNew != NULL ) );

/* Reuse the pktio buffer instead of allocate. */
pNew->pLine = pLine;
Expand Down Expand Up @@ -254,7 +254,7 @@ static CellularATCommandResponse_t * _Cellular_AtResponseNew( void )
CellularATCommandResponse_t * pNew = NULL;

pNew = ( CellularATCommandResponse_t * ) Platform_Malloc( sizeof( CellularATCommandResponse_t ) );
configASSERT( ( int32_t ) ( pNew != NULL ) );
configASSERT( ( pNew != NULL ) );

( void ) memset( ( void * ) pNew, 0, sizeof( CellularATCommandResponse_t ) );

Expand Down
8 changes: 4 additions & 4 deletions docs/doxygen/include/size_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<tr>
<td>cellular_3gpp_api.c</td>
<td><center>6.3K</center></td>
<td><center>5.7K</center></td>
<td><center>5.8K</center></td>
</tr>
<tr>
<td>cellular_3gpp_urc_handler.c</td>
Expand All @@ -30,12 +30,12 @@
<tr>
<td>cellular_common.c</td>
<td><center>1.6K</center></td>
<td><center>1.4K</center></td>
<td><center>1.5K</center></td>
</tr>
<tr>
<td>cellular_pkthandler.c</td>
<td><center>1.4K</center></td>
<td><center>1.2K</center></td>
<td><center>1.3K</center></td>
</tr>
<tr>
<td>cellular_pktio.c</td>
Expand All @@ -45,6 +45,6 @@
<tr>
<td><b>Total estimates</b></td>
<td><b><center>13.9K</center></b></td>
<td><b><center>12.4K</center></b></td>
<td><b><center>12.7K</center></b></td>
</tr>
</table>
4 changes: 2 additions & 2 deletions docs/doxygen/pages.dox
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ Some configuration settings are C pre-processor constants, and some are function
@section CELLULAR_CONFIG_STATIC_ALLOCATION_CONTEXT
@copydoc CELLULAR_CONFIG_STATIC_ALLOCATION_CONTEXT

@section CELLULAR_CONFIG_STATIC_ALLOCATION_COMM_CONTEXT
@copydoc CELLULAR_CONFIG_STATIC_ALLOCATION_COMM_CONTEXT
@section CELLULAR_CONFIG_STATIC_COMM_CONTEXT_ALLOCATION
@copydoc CELLULAR_CONFIG_STATIC_COMM_CONTEXT_ALLOCATION

@section CELLULAR_CONFIG_DEFAULT_RAT
@copydoc CELLULAR_CONFIG_DEFAULT_RAT
Expand Down
4 changes: 2 additions & 2 deletions include/cellular_config_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@
* <b>Possible values:</b>`0 or 1`<br>
* <b>Default value (if undefined):</b> 0
*/
#ifndef CELLULAR_CONFIG_STATIC_ALLOCATION_COMM_CONTEXT
#define CELLULAR_CONFIG_STATIC_ALLOCATION_COMM_CONTEXT ( 0U )
#ifndef CELLULAR_CONFIG_STATIC_COMM_CONTEXT_ALLOCATION
#define CELLULAR_CONFIG_STATIC_COMM_CONTEXT_ALLOCATION ( 0U )
#endif

/**
Expand Down
5 changes: 0 additions & 5 deletions test/unit-test/cellular_3gpp_api_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ int suiteTearDown( int numFailures )

/* ========================================================================== */

void dummyAssert( int condition )
{
( void ) condition;
}

bool MockPlatformMutex_Create( PlatformMutex_t * pNewMutex,
bool recursive )
{
Expand Down
7 changes: 1 addition & 6 deletions test/unit-test/cellular_3gpp_urc_handler_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,11 @@ int suiteTearDown( int numFailures )
}

/* ========================================================================== */
void dummyDelay( int milliseconds )
void dummyDelay( uint32_t milliseconds )
{
( void ) milliseconds;
}

void dummyAssert( int condition )
{
( void ) condition;
}

void * mock_malloc( size_t size )
{
return malloc( size );
Expand Down
5 changes: 0 additions & 5 deletions test/unit-test/cellular_common_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ void dummyTaskEXIT_CRITICAL( void )
{
}

void dummyAssert( int condition )
{
( void ) condition;
}

static CellularCommInterfaceError_t _prvCommIntfOpen( CellularCommInterfaceReceiveCallback_t receiveCallback,
void * pUserData,
CellularCommInterfaceHandle_t * pCommInterfaceHandle )
Expand Down
7 changes: 1 addition & 6 deletions test/unit-test/cellular_pkthandler_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,11 @@ int suiteTearDown( int numFailures )

/* ========================================================================== */

void dummyDelay( int milliseconds )
void dummyDelay( uint32_t milliseconds )
{
( void ) milliseconds;
}

void dummyAssert( int condition )
{
( void ) condition;
}

void * mock_malloc( size_t size )
{
return ( void * ) malloc( size );
Expand Down
7 changes: 1 addition & 6 deletions test/unit-test/cellular_pktio_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,11 @@ int suiteTearDown( int numFailures )

/* ========================================================================== */

void dummyDelay( int milliseconds )
void dummyDelay( uint32_t milliseconds )
{
( void ) milliseconds;
}

void dummyAssert( int condition )
{
( void ) condition;
}

void * mock_malloc( size_t size )
{
return ( void * ) malloc( size );
Expand Down
7 changes: 4 additions & 3 deletions test/unit-test/cellular_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

/*-----------------------------------------------------------*/

#define configASSERT dummyAssert
#define configASSERT assert
#define Platform_Delay dummyDelay
#define taskENTER_CRITICAL dummyTaskENTER_CRITICAL
#define taskEXIT_CRITICAL dummyTaskEXIT_CRITICAL
Expand Down Expand Up @@ -239,9 +239,10 @@ int32_t MockPlatformEventGroup_SetBitsFromISR( PlatformEventGroupHandle_t groupE
EventBits_t event,
BaseType_t * pHigherPriorityTaskWoken );

void dummyAssert( int condition );
void dummyDelay( int milliseconds );
void dummyDelay( uint32_t milliseconds );

void dummyTaskENTER_CRITICAL( void );

void dummyTaskEXIT_CRITICAL( void );

#endif /* __CELLULAR_PLATFORM_H__ */

0 comments on commit b5c3a17

Please sign in to comment.