lx_nor_flash_system_error.c
| 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 | /** LevelX Component */ | ||
| 17 | /** */ | ||
| 18 | /** NOR Flash */ | ||
| 19 | /** */ | ||
| 20 | /**************************************************************************/ | ||
| 21 | /**************************************************************************/ | ||
| 22 | |||
| 23 | #define LX_SOURCE_CODE | ||
| 24 | |||
| 25 | |||
| 26 | /* Disable ThreadX error checking. */ | ||
| 27 | |||
| 28 | #ifndef LX_DISABLE_ERROR_CHECKING | ||
| 29 | #define LX_DISABLE_ERROR_CHECKING | ||
| 30 | #endif | ||
| 31 | |||
| 32 | |||
| 33 | /* Include necessary system files. */ | ||
| 34 | |||
| 35 | #include "lx_api.h" | ||
| 36 | |||
| 37 | |||
| 38 | /**************************************************************************/ | ||
| 39 | /* */ | ||
| 40 | /* FUNCTION RELEASE */ | ||
| 41 | /* */ | ||
| 42 | /* _lx_nor_flash_system_error PORTABLE C */ | ||
| 43 | /* 6.2.1 */ | ||
| 44 | /* AUTHOR */ | ||
| 45 | /* */ | ||
| 46 | /* William E. Lamie, Microsoft Corporation */ | ||
| 47 | /* */ | ||
| 48 | /* DESCRIPTION */ | ||
| 49 | /* */ | ||
| 50 | /* This function handles system errors in the NOR flash. */ | ||
| 51 | /* */ | ||
| 52 | /* INPUT */ | ||
| 53 | /* */ | ||
| 54 | /* nor_flash NOR flash instance */ | ||
| 55 | /* error_code System error code */ | ||
| 56 | /* */ | ||
| 57 | /* OUTPUT */ | ||
| 58 | /* */ | ||
| 59 | /* None */ | ||
| 60 | /* */ | ||
| 61 | /* CALLS */ | ||
| 62 | /* */ | ||
| 63 | /* (lx_nor_flash_driver_system_error) Driver system error handler */ | ||
| 64 | /* */ | ||
| 65 | /* CALLED BY */ | ||
| 66 | /* */ | ||
| 67 | /* Internal LevelX */ | ||
| 68 | /* */ | ||
| 69 | /**************************************************************************/ | ||
| 70 | 20 | VOID _lx_nor_flash_system_error(LX_NOR_FLASH *nor_flash, UINT error_code) | |
| 71 | { | ||
| 72 | |||
| 73 | /* Increment the system error counter. */ | ||
| 74 | 20 | nor_flash -> lx_nor_flash_diagnostic_system_errors++; | |
| 75 | |||
| 76 | /* Save the most recent system error code. */ | ||
| 77 | 20 | nor_flash -> lx_nor_flash_diagnostic_system_error = error_code; | |
| 78 | |||
| 79 | /* Determine if the driver has setup a system error handler. */ | ||
| 80 |
1/2✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 20 times.
|
20 | if (nor_flash -> lx_nor_flash_driver_system_error) |
| 81 | { | ||
| 82 | |||
| 83 | /* Yes, call the driver's system error handler. */ | ||
| 84 | #ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE | ||
| 85 | ✗ | (nor_flash -> lx_nor_flash_driver_system_error)(nor_flash, error_code); | |
| 86 | #else | ||
| 87 | ✗ | (nor_flash -> lx_nor_flash_driver_system_error)(error_code); | |
| 88 | #endif | ||
| 89 | } | ||
| 90 | 20 | } | |
| 91 | |||
| 92 |