From eb47f0cfc0e10df9246121970e6ad87f386939c6 Mon Sep 17 00:00:00 2001 From: Stephen Caudle Date: Fri, 28 Oct 2011 16:21:31 -0400 Subject: Add SCB from stm32f1 --- lib/stm32/f2/Makefile | 2 +- lib/stm32/f2/scb.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 lib/stm32/f2/scb.c (limited to 'lib') diff --git a/lib/stm32/f2/Makefile b/lib/stm32/f2/Makefile index 6afb42d..2f34962 100644 --- a/lib/stm32/f2/Makefile +++ b/lib/stm32/f2/Makefile @@ -29,7 +29,7 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ # ARFLAGS = rcsv ARFLAGS = rcs OBJS = vector.o rcc.o gpio.o usart.o spi.o flash.o nvic.o \ - i2c.o systick.o exti.o \ + i2c.o systick.o exti.o scb.o \ VPATH += ../../usb:../ diff --git a/lib/stm32/f2/scb.c b/lib/stm32/f2/scb.c new file mode 100644 index 0000000..338542e --- /dev/null +++ b/lib/stm32/f2/scb.c @@ -0,0 +1,30 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2010 Gareth McMullin + * + * 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 . + */ + +#include + +void scb_reset_core(void) +{ + SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_VECTRESET; +} + +void scb_reset_system(void) +{ + SCB_AIRCR = SCB_AIRCR_VECTKEY | SCB_AIRCR_SYSRESETREQ; +} -- cgit v1.2.3