GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lx_nand_flash_open.c Lines: 4 4 100.0 %
Date: 2026-01-12 23:08:29 Branches: 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_open                                 PORTABLE C      */
42
/*                                                           6.3.0        */
43
/*  AUTHOR                                                                */
44
/*                                                                        */
45
/*    Xiuwen Cai, Microsoft Corporation                                   */
46
/*                                                                        */
47
/*  DESCRIPTION                                                           */
48
/*                                                                        */
49
/*    This function opens a NAND flash instance and ensures the           */
50
/*    NAND flash is in a coherent state.                                  */
51
/*                                                                        */
52
/*  INPUT                                                                 */
53
/*                                                                        */
54
/*    nand_flash                            NAND flash instance           */
55
/*    name                                  Name of NAND flash instance   */
56
/*    nand_driver_initialize                Driver initialize             */
57
/*    nand_driver_info_ptr                  User data pointer             */
58
/*    memory_ptr                            Pointer to memory used by the */
59
/*                                            LevelX for this NAND.       */
60
/*    memory_size                           Size of memory - must at least*/
61
/*                                            7 * total block count +     */
62
/*                                            2 * page size               */
63
/*                                                                        */
64
/*  OUTPUT                                                                */
65
/*                                                                        */
66
/*    return status                                                       */
67
/*                                                                        */
68
/*  CALLS                                                                 */
69
/*                                                                        */
70
/*    lx_nand_flash_open_extended           Pass NULL as driver_info_ptr  */
71
/*                                                                        */
72
/*  CALLED BY                                                             */
73
/*                                                                        */
74
/*    Application Code                                                    */
75
/*                                                                        */
76
/*  RELEASE HISTORY                                                       */
77
/*                                                                        */
78
/*    DATE              NAME                      DESCRIPTION             */
79
/*                                                                        */
80
/*  03-08-2023     Xiuwen Cai               Initial Version 6.2.1         */
81
/*  10-31-2023     Xiuwen Cai               Modified comment(s),          */
82
/*                                            avoided clearing user       */
83
/*                                            extension in flash control  */
84
/*                                            block,                      */
85
/*                                            resulting in version 6.3.0  */
86
/*                                                                        */
87
/**************************************************************************/
88
5
UINT  _lx_nand_flash_open(LX_NAND_FLASH  *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *),
89
                          ULONG* memory_ptr, UINT memory_size)
90
{
91
5
UINT status = LX_ERROR;
92
93
5
    status = _lx_nand_flash_open_extended(nand_flash, name, nand_driver_initialize, NULL, memory_ptr, memory_size);
94
95
5
    return status;
96
}