git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@637 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
cb692f1c51
commit
0c36565550
|
@ -84,7 +84,7 @@ WARN_LOGFILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the input files
|
# configuration options related to the input files
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
INPUT = ../src/include ../src/templates ../src ../docs/ch.txt ../src/lib ../ports/ARM7 ../ports/ARMCM3 ../ports/MSP430
|
INPUT = ../src/include ../src/templates ../src ../docs/ch.txt ../src/lib ../ports/ARM7 ../ports/ARMCM3 ../ports/MSP430 ../ports/AVR
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py *.ddf
|
FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py *.ddf
|
||||||
RECURSIVE = YES
|
RECURSIVE = YES
|
||||||
|
|
38
docs/ch.txt
38
docs/ch.txt
|
@ -294,40 +294,6 @@
|
||||||
*/
|
*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup AVR MegaAVR
|
|
||||||
* @{
|
|
||||||
* <p>
|
|
||||||
* Notes about the AVR port:
|
|
||||||
* </p>
|
|
||||||
* <ul>
|
|
||||||
* <li>The AVR does not have a dedicated interrupt stack, make sure to reserve
|
|
||||||
* enough stack space for interrupts in each thread stack. This can be done
|
|
||||||
* by modifying the @p INT_REQUIRED_STACK macro into
|
|
||||||
* <b>./ports/AVR/chcore.h</b>.</li>
|
|
||||||
* </ul>
|
|
||||||
* @ingroup Ports
|
|
||||||
*/
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup AVRCONF Configuration Options
|
|
||||||
* @{
|
|
||||||
* <p>
|
|
||||||
* The AVR port allows some architecture-specific configurations settings
|
|
||||||
* that can be specified externally, as example on the compiler command line:
|
|
||||||
* <ul>
|
|
||||||
* <li>@p INT_REQUIRED_STACK, this value represent the amount of stack space
|
|
||||||
* used by the interrupt handlers.<br>
|
|
||||||
* The default for this value is @p 32, this space is allocated for each
|
|
||||||
* thread so be careful in order to not waste precious RAM space.<br>
|
|
||||||
* The default value is set into <b>./ports/AVR/chcore.h</b>.</li>
|
|
||||||
* </ul>
|
|
||||||
* </p>
|
|
||||||
* @ingroup AVR
|
|
||||||
*/
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Kernel Kernel
|
* @defgroup Kernel Kernel
|
||||||
* @{
|
* @{
|
||||||
|
@ -345,9 +311,9 @@
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Core Core
|
* @defgroup Core Generic Port Code Templates
|
||||||
* @{
|
* @{
|
||||||
* Non portable code.
|
* Non portable code templates.
|
||||||
* @ingroup Kernel
|
* @ingroup Kernel
|
||||||
* @file src/templates/chcore.c Non portable code template file.
|
* @file src/templates/chcore.c Non portable code template file.
|
||||||
* @file src/templates/chcore.h Non portable macros and structures template file.
|
* @file src/templates/chcore.h Non portable macros and structures template file.
|
||||||
|
|
|
@ -24,13 +24,6 @@
|
||||||
|
|
||||||
#include <ch.h>
|
#include <ch.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 advantage in doing so, as example
|
|
||||||
* because performance concerns.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default implementation of this function is void so no messages are
|
* The default implementation of this function is void so no messages are
|
||||||
* actually printed.
|
* actually printed.
|
||||||
|
@ -38,8 +31,10 @@
|
||||||
* it in your application code.
|
* it in your application code.
|
||||||
* @param msg pointer to the message string
|
* @param msg pointer to the message string
|
||||||
*/
|
*/
|
||||||
|
/** @cond never */
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void sys_puts(char *msg) {
|
/** @endcond */
|
||||||
|
void port_puts(char *msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,8 +44,10 @@ void sys_puts(char *msg) {
|
||||||
* @note The function is declared as a weak symbol, it is possible to redefine
|
* @note The function is declared as a weak symbol, it is possible to redefine
|
||||||
* it in your application code.
|
* it in your application code.
|
||||||
*/
|
*/
|
||||||
|
/** @cond never */
|
||||||
__attribute__((naked, weak))
|
__attribute__((naked, weak))
|
||||||
void sys_switch(Thread *otp, Thread *ntp) {
|
/** @endcond */
|
||||||
|
void port_switch(Thread *otp, Thread *ntp) {
|
||||||
|
|
||||||
asm volatile ("push r2");
|
asm volatile ("push r2");
|
||||||
asm volatile ("push r3");
|
asm volatile ("push r3");
|
||||||
|
@ -113,10 +110,12 @@ void sys_switch(Thread *otp, Thread *ntp) {
|
||||||
* @note The function is declared as a weak symbol, it is possible to redefine
|
* @note The function is declared as a weak symbol, it is possible to redefine
|
||||||
* it in your application code.
|
* it in your application code.
|
||||||
*/
|
*/
|
||||||
|
/** @cond never */
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void sys_halt(void) {
|
/** @endcond */
|
||||||
|
void port_halt(void) {
|
||||||
|
|
||||||
sys_disable();
|
port_disable();
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,10 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* IRQ prologue code, inserted at the start of all IRQ handlers enabled to
|
* IRQ prologue code, inserted at the start of all IRQ handlers enabled to
|
||||||
* invoke system APIs.
|
* invoke system APIs.
|
||||||
* This code tricks the compiler to save the specified registers by "touching"
|
* This code tricks the compiler to save all the specified registers by
|
||||||
* them.
|
* "touching" them.
|
||||||
*/
|
*/
|
||||||
#define SYS_IRQ_PROLOGUE() { \
|
#define PORT_IRQ_PROLOGUE() { \
|
||||||
asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
|
asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
|
||||||
"r25", "r26", "r27", "r30", "r31"); \
|
"r25", "r26", "r27", "r30", "r31"); \
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
|
||||||
* IRQ epilogue code, inserted at the end of all IRQ handlers enabled to
|
* IRQ epilogue code, inserted at the end of all IRQ handlers enabled to
|
||||||
* invoke system APIs.
|
* invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#define SYS_IRQ_EPILOGUE() { \
|
#define PORT_IRQ_EPILOGUE() { \
|
||||||
if (chSchRescRequiredI()) \
|
if (chSchRescRequiredI()) \
|
||||||
chSchDoRescheduleI(); \
|
chSchDoRescheduleI(); \
|
||||||
}
|
}
|
||||||
|
@ -186,53 +186,66 @@ asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \
|
||||||
* IRQ handler function modifier. Note, it just aliases the WinAVR "ISR"
|
* IRQ handler function modifier. Note, it just aliases the WinAVR "ISR"
|
||||||
* macro.
|
* macro.
|
||||||
*/
|
*/
|
||||||
#define SYS_IRQ_HANDLER ISR
|
#define PORT_IRQ_HANDLER ISR
|
||||||
|
|
||||||
/**
|
|
||||||
* This port function is implemented as inlined code for performance reasons.
|
|
||||||
*/
|
|
||||||
#define sys_disable() asm volatile ("cli")
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This port function is implemented as inlined code for performance reasons.
|
|
||||||
*/
|
|
||||||
#define sys_enable() asm volatile ("sei")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is empty in this port.
|
* This function is empty in this port.
|
||||||
*/
|
*/
|
||||||
#define sys_disable_from_isr()
|
#define port_init()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented as global interrupt disable.
|
||||||
|
*/
|
||||||
|
#define port_lock() asm volatile ("cli")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented as global interrupt enable.
|
||||||
|
*/
|
||||||
|
#define port_unlock() asm volatile ("sei")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is empty in this port.
|
* This function is empty in this port.
|
||||||
*/
|
*/
|
||||||
#define sys_enable_from_isr()
|
#define port_lock_from_isr()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables all the interrupt sources, even those having a priority higher
|
* This function is empty in this port.
|
||||||
* to the kernel.
|
|
||||||
* In this port it is no different than sys_disable() because the simple
|
|
||||||
* interrupt handling
|
|
||||||
*/
|
*/
|
||||||
#define sys_disable_all() sys_disable()
|
#define port_unlock_from_isr()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented as global interrupt disable.
|
||||||
|
*/
|
||||||
|
#define port_disable() asm volatile ("cli")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as @p port_disable() in this port, there is no difference between the
|
||||||
|
* two states.
|
||||||
|
*/
|
||||||
|
#define port_suspend() asm volatile ("cli")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implemented as global interrupt enable.
|
||||||
|
*/
|
||||||
|
#define port_enable() asm volatile ("sei")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This port function is implemented as inlined code for performance reasons.
|
* This port function is implemented as inlined code for performance reasons.
|
||||||
*/
|
*/
|
||||||
#if ENABLE_WFI_IDLE != 0
|
#if ENABLE_WFI_IDLE != 0
|
||||||
#define sys_wait_for_interrupt() { \
|
#define port_wait_for_interrupt() { \
|
||||||
asm volatile ("sleep"); \
|
asm volatile ("sleep"); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define sys_wait_for_interrupt()
|
#define port_wait_for_interrupt()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void sys_puts(char *msg);
|
void port_puts(char *msg);
|
||||||
void sys_switch(Thread *otp, Thread *ntp);
|
void port_switch(Thread *otp, Thread *ntp);
|
||||||
void sys_halt(void);
|
void port_halt(void);
|
||||||
void threadstart(void);
|
void threadstart(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/**
|
||||||
|
* @defgroup AVR MegaAVR
|
||||||
|
* @{
|
||||||
|
* @details AVR port details. This section how the ChibiOS/RT features are
|
||||||
|
* implemented on this architecture.
|
||||||
|
*
|
||||||
|
* @section AVR_STATES Mapping of the System States in the AVR port
|
||||||
|
* The ChibiOS/RT logical @ref system_states are mapped as follow in the AVR
|
||||||
|
* port:
|
||||||
|
* - <b>Initialization</b>. This state is represented by the startup code and
|
||||||
|
* the initialization code before @p chSysInit() is executed. It has not a
|
||||||
|
* special hardware state associated.
|
||||||
|
* - <b>Normal</b>. This is the state the system has after executing
|
||||||
|
* @p chSysInit(). Interrupts are enabled.
|
||||||
|
* - <b>Suspended</b>. Interrupts are disabled.
|
||||||
|
* - <b>Disabled</b>. Interrupts are enabled. This state is equivalent to the
|
||||||
|
* Suspended state because there are no fast interrupts in this architecture.
|
||||||
|
* - <b>Sleep</b>. This state is entered with the execution of the specific
|
||||||
|
* instruction @p <b>sleep</b>.
|
||||||
|
* - <b>S-Locked</b>. Interrupts are disabled.
|
||||||
|
* - <b>I-Locked</b>. This state is equivalent to the SRI state, the
|
||||||
|
* @p chSysLockI() and @p chSysUnlockI() APIs do nothing (still use them in
|
||||||
|
* order to formally change state because this may change).
|
||||||
|
* - <b>Serving Regular Interrupt</b>. Normal interrupt service code.
|
||||||
|
* - <b>Serving Fast Interrupt</b>. Not present in this architecture.
|
||||||
|
* - <b>Serving Non-Maskable Interrupt</b>. Not present in this architecture.
|
||||||
|
* - <b>Halted</b>. Implemented as an infinite loop with interrupts disabled.
|
||||||
|
*
|
||||||
|
* @section AVR_NOTES The AVR port notes
|
||||||
|
* - The AVR does not have a dedicated interrupt stack, make sure to reserve
|
||||||
|
* enough stack space for interrupts in each thread stack. This can be done
|
||||||
|
* by modifying the @p INT_REQUIRED_STACK macro into
|
||||||
|
* <b>./ports/AVR/chcore.h</b>.
|
||||||
|
*
|
||||||
|
* @ingroup Ports
|
||||||
|
*/
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup AVR_CONF Configuration Options
|
||||||
|
* @{
|
||||||
|
* @brief AVR Configuration Options.
|
||||||
|
* The AVR port allows some architecture-specific configurations settings
|
||||||
|
* that can be specified externally, as example on the compiler command line:
|
||||||
|
* - @p INT_REQUIRED_STACK, this value represent the amount of stack space
|
||||||
|
* used by the interrupt handlers.<br>
|
||||||
|
* The default for this value is @p 32, this space is allocated for each
|
||||||
|
* thread so be careful in order to not waste precious RAM space.<br>
|
||||||
|
* The default value is set into <b>./ports/AVR/chcore.h</b>.
|
||||||
|
*
|
||||||
|
* @ingroup AVR
|
||||||
|
*/
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup AVR_CORE AVR Core Implementation
|
||||||
|
* @{
|
||||||
|
* @brief AVR specific port code, structures and macros.
|
||||||
|
*
|
||||||
|
* @ingroup AVR
|
||||||
|
* @file ports/AVR/chtypes.h Port types.
|
||||||
|
* @file ports/AVR/chcore.h Port related structures and macros.
|
||||||
|
* @file ports/AVR/chcore.c Port related code.
|
||||||
|
*/
|
||||||
|
/** @} */
|
|
@ -24,13 +24,6 @@
|
||||||
|
|
||||||
#include <ch.h>
|
#include <ch.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 advantage in doing so, as example
|
|
||||||
* because performance concerns.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default implementation of this function is void so no messages are
|
* The default implementation of this function is void so no messages are
|
||||||
* actually printed.
|
* actually printed.
|
||||||
|
|
Loading…
Reference in New Issue