cpu.h
1 /*
2  * Copyright (C) 2013, Freie Universitaet Berlin (FUB). All rights reserved.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #ifndef CPU_H
10 #define CPU_H
11 
19 #include <stdio.h>
20 #include <stdbool.h>
21 
22 #include "lpc23xx.h"
23 #include "arm_cpu.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 extern uintptr_t __stack_start;
34 void cpu_init_pll(void);
35 
39 void cpu_init_mam(void);
40 
44 void lpc23xx_pclk_scale(uint32_t source, uint32_t target, uint32_t *pclksel, uint32_t *prescale);
45 
49 void cpu_init_clks(void);
50 
54 bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority);
55 
56 #ifdef MODULE_PERIPH
57 void gpio_init_ports(void);
58 #endif
59 
63 static inline void cpu_print_last_instruction(void)
64 {
65  register uint32_t *lr_ptr;
66  __asm__ __volatile__("mov %0, lr" : "=r"(lr_ptr));
67  printf("%p\n", (void*) lr_ptr);
68 }
69 
73 static inline bool cpu_woke_from_backup(void) {
74  return RSIR == 0;
75 }
76 
81 
85 #define CPU_HAS_BACKUP_RAM (1)
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
92 #endif /* CPU_H */
cpu_woke_from_backup
static bool cpu_woke_from_backup(void)
Returns true if the CPU woke from Deep Sleep.
Definition: cpu.h:73
cpu_init_pll
void cpu_init_pll(void)
Initialize the phase lock loop oscillator.
cpu_backup_ram_is_initialized
bool cpu_backup_ram_is_initialized(void)
Returns true if the backup RAM has been initialized.
__stack_start
uintptr_t __stack_start
end of user stack memory space
lpc23xx_pclk_scale
void lpc23xx_pclk_scale(uint32_t source, uint32_t target, uint32_t *pclksel, uint32_t *prescale)
Scale lpc23xx cpu speed.
cpu_init_clks
void cpu_init_clks(void)
Initialize lpc23xx cpu clocks.
cpu_print_last_instruction
static void cpu_print_last_instruction(void)
Prints the current content of the link register (lr)
Definition: cpu.h:63
install_irq
bool install_irq(int IntNumber, void(*HandlerAddr)(void), int Priority)
install lpc23xx irq
cpu_init_mam
void cpu_init_mam(void)
Initialize the Memory Acceleration Module.