139 lines
6.9 KiB
Plaintext
139 lines
6.9 KiB
Plaintext
|
C51 COMPILER V9.01 SH_IEC60730B_8051F_WDG 10/11/2023 14:22:17 PAGE 1
|
|||
|
|
|||
|
|
|||
|
C51 COMPILER V9.01, COMPILATION OF MODULE SH_IEC60730B_8051F_WDG
|
|||
|
OBJECT MODULE PLACED IN .\output\sh_iec60730b_8051f_wdg.obj
|
|||
|
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE code_classb\iec60730_lib\sh_iec60730b_8051f_wdg.c LARGE OPTIMIZE(7,SIZE)
|
|||
|
- REGFILE(.\output\McuFlash_ISP.ORC) BROWSE INTVECTOR(0X1000) INCDIR(.\header_app;.\header_drv;.\code_gasguage) DEBUG OBJ
|
|||
|
-ECTEXTEND PRINT(.\output\sh_iec60730b_8051f_wdg.lst) OBJECT(.\output\sh_iec60730b_8051f_wdg.obj)
|
|||
|
|
|||
|
line level source
|
|||
|
|
|||
|
1 /*
|
|||
|
2 * IEC60730 Class B Library for SINOWEALTH 8051 based ICs.
|
|||
|
3 * File: sh_iec60730b_8051f_wdg.c
|
|||
|
4 * Version: 1.0
|
|||
|
5 * Author: Robin.zhang Chaoming.luo
|
|||
|
6 * Date: 04/21/2023
|
|||
|
7 * SINOWEALTH IS SUPPLYING THIS SOFTWARE FOR USE EXCLUSIVELY ON SINOWEALTH'S
|
|||
|
8 * MICROCONTROLLER PRODUCTS. IT IS PROTECTED UNDER APPLICABLE COPYRIGHT LAWS.
|
|||
|
9 * THIS SOFTWARE IS FOR GUIDANCE IN ORDER TO SAVE TIME. AS A RESULT, SINOWEALTH
|
|||
|
10 * SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES
|
|||
|
11 * WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR
|
|||
|
12 * THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN
|
|||
|
13 * CONNECTION WITH THEIR PRODUCTS.
|
|||
|
14 *
|
|||
|
15 */
|
|||
|
16
|
|||
|
17 #include "sh_iec60730b_8051f_cfg.h"
|
|||
|
*** WARNING C318 IN LINE 17 OF code_classb\iec60730_lib\sh_iec60730b_8051f_wdg.c: can't open file 'sh_iec60730b_8051f_cf
|
|||
|
-g.h'
|
|||
|
18
|
|||
|
19 #if SH_CHK_WDG_EN == 1
|
|||
|
*** WARNING C322 IN LINE 19 OF code_classb\iec60730_lib\sh_iec60730b_8051f_wdg.c: unknown identifier
|
|||
|
xdata SHT_IEC60730B_WDG_TEST __iec60730b_wdg_test_obj _at_ (SH_CHK_XDATA_SIZE-sizeof(SHT_IEC60730B_WDG_TES
|
|||
|
-T));
|
|||
|
|
|||
|
/******************************************************************************
|
|||
|
* Functions
|
|||
|
******************************************************************************/
|
|||
|
/*******************************************************************************
|
|||
|
*
|
|||
|
* @brief This function should be called only once after POR reset.
|
|||
|
* Each calling of this function causes a wd reset.
|
|||
|
* Function clears the WD resets counter to 0.
|
|||
|
* No WD settings are changed here. It starts the LPTMR which must
|
|||
|
* be configured before the function call occurs.
|
|||
|
* Within the waiting endless loop, value from LPTMR is periodically
|
|||
|
* stored to reserved area in RAM.
|
|||
|
*
|
|||
|
* @param void
|
|||
|
*
|
|||
|
* @return SH_CHK_PASS ;watchdog timeout has measured
|
|||
|
* SH_CHK_FAIL_WDG ;watchdog timeout need remeasured
|
|||
|
*
|
|||
|
******************************************************************************/
|
|||
|
SHT_RESULT sh_8051f_wdg_setup()
|
|||
|
{
|
|||
|
if((__iec60730b_wdg_test_obj.resetSource & SH_IEC60730B_RESET_SRC_POR)
|
|||
|
||(__iec60730b_wdg_test_obj.resetSource & SH_IEC60730B_RESET_SRC_LVR)
|
|||
|
// ||(__iec60730b_wdg_test_obj.resetSource == 0) //FOR DEBUG
|
|||
|
)
|
|||
|
{
|
|||
|
__iec60730b_wdg_test_obj.counter = 0;
|
|||
|
__iec60730b_wdg_test_obj.resets = 0;
|
|||
|
C51 COMPILER V9.01 SH_IEC60730B_8051F_WDG 10/11/2023 14:22:17 PAGE 2
|
|||
|
|
|||
|
return SH_CHK_FAIL_WDG;
|
|||
|
}
|
|||
|
return SH_CHK_PASS;
|
|||
|
}
|
|||
|
|
|||
|
/*******************************************************************************
|
|||
|
*
|
|||
|
* @brief Function should be called after every WD reset, its calling should
|
|||
|
* be handled by conditional execution in application.
|
|||
|
*
|
|||
|
* If the source of reset is WD, function increments the wd_reset counter.
|
|||
|
* If the reset counter has overflowed, function will wait in endless
|
|||
|
* loop if it is enabled.
|
|||
|
*
|
|||
|
* If the source of reset is WD, function check the timeout
|
|||
|
* value. If it is not in range, function will wait in the endless
|
|||
|
* loop if enabled.
|
|||
|
*
|
|||
|
* If the source of reset isn't WD or POR, function will sets the
|
|||
|
* wdTestUncompleteFlag and will wait in endless loop if enabled.
|
|||
|
*
|
|||
|
* @param void
|
|||
|
*
|
|||
|
* @return SH_CHK_PASS - successfull execution of test
|
|||
|
* SH_CHK_FAIL_WDG - reset counter doesn't fit into limit
|
|||
|
*
|
|||
|
******************************************************************************/
|
|||
|
SHT_RESULT sh_8051f_wdg_check()
|
|||
|
{
|
|||
|
SHT_RESULT checkResult = SH_CHK_PASS;
|
|||
|
if(__iec60730b_wdg_test_obj.resetSource & SH_IEC60730B_RESET_SRC_IWDG)
|
|||
|
{
|
|||
|
__iec60730b_wdg_test_obj.resets++;
|
|||
|
|
|||
|
if(__iec60730b_wdg_test_obj.resets > SH_CHK_WDG_RESET_LIMIT)
|
|||
|
{
|
|||
|
checkResult = SH_CHK_FAIL_WDG;
|
|||
|
}
|
|||
|
else if(__iec60730b_wdg_test_obj.counter < SH_CHK_WDG_LIMIT_LOW
|
|||
|
|| __iec60730b_wdg_test_obj.counter > SH_CHK_WDG_LIMIT_HIGH)
|
|||
|
{
|
|||
|
checkResult = SH_CHK_FAIL_WDG;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(__iec60730b_wdg_test_obj.counter < SH_CHK_WDG_LIMIT_LOW
|
|||
|
| __iec60730b_wdg_test_obj.counter > SH_CHK_WDG_LIMIT_HIGH )
|
|||
|
{
|
|||
|
checkResult = SH_CHK_FAIL_WDG;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return checkResult;
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
MODULE INFORMATION: STATIC OVERLAYABLE
|
|||
|
CODE SIZE = ---- ----
|
|||
|
CONSTANT SIZE = ---- ----
|
|||
|
XDATA SIZE = ---- ----
|
|||
|
C51 COMPILER V9.01 SH_IEC60730B_8051F_WDG 10/11/2023 14:22:17 PAGE 3
|
|||
|
|
|||
|
PDATA SIZE = ---- ----
|
|||
|
DATA SIZE = ---- ----
|
|||
|
IDATA SIZE = ---- ----
|
|||
|
BIT SIZE = ---- ----
|
|||
|
END OF MODULE INFORMATION.
|
|||
|
|
|||
|
|
|||
|
C51 COMPILATION COMPLETE. 2 WARNING(S), 0 ERROR(S)
|