Callisto4Bootloader: test/c4_privilege_modes_test.c File Reference

Callisto4Bootloader

Functions
c4_privilege_modes_test.c File Reference

Test operation in privileged and unprivileged modes. More...

`#include "c4_privilege_modes_test.h"`
`#include "c4_privilege_modes.h"`
`#include "fsl_debug_console.h"`
`#include <stdio.h>`
`#include <string.h>`

Go to the source code of this file.

## Functions

static uint32_t | getRegisterValue (const char *regName)
| Gets the current value of the specified register. More...
static void | printRegisterValue (const char *regName, uint32_t val)
| Prints the current register value. More...
exit_code_t | TestUnprivileged ()
| Test unprivileged mode. More...

## Detailed Description

Test operation in privileged and unprivileged modes.

Copyright
  2020 Remsdaq Ltd.

Date
  : 8 Jul 2020

Author
  : Dan Smithers

Definition in file c4_privilege_modes_test.c.

## Function Documentation

## ◆ getRegisterValue()

static uint32_t getRegisterValue | ( | const char * | regName | ) |

static

Gets the current value of the specified register.

This function assembles a string that is used to call an asm function.

Parameters

  [in] | regName | String register name

Returns
  Register value.

Definition at line 78 of file c4_privilege_modes_test.c.

Referenced by TestUnprivileged().

## ◆ printRegisterValue()

static void printRegisterValue | ( | const char * | regName,
|  | uint32_t | val
| ) |  |

static

Prints the current register value.

Parameters

  [in] | regName | Register to display
  [in] | val | Register value

Definition at line 91 of file c4_privilege_modes_test.c.

Referenced by TestUnprivileged().

## ◆ TestUnprivileged()

exit_code_t TestUnprivileged | ( |  | ) |

Test unprivileged mode.

Enter unprivileged mode and test that access is restricted.

Definition at line 57 of file c4_privilege_modes_test.c.

References C4_enterUnprivileged(), getRegisterValue(), printRegisterValue(), and CONTROL_Type::w.