2009-08-30 06:59:43 +00:00
|
|
|
/*
|
2011-03-18 18:38:08 +00:00
|
|
|
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
2012-01-21 14:29:42 +00:00
|
|
|
2011,2012 Giovanni Di Sirio.
|
2009-08-30 06:59:43 +00:00
|
|
|
|
|
|
|
This file is part of ChibiOS/RT.
|
|
|
|
|
|
|
|
ChibiOS/RT 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.
|
|
|
|
|
|
|
|
ChibiOS/RT 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-10-03 13:10:15 +00:00
|
|
|
/* * <-disabled
|
2010-02-06 08:12:31 +00:00
|
|
|
* @file templates/chcore.c
|
|
|
|
* @brief Port related template code.
|
|
|
|
* @details This file is a template of the system driver functions provided by
|
|
|
|
* a port. Some of the following functions may be implemented as
|
|
|
|
* macros in chcore.h if the implementer decides that there is an
|
2010-11-11 11:04:05 +00:00
|
|
|
* advantage in doing so, for example because performance concerns.
|
2010-02-06 08:12:31 +00:00
|
|
|
*
|
2009-08-30 06:59:43 +00:00
|
|
|
* @addtogroup core
|
2010-03-16 19:36:21 +00:00
|
|
|
* @details Non portable code templates.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2009-12-08 17:37:49 +00:00
|
|
|
#include "ch.h"
|
2009-08-30 06:59:43 +00:00
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Port-related initialization code.
|
2010-02-21 07:24:53 +00:00
|
|
|
* @note This function is usually empty.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
2010-02-07 09:38:23 +00:00
|
|
|
void port_init(void) {
|
2009-08-30 06:59:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Kernel-lock action.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @details Usually this function just disables interrupts but may perform more
|
2010-02-21 07:24:53 +00:00
|
|
|
* actions.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_lock(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Kernel-unlock action.
|
2011-10-25 19:56:00 +00:00
|
|
|
* @details Usually this function just enables interrupts but may perform more
|
2010-02-06 08:12:31 +00:00
|
|
|
* actions.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_unlock(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Kernel-lock action from an interrupt handler.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @details This function is invoked before invoking I-class APIs from
|
2010-02-06 08:12:31 +00:00
|
|
|
* interrupt handlers. The implementation is architecture dependent,
|
|
|
|
* in its simplest form it is void.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_lock_from_isr(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Kernel-unlock action from an interrupt handler.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @details This function is invoked after invoking I-class APIs from interrupt
|
2010-02-06 08:12:31 +00:00
|
|
|
* handlers. The implementation is architecture dependent, in its
|
|
|
|
* simplest form it is void.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_unlock_from_isr(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Disables all the interrupt sources.
|
2012-03-26 09:13:37 +00:00
|
|
|
* @note Of course non-maskable interrupt sources are not included.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
2010-02-14 10:28:41 +00:00
|
|
|
void port_disable(void) {
|
2009-08-30 06:59:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-03-14 09:13:21 +00:00
|
|
|
* @brief Disables the interrupt sources below kernel-level priority.
|
|
|
|
* @note Interrupt sources above kernel level remains enabled.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_suspend(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-21 07:24:53 +00:00
|
|
|
* @brief Enables all the interrupt sources.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_enable(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-03-14 09:13:21 +00:00
|
|
|
* @brief Enters an architecture-dependent IRQ-waiting mode.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @details The function is meant to return when an interrupt becomes pending.
|
2010-02-06 08:12:31 +00:00
|
|
|
* The simplest implementation is an empty function or macro but this
|
|
|
|
* would not take advantage of architecture-specific power saving
|
2010-02-21 07:24:53 +00:00
|
|
|
* modes.
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_wait_for_interrupt(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Halts the system.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @details This function is invoked by the operating system when an
|
2010-11-11 11:04:05 +00:00
|
|
|
* unrecoverable error is detected (for example because a programming
|
2010-02-06 08:12:31 +00:00
|
|
|
* error in the application code that triggers an assertion while in
|
2010-02-21 07:24:53 +00:00
|
|
|
* debug mode).
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
|
|
|
void port_halt(void) {
|
|
|
|
|
|
|
|
port_disable();
|
|
|
|
while (TRUE) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 08:12:31 +00:00
|
|
|
* @brief Performs a context switch between two threads.
|
2009-08-30 06:59:43 +00:00
|
|
|
* @details This is the most critical code in any port, this function
|
2010-02-06 08:12:31 +00:00
|
|
|
* is responsible for the context switch between 2 threads.
|
|
|
|
* @note The implementation of this code affects <b>directly</b> the context
|
|
|
|
* switch performance so optimize here as much as you can.
|
2009-08-30 06:59:43 +00:00
|
|
|
*
|
2010-03-14 09:13:21 +00:00
|
|
|
* @param[in] ntp the thread to be switched in
|
|
|
|
* @param[in] otp the thread to be switched out
|
2009-08-30 06:59:43 +00:00
|
|
|
*/
|
2010-03-14 09:13:21 +00:00
|
|
|
void port_switch(Thread *ntp, Thread *otp) {
|
2009-08-30 06:59:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @} */
|