Commit 12db0990 authored by Adam Wujek's avatar Adam Wujek

main_fw/i2c: inlude value of TMR_ERROR_CNT in STATUS_CML register calculations

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 360ed539
......@@ -18,6 +18,7 @@ typedef void(*fp_t)(void);
/* Defines for STATUS_CML */
#define CML_PEC 0x20
#define CML_MEM_FAULT 0x10
#define CML_COMM_ERR 0x2
#define CML_CPU 0x80
......
......@@ -376,7 +376,9 @@ The STATUS_CML command returns one data byte with contents as follows:
+--------+---------------------------+
| 5 | Packet Error Check Failed |
+--------+---------------------------+
| 4:2 | Unused |
| 4 | TMR Error |
+--------+---------------------------+
| 3:2 | Unused |
+--------+---------------------------+
| 1 | A communication fault |
+--------+---------------------------+
......@@ -385,6 +387,8 @@ The STATUS_CML command returns one data byte with contents as follows:
Write 1's in the desired bits positions to clear corresponding errors in the register.
Clearing TMR Error flag sets TMR_ERROR_CNT_ register to 0.
.. _READ_VOUT:
READ_VOUT
......@@ -645,7 +649,8 @@ TMR_ERROR_CNT
When software mitigation through COAST is enabled (see
:ref:`coast_sec`), one can access the TMR_ERROR_CNT counter using
this command.
this command. Setting `TMR Error` bit in STATUS_CML_ clears the value of this
register.
.. _USE_PEC:
......
......@@ -321,13 +321,20 @@ void read_status_b(void)
void get_status_cml(void)
{
/* Set CML_MEM_FAULT bit if TMR error detected */
status_cml |= TMR_ERROR_CNT ? CML_MEM_FAULT : 0;
status_cml_tmp = status_cml;
}
void write_status_cml(void)
{
/* clear only bits set to 1 */
/* Clear only bits set to 1 */
status_cml &= ~status_cml_tmp;
/* Set TMR_ERROR_CNT to zero if CML_MEM_FAULT bit is to be cleared */
if (status_cml_tmp & CML_MEM_FAULT)
TMR_ERROR_CNT = 0;
}
#if defined(MMFANT) || defined(MMPROT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment