Callisto4Bootloader: lib/c4_error_codes.c File Reference

Callisto4Bootloader

Macros | Functions | Variables
c4_error_codes.c File Reference

Implementation of error code display via UART and LED. More...

`#include "c4_error_codes.h"`
`#include "c4_privilege_modes.h"`
`#include <stdio.h>`
`#include <stdint.h>`

Go to the source code of this file.

## Macros

#define | DIT (1)
#define | DI (DIT)
#define | DAH (3)
#define | CODE_SPACE (1)
#define | CHAR_SPACE (3 - CODE_SPACE)
#define | WORD_SPACE (7 - CHAR_SPACE - CODE_SPACE)
#define | CALLISTO_ERR(name, text, ...) __VA_ARGS__ ,
#define | CALLISTO_ERR(name, text, ...) "C4_ERR_"#name" : "#text,

## Functions

static void | C4_flashError (const uint32_t err[6])
void | BL_SysTick_DelayTicks (uint32_t n)
| Sets a delay. More...
void | C4_displayError (const char *text, exit_code_t errVal, bool fatal)
| Print exit code on serial line and flash led. More...

## Variables

static const uint16_t | g_ditLength = 1000U * 60/50/2/5
static const uint32_t | FlashCode [C4_ERR_MAX][6]
const char | err_strings [C4_ERR_MAX][72]

## Detailed Description

Implementation of error code display via UART and LED.

Copyright
  2020 Remsdaq Ltd.

Date
  : 5 Jun 2020

Author
  : Dan Smithers dwhs@.nosp@m.rems.nosp@m.daq.c.nosp@m.om

Definition in file c4_error_codes.c.

## Macro Definition Documentation

## ◆ CALLISTO_ERR [1/2]

#define CALLISTO_ERR | ( |  | name,
|  |  | text,
|  |  | ...
| ) |  | __VA_ARGS__ ,

## ◆ CALLISTO_ERR [2/2]

#define CALLISTO_ERR | ( |  | name,
|  |  | text,
|  |  | ...
| ) |  | "C4_ERR_"#name" : "#text,

## ◆ CHAR_SPACE

#define CHAR_SPACE (3 - CODE_SPACE)

Definition at line 26 of file c4_error_codes.c.

## ◆ CODE_SPACE

#define CODE_SPACE (1)

Definition at line 25 of file c4_error_codes.c.

## ◆ DAH

#define DAH (3)

Definition at line 24 of file c4_error_codes.c.

## ◆ DI

#define DI (DIT)

Definition at line 23 of file c4_error_codes.c.

## ◆ DIT

#define DIT (1)

Definition at line 22 of file c4_error_codes.c.

## ◆ WORD_SPACE

#define WORD_SPACE (7 - CHAR_SPACE - CODE_SPACE)

Definition at line 27 of file c4_error_codes.c.

## Function Documentation

## ◆ BL_SysTick_DelayTicks()

void BL_SysTick_DelayTicks | ( | uint32_t | n | ) |

Sets a delay.

Expose function from bootloader.c.

Parameters

  [in] | n | Delay time in ms

Definition at line 317 of file bootloader.c.

Referenced by C4_displayError(), and C4_flashError().

## ◆ C4_displayError()

void C4_displayError | ( | const char * | text,
|  | exit_code_t | errVal,
|  | bool | fatal
| ) |  |

Print exit code on serial line and flash led.

This function will enter a continuous loop if fatal is true and anything other than C4_ERR_OK is sent.

Parameters

  [in] | text | Optional user text to display.
  [in] | errVal | Exit code.
  [in] | fatal | If true this error is fatal and the code loops forever.

Definition at line 44 of file c4_error_codes.c.

References BL_SysTick_DelayTicks(), C4_flashError(), DIT, err_strings, FlashCode, and g_ditLength.

## ◆ C4_flashError()

void C4_flashError | ( | const uint32_t | err[6] | ) |

static

Definition at line 54 of file c4_error_codes.c.

References BL_SysTick_DelayTicks(), CHAR_SPACE, CODE_SPACE, FlashLed(), g_ditLength, and i.

Referenced by C4_displayError().

## Variable Documentation

## ◆ err_strings

const char err_strings[C4_ERR_MAX][72]

Initial value:
= {
#define CALLISTO_ERR(name, text, ...)
ERROR_LIST
}

Definition at line 36 of file c4_error_codes.c.

Referenced by C4_displayError().

## ◆ FlashCode

const uint32_t FlashCode[C4_ERR_MAX][6]

static

Initial value:
= {
#define CALLISTO_ERR(name, text, ...)
ERROR_LIST
}

Definition at line 30 of file c4_error_codes.c.

Referenced by C4_displayError().

## ◆ g_ditLength

const uint16_t g_ditLength = 1000U * 60/50/2/5

static

Definition at line 20 of file c4_error_codes.c.

Referenced by C4_displayError(), and C4_flashError().

ERROR_LIST
#define ERROR_LIST
Error codes and strings.
Definition: c4_error_codes.h:36