src/occ_405/errl/errl.c
// Function Specification
//
// Name:  addUsrDtlsToErrl
//
// Description: Add User Details to an Error Log
//
// End Function Specification
Function Specification
Name:  addUsrDtlsToErrl

Add User Details to an Error Log

End Function Specification
Function Specification Name : addUsrDtlsToErrl Add User Details to an Error Log End Function Specification
void addUsrDtlsToErrl(
            errlHndl_t io_err,
            uint8_t *i_dataPtr,
            const uint16_t i_size,
            const uint8_t i_version,
            const ERRL_USR_DETAIL_TYPE i_type)
{
    uint16_t l_maxSize = (i_type == ERRL_USR_DTL_CALLHOME_DATA) ? MAX_ERRL_CALL_HOME_SZ : MAX_ERRL_ENTRY_SZ;
    if ((io_err != NULL ) &&
        (io_err != INVALID_ERR_HNDL ) &&
        (io_err->iv_userDetails.iv_committed == 0) &&
        (i_size != 0) &&
        (i_dataPtr != NULL) &&
        ((io_err->iv_userDetails.iv_entrySize) < l_maxSize))
    {
        ErrlUserDetailsEntry_t l_usrDtlsEntry;
        uint16_t l_headerSz = sizeof( l_usrDtlsEntry );
        uint16_t l_availableSize = l_maxSize - (io_err->iv_userDetails.iv_entrySize + l_headerSz );
        l_usrDtlsEntry.iv_size = ( i_size < l_availableSize ) ? i_size : l_availableSize;
        l_usrDtlsEntry.iv_type = (uint8_t)i_type;
        l_usrDtlsEntry.iv_version = i_version;
        uint16_t l_actualSizeOfUsrDtls = l_headerSz + l_usrDtlsEntry.iv_size;
        void * l_p = io_err;
        l_p = memcpy( l_p+((io_err->iv_userDetails.iv_entrySize)),&l_usrDtlsEntry, l_headerSz );
        memcpy( l_p+l_headerSz, i_dataPtr, l_usrDtlsEntry.iv_size);
        io_err->iv_userDetails.iv_userDetailEntrySize += l_actualSizeOfUsrDtls;
        io_err->iv_userDetails.iv_entrySize += l_actualSizeOfUsrDtls;
    }
}
void addUsrDtlsToErrl ( errlHndl_t io_err , uint8_t * i_dataPtr , const uint16_t i_size , const uint8_t i_version , const ERRL_USR_DETAIL_TYPE i_type ) { uint16_t l_maxSize = ( i_type == ERRL_USR_DTL_CALLHOME_DATA ) ? MAX_ERRL_CALL_HOME_SZ : MAX_ERRL_ENTRY_SZ ; if ( ( io_err != NULL ) && ( io_err != INVALID_ERR_HNDL ) && ( io_err -> iv_userDetails . iv_committed == 0 ) && ( i_size != 0 ) && ( i_dataPtr != NULL ) && ( ( io_err -> iv_userDetails . iv_entrySize ) < l_maxSize ) ) { ErrlUserDetailsEntry_t l_usrDtlsEntry ; uint16_t l_headerSz = sizeof ( l_usrDtlsEntry ) ; uint16_t l_availableSize = l_maxSize - ( io_err -> iv_userDetails . iv_entrySize + l_headerSz ) ; l_usrDtlsEntry . iv_size = ( i_size < l_availableSize ) ? i_size : l_availableSize ; l_usrDtlsEntry . iv_type = ( uint8_t ) i_type ; l_usrDtlsEntry . iv_version = i_version ; uint16_t l_actualSizeOfUsrDtls = l_headerSz + l_usrDtlsEntry . iv_size ; void * l_p = io_err ; l_p = memcpy ( l_p + ( ( io_err -> iv_userDetails . iv_entrySize ) ) , & l_usrDtlsEntry , l_headerSz ) ; memcpy ( l_p + l_headerSz , i_dataPtr , l_usrDtlsEntry . iv_size ) ; io_err -> iv_userDetails . iv_userDetailEntrySize += l_actualSizeOfUsrDtls ; io_err -> iv_userDetails . iv_entrySize += l_actualSizeOfUsrDtls ; } }
Function Specification
Name:  addUsrDtlsToErrl
Function Specification Name : addUsrDtlsToErrl
// Locals // 1.  check if handle is valid // 2.  NOT empty // 3.  not committed // 4.  size being passed in is valid // 5.  data pointer is valid // 6.  and we have enough size //local copy of the usr details entry //adjust user details entry size to available size (word align ) //set type //set version //set the data //copy the data into error the offset is the size of the current errorlog //update usr data entry size //update error log size