From 6852efe4a621a52e82ec5371a4b9fc10cc1bea88 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Thu, 18 May 2017 19:20:05 +0100 Subject: asm.h -> lib/asm.h --- asm.h | 42 ------------------------------------------ fmk.c | 2 +- lib/asm.h | 42 ++++++++++++++++++++++++++++++++++++++++++ setup.c | 2 +- uart/uart.c | 4 ++-- 5 files changed, 46 insertions(+), 46 deletions(-) delete mode 100644 asm.h create mode 100644 lib/asm.h diff --git a/asm.h b/asm.h deleted file mode 100644 index 63310b5..0000000 --- a/asm.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * asm.h -- ARM thumb assembly instructions - * - * Copyright (C) 2016-2017 Tomasz Kramkowski - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef FMK_ASM_H -#define FMK_ASM_H - -#include - -#define CLI() __asm__ volatile ("cpsid i") -#define STI() __asm__ volatile ("cpsie i") -#define WFI() __asm__ volatile ("wfi") - -static inline uint32_t get_BASEPRI(void) -{ - uint32_t ret; - - __asm__ volatile ("mrs %0, basepri" :"=r"(ret)); - - return ret; -} - -static inline void set_BASEPRI(uint32_t p) -{ - __asm__ volatile ("msr basepri, %0" ::"r"(p)); -} - -#endif /* FMK_ASM_H */ diff --git a/fmk.c b/fmk.c index bf2fb79..5e8462e 100644 --- a/fmk.c +++ b/fmk.c @@ -1,4 +1,4 @@ -#include "asm.h" +#include int main(void) { diff --git a/lib/asm.h b/lib/asm.h new file mode 100644 index 0000000..63310b5 --- /dev/null +++ b/lib/asm.h @@ -0,0 +1,42 @@ +/* + * asm.h -- ARM thumb assembly instructions + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_ASM_H +#define FMK_ASM_H + +#include + +#define CLI() __asm__ volatile ("cpsid i") +#define STI() __asm__ volatile ("cpsie i") +#define WFI() __asm__ volatile ("wfi") + +static inline uint32_t get_BASEPRI(void) +{ + uint32_t ret; + + __asm__ volatile ("mrs %0, basepri" :"=r"(ret)); + + return ret; +} + +static inline void set_BASEPRI(uint32_t p) +{ + __asm__ volatile ("msr basepri, %0" ::"r"(p)); +} + +#endif /* FMK_ASM_H */ diff --git a/setup.c b/setup.c index 1e002f1..57ef649 100644 --- a/setup.c +++ b/setup.c @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include #include #include -#include "asm.h" #include "usb/usb.h" #include "uart/uart.h" diff --git a/uart/uart.c b/uart/uart.c index ff467eb..aef64ce 100644 --- a/uart/uart.c +++ b/uart/uart.c @@ -16,16 +16,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include #include #include #include #include -#include #include +#include #include "uart.h" -#include "../asm.h" enum { SBR_VAL = 39, -- cgit v1.2.3-54-g00ecf