Callisto4Bootloader: lib/c4_privilege_modes.c File Reference

Callisto4Bootloader

Macros | Functions
c4_privilege_modes.c File Reference

Implementation of privilege modes. More...

`#include "c4_privilege_modes.h"`
`#include <stdarg.h>`
`#include <stdio.h>`

Go to the source code of this file.

## Macros

#define | PRINTF(f, ...)
#define | C4_SVC_PRINT_CALL(str, l)
#define | MAX_PRINT 128
| Length of string for printf. More...

## Functions

void | C4_enterUnprivileged ()
| Set the CONTROL register for Unprivileged level. More...
void * | C4_executePrivileged (C4_SVC_Op_t op,...)
| Execute operation in privileged mode. More...

## Detailed Description

Implementation of privilege modes.

Copyright
  2020 Remsdaq Ltd.

This provides a mechanism to transfer into unprivileged mode and also a function that can be used to execute an operation with privilege.

Date
  8 Jul 2020

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

Definition in file c4_privilege_modes.c.

## Macro Definition Documentation

## ◆ C4_SVC_PRINT_CALL

#define C4_SVC_PRINT_CALL | ( |  | str,
|  |  | l
| ) |  |

Value:
asm("MOV r0, %0\n\tMOV r1, %1\n\tSVC %2\n\t":: \
"r"(str), "r"(l), "I" (C4_SVC_PRINT))

Definition at line 29 of file c4_privilege_modes.c.

## ◆ MAX_PRINT

#define MAX_PRINT 128

Length of string for printf.

Definition at line 34 of file c4_privilege_modes.c.

## ◆ PRINTF

#define PRINTF | ( |  | f,
|  |  | ...
| ) |  |

Definition at line 20 of file c4_privilege_modes.c.

## Function Documentation

## ◆ C4_enterUnprivileged()

void C4_enterUnprivileged | ( |  | ) |

Set the CONTROL register for Unprivileged level.

Definition at line 48 of file c4_privilege_modes.c.

References CONTROL_Type::b, and CONTROL_Type::nPRIV.

Referenced by TestUnprivileged().

## ◆ C4_executePrivileged()

void* C4_executePrivileged | ( | C4_SVC_Op_t | op,
|  |  | ...
| ) |  |

Execute operation in privileged mode.

Parameters

  [in] | op | Enumerated ID of operation to be performed.

Definition at line 62 of file c4_privilege_modes.c.

Referenced by SVC_test().