2014-08-27 18:47:31 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013, Freie Universitaet Berlin (FUB). All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2010-09-22 15:10:42 +02:00
|
|
|
|
2016-06-07 16:29:37 +02:00
|
|
|
#ifndef CPU_H
|
|
|
|
#define CPU_H
|
2010-09-22 15:10:42 +02:00
|
|
|
|
|
|
|
/**
|
2018-06-01 12:25:00 +02:00
|
|
|
* @defgroup cpu_lpc2387 NXP LPC2387
|
2013-11-27 17:54:30 +01:00
|
|
|
* @ingroup cpu
|
|
|
|
* @brief NXP LPC2387 specific code
|
2010-09-22 15:10:42 +02:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2015-09-04 16:51:08 +02:00
|
|
|
#include <stdio.h>
|
2010-09-22 15:10:42 +02:00
|
|
|
#include <stdbool.h>
|
2015-09-04 16:51:08 +02:00
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
#include "lpc2387.h"
|
|
|
|
#include "arm_cpu.h"
|
|
|
|
|
2014-10-13 10:53:20 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-02-05 11:39:41 +01:00
|
|
|
extern uintptr_t __stack_start; /**< end of user stack memory space */
|
2010-09-22 15:10:42 +02:00
|
|
|
|
2015-08-06 12:58:08 +02:00
|
|
|
/**
|
|
|
|
* @brief Scale lpc2387 cpu speed
|
|
|
|
*/
|
2013-06-21 03:52:57 +02:00
|
|
|
void lpc2387_pclk_scale(uint32_t source, uint32_t target, uint32_t *pclksel, uint32_t *prescale);
|
2015-08-06 12:58:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief install lpc2387 irq
|
|
|
|
*/
|
2013-11-21 14:18:54 +01:00
|
|
|
bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority);
|
2010-09-22 15:10:42 +02:00
|
|
|
|
2015-06-09 12:45:35 +02:00
|
|
|
#ifdef MODULE_PERIPH
|
|
|
|
void gpio_init_ports(void);
|
|
|
|
#endif
|
|
|
|
|
2015-09-04 16:51:08 +02:00
|
|
|
/**
|
|
|
|
* @brief Prints the current content of the link register (lr)
|
|
|
|
*/
|
|
|
|
static inline void cpu_print_last_instruction(void)
|
|
|
|
{
|
|
|
|
register uint32_t *lr_ptr;
|
|
|
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
|
2015-11-28 14:18:29 +01:00
|
|
|
printf("%p\n", (void*) lr_ptr);
|
2015-09-04 16:51:08 +02:00
|
|
|
}
|
|
|
|
|
2014-10-13 10:53:20 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-09-22 15:10:42 +02:00
|
|
|
/** @} */
|
2016-06-07 16:29:37 +02:00
|
|
|
#endif /* CPU_H */
|