src/occ_405/errl/errl.c
// Function Specification
//
// Name:  createErrl
//
// Description: Create an Error Log
//
// End Function Specification
Function Specification
Name:  createErrl

Create an Error Log

End Function Specification
Function Specification Name : createErrl Create an Error Log End Function Specification
errlHndl_t createErrl(
            const uint16_t i_modId,
            const uint8_t i_reasonCode,
            const uint16_t i_extReasonCode,
            const ERRL_SEVERITY i_sev,
            const trace_descriptor_array_t* i_trace,
            const uint16_t i_traceSz,
            const uint32_t i_userData1,
            const uint32_t i_userData2
            )
{
    errlHndl_t  l_rc = INVALID_ERR_HNDL;
    uint64_t    l_time = 0;
    uint8_t     l_id = 0;
    uint8_t     l_errSlot = getErrSlotNumAndErrId( i_sev, &l_id, &l_time);
    static uint8_t traceCount = 5;
    if ( l_errSlot != ERRL_INVALID_SLOT )
    {
        TRAC_INFO("Creating error log in slot [%d]", l_errSlot);
        l_rc = G_occErrSlots[ l_errSlot ];
        l_rc->iv_userDetails.iv_entrySize = sizeof( ErrlEntry_t );
        addErrHistory( l_rc );
        addTraceToErrl( i_trace, i_traceSz,  l_rc );
        l_rc->iv_entryId = l_id;
        l_rc->iv_version = ERRL_STRUCT_VERSION_1;
        l_rc->iv_userDetails.iv_timeStamp = l_time;
        l_rc->iv_severity = (i_sev == ERRL_SEV_CALLHOME_DATA ? (uint8_t)ERRL_SEV_INFORMATIONAL : i_sev);
        l_rc->iv_extendedRC = i_extReasonCode;
        l_rc->iv_userDetails.iv_version = ERRL_USR_DTL_STRUCT_VERSION_1;
        l_rc->iv_userDetails.iv_modId = i_modId;
        l_rc->iv_reasonCode = i_reasonCode;
        l_rc->iv_userDetails.iv_userData1 = i_userData1;
        l_rc->iv_userDetails.iv_userData2 = i_userData2;
        l_rc->iv_numCallouts = 0;
        l_rc->iv_userDetails.iv_fclipHistory = g_amec->proc[0].chip_f_reason_history;
        l_rc->iv_userDetails.iv_occId = G_pbax_id.chip_id;
        l_rc->iv_userDetails.iv_occRole = G_occ_role;
        l_rc->iv_userDetails.iv_operatingState = CURRENT_STATE();
    }
    else
    {
        if( traceCount > 0 )
        {
            TRAC_INFO("Error Logs are FULL  - Slot [%d]", l_errSlot);
            traceCount--;
        }
    }
    return l_rc;
}
errlHndl_t createErrl ( const uint16_t i_modId , const uint8_t i_reasonCode , const uint16_t i_extReasonCode , const ERRL_SEVERITY i_sev , const trace_descriptor_array_t * i_trace , const uint16_t i_traceSz , const uint32_t i_userData1 , const uint32_t i_userData2 ) { errlHndl_t l_rc = INVALID_ERR_HNDL ; uint64_t l_time = 0 ; uint8_t l_id = 0 ; uint8_t l_errSlot = getErrSlotNumAndErrId ( i_sev , & l_id , & l_time ) ; static uint8_t traceCount = 5 ; if ( l_errSlot != ERRL_INVALID_SLOT ) { TRAC_INFO ( " " , l_errSlot ) ; l_rc = G_occErrSlots [ l_errSlot ] ; l_rc -> iv_userDetails . iv_entrySize = sizeof ( ErrlEntry_t ) ; addErrHistory ( l_rc ) ; addTraceToErrl ( i_trace , i_traceSz , l_rc ) ; l_rc -> iv_entryId = l_id ; l_rc -> iv_version = ERRL_STRUCT_VERSION_1 ; l_rc -> iv_userDetails . iv_timeStamp = l_time ; l_rc -> iv_severity = ( i_sev == ERRL_SEV_CALLHOME_DATA ? ( uint8_t ) ERRL_SEV_INFORMATIONAL : i_sev ) ; l_rc -> iv_extendedRC = i_extReasonCode ; l_rc -> iv_userDetails . iv_version = ERRL_USR_DTL_STRUCT_VERSION_1 ; l_rc -> iv_userDetails . iv_modId = i_modId ; l_rc -> iv_reasonCode = i_reasonCode ; l_rc -> iv_userDetails . iv_userData1 = i_userData1 ; l_rc -> iv_userDetails . iv_userData2 = i_userData2 ; l_rc -> iv_numCallouts = 0 ; l_rc -> iv_userDetails . iv_fclipHistory = g_amec -> proc [ 0 ] . chip_f_reason_history ; l_rc -> iv_userDetails . iv_occId = G_pbax_id . chip_id ; l_rc -> iv_userDetails . iv_occRole = G_occ_role ; l_rc -> iv_userDetails . iv_operatingState = CURRENT_STATE ( ) ; } else { if ( traceCount > 0 ) { TRAC_INFO ( " " , l_errSlot ) ; traceCount -- ; } } return l_rc ; }
Function Specification
Name:  createErrl
Function Specification Name : createErrl
// get slot pointer // save off default size // add error history // add trace // save off entry Id //Save off version info // save off time // if its a call home error then set the sev to informational // save off user detail section version // save off rest of input parameters // set callout count to 0 // save off occ fields