diff options
author | Sachin Gupta <sgupta2m@in.ibm.com> | 2015-09-15 06:40:21 -0500 |
---|---|---|
committer | Amit J. Tendolkar <amit.tendolkar@in.ibm.com> | 2015-09-16 12:07:28 -0500 |
commit | 0321d657e2008d8c99ed9f671db4405b161ff616 (patch) | |
tree | bf6f1a11aec09dba5c6ea2410a3d9a5c1e2c9e01 /sbe | |
parent | 6bb5153bc0a8c1a5b12b6b6e6b4085ea70a9464d (diff) | |
download | talos-sbe-0321d657e2008d8c99ed9f671db4405b161ff616.tar.gz talos-sbe-0321d657e2008d8c99ed9f671db4405b161ff616.zip |
assert skeleton implementation
Change-Id: I0f1008c913b4407789f1b1eef2d5584209b7d288
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/20518
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: Amit J. Tendolkar <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'sbe')
-rw-r--r-- | sbe/sbefw/assert.h | 24 | ||||
-rw-r--r-- | sbe/sbefw/pool.C | 11 | ||||
-rw-r--r-- | sbe/sbefw/sbecmdiplcontrol.C | 4 | ||||
-rw-r--r-- | sbe/sbefw/sbecmdprocessor.C | 12 | ||||
-rw-r--r-- | sbe/sbefw/sbeirq.C | 8 | ||||
-rw-r--r-- | sbe/sbefw/vector | 4 |
6 files changed, 35 insertions, 28 deletions
diff --git a/sbe/sbefw/assert.h b/sbe/sbefw/assert.h new file mode 100644 index 00000000..bd1dbe99 --- /dev/null +++ b/sbe/sbefw/assert.h @@ -0,0 +1,24 @@ +/* + * @file assert.h + * + * @brief This file contains the assert macro for SBE + */ +#ifndef SBE_ASSERT_H +#define SBE_ASSERT_H +#include "sbetrace.H" + +//@TODO via RTC 129166 +//inject exception to halt SBE. Also see if we can use some +//PK kernel API. +#ifndef NDEBUG +#define assert(expr) \ + if( !(expr )) \ + { \ + SBE_ERROR("assertion failed: "#expr); \ + } \ + +#else +#define assert(expr) +#endif //NDEBUG + +#endif // SBE_ASSERT_H diff --git a/sbe/sbefw/pool.C b/sbe/sbefw/pool.C index 3f9709e3..6f5acf24 100644 --- a/sbe/sbefw/pool.C +++ b/sbe/sbefw/pool.C @@ -2,6 +2,7 @@ #include <sbetrace.H> #include <stddef.h> #include<pool.H> +#include "assert.h" namespace SBEVECTORPOOL { @@ -30,14 +31,8 @@ void releaseMem( vectorMemPool_t * i_pool ) { if ( NULL == i_pool ) break; - if( 0 == i_pool->refCount ) - { - //TODO via RTC 129166 - // Assert here. This pool was not supposed to be in use. - // Currenty just keeping it as is as we can not do much till the - // time support for assert is in. - break; - } + // Assert here. This pool was not supposed to be in use. + assert( 0 != i_pool->refCount ) SBE_TRACE(" Releasing pool 0x%08X", i_pool); i_pool->refCount--; SBE_TRACE(" In releaseMem() RefCount:%u", i_pool->refCount); diff --git a/sbe/sbefw/sbecmdiplcontrol.C b/sbe/sbefw/sbecmdiplcontrol.C index 7ff3208e..6bf47354 100644 --- a/sbe/sbefw/sbecmdiplcontrol.C +++ b/sbe/sbefw/sbecmdiplcontrol.C @@ -9,6 +9,7 @@ #include "sbefifo.H" #include "sbetrace.H" #include "sbe_sp_intf.H" +#include "assert.h" #include "fapi2.H" // Pervasive HWP Header Files ( istep 2) @@ -340,9 +341,8 @@ ReturnCode sbeExecuteIstep (const uint8_t i_major, const uint8_t i_minor) // We should never reach here as before calling this validation has // been done. - // @TODO via RTC 129166. - // assert if we reach in default case. default: + assert(0); break; } diff --git a/sbe/sbefw/sbecmdprocessor.C b/sbe/sbefw/sbecmdprocessor.C index b9a6e9b2..faaa88d8 100644 --- a/sbe/sbefw/sbecmdprocessor.C +++ b/sbe/sbefw/sbecmdprocessor.C @@ -12,6 +12,7 @@ #include "sbeirq.H" #include "sbetrace.H" #include "sbe_sp_intf.H" +#include "assert.h" ////////////////////////////////////////////////////// ////////////////////////////////////////////////////// @@ -149,16 +150,7 @@ void sbeSyncCommandProcessor_routine(void *i_pArg) // Get the command function l_pFuncP = sbeFindCmdFunc (l_cmdClass, l_cmdOpCode) ; - if (!l_pFuncP) - { - // No Supported function found - SBE_ERROR(SBE_FUNC"No supported function"); - l_rc = SBE_FUNC_NOT_SUPPORTED; - - // @TODO via RTC : 129166 - // force assert - break; - } + assert( l_pFuncP ) // Call the ChipOp function l_rc = l_pFuncP ((uint8_t *)i_pArg); diff --git a/sbe/sbefw/sbeirq.C b/sbe/sbefw/sbeirq.C index 3aa92188..ccb6bafb 100644 --- a/sbe/sbefw/sbeirq.C +++ b/sbe/sbefw/sbeirq.C @@ -8,7 +8,7 @@ #include "sbeexeintf.H" #include "sbeirq.H" #include "sbetrace.H" - +#include "assert.h" //////////////////////////////////////////////////////////////// // @brief: SBE control loop ISR: @@ -38,17 +38,15 @@ void sbe_fifo_interrupt_handler (void *i_pArg, PkIrqId i_irq) { // If we received an error while posting the semaphore, // unmask the interrupt back and assert - // @TODO via RTC : 129166 - // Add support for ASSERT here SBE_ERROR(SBE_FUNC"pk_semaphore_post failed, rc=[%d]", l_rc); + assert(!l_rc); pk_irq_enable(i_irq); } break; default: SBE_ERROR(SBE_FUNC"Unknown IRQ, assert"); - // @TODO via RTC : 129166 - // Add support for ASSERT here + assert(0); break; } #undef SBE_FUNC diff --git a/sbe/sbefw/vector b/sbe/sbefw/vector index e8a7397d..3ed67b85 100644 --- a/sbe/sbefw/vector +++ b/sbe/sbefw/vector @@ -14,9 +14,7 @@ #endif #include <stdint.h> #include <pool.H> -//TODO via RTC 129166 -// Add implementation for assert -#define assert(X) +#include <assert.h> namespace std { |