2014-11-09 15:06:25 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Freie Universität Berlin
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#ifndef ARM_CPU_H
|
|
|
|
#define ARM_CPU_H
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "VIC.h"
|
2014-11-20 18:59:58 +01:00
|
|
|
#include "arm7_common.h"
|
2010-09-22 15:10:42 +02:00
|
|
|
|
2014-11-21 21:00:52 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
#define NEW_TASK_CPSR 0x1F
|
|
|
|
#define WORDSIZE 32
|
|
|
|
|
|
|
|
uint32_t get_system_speed(void);
|
2013-06-21 03:52:57 +02:00
|
|
|
void cpu_clock_scale(uint32_t source, uint32_t target, uint32_t *prescale);
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
void arm_reset(void);
|
2014-12-05 18:52:53 +01:00
|
|
|
|
2023-04-27 15:05:47 +02:00
|
|
|
/**
|
|
|
|
* @brief Returns the current content of the link register (lr)
|
|
|
|
*/
|
|
|
|
static inline uintptr_t cpu_get_caller_pc(void)
|
|
|
|
{
|
|
|
|
register uintptr_t lr_ptr;
|
|
|
|
|
|
|
|
__asm__ __volatile__ ("mov %0, lr" : "=r" (lr_ptr));
|
|
|
|
return lr_ptr;
|
|
|
|
}
|
|
|
|
|
2019-12-06 00:06:18 +01:00
|
|
|
/**
|
|
|
|
* @brief Interrupt stack canary value
|
|
|
|
*
|
|
|
|
* @note 0xeafffffe is the ARM machine code equivalent of asm("b #0") or
|
|
|
|
* 'while (1);', i.e. an infinite loop.
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
#define STACK_CANARY_WORD (0xEAFFFFFEu)
|
|
|
|
|
2020-07-19 22:44:06 +02:00
|
|
|
/**
|
|
|
|
* @brief Select fastest bitarithm_lsb implementation
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#ifdef __ARM_FEATURE_CLZ
|
|
|
|
#define BITARITHM_LSB_BUILTIN
|
|
|
|
#define BITARITHM_HAS_CLZ
|
|
|
|
#else
|
|
|
|
#define BITARITHM_LSB_LOOKUP
|
|
|
|
#endif
|
|
|
|
/** @} */
|
2019-12-06 00:06:18 +01:00
|
|
|
|
2014-11-21 21:00:52 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#endif /* ARM_CPU_H */
|