From b5c3a17cbcccf02e865d3f14f7b5f4a89afd8935 Mon Sep 17 00:00:00 2001 From: Andy Sun Date: Mon, 30 Aug 2021 20:28:50 +0800 Subject: [PATCH] [Cellular Library] Correct memory estimation. --- common/src/cellular_pktio.c | 4 ++-- docs/doxygen/include/size_table.md | 8 ++++---- docs/doxygen/pages.dox | 4 ++-- include/cellular_config_defaults.h | 4 ++-- test/unit-test/cellular_3gpp_api_utest.c | 5 ----- test/unit-test/cellular_3gpp_urc_handler_utest.c | 7 +------ test/unit-test/cellular_common_utest.c | 5 ----- test/unit-test/cellular_pkthandler_utest.c | 7 +------ test/unit-test/cellular_pktio_utest.c | 7 +------ test/unit-test/cellular_platform.h | 7 ++++--- 10 files changed, 17 insertions(+), 41 deletions(-) diff --git a/common/src/cellular_pktio.c b/common/src/cellular_pktio.c index 54c04344..206f52af 100644 --- a/common/src/cellular_pktio.c +++ b/common/src/cellular_pktio.c @@ -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; @@ -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 ) ); diff --git a/docs/doxygen/include/size_table.md b/docs/doxygen/include/size_table.md index 8a9f0a0a..8114a9b9 100644 --- a/docs/doxygen/include/size_table.md +++ b/docs/doxygen/include/size_table.md @@ -10,7 +10,7 @@ cellular_3gpp_api.c
6.3K
-
5.7K
+
5.8K
cellular_3gpp_urc_handler.c @@ -30,12 +30,12 @@ cellular_common.c
1.6K
-
1.4K
+
1.5K
cellular_pkthandler.c
1.4K
-
1.2K
+
1.3K
cellular_pktio.c @@ -45,6 +45,6 @@ Total estimates
13.9K
-
12.4K
+
12.7K
diff --git a/docs/doxygen/pages.dox b/docs/doxygen/pages.dox index 5055e0bb..e8d59742 100644 --- a/docs/doxygen/pages.dox +++ b/docs/doxygen/pages.dox @@ -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 diff --git a/include/cellular_config_defaults.h b/include/cellular_config_defaults.h index 1518f78a..039dc59c 100644 --- a/include/cellular_config_defaults.h +++ b/include/cellular_config_defaults.h @@ -331,8 +331,8 @@ * Possible values:`0 or 1`
* Default value (if undefined): 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 /** diff --git a/test/unit-test/cellular_3gpp_api_utest.c b/test/unit-test/cellular_3gpp_api_utest.c index e19e3042..d29210b7 100644 --- a/test/unit-test/cellular_3gpp_api_utest.c +++ b/test/unit-test/cellular_3gpp_api_utest.c @@ -135,11 +135,6 @@ int suiteTearDown( int numFailures ) /* ========================================================================== */ -void dummyAssert( int condition ) -{ - ( void ) condition; -} - bool MockPlatformMutex_Create( PlatformMutex_t * pNewMutex, bool recursive ) { diff --git a/test/unit-test/cellular_3gpp_urc_handler_utest.c b/test/unit-test/cellular_3gpp_urc_handler_utest.c index 17ba16c0..456535e3 100644 --- a/test/unit-test/cellular_3gpp_urc_handler_utest.c +++ b/test/unit-test/cellular_3gpp_urc_handler_utest.c @@ -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 ); diff --git a/test/unit-test/cellular_common_utest.c b/test/unit-test/cellular_common_utest.c index 03d0f2d1..5100d4df 100644 --- a/test/unit-test/cellular_common_utest.c +++ b/test/unit-test/cellular_common_utest.c @@ -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 ) diff --git a/test/unit-test/cellular_pkthandler_utest.c b/test/unit-test/cellular_pkthandler_utest.c index b7821d44..17859a6e 100644 --- a/test/unit-test/cellular_pkthandler_utest.c +++ b/test/unit-test/cellular_pkthandler_utest.c @@ -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 ); diff --git a/test/unit-test/cellular_pktio_utest.c b/test/unit-test/cellular_pktio_utest.c index 61f09c85..f3acc18e 100644 --- a/test/unit-test/cellular_pktio_utest.c +++ b/test/unit-test/cellular_pktio_utest.c @@ -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 ); diff --git a/test/unit-test/cellular_platform.h b/test/unit-test/cellular_platform.h index 10712e35..f6822670 100644 --- a/test/unit-test/cellular_platform.h +++ b/test/unit-test/cellular_platform.h @@ -38,7 +38,7 @@ /*-----------------------------------------------------------*/ -#define configASSERT dummyAssert +#define configASSERT assert #define Platform_Delay dummyDelay #define taskENTER_CRITICAL dummyTaskENTER_CRITICAL #define taskEXIT_CRITICAL dummyTaskEXIT_CRITICAL @@ -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__ */