GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: core/src/ux_system_error_handler.c Lines: 6 6 100.0 %
Date: 2026-03-06 18:57:10 Branches: 2 2 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** USBX Component                                                        */
17
/**                                                                       */
18
/**   System                                                              */
19
/**                                                                       */
20
/**************************************************************************/
21
/**************************************************************************/
22
23
/* Include necessary system files.  */
24
25
#define UX_SOURCE_CODE
26
27
#include "ux_api.h"
28
29
30
#ifndef UX_DISABLE_ERROR_HANDLER
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _ux_system_error_handler                            PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Chaoqiong Xiao, Microsoft Corporation                               */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function saves the last critical error from USBX functions.    */
44
/*    It is mainly used for debugging purpose to trap where error occurred*/
45
/*                                                                        */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*   error_code                                                           */
50
/*                                                                        */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    Application                                                         */
63
/*                                                                        */
64
/**************************************************************************/
65
18166
VOID   _ux_system_error_handler(UINT system_level, UINT system_context, UINT error_code)
66
{
67
68
    /* Save the last system error code.  */
69
18166
    _ux_system -> ux_system_last_error =  error_code;
70
71
    /* Increment the total number of system errors.  */
72
18166
    _ux_system -> ux_system_error_count++;
73
74
    /* Is there an application call back function to call ? */
75
18166
    if (_ux_system -> ux_system_error_callback_function != UX_NULL)
76
    {
77
78
        /* The callback function is defined, call it.  */
79
18030
        _ux_system -> ux_system_error_callback_function(system_level, system_context, error_code);
80
    }
81
18166
}
82
#endif