2013-02-16 16:32:19 +00:00
|
|
|
/****************************************************************************
|
2020-04-30 15:19:35 -06:00
|
|
|
* arch/arm/src/armv6-m/arm_systemreset.c
|
2013-02-16 16:32:19 +00:00
|
|
|
*
|
2024-12-05 14:05:04 +01:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*
|
2020-04-30 16:17:09 -06:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
|
* License. You may obtain a copy of the License at
|
2013-02-16 16:32:19 +00:00
|
|
|
*
|
2020-04-30 16:17:09 -06:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2013-02-16 16:32:19 +00:00
|
|
|
*
|
2020-04-30 16:17:09 -06:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
|
* under the License.
|
2013-02-16 16:32:19 +00:00
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
* Included Files
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2019-03-25 10:32:43 -06:00
|
|
|
#include <nuttx/arch.h>
|
2015-07-04 10:39:24 -06:00
|
|
|
#include <nuttx/board.h>
|
|
|
|
|
|
2022-03-12 00:41:15 +08:00
|
|
|
#include "arm_internal.h"
|
2013-02-16 16:32:19 +00:00
|
|
|
#include "nvic.h"
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
2020-04-30 16:17:09 -06:00
|
|
|
* Public Functions
|
2013-02-16 16:32:19 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-07-04 10:39:24 -06:00
|
|
|
* Name: up_systemreset
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Internal, Cortex-M0 reset logic.
|
|
|
|
|
*
|
2013-02-16 16:32:19 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void up_systemreset(void)
|
|
|
|
|
{
|
|
|
|
|
uint32_t regval;
|
|
|
|
|
|
|
|
|
|
/* Set up for the system reset, retaining the priority group from the
|
|
|
|
|
* the AIRCR register.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-30 16:17:09 -06:00
|
|
|
regval = ((0x5fa << SYSCON_AIRCR_VECTKEY_SHIFT) |
|
|
|
|
|
SYSCON_AIRCR_SYSRESETREQ);
|
2013-02-16 16:32:19 +00:00
|
|
|
putreg32(regval, ARMV6M_SYSCON_AIRCR);
|
|
|
|
|
|
2014-04-13 16:22:22 -06:00
|
|
|
/* Ensure completion of memory accesses */
|
2013-02-16 16:32:19 +00:00
|
|
|
|
|
|
|
|
__asm volatile ("dsb");
|
|
|
|
|
|
|
|
|
|
/* Wait for the reset */
|
|
|
|
|
|
2015-10-07 11:39:06 -06:00
|
|
|
for (; ; );
|
2013-02-16 16:32:19 +00:00
|
|
|
}
|