ChibiOS/os/common/ports/ARMvx-M-SB/chcore.c

90 lines
3.1 KiB
C

/*
ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2014,
2015,2016,2017,2018,2019,2020,2021 Giovanni Di Sirio.
This file is part of ChibiOS.
ChibiOS 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 version 3 of the License.
ChibiOS 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 <http://www.gnu.org/licenses/>.
*/
/**
* @file ARMvx-M-SB/chcore.c
* @brief ARMvx-M-SB port code.
*
* @addtogroup ARMVXM_SB_CORE
* @{
*/
#include "ch.h"
/*===========================================================================*/
/* Module local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Module exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local types. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Module local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Module interrupt handlers. */
/*===========================================================================*/
CH_IRQ_HANDLER(__sb_vector0) {
CH_IRQ_PROLOGUE();
chSysLockFromISR();
chSysTimerHandlerI();
chSysUnlockFromISR();
CH_IRQ_EPILOGUE();
}
/*===========================================================================*/
/* Module exported functions. */
/*===========================================================================*/
/**
* @brief Port-related initialization code.
*
* @param[in, out] oip pointer to the @p os_instance_t structure
*
* @notapi
*/
void port_init(os_instance_t *oip) {
(void)oip;
/* Starting in a known IRQ configuration.*/
port_disable();
/* Enabling alarm VRQ.*/
__sb_vrq_seten(1U << 0);
sbSetAlarm(sbGetFrequency() / CH_CFG_ST_FREQUENCY, true);
}
/** @} */