From: Tilman Sauerbeck Date: Sat, 16 Nov 2019 10:32:26 +0000 (+0100) Subject: common: Implement enable_interrupts() and disable_interrupts(). X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=5ec2dd3f317fc01e9893f34c93b99986c3fee521;p=gps-watch.git common: Implement enable_interrupts() and disable_interrupts(). --- diff --git a/SConscript.libcommon b/SConscript.libcommon index 3e229c2..79433bc 100644 --- a/SConscript.libcommon +++ b/SConscript.libcommon @@ -16,6 +16,7 @@ source_files_rs = [ source_files_c = [ 'src/common/startup.c', + 'src/common/asm_helpers.c', 'src/common/systick.c', 'src/common/ringbuf.c', 'src/common/flash.c', diff --git a/src/common/asm_helpers.c b/src/common/asm_helpers.c new file mode 100644 index 0000000..b7b5303 --- /dev/null +++ b/src/common/asm_helpers.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 Tilman Sauerbeck (tilman at code-monkey de) + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +void +enable_interrupts (void) +{ + asm volatile ("cpsie i"); +} + +void +disable_interrupts (void) +{ + asm volatile ("cpsid i"); +}