William Kane / Generic

Dependents:   LaserioLib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers abcc_debug_err.c Source File

abcc_debug_err.c

00001 /*******************************************************************************
00002 ********************************************************************************
00003 **                                                                            **
00004 ** ABCC Driver version 4.01.01 (2015-12-14)                                   **
00005 **                                                                            **
00006 ** Delivered with:                                                            **
00007 **    ABP         7.16.01 (2015-10-14)                                        **
00008 **                                                                            */
00009 /*******************************************************************************
00010 ********************************************************************************
00011 ** COPYRIGHT NOTIFICATION (c) 2013 HMS Industrial Networks AB                 **
00012 **                                                                            **
00013 ** This code is the property of HMS Industrial Networks AB.                   **
00014 ** The source code may not be reproduced, distributed, or used without        **
00015 ** permission. When used together with a product from HMS, permission is      **
00016 ** granted to modify, reproduce and distribute the code in binary form        **
00017 ** without any restrictions.                                                  **
00018 **                                                                            **
00019 ** THE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. HMS DOES NOT    **
00020 ** WARRANT THAT THE FUNCTIONS OF THE CODE WILL MEET YOUR REQUIREMENTS, OR     **
00021 ** THAT THE OPERATION OF THE CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR     **
00022 ** THAT DEFECTS IN IT CAN BE CORRECTED.                                       **
00023 ********************************************************************************
00024 ********************************************************************************
00025 ** File Description:
00026 ** ABCC driver error and debug functions.
00027 ********************************************************************************
00028 ********************************************************************************
00029 */
00030 
00031 #include "abcc_drv_cfg.h"
00032 #include "abcc_sw_port.h"
00033 #include "abcc_td.h"
00034 #include "abp.h"
00035 #include "abcc_debug_err.h"
00036 
00037 /*******************************************************************************
00038 ** Constants
00039 ********************************************************************************
00040 */
00041 
00042 
00043 /*******************************************************************************
00044 ** Typedefs
00045 ********************************************************************************
00046 */
00047 
00048 
00049 /*******************************************************************************
00050 ** Public Globals
00051 ********************************************************************************
00052 */
00053 
00054 
00055 /*******************************************************************************
00056 ** Private Globals
00057 ********************************************************************************
00058 */
00059 #ifdef ABCC_SYS_16_BIT_CHAR
00060 #define ABCC_GetMsgCmdField( psMsg )   ( ABCC_GetLowAddrOct( (psMsg)->sHeader.iCmdReserved ) )
00061 #else
00062 #define ABCC_GetMsgCmdField( psMsg )   ( (psMsg)->sHeader.bCmd )
00063 #endif
00064 
00065 ABCC_ErrorReporter ErrorReporter;
00066 
00067 /*******************************************************************************
00068 ** Private Services
00069 ********************************************************************************
00070 */
00071 
00072 
00073 /*******************************************************************************
00074 ** Public Services
00075 ********************************************************************************
00076 */
00077 #if ABCC_CFG_DEBUG_MESSAGING
00078 void ABCC_DebugPrintMsg( char* pcInfo, ABP_MsgType* psMsg )
00079 {
00080    UINT16 i;
00081    UINT16 iDataSize;
00082    UINT8 bData;
00083 
00084    iDataSize = ABCC_GetMsgDataSize( psMsg );
00085 
00086    ABCC_PORT_DebugPrint( ( "\n%s:\n", pcInfo ) );
00087    ABCC_PORT_DebugPrint( ( "[ MsgBuf:0x%08x Size:0x%04x SrcId  :0x%02x DestObj:0x%02x\n  Inst  :0x%04x     Cmd :0x%02x   CmdExt0:0x%02x CmdExt1:0x%02x ]\n",
00088                          (UINT32)psMsg,
00089                           ABCC_GetMsgDataSize( psMsg ),
00090                           ABCC_GetMsgSourceId( psMsg ),
00091                           ABCC_GetMsgDestObj( psMsg ),
00092                           ABCC_GetMsgInstance( psMsg ),
00093                           ABCC_GetMsgCmdField( psMsg ),
00094                           ABCC_GetMsgCmdExt0( psMsg ),
00095                           ABCC_GetMsgCmdExt1( psMsg ) ) );
00096 
00097    ABCC_PORT_DebugPrint( ("[ ") );
00098    for( i = 0; i < iDataSize; i++ )
00099    {
00100       if( ( i % 16 ) == 15 )
00101       {
00102          ABCC_PORT_DebugPrint( ("\n  ") );
00103       }
00104 
00105       ABCC_GetMsgData8( psMsg, &bData, i );
00106       ABCC_PORT_DebugPrint( ("0x%02x ", bData ) );
00107    }
00108 
00109    ABCC_PORT_DebugPrint( ( "]\n\n") );
00110 }
00111 
00112 void ABCC_DebugPrintMsgEvent( char* pcInfo, ABP_MsgType* psMsg )
00113 {
00114    ABCC_PORT_DebugPrint( ( "%s: MsgBuf:0x%08x SrcId:0x%02x\n",
00115                           pcInfo,(UINT32)psMsg,
00116                           ABCC_GetMsgSourceId( psMsg ) ) );
00117 }
00118 #endif
00119 
00120