GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lx_nand_flash_system_error.c Lines: 0 9 0.0 %
Date: 2024-03-11 05:20:25 Branches: 0 4 0.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 *
4
 * This program and the accompanying materials are made available under the
5
 * terms of the MIT License which is available at
6
 * https://opensource.org/licenses/MIT.
7
 *
8
 * SPDX-License-Identifier: MIT
9
 **************************************************************************/
10
11
12
/**************************************************************************/
13
/**************************************************************************/
14
/**                                                                       */
15
/** LevelX Component                                                      */
16
/**                                                                       */
17
/**   NAND Flash                                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
/**************************************************************************/
21
22
#define LX_SOURCE_CODE
23
24
25
/* Disable ThreadX error checking.  */
26
27
#ifndef LX_DISABLE_ERROR_CHECKING
28
#define LX_DISABLE_ERROR_CHECKING
29
#endif
30
31
32
/* Include necessary system files.  */
33
34
#include "lx_api.h"
35
36
37
/**************************************************************************/
38
/*                                                                        */
39
/*  FUNCTION                                               RELEASE        */
40
/*                                                                        */
41
/*    _lx_nand_flash_system_error                         PORTABLE C      */
42
/*                                                           6.2.1       */
43
/*  AUTHOR                                                                */
44
/*                                                                        */
45
/*    William E. Lamie, Microsoft Corporation                             */
46
/*                                                                        */
47
/*  DESCRIPTION                                                           */
48
/*                                                                        */
49
/*    This function handles system errors in the NAND flash.              */
50
/*                                                                        */
51
/*  INPUT                                                                 */
52
/*                                                                        */
53
/*    nand_flash                            NAND flash instance           */
54
/*    error_code                            System error code             */
55
/*    block                                 Block where error occurred    */
56
/*    page                                  Page where error occurred     */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    None                                                                */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    (lx_nand_flash_driver_system_error)   Driver system error handler   */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Internal LevelX                                                     */
69
/*                                                                        */
70
/*  RELEASE HISTORY                                                       */
71
/*                                                                        */
72
/*    DATE              NAME                      DESCRIPTION             */
73
/*                                                                        */
74
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
75
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
76
/*                                            resulting in version 6.1    */
77
/*  06-02-2021     Bhupendra Naphade        Modified comment(s),          */
78
/*                                            resulting in version 6.1.7  */
79
/*  03-08-2023     Xiuwen Cai               Modified comment(s),          */
80
/*                                            added new driver interface, */
81
/*                                            resulting in version 6.2.1 */
82
/*                                                                        */
83
/**************************************************************************/
84
VOID  _lx_nand_flash_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, ULONG block, ULONG page)
85
{
86
87
    /* Increment the system error counter.  */
88
    nand_flash -> lx_nand_flash_diagnostic_system_errors++;
89
90
    /* Save the most recent system error code.  */
91
    nand_flash -> lx_nand_flash_diagnostic_system_error =  error_code;
92
93
    /* Determine if the system error is a NAND page corrected error.  */
94
    if (error_code == LX_NAND_ERROR_CORRECTED)
95
    {
96
97
        /* Yes, increment error correction information.  */
98
        nand_flash -> lx_nand_flash_page_corrections++;
99
100
        /* Remember the last block/page of corrected error.  */
101
        nand_flash -> lx_nand_flash_last_block_correction =  block;
102
        nand_flash -> lx_nand_flash_last_page_correction =   page;
103
    }
104
105
    /* Determine if the driver has setup a system error handler.  */
106
    if (nand_flash -> lx_nand_flash_driver_system_error)
107
    {
108
109
        /* Yes, call the driver's system error handler.  */
110
#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
111
        (nand_flash -> lx_nand_flash_driver_system_error)(nand_flash, error_code, block, page);
112
#else
113
        (nand_flash -> lx_nand_flash_driver_system_error)(error_code, block, page);
114
#endif
115
    }
116
}
117