From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/hal.dox | 4 +- os/hal/include/adc.h | 2 +- os/hal/include/can.h | 2 +- os/hal/include/hal.h | 2 +- os/hal/include/mac.h | 6 +- os/hal/include/mii.h | 2 +- os/hal/include/mmc_spi.h | 28 +- os/hal/include/pal.h | 22 +- os/hal/include/pwm.h | 2 +- os/hal/include/serial.h | 4 +- os/hal/include/spi.h | 2 +- os/hal/platforms/AT91SAM7/at91sam7.h | 2 +- os/hal/platforms/AT91SAM7/at91sam7_mii.c | 2 +- os/hal/platforms/AT91SAM7/at91sam7_mii.h | 4 +- os/hal/platforms/AT91SAM7/hal_lld.c | 2 +- os/hal/platforms/AT91SAM7/hal_lld.h | 2 +- os/hal/platforms/AT91SAM7/mac_lld.c | 20 +- os/hal/platforms/AT91SAM7/mac_lld.h | 2 +- os/hal/platforms/AT91SAM7/pal_lld.c | 2 +- os/hal/platforms/AT91SAM7/pal_lld.h | 8 +- os/hal/platforms/AT91SAM7/platform.dox | 2 +- os/hal/platforms/AT91SAM7/serial_lld.c | 4 +- os/hal/platforms/AT91SAM7/serial_lld.h | 2 +- os/hal/platforms/AVR/hal_lld.c | 2 +- os/hal/platforms/AVR/hal_lld.h | 2 +- os/hal/platforms/AVR/platform.dox | 2 +- os/hal/platforms/AVR/serial_lld.c | 4 +- os/hal/platforms/AVR/serial_lld.h | 2 +- os/hal/platforms/LPC214x/hal_lld.c | 2 +- os/hal/platforms/LPC214x/hal_lld.h | 2 +- os/hal/platforms/LPC214x/lpc214x.h | 2 +- os/hal/platforms/LPC214x/pal_lld.c | 2 +- os/hal/platforms/LPC214x/pal_lld.h | 6 +- os/hal/platforms/LPC214x/platform.dox | 2 +- os/hal/platforms/LPC214x/serial_lld.c | 10 +- os/hal/platforms/LPC214x/serial_lld.h | 2 +- os/hal/platforms/LPC214x/spi_lld.c | 4 +- os/hal/platforms/LPC214x/spi_lld.h | 6 +- os/hal/platforms/LPC214x/vic.c | 2 +- os/hal/platforms/LPC214x/vic.h | 2 +- os/hal/platforms/Linux/console.c | 4 +- os/hal/platforms/Linux/console.h | 2 +- os/hal/platforms/Linux/hal_lld.c | 2 +- os/hal/platforms/Linux/hal_lld.h | 2 +- os/hal/platforms/Linux/serial_lld.c | 4 +- os/hal/platforms/Linux/serial_lld.h | 4 +- os/hal/platforms/MSP430/hal_lld.c | 2 +- os/hal/platforms/MSP430/hal_lld.h | 8 +- os/hal/platforms/MSP430/pal_lld.c | 2 +- os/hal/platforms/MSP430/pal_lld.h | 16 +- os/hal/platforms/MSP430/platform.dox | 2 +- os/hal/platforms/MSP430/serial_lld.c | 4 +- os/hal/platforms/MSP430/serial_lld.h | 2 +- os/hal/platforms/SPC563/hal_lld.c | 2 +- os/hal/platforms/SPC563/hal_lld.h | 2 +- os/hal/platforms/SPC563/serial_lld.c | 4 +- os/hal/platforms/SPC563/serial_lld.h | 2 +- os/hal/platforms/SPC563/typedefs.h | 2 +- os/hal/platforms/STM32/adc_lld.c | 2 +- os/hal/platforms/STM32/adc_lld.h | 20 +- os/hal/platforms/STM32/can_lld.c | 10 +- os/hal/platforms/STM32/can_lld.h | 28 +- os/hal/platforms/STM32/hal_lld.c | 2 +- os/hal/platforms/STM32/hal_lld.h | 4 +- os/hal/platforms/STM32/pal_lld.c | 6 +- os/hal/platforms/STM32/pal_lld.h | 8 +- os/hal/platforms/STM32/platform.dox | 2 +- os/hal/platforms/STM32/pwm_lld.c | 10 +- os/hal/platforms/STM32/pwm_lld.h | 12 +- os/hal/platforms/STM32/serial_lld.c | 4 +- os/hal/platforms/STM32/serial_lld.h | 6 +- os/hal/platforms/STM32/spi_lld.c | 6 +- os/hal/platforms/STM32/spi_lld.h | 18 +- os/hal/platforms/STM32/stm32_dma.c | 8 +- os/hal/platforms/STM32/stm32_dma.h | 2 +- os/hal/platforms/Win32/console.c | 4 +- os/hal/platforms/Win32/console.h | 2 +- os/hal/platforms/Win32/hal_lld.c | 2 +- os/hal/platforms/Win32/hal_lld.h | 2 +- os/hal/platforms/Win32/serial_lld.c | 4 +- os/hal/platforms/Win32/serial_lld.h | 4 +- os/hal/src/adc.c | 18 +- os/hal/src/can.c | 14 +- os/hal/src/hal.c | 4 +- os/hal/src/mac.c | 22 +- os/hal/src/mmc_spi.c | 30 +- os/hal/src/pal.c | 4 +- os/hal/src/pwm.c | 10 +- os/hal/src/serial.c | 2 +- os/hal/src/spi.c | 12 +- os/hal/templates/adc_lld.c | 2 +- os/hal/templates/adc_lld.h | 10 +- os/hal/templates/can_lld.c | 6 +- os/hal/templates/can_lld.h | 6 +- os/hal/templates/hal_lld.c | 2 +- os/hal/templates/hal_lld.h | 4 +- os/hal/templates/halconf.h | 10 +- os/hal/templates/mac_lld.c | 4 +- os/hal/templates/mac_lld.h | 4 +- os/hal/templates/meta/driver.c | 2 +- os/hal/templates/meta/driver.h | 2 +- os/hal/templates/meta/driver_lld.c | 2 +- os/hal/templates/meta/driver_lld.h | 2 +- os/hal/templates/pal_lld.c | 2 +- os/hal/templates/pal_lld.h | 12 +- os/hal/templates/pwm_lld.c | 2 +- os/hal/templates/pwm_lld.h | 8 +- os/hal/templates/serial_lld.c | 4 +- os/hal/templates/serial_lld.h | 2 +- os/hal/templates/spi_lld.c | 4 +- os/hal/templates/spi_lld.h | 6 +- os/kernel/include/ch.h | 12 +- os/kernel/include/channels.h | 2 +- os/kernel/include/condvars.h | 2 +- os/kernel/include/debug.h | 2 +- os/kernel/include/events.h | 2 +- os/kernel/include/heap.h | 2 +- os/kernel/include/inline.h | 2 +- os/kernel/include/lists.h | 4 +- os/kernel/include/mailboxes.h | 4 +- os/kernel/include/memcore.h | 2 +- os/kernel/include/mempools.h | 6 +- os/kernel/include/messages.h | 2 +- os/kernel/include/mutexes.h | 2 +- os/kernel/include/queues.h | 484 ++--- os/kernel/include/registry.h | 4 +- os/kernel/include/scheduler.h | 268 +-- os/kernel/include/semaphores.h | 6 +- os/kernel/include/streams.h | 2 +- os/kernel/include/sys.h | 4 +- os/kernel/include/threads.h | 660 +++---- os/kernel/include/vt.h | 6 +- os/kernel/kernel.dox | 4 +- os/kernel/src/chcond.c | 2 +- os/kernel/src/chdebug.c | 4 +- os/kernel/src/chevents.c | 2 +- os/kernel/src/chheap.c | 2 +- os/kernel/src/chlists.c | 2 +- os/kernel/src/chmboxes.c | 4 +- os/kernel/src/chmemcore.c | 6 +- os/kernel/src/chmempools.c | 2 +- os/kernel/src/chmsg.c | 2 +- os/kernel/src/chmtx.c | 552 +++--- os/kernel/src/chqueues.c | 2 +- os/kernel/src/chregistry.c | 6 +- os/kernel/src/chschd.c | 560 +++--- os/kernel/src/chsem.c | 2 +- os/kernel/src/chsys.c | 260 +-- os/kernel/src/chthreads.c | 892 ++++----- os/kernel/src/chvt.c | 4 +- os/kernel/templates/chconf.h | 4 +- os/kernel/templates/chcore.c | 16 +- os/kernel/templates/chcore.h | 6 +- os/kernel/templates/chtypes.h | 2 +- os/ports/GCC/ARM7/AT91SAM7/vectors.s | 2 +- os/ports/GCC/ARM7/AT91SAM7/wfi.h | 2 +- os/ports/GCC/ARM7/LPC214x/vectors.s | 2 +- os/ports/GCC/ARM7/LPC214x/wfi.h | 2 +- os/ports/GCC/ARM7/chcore.c | 4 +- os/ports/GCC/ARM7/chcore.h | 6 +- os/ports/GCC/ARM7/chcoreasm.s | 2 +- os/ports/GCC/ARM7/chtypes.h | 2 +- os/ports/GCC/ARM7/crt0.s | 2 +- os/ports/GCC/ARM7/port.dox | 2 +- os/ports/GCC/ARMCM3/STM32F103/vectors.s | 2 +- os/ports/GCC/ARMCM3/chcore.c | 2 +- os/ports/GCC/ARMCM3/chcore.h | 6 +- os/ports/GCC/ARMCM3/chtypes.h | 2 +- os/ports/GCC/ARMCM3/cmsis/core_cm3.h | 38 +- os/ports/GCC/ARMCM3/crt0.s | 256 +-- os/ports/GCC/ARMCM3/nvic.c | 8 +- os/ports/GCC/ARMCM3/nvic.h | 4 +- os/ports/GCC/ARMCM3/port.dox | 2 +- os/ports/GCC/AVR/chcore.c | 2 +- os/ports/GCC/AVR/chcore.h | 6 +- os/ports/GCC/AVR/chtypes.h | 2 +- os/ports/GCC/AVR/port.dox | 2 +- os/ports/GCC/MSP430/chcore.c | 4 +- os/ports/GCC/MSP430/chcore.h | 4 +- os/ports/GCC/MSP430/chtypes.h | 2 +- os/ports/GCC/MSP430/port.dox | 2 +- os/ports/GCC/PPC/SPC56x/ivor.s | 348 ++-- os/ports/GCC/PPC/SPC56x/vectors.s | 2988 +++++++++++++++--------------- os/ports/GCC/PPC/chcore.c | 4 +- os/ports/GCC/PPC/chcore.h | 10 +- os/ports/GCC/PPC/chtypes.h | 2 +- os/ports/GCC/PPC/crt0.s | 238 +-- os/ports/GCC/SIMIA32/chcore.c | 2 +- os/ports/GCC/SIMIA32/chcore.h | 2 +- os/ports/GCC/SIMIA32/chtypes.h | 2 +- os/ports/ports.dox | 2 +- os/various/ch.cpp | 2 +- os/various/ch.hpp | 14 +- os/various/evtimer.c | 2 +- os/various/evtimer.h | 2 +- os/various/memstreams.c | 2 +- os/various/memstreams.h | 2 +- os/various/shell.c | 28 +- os/various/shell.h | 8 +- os/various/syscalls.c | 340 ++-- os/various/various.dox | 2 +- 201 files changed, 4404 insertions(+), 4406 deletions(-) (limited to 'os') diff --git a/os/hal/hal.dox b/os/hal/hal.dox index 657185f8e..08a3ebbd1 100644 --- a/os/hal/hal.dox +++ b/os/hal/hal.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -394,4 +394,4 @@ * @ingroup IO */ - \ No newline at end of file + diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h index 76e83a51a..983fe0f78 100644 --- a/os/hal/include/adc.h +++ b/os/hal/include/adc.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/include/can.h b/os/hal/include/can.h index 0e171fee4..b503dd8e3 100644 --- a/os/hal/include/can.h +++ b/os/hal/include/can.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h index 1bdeafe8c..1084baf91 100644 --- a/os/hal/include/hal.h +++ b/os/hal/include/hal.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/include/mac.h b/os/hal/include/mac.h index 29381bab3..a180cc4f0 100644 --- a/os/hal/include/mac.h +++ b/os/hal/include/mac.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -57,7 +57,7 @@ /** * @brief Returns the received frames event source. - * + * * @param[in] macp pointer to the @p MACDriver object * @return The pointer to the @p EventSource structure. */ @@ -67,7 +67,7 @@ /** * @brief Writes to a transmit descriptor's stream. - * + * * @param[in] tdp pointer to a @p MACTransmitDescriptor structure * @param[in] buf pointer to the buffer containing the data to be written * @param[in] size number of bytes to be written diff --git a/os/hal/include/mii.h b/os/hal/include/mii.h index 937b805ab..bc3b4ff6a 100644 --- a/os/hal/include/mii.h +++ b/os/hal/include/mii.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/include/mmc_spi.h b/os/hal/include/mmc_spi.h index e4c3ee157..cc698c3de 100644 --- a/os/hal/include/mmc_spi.h +++ b/os/hal/include/mmc_spi.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -65,7 +65,7 @@ * routines releasing some extra CPU time for the threads with * lower priority, this may slow down the driver a bit however. * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. + * use a DMA channel and heavily loads the CPU. */ #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) #define MMC_NICE_WAITING TRUE @@ -73,14 +73,14 @@ /** * @brief Number of positive insertion queries before generating the - * insertion event. + * insertion event. */ #if !defined(MMC_POLLING_INTERVAL) || defined(__DOXYGEN__) #define MMC_POLLING_INTERVAL 10 #endif /** - * @brief Interval, in milliseconds, between insertion queries. + * @brief Interval, in milliseconds, between insertion queries. */ #if !defined(MMC_POLLING_DELAY) || defined(__DOXYGEN__) #define MMC_POLLING_DELAY 10 @@ -138,19 +138,19 @@ typedef struct { */ const MMCConfig *mmc_config; /** - * @brief SPI driver associated to this MMC driver. + * @brief SPI driver associated to this MMC driver. */ SPIDriver *mmc_spip; /** - * @brief SPI low speed configuration used during initialization. + * @brief SPI low speed configuration used during initialization. */ const SPIConfig *mmc_lscfg; /** - * @brief SPI high speed configuration used during transfers. + * @brief SPI high speed configuration used during transfers. */ const SPIConfig *mmc_hscfg; /** - * @brief Write protect status query function. + * @brief Write protect status query function. */ mmcquery_t mmc_is_protected; /** @@ -158,19 +158,19 @@ typedef struct { */ mmcquery_t mmc_is_inserted; /** - * @brief Card insertion event source. + * @brief Card insertion event source. */ EventSource mmc_inserted_event; /** - * @brief Card removal event source. + * @brief Card removal event source. */ EventSource mmc_removed_event; /** - * @brief MMC insertion polling timer. + * @brief MMC insertion polling timer. */ VirtualTimer mmc_vt; /** - * @brief Insertion counter. + * @brief Insertion counter. */ uint_fast8_t mmc_cnt; } MMCDriver; @@ -180,12 +180,12 @@ typedef struct { /*===========================================================================*/ /** - * @brief Returns the driver state. + * @brief Returns the driver state. */ #define mmcGetDriverState(mmcp) ((mmcp)->mmc_state) /** - * @brief Returns the write protect status. + * @brief Returns the write protect status. */ #define mmcIsWriteProtected(mmcp) ((mmcp)->mmc_is_protected()) diff --git a/os/hal/include/pal.h b/os/hal/include/pal.h index 352523021..1ba3ee04d 100644 --- a/os/hal/include/pal.h +++ b/os/hal/include/pal.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -37,7 +37,7 @@ /** * @brief Bits in a mode word dedicated as mode selector. * @details The other bits are not defined and may be used as device-specific - * option bits. + * option bits. */ #define PAL_MODE_MASK 0xF @@ -45,12 +45,12 @@ * @brief After reset state. * @details The state itself is not specified and is architecture dependent, * it is guaranteed to be equal to the after-reset state. It is - * usually an input state. + * usually an input state. */ #define PAL_MODE_RESET 0 /** - * @brief Safe state for unconnected pads. + * @brief Safe state for unconnected pads. * @details The state itself is not specified and is architecture dependent, * it may be mapped on @p PAL_MODE_INPUT_PULLUP, * @p PAL_MODE_INPUT_PULLDOWN or @p PAL_MODE_OUTPUT_PUSHPULL as @@ -64,7 +64,7 @@ #define PAL_MODE_INPUT 2 /** - * @brief Input pad with weak pull up resistor. + * @brief Input pad with weak pull up resistor. */ #define PAL_MODE_INPUT_PULLUP 3 @@ -74,7 +74,7 @@ #define PAL_MODE_INPUT_PULLDOWN 4 /** - * @brief Analog input mode. + * @brief Analog input mode. */ #define PAL_MODE_INPUT_ANALOG 5 @@ -145,7 +145,7 @@ typedef struct { * @details This macro calculates the mask of a bit within a port. * * @param[in] n bit position within the port - * @return The bit mask. + * @return The bit mask. */ #define PAL_PORT_BIT(n) ((ioportmask_t)(1 << (n))) @@ -154,7 +154,7 @@ typedef struct { * @brief Bits group mask helper. * @details This macro calculates the mask of a bits group. * - * @param[in] width group width + * @param[in] width group width * @return The group mask. */ #define PAL_GROUP_MASK(width) ((ioportmask_t)(1 << (width)) - 1) @@ -188,7 +188,7 @@ typedef struct { * * @param[in] config pointer to an architecture specific configuration * structure. This structure is defined in the low level driver - * header. + * header. */ #define palInit(config) pal_lld_init(config) @@ -212,7 +212,7 @@ typedef struct { * value. * @note The default implementation always return zero and computes the * parameter eventual side effects. - * + * * @param[in] port port identifier * @return The latched logical states. */ @@ -302,7 +302,7 @@ typedef struct { /** * @brief Reads a group of bits. - * + * * @param[in] port port identifier * @param[in] mask group mask, a logical AND is performed on the input * data diff --git a/os/hal/include/pwm.h b/os/hal/include/pwm.h index f736c2e98..9b0043a21 100644 --- a/os/hal/include/pwm.h +++ b/os/hal/include/pwm.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h index 07527d601..e321d5585 100644 --- a/os/hal/include/serial.h +++ b/os/hal/include/serial.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -97,7 +97,7 @@ typedef enum { } sdstate_t; /** - * @brief Structure representing a serial driver. + * @brief Structure representing a serial driver. */ typedef struct _SerialDriver SerialDriver; diff --git a/os/hal/include/spi.h b/os/hal/include/spi.h index 5729aa042..7ff92a04d 100644 --- a/os/hal/include/spi.h +++ b/os/hal/include/spi.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/at91sam7.h b/os/hal/platforms/AT91SAM7/at91sam7.h index 583f1fd04..a34ab62d4 100644 --- a/os/hal/platforms/AT91SAM7/at91sam7.h +++ b/os/hal/platforms/AT91SAM7/at91sam7.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/at91sam7_mii.c b/os/hal/platforms/AT91SAM7/at91sam7_mii.c index 8637f5b0c..8a79082c5 100644 --- a/os/hal/platforms/AT91SAM7/at91sam7_mii.c +++ b/os/hal/platforms/AT91SAM7/at91sam7_mii.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/at91sam7_mii.h b/os/hal/platforms/AT91SAM7/at91sam7_mii.h index be37a21f1..8d98d41b0 100644 --- a/os/hal/platforms/AT91SAM7/at91sam7_mii.h +++ b/os/hal/platforms/AT91SAM7/at91sam7_mii.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -52,7 +52,7 @@ /*===========================================================================*/ /** - * @brief Pins latched by the PHY at reset. + * @brief Pins latched by the PHY at reset. */ #if PHY_HARDWARE == PHY_MICREL_KS8721 #define PHY_ADDRESS 1 diff --git a/os/hal/platforms/AT91SAM7/hal_lld.c b/os/hal/platforms/AT91SAM7/hal_lld.c index 3b23b4f74..a9012f186 100644 --- a/os/hal/platforms/AT91SAM7/hal_lld.c +++ b/os/hal/platforms/AT91SAM7/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/hal_lld.h b/os/hal/platforms/AT91SAM7/hal_lld.h index 70b62e31c..e1a8fa2f8 100644 --- a/os/hal/platforms/AT91SAM7/hal_lld.h +++ b/os/hal/platforms/AT91SAM7/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/mac_lld.c b/os/hal/platforms/AT91SAM7/mac_lld.c index 9517c4838..248202b05 100644 --- a/os/hal/platforms/AT91SAM7/mac_lld.c +++ b/os/hal/platforms/AT91SAM7/mac_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -53,7 +53,7 @@ /*===========================================================================*/ /** - * @brief Ethernet driver 1. + * @brief Ethernet driver 1. */ MACDriver ETH1; @@ -83,7 +83,7 @@ static uint8_t tb[EMAC_TRANSMIT_DESCRIPTORS * EMAC_TRANSMIT_BUFFERS_SIZE] /*===========================================================================*/ /** - * @brief IRQ handler. + * @brief IRQ handler. */ /** @cond never*/ __attribute__((noinline)) @@ -153,7 +153,7 @@ CH_IRQ_HANDLER(irq_handler) { /*===========================================================================*/ /** - * @brief Low level MAC initialization. + * @brief Low level MAC initialization. */ void mac_lld_init(void) { unsigned i; @@ -178,7 +178,7 @@ void mac_lld_init(void) { txptr = td; /* - * Associated PHY initialization. + * Associated PHY initialization. */ miiReset(Ð1); @@ -218,7 +218,7 @@ void mac_lld_init(void) { AT91C_BASE_EMAC->EMAC_NCR &= ~AT91C_EMAC_MPE; /* - * Interrupt configuration. + * Interrupt configuration. */ AT91C_BASE_EMAC->EMAC_IER = AT91C_EMAC_RCOMP | AT91C_EMAC_TCOMP; AIC_ConfigureIT(AT91C_ID_EMAC, @@ -272,7 +272,7 @@ msg_t max_lld_get_transmit_descriptor(MACDriver *macp, } /* * Set the buffer size and configuration, the buffer is also marked - * as locked. + * as locked. */ if (++txptr >= &td[EMAC_TRANSMIT_DESCRIPTORS]) { edp->w2 = W2_T_LOCKED | W2_T_USED | W2_T_LAST_BUFFER | W2_T_WRAP; @@ -368,7 +368,7 @@ skip: /* * Now compute the total frame size skipping eventual incomplete frames - * or holes... + * or holes... */ restart: edp = rxptr; @@ -393,7 +393,7 @@ restart: cleanup(edp); goto restart; /* Another start buffer for some reason... */ } - + if (++rxptr >= &rd[EMAC_RECEIVE_DESCRIPTORS]) rxptr = rd; n--; @@ -458,7 +458,7 @@ void mac_lld_release_receive_descriptor(MACReceiveDescriptor *rdp) { while ((n > 0) && !done); /* * Make rxptr point to the descriptor where the next frame will most - * likely appear. + * likely appear. */ rxptr = edp; } diff --git a/os/hal/platforms/AT91SAM7/mac_lld.h b/os/hal/platforms/AT91SAM7/mac_lld.h index 155439d7a..a1580aa7e 100644 --- a/os/hal/platforms/AT91SAM7/mac_lld.h +++ b/os/hal/platforms/AT91SAM7/mac_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/pal_lld.c b/os/hal/platforms/AT91SAM7/pal_lld.c index 60fbb9899..b91ec9348 100644 --- a/os/hal/platforms/AT91SAM7/pal_lld.c +++ b/os/hal/platforms/AT91SAM7/pal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/pal_lld.h b/os/hal/platforms/AT91SAM7/pal_lld.h index f88f6c4db..ef143dac5 100644 --- a/os/hal/platforms/AT91SAM7/pal_lld.h +++ b/os/hal/platforms/AT91SAM7/pal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -69,12 +69,12 @@ typedef struct { } AT91SAM7PIOConfig; /** - * @brief Width, in bits, of an I/O port. + * @brief Width, in bits, of an I/O port. */ #define PAL_IOPORTS_WIDTH 32 /** - * @brief Digital I/O port sized unsigned type. + * @brief Digital I/O port sized unsigned type. */ typedef uint32_t ioportmask_t; @@ -82,7 +82,7 @@ typedef uint32_t ioportmask_t; * @brief Port Identifier. * @details This type can be a scalar or some kind of pointer, do not make * any assumption about it, use the provided macros when populating - * variables of this type. + * variables of this type. */ typedef AT91PS_PIO ioportid_t; diff --git a/os/hal/platforms/AT91SAM7/platform.dox b/os/hal/platforms/AT91SAM7/platform.dox index 2b87f64bd..770e80e5b 100644 --- a/os/hal/platforms/AT91SAM7/platform.dox +++ b/os/hal/platforms/AT91SAM7/platform.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AT91SAM7/serial_lld.c b/os/hal/platforms/AT91SAM7/serial_lld.c index 64acb809d..c5197544d 100644 --- a/os/hal/platforms/AT91SAM7/serial_lld.c +++ b/os/hal/platforms/AT91SAM7/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -222,7 +222,7 @@ CH_IRQ_HANDLER(USART1IrqHandler) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/AT91SAM7/serial_lld.h b/os/hal/platforms/AT91SAM7/serial_lld.h index d05c7c6bd..cc03b144f 100644 --- a/os/hal/platforms/AT91SAM7/serial_lld.h +++ b/os/hal/platforms/AT91SAM7/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AVR/hal_lld.c b/os/hal/platforms/AVR/hal_lld.c index adf8db71f..a2bed98ed 100644 --- a/os/hal/platforms/AVR/hal_lld.c +++ b/os/hal/platforms/AVR/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AVR/hal_lld.h b/os/hal/platforms/AVR/hal_lld.h index 03bf5722e..6e7c8fe77 100644 --- a/os/hal/platforms/AVR/hal_lld.h +++ b/os/hal/platforms/AVR/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AVR/platform.dox b/os/hal/platforms/AVR/platform.dox index 0302b83bb..6e51eb843 100644 --- a/os/hal/platforms/AVR/platform.dox +++ b/os/hal/platforms/AVR/platform.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/AVR/serial_lld.c b/os/hal/platforms/AVR/serial_lld.c index 008b1176d..48f688b64 100644 --- a/os/hal/platforms/AVR/serial_lld.c +++ b/os/hal/platforms/AVR/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -216,7 +216,7 @@ CH_IRQ_HANDLER(USART1_UDRE_vect) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/AVR/serial_lld.h b/os/hal/platforms/AVR/serial_lld.h index 3d5281e95..cfdb40aa9 100644 --- a/os/hal/platforms/AVR/serial_lld.h +++ b/os/hal/platforms/AVR/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/hal_lld.c b/os/hal/platforms/LPC214x/hal_lld.c index 5f0e3eedb..b7520f6a6 100644 --- a/os/hal/platforms/LPC214x/hal_lld.c +++ b/os/hal/platforms/LPC214x/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/hal_lld.h b/os/hal/platforms/LPC214x/hal_lld.h index 98905aac9..0c231e4e5 100644 --- a/os/hal/platforms/LPC214x/hal_lld.h +++ b/os/hal/platforms/LPC214x/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/lpc214x.h b/os/hal/platforms/LPC214x/lpc214x.h index 9a3238c79..66c288028 100644 --- a/os/hal/platforms/LPC214x/lpc214x.h +++ b/os/hal/platforms/LPC214x/lpc214x.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/pal_lld.c b/os/hal/platforms/LPC214x/pal_lld.c index 6d9e03027..33838063c 100644 --- a/os/hal/platforms/LPC214x/pal_lld.c +++ b/os/hal/platforms/LPC214x/pal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/pal_lld.h b/os/hal/platforms/LPC214x/pal_lld.h index c2c8823e9..259fdfe30 100644 --- a/os/hal/platforms/LPC214x/pal_lld.h +++ b/os/hal/platforms/LPC214x/pal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -72,12 +72,12 @@ typedef struct { } LPC214xFIOConfig; /** - * @brief Width, in bits, of an I/O port. + * @brief Width, in bits, of an I/O port. */ #define PAL_IOPORTS_WIDTH 32 /** - * @brief Digital I/O port sized unsigned type. + * @brief Digital I/O port sized unsigned type. */ typedef uint32_t ioportmask_t; diff --git a/os/hal/platforms/LPC214x/platform.dox b/os/hal/platforms/LPC214x/platform.dox index b429793ec..5323f1ecf 100644 --- a/os/hal/platforms/LPC214x/platform.dox +++ b/os/hal/platforms/LPC214x/platform.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/serial_lld.c b/os/hal/platforms/LPC214x/serial_lld.c index 4f5d671b4..673c737f3 100644 --- a/os/hal/platforms/LPC214x/serial_lld.c +++ b/os/hal/platforms/LPC214x/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -179,7 +179,7 @@ static void serve_interrupt(SerialDriver *sdp) { } /** - * @brief Attempts a TX FIFO preload. + * @brief Attempts a TX FIFO preload. */ static void preload(SerialDriver *sdp) { UART *u = sdp->uart; @@ -199,7 +199,7 @@ static void preload(SerialDriver *sdp) { } /** - * @brief Driver SD1 output notification. + * @brief Driver SD1 output notification. */ #if USE_LPC214x_UART0 || defined(__DOXYGEN__) static void notify1(void) { @@ -224,7 +224,7 @@ static void notify2(void) { /*===========================================================================*/ /** - * @brief UART0 IRQ handler. + * @brief UART0 IRQ handler. */ #if USE_LPC214x_UART0 || defined(__DOXYGEN__) CH_IRQ_HANDLER(UART0IrqHandler) { @@ -260,7 +260,7 @@ CH_IRQ_HANDLER(UART1IrqHandler) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/LPC214x/serial_lld.h b/os/hal/platforms/LPC214x/serial_lld.h index fe2746dea..ad93fc953 100644 --- a/os/hal/platforms/LPC214x/serial_lld.h +++ b/os/hal/platforms/LPC214x/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/spi_lld.c b/os/hal/platforms/LPC214x/spi_lld.c index 8ed19b8ea..44c668db8 100644 --- a/os/hal/platforms/LPC214x/spi_lld.c +++ b/os/hal/platforms/LPC214x/spi_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -85,7 +85,7 @@ void rw8(size_t n, const uint8_t *txbuf, uint8_t *rxbuf) { /*===========================================================================*/ /** - * @brief Low level SPI driver initialization. + * @brief Low level SPI driver initialization. */ void spi_lld_init(void) { diff --git a/os/hal/platforms/LPC214x/spi_lld.h b/os/hal/platforms/LPC214x/spi_lld.h index c1fec8e02..64719ad9b 100644 --- a/os/hal/platforms/LPC214x/spi_lld.h +++ b/os/hal/platforms/LPC214x/spi_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -55,7 +55,7 @@ /*===========================================================================*/ /** - * @brief Driver configuration structure. + * @brief Driver configuration structure. */ typedef struct { /** @@ -85,7 +85,7 @@ typedef struct { */ typedef struct { /** - * @brief Driver state. + * @brief Driver state. */ spistate_t spd_state; #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) diff --git a/os/hal/platforms/LPC214x/vic.c b/os/hal/platforms/LPC214x/vic.c index b94b4b53f..f9b18f887 100644 --- a/os/hal/platforms/LPC214x/vic.c +++ b/os/hal/platforms/LPC214x/vic.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/LPC214x/vic.h b/os/hal/platforms/LPC214x/vic.h index 486a80b56..df4b1b67e 100644 --- a/os/hal/platforms/LPC214x/vic.h +++ b/os/hal/platforms/LPC214x/vic.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Linux/console.c b/os/hal/platforms/Linux/console.c index 20443dcaf..737cf92bf 100644 --- a/os/hal/platforms/Linux/console.c +++ b/os/hal/platforms/Linux/console.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -33,7 +33,7 @@ /*===========================================================================*/ /** - * @brief Console driver 1. + * @brief Console driver 1. */ BaseChannel CD1; diff --git a/os/hal/platforms/Linux/console.h b/os/hal/platforms/Linux/console.h index d6f6cc9c4..3a30e6295 100644 --- a/os/hal/platforms/Linux/console.h +++ b/os/hal/platforms/Linux/console.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Linux/hal_lld.c b/os/hal/platforms/Linux/hal_lld.c index e143dd5fb..578051d70 100644 --- a/os/hal/platforms/Linux/hal_lld.c +++ b/os/hal/platforms/Linux/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Linux/hal_lld.h b/os/hal/platforms/Linux/hal_lld.h index d4bac85a7..1f65bfc05 100644 --- a/os/hal/platforms/Linux/hal_lld.h +++ b/os/hal/platforms/Linux/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Linux/serial_lld.c b/os/hal/platforms/Linux/serial_lld.c index c80c59d1b..cd1cc9f8b 100644 --- a/os/hal/platforms/Linux/serial_lld.c +++ b/os/hal/platforms/Linux/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -201,7 +201,7 @@ static bool_t outint(SerialDriver *sdp) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/Linux/serial_lld.h b/os/hal/platforms/Linux/serial_lld.h index 56618e30a..1fb29d197 100644 --- a/os/hal/platforms/Linux/serial_lld.h +++ b/os/hal/platforms/Linux/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -65,7 +65,7 @@ #endif /** - * @brief Listen port for SD1. + * @brief Listen port for SD1. */ #if !defined(SD1_PORT) || defined(__DOXYGEN__) #define SIM_SD1_PORT 29001 diff --git a/os/hal/platforms/MSP430/hal_lld.c b/os/hal/platforms/MSP430/hal_lld.c index d511f7f6e..c02957014 100644 --- a/os/hal/platforms/MSP430/hal_lld.c +++ b/os/hal/platforms/MSP430/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/MSP430/hal_lld.h b/os/hal/platforms/MSP430/hal_lld.h index 1d2fb6109..cb8a46219 100644 --- a/os/hal/platforms/MSP430/hal_lld.h +++ b/os/hal/platforms/MSP430/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -50,7 +50,7 @@ * @details The clock source can be selected from: * - @p MSP430_CLOCK_SOURCE_XT2CLK. * - @p MSP430_CLOCK_SOURCE_DCOCLK. - * . + * . */ #if !defined(MSP430_USE_CLOCK) || defined(__DOXYGEN__) #define MSP430_USE_CLOCK MSP430_CLOCK_SOURCE_XT2CLK @@ -61,7 +61,7 @@ /*===========================================================================*/ /* - * Calculating the derived clock constants. + * Calculating the derived clock constants. */ #define ACLK LFXT1CLK #if MSP430_USE_CLOCK == MSP430_CLOCK_SOURCE_XT2CLK @@ -75,7 +75,7 @@ #endif /* - * Calculating the initialization values. + * Calculating the initialization values. */ #define VAL_DCOCTL (DCO0 | DCO1) #if MSP430_USE_CLOCK == MSP430_CLOCK_SOURCE_XT2CLK diff --git a/os/hal/platforms/MSP430/pal_lld.c b/os/hal/platforms/MSP430/pal_lld.c index 38806a7f8..4786261f0 100644 --- a/os/hal/platforms/MSP430/pal_lld.c +++ b/os/hal/platforms/MSP430/pal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/MSP430/pal_lld.h b/os/hal/platforms/MSP430/pal_lld.h index 31002e0d6..e52589e55 100644 --- a/os/hal/platforms/MSP430/pal_lld.h +++ b/os/hal/platforms/MSP430/pal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -45,7 +45,7 @@ /** * @brief Simplified MSP430 I/O port representation. * @details This structure represents the common part of all the MSP430 I/O - * ports. + * ports. */ struct port_common_t { ioregister_t in; @@ -54,7 +54,7 @@ struct port_common_t { }; /** - * @brief Generic MSP430 I/O port. + * @brief Generic MSP430 I/O port. */ union __ioport { struct port_common_t iop_common; @@ -63,7 +63,7 @@ union __ioport { }; /** - * @brief Setup registers common to all the MSP430 ports. + * @brief Setup registers common to all the MSP430 ports. */ typedef struct { ioregister_t out; @@ -75,7 +75,7 @@ typedef struct { * @details An instance of this structure must be passed to @p palInit() at * system startup time in order to initialize the digital I/O * subsystem. This represents only the initial setup, specific pads - * or whole ports can be reprogrammed at later time. + * or whole ports can be reprogrammed at later time. */ typedef struct { #if defined(__MSP430_HAS_PORT1__) || \ @@ -117,7 +117,7 @@ typedef struct { } MSP430DIOConfig; /** - * @brief Width, in bits, of an I/O port. + * @brief Width, in bits, of an I/O port. */ #define PAL_IOPORTS_WIDTH 8 @@ -128,7 +128,7 @@ typedef struct { #define PAL_WHOLE_PORT ((ioportmask_t)0xFF) /** - * @brief Digital I/O port sized unsigned type. + * @brief Digital I/O port sized unsigned type. */ typedef uint8_t ioportmask_t; @@ -136,7 +136,7 @@ typedef uint8_t ioportmask_t; * @brief Port Identifier. * @details This type can be a scalar or some kind of pointer, do not make * any assumption about it, use the provided macros when populating - * variables of this type. + * variables of this type. */ typedef union __ioport * ioportid_t; diff --git a/os/hal/platforms/MSP430/platform.dox b/os/hal/platforms/MSP430/platform.dox index f577bdf21..2ea6c1593 100644 --- a/os/hal/platforms/MSP430/platform.dox +++ b/os/hal/platforms/MSP430/platform.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/MSP430/serial_lld.c b/os/hal/platforms/MSP430/serial_lld.c index abb0086bf..1dc6399f1 100644 --- a/os/hal/platforms/MSP430/serial_lld.c +++ b/os/hal/platforms/MSP430/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -236,7 +236,7 @@ CH_IRQ_HANDLER(USART1RX_VECTOR) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/MSP430/serial_lld.h b/os/hal/platforms/MSP430/serial_lld.h index 3c7e437a2..62d3358bf 100644 --- a/os/hal/platforms/MSP430/serial_lld.h +++ b/os/hal/platforms/MSP430/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/SPC563/hal_lld.c b/os/hal/platforms/SPC563/hal_lld.c index 3339306f9..8c7d496ef 100644 --- a/os/hal/platforms/SPC563/hal_lld.c +++ b/os/hal/platforms/SPC563/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/SPC563/hal_lld.h b/os/hal/platforms/SPC563/hal_lld.h index 2c6df9b10..a9bc43ed8 100644 --- a/os/hal/platforms/SPC563/hal_lld.h +++ b/os/hal/platforms/SPC563/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/SPC563/serial_lld.c b/os/hal/platforms/SPC563/serial_lld.c index e31615019..21a93764b 100644 --- a/os/hal/platforms/SPC563/serial_lld.c +++ b/os/hal/platforms/SPC563/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -244,7 +244,7 @@ CH_IRQ_HANDLER(vector149) { /*===========================================================================*/ /** - * @brief Low level serial driver initialization. + * @brief Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/SPC563/serial_lld.h b/os/hal/platforms/SPC563/serial_lld.h index f3df7b73a..732a55bca 100644 --- a/os/hal/platforms/SPC563/serial_lld.h +++ b/os/hal/platforms/SPC563/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/SPC563/typedefs.h b/os/hal/platforms/SPC563/typedefs.h index a987a4941..b90ce8c68 100644 --- a/os/hal/platforms/SPC563/typedefs.h +++ b/os/hal/platforms/SPC563/typedefs.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/STM32/adc_lld.c b/os/hal/platforms/STM32/adc_lld.c index f1ecc2bde..c543b2c73 100644 --- a/os/hal/platforms/STM32/adc_lld.c +++ b/os/hal/platforms/STM32/adc_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/STM32/adc_lld.h b/os/hal/platforms/STM32/adc_lld.h index 4862f9ef0..7e62a618c 100644 --- a/os/hal/platforms/STM32/adc_lld.h +++ b/os/hal/platforms/STM32/adc_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -84,7 +84,7 @@ #endif /** - * @brief ADC1 DMA error hook. + * @brief ADC1 DMA error hook. * @note The default action for DMA errors is a system halt because DMA error * can only happen because programming errors. */ @@ -101,7 +101,7 @@ /*===========================================================================*/ /** - * @brief ADC sample data type. + * @brief ADC sample data type. */ typedef uint16_t adcsample_t; @@ -113,22 +113,22 @@ typedef uint16_t adc_channels_num_t; /** * @brief ADC notification callback type. * @param[in] buffer pointer to the most recent samples data - * @param[in] n number of buffer rows available starting from @p buffer + * @param[in] n number of buffer rows available starting from @p buffer */ typedef void (*adccallback_t)(adcsample_t *buffer, size_t n); /** * @brief Conversion group configuration structure. * @details This implementation-dependent structure describes a conversion - * operation. + * operation. */ typedef struct { /** - * @brief Enables the circular buffer mode for the group. + * @brief Enables the circular buffer mode for the group. */ bool_t acg_circular; /** - * @brief Number of the analog channels belonging to the conversion group. + * @brief Number of the analog channels belonging to the conversion group. */ adc_channels_num_t acg_num_channels; /* End of the mandatory fields.*/ @@ -176,7 +176,7 @@ typedef struct { * @brief ADC prescaler setting. * @note This field can assume one of the following values: * @p RCC_CFGR_ADCPRE_DIV2, @p RCC_CFGR_ADCPRE_DIV4, - * @p RCC_CFGR_ADCPRE_DIV6, @p RCC_CFGR_ADCPRE_DIV8. + * @p RCC_CFGR_ADCPRE_DIV6, @p RCC_CFGR_ADCPRE_DIV8. */ /* uint32_t ac_prescaler;*/ } ADCConfig; @@ -194,11 +194,11 @@ typedef struct { */ const ADCConfig *ad_config; /** - * @brief Synchronization semaphore. + * @brief Synchronization semaphore. */ Semaphore ad_sem; /** - * @brief Current callback function or @p NULL. + * @brief Current callback function or @p NULL. */ adccallback_t ad_callback; /** diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c index a4a407bfa..4b24ec810 100644 --- a/os/hal/platforms/STM32/can_lld.c +++ b/os/hal/platforms/STM32/can_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -269,12 +269,12 @@ void can_lld_stop(CANDriver *canp) { /** * @brief Determines whether a frame can be transmitted. - * + * * @param[in] canp pointer to the @p CANDriver object * * @return The queue space availability. * @retval FALSE no space in the transmit queue. - * @retval TRUE transmit slot available. + * @retval TRUE transmit slot available. */ bool_t can_lld_can_transmit(CANDriver *canp) { @@ -283,7 +283,7 @@ bool_t can_lld_can_transmit(CANDriver *canp) { /** * @brief Inserts a frame into the transmit queue. - * + * * @param[in] canp pointer to the @p CANDriver object * @param[in] ctfp pointer to the CAN frame to be transmitted */ @@ -322,7 +322,7 @@ bool_t can_lld_can_receive(CANDriver *canp) { /** * @brief Receives a frame from the input queue. - * + * * @param[in] canp pointer to the @p CANDriver object * @param[out] crfp pointer to the buffer where the CAN frame is copied */ diff --git a/os/hal/platforms/STM32/can_lld.h b/os/hal/platforms/STM32/can_lld.h index ced27f38d..25f8a2105 100644 --- a/os/hal/platforms/STM32/can_lld.h +++ b/os/hal/platforms/STM32/can_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -35,7 +35,7 @@ /* * The following macros from the ST header file are replaced with better - * equivalents. + * equivalents. */ #undef CAN_BTR_BRP #undef CAN_BTR_TS1 @@ -44,12 +44,12 @@ /** * @brief This switch defines whether the driver implementation supports - * a low power switch mode with automatic an wakeup feature. + * a low power switch mode with automatic an wakeup feature. */ #define CAN_SUPPORTS_SLEEP TRUE /** - * @brief Minimum number of CAN filters. + * @brief Minimum number of CAN filters. */ #if defined(STM32F10X_CL) || defined(__DOXYGEN__) #define CAN_MAX_FILTERS 28 @@ -102,7 +102,7 @@ /*===========================================================================*/ /** - * @brief CAN status flags. + * @brief CAN status flags. */ typedef uint32_t canstatus_t; @@ -164,7 +164,7 @@ typedef struct { /** * @brief CAN filter. - * @note Refer to the STM32 reference manual for info about filters. + * @note Refer to the STM32 reference manual for info about filters. */ typedef struct { /** @@ -214,13 +214,13 @@ typedef struct { /** * @brief Number of elements into the filters array. * @note By setting this field to zero a default filter is enabled that - * allows all frames, this should be adequate for simple applications. + * allows all frames, this should be adequate for simple applications. */ uint32_t cc_num; /** * @brief Pointer to an array of @p CANFilter structures. * @note This field can be set to @p NULL if the field @p cc_num is set to - * zero. + * zero. */ const CANFilter *cc_filters; } CANConfig; @@ -238,7 +238,7 @@ typedef struct { */ const CANConfig *cd_config; /** - * @brief Transmission queue semaphore. + * @brief Transmission queue semaphore. */ Semaphore cd_txsem; /** @@ -252,7 +252,7 @@ typedef struct { * is not broadcasted for each received frame. It is * responsibility of the application to empty the queue by repeatedly * invoking @p chReceive() when listening to this event. This behavior - * minimizes the interrupt served by the system because CAN traffic. + * minimizes the interrupt served by the system because CAN traffic. */ EventSource cd_rxfull_event; /** @@ -264,22 +264,22 @@ typedef struct { */ EventSource cd_error_event; /** - * @brief Error flags set when an error event is broadcasted. + * @brief Error flags set when an error event is broadcasted. */ canstatus_t cd_status; #if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) /** - * @brief Entering sleep state event. + * @brief Entering sleep state event. */ EventSource cd_sleep_event; /** - * @brief Exiting sleep state event. + * @brief Exiting sleep state event. */ EventSource cd_wakeup_event; #endif /* CAN_USE_SLEEP_MODE */ /* End of the mandatory fields.*/ /** - * @brief Pointer to the CAN registers. + * @brief Pointer to the CAN registers. */ CAN_TypeDef *cd_can; } CANDriver; diff --git a/os/hal/platforms/STM32/hal_lld.c b/os/hal/platforms/STM32/hal_lld.c index 097a75bd2..616a2b4df 100644 --- a/os/hal/platforms/STM32/hal_lld.c +++ b/os/hal/platforms/STM32/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/STM32/hal_lld.h b/os/hal/platforms/STM32/hal_lld.h index db2a9c390..5b24589ee 100644 --- a/os/hal/platforms/STM32/hal_lld.h +++ b/os/hal/platforms/STM32/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -55,7 +55,7 @@ /** * @brief System clock setting. - * @note Only 48MHz and 72MHz are currently supported. + * @note Only 48MHz and 72MHz are currently supported. */ #if !defined(STM32_SYSCLK) || defined(__DOXYGEN__) #define STM32_SYSCLK 72 diff --git a/os/hal/platforms/STM32/pal_lld.c b/os/hal/platforms/STM32/pal_lld.c index 7e81ea1ae..f39b64498 100644 --- a/os/hal/platforms/STM32/pal_lld.c +++ b/os/hal/platforms/STM32/pal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -84,12 +84,12 @@ void _pal_lld_init(const STM32GPIOConfig *config) { /* - * Enables the GPIO related clocks. + * Enables the GPIO related clocks. */ RCC->APB2ENR |= APB2_EN_MASK; /* - * Resets the GPIO ports and AFIO. + * Resets the GPIO ports and AFIO. */ RCC->APB2RSTR = APB2_RST_MASK; RCC->APB2RSTR = 0; diff --git a/os/hal/platforms/STM32/pal_lld.h b/os/hal/platforms/STM32/pal_lld.h index 7b052ae3f..6b526916c 100644 --- a/os/hal/platforms/STM32/pal_lld.h +++ b/os/hal/platforms/STM32/pal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -84,7 +84,7 @@ typedef struct { } STM32GPIOConfig; /** - * @brief Width, in bits, of an I/O port. + * @brief Width, in bits, of an I/O port. */ #define PAL_IOPORTS_WIDTH 16 @@ -95,7 +95,7 @@ typedef struct { #define PAL_WHOLE_PORT ((ioportmask_t)0xFFFF) /** - * @brief Digital I/O port sized unsigned type. + * @brief Digital I/O port sized unsigned type. */ typedef uint32_t ioportmask_t; @@ -103,7 +103,7 @@ typedef uint32_t ioportmask_t; * @brief Port Identifier. * @details This type can be a scalar or some kind of pointer, do not make * any assumption about it, use the provided macros when populating - * variables of this type. + * variables of this type. */ typedef GPIO_TypeDef * ioportid_t; diff --git a/os/hal/platforms/STM32/platform.dox b/os/hal/platforms/STM32/platform.dox index 6cf743df8..0eae343e2 100644 --- a/os/hal/platforms/STM32/platform.dox +++ b/os/hal/platforms/STM32/platform.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/STM32/pwm_lld.c b/os/hal/platforms/STM32/pwm_lld.c index e5c20f12f..7e39964c3 100644 --- a/os/hal/platforms/STM32/pwm_lld.c +++ b/os/hal/platforms/STM32/pwm_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -74,7 +74,7 @@ PWMDriver PWMD4; /*===========================================================================*/ /** - * @brief Stops all channels. + * @brief Stops all channels. * * @param[in] pwmp pointer to a @p PWMDriver object */ @@ -92,7 +92,7 @@ static void stop_channels(PWMDriver *pwmp) { #if USE_STM32_PWM2 || USE_STM32_PWM3 || USE_STM32_PWM4 || defined(__DOXYGEN__) /** - * @brief Common TIM2...TIM4 IRQ handler. + * @brief Common TIM2...TIM4 IRQ handler. * @note It is assumed that the various sources are only activated if the * associated callback pointer is not equal to @p NULL in order to not * perform an extra check in a potentially critical interrupt handler. @@ -401,7 +401,7 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, pwmcnt_t width) { /* - * Changes the pulse width. + * Changes the pulse width. */ switch (channel) { case 0: @@ -419,7 +419,7 @@ void pwm_lld_enable_channel(PWMDriver *pwmp, } if ((pwmp->pd_enabled_channels & (1 << channel)) == 0) { /* - * The channel is not enabled yet. + * The channel is not enabled yet. */ pwmp->pd_enabled_channels |= (1 << channel); /* diff --git a/os/hal/platforms/STM32/pwm_lld.h b/os/hal/platforms/STM32/pwm_lld.h index 7b3f5366f..3a772d023 100644 --- a/os/hal/platforms/STM32/pwm_lld.h +++ b/os/hal/platforms/STM32/pwm_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -34,7 +34,7 @@ /*===========================================================================*/ /** - * @brief Number of PWM channels per PWM driver. + * @brief Number of PWM channels per PWM driver. */ #define PWM_CHANNELS 4 @@ -123,12 +123,12 @@ /*===========================================================================*/ /** - * @brief PWM channel type. + * @brief PWM channel type. */ typedef uint8_t pwmchannel_t; /** - * @brief PWM counter type. + * @brief PWM counter type. */ typedef uint16_t pwmcnt_t; @@ -195,11 +195,11 @@ typedef struct { const PWMConfig *pd_config; /* End of the mandatory fields.*/ /** - * @brief Bit mask of the enabled channels. + * @brief Bit mask of the enabled channels. */ uint32_t pd_enabled_channels; /** - * @brief Pointer to the TIMx registers block. + * @brief Pointer to the TIMx registers block. */ TIM_TypeDef *pd_tim; } PWMDriver; diff --git a/os/hal/platforms/STM32/serial_lld.c b/os/hal/platforms/STM32/serial_lld.c index 92ee6609e..33ccd44c1 100644 --- a/os/hal/platforms/STM32/serial_lld.c +++ b/os/hal/platforms/STM32/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -281,7 +281,7 @@ CH_IRQ_HANDLER(Vector114) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/STM32/serial_lld.h b/os/hal/platforms/STM32/serial_lld.h index a12dfe2d9..eb6764bb5 100644 --- a/os/hal/platforms/STM32/serial_lld.h +++ b/os/hal/platforms/STM32/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -150,11 +150,11 @@ typedef uint32_t sdflags_t; */ typedef struct { /** - * @brief Bit rate. + * @brief Bit rate. */ uint32_t sc_speed; /** - * @brief Initialization value for the CR1 register. + * @brief Initialization value for the CR1 register. */ uint16_t sc_cr1; /** diff --git a/os/hal/platforms/STM32/spi_lld.c b/os/hal/platforms/STM32/spi_lld.c index ef3acf4f0..ee3bd6197 100644 --- a/os/hal/platforms/STM32/spi_lld.c +++ b/os/hal/platforms/STM32/spi_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -108,7 +108,7 @@ static void spi_start_wait(SPIDriver *spip, size_t n, #if USE_STM32_SPI1 || defined(__DOXYGEN__) /** - * @brief SPI1 RX DMA interrupt handler (channel 2). + * @brief SPI1 RX DMA interrupt handler (channel 2). */ CH_IRQ_HANDLER(Vector70) { @@ -177,7 +177,7 @@ CH_IRQ_HANDLER(Vector7C) { /*===========================================================================*/ /** - * @brief Low level SPI driver initialization. + * @brief Low level SPI driver initialization. */ void spi_lld_init(void) { diff --git a/os/hal/platforms/STM32/spi_lld.h b/os/hal/platforms/STM32/spi_lld.h index 46ea4b559..3be86365c 100644 --- a/os/hal/platforms/STM32/spi_lld.h +++ b/os/hal/platforms/STM32/spi_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -59,7 +59,7 @@ * @brief SPI1 DMA priority (0..3|lowest..highest). * @note The priority level is used for both the TX and RX DMA channels but * because of the channels ordering the RX channel has always priority - * over the TX channel. + * over the TX channel. */ #if !defined(SPI1_DMA_PRIORITY) || defined(__DOXYGEN__) #define STM32_SPI1_DMA_PRIORITY 2 @@ -118,15 +118,15 @@ /*===========================================================================*/ /** - * @brief Driver configuration structure. + * @brief Driver configuration structure. */ typedef struct { /** - * @brief The chip select line port. + * @brief The chip select line port. */ ioportid_t spc_ssport; /** - * @brief The chip select line pad number. + * @brief The chip select line pad number. */ uint16_t spc_sspad; /** @@ -140,7 +140,7 @@ typedef struct { */ typedef struct { /** - * @brief Driver state. + * @brief Driver state. */ spistate_t spd_state; #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) @@ -159,11 +159,11 @@ typedef struct { const SPIConfig *spd_config; /* End of the mandatory fields.*/ /** - * @brief Thread waiting for I/O completion. + * @brief Thread waiting for I/O completion. */ Thread *spd_thread; /** - * @brief Pointer to the SPIx registers block. + * @brief Pointer to the SPIx registers block. */ SPI_TypeDef *spd_spi; /** @@ -175,7 +175,7 @@ typedef struct { */ DMA_Channel_TypeDef *spd_dmatx; /** - * @brief DMA priority bit mask. + * @brief DMA priority bit mask. */ uint32_t spd_dmaprio; } SPIDriver; diff --git a/os/hal/platforms/STM32/stm32_dma.c b/os/hal/platforms/STM32/stm32_dma.c index befd9781d..76f325c49 100644 --- a/os/hal/platforms/STM32/stm32_dma.c +++ b/os/hal/platforms/STM32/stm32_dma.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -53,7 +53,7 @@ static cnt_t dmacnt2; /*===========================================================================*/ /** - * @brief STM32 DMA helper initialization. + * @brief STM32 DMA helper initialization. */ void dmaInit(void) { @@ -65,8 +65,8 @@ void dmaInit(void) { /** * @brief Enables the specified DMA controller clock. - * - * @param[in] dma the DMA controller id + * + * @param[in] dma the DMA controller id */ void dmaEnable(uint32_t dma) { diff --git a/os/hal/platforms/STM32/stm32_dma.h b/os/hal/platforms/STM32/stm32_dma.h index 87126538b..1dcb56d24 100644 --- a/os/hal/platforms/STM32/stm32_dma.h +++ b/os/hal/platforms/STM32/stm32_dma.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Win32/console.c b/os/hal/platforms/Win32/console.c index 20443dcaf..737cf92bf 100644 --- a/os/hal/platforms/Win32/console.c +++ b/os/hal/platforms/Win32/console.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -33,7 +33,7 @@ /*===========================================================================*/ /** - * @brief Console driver 1. + * @brief Console driver 1. */ BaseChannel CD1; diff --git a/os/hal/platforms/Win32/console.h b/os/hal/platforms/Win32/console.h index d6f6cc9c4..3a30e6295 100644 --- a/os/hal/platforms/Win32/console.h +++ b/os/hal/platforms/Win32/console.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Win32/hal_lld.c b/os/hal/platforms/Win32/hal_lld.c index f0446186e..a38d356d8 100644 --- a/os/hal/platforms/Win32/hal_lld.c +++ b/os/hal/platforms/Win32/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Win32/hal_lld.h b/os/hal/platforms/Win32/hal_lld.h index 16a861c58..8632508a1 100644 --- a/os/hal/platforms/Win32/hal_lld.h +++ b/os/hal/platforms/Win32/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/platforms/Win32/serial_lld.c b/os/hal/platforms/Win32/serial_lld.c index b22dcbad3..098f1dc93 100644 --- a/os/hal/platforms/Win32/serial_lld.c +++ b/os/hal/platforms/Win32/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -196,7 +196,7 @@ static bool_t outint(SerialDriver *sdp) { /*===========================================================================*/ /** - * Low level serial driver initialization. + * Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/platforms/Win32/serial_lld.h b/os/hal/platforms/Win32/serial_lld.h index 6f9f0150e..fc1e21b36 100644 --- a/os/hal/platforms/Win32/serial_lld.h +++ b/os/hal/platforms/Win32/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -61,7 +61,7 @@ #endif /** - * @brief Listen port for SD1. + * @brief Listen port for SD1. */ #if !defined(SD1_PORT) || defined(__DOXYGEN__) #define SD1_PORT 29001 diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c index dff7d828b..2a329d003 100644 --- a/os/hal/src/adc.c +++ b/os/hal/src/adc.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -126,10 +126,10 @@ void adcStop(ADCDriver *adcp) { * @note The buffer is organized as a matrix of M*N elements where M is the * channels number configured into the conversion group and N is the * buffer depth. The samples are sequentially written into the buffer - * with no gaps. - * - * @param[in] adcp pointer to the @p ADCDriver object - * @param[in] grpp pointer to a @p ADCConversionGroup object + * with no gaps. + * + * @param[in] adcp pointer to the @p ADCDriver object + * @param[in] grpp pointer to a @p ADCConversionGroup object * @param[out] samples pointer to the samples buffer * @param[in] depth buffer depth (matrix rows number). The buffer depth * must be one or an even number. @@ -170,8 +170,8 @@ bool_t adcStartConversion(ADCDriver *adcp, /** * @brief Stops an ongoing conversion. - * - * @param[in] adcp pointer to the @p ADCDriver object + * + * @param[in] adcp pointer to the @p ADCDriver object */ void adcStopConversion(ADCDriver *adcp) { @@ -199,7 +199,7 @@ void adcStopConversion(ADCDriver *adcp) { * @brief Waits for completion. * @details If the conversion is not completed or not yet started then the * invoking thread waits for a conversion completion event. - * + * * @param[in] adcp pointer to the @p ADCDriver object * @param[in] timeout the number of ticks before the operation timeouts, * the following special values are allowed: @@ -208,7 +208,7 @@ void adcStopConversion(ADCDriver *adcp) { * . * @return The operation result. * @retval RDY_OK conversion finished. - * @retval RDY_TIMEOUT conversion not finished within the specified time. + * @retval RDY_TIMEOUT conversion not finished within the specified time. */ msg_t adcWaitConversion(ADCDriver *adcp, systime_t timeout) { diff --git a/os/hal/src/can.c b/os/hal/src/can.c index a4da35b8e..7bb91173f 100644 --- a/os/hal/src/can.c +++ b/os/hal/src/can.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -128,9 +128,9 @@ void canStop(CANDriver *canp) { * @details The specified frame is queued for transmission, if the hardware * queue is full then the invoking thread is queued. * @note Trying to transmit while in sleep mode simply enqueues the thread. - * - * @param[in] canp pointer to the @p CANDriver object - * @param[in] ctfp pointer to the CAN frame to be transmitted + * + * @param[in] canp pointer to the @p CANDriver object + * @param[in] ctfp pointer to the CAN frame to be transmitted * @param[in] timeout the number of ticks before the operation timeouts, * the following special values are allowed: * - @a TIME_IMMEDIATE immediate timeout. @@ -203,7 +203,7 @@ msg_t canReceive(CANDriver *canp, CANRxFrame *crfp, systime_t timeout) { } /** - * @brief Returns the current status mask and clears it. + * @brief Returns the current status mask and clears it. * * @param[in] canp pointer to the @p CANDriver object * @return The status flags mask. @@ -220,7 +220,7 @@ canstatus_t canGetAndClearFlags(CANDriver *canp) { #if CAN_USE_SLEEP_MODE || defined(__DOXYGEN__) /** - * @brief Enters the sleep mode. + * @brief Enters the sleep mode. * * @param[in] canp pointer to the @p CANDriver object */ @@ -244,7 +244,7 @@ void canSleep(CANDriver *canp) { /** * @brief Enforces leaving the sleep mode. * @note The sleep mode is supposed to be usually exited automatically by - * an hardware event. + * an hardware event. * * @param[in] canp pointer to the @p CANDriver object */ diff --git a/os/hal/src/hal.c b/os/hal/src/hal.c index f93f036c6..d7e963f74 100644 --- a/os/hal/src/hal.c +++ b/os/hal/src/hal.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -45,7 +45,7 @@ /*===========================================================================*/ /** - * @brief HAL initialization. + * @brief HAL initialization. */ void halInit(void) { diff --git a/os/hal/src/mac.c b/os/hal/src/mac.c index 74e08bdf4..a079556fe 100644 --- a/os/hal/src/mac.c +++ b/os/hal/src/mac.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -51,7 +51,7 @@ /*===========================================================================*/ /** - * @brief MAC Driver initialization. + * @brief MAC Driver initialization. */ void macInit(void) { @@ -59,7 +59,7 @@ void macInit(void) { } /** - * @brief Initialize the standard part of a @p MACDriver structure. + * @brief Initialize the standard part of a @p MACDriver structure. * * @param[in] macp pointer to the @p MACDriver object */ @@ -75,9 +75,9 @@ void macObjectInit(MACDriver *macp) { /** * @brief MAC address setup. * @note This function must be invoked only with the driver in the stopped - * state. If invoked on an active interface then it is ignored. + * state. If invoked on an active interface then it is ignored. * - * @param[in] macp pointer to the @p MACDriver object + * @param[in] macp pointer to the @p MACDriver object * @param[in] p pointer to a six bytes buffer containing the MAC * address. If this parameter is set to @p NULL then MAC * a system default is used. @@ -93,7 +93,7 @@ void macSetAddress(MACDriver *macp, const uint8_t *p) { * @details One of the available transmission descriptors is locked and * returned. If a descriptor is not currently available then the * invoking thread is queued until one is freed. - * + * * @param[in] macp pointer to the @p MACDriver object * @param[out] tdp pointer to a @p MACTransmitDescriptor structure * @param[in] time the number of ticks before the operation timeouts, @@ -103,7 +103,7 @@ void macSetAddress(MACDriver *macp, const uint8_t *p) { * . * @return The operation status. * @retval RDY_OK the descriptor was obtained. - * @retval RDY_TIMEOUT the operation timed out, descriptor not initialized. + * @retval RDY_TIMEOUT the operation timed out, descriptor not initialized. */ msg_t macWaitTransmitDescriptor(MACDriver *macp, MACTransmitDescriptor *tdp, @@ -126,8 +126,8 @@ msg_t macWaitTransmitDescriptor(MACDriver *macp, /** * @brief Releases a transmit descriptor and starts the transmission of the * enqueued data as a single frame. - * - * @param[in] tdp the pointer to the @p MACTransmitDescriptor structure + * + * @param[in] tdp the pointer to the @p MACTransmitDescriptor structure */ void macReleaseTransmitDescriptor(MACTransmitDescriptor *tdp) { @@ -183,11 +183,11 @@ void macReleaseReceiveDescriptor(MACReceiveDescriptor *rdp) { /** * @brief Updates and returns the link status. - * + * * @param[in] macp pointer to the @p MACDriver object * @return The link status. * @retval TRUE if the link is active. - * @retval FALSE if the link is down. + * @retval FALSE if the link is down. */ bool_t macPollLinkStatus(MACDriver *macp) { diff --git a/os/hal/src/mmc_spi.c b/os/hal/src/mmc_spi.c index c1cb313ec..6fb7a8332 100644 --- a/os/hal/src/mmc_spi.c +++ b/os/hal/src/mmc_spi.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -45,7 +45,7 @@ /** * @brief Inserion monitor timer callback function. * - * @param[in] p pointer to the @p MMCDriver object + * @param[in] p pointer to the @p MMCDriver object */ void tmrfunc(void *p) { MMCDriver *mmcp = p; @@ -72,7 +72,7 @@ void tmrfunc(void *p) { /** * @brief Waits an idle condition. - * + * * @param[in] mmcp pointer to the @p MMCDriver object */ static void wait(MMCDriver *mmcp) { @@ -98,10 +98,10 @@ static void wait(MMCDriver *mmcp) { /** * @brief Sends a command header. - * + * * @param[in] mmcp pointer to the @p MMCDriver object - * @param cmd[in] the command id - * @param arg[in] the command argument + * @param cmd[in] the command id + * @param arg[in] the command argument */ static void send_hdr(MMCDriver *mmcp, uint8_t cmd, uint32_t arg) { uint8_t buf[6]; @@ -120,10 +120,10 @@ static void send_hdr(MMCDriver *mmcp, uint8_t cmd, uint32_t arg) { /** * @brief Receives a single byte response. - * + * * @param[in] mmcp pointer to the @p MMCDriver object * @return The response as an @p uint8_t value. - * @retval 0xFF timed out. + * @retval 0xFF timed out. */ static uint8_t recvr1(MMCDriver *mmcp) { int i; @@ -139,7 +139,7 @@ static uint8_t recvr1(MMCDriver *mmcp) { /** * @brief Sends a command an returns a single byte response. - * + * * @param[in] mmcp pointer to the @p MMCDriver object * @param cmd[in] the command id * @param arg[in] the command argument @@ -157,7 +157,7 @@ static uint8_t send_command(MMCDriver *mmcp, uint8_t cmd, uint32_t arg) { } /** - * @brief Waits that the card reaches an idle state. + * @brief Waits that the card reaches an idle state. * * @param[in] mmcp pointer to the @p MMCDriver object */ @@ -335,7 +335,7 @@ bool_t mmcConnect(MMCDriver *mmcp) { /** * @brief Brings the driver in a state safe for card removal. - * + * * @param[in] mmcp pointer to the @p MMCDriver object * @return The operation status. * @retval FALSE the operation was successful and the driver is now @@ -367,9 +367,9 @@ bool_t mmcDisconnect(MMCDriver *mmcp) { /** * @brief Starts a sequential read. - * + * * @param[in] mmcp pointer to the @p MMCDriver object - * @param[in] startblk first block to read + * @param[in] startblk first block to read * @return The operation status. * @retval FALSE the operation was successful. * @retval TRUE the operation failed. @@ -401,7 +401,7 @@ bool_t mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk) { /** * @brief Reads a block within a sequential read operation. - * + * * @param[in] mmcp pointer to the @p MMCDriver object * @param[out] buffer pointer to the read buffer * @return The operation status. @@ -440,7 +440,7 @@ bool_t mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer) { /** * @brief Stops a sequential read gracefully. - * + * * @param[in] mmcp pointer to the @p MMCDriver object * @return The operation status. * @retval FALSE the operation was successful. diff --git a/os/hal/src/pal.c b/os/hal/src/pal.c index cc898d2fd..eef5c32ff 100644 --- a/os/hal/src/pal.c +++ b/os/hal/src/pal.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -99,7 +99,7 @@ void palWriteBus(IOBus *bus, ioportmask_t bits) { * @note The default implementation is non atomic and not necessarily * optimal. Low level drivers may optimize the function by using * specific hardware or coding. - * + * * @param[in] bus the I/O bus, pointer to a @p IOBus structure * @param[in] mode the mode */ diff --git a/os/hal/src/pwm.c b/os/hal/src/pwm.c index ddfb6dd83..3aeec1309 100644 --- a/os/hal/src/pwm.c +++ b/os/hal/src/pwm.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -104,10 +104,10 @@ void pwmStop(PWMDriver *pwmp) { /** * @brief Enables a PWM channel. - * + * * @param[in] pwmp pointer to a @p PWMDriver object - * @param[in] channel PWM channel identifier - * @param[in] width PWM pulse width as clock pulses number + * @param[in] channel PWM channel identifier + * @param[in] width PWM pulse width as clock pulses number */ void pwmEnableChannel(PWMDriver *pwmp, pwmchannel_t channel, @@ -127,7 +127,7 @@ void pwmEnableChannel(PWMDriver *pwmp, * @brief Disables a PWM channel. * @details The channel is disabled and its output line returned to the * idle state. - * + * * @param[in] pwmp pointer to a @p PWMDriver object * @param[in] channel PWM channel identifier */ diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index 851f16ffb..52a1772c8 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/src/spi.c b/os/hal/src/spi.c index 611a454a7..29e69a283 100644 --- a/os/hal/src/spi.c +++ b/os/hal/src/spi.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -110,7 +110,7 @@ void spiStop(SPIDriver *spip) { /** * @brief Asserts the slave select signal and prepares for transfers. - * + * * @param[in] spip pointer to the @p SPIDriver object */ void spiSelect(SPIDriver *spip) { @@ -130,7 +130,7 @@ void spiSelect(SPIDriver *spip) { /** * @brief Deasserts the slave select signal. * @details The previously selected peripheral is unselected. - * + * * @param[in] spip pointer to the @p SPIDriver object */ void spiUnselect(SPIDriver *spip) { @@ -152,7 +152,7 @@ void spiUnselect(SPIDriver *spip) { * @details This function transmits a series of idle words on the SPI bus and * ignores the received data. This function can be invoked even * when a slave select signal has not been yet asserted. - * + * * @param[in] spip pointer to the @p SPIDriver object * @param[in] n number of words to be ignored */ @@ -171,9 +171,9 @@ void spiIgnore(SPIDriver *spip, size_t n) { * @details This function performs a simultaneous transmit/receive operation. * @note The buffers are organized as uint8_t arrays for data sizes below * or equal to 8 bits else it is organized as uint16_t arrays. - * + * * @param[in] spip pointer to the @p SPIDriver object - * @param[in] n number of words to be exchanged + * @param[in] n number of words to be exchanged * @param[in] txbuf the pointer to the transmit buffer * @param[out] rxbuf the pointer to the receive buffer */ diff --git a/os/hal/templates/adc_lld.c b/os/hal/templates/adc_lld.c index b0b6d4451..ffe67bc0f 100644 --- a/os/hal/templates/adc_lld.c +++ b/os/hal/templates/adc_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h index e4ed953b9..a36fc205f 100644 --- a/os/hal/templates/adc_lld.h +++ b/os/hal/templates/adc_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -51,7 +51,7 @@ /*===========================================================================*/ /** - * @brief ADC sample data type. + * @brief ADC sample data type. */ typedef uint16_t adcsample_t; @@ -64,14 +64,14 @@ typedef uint16_t adc_channels_num_t; * @brief ADC notification callback type. * * @param[in] buffer pointer to the most recent samples data - * @param[in] n number of buffer rows available starting from @p buffer + * @param[in] n number of buffer rows available starting from @p buffer */ typedef void (*adccallback_t)(adcsample_t *buffer, size_t n); /** * @brief Conversion group configuration structure. * @details This implementation-dependent structure describes a conversion - * operation. + * operation. */ typedef struct { /** @@ -79,7 +79,7 @@ typedef struct { */ bool_t acg_circular; /** - * @brief Number of the analog channels belonging to the conversion group. + * @brief Number of the analog channels belonging to the conversion group. */ adc_channels_num_t acg_num_channels; /* End of the mandatory fields.*/ diff --git a/os/hal/templates/can_lld.c b/os/hal/templates/can_lld.c index 3d3897e3d..65190276d 100644 --- a/os/hal/templates/can_lld.c +++ b/os/hal/templates/can_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -82,11 +82,11 @@ void can_lld_stop(CANDriver *canp) { /** * @brief Determines whether a frame can be transmitted. - * + * * @param[in] canp pointer to the @p CANDriver object * @return The queue space availability. * @retval FALSE no space in the transmit queue. - * @retval TRUE transmit slot available. + * @retval TRUE transmit slot available. */ bool_t can_lld_can_transmit(CANDriver *canp) { diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 3543e039d..3049d8a94 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -36,7 +36,7 @@ /** * @brief This switch defines whether the driver implementation supports - * a low power switch mode with automatic an wakeup feature. + * a low power switch mode with automatic an wakeup feature. */ #define CAN_SUPPORTS_SLEEP TRUE @@ -47,7 +47,7 @@ /** * @brief Sleep mode related APIs inclusion switch. * @note This switch is enforced to @p FALSE if the driver implementation - * does not support the sleep mode. + * does not support the sleep mode. */ #if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) diff --git a/os/hal/templates/hal_lld.c b/os/hal/templates/hal_lld.c index 56dc1b88e..8674d4f38 100644 --- a/os/hal/templates/hal_lld.c +++ b/os/hal/templates/hal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/hal_lld.h b/os/hal/templates/hal_lld.h index c5393b522..dc8b3f143 100644 --- a/os/hal/templates/hal_lld.h +++ b/os/hal/templates/hal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -33,7 +33,7 @@ /*===========================================================================*/ /** - * @brief Platform name. + * @brief Platform name. */ #define PLATFORM_NAME "" diff --git a/os/hal/templates/halconf.h b/os/hal/templates/halconf.h index dae0c2c76..f58ca677b 100644 --- a/os/hal/templates/halconf.h +++ b/os/hal/templates/halconf.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -29,7 +29,7 @@ */ /* - * + * */ #ifndef _HALCONF_H_ @@ -38,7 +38,7 @@ /* * Uncomment the following line in order to include a mcu-related * settings file. This file can be used to include platform specific - * header files or to override the low level drivers settings. + * header files or to override the low level drivers settings. */ /*#include "mcuconf.h"*/ @@ -47,7 +47,7 @@ /*===========================================================================*/ /** - * @brief Enables the PAL subsystem. + * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) #define CH_HAL_USE_PAL TRUE @@ -131,7 +131,7 @@ #endif /* - * Default SPI settings overrides (uncomment to override). + * Default SPI settings overrides (uncomment to override). */ /*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ diff --git a/os/hal/templates/mac_lld.c b/os/hal/templates/mac_lld.c index b71d11330..bfe21d65a 100644 --- a/os/hal/templates/mac_lld.c +++ b/os/hal/templates/mac_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -51,7 +51,7 @@ /*===========================================================================*/ /** - * @brief Low level MAC initialization. + * @brief Low level MAC initialization. */ void mac_lld_init(void) { diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h index 05d943084..37b6d0ae9 100644 --- a/os/hal/templates/mac_lld.h +++ b/os/hal/templates/mac_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -53,7 +53,7 @@ #endif /** - * @brief Maximum supported frame size. + * @brief Maximum supported frame size. */ #if !defined(MAC_BUFFERS_SIZE) || defined(__DOXYGEN__) #define MAC_BUFFERS_SIZE 1518 diff --git a/os/hal/templates/meta/driver.c b/os/hal/templates/meta/driver.c index e4d6e5748..d688f3626 100644 --- a/os/hal/templates/meta/driver.c +++ b/os/hal/templates/meta/driver.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/meta/driver.h b/os/hal/templates/meta/driver.h index 762e54c7c..b3aeb3b0a 100644 --- a/os/hal/templates/meta/driver.h +++ b/os/hal/templates/meta/driver.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/meta/driver_lld.c b/os/hal/templates/meta/driver_lld.c index 787ac388d..5d6253339 100644 --- a/os/hal/templates/meta/driver_lld.c +++ b/os/hal/templates/meta/driver_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/meta/driver_lld.h b/os/hal/templates/meta/driver_lld.h index 409523cfb..967da13a7 100644 --- a/os/hal/templates/meta/driver_lld.h +++ b/os/hal/templates/meta/driver_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/pal_lld.c b/os/hal/templates/pal_lld.c index 3b5f597d0..9a2abb6b2 100644 --- a/os/hal/templates/pal_lld.c +++ b/os/hal/templates/pal_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h index 8b8dd9202..b71b9d96e 100644 --- a/os/hal/templates/pal_lld.h +++ b/os/hal/templates/pal_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -58,18 +58,18 @@ typedef struct { } GenericConfig; /** - * @brief Width, in bits, of an I/O port. + * @brief Width, in bits, of an I/O port. */ #define PAL_IOPORTS_WIDTH 32 /** * @brief Whole port mask. - * @brief This macro specifies all the valid bits into a port. + * @brief This macro specifies all the valid bits into a port. */ #define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFF) /** - * @brief Digital I/O port sized unsigned type. + * @brief Digital I/O port sized unsigned type. */ typedef uint32_t ioportmask_t; @@ -77,7 +77,7 @@ typedef uint32_t ioportmask_t; * @brief Port Identifier. * @details This type can be a scalar or some kind of pointer, do not make * any assumption about it, use the provided macros when populating - * variables of this type. + * variables of this type. */ typedef uint32_t ioportid_t; @@ -227,7 +227,7 @@ typedef uint32_t ioportid_t; * @note The @ref PAL provides a default software implementation of this * functionality, implement this function if can optimize it by using * special hardware functionalities or special coding. - * + * * @param[in] port port identifier * @param[in] pad pad number within the port * @return The logical state. diff --git a/os/hal/templates/pwm_lld.c b/os/hal/templates/pwm_lld.c index 809a90608..c37db97ea 100644 --- a/os/hal/templates/pwm_lld.c +++ b/os/hal/templates/pwm_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h index 83c075510..76a691a55 100644 --- a/os/hal/templates/pwm_lld.h +++ b/os/hal/templates/pwm_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -37,7 +37,7 @@ /*===========================================================================*/ /** - * @brief Number of PWM channels per PWM driver. + * @brief Number of PWM channels per PWM driver. */ #if !defined(PWM_CHANNELS) || defined(__DOXYGEN__) #define PWM_CHANNELS 1 @@ -52,12 +52,12 @@ /*===========================================================================*/ /** - * @brief PWM channel type. + * @brief PWM channel type. */ typedef uint8_t pwmchannel_t; /** - * @brief PWM counter type. + * @brief PWM counter type. */ typedef uint16_t pwmcnt_t; diff --git a/os/hal/templates/serial_lld.c b/os/hal/templates/serial_lld.c index 7fbe7f9d1..52e1881e7 100644 --- a/os/hal/templates/serial_lld.c +++ b/os/hal/templates/serial_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -57,7 +57,7 @@ static const SerialConfig default_config = { /*===========================================================================*/ /** - * @brief Low level serial driver initialization. + * @brief Low level serial driver initialization. */ void sd_lld_init(void) { diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h index a9dbb3c1a..72a0063be 100644 --- a/os/hal/templates/serial_lld.h +++ b/os/hal/templates/serial_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c index 83862dd0a..769e13b51 100644 --- a/os/hal/templates/spi_lld.c +++ b/os/hal/templates/spi_lld.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -51,7 +51,7 @@ /*===========================================================================*/ /** - * @brief Low level SPI driver initialization. + * @brief Low level SPI driver initialization. */ void spi_lld_init(void) { diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h index f5046f147..11409d9eb 100644 --- a/os/hal/templates/spi_lld.h +++ b/os/hal/templates/spi_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -47,7 +47,7 @@ /*===========================================================================*/ /** - * @brief Driver configuration structure. + * @brief Driver configuration structure. */ typedef struct { @@ -58,7 +58,7 @@ typedef struct { */ typedef struct { /** - * @brief Driver state. + * @brief Driver state. */ spistate_t spd_state; #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) diff --git a/os/kernel/include/ch.h b/os/kernel/include/ch.h index a0b2ca6fd..8f3f07e21 100644 --- a/os/kernel/include/ch.h +++ b/os/kernel/include/ch.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -31,27 +31,27 @@ #define _CH_H_ /** - * @brief ChibiOS/RT identification macro. + * @brief ChibiOS/RT identification macro. */ #define _CHIBIOS_RT_ /** - * @brief Kernel version string. + * @brief Kernel version string. */ #define CH_KERNEL_VERSION "1.5.2unstable" /** - * @brief Kernel version major number. + * @brief Kernel version major number. */ #define CH_KERNEL_MAJOR 1 /** - * @brief Kernel version minor number. + * @brief Kernel version minor number. */ #define CH_KERNEL_MINOR 5 /** - * @brief Kernel version patch number. + * @brief Kernel version patch number. */ #define CH_KERNEL_PATCH 2 diff --git a/os/kernel/include/channels.h b/os/kernel/include/channels.h index 7e275af96..06c7cf88a 100644 --- a/os/kernel/include/channels.h +++ b/os/kernel/include/channels.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/condvars.h b/os/kernel/include/condvars.h index be40f7dd3..a84fa3bdb 100644 --- a/os/kernel/include/condvars.h +++ b/os/kernel/include/condvars.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/debug.h b/os/kernel/include/debug.h index b60171866..5cd056a81 100644 --- a/os/kernel/include/debug.h +++ b/os/kernel/include/debug.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/events.h b/os/kernel/include/events.h index 42f415b73..c434eb7ce 100644 --- a/os/kernel/include/events.h +++ b/os/kernel/include/events.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/heap.h b/os/kernel/include/heap.h index 0ebe1d7b5..8be48961a 100644 --- a/os/kernel/include/heap.h +++ b/os/kernel/include/heap.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/inline.h b/os/kernel/include/inline.h index 43f12f2e7..2b160f03f 100644 --- a/os/kernel/include/inline.h +++ b/os/kernel/include/inline.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/lists.h b/os/kernel/include/lists.h index 9240a6fcb..48841c687 100644 --- a/os/kernel/include/lists.h +++ b/os/kernel/include/lists.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -45,7 +45,7 @@ typedef struct Thread Thread; /** * @brief Evaluates to @p TRUE if the specified threads queue or list is - * empty. + * empty. */ #define isempty(p) ((p)->p_next == (Thread *)(p)) diff --git a/os/kernel/include/mailboxes.h b/os/kernel/include/mailboxes.h index 33048229f..d2c71b6d8 100644 --- a/os/kernel/include/mailboxes.h +++ b/os/kernel/include/mailboxes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -102,7 +102,7 @@ extern "C" { * @note A message must be waiting in the queue for this function to work or * it would return garbage. The correct way to use this macro is to * use @p chMBGetFull() and then use this macro, all within a lock - * state. + * state. */ #define chMBPeek(mbp) (*(mbp)->mb_rdptr) diff --git a/os/kernel/include/memcore.h b/os/kernel/include/memcore.h index c0aa9c9a2..381339938 100644 --- a/os/kernel/include/memcore.h +++ b/os/kernel/include/memcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/mempools.h b/os/kernel/include/mempools.h index d6611663a..056ceaae8 100644 --- a/os/kernel/include/mempools.h +++ b/os/kernel/include/mempools.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -31,7 +31,7 @@ #if CH_USE_MEMPOOLS /** - * @brief Memory pool free object header. + * @brief Memory pool free object header. */ struct pool_header { struct pool_header *ph_next; /**< @brief Pointer to the next pool @@ -39,7 +39,7 @@ struct pool_header { }; /** - * @brief Memory pool descriptor. + * @brief Memory pool descriptor. */ typedef struct { struct pool_header *mp_next; /**< @brief Pointer to the header. */ diff --git a/os/kernel/include/messages.h b/os/kernel/include/messages.h index 669b1c8b9..d5e7cb32e 100644 --- a/os/kernel/include/messages.h +++ b/os/kernel/include/messages.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/mutexes.h b/os/kernel/include/mutexes.h index 5bdbcdbd9..a57e8386a 100644 --- a/os/kernel/include/mutexes.h +++ b/os/kernel/include/mutexes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/queues.h b/os/kernel/include/queues.h index 124175133..fb2f13194 100644 --- a/os/kernel/include/queues.h +++ b/os/kernel/include/queues.h @@ -1,242 +1,242 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file queues.h I/O - * @brief Queues macros and structures. - * - * @addtogroup io_queues - * @{ - */ - -#ifndef _QUEUES_H_ -#define _QUEUES_H_ - -#if CH_USE_QUEUES - -/* - * Module dependencies check. - */ -#if !CH_USE_SEMAPHORES -#error "CH_USE_QUEUES requires CH_USE_SEMAPHORES" -#endif - -/** @brief Queue notification callback type.*/ -typedef void (*qnotify_t)(void); - -/** @brief Returned by the queue functions if the operation is successful.*/ -#define Q_OK RDY_OK -/** @brief Returned by the queue functions if a timeout occurs.*/ -#define Q_TIMEOUT RDY_TIMEOUT -/** @brief Returned by the queue functions if the queue is reset.*/ -#define Q_RESET RDY_RESET -/** @brief Returned by the queue functions if the queue is empty.*/ -#define Q_EMPTY -3 -/** @brief Returned by the queue functions if the queue is full.*/ -#define Q_FULL -4 - -/** - * @brief Generic I/O queue structure. - * @details This structure represents a generic Input or Output asymmetrical - * queue. The queue is asymmetrical because one end is meant to be - * accessed from a thread context, and thus can be blocking, the other - * end is accessible from interrupt handlers or from within a kernel - * lock zone (see I-Locked and S-Locked states in - * @ref system_states) and is non-blocking. - */ -typedef struct { - uint8_t *q_buffer; /**< @brief Pointer to the queue buffer.*/ - uint8_t *q_top; /**< @brief Pointer to the first location - after the buffer. */ - uint8_t *q_wrptr; /**< @brief Write pointer. */ - uint8_t *q_rdptr; /**< @brief Read pointer. */ - Semaphore q_sem; /**< @brief Counter @p Semaphore. */ - qnotify_t q_notify; /**< @brief Data notification callback. */ -} GenericQueue; - -/** - * @brief Returns the queue's buffer size. - */ -#define chQSize(q) ((q)->q_top - (q)->q_buffer) - -/** - * @brief Queue space. - * @details Returns the used space if used on an Input Queue and the empty - * space if used on an Output Queue. - * @note The returned value can be less than zero when there are waiting - * threads on the internal semaphore. - */ -#define chQSpace(q) chSemGetCounterI(&(q)->q_sem) - -/** - * @extends GenericQueue - * - * @brief Input queue structure. - * @details This structure represents a generic asymmetrical input queue. - * Writing in the queue is non-blocking and can be performed from - * interrupt handlers or from within a kernel lock zone (see - * I-Locked and S-Locked states in @ref system_states). - * Reading the queue can be a blocking operation and is supposed to - * be performed by a system thread. - */ -typedef GenericQueue InputQueue; - -/** @brief Evaluates to @p TRUE if the specified Input Queue is empty.*/ -#define chIQIsEmpty(q) (chQSpace(q) <= 0) - -/** @brief Evaluates to @p TRUE if the specified Input Queue is full.*/ -#define chIQIsFull(q) (chQSpace(q) >= chQSize(q)) - -/** - * @brief Input queue read. - * @details This function reads a byte value from an input queue. If the queue - * is empty then the calling thread is suspended until a byte arrives - * in the queue. - * - * @param[in] iqp pointer to an @p InputQueue structure - * @return A byte value from the queue or: - * @retval Q_RESET if the queue was reset. - */ -#define chIQGet(iqp) chIQGetTimeout(iqp, TIME_INFINITE) - -/** - * @brief Data part of a static input queue initializer. - * @details This macro should be used when statically initializing an - * input queue that is part of a bigger structure. - * - * @param[in] name the name of the input queue variable - * @param[in] buffer pointer to the queue buffer area - * @param[in] size size of the queue buffer area - * @param[in] inotify input notification callback pointer - */ -#define _INPUTQUEUE_DATA(name, buffer, size, inotify) { \ - (uint8_t *)(buffer), \ - (uint8_t *)(buffer) + size, \ - (uint8_t *)(buffer), \ - (uint8_t *)(buffer), \ - _SEMAPHORE_DATA(name.q_sem, 0), \ - inotify \ -} - -/** - * @brief Static input queue initializer. - * @details Statically initialized input queues require no explicit - * initialization using @p chIQInit(). - * - * @param[in] name the name of the input queue variable - * @param[in] buffer pointer to the queue buffer area - * @param[in] size size of the queue buffer area - * @param[in] inotify input notification callback pointer - */ -#define INPUTQUEUE_DECL(name, buffer, size, inotify) \ - InputQueue name = _INPUTQUEUE_DATA(name, buffer, size, inotify) - -/** - * @extends GenericQueue - * - * @brief Output queue structure. - * @details This structure represents a generic asymmetrical output queue. - * Reading from the queue is non-blocking and can be performed from - * interrupt handlers or from within a kernel lock zone (see - * I-Locked and S-Locked states in @ref system_states). - * Writing the queue can be a blocking operation and is supposed to - * be performed by a system thread. - */ -typedef GenericQueue OutputQueue; - -/** - * @brief Evaluates to @p TRUE if the specified Output Queue is empty. - */ -#define chOQIsEmpty(q) (chQSpace(q) >= chQSize(q)) - -/** - * @brief Evaluates to @p TRUE if the specified Output Queue is full. - */ -#define chOQIsFull(q) (chQSpace(q) <= 0) - -/** - * @brief Output queue write. - * @details This function writes a byte value to an output queue. If the queue - * is full then the calling thread is suspended until there is space - * in the queue. - * - * @param[in] oqp pointer to an @p OutputQueue structure - * @param[in] b the byte value to be written in the queue - * @return The operation status: - * @retval Q_OK if the operation succeeded. - * @retval Q_RESET if the queue was reset. - */ -#define chOQPut(oqp, b) chOQPutTimeout(oqp, b, TIME_INFINITE) - -/** - * @brief Data part of a static output queue initializer. - * @details This macro should be used when statically initializing an - * output queue that is part of a bigger structure. - * - * @param[in] name the name of the output queue variable. - * @param[in] buffer pointer to the queue buffer area - * @param[in] size size of the queue buffer area - * @param[in] onotify output notification callback pointer - */ -#define _OUTPUTQUEUE_DATA(name, buffer, size, onotify) { \ - (uint8_t *)(buffer), \ - (uint8_t *)(buffer) + size, \ - (uint8_t *)(buffer), \ - (uint8_t *)(buffer), \ - _SEMAPHORE_DATA(name.q_sem, size), \ - onotify \ -} - -/** - * @brief Static output queue initializer. - * @details Statically initialized output queues require no explicit - * initialization using @p chOQInit(). - * - * @param[in] name the name of the output queue variable - * @param[in] buffer pointer to the queue buffer area - * @param[in] size size of the queue buffer area - * @param[in] onotify output notification callback pointer - */ -#define OUTPUTQUEUE_DECL(name, buffer, size, onotify) \ - InputQueue name = _OUTPUTQUEUE_DATA(name, buffer, size, onotify) - -#ifdef __cplusplus -extern "C" { -#endif - void chIQInit(InputQueue *qp, uint8_t *bp, size_t size, qnotify_t infy); - void chIQResetI(InputQueue *qp); - msg_t chIQPutI(InputQueue *qp, uint8_t b); - msg_t chIQGetTimeout(InputQueue *qp, systime_t time); - size_t chIQReadTimeout(InputQueue *qp, uint8_t *bp, - size_t n, systime_t time); - - void chOQInit(OutputQueue *queue, uint8_t *bp, size_t size, qnotify_t onfy); - void chOQResetI(OutputQueue *queue); - msg_t chOQPutTimeout(OutputQueue *queue, uint8_t b, systime_t time); - msg_t chOQGetI(OutputQueue *queue); - size_t chOQWriteTimeout(OutputQueue *queue, const uint8_t *bp, - size_t n, systime_t time); -#ifdef __cplusplus -} -#endif -#endif /* CH_USE_QUEUES */ - -#endif /* _QUEUES_H_ */ - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file queues.h I/O + * @brief Queues macros and structures. + * + * @addtogroup io_queues + * @{ + */ + +#ifndef _QUEUES_H_ +#define _QUEUES_H_ + +#if CH_USE_QUEUES + +/* + * Module dependencies check. + */ +#if !CH_USE_SEMAPHORES +#error "CH_USE_QUEUES requires CH_USE_SEMAPHORES" +#endif + +/** @brief Queue notification callback type.*/ +typedef void (*qnotify_t)(void); + +/** @brief Returned by the queue functions if the operation is successful.*/ +#define Q_OK RDY_OK +/** @brief Returned by the queue functions if a timeout occurs.*/ +#define Q_TIMEOUT RDY_TIMEOUT +/** @brief Returned by the queue functions if the queue is reset.*/ +#define Q_RESET RDY_RESET +/** @brief Returned by the queue functions if the queue is empty.*/ +#define Q_EMPTY -3 +/** @brief Returned by the queue functions if the queue is full.*/ +#define Q_FULL -4 + +/** + * @brief Generic I/O queue structure. + * @details This structure represents a generic Input or Output asymmetrical + * queue. The queue is asymmetrical because one end is meant to be + * accessed from a thread context, and thus can be blocking, the other + * end is accessible from interrupt handlers or from within a kernel + * lock zone (see I-Locked and S-Locked states in + * @ref system_states) and is non-blocking. + */ +typedef struct { + uint8_t *q_buffer; /**< @brief Pointer to the queue buffer.*/ + uint8_t *q_top; /**< @brief Pointer to the first location + after the buffer. */ + uint8_t *q_wrptr; /**< @brief Write pointer. */ + uint8_t *q_rdptr; /**< @brief Read pointer. */ + Semaphore q_sem; /**< @brief Counter @p Semaphore. */ + qnotify_t q_notify; /**< @brief Data notification callback. */ +} GenericQueue; + +/** + * @brief Returns the queue's buffer size. + */ +#define chQSize(q) ((q)->q_top - (q)->q_buffer) + +/** + * @brief Queue space. + * @details Returns the used space if used on an Input Queue and the empty + * space if used on an Output Queue. + * @note The returned value can be less than zero when there are waiting + * threads on the internal semaphore. + */ +#define chQSpace(q) chSemGetCounterI(&(q)->q_sem) + +/** + * @extends GenericQueue + * + * @brief Input queue structure. + * @details This structure represents a generic asymmetrical input queue. + * Writing in the queue is non-blocking and can be performed from + * interrupt handlers or from within a kernel lock zone (see + * I-Locked and S-Locked states in @ref system_states). + * Reading the queue can be a blocking operation and is supposed to + * be performed by a system thread. + */ +typedef GenericQueue InputQueue; + +/** @brief Evaluates to @p TRUE if the specified Input Queue is empty.*/ +#define chIQIsEmpty(q) (chQSpace(q) <= 0) + +/** @brief Evaluates to @p TRUE if the specified Input Queue is full.*/ +#define chIQIsFull(q) (chQSpace(q) >= chQSize(q)) + +/** + * @brief Input queue read. + * @details This function reads a byte value from an input queue. If the queue + * is empty then the calling thread is suspended until a byte arrives + * in the queue. + * + * @param[in] iqp pointer to an @p InputQueue structure + * @return A byte value from the queue or: + * @retval Q_RESET if the queue was reset. + */ +#define chIQGet(iqp) chIQGetTimeout(iqp, TIME_INFINITE) + +/** + * @brief Data part of a static input queue initializer. + * @details This macro should be used when statically initializing an + * input queue that is part of a bigger structure. + * + * @param[in] name the name of the input queue variable + * @param[in] buffer pointer to the queue buffer area + * @param[in] size size of the queue buffer area + * @param[in] inotify input notification callback pointer + */ +#define _INPUTQUEUE_DATA(name, buffer, size, inotify) { \ + (uint8_t *)(buffer), \ + (uint8_t *)(buffer) + size, \ + (uint8_t *)(buffer), \ + (uint8_t *)(buffer), \ + _SEMAPHORE_DATA(name.q_sem, 0), \ + inotify \ +} + +/** + * @brief Static input queue initializer. + * @details Statically initialized input queues require no explicit + * initialization using @p chIQInit(). + * + * @param[in] name the name of the input queue variable + * @param[in] buffer pointer to the queue buffer area + * @param[in] size size of the queue buffer area + * @param[in] inotify input notification callback pointer + */ +#define INPUTQUEUE_DECL(name, buffer, size, inotify) \ + InputQueue name = _INPUTQUEUE_DATA(name, buffer, size, inotify) + +/** + * @extends GenericQueue + * + * @brief Output queue structure. + * @details This structure represents a generic asymmetrical output queue. + * Reading from the queue is non-blocking and can be performed from + * interrupt handlers or from within a kernel lock zone (see + * I-Locked and S-Locked states in @ref system_states). + * Writing the queue can be a blocking operation and is supposed to + * be performed by a system thread. + */ +typedef GenericQueue OutputQueue; + +/** + * @brief Evaluates to @p TRUE if the specified Output Queue is empty. + */ +#define chOQIsEmpty(q) (chQSpace(q) >= chQSize(q)) + +/** + * @brief Evaluates to @p TRUE if the specified Output Queue is full. + */ +#define chOQIsFull(q) (chQSpace(q) <= 0) + +/** + * @brief Output queue write. + * @details This function writes a byte value to an output queue. If the queue + * is full then the calling thread is suspended until there is space + * in the queue. + * + * @param[in] oqp pointer to an @p OutputQueue structure + * @param[in] b the byte value to be written in the queue + * @return The operation status: + * @retval Q_OK if the operation succeeded. + * @retval Q_RESET if the queue was reset. + */ +#define chOQPut(oqp, b) chOQPutTimeout(oqp, b, TIME_INFINITE) + +/** + * @brief Data part of a static output queue initializer. + * @details This macro should be used when statically initializing an + * output queue that is part of a bigger structure. + * + * @param[in] name the name of the output queue variable. + * @param[in] buffer pointer to the queue buffer area + * @param[in] size size of the queue buffer area + * @param[in] onotify output notification callback pointer + */ +#define _OUTPUTQUEUE_DATA(name, buffer, size, onotify) { \ + (uint8_t *)(buffer), \ + (uint8_t *)(buffer) + size, \ + (uint8_t *)(buffer), \ + (uint8_t *)(buffer), \ + _SEMAPHORE_DATA(name.q_sem, size), \ + onotify \ +} + +/** + * @brief Static output queue initializer. + * @details Statically initialized output queues require no explicit + * initialization using @p chOQInit(). + * + * @param[in] name the name of the output queue variable + * @param[in] buffer pointer to the queue buffer area + * @param[in] size size of the queue buffer area + * @param[in] onotify output notification callback pointer + */ +#define OUTPUTQUEUE_DECL(name, buffer, size, onotify) \ + InputQueue name = _OUTPUTQUEUE_DATA(name, buffer, size, onotify) + +#ifdef __cplusplus +extern "C" { +#endif + void chIQInit(InputQueue *qp, uint8_t *bp, size_t size, qnotify_t infy); + void chIQResetI(InputQueue *qp); + msg_t chIQPutI(InputQueue *qp, uint8_t b); + msg_t chIQGetTimeout(InputQueue *qp, systime_t time); + size_t chIQReadTimeout(InputQueue *qp, uint8_t *bp, + size_t n, systime_t time); + + void chOQInit(OutputQueue *queue, uint8_t *bp, size_t size, qnotify_t onfy); + void chOQResetI(OutputQueue *queue); + msg_t chOQPutTimeout(OutputQueue *queue, uint8_t b, systime_t time); + msg_t chOQGetI(OutputQueue *queue); + size_t chOQWriteTimeout(OutputQueue *queue, const uint8_t *bp, + size_t n, systime_t time); +#ifdef __cplusplus +} +#endif +#endif /* CH_USE_QUEUES */ + +#endif /* _QUEUES_H_ */ + +/** @} */ diff --git a/os/kernel/include/registry.h b/os/kernel/include/registry.h index afaf3c5f7..2bff903e8 100644 --- a/os/kernel/include/registry.h +++ b/os/kernel/include/registry.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -34,7 +34,7 @@ * @brief Removes a thread from the registry list. * @note This macro is not meant for use in application code. * - * @param[in] tp thread to remove from the registry + * @param[in] tp thread to remove from the registry */ #define REG_REMOVE(tp) { \ (tp)->p_older->p_newer = (tp)->p_newer; \ diff --git a/os/kernel/include/scheduler.h b/os/kernel/include/scheduler.h index e6bc69078..ddb7df979 100644 --- a/os/kernel/include/scheduler.h +++ b/os/kernel/include/scheduler.h @@ -1,134 +1,134 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file scheduler.h - * @brief Scheduler macros and structures. - * - * @addtogroup scheduler - * @{ - */ - -#ifndef _SCHEDULER_H_ -#define _SCHEDULER_H_ - -/** @brief Default thread wakeup low level message.*/ -#define RDY_OK 0 -/** @brief Low level message sent to a thread awakened by a timeout.*/ -#define RDY_TIMEOUT -1 -/** @brief Low level message sent to a thread awakened by a reset operation.*/ -#define RDY_RESET -2 - -#define NOPRIO 0 /**< @brief Ready list header priority. */ -#define IDLEPRIO 1 /**< @brief Idle thread priority. */ -#define LOWPRIO 2 /**< @brief Lowest user priority. */ -#define NORMALPRIO 64 /**< @brief Normal user priority. */ -#define HIGHPRIO 127 /**< @brief Highest user priority. */ -#define ABSPRIO 255 /**< @brief Greatest possible priority. */ - -/** - * @brief Zero time specification for some syscalls with a timeout - * specification. - * @note Not all functions accept @p TIME_IMMEDIATE as timeout parameter, - * see the specific function documentation. - */ -#define TIME_IMMEDIATE ((systime_t)-1) - -/** - * @brief Infinite time specification for all the syscalls with a timeout - * specification. - */ -#define TIME_INFINITE ((systime_t)0) - -/** - * @brief Returns the priority of the first thread on the given ready list. - */ -#define firstprio(rlp) ((rlp)->p_next->p_prio) - -/** - * @extends ThreadsQueue - * - * @brief Ready list header. - */ -typedef struct { - ThreadsQueue r_queue; /**< @brief Threads queue. */ - tprio_t r_prio; /**< @brief This field must be - initialized to zero. */ - struct context p_ctx; /**< @brief Not used, present because - offsets. */ -#if CH_USE_REGISTRY - Thread *p_newer; /**< @brief Newer registry element. */ - Thread *p_older; /**< @brief Older registry element. */ -#endif - /* End of the fields shared with the Thread structure.*/ -#if CH_TIME_QUANTUM > 0 - cnt_t r_preempt; /**< @brief Round robin counter. */ -#endif -#ifndef CH_CURRP_REGISTER_CACHE - Thread *r_current; /**< @brief The currently running - thread. */ -#endif -} ReadyList; - -#if !defined(__DOXYGEN__) -extern ReadyList rlist; -#endif - -#ifdef CH_CURRP_REGISTER_CACHE -register Thread *currp asm(CH_CURRP_REGISTER_CACHE); -#else -#define currp rlist.r_current -#endif - -/* - * Scheduler APIs. - */ -#ifdef __cplusplus -extern "C" { -#endif - void scheduler_init(void); - Thread *chSchReadyI(Thread *tp); - void chSchGoSleepS(tstate_t newstate); - msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time); - void chSchWakeupS(Thread *tp, msg_t msg); - void chSchDoRescheduleI(void); - void chSchRescheduleS(void); - bool_t chSchIsRescRequiredExI(void); - void chSchDoYieldS(void); -#ifdef __cplusplus -} -#endif - -/** - * @brief Determines if yielding is possible. - * @details This function returns @p TRUE if there is a ready thread with - * equal or higher priority. - */ -#define chSchCanYieldS() (firstprio(&rlist.r_queue) >= currp->p_prio) - -/** - * @brief Determines if the current thread must reschedule. - * @details This function returns @p TRUE if there is a ready thread with - * higher priority. - */ -#define chSchIsRescRequiredI() (firstprio(&rlist.r_queue) > currp->p_prio) - -#endif /* _SCHEDULER_H_ */ - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file scheduler.h + * @brief Scheduler macros and structures. + * + * @addtogroup scheduler + * @{ + */ + +#ifndef _SCHEDULER_H_ +#define _SCHEDULER_H_ + +/** @brief Default thread wakeup low level message.*/ +#define RDY_OK 0 +/** @brief Low level message sent to a thread awakened by a timeout.*/ +#define RDY_TIMEOUT -1 +/** @brief Low level message sent to a thread awakened by a reset operation.*/ +#define RDY_RESET -2 + +#define NOPRIO 0 /**< @brief Ready list header priority. */ +#define IDLEPRIO 1 /**< @brief Idle thread priority. */ +#define LOWPRIO 2 /**< @brief Lowest user priority. */ +#define NORMALPRIO 64 /**< @brief Normal user priority. */ +#define HIGHPRIO 127 /**< @brief Highest user priority. */ +#define ABSPRIO 255 /**< @brief Greatest possible priority. */ + +/** + * @brief Zero time specification for some syscalls with a timeout + * specification. + * @note Not all functions accept @p TIME_IMMEDIATE as timeout parameter, + * see the specific function documentation. + */ +#define TIME_IMMEDIATE ((systime_t)-1) + +/** + * @brief Infinite time specification for all the syscalls with a timeout + * specification. + */ +#define TIME_INFINITE ((systime_t)0) + +/** + * @brief Returns the priority of the first thread on the given ready list. + */ +#define firstprio(rlp) ((rlp)->p_next->p_prio) + +/** + * @extends ThreadsQueue + * + * @brief Ready list header. + */ +typedef struct { + ThreadsQueue r_queue; /**< @brief Threads queue. */ + tprio_t r_prio; /**< @brief This field must be + initialized to zero. */ + struct context p_ctx; /**< @brief Not used, present because + offsets. */ +#if CH_USE_REGISTRY + Thread *p_newer; /**< @brief Newer registry element. */ + Thread *p_older; /**< @brief Older registry element. */ +#endif + /* End of the fields shared with the Thread structure.*/ +#if CH_TIME_QUANTUM > 0 + cnt_t r_preempt; /**< @brief Round robin counter. */ +#endif +#ifndef CH_CURRP_REGISTER_CACHE + Thread *r_current; /**< @brief The currently running + thread. */ +#endif +} ReadyList; + +#if !defined(__DOXYGEN__) +extern ReadyList rlist; +#endif + +#ifdef CH_CURRP_REGISTER_CACHE +register Thread *currp asm(CH_CURRP_REGISTER_CACHE); +#else +#define currp rlist.r_current +#endif + +/* + * Scheduler APIs. + */ +#ifdef __cplusplus +extern "C" { +#endif + void scheduler_init(void); + Thread *chSchReadyI(Thread *tp); + void chSchGoSleepS(tstate_t newstate); + msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time); + void chSchWakeupS(Thread *tp, msg_t msg); + void chSchDoRescheduleI(void); + void chSchRescheduleS(void); + bool_t chSchIsRescRequiredExI(void); + void chSchDoYieldS(void); +#ifdef __cplusplus +} +#endif + +/** + * @brief Determines if yielding is possible. + * @details This function returns @p TRUE if there is a ready thread with + * equal or higher priority. + */ +#define chSchCanYieldS() (firstprio(&rlist.r_queue) >= currp->p_prio) + +/** + * @brief Determines if the current thread must reschedule. + * @details This function returns @p TRUE if there is a ready thread with + * higher priority. + */ +#define chSchIsRescRequiredI() (firstprio(&rlist.r_queue) > currp->p_prio) + +#endif /* _SCHEDULER_H_ */ + +/** @} */ diff --git a/os/kernel/include/semaphores.h b/os/kernel/include/semaphores.h index b2fbba65c..cced49601 100644 --- a/os/kernel/include/semaphores.h +++ b/os/kernel/include/semaphores.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -62,7 +62,7 @@ extern "C" { * @brief Data part of a static semaphore initializer. * @details This macro should be used when statically initializing a semaphore * that is part of a bigger structure. - * + * * @param[in] name the name of the semaphore variable * @param[in] n the counter initial value, this value must be * non-negative @@ -76,7 +76,7 @@ extern "C" { * * @param[in] name the name of the semaphore variable * @param[in] n the counter initial value, this value must be - * non-negative + * non-negative */ #define SEMAPHORE_DECL(name, n) Semaphore name = _SEMAPHORE_DATA(name, n) diff --git a/os/kernel/include/streams.h b/os/kernel/include/streams.h index b4f7f4901..fa376546c 100644 --- a/os/kernel/include/streams.h +++ b/os/kernel/include/streams.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/include/sys.h b/os/kernel/include/sys.h index a6409d3bf..5d0b6d875 100644 --- a/os/kernel/include/sys.h +++ b/os/kernel/include/sys.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -154,7 +154,7 @@ #define CH_IRQ_EPILOGUE() PORT_IRQ_EPILOGUE() /** - * @brief Standard IRQ handler declaration. + * @brief Standard IRQ handler declaration. * @note @p id can be a function name or a vector number depending on the * port implementation. */ diff --git a/os/kernel/include/threads.h b/os/kernel/include/threads.h index 253b220fe..9f519fea0 100644 --- a/os/kernel/include/threads.h +++ b/os/kernel/include/threads.h @@ -1,330 +1,330 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file threads.h - * @brief Threads macros and structures. - * - * @addtogroup threads - * @{ - */ - -#ifndef _THREADS_H_ -#define _THREADS_H_ - -/* - * Module dependencies check. - */ -#if CH_USE_DYNAMIC && !CH_USE_WAITEXIT -#error "CH_USE_DYNAMIC requires CH_USE_WAITEXIT" -#endif -#if CH_USE_DYNAMIC && !CH_USE_HEAP && !CH_USE_MEMPOOLS -#error "CH_USE_DYNAMIC requires CH_USE_HEAP and/or CH_USE_MEMPOOLS" -#endif - -/** - * @extends ThreadsQueue - * - * @brief Structure representing a thread. - * @note Not all the listed fields are always needed, by switching off some - * not needed ChibiOS/RT subsystems it is possible to save RAM space - * by shrinking the @p Thread structure. - */ -struct Thread { - Thread *p_next; /**< @brief Next in the list/queue. */ - /* End of the fields shared with the ThreadsList structure. */ - Thread *p_prev; /**< @brief Previous in the queue. */ - /* End of the fields shared with the ThreadsQueue structure. */ - tprio_t p_prio; /**< @brief Thread priority. */ - struct context p_ctx; /**< @brief Processor context. */ -#if CH_USE_REGISTRY - Thread *p_newer; /**< @brief Newer registry element. */ - Thread *p_older; /**< @brief Older registry element. */ -#endif - /* End of the fields shared with the ReadyList structure. */ - /** - * @brief Current thread state. - */ - tstate_t p_state; - /** - * @brief Various thread flags. - */ - tmode_t p_flags; -#if CH_USE_DYNAMIC - /** - * @brief References to this thread. - */ - trefs_t p_refs; -#endif -#if CH_USE_NESTED_LOCKS - /** - * @brief Number of nested locks. - */ - cnt_t p_locks; -#endif -#if CH_DBG_THREADS_PROFILING - /** - * @brief Thread consumed time in ticks. - * @note This field can overflow. - */ - volatile systime_t p_time; -#endif - /** - * @brief State-specific fields. - * @note All the fields declared in this union are only valid in the - * specified state or condition and are thus volatile. - */ - union { - /** - * @brief Thread wakeup code. - * @note This field contains the low level message sent to the thread - * by the waking thread or interrupt handler. The value is valid - * after exiting the @p chSchWakeupS() function. - */ - msg_t rdymsg; - /** - * @brief Thread exit code. - * @note The thread termination code is stored in this field in order - * to be retrieved by the thread performing a @p chThdWait() on - * this thread. - */ - msg_t exitcode; - /** - * @brief Pointer to a generic "wait" object. - * @note This field is used to get a generic pointer to a synchronization - * object and is valid when the thread is in one of the wait - * states. - */ - void *wtobjp; -#if CH_USE_EVENTS - /** - * @brief Enabled events mask. - * @note This field is only valied while the thread is in the - * @p THD_STATE_WTOREVT or @p THD_STATE_WTANDEVT states. - */ - eventmask_t ewmask; -#endif - } p_u; -#if CH_USE_WAITEXIT - /** - * @brief Termination waiting list. - */ - ThreadsList p_waiting; -#endif -#if CH_USE_MESSAGES - /** - * @brief Messages queue. - */ - ThreadsQueue p_msgqueue; - /** - * @brief Thread message. - */ - msg_t p_msg; -#endif -#if CH_USE_EVENTS - /** - * @brief Pending events mask. - */ - eventmask_t p_epending; -#endif -#if CH_USE_MUTEXES - /** - * @brief List of the mutexes owned by this thread. - * @note The list is terminated by a @p NULL in this field. - */ - Mutex *p_mtxlist; - /** - * @brief Thread's own, non-inherited, priority. - */ - tprio_t p_realprio; -#endif -#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS - /** - * @brief Memory Pool where the thread workspace is returned. - */ - void *p_mpool; -#endif - /* Extra fields defined in chconf.h.*/ - THREAD_EXT_FIELDS -}; - -/** @brief Thread state: Ready to run, waiting on the ready list.*/ -#define THD_STATE_READY 0 -/** @brief Thread state: Currently running.*/ -#define THD_STATE_CURRENT 1 -/** @brief Thread state: Thread created in suspended state.*/ -#define THD_STATE_SUSPENDED 2 -/** @brief Thread state: Waiting on a semaphore.*/ -#define THD_STATE_WTSEM 3 -/** @brief Thread state: Waiting on a mutex.*/ -#define THD_STATE_WTMTX 4 -/** @brief Thread state: Waiting in @p chCondWait().*/ -#define THD_STATE_WTCOND 5 -/** @brief Thread state: Waiting in @p chThdSleep() or @p chThdSleepUntil().*/ -#define THD_STATE_SLEEPING 6 -/** @brief Thread state: Waiting in @p chThdWait().*/ -#define THD_STATE_WTEXIT 7 -/** @brief Thread state: Waiting in @p chEvtWaitXXX().*/ -#define THD_STATE_WTOREVT 8 -/** @brief Thread state: Waiting in @p chEvtWaitAllTimeout().*/ -#define THD_STATE_WTANDEVT 9 -/** @brief Thread state: Waiting in @p chMsgSend().*/ -#define THD_STATE_SNDMSG 10 -/** @brief Thread state: Waiting in @p chMsgWait().*/ -#define THD_STATE_WTMSG 11 -/** @brief Thread state: After termination.*/ -#define THD_STATE_FINAL 12 - -/* - * Various flags into the thread p_flags field. - */ -#define THD_MEM_MODE_MASK 3 /**< @brief Thread memory mode mask. */ -#define THD_MEM_MODE_STATIC 0 /**< @brief Thread memory mode: static. */ -#define THD_MEM_MODE_HEAP 1 /**< @brief Thread memory mode: heap. */ -#define THD_MEM_MODE_MEMPOOL 2 /**< @brief Thread memory mode: pool. */ -#define THD_TERMINATE 4 /**< @brief Termination requested. */ - -/** @brief Thread function.*/ -typedef msg_t (*tfunc_t)(void *); - -/* - * Threads APIs. - */ -#ifdef __cplusplus -extern "C" { -#endif - Thread *init_thread(Thread *tp, tprio_t prio); - Thread *chThdInit(void *wsp, size_t size, - tprio_t prio, tfunc_t pf, void *arg); - Thread *chThdCreateStatic(void *wsp, size_t size, - tprio_t prio, tfunc_t pf, void *arg); -#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP - Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, - tprio_t prio, tfunc_t pf, void *arg); -#endif -#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_MEMPOOLS - Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, - tfunc_t pf, void *arg); -#endif - tprio_t chThdSetPriority(tprio_t newprio); - Thread *chThdResume(Thread *tp); - void chThdTerminate(Thread *tp); - void chThdSleep(systime_t time); - void chThdSleepUntil(systime_t time); - void chThdYield(void); - void chThdExit(msg_t msg); -#if CH_USE_DYNAMIC - Thread *chThdAddRef(Thread *tp); - void chThdRelease(Thread *tp); -#endif -#if CH_USE_WAITEXIT - msg_t chThdWait(Thread *tp); -#endif -#ifdef __cplusplus -} -#endif - -/** - * @brief Returns a pointer to the current @p Thread. - */ -#define chThdSelf() currp - -/** - * @brief Returns the current thread priority. - */ -#define chThdGetPriority() (currp->p_prio) - -/** - * @brief Returns the pointer to the @p Thread local storage area, if any. - */ -#define chThdLS() (void *)(currp + 1) - -/** - * @brief Verifies if the specified thread is in the @p THD_STATE_FINAL state. - * - * @param[in] tp the pointer to the thread - * @retval TRUE thread terminated. - * @retval FALSE thread not terminated. - */ -#define chThdTerminated(tp) ((tp)->p_state == THD_STATE_FINAL) - -/** - * @brief Verifies if the current thread has a termination request pending. - * - * @retval TRUE termination request pended. - * @retval FALSE termination request not pended. - */ -#define chThdShouldTerminate() (currp->p_flags & THD_TERMINATE) - -/** - * @brief Resumes a thread created with @p chThdInit(). - * - * @param[in] tp the pointer to the thread - */ -#define chThdResumeI(tp) chSchReadyI(tp) - -/** - * @brief Suspends the invoking thread for the specified time. - * - * @param[in] time the delay in system ticks, the special values are - * handled as follow: - * - @a TIME_INFINITE the thread enters an infinite sleep - * state. - * - @a TIME_IMMEDIATE this value is accepted but - * interpreted as a normal time specification not as - * an immediate timeout specification. - * . - */ -#define chThdSleepS(time) chSchGoSleepTimeoutS(THD_STATE_SLEEPING, time) - -/** - * @brief Delays the invoking thread for the specified number of seconds. - * @note The specified time is rounded up to a value allowed by the real - * system clock. - * @note The maximum specified value is implementation dependent. - * - * @param[in] sec the time in seconds - */ -#define chThdSleepSeconds(sec) chThdSleep(S2ST(sec)) - -/** - * @brief Delays the invoking thread for the specified number of - * milliseconds. - * @note The specified time is rounded up to a value allowed by the real - * system clock. - * @note The maximum specified value is implementation dependent. - * - * @param[in] msec the time in milliseconds - */ -#define chThdSleepMilliseconds(msec) chThdSleep(MS2ST(msec)) - -/** - * @brief Delays the invoking thread for the specified number of - * microseconds. - * @note The specified time is rounded up to a value allowed by the real - * system clock. - * @note The maximum specified value is implementation dependent. - * - * @param[in] usec the time in microseconds - */ -#define chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec)) - -#endif /* _THREADS_H_ */ - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file threads.h + * @brief Threads macros and structures. + * + * @addtogroup threads + * @{ + */ + +#ifndef _THREADS_H_ +#define _THREADS_H_ + +/* + * Module dependencies check. + */ +#if CH_USE_DYNAMIC && !CH_USE_WAITEXIT +#error "CH_USE_DYNAMIC requires CH_USE_WAITEXIT" +#endif +#if CH_USE_DYNAMIC && !CH_USE_HEAP && !CH_USE_MEMPOOLS +#error "CH_USE_DYNAMIC requires CH_USE_HEAP and/or CH_USE_MEMPOOLS" +#endif + +/** + * @extends ThreadsQueue + * + * @brief Structure representing a thread. + * @note Not all the listed fields are always needed, by switching off some + * not needed ChibiOS/RT subsystems it is possible to save RAM space + * by shrinking the @p Thread structure. + */ +struct Thread { + Thread *p_next; /**< @brief Next in the list/queue. */ + /* End of the fields shared with the ThreadsList structure. */ + Thread *p_prev; /**< @brief Previous in the queue. */ + /* End of the fields shared with the ThreadsQueue structure. */ + tprio_t p_prio; /**< @brief Thread priority. */ + struct context p_ctx; /**< @brief Processor context. */ +#if CH_USE_REGISTRY + Thread *p_newer; /**< @brief Newer registry element. */ + Thread *p_older; /**< @brief Older registry element. */ +#endif + /* End of the fields shared with the ReadyList structure. */ + /** + * @brief Current thread state. + */ + tstate_t p_state; + /** + * @brief Various thread flags. + */ + tmode_t p_flags; +#if CH_USE_DYNAMIC + /** + * @brief References to this thread. + */ + trefs_t p_refs; +#endif +#if CH_USE_NESTED_LOCKS + /** + * @brief Number of nested locks. + */ + cnt_t p_locks; +#endif +#if CH_DBG_THREADS_PROFILING + /** + * @brief Thread consumed time in ticks. + * @note This field can overflow. + */ + volatile systime_t p_time; +#endif + /** + * @brief State-specific fields. + * @note All the fields declared in this union are only valid in the + * specified state or condition and are thus volatile. + */ + union { + /** + * @brief Thread wakeup code. + * @note This field contains the low level message sent to the thread + * by the waking thread or interrupt handler. The value is valid + * after exiting the @p chSchWakeupS() function. + */ + msg_t rdymsg; + /** + * @brief Thread exit code. + * @note The thread termination code is stored in this field in order + * to be retrieved by the thread performing a @p chThdWait() on + * this thread. + */ + msg_t exitcode; + /** + * @brief Pointer to a generic "wait" object. + * @note This field is used to get a generic pointer to a synchronization + * object and is valid when the thread is in one of the wait + * states. + */ + void *wtobjp; +#if CH_USE_EVENTS + /** + * @brief Enabled events mask. + * @note This field is only valied while the thread is in the + * @p THD_STATE_WTOREVT or @p THD_STATE_WTANDEVT states. + */ + eventmask_t ewmask; +#endif + } p_u; +#if CH_USE_WAITEXIT + /** + * @brief Termination waiting list. + */ + ThreadsList p_waiting; +#endif +#if CH_USE_MESSAGES + /** + * @brief Messages queue. + */ + ThreadsQueue p_msgqueue; + /** + * @brief Thread message. + */ + msg_t p_msg; +#endif +#if CH_USE_EVENTS + /** + * @brief Pending events mask. + */ + eventmask_t p_epending; +#endif +#if CH_USE_MUTEXES + /** + * @brief List of the mutexes owned by this thread. + * @note The list is terminated by a @p NULL in this field. + */ + Mutex *p_mtxlist; + /** + * @brief Thread's own, non-inherited, priority. + */ + tprio_t p_realprio; +#endif +#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS + /** + * @brief Memory Pool where the thread workspace is returned. + */ + void *p_mpool; +#endif + /* Extra fields defined in chconf.h.*/ + THREAD_EXT_FIELDS +}; + +/** @brief Thread state: Ready to run, waiting on the ready list.*/ +#define THD_STATE_READY 0 +/** @brief Thread state: Currently running.*/ +#define THD_STATE_CURRENT 1 +/** @brief Thread state: Thread created in suspended state.*/ +#define THD_STATE_SUSPENDED 2 +/** @brief Thread state: Waiting on a semaphore.*/ +#define THD_STATE_WTSEM 3 +/** @brief Thread state: Waiting on a mutex.*/ +#define THD_STATE_WTMTX 4 +/** @brief Thread state: Waiting in @p chCondWait().*/ +#define THD_STATE_WTCOND 5 +/** @brief Thread state: Waiting in @p chThdSleep() or @p chThdSleepUntil().*/ +#define THD_STATE_SLEEPING 6 +/** @brief Thread state: Waiting in @p chThdWait().*/ +#define THD_STATE_WTEXIT 7 +/** @brief Thread state: Waiting in @p chEvtWaitXXX().*/ +#define THD_STATE_WTOREVT 8 +/** @brief Thread state: Waiting in @p chEvtWaitAllTimeout().*/ +#define THD_STATE_WTANDEVT 9 +/** @brief Thread state: Waiting in @p chMsgSend().*/ +#define THD_STATE_SNDMSG 10 +/** @brief Thread state: Waiting in @p chMsgWait().*/ +#define THD_STATE_WTMSG 11 +/** @brief Thread state: After termination.*/ +#define THD_STATE_FINAL 12 + +/* + * Various flags into the thread p_flags field. + */ +#define THD_MEM_MODE_MASK 3 /**< @brief Thread memory mode mask. */ +#define THD_MEM_MODE_STATIC 0 /**< @brief Thread memory mode: static. */ +#define THD_MEM_MODE_HEAP 1 /**< @brief Thread memory mode: heap. */ +#define THD_MEM_MODE_MEMPOOL 2 /**< @brief Thread memory mode: pool. */ +#define THD_TERMINATE 4 /**< @brief Termination requested. */ + +/** @brief Thread function.*/ +typedef msg_t (*tfunc_t)(void *); + +/* + * Threads APIs. + */ +#ifdef __cplusplus +extern "C" { +#endif + Thread *init_thread(Thread *tp, tprio_t prio); + Thread *chThdInit(void *wsp, size_t size, + tprio_t prio, tfunc_t pf, void *arg); + Thread *chThdCreateStatic(void *wsp, size_t size, + tprio_t prio, tfunc_t pf, void *arg); +#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP + Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, + tprio_t prio, tfunc_t pf, void *arg); +#endif +#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_MEMPOOLS + Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, + tfunc_t pf, void *arg); +#endif + tprio_t chThdSetPriority(tprio_t newprio); + Thread *chThdResume(Thread *tp); + void chThdTerminate(Thread *tp); + void chThdSleep(systime_t time); + void chThdSleepUntil(systime_t time); + void chThdYield(void); + void chThdExit(msg_t msg); +#if CH_USE_DYNAMIC + Thread *chThdAddRef(Thread *tp); + void chThdRelease(Thread *tp); +#endif +#if CH_USE_WAITEXIT + msg_t chThdWait(Thread *tp); +#endif +#ifdef __cplusplus +} +#endif + +/** + * @brief Returns a pointer to the current @p Thread. + */ +#define chThdSelf() currp + +/** + * @brief Returns the current thread priority. + */ +#define chThdGetPriority() (currp->p_prio) + +/** + * @brief Returns the pointer to the @p Thread local storage area, if any. + */ +#define chThdLS() (void *)(currp + 1) + +/** + * @brief Verifies if the specified thread is in the @p THD_STATE_FINAL state. + * + * @param[in] tp the pointer to the thread + * @retval TRUE thread terminated. + * @retval FALSE thread not terminated. + */ +#define chThdTerminated(tp) ((tp)->p_state == THD_STATE_FINAL) + +/** + * @brief Verifies if the current thread has a termination request pending. + * + * @retval TRUE termination request pended. + * @retval FALSE termination request not pended. + */ +#define chThdShouldTerminate() (currp->p_flags & THD_TERMINATE) + +/** + * @brief Resumes a thread created with @p chThdInit(). + * + * @param[in] tp the pointer to the thread + */ +#define chThdResumeI(tp) chSchReadyI(tp) + +/** + * @brief Suspends the invoking thread for the specified time. + * + * @param[in] time the delay in system ticks, the special values are + * handled as follow: + * - @a TIME_INFINITE the thread enters an infinite sleep + * state. + * - @a TIME_IMMEDIATE this value is accepted but + * interpreted as a normal time specification not as + * an immediate timeout specification. + * . + */ +#define chThdSleepS(time) chSchGoSleepTimeoutS(THD_STATE_SLEEPING, time) + +/** + * @brief Delays the invoking thread for the specified number of seconds. + * @note The specified time is rounded up to a value allowed by the real + * system clock. + * @note The maximum specified value is implementation dependent. + * + * @param[in] sec the time in seconds + */ +#define chThdSleepSeconds(sec) chThdSleep(S2ST(sec)) + +/** + * @brief Delays the invoking thread for the specified number of + * milliseconds. + * @note The specified time is rounded up to a value allowed by the real + * system clock. + * @note The maximum specified value is implementation dependent. + * + * @param[in] msec the time in milliseconds + */ +#define chThdSleepMilliseconds(msec) chThdSleep(MS2ST(msec)) + +/** + * @brief Delays the invoking thread for the specified number of + * microseconds. + * @note The specified time is rounded up to a value allowed by the real + * system clock. + * @note The maximum specified value is implementation dependent. + * + * @param[in] usec the time in microseconds + */ +#define chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec)) + +#endif /* _THREADS_H_ */ + +/** @} */ diff --git a/os/kernel/include/vt.h b/os/kernel/include/vt.h index 23396e594..445650332 100644 --- a/os/kernel/include/vt.h +++ b/os/kernel/include/vt.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -55,7 +55,7 @@ typedef void (*vtfunc_t)(void *); /** - * @brief Virtual Timer structure type. + * @brief Virtual Timer structure type. */ typedef struct VirtualTimer VirtualTimer; @@ -94,7 +94,7 @@ typedef struct { extern VTList vtlist; /** - * @brief Virtual timers sticker. + * @brief Virtual timers sticker. */ #define chVTDoTickI() { \ vtlist.vt_systime++; \ diff --git a/os/kernel/kernel.dox b/os/kernel/kernel.dox index 072be41ec..e93ac8c5e 100644 --- a/os/kernel/kernel.dox +++ b/os/kernel/kernel.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -353,4 +353,4 @@ * Internal details, not APIs. * @ingroup kernel */ - \ No newline at end of file + diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c index 21f3a22e2..f0ec50c4f 100644 --- a/os/kernel/src/chcond.c +++ b/os/kernel/src/chcond.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chdebug.c b/os/kernel/src/chdebug.c index 38626387b..ebe93e8a5 100644 --- a/os/kernel/src/chdebug.c +++ b/os/kernel/src/chdebug.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -64,7 +64,7 @@ void chDbgTrace(Thread *otp, Thread *ntp) { * @brief Pointer to the panic message. * @details This pointer is meant to be accessed through the debugger, it is * written once and then the system is halted. This variable can be - * set to @p NULL if the halt is caused by a stack overflow. + * set to @p NULL if the halt is caused by a stack overflow. */ char *panic_msg; diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c index 310f04212..e3c0b07ba 100644 --- a/os/kernel/src/chevents.c +++ b/os/kernel/src/chevents.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chheap.c b/os/kernel/src/chheap.c index 91b7d01bc..ce8ce385b 100644 --- a/os/kernel/src/chheap.c +++ b/os/kernel/src/chheap.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chlists.c b/os/kernel/src/chlists.c index 9b309ceea..f722f94cb 100644 --- a/os/kernel/src/chlists.c +++ b/os/kernel/src/chlists.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chmboxes.c b/os/kernel/src/chmboxes.c index aee514f84..3811fc5da 100644 --- a/os/kernel/src/chmboxes.c +++ b/os/kernel/src/chmboxes.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -33,7 +33,7 @@ * * @param[out] mbp the pointer to the Mailbox structure to be initialized * @param[in] buf the circular messages buffer - * @param[in] n the buffer size as number of @p msg_t + * @param[in] n the buffer size as number of @p msg_t */ void chMBInit(Mailbox *mbp, msg_t *buf, cnt_t n) { diff --git a/os/kernel/src/chmemcore.c b/os/kernel/src/chmemcore.c index d5adbef48..435120a33 100644 --- a/os/kernel/src/chmemcore.c +++ b/os/kernel/src/chmemcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -60,7 +60,7 @@ void core_init(void) { * * @param[in] size the size of the block to be allocated * @return A pointer to the allocated memory block. - * @retval NULL allocation failed, core memory exhausted. + * @retval NULL allocation failed, core memory exhausted. */ void *chCoreAlloc(size_t size) { void *p; @@ -95,7 +95,7 @@ void *chCoreAllocI(size_t size) { /** * @brief Core memory left. * - * @return The size, in bytes, of the free core memory. + * @return The size, in bytes, of the free core memory. */ size_t chCoreFree(void) { diff --git a/os/kernel/src/chmempools.c b/os/kernel/src/chmempools.c index 1e827c128..f79e20353 100644 --- a/os/kernel/src/chmempools.c +++ b/os/kernel/src/chmempools.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index 9b6afd950..411c5fed3 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chmtx.c b/os/kernel/src/chmtx.c index d5335c0aa..336df8a6e 100644 --- a/os/kernel/src/chmtx.c +++ b/os/kernel/src/chmtx.c @@ -1,276 +1,276 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file chmtx.c - * @brief Mutexes code. - * - * @addtogroup mutexes - * @{ - */ - -#include "ch.h" - -#if CH_USE_MUTEXES - -/** - * @brief Initializes s @p Mutex structure. - * - * @param[out] mp pointer to a @p Mutex structure - */ -void chMtxInit(Mutex *mp) { - - chDbgCheck(mp != NULL, "chMtxInit"); - - queue_init(&mp->m_queue); - mp->m_owner = NULL; -} - -/** - * @brief Locks the specified mutex. - * - * @param[in] mp pointer to the @p Mutex structure - */ -void chMtxLock(Mutex *mp) { - - chSysLock(); - - chMtxLockS(mp); - - chSysUnlock(); -} - -/** - * @brief Locks the specified mutex. - * - * @param[in] mp pointer to the @p Mutex structure - */ -void chMtxLockS(Mutex *mp) { - Thread *ctp = currp; - - chDbgCheck(mp != NULL, "chMtxLockS"); - - /* Ia the mutex already locked? */ - if (mp->m_owner != NULL) { - /* Priority inheritance protocol; explores the thread-mutex dependencies - boosting the priority of all the affected threads to equal the priority - of the running thread requesting the mutex.*/ - Thread *tp = mp->m_owner; - /* Does the running thread have higher priority than the mutex - ownning thread? */ - while (tp->p_prio < ctp->p_prio) { - /* Make priority of thread tp match the running thread's priority.*/ - tp->p_prio = ctp->p_prio; - /* The following states need priority queues reordering.*/ - switch (tp->p_state) { - case THD_STATE_WTMTX: - /* Re-enqueues the mutex owner with its new priority.*/ - prio_insert(dequeue(tp), (ThreadsQueue *)tp->p_u.wtobjp); - tp = ((Mutex *)tp->p_u.wtobjp)->m_owner; - continue; -#if CH_USE_CONDVARS | CH_USE_SEMAPHORES_PRIORITY | CH_USE_MESSAGES_PRIORITY -#if CH_USE_CONDVARS - case THD_STATE_WTCOND: -#endif -#if CH_USE_SEMAPHORES_PRIORITY - case THD_STATE_WTSEM: -#endif -#if CH_USE_MESSAGES_PRIORITY - case THD_STATE_SNDMSG: -#endif - /* Re-enqueues tp with its new priority on the queue.*/ - prio_insert(dequeue(tp), (ThreadsQueue *)tp->p_u.wtobjp); - break; -#endif - case THD_STATE_READY: - /* Re-enqueues tp with its new priority on the ready list.*/ - chSchReadyI(dequeue(tp)); - } - break; - } - /* Sleep on the mutex.*/ - prio_insert(ctp, &mp->m_queue); - ctp->p_u.wtobjp = mp; - chSchGoSleepS(THD_STATE_WTMTX); - chDbgAssert(mp->m_owner == NULL, "chMtxLockS(), #1", "still owned"); - } - /* The mutex is now inserted in the owned mutexes list.*/ - mp->m_owner = ctp; - mp->m_next = ctp->p_mtxlist; - ctp->p_mtxlist = mp; -} - -/** - * @brief Tries to lock a mutex. - * @details This function does not have any overhead related to - * the priority inheritance mechanism because it does not try to - * enter a sleep state on the mutex. - * - * @param[in] mp pointer to the @p Mutex structure - * @retval TRUE if the mutex was successfully acquired - * @retval FALSE if the lock attempt failed. - */ -bool_t chMtxTryLock(Mutex *mp) { - bool_t b; - - chSysLock(); - - b = chMtxTryLockS(mp); - - chSysUnlock(); - return b; -} - -/** - * @brief Tries to lock a mutex. - * @details This function does not have any overhead related to - * the priority inheritance mechanism because it does not try to - * enter a sleep state on the mutex. - * - * @param[in] mp pointer to the @p Mutex structure - * @retval TRUE if the mutex was successfully acquired - * @retval FALSE if the lock attempt failed. - */ -bool_t chMtxTryLockS(Mutex *mp) { - - chDbgCheck(mp != NULL, "chMtxTryLockS"); - - if (mp->m_owner != NULL) - return FALSE; - mp->m_owner = currp; - mp->m_next = currp->p_mtxlist; - currp->p_mtxlist = mp; - return TRUE; -} - -/** - * @brief Unlocks the next owned mutex in reverse lock order. - * - * @return The pointer to the unlocked mutex. - */ -Mutex *chMtxUnlock(void) { - Thread *ctp = currp; - Mutex *ump, *mp; - - chSysLock(); - chDbgAssert(ctp->p_mtxlist != NULL, - "chMtxUnlock(), #1", - "owned mutexes list empty"); - chDbgAssert(ctp->p_mtxlist->m_owner == ctp, - "chMtxUnlock(), #2", - "ownership failure"); - /* Removes the top Mutex from the Threads's owned mutexes list and matk it - as not owned.*/ - ump = ctp->p_mtxlist; - ctp->p_mtxlist = ump->m_next; - ump->m_owner = NULL; - /* If a thread is waiting on the mutex then the fun part begins.*/ - if (chMtxQueueNotEmptyS(ump)) { - /* Recalculates the optimal thread priority by scanning the owned - mutexes list.*/ - tprio_t newprio = ctp->p_realprio; - mp = ctp->p_mtxlist; - while (mp != NULL) { - /* If the highest priority thread waiting in the mutexes list has a - greater priority than the current thread base priority then the final - priority will have at least that priority.*/ - if (chMtxQueueNotEmptyS(mp) && (mp->m_queue.p_next->p_prio > newprio)) - newprio = mp->m_queue.p_next->p_prio; - mp = mp->m_next; - } - /* Assigns to the current thread the highest priority among all the - waiting threads.*/ - ctp->p_prio = newprio; - /* Awakens the highest priority thread waiting for the unlocked mutex.*/ - chSchWakeupS(fifo_remove(&ump->m_queue), RDY_OK); - } - chSysUnlock(); - return ump; -} - -/** - * @brief Unlocks the next owned mutex in reverse lock order. - * @note This function does not reschedule internally. - * - * @return The pointer to the unlocked mutex. - */ -Mutex *chMtxUnlockS(void) { - Thread *ctp = currp; - Mutex *ump, *mp; - - chDbgAssert(ctp->p_mtxlist != NULL, - "chMtxUnlockS(), #1", - "owned mutexes list empty"); - chDbgAssert(ctp->p_mtxlist->m_owner == ctp, - "chMtxUnlockS(), #2", - "ownership failure"); - - /* Removes the top Mutex from the owned mutexes list and marks it as not - owned.*/ - ump = ctp->p_mtxlist; - ctp->p_mtxlist = ump->m_next; - ump->m_owner = NULL; - /* If a thread is waiting on the mutex then the fun part begins.*/ - if (chMtxQueueNotEmptyS(ump)) { - /* Recalculates the optimal thread priority by scanning the owned - mutexes list.*/ - tprio_t newprio = ctp->p_realprio; - mp = ctp->p_mtxlist; - while (mp != NULL) { - /* If the highest priority thread waiting in the mutexes list has a - greater priority than the current thread base priority then the final - priority will have at least that priority.*/ - if (chMtxQueueNotEmptyS(mp) && (mp->m_queue.p_next->p_prio > newprio)) - newprio = mp->m_queue.p_next->p_prio; - mp = mp->m_next; - } - ctp->p_prio = newprio; - chSchReadyI(fifo_remove(&ump->m_queue)); - } - return ump; -} - -/** - * @brief Unlocks all the mutexes owned by the invoking thread. - * @details This function is MUCH MORE efficient than releasing the - * mutexes one by one and not just because the call overhead, - * this function does not have any overhead related to the priority - * inheritance mechanism. - */ -void chMtxUnlockAll(void) { - Thread *ctp = currp; - - chSysLock(); - if (ctp->p_mtxlist != NULL) { - do { - Mutex *mp = ctp->p_mtxlist; - ctp->p_mtxlist = mp->m_next; - mp->m_owner = NULL; - if (chMtxQueueNotEmptyS(mp)) - chSchReadyI(fifo_remove(&mp->m_queue)); - } while (ctp->p_mtxlist != NULL); - ctp->p_prio = ctp->p_realprio; - chSchRescheduleS(); - } - chSysUnlock(); -} - -#endif /* CH_USE_MUTEXES */ - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file chmtx.c + * @brief Mutexes code. + * + * @addtogroup mutexes + * @{ + */ + +#include "ch.h" + +#if CH_USE_MUTEXES + +/** + * @brief Initializes s @p Mutex structure. + * + * @param[out] mp pointer to a @p Mutex structure + */ +void chMtxInit(Mutex *mp) { + + chDbgCheck(mp != NULL, "chMtxInit"); + + queue_init(&mp->m_queue); + mp->m_owner = NULL; +} + +/** + * @brief Locks the specified mutex. + * + * @param[in] mp pointer to the @p Mutex structure + */ +void chMtxLock(Mutex *mp) { + + chSysLock(); + + chMtxLockS(mp); + + chSysUnlock(); +} + +/** + * @brief Locks the specified mutex. + * + * @param[in] mp pointer to the @p Mutex structure + */ +void chMtxLockS(Mutex *mp) { + Thread *ctp = currp; + + chDbgCheck(mp != NULL, "chMtxLockS"); + + /* Ia the mutex already locked? */ + if (mp->m_owner != NULL) { + /* Priority inheritance protocol; explores the thread-mutex dependencies + boosting the priority of all the affected threads to equal the priority + of the running thread requesting the mutex.*/ + Thread *tp = mp->m_owner; + /* Does the running thread have higher priority than the mutex + ownning thread? */ + while (tp->p_prio < ctp->p_prio) { + /* Make priority of thread tp match the running thread's priority.*/ + tp->p_prio = ctp->p_prio; + /* The following states need priority queues reordering.*/ + switch (tp->p_state) { + case THD_STATE_WTMTX: + /* Re-enqueues the mutex owner with its new priority.*/ + prio_insert(dequeue(tp), (ThreadsQueue *)tp->p_u.wtobjp); + tp = ((Mutex *)tp->p_u.wtobjp)->m_owner; + continue; +#if CH_USE_CONDVARS | CH_USE_SEMAPHORES_PRIORITY | CH_USE_MESSAGES_PRIORITY +#if CH_USE_CONDVARS + case THD_STATE_WTCOND: +#endif +#if CH_USE_SEMAPHORES_PRIORITY + case THD_STATE_WTSEM: +#endif +#if CH_USE_MESSAGES_PRIORITY + case THD_STATE_SNDMSG: +#endif + /* Re-enqueues tp with its new priority on the queue.*/ + prio_insert(dequeue(tp), (ThreadsQueue *)tp->p_u.wtobjp); + break; +#endif + case THD_STATE_READY: + /* Re-enqueues tp with its new priority on the ready list.*/ + chSchReadyI(dequeue(tp)); + } + break; + } + /* Sleep on the mutex.*/ + prio_insert(ctp, &mp->m_queue); + ctp->p_u.wtobjp = mp; + chSchGoSleepS(THD_STATE_WTMTX); + chDbgAssert(mp->m_owner == NULL, "chMtxLockS(), #1", "still owned"); + } + /* The mutex is now inserted in the owned mutexes list.*/ + mp->m_owner = ctp; + mp->m_next = ctp->p_mtxlist; + ctp->p_mtxlist = mp; +} + +/** + * @brief Tries to lock a mutex. + * @details This function does not have any overhead related to + * the priority inheritance mechanism because it does not try to + * enter a sleep state on the mutex. + * + * @param[in] mp pointer to the @p Mutex structure + * @retval TRUE if the mutex was successfully acquired + * @retval FALSE if the lock attempt failed. + */ +bool_t chMtxTryLock(Mutex *mp) { + bool_t b; + + chSysLock(); + + b = chMtxTryLockS(mp); + + chSysUnlock(); + return b; +} + +/** + * @brief Tries to lock a mutex. + * @details This function does not have any overhead related to + * the priority inheritance mechanism because it does not try to + * enter a sleep state on the mutex. + * + * @param[in] mp pointer to the @p Mutex structure + * @retval TRUE if the mutex was successfully acquired + * @retval FALSE if the lock attempt failed. + */ +bool_t chMtxTryLockS(Mutex *mp) { + + chDbgCheck(mp != NULL, "chMtxTryLockS"); + + if (mp->m_owner != NULL) + return FALSE; + mp->m_owner = currp; + mp->m_next = currp->p_mtxlist; + currp->p_mtxlist = mp; + return TRUE; +} + +/** + * @brief Unlocks the next owned mutex in reverse lock order. + * + * @return The pointer to the unlocked mutex. + */ +Mutex *chMtxUnlock(void) { + Thread *ctp = currp; + Mutex *ump, *mp; + + chSysLock(); + chDbgAssert(ctp->p_mtxlist != NULL, + "chMtxUnlock(), #1", + "owned mutexes list empty"); + chDbgAssert(ctp->p_mtxlist->m_owner == ctp, + "chMtxUnlock(), #2", + "ownership failure"); + /* Removes the top Mutex from the Threads's owned mutexes list and matk it + as not owned.*/ + ump = ctp->p_mtxlist; + ctp->p_mtxlist = ump->m_next; + ump->m_owner = NULL; + /* If a thread is waiting on the mutex then the fun part begins.*/ + if (chMtxQueueNotEmptyS(ump)) { + /* Recalculates the optimal thread priority by scanning the owned + mutexes list.*/ + tprio_t newprio = ctp->p_realprio; + mp = ctp->p_mtxlist; + while (mp != NULL) { + /* If the highest priority thread waiting in the mutexes list has a + greater priority than the current thread base priority then the final + priority will have at least that priority.*/ + if (chMtxQueueNotEmptyS(mp) && (mp->m_queue.p_next->p_prio > newprio)) + newprio = mp->m_queue.p_next->p_prio; + mp = mp->m_next; + } + /* Assigns to the current thread the highest priority among all the + waiting threads.*/ + ctp->p_prio = newprio; + /* Awakens the highest priority thread waiting for the unlocked mutex.*/ + chSchWakeupS(fifo_remove(&ump->m_queue), RDY_OK); + } + chSysUnlock(); + return ump; +} + +/** + * @brief Unlocks the next owned mutex in reverse lock order. + * @note This function does not reschedule internally. + * + * @return The pointer to the unlocked mutex. + */ +Mutex *chMtxUnlockS(void) { + Thread *ctp = currp; + Mutex *ump, *mp; + + chDbgAssert(ctp->p_mtxlist != NULL, + "chMtxUnlockS(), #1", + "owned mutexes list empty"); + chDbgAssert(ctp->p_mtxlist->m_owner == ctp, + "chMtxUnlockS(), #2", + "ownership failure"); + + /* Removes the top Mutex from the owned mutexes list and marks it as not + owned.*/ + ump = ctp->p_mtxlist; + ctp->p_mtxlist = ump->m_next; + ump->m_owner = NULL; + /* If a thread is waiting on the mutex then the fun part begins.*/ + if (chMtxQueueNotEmptyS(ump)) { + /* Recalculates the optimal thread priority by scanning the owned + mutexes list.*/ + tprio_t newprio = ctp->p_realprio; + mp = ctp->p_mtxlist; + while (mp != NULL) { + /* If the highest priority thread waiting in the mutexes list has a + greater priority than the current thread base priority then the final + priority will have at least that priority.*/ + if (chMtxQueueNotEmptyS(mp) && (mp->m_queue.p_next->p_prio > newprio)) + newprio = mp->m_queue.p_next->p_prio; + mp = mp->m_next; + } + ctp->p_prio = newprio; + chSchReadyI(fifo_remove(&ump->m_queue)); + } + return ump; +} + +/** + * @brief Unlocks all the mutexes owned by the invoking thread. + * @details This function is MUCH MORE efficient than releasing the + * mutexes one by one and not just because the call overhead, + * this function does not have any overhead related to the priority + * inheritance mechanism. + */ +void chMtxUnlockAll(void) { + Thread *ctp = currp; + + chSysLock(); + if (ctp->p_mtxlist != NULL) { + do { + Mutex *mp = ctp->p_mtxlist; + ctp->p_mtxlist = mp->m_next; + mp->m_owner = NULL; + if (chMtxQueueNotEmptyS(mp)) + chSchReadyI(fifo_remove(&mp->m_queue)); + } while (ctp->p_mtxlist != NULL); + ctp->p_prio = ctp->p_realprio; + chSchRescheduleS(); + } + chSysUnlock(); +} + +#endif /* CH_USE_MUTEXES */ + +/** @} */ diff --git a/os/kernel/src/chqueues.c b/os/kernel/src/chqueues.c index 50f1f2401..2f8d1b569 100644 --- a/os/kernel/src/chqueues.c +++ b/os/kernel/src/chqueues.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index b6555df40..8d4ffa4e8 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -37,7 +37,7 @@ * @note This function cannot return @p NULL because there is always at * least one thread in the system. * - * @return A reference to the first thread. + * @return A reference to the first thread. */ Thread *chRegFirstThread(void) { Thread *tp; @@ -55,7 +55,7 @@ Thread *chRegFirstThread(void) { * @brief Returns the thread next to the specified one. * @details The reference counter of the specified thread is decremented and * the reference counter of the returned thread is incremented. - * + * * @param[in] tp pointer to the thread * @return A reference to the next thread. * @retval NULL if there is no next thread. diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index 5bd016226..8cfd5cd81 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -1,280 +1,280 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file chschd.c - * @brief Scheduler code. - * - * @addtogroup scheduler - * @{ - */ - -#include "ch.h" - -/** - * @brief Ready list header. - */ -ReadyList rlist; - -/** - * @brief Scheduler initialization. - * @note Internally invoked by the @p chSysInit(), not an API. - */ -void scheduler_init(void) { - - queue_init(&rlist.r_queue); - rlist.r_prio = NOPRIO; -#if CH_TIME_QUANTUM > 0 - rlist.r_preempt = CH_TIME_QUANTUM; -#endif -#if CH_USE_REGISTRY - rlist.p_newer = rlist.p_older = (Thread *)&rlist; -#endif -} - -/** - * @brief Inserts a thread in the Ready List. - * @note The function does not reschedule, the @p chSchRescheduleS() should - * be called soon after. - * - * @param[in] tp the Thread to be made ready - * @return The Thread pointer. - */ -#if CH_OPTIMIZE_SPEED -/* NOTE: it is inlined in this module only.*/ -INLINE Thread *chSchReadyI(Thread *tp) { -#else -Thread *chSchReadyI(Thread *tp) { -#endif - Thread *cp; - - tp->p_state = THD_STATE_READY; - cp = (Thread *)&rlist.r_queue; - do { - cp = cp->p_next; - } while (cp->p_prio >= tp->p_prio); - /* Insertion on p_prev.*/ - tp->p_prev = (tp->p_next = cp)->p_prev; - tp->p_prev->p_next = cp->p_prev = tp; - return tp; -} - -/** - * @brief Puts the current thread to sleep into the specified state. - * @details The thread goes into a sleeping state. The @ref thread_states are - * described into @p threads.h. - * - * @param[in] newstate the new thread state - */ -void chSchGoSleepS(tstate_t newstate) { - Thread *otp; - - (otp = currp)->p_state = newstate; - (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; -#if CH_TIME_QUANTUM > 0 - rlist.r_preempt = CH_TIME_QUANTUM; -#endif - chDbgTrace(otp, currp); - chSysSwitchI(otp, currp); -} - -/* - * Timeout wakeup callback. - */ -static void wakeup(void *p) { - Thread *tp = (Thread *)p; - -#if CH_USE_SEMAPHORES || CH_USE_MUTEXES || CH_USE_CONDVARS - switch (tp->p_state) { -#if CH_USE_SEMAPHORES - case THD_STATE_WTSEM: - chSemFastSignalI((Semaphore *)tp->p_u.wtobjp); - /* Falls into, intentional. */ -#endif -#if CH_USE_MUTEXES - case THD_STATE_WTMTX: -#endif -#if CH_USE_CONDVARS - case THD_STATE_WTCOND: -#endif - /* States requiring dequeuing.*/ - dequeue(tp); - } -#endif - chSchReadyI(tp)->p_u.rdymsg = RDY_TIMEOUT; -} - -/** - * @brief Puts the current thread to sleep into the specified state with - * timeout specification. - * @details The thread goes into a sleeping state, if it is not awakened - * explicitly within the specified timeout then it is forcibly - * awakened with a @p RDY_TIMEOUT low level message. The @ref - * thread_states are described into @p threads.h. - * - * @param[in] newstate the new thread state - * @param[in] time the number of ticks before the operation timeouts, the - * special values are handled as follow: - * - @a TIME_INFINITE the thread enters an infinite sleep - * state, this is equivalent to invoking - * @p chSchGoSleepS() but, of course, less efficient. - * - @a TIME_IMMEDIATE this value is accepted but - * interpreted as a normal time specification not as an - * immediate timeout specification. - * . - * @return The wakeup message. - * @retval RDY_TIMEOUT if a timeout occurs. - */ -msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { - - if (TIME_INFINITE != time) { - VirtualTimer vt; - - chVTSetI(&vt, time, wakeup, currp); - chSchGoSleepS(newstate); - if (chVTIsArmedI(&vt)) - chVTResetI(&vt); - } - else - chSchGoSleepS(newstate); - return currp->p_u.rdymsg; -} - -/** - * @brief Wakes up a thread. - * @details The thread is inserted into the ready list or immediately made - * running depending on its relative priority compared to the current - * thread. - * @note It is equivalent to a @p chSchReadyI() followed by a - * @p chSchRescheduleS() but much more efficient. - * @note The function assumes that the current thread has the highest - * priority. - * - * @param[in] ntp the Thread to be made ready - * @param[in] msg message to the awakened thread - */ -void chSchWakeupS(Thread *ntp, msg_t msg) { - - ntp->p_u.rdymsg = msg; - /* If the waken thread has a not-greater priority than the current - one then it is just inserted in the ready list else it made - running immediately and the invoking thread goes in the ready - list instead.*/ - if (ntp->p_prio <= currp->p_prio) - chSchReadyI(ntp); - else { - Thread *otp = currp; - chSchReadyI(otp); -#if CH_TIME_QUANTUM > 0 - rlist.r_preempt = CH_TIME_QUANTUM; -#endif - (currp = ntp)->p_state = THD_STATE_CURRENT; - chDbgTrace(otp, ntp); - chSysSwitchI(otp, ntp); - } -} - -/** - * @brief Switches to the first thread on the runnable queue. - * @note It is intended to be called if @p chSchRescRequiredI() evaluates - * to @p TRUE. - */ -void chSchDoRescheduleI(void) { - - Thread *otp = currp; - /* Pick the first thread from the ready queue and makes it current.*/ - (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; - chSchReadyI(otp); -#if CH_TIME_QUANTUM > 0 - rlist.r_preempt = CH_TIME_QUANTUM; -#endif - chDbgTrace(otp, currp); - chSysSwitchI(otp, currp); -} - -/** - * @brief Performs a reschedulation if a higher priority thread is runnable. - * @details If a thread with a higher priority than the current thread is in - * the ready list then make the higher priority thread running. - */ -void chSchRescheduleS(void) { - - if (chSchIsRescRequiredI()) - chSchDoRescheduleI(); -} - -/** - * @brief Evaluates if a reschedulation is required. - * @details The decision is taken by comparing the relative priorities and - * depending on the state of the round robin timeout counter. - * @note This function is meant to be used in the timer interrupt handler - * where @p chVTDoTickI() is invoked. - * - * @retval TRUE if there is a thread that should go in running state. - * @retval FALSE if a reschedulation is not required. - */ -bool_t chSchIsRescRequiredExI(void) { - tprio_t p1 = firstprio(&rlist.r_queue); - tprio_t p2 = currp->p_prio; -#if CH_TIME_QUANTUM > 0 - /* If the running thread has not reached its time quantum, reschedule only - if the first thread on the ready queue has a higher priority. - Otherwise, if the running thread has used up its time quantum, reschedule - if the first thread on the ready queue has equal or higher priority.*/ - return rlist.r_preempt ? p1 > p2 : p1 >= p2; -#else - /* If the round robin preemption feature is not enabled then performs a - simpler comparison.*/ - return p1 > p2; -#endif -} - -/** - * @brief Yields the time slot. - * @details Yields the CPU control to the next thread in the ready list with - * equal priority, if any. - */ -void chSchDoYieldS(void) { - - if (chSchCanYieldS()) { - Thread *cp = (Thread *)&rlist.r_queue; - Thread *otp = currp; - - /* Note, the following insertion code works because we know that on the - ready list there is at least one thread with priority equal or higher - than the current one.*/ - otp->p_state = THD_STATE_READY; - do { - cp = cp->p_prev; - } while (cp->p_prio < otp->p_prio); - /* Insertion on p_next.*/ - otp->p_next = (otp->p_prev = cp)->p_next; - otp->p_next->p_prev = cp->p_next = otp; - - /* Pick the first thread from the ready queue and makes it current.*/ - (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; -#if CH_TIME_QUANTUM > 0 - rlist.r_preempt = CH_TIME_QUANTUM; -#endif - chDbgTrace(otp, currp); - chSysSwitchI(otp, currp); - } -} - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file chschd.c + * @brief Scheduler code. + * + * @addtogroup scheduler + * @{ + */ + +#include "ch.h" + +/** + * @brief Ready list header. + */ +ReadyList rlist; + +/** + * @brief Scheduler initialization. + * @note Internally invoked by the @p chSysInit(), not an API. + */ +void scheduler_init(void) { + + queue_init(&rlist.r_queue); + rlist.r_prio = NOPRIO; +#if CH_TIME_QUANTUM > 0 + rlist.r_preempt = CH_TIME_QUANTUM; +#endif +#if CH_USE_REGISTRY + rlist.p_newer = rlist.p_older = (Thread *)&rlist; +#endif +} + +/** + * @brief Inserts a thread in the Ready List. + * @note The function does not reschedule, the @p chSchRescheduleS() should + * be called soon after. + * + * @param[in] tp the Thread to be made ready + * @return The Thread pointer. + */ +#if CH_OPTIMIZE_SPEED +/* NOTE: it is inlined in this module only.*/ +INLINE Thread *chSchReadyI(Thread *tp) { +#else +Thread *chSchReadyI(Thread *tp) { +#endif + Thread *cp; + + tp->p_state = THD_STATE_READY; + cp = (Thread *)&rlist.r_queue; + do { + cp = cp->p_next; + } while (cp->p_prio >= tp->p_prio); + /* Insertion on p_prev.*/ + tp->p_prev = (tp->p_next = cp)->p_prev; + tp->p_prev->p_next = cp->p_prev = tp; + return tp; +} + +/** + * @brief Puts the current thread to sleep into the specified state. + * @details The thread goes into a sleeping state. The @ref thread_states are + * described into @p threads.h. + * + * @param[in] newstate the new thread state + */ +void chSchGoSleepS(tstate_t newstate) { + Thread *otp; + + (otp = currp)->p_state = newstate; + (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; +#if CH_TIME_QUANTUM > 0 + rlist.r_preempt = CH_TIME_QUANTUM; +#endif + chDbgTrace(otp, currp); + chSysSwitchI(otp, currp); +} + +/* + * Timeout wakeup callback. + */ +static void wakeup(void *p) { + Thread *tp = (Thread *)p; + +#if CH_USE_SEMAPHORES || CH_USE_MUTEXES || CH_USE_CONDVARS + switch (tp->p_state) { +#if CH_USE_SEMAPHORES + case THD_STATE_WTSEM: + chSemFastSignalI((Semaphore *)tp->p_u.wtobjp); + /* Falls into, intentional. */ +#endif +#if CH_USE_MUTEXES + case THD_STATE_WTMTX: +#endif +#if CH_USE_CONDVARS + case THD_STATE_WTCOND: +#endif + /* States requiring dequeuing.*/ + dequeue(tp); + } +#endif + chSchReadyI(tp)->p_u.rdymsg = RDY_TIMEOUT; +} + +/** + * @brief Puts the current thread to sleep into the specified state with + * timeout specification. + * @details The thread goes into a sleeping state, if it is not awakened + * explicitly within the specified timeout then it is forcibly + * awakened with a @p RDY_TIMEOUT low level message. The @ref + * thread_states are described into @p threads.h. + * + * @param[in] newstate the new thread state + * @param[in] time the number of ticks before the operation timeouts, the + * special values are handled as follow: + * - @a TIME_INFINITE the thread enters an infinite sleep + * state, this is equivalent to invoking + * @p chSchGoSleepS() but, of course, less efficient. + * - @a TIME_IMMEDIATE this value is accepted but + * interpreted as a normal time specification not as an + * immediate timeout specification. + * . + * @return The wakeup message. + * @retval RDY_TIMEOUT if a timeout occurs. + */ +msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { + + if (TIME_INFINITE != time) { + VirtualTimer vt; + + chVTSetI(&vt, time, wakeup, currp); + chSchGoSleepS(newstate); + if (chVTIsArmedI(&vt)) + chVTResetI(&vt); + } + else + chSchGoSleepS(newstate); + return currp->p_u.rdymsg; +} + +/** + * @brief Wakes up a thread. + * @details The thread is inserted into the ready list or immediately made + * running depending on its relative priority compared to the current + * thread. + * @note It is equivalent to a @p chSchReadyI() followed by a + * @p chSchRescheduleS() but much more efficient. + * @note The function assumes that the current thread has the highest + * priority. + * + * @param[in] ntp the Thread to be made ready + * @param[in] msg message to the awakened thread + */ +void chSchWakeupS(Thread *ntp, msg_t msg) { + + ntp->p_u.rdymsg = msg; + /* If the waken thread has a not-greater priority than the current + one then it is just inserted in the ready list else it made + running immediately and the invoking thread goes in the ready + list instead.*/ + if (ntp->p_prio <= currp->p_prio) + chSchReadyI(ntp); + else { + Thread *otp = currp; + chSchReadyI(otp); +#if CH_TIME_QUANTUM > 0 + rlist.r_preempt = CH_TIME_QUANTUM; +#endif + (currp = ntp)->p_state = THD_STATE_CURRENT; + chDbgTrace(otp, ntp); + chSysSwitchI(otp, ntp); + } +} + +/** + * @brief Switches to the first thread on the runnable queue. + * @note It is intended to be called if @p chSchRescRequiredI() evaluates + * to @p TRUE. + */ +void chSchDoRescheduleI(void) { + + Thread *otp = currp; + /* Pick the first thread from the ready queue and makes it current.*/ + (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; + chSchReadyI(otp); +#if CH_TIME_QUANTUM > 0 + rlist.r_preempt = CH_TIME_QUANTUM; +#endif + chDbgTrace(otp, currp); + chSysSwitchI(otp, currp); +} + +/** + * @brief Performs a reschedulation if a higher priority thread is runnable. + * @details If a thread with a higher priority than the current thread is in + * the ready list then make the higher priority thread running. + */ +void chSchRescheduleS(void) { + + if (chSchIsRescRequiredI()) + chSchDoRescheduleI(); +} + +/** + * @brief Evaluates if a reschedulation is required. + * @details The decision is taken by comparing the relative priorities and + * depending on the state of the round robin timeout counter. + * @note This function is meant to be used in the timer interrupt handler + * where @p chVTDoTickI() is invoked. + * + * @retval TRUE if there is a thread that should go in running state. + * @retval FALSE if a reschedulation is not required. + */ +bool_t chSchIsRescRequiredExI(void) { + tprio_t p1 = firstprio(&rlist.r_queue); + tprio_t p2 = currp->p_prio; +#if CH_TIME_QUANTUM > 0 + /* If the running thread has not reached its time quantum, reschedule only + if the first thread on the ready queue has a higher priority. + Otherwise, if the running thread has used up its time quantum, reschedule + if the first thread on the ready queue has equal or higher priority.*/ + return rlist.r_preempt ? p1 > p2 : p1 >= p2; +#else + /* If the round robin preemption feature is not enabled then performs a + simpler comparison.*/ + return p1 > p2; +#endif +} + +/** + * @brief Yields the time slot. + * @details Yields the CPU control to the next thread in the ready list with + * equal priority, if any. + */ +void chSchDoYieldS(void) { + + if (chSchCanYieldS()) { + Thread *cp = (Thread *)&rlist.r_queue; + Thread *otp = currp; + + /* Note, the following insertion code works because we know that on the + ready list there is at least one thread with priority equal or higher + than the current one.*/ + otp->p_state = THD_STATE_READY; + do { + cp = cp->p_prev; + } while (cp->p_prio < otp->p_prio); + /* Insertion on p_next.*/ + otp->p_next = (otp->p_prev = cp)->p_next; + otp->p_next->p_prev = cp->p_next = otp; + + /* Pick the first thread from the ready queue and makes it current.*/ + (currp = fifo_remove(&rlist.r_queue))->p_state = THD_STATE_CURRENT; +#if CH_TIME_QUANTUM > 0 + rlist.r_preempt = CH_TIME_QUANTUM; +#endif + chDbgTrace(otp, currp); + chSysSwitchI(otp, currp); + } +} + +/** @} */ diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c index b4ff0d9bc..7af52d8b6 100644 --- a/os/kernel/src/chsem.c +++ b/os/kernel/src/chsem.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/kernel/src/chsys.c b/os/kernel/src/chsys.c index 8c252609d..2003f690b 100644 --- a/os/kernel/src/chsys.c +++ b/os/kernel/src/chsys.c @@ -1,130 +1,130 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file chsys.c - * @brief System related code. - * - * @addtogroup system - * @{ - */ - -#include "ch.h" - -static WORKING_AREA(idle_thread_wa, IDLE_THREAD_STACK_SIZE); - -/** - * @brief This function implements the idle thread infinite loop. - * @details The function puts the processor in the lowest power mode capable - * to serve interrupts.
- * The priority is internally set to the minimum system value so - * that this thread is executed only if there are no other ready - * threads in the system. - * - * @param[in] p the thread parameter, unused in this scenario - */ -static void idle_thread(void *p) { - - (void)p; - while (TRUE) { - port_wait_for_interrupt(); - IDLE_LOOP_HOOK(); - } -} - -/** - * @brief ChibiOS/RT initialization. - * @details After executing this function the current instructions stream - * becomes the main thread. - * @note Interrupts should be still disabled when @p chSysInit() is invoked - * and are internally enabled. - * @note The main thread is created with priority @p NORMALPRIO. - */ -void chSysInit(void) { - static Thread mainthread; - - port_init(); - scheduler_init(); - vt_init(); -#if CH_USE_MEMCORE - core_init(); -#endif -#if CH_USE_HEAP - heap_init(); -#endif -#if CH_DBG_ENABLE_TRACE - trace_init(); -#endif - - /* Now this instructions flow becomes the main thread.*/ - (currp = init_thread(&mainthread, NORMALPRIO))->p_state = THD_STATE_CURRENT; - chSysEnable(); - - /* This thread has the lowest priority in the system, its role is just to - serve interrupts in its context while keeping the lowest energy saving - mode compatible with the system status.*/ - chThdCreateStatic(idle_thread_wa, sizeof(idle_thread_wa), IDLEPRIO, - (tfunc_t)idle_thread, NULL); -} - -/** - * @brief Handles time ticks for round robin preemption and timer increments. - * @details Decrements the remaining time quantum of the running thread - * and preempts it when the quantum is used up. Increments system - * time and manages the timers. - * - * @note The frequency of the timer determines the system tick granularity - * and, together with the @p CH_TIME_QUANTUM macro, the round robin - * interval. - */ -void chSysTimerHandlerI(void) { - -#if CH_TIME_QUANTUM > 0 - /* Running thread has not used up quantum yet? */ - if (rlist.r_preempt > 0) - /* Decrement remaining quantum.*/ - rlist.r_preempt--; -#endif -#if CH_DBG_THREADS_PROFILING - currp->p_time++; -#endif - chVTDoTickI(); -} - -#if CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED -void chSysLock(void) { - - chDbgAssert(currp->p_locks >= 0, - "chSysLock(), #1", - "negative nesting counter"); - if (currp->p_locks++ == 0) - port_lock(); -} - -void chSysUnlock(void) { - - chDbgAssert(currp->p_locks > 0, - "chSysUnlock(), #1", - "non-positive nesting counter"); - if (--currp->p_locks == 0) - port_unlock(); -} -#endif /* CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED */ - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file chsys.c + * @brief System related code. + * + * @addtogroup system + * @{ + */ + +#include "ch.h" + +static WORKING_AREA(idle_thread_wa, IDLE_THREAD_STACK_SIZE); + +/** + * @brief This function implements the idle thread infinite loop. + * @details The function puts the processor in the lowest power mode capable + * to serve interrupts.
+ * The priority is internally set to the minimum system value so + * that this thread is executed only if there are no other ready + * threads in the system. + * + * @param[in] p the thread parameter, unused in this scenario + */ +static void idle_thread(void *p) { + + (void)p; + while (TRUE) { + port_wait_for_interrupt(); + IDLE_LOOP_HOOK(); + } +} + +/** + * @brief ChibiOS/RT initialization. + * @details After executing this function the current instructions stream + * becomes the main thread. + * @note Interrupts should be still disabled when @p chSysInit() is invoked + * and are internally enabled. + * @note The main thread is created with priority @p NORMALPRIO. + */ +void chSysInit(void) { + static Thread mainthread; + + port_init(); + scheduler_init(); + vt_init(); +#if CH_USE_MEMCORE + core_init(); +#endif +#if CH_USE_HEAP + heap_init(); +#endif +#if CH_DBG_ENABLE_TRACE + trace_init(); +#endif + + /* Now this instructions flow becomes the main thread.*/ + (currp = init_thread(&mainthread, NORMALPRIO))->p_state = THD_STATE_CURRENT; + chSysEnable(); + + /* This thread has the lowest priority in the system, its role is just to + serve interrupts in its context while keeping the lowest energy saving + mode compatible with the system status.*/ + chThdCreateStatic(idle_thread_wa, sizeof(idle_thread_wa), IDLEPRIO, + (tfunc_t)idle_thread, NULL); +} + +/** + * @brief Handles time ticks for round robin preemption and timer increments. + * @details Decrements the remaining time quantum of the running thread + * and preempts it when the quantum is used up. Increments system + * time and manages the timers. + * + * @note The frequency of the timer determines the system tick granularity + * and, together with the @p CH_TIME_QUANTUM macro, the round robin + * interval. + */ +void chSysTimerHandlerI(void) { + +#if CH_TIME_QUANTUM > 0 + /* Running thread has not used up quantum yet? */ + if (rlist.r_preempt > 0) + /* Decrement remaining quantum.*/ + rlist.r_preempt--; +#endif +#if CH_DBG_THREADS_PROFILING + currp->p_time++; +#endif + chVTDoTickI(); +} + +#if CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED +void chSysLock(void) { + + chDbgAssert(currp->p_locks >= 0, + "chSysLock(), #1", + "negative nesting counter"); + if (currp->p_locks++ == 0) + port_lock(); +} + +void chSysUnlock(void) { + + chDbgAssert(currp->p_locks > 0, + "chSysUnlock(), #1", + "non-positive nesting counter"); + if (--currp->p_locks == 0) + port_unlock(); +} +#endif /* CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED */ + +/** @} */ diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c index 6f67f7093..79ea23f94 100644 --- a/os/kernel/src/chthreads.c +++ b/os/kernel/src/chthreads.c @@ -1,446 +1,446 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file chthreads.c - * @brief Threads code. - * - * @addtogroup threads - * @{ - */ - -#include "ch.h" - -/** - * @brief Initializes a thread structure. - * - * @param[in] tp pointer to the thread - * @param[in] prio the priority level for the new thread - * @return The same thread pointer passed as parameter. - */ -Thread *init_thread(Thread *tp, tprio_t prio) { - - tp->p_flags = THD_MEM_MODE_STATIC; - tp->p_prio = prio; - tp->p_state = THD_STATE_SUSPENDED; -#if CH_USE_REGISTRY - REG_INSERT(tp); -#endif -#if CH_USE_DYNAMIC - tp->p_refs = 1; -#endif -#if CH_USE_NESTED_LOCKS - tp->p_locks = 0; -#endif -#if CH_DBG_THREADS_PROFILING - tp->p_time = 0; -#endif -#if CH_USE_MUTEXES - tp->p_realprio = prio; - tp->p_mtxlist = NULL; -#endif -#if CH_USE_WAITEXIT - list_init(&tp->p_waiting); -#endif -#if CH_USE_MESSAGES - queue_init(&tp->p_msgqueue); -#endif -#if CH_USE_EVENTS - tp->p_epending = 0; -#endif - THREAD_EXT_INIT(tp); - return tp; -} - -#if CH_DBG_FILL_THREADS -static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) { - - while (startp < endp) - *startp++ = v; -} -#endif - -/** - * @brief Initializes a new thread. - * @details The new thread is initialized but not inserted in the ready list, - * the initial state is @p THD_STATE_SUSPENDED. - * @note A thread can terminate by calling @p chThdExit() or by simply - * returning from its main function. - * @note This function can be invoked from within an interrupt handler - * even if it is not an I-Class API because it does not touch - * any critical kernel data structure. - * - * @param[out] wsp pointer to a working area dedicated to the thread stack - * @param[in] size size of the working area - * @param[in] prio the priority level for the new thread - * @param[in] pf the thread function - * @param[in] arg an argument passed to the thread function. It can be - * @p NULL. - * @return The pointer to the @p Thread structure allocated for - * the thread into the working space area. - */ -Thread *chThdInit(void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg) { - /* Thread structure is layed out in the lower part of the thread workspace */ - Thread *tp = wsp; - - chDbgCheck((wsp != NULL) && (size >= THD_WA_SIZE(0)) && - (prio <= HIGHPRIO) && (pf != NULL), - "chThdInit"); -#if CH_DBG_FILL_THREADS - memfill((uint8_t *)wsp, (uint8_t *)wsp + sizeof(Thread), THREAD_FILL_VALUE); - memfill((uint8_t *)wsp + sizeof(Thread), - (uint8_t *)wsp + size, STACK_FILL_VALUE); -#endif - SETUP_CONTEXT(wsp, size, pf, arg); - return init_thread(tp, prio); -} - -/** - * @brief Creates a new thread into a static memory area. - * @note A thread can terminate by calling @p chThdExit() or by simply - * returning from its main function. - * - * @param[out] wsp pointer to a working area dedicated to the thread stack - * @param[in] size size of the working area - * @param[in] prio the priority level for the new thread - * @param[in] pf the thread function - * @param[in] arg an argument passed to the thread function. It can be - * @p NULL. - * @return The pointer to the @p Thread structure allocated for - * the thread into the working space area. - */ -Thread *chThdCreateStatic(void *wsp, size_t size, - tprio_t prio, tfunc_t pf, void *arg) { - - return chThdResume(chThdInit(wsp, size, prio, pf, arg)); -} - -#if CH_USE_DYNAMIC && CH_USE_HEAP -/** - * @brief Creates a new thread allocating the memory from the heap. - * @note A thread can terminate by calling @p chThdExit() or by simply - * returning from its main function. - * @note The memory allocated for the thread is not released when the thread - * terminates but when a @p chThdWait() is performed. - * @note The function is available only if the @p CH_USE_DYNAMIC, - * @p CH_USE_HEAP and @p CH_USE_WAITEXIT options are enabled - * in @p chconf.h. - * - * @param[in] heapp heap from which allocate the memory or @p NULL for the - * default heap - * @param[in] size size of the working area to be allocated - * @param[in] prio the priority level for the new thread - * @param[in] pf the thread function - * @param[in] arg an argument passed to the thread function. It can be - * @p NULL. - * @return The pointer to the @p Thread structure allocated for - * the thread into the working space area. - * @retval NULL if the memory cannot be allocated. - */ -Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, - tprio_t prio, tfunc_t pf, void *arg) { - void *wsp; - Thread *tp; - - wsp = chHeapAlloc(heapp, size); - if (wsp == NULL) - return NULL; - tp = chThdInit(wsp, size, prio, pf, arg); - tp->p_flags = THD_MEM_MODE_HEAP; - return chThdResume(tp); -} -#endif /* CH_USE_DYNAMIC && CH_USE_HEAP */ - -#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS -/** - * @brief Creates a new thread allocating the memory from the specified - * Memory Pool. - * @note A thread can terminate by calling @p chThdExit() or by simply - * returning from its main function. - * @note The memory allocated for the thread is not released when the thread - * terminates but when a @p chThdWait() is performed. - * @note The function is available only if the @p CH_USE_DYNAMIC, - * @p CH_USE_MEMPOOLS and @p CH_USE_WAITEXIT options are enabled - * in @p chconf.h. - * - * @param[in] mp pointer to the memory pool object - * @param[in] prio the priority level for the new thread - * @param[in] pf the thread function - * @param[in] arg an argument passed to the thread function. It can be - * @p NULL. - * @return The pointer to the @p Thread structure allocated for - * the thread into the working space area. - * @retval NULL if the memory pool is empty. - */ -Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, - tfunc_t pf, void *arg) { - void *wsp; - Thread *tp; - - chDbgCheck(mp != NULL, "chThdCreateFromMemoryPool"); - - wsp = chPoolAlloc(mp); - if (wsp == NULL) - return NULL; - tp = chThdInit(wsp, mp->mp_object_size, prio, pf, arg); - tp->p_flags = THD_MEM_MODE_MEMPOOL; - tp->p_mpool = mp; - return chThdResume(tp); -} -#endif /* CH_USE_DYNAMIC && CH_USE_MEMPOOLS */ - -/** - * @brief Changes the running thread priority level then reschedules if - * necessary. - * @note The function returns the real thread priority regardless of the - * current priority that could be higher than the real priority - * because the priority inheritance mechanism. - * - * @param[in] newprio the new priority level of the running thread - * @return The old priority level. - */ -tprio_t chThdSetPriority(tprio_t newprio) { - tprio_t oldprio; - - chDbgCheck((newprio >= LOWPRIO) && (newprio <= HIGHPRIO), - "chThdSetPriority"); - - chSysLock(); -#if CH_USE_MUTEXES - oldprio = currp->p_realprio; - if ((currp->p_prio == currp->p_realprio) || (newprio > currp->p_prio)) - currp->p_prio = newprio; - currp->p_realprio = newprio; -#else - oldprio = currp->p_prio; - currp->p_prio = newprio; -#endif - chSchRescheduleS(); - chSysUnlock(); - return oldprio; -} - -/** - * @brief Resumes a suspended thread. - * @note Use this function to resume threads created with @p chThdInit(). - * - * @param[in] tp pointer to the thread - * @return The pointer to the thread. - */ -Thread *chThdResume(Thread *tp) { - - chSysLock(); - chDbgAssert(tp->p_state == THD_STATE_SUSPENDED, - "chThdResume(), #1", - "thread not in THD_STATE_SUSPENDED state"); - chSchWakeupS(tp, RDY_OK); - chSysUnlock(); - return tp; -} - -/** - * @brief Requests a thread termination. - * @note The thread is not terminated but a termination request is added to - * its @p p_flags field. The thread can read this status by - * invoking @p chThdShouldTerminate() and then terminate cleanly. - * - * @param[in] tp pointer to the thread - */ -void chThdTerminate(Thread *tp) { - - chSysLock(); - tp->p_flags |= THD_TERMINATE; - chSysUnlock(); -} - -/** - * @brief Suspends the invoking thread for the specified time. - * - * @param[in] time the delay in system ticks, the special values are - * handled as follow: - * - @a TIME_INFINITE the thread enters an infinite sleep - * state. - * - @a TIME_IMMEDIATE this value is accepted but - * interpreted as a normal time specification not as an - * immediate timeout specification. - * . - */ -void chThdSleep(systime_t time) { - - chDbgCheck(time != TIME_INFINITE, "chThdSleep"); - - chSysLock(); - chThdSleepS(time); - chSysUnlock(); -} - -/** - * @brief Suspends the invoking thread until the system time arrives to the - * specified value. - * - * @param[in] time absolute system time - */ -void chThdSleepUntil(systime_t time) { - - chSysLock(); - if ((time -= chTimeNow()) > 0) - chThdSleepS(time); - chSysUnlock(); -} - -/** - * @brief Yields the time slot. - * @details Yields the CPU control to the next thread in the ready list with - * equal priority, if any. - */ -void chThdYield(void) { - - chSysLock(); - chSchDoYieldS(); - chSysUnlock(); -} - -/** - * @brief Terminates the current thread by specifying an exit status code. - * - * @param[in] msg thread exit code. The code can be retrieved by using - * @p chThdWait(). - */ -void chThdExit(msg_t msg) { - Thread *tp = currp; - - chSysLock(); - tp->p_u.exitcode = msg; - THREAD_EXT_EXIT(tp); -#if CH_USE_WAITEXIT - while (notempty(&tp->p_waiting)) - chSchReadyI(list_remove(&tp->p_waiting)); -#endif -#if CH_USE_REGISTRY - REG_REMOVE(tp); -#endif - chSchGoSleepS(THD_STATE_FINAL); -} - -#if CH_USE_DYNAMIC || defined(__DOXYGEN__) -/** - * @brief Adds a reference to a thread object. - * - * @param[in] tp pointer to the thread - * @return The same thread pointer passed as parameter - * representing the new reference. - */ -Thread *chThdAddRef(Thread *tp) { - - chSysLock(); - chDbgAssert(tp->p_refs < 255, "chThdAddRef(), #1", "too many references"); - tp->p_refs++; - chSysUnlock(); - return tp; -} - -/** - * @brief Releases a reference to a thread object. - * @details If the references counter reaches zero and the thread - * is in the @p THD_STATE_FINAL state then the thread's memory is - * returned to the proper allocator. - * @note Static threads are not affected. - * - * @param[in] tp pointer to the thread - */ -void chThdRelease(Thread *tp) { - trefs_t refs; - - chSysLock(); - chDbgAssert(tp->p_refs > 0, "chThdRelease(), #1", "not referenced"); - refs = --tp->p_refs; - chSysUnlock(); - - /* If the references counter reaches zero then the memory can be returned - to the proper allocator. Of course static threads are not affected.*/ - if (refs == 0) { - switch (tp->p_flags & THD_MEM_MODE_MASK) { -#if CH_USE_HEAP - case THD_MEM_MODE_HEAP: - chHeapFree(tp); - break; -#endif -#if CH_USE_MEMPOOLS - case THD_MEM_MODE_MEMPOOL: - chPoolFree(tp->p_mpool, tp); - break; -#endif - } - } -} -#endif /* CH_USE_DYNAMIC */ - -#if CH_USE_WAITEXIT || defined(__DOXYGEN__) -/** - * @brief Blocks the execution of the invoking thread until the specified - * thread terminates then the exit code is returned. - * @details This function waits for the specified thread to terminate then - * decrements its reference counter, if the counter reaches zero then - * the thread working area is returned to the proper allocator.
- * The memory used by the exited thread is handled in different ways - * depending on the API that spawned the thread: - * - If the thread was spawned by @p chThdCreateStatic() or by - * @p chThdInit() then nothing happens and the thread working area - * is not released or modified in any way. This is the default, - * totally static, behavior. - * - If the thread was spawned by @p chThdCreateFromHeap() then - * the working area is returned to the system heap. - * - If the thread was spawned by @p chThdCreateFromMemoryPool() - * then the working area is returned to the owning memory pool. - * . - * Please read the @ref article_lifecycle article for more details. - * @note After invoking @p chThdWait() the thread pointer becomes invalid - * and must not be used as parameter for further system calls. - * @note The function is available only if the @p CH_USE_WAITEXIT - * option is enabled in @p chconf.h. - * @note If @p CH_USE_DYNAMIC is not specified this function just waits for - * the thread termination, no memory allocators are involved. - * - * @param[in] tp pointer to the thread - * @return The exit code from the terminated thread. - */ -msg_t chThdWait(Thread *tp) { - msg_t msg; - - chDbgCheck(tp != NULL, "chThdWait"); - - chSysLock(); - chDbgAssert(tp != currp, "chThdWait(), #1", "waiting self"); -#if CH_USE_DYNAMIC - chDbgAssert(tp->p_refs > 0, "chThdWait(), #2", "not referenced"); -#endif - if (tp->p_state != THD_STATE_FINAL) { - list_insert(currp, &tp->p_waiting); - chSchGoSleepS(THD_STATE_WTEXIT); - } - msg = tp->p_u.exitcode; - chSysUnlock(); -#if CH_USE_DYNAMIC - chThdRelease(tp); -#endif - return msg; -} -#endif /* CH_USE_WAITEXIT */ - -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file chthreads.c + * @brief Threads code. + * + * @addtogroup threads + * @{ + */ + +#include "ch.h" + +/** + * @brief Initializes a thread structure. + * + * @param[in] tp pointer to the thread + * @param[in] prio the priority level for the new thread + * @return The same thread pointer passed as parameter. + */ +Thread *init_thread(Thread *tp, tprio_t prio) { + + tp->p_flags = THD_MEM_MODE_STATIC; + tp->p_prio = prio; + tp->p_state = THD_STATE_SUSPENDED; +#if CH_USE_REGISTRY + REG_INSERT(tp); +#endif +#if CH_USE_DYNAMIC + tp->p_refs = 1; +#endif +#if CH_USE_NESTED_LOCKS + tp->p_locks = 0; +#endif +#if CH_DBG_THREADS_PROFILING + tp->p_time = 0; +#endif +#if CH_USE_MUTEXES + tp->p_realprio = prio; + tp->p_mtxlist = NULL; +#endif +#if CH_USE_WAITEXIT + list_init(&tp->p_waiting); +#endif +#if CH_USE_MESSAGES + queue_init(&tp->p_msgqueue); +#endif +#if CH_USE_EVENTS + tp->p_epending = 0; +#endif + THREAD_EXT_INIT(tp); + return tp; +} + +#if CH_DBG_FILL_THREADS +static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) { + + while (startp < endp) + *startp++ = v; +} +#endif + +/** + * @brief Initializes a new thread. + * @details The new thread is initialized but not inserted in the ready list, + * the initial state is @p THD_STATE_SUSPENDED. + * @note A thread can terminate by calling @p chThdExit() or by simply + * returning from its main function. + * @note This function can be invoked from within an interrupt handler + * even if it is not an I-Class API because it does not touch + * any critical kernel data structure. + * + * @param[out] wsp pointer to a working area dedicated to the thread stack + * @param[in] size size of the working area + * @param[in] prio the priority level for the new thread + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be + * @p NULL. + * @return The pointer to the @p Thread structure allocated for + * the thread into the working space area. + */ +Thread *chThdInit(void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg) { + /* Thread structure is layed out in the lower part of the thread workspace */ + Thread *tp = wsp; + + chDbgCheck((wsp != NULL) && (size >= THD_WA_SIZE(0)) && + (prio <= HIGHPRIO) && (pf != NULL), + "chThdInit"); +#if CH_DBG_FILL_THREADS + memfill((uint8_t *)wsp, (uint8_t *)wsp + sizeof(Thread), THREAD_FILL_VALUE); + memfill((uint8_t *)wsp + sizeof(Thread), + (uint8_t *)wsp + size, STACK_FILL_VALUE); +#endif + SETUP_CONTEXT(wsp, size, pf, arg); + return init_thread(tp, prio); +} + +/** + * @brief Creates a new thread into a static memory area. + * @note A thread can terminate by calling @p chThdExit() or by simply + * returning from its main function. + * + * @param[out] wsp pointer to a working area dedicated to the thread stack + * @param[in] size size of the working area + * @param[in] prio the priority level for the new thread + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be + * @p NULL. + * @return The pointer to the @p Thread structure allocated for + * the thread into the working space area. + */ +Thread *chThdCreateStatic(void *wsp, size_t size, + tprio_t prio, tfunc_t pf, void *arg) { + + return chThdResume(chThdInit(wsp, size, prio, pf, arg)); +} + +#if CH_USE_DYNAMIC && CH_USE_HEAP +/** + * @brief Creates a new thread allocating the memory from the heap. + * @note A thread can terminate by calling @p chThdExit() or by simply + * returning from its main function. + * @note The memory allocated for the thread is not released when the thread + * terminates but when a @p chThdWait() is performed. + * @note The function is available only if the @p CH_USE_DYNAMIC, + * @p CH_USE_HEAP and @p CH_USE_WAITEXIT options are enabled + * in @p chconf.h. + * + * @param[in] heapp heap from which allocate the memory or @p NULL for the + * default heap + * @param[in] size size of the working area to be allocated + * @param[in] prio the priority level for the new thread + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be + * @p NULL. + * @return The pointer to the @p Thread structure allocated for + * the thread into the working space area. + * @retval NULL if the memory cannot be allocated. + */ +Thread *chThdCreateFromHeap(MemoryHeap *heapp, size_t size, + tprio_t prio, tfunc_t pf, void *arg) { + void *wsp; + Thread *tp; + + wsp = chHeapAlloc(heapp, size); + if (wsp == NULL) + return NULL; + tp = chThdInit(wsp, size, prio, pf, arg); + tp->p_flags = THD_MEM_MODE_HEAP; + return chThdResume(tp); +} +#endif /* CH_USE_DYNAMIC && CH_USE_HEAP */ + +#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS +/** + * @brief Creates a new thread allocating the memory from the specified + * Memory Pool. + * @note A thread can terminate by calling @p chThdExit() or by simply + * returning from its main function. + * @note The memory allocated for the thread is not released when the thread + * terminates but when a @p chThdWait() is performed. + * @note The function is available only if the @p CH_USE_DYNAMIC, + * @p CH_USE_MEMPOOLS and @p CH_USE_WAITEXIT options are enabled + * in @p chconf.h. + * + * @param[in] mp pointer to the memory pool object + * @param[in] prio the priority level for the new thread + * @param[in] pf the thread function + * @param[in] arg an argument passed to the thread function. It can be + * @p NULL. + * @return The pointer to the @p Thread structure allocated for + * the thread into the working space area. + * @retval NULL if the memory pool is empty. + */ +Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio, + tfunc_t pf, void *arg) { + void *wsp; + Thread *tp; + + chDbgCheck(mp != NULL, "chThdCreateFromMemoryPool"); + + wsp = chPoolAlloc(mp); + if (wsp == NULL) + return NULL; + tp = chThdInit(wsp, mp->mp_object_size, prio, pf, arg); + tp->p_flags = THD_MEM_MODE_MEMPOOL; + tp->p_mpool = mp; + return chThdResume(tp); +} +#endif /* CH_USE_DYNAMIC && CH_USE_MEMPOOLS */ + +/** + * @brief Changes the running thread priority level then reschedules if + * necessary. + * @note The function returns the real thread priority regardless of the + * current priority that could be higher than the real priority + * because the priority inheritance mechanism. + * + * @param[in] newprio the new priority level of the running thread + * @return The old priority level. + */ +tprio_t chThdSetPriority(tprio_t newprio) { + tprio_t oldprio; + + chDbgCheck((newprio >= LOWPRIO) && (newprio <= HIGHPRIO), + "chThdSetPriority"); + + chSysLock(); +#if CH_USE_MUTEXES + oldprio = currp->p_realprio; + if ((currp->p_prio == currp->p_realprio) || (newprio > currp->p_prio)) + currp->p_prio = newprio; + currp->p_realprio = newprio; +#else + oldprio = currp->p_prio; + currp->p_prio = newprio; +#endif + chSchRescheduleS(); + chSysUnlock(); + return oldprio; +} + +/** + * @brief Resumes a suspended thread. + * @note Use this function to resume threads created with @p chThdInit(). + * + * @param[in] tp pointer to the thread + * @return The pointer to the thread. + */ +Thread *chThdResume(Thread *tp) { + + chSysLock(); + chDbgAssert(tp->p_state == THD_STATE_SUSPENDED, + "chThdResume(), #1", + "thread not in THD_STATE_SUSPENDED state"); + chSchWakeupS(tp, RDY_OK); + chSysUnlock(); + return tp; +} + +/** + * @brief Requests a thread termination. + * @note The thread is not terminated but a termination request is added to + * its @p p_flags field. The thread can read this status by + * invoking @p chThdShouldTerminate() and then terminate cleanly. + * + * @param[in] tp pointer to the thread + */ +void chThdTerminate(Thread *tp) { + + chSysLock(); + tp->p_flags |= THD_TERMINATE; + chSysUnlock(); +} + +/** + * @brief Suspends the invoking thread for the specified time. + * + * @param[in] time the delay in system ticks, the special values are + * handled as follow: + * - @a TIME_INFINITE the thread enters an infinite sleep + * state. + * - @a TIME_IMMEDIATE this value is accepted but + * interpreted as a normal time specification not as an + * immediate timeout specification. + * . + */ +void chThdSleep(systime_t time) { + + chDbgCheck(time != TIME_INFINITE, "chThdSleep"); + + chSysLock(); + chThdSleepS(time); + chSysUnlock(); +} + +/** + * @brief Suspends the invoking thread until the system time arrives to the + * specified value. + * + * @param[in] time absolute system time + */ +void chThdSleepUntil(systime_t time) { + + chSysLock(); + if ((time -= chTimeNow()) > 0) + chThdSleepS(time); + chSysUnlock(); +} + +/** + * @brief Yields the time slot. + * @details Yields the CPU control to the next thread in the ready list with + * equal priority, if any. + */ +void chThdYield(void) { + + chSysLock(); + chSchDoYieldS(); + chSysUnlock(); +} + +/** + * @brief Terminates the current thread by specifying an exit status code. + * + * @param[in] msg thread exit code. The code can be retrieved by using + * @p chThdWait(). + */ +void chThdExit(msg_t msg) { + Thread *tp = currp; + + chSysLock(); + tp->p_u.exitcode = msg; + THREAD_EXT_EXIT(tp); +#if CH_USE_WAITEXIT + while (notempty(&tp->p_waiting)) + chSchReadyI(list_remove(&tp->p_waiting)); +#endif +#if CH_USE_REGISTRY + REG_REMOVE(tp); +#endif + chSchGoSleepS(THD_STATE_FINAL); +} + +#if CH_USE_DYNAMIC || defined(__DOXYGEN__) +/** + * @brief Adds a reference to a thread object. + * + * @param[in] tp pointer to the thread + * @return The same thread pointer passed as parameter + * representing the new reference. + */ +Thread *chThdAddRef(Thread *tp) { + + chSysLock(); + chDbgAssert(tp->p_refs < 255, "chThdAddRef(), #1", "too many references"); + tp->p_refs++; + chSysUnlock(); + return tp; +} + +/** + * @brief Releases a reference to a thread object. + * @details If the references counter reaches zero and the thread + * is in the @p THD_STATE_FINAL state then the thread's memory is + * returned to the proper allocator. + * @note Static threads are not affected. + * + * @param[in] tp pointer to the thread + */ +void chThdRelease(Thread *tp) { + trefs_t refs; + + chSysLock(); + chDbgAssert(tp->p_refs > 0, "chThdRelease(), #1", "not referenced"); + refs = --tp->p_refs; + chSysUnlock(); + + /* If the references counter reaches zero then the memory can be returned + to the proper allocator. Of course static threads are not affected.*/ + if (refs == 0) { + switch (tp->p_flags & THD_MEM_MODE_MASK) { +#if CH_USE_HEAP + case THD_MEM_MODE_HEAP: + chHeapFree(tp); + break; +#endif +#if CH_USE_MEMPOOLS + case THD_MEM_MODE_MEMPOOL: + chPoolFree(tp->p_mpool, tp); + break; +#endif + } + } +} +#endif /* CH_USE_DYNAMIC */ + +#if CH_USE_WAITEXIT || defined(__DOXYGEN__) +/** + * @brief Blocks the execution of the invoking thread until the specified + * thread terminates then the exit code is returned. + * @details This function waits for the specified thread to terminate then + * decrements its reference counter, if the counter reaches zero then + * the thread working area is returned to the proper allocator.
+ * The memory used by the exited thread is handled in different ways + * depending on the API that spawned the thread: + * - If the thread was spawned by @p chThdCreateStatic() or by + * @p chThdInit() then nothing happens and the thread working area + * is not released or modified in any way. This is the default, + * totally static, behavior. + * - If the thread was spawned by @p chThdCreateFromHeap() then + * the working area is returned to the system heap. + * - If the thread was spawned by @p chThdCreateFromMemoryPool() + * then the working area is returned to the owning memory pool. + * . + * Please read the @ref article_lifecycle article for more details. + * @note After invoking @p chThdWait() the thread pointer becomes invalid + * and must not be used as parameter for further system calls. + * @note The function is available only if the @p CH_USE_WAITEXIT + * option is enabled in @p chconf.h. + * @note If @p CH_USE_DYNAMIC is not specified this function just waits for + * the thread termination, no memory allocators are involved. + * + * @param[in] tp pointer to the thread + * @return The exit code from the terminated thread. + */ +msg_t chThdWait(Thread *tp) { + msg_t msg; + + chDbgCheck(tp != NULL, "chThdWait"); + + chSysLock(); + chDbgAssert(tp != currp, "chThdWait(), #1", "waiting self"); +#if CH_USE_DYNAMIC + chDbgAssert(tp->p_refs > 0, "chThdWait(), #2", "not referenced"); +#endif + if (tp->p_state != THD_STATE_FINAL) { + list_insert(currp, &tp->p_waiting); + chSchGoSleepS(THD_STATE_WTEXIT); + } + msg = tp->p_u.exitcode; + chSysUnlock(); +#if CH_USE_DYNAMIC + chThdRelease(tp); +#endif + return msg; +} +#endif /* CH_USE_WAITEXIT */ + +/** @} */ diff --git a/os/kernel/src/chvt.c b/os/kernel/src/chvt.c index 9558a1cb7..b48e7f4f4 100644 --- a/os/kernel/src/chvt.c +++ b/os/kernel/src/chvt.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -28,7 +28,7 @@ #include "ch.h" /** - * @brief Virtual timers delta list header. + * @brief Virtual timers delta list header. */ VTList vtlist; diff --git a/os/kernel/templates/chconf.h b/os/kernel/templates/chconf.h index 6f8233b7f..02d38baf4 100644 --- a/os/kernel/templates/chconf.h +++ b/os/kernel/templates/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -404,7 +404,7 @@ * @brief Debug option, stacks initialization. * @details If enabled then the threads working area is filled with a byte * value when a thread is created. This can be useful for the - * runtime measurement of the used stack. + * runtime measurement of the used stack. * * @note The default is @p FALSE. */ diff --git a/os/kernel/templates/chcore.c b/os/kernel/templates/chcore.c index d1bad3c02..2bca5eb6c 100644 --- a/os/kernel/templates/chcore.c +++ b/os/kernel/templates/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -33,7 +33,7 @@ /** * @brief Port-related initialization code. - * @note This function is usually empty. + * @note This function is usually empty. */ void port_init(void) { } @@ -41,7 +41,7 @@ void port_init(void) { /** * @brief Kernel-lock action. * @details Usually this function just disables interrupts but may perform more - * actions. + * actions. */ void port_lock(void) { } @@ -74,20 +74,20 @@ void port_unlock_from_isr(void) { /** * @brief Disables all the interrupt sources. - * @note Of course non maskable interrupt sources are not included. + * @note Of course non maskable interrupt sources are not included. */ void port_disable(void) { } /** * @brief Disables the interrupt sources that are not supposed to preempt - * the kernel. + * the kernel. */ void port_suspend(void) { } /** - * @brief Enables all the interrupt sources. + * @brief Enables all the interrupt sources. */ void port_enable(void) { } @@ -97,7 +97,7 @@ void port_enable(void) { * @details The function is meant to return when an interrupt becomes pending. * The simplest implementation is an empty function or macro but this * would not take advantage of architecture-specific power saving - * modes. + * modes. */ void port_wait_for_interrupt(void) { } @@ -107,7 +107,7 @@ void port_wait_for_interrupt(void) { * @details This function is invoked by the operating system when an * unrecoverable error is detected (as example because a programming * error in the application code that triggers an assertion while in - * debug mode). + * debug mode). */ void port_halt(void) { diff --git a/os/kernel/templates/chcore.h b/os/kernel/templates/chcore.h index bf72fc042..0e78dbcf5 100644 --- a/os/kernel/templates/chcore.h +++ b/os/kernel/templates/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -41,7 +41,7 @@ #define CH_ARCHITECTURE_NAME "" /** - * @brief Name of the architecture variant (optional). + * @brief Name of the architecture variant (optional). */ #define CH_ARCHITECTURE_VARIANT_NAME "" @@ -144,7 +144,7 @@ struct context { /** * @brief IRQ handler function declaration. * @note @p id can be a function name or a vector number depending on the - * port implementation. + * port implementation. */ #define PORT_IRQ_HANDLER(id) void id(void) diff --git a/os/kernel/templates/chtypes.h b/os/kernel/templates/chtypes.h index f790d847c..5c771e999 100644 --- a/os/kernel/templates/chtypes.h +++ b/os/kernel/templates/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/AT91SAM7/vectors.s b/os/ports/GCC/ARM7/AT91SAM7/vectors.s index 29271daf1..ee0c01a19 100644 --- a/os/ports/GCC/ARM7/AT91SAM7/vectors.s +++ b/os/ports/GCC/ARM7/AT91SAM7/vectors.s @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/AT91SAM7/wfi.h b/os/ports/GCC/ARM7/AT91SAM7/wfi.h index 56b251957..76390d407 100644 --- a/os/ports/GCC/ARM7/AT91SAM7/wfi.h +++ b/os/ports/GCC/ARM7/AT91SAM7/wfi.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/LPC214x/vectors.s b/os/ports/GCC/ARM7/LPC214x/vectors.s index 016a2f1de..9f904ead9 100644 --- a/os/ports/GCC/ARM7/LPC214x/vectors.s +++ b/os/ports/GCC/ARM7/LPC214x/vectors.s @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/LPC214x/wfi.h b/os/ports/GCC/ARM7/LPC214x/wfi.h index bd3b5e7cd..1688c33f8 100644 --- a/os/ports/GCC/ARM7/LPC214x/wfi.h +++ b/os/ports/GCC/ARM7/LPC214x/wfi.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/chcore.c b/os/ports/GCC/ARM7/chcore.c index 582e16c62..4abd9cc2f 100644 --- a/os/ports/GCC/ARM7/chcore.c +++ b/os/ports/GCC/ARM7/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -27,7 +27,7 @@ #include "ch.h" /** - * Halts the system. + * Halts the system. */ /** @cond never */ __attribute__((weak)) diff --git a/os/ports/GCC/ARM7/chcore.h b/os/ports/GCC/ARM7/chcore.h index f32ec0293..4e5707a81 100644 --- a/os/ports/GCC/ARM7/chcore.h +++ b/os/ports/GCC/ARM7/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -28,7 +28,7 @@ #define _CHCORE_H_ /** - * If enabled allows the idle thread to enter a low power mode. + * If enabled allows the idle thread to enter a low power mode. */ #ifndef ENABLE_WFI_IDLE #define ENABLE_WFI_IDLE 0 @@ -162,7 +162,7 @@ struct context { * @note The THUMB implementation starts with ARM code because interrupt * vectors are always invoked in ARM mode regardless the bit 0 * value. The switch in THUMB mode is done in the function prologue so - * it is transparent to the user code. + * it is transparent to the user code. */ #ifdef THUMB #define PORT_IRQ_PROLOGUE() { \ diff --git a/os/ports/GCC/ARM7/chcoreasm.s b/os/ports/GCC/ARM7/chcoreasm.s index e172e3455..5e2029019 100644 --- a/os/ports/GCC/ARM7/chcoreasm.s +++ b/os/ports/GCC/ARM7/chcoreasm.s @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/chtypes.h b/os/ports/GCC/ARM7/chtypes.h index 3bd6319be..225263345 100644 --- a/os/ports/GCC/ARM7/chtypes.h +++ b/os/ports/GCC/ARM7/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/crt0.s b/os/ports/GCC/ARM7/crt0.s index ed798fc78..fa0812632 100644 --- a/os/ports/GCC/ARM7/crt0.s +++ b/os/ports/GCC/ARM7/crt0.s @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARM7/port.dox b/os/ports/GCC/ARM7/port.dox index 80027f700..563251790 100644 --- a/os/ports/GCC/ARM7/port.dox +++ b/os/ports/GCC/ARM7/port.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARMCM3/STM32F103/vectors.s b/os/ports/GCC/ARMCM3/STM32F103/vectors.s index a3cc8e651..58b0f8aea 100644 --- a/os/ports/GCC/ARMCM3/STM32F103/vectors.s +++ b/os/ports/GCC/ARMCM3/STM32F103/vectors.s @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARMCM3/chcore.c b/os/ports/GCC/ARMCM3/chcore.c index bcd726a7b..65f71f751 100644 --- a/os/ports/GCC/ARMCM3/chcore.c +++ b/os/ports/GCC/ARMCM3/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARMCM3/chcore.h b/os/ports/GCC/ARMCM3/chcore.h index 1b72a454d..b5d347a89 100644 --- a/os/ports/GCC/ARMCM3/chcore.h +++ b/os/ports/GCC/ARMCM3/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -207,7 +207,7 @@ struct context { /** * IRQ prologue code, inserted at the start of all IRQ handlers enabled to - * invoke system APIs. + * invoke system APIs. */ #define PORT_IRQ_PROLOGUE() @@ -233,7 +233,7 @@ struct context { #define port_init() /** - * Raises the base priority to kernel level. + * Raises the base priority to kernel level. */ #if CH_OPTIMIZE_SPEED #define port_lock() { \ diff --git a/os/ports/GCC/ARMCM3/chtypes.h b/os/ports/GCC/ARMCM3/chtypes.h index 1a854d209..f89ba4dc8 100644 --- a/os/ports/GCC/ARMCM3/chtypes.h +++ b/os/ports/GCC/ARMCM3/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/ARMCM3/cmsis/core_cm3.h b/os/ports/GCC/ARMCM3/cmsis/core_cm3.h index eaec52246..6c1ca9a56 100644 --- a/os/ports/GCC/ARMCM3/cmsis/core_cm3.h +++ b/os/ports/GCC/ARMCM3/cmsis/core_cm3.h @@ -1,23 +1,21 @@ -/****************************************************************************** - * @file: core_cm3.h - * @purpose: CMSIS Cortex-M3 Core Peripheral Access Layer Header File - * @version: V1.20.1 (ChibiOS/RT fixes) - * @date: 18. July 2009 - *---------------------------------------------------------------------------- - * - * Copyright (C) 2009 ARM Limited. All rights reserved. - * - * ARM Limited (ARM) is supplying this software for use with Cortex-Mx - * processor based microcontrollers. This file can be freely distributed - * within development tools that are supporting such ARM based processors. - * - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR - * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - * - ******************************************************************************/ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ /****************************************************************************** * ChibiOS/RT notes and fixes: diff --git a/os/ports/GCC/ARMCM3/crt0.s b/os/ports/GCC/ARMCM3/crt0.s index 81da94c2c..792ae1534 100644 --- a/os/ports/GCC/ARMCM3/crt0.s +++ b/os/ports/GCC/ARMCM3/crt0.s @@ -1,128 +1,128 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file ARMCM3/crt0.s - * @brief Generic ARM Cortex-M3 startup file for ChibiOS/RT. - * @addtogroup ARMCM3_CORE - * @{ - */ -/** @cond never */ - -.set CONTROL_MODE_PRIVILEGED, 0 -.set CONTROL_MODE_UNPRIVILEGED, 1 -.set CONTROL_USE_MSP, 0 -.set CONTROL_USE_PSP, 2 - -.text -.balign 2 -.syntax unified -.thumb - -/* - * Reset handler. - */ -.thumb_func -.global ResetHandler -.weak ResetHandler -ResetHandler: - /* Interrupts globally masked. */ - cpsid i - /* - * Stack pointers initialization. - */ - ldr r0, =__ram_end__ - ldr r1, =__main_stack_size__ - sub r0, r0, r1 - /* { r0 = main stack low address } */ - msr PSP, r0 - /* Early initialization. */ - bl hwinit0 - /* - * Data initialization. - * NOTE: It assumes that the DATA size is a multiple of 4. - */ - ldr r1, =_textdata - ldr r2, =_data - ldr r3, =_edata -dloop: - cmp r2, r3 - ittt lo - ldrlo r0, [r1], #4 - strlo r0, [r2], #4 - blo dloop - /* - * BSS initialization. - * NOTE: It assumes that the BSS size is a multiple of 4. - */ - movs r0, #0 - ldr r1, =_bss_start - ldr r2, =_bss_end -bloop: - cmp r1, r2 - itt lo - strlo r0, [r1], #4 - blo bloop - /* Switches to the Process Stack. */ - movs r0, #CONTROL_MODE_PRIVILEGED | CONTROL_USE_PSP - msr CONTROL, r0 - isb - /* Late initialization. */ - bl hwinit1 - movs r0, #0 - mov r1, r0 - bl main - b MainExitHandler - -/* - * Default main exit code, just a loop. - * It is a weak symbol, the application code can redefine the behavior. - */ -.thumb_func -.global MainExitHandler -.weak MainExitHandler -MainExitHandler: -.loop: b .loop - -/* - * Default early initialization code. It is declared weak in order to be - * replaced by the real initialization code. - * Early initialization is performed just after reset before BSS and DATA - * segments initialization. - */ -.thumb_func -.global hwinit0 -.weak hwinit0 -hwinit0: - bx lr - -/* - * Default late initialization code. It is declared weak in order to be - * replaced by the real initialization code. - * Late initialization is performed after BSS and DATA segments initialization - * and before invoking the main() function. - */ -.thumb_func -.global hwinit1 -.weak hwinit1 -hwinit1: - bx lr - -/** @endcond */ -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file ARMCM3/crt0.s + * @brief Generic ARM Cortex-M3 startup file for ChibiOS/RT. + * @addtogroup ARMCM3_CORE + * @{ + */ +/** @cond never */ + +.set CONTROL_MODE_PRIVILEGED, 0 +.set CONTROL_MODE_UNPRIVILEGED, 1 +.set CONTROL_USE_MSP, 0 +.set CONTROL_USE_PSP, 2 + +.text +.balign 2 +.syntax unified +.thumb + +/* + * Reset handler. + */ +.thumb_func +.global ResetHandler +.weak ResetHandler +ResetHandler: + /* Interrupts globally masked. */ + cpsid i + /* + * Stack pointers initialization. + */ + ldr r0, =__ram_end__ + ldr r1, =__main_stack_size__ + sub r0, r0, r1 + /* { r0 = main stack low address } */ + msr PSP, r0 + /* Early initialization. */ + bl hwinit0 + /* + * Data initialization. + * NOTE: It assumes that the DATA size is a multiple of 4. + */ + ldr r1, =_textdata + ldr r2, =_data + ldr r3, =_edata +dloop: + cmp r2, r3 + ittt lo + ldrlo r0, [r1], #4 + strlo r0, [r2], #4 + blo dloop + /* + * BSS initialization. + * NOTE: It assumes that the BSS size is a multiple of 4. + */ + movs r0, #0 + ldr r1, =_bss_start + ldr r2, =_bss_end +bloop: + cmp r1, r2 + itt lo + strlo r0, [r1], #4 + blo bloop + /* Switches to the Process Stack. */ + movs r0, #CONTROL_MODE_PRIVILEGED | CONTROL_USE_PSP + msr CONTROL, r0 + isb + /* Late initialization. */ + bl hwinit1 + movs r0, #0 + mov r1, r0 + bl main + b MainExitHandler + +/* + * Default main exit code, just a loop. + * It is a weak symbol, the application code can redefine the behavior. + */ +.thumb_func +.global MainExitHandler +.weak MainExitHandler +MainExitHandler: +.loop: b .loop + +/* + * Default early initialization code. It is declared weak in order to be + * replaced by the real initialization code. + * Early initialization is performed just after reset before BSS and DATA + * segments initialization. + */ +.thumb_func +.global hwinit0 +.weak hwinit0 +hwinit0: + bx lr + +/* + * Default late initialization code. It is declared weak in order to be + * replaced by the real initialization code. + * Late initialization is performed after BSS and DATA segments initialization + * and before invoking the main() function. + */ +.thumb_func +.global hwinit1 +.weak hwinit1 +hwinit1: + bx lr + +/** @endcond */ +/** @} */ diff --git a/os/ports/GCC/ARMCM3/nvic.c b/os/ports/GCC/ARMCM3/nvic.c index 9fbf40044..44a80584a 100644 --- a/os/ports/GCC/ARMCM3/nvic.c +++ b/os/ports/GCC/ARMCM3/nvic.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -59,10 +59,10 @@ void NVICDisableVector(uint32_t n) { /** * @brief Changes the priority of a system handler. - * - * @param handler the system handler number + * + * @param handler the system handler number * @param prio the system handler priority - * @note The parameters are not tested for correctness. + * @note The parameters are not tested for correctness. */ void NVICSetSystemHandlerPriority(uint32_t handler, uint32_t prio) { unsigned sh = (handler & 3) * 8; diff --git a/os/ports/GCC/ARMCM3/nvic.h b/os/ports/GCC/ARMCM3/nvic.h index ff4bfa34f..0538af307 100644 --- a/os/ports/GCC/ARMCM3/nvic.h +++ b/os/ports/GCC/ARMCM3/nvic.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -28,7 +28,7 @@ #define _NVIC_H_ /* - * System vector constants for @p NVICSetSystemHandlerPriority(). + * System vector constants for @p NVICSetSystemHandlerPriority(). */ #define HANDLER_MEM_MANAGE 0 /**< MEM MANAGE vector id.*/ #define HANDLER_BUS_FAULT 1 /**< BUS FAULT vector id.*/ diff --git a/os/ports/GCC/ARMCM3/port.dox b/os/ports/GCC/ARMCM3/port.dox index 5a063c867..e0c1ce350 100644 --- a/os/ports/GCC/ARMCM3/port.dox +++ b/os/ports/GCC/ARMCM3/port.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/AVR/chcore.c b/os/ports/GCC/AVR/chcore.c index 6662b5199..8242f7b1c 100644 --- a/os/ports/GCC/AVR/chcore.c +++ b/os/ports/GCC/AVR/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/AVR/chcore.h b/os/ports/GCC/AVR/chcore.h index d37f31899..8507ed752 100644 --- a/os/ports/GCC/AVR/chcore.h +++ b/os/ports/GCC/AVR/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -183,7 +183,7 @@ struct context { * IRQ prologue code, inserted at the start of all IRQ handlers enabled to * invoke system APIs. * This code tricks the compiler to save all the specified registers by - * "touching" them. + * "touching" them. */ #define PORT_IRQ_PROLOGUE() { \ asm ("" : : : "r18", "r19", "r20", "r21", "r22", "r23", "r24", \ @@ -201,7 +201,7 @@ struct context { /** * IRQ handler function declaration. Note, it just aliases the WinAVR "ISR" - * macro. + * macro. */ #define PORT_IRQ_HANDLER(id) ISR(id) diff --git a/os/ports/GCC/AVR/chtypes.h b/os/ports/GCC/AVR/chtypes.h index 0d8dba195..6c8c474c6 100644 --- a/os/ports/GCC/AVR/chtypes.h +++ b/os/ports/GCC/AVR/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/AVR/port.dox b/os/ports/GCC/AVR/port.dox index 63af3a525..664714366 100644 --- a/os/ports/GCC/AVR/port.dox +++ b/os/ports/GCC/AVR/port.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/MSP430/chcore.c b/os/ports/GCC/MSP430/chcore.c index 399c8a6f0..369e70987 100644 --- a/os/ports/GCC/MSP430/chcore.c +++ b/os/ports/GCC/MSP430/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -61,7 +61,7 @@ void port_switch(Thread *otp, Thread *ntp) { } /** - * Disables the interrupts and halts the system. + * Disables the interrupts and halts the system. * @note The function is declared as a weak symbol, it is possible to redefine * it in your application code. */ diff --git a/os/ports/GCC/MSP430/chcore.h b/os/ports/GCC/MSP430/chcore.h index 63616d287..020096a66 100644 --- a/os/ports/GCC/MSP430/chcore.h +++ b/os/ports/GCC/MSP430/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -153,7 +153,7 @@ struct context { /** * IRQ prologue code, inserted at the start of all IRQ handlers enabled to - * invoke system APIs. + * invoke system APIs. */ #define PORT_IRQ_PROLOGUE() diff --git a/os/ports/GCC/MSP430/chtypes.h b/os/ports/GCC/MSP430/chtypes.h index 44596806e..8f308f2d4 100644 --- a/os/ports/GCC/MSP430/chtypes.h +++ b/os/ports/GCC/MSP430/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/MSP430/port.dox b/os/ports/GCC/MSP430/port.dox index 5ae73c0b0..4e8dca24c 100644 --- a/os/ports/GCC/MSP430/port.dox +++ b/os/ports/GCC/MSP430/port.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/PPC/SPC56x/ivor.s b/os/ports/GCC/PPC/SPC56x/ivor.s index b2081fa7e..0f4c85cf3 100644 --- a/os/ports/GCC/PPC/SPC56x/ivor.s +++ b/os/ports/GCC/PPC/SPC56x/ivor.s @@ -1,174 +1,174 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file PPC/ivor.s - * @brief PowerPC IVORx handlers. - * - * @addtogroup PPC_CORE - * @{ - */ -/** @cond never */ - - /* - * INTC registers address. - */ - .equ INTC_IACKR, 0xfff48010 - .equ INTC_EOIR, 0xfff48018 - - .section .handlers - - /* - * IVOR10 handler (Book-E decrementer). - */ - .align 4 - .globl IVOR10 -IVOR10: - /* Creation of the external stack frame (extctx structure).*/ - stwu %sp, -80(%sp) /* Size of the extctx structure.*/ - stw %r0, 32(%sp) /* Saves GPR0. */ - mfSRR0 %r0 - stw %r0, 8(%sp) /* Saves PC. */ - mfSRR1 %r0 - stw %r0, 12(%sp) /* Saves MSR. */ - mfCR %r0 - stw %r0, 16(%sp) /* Saves CR. */ - mfLR %r0 - stw %r0, 20(%sp) /* Saves LR. */ - mfCTR %r0 - stw %r0, 24(%sp) /* Saves CTR. */ - mfXER %r0 - stw %r0, 28(%sp) /* Saves XER. */ - stw %r3, 36(%sp) /* Saves GPR3...GPR12. */ - stw %r4, 40(%sp) - stw %r5, 44(%sp) - stw %r6, 48(%sp) - stw %r7, 52(%sp) - stw %r8, 56(%sp) - stw %r9, 60(%sp) - stw %r10, 64(%sp) - stw %r11, 68(%sp) - stw %r12, 72(%sp) - - /* Reset DIE bit in TSR register.*/ - lis %r3, 0x0800 /* DIS bit mask. */ - mtspr 336, %r3 /* TSR register. */ - - /* System tick handler invokation.*/ - bl chSysTimerHandlerI - bl chSchIsRescRequiredExI - cmpli cr0, %r3, 0 - beq cr0, .ctxrestore - bl chSchDoRescheduleI - b .ctxrestore - - /* - * IVOR4 handler (Book-E external interrupt). - */ - .align 4 - .globl IVOR4 -IVOR4: - /* Creation of the external stack frame (extctx structure).*/ - stwu %sp, -80(%sp) /* Size of the extctx structure.*/ - stw %r0, 32(%sp) /* Saves GPR0. */ - mfSRR0 %r0 - stw %r0, 8(%sp) /* Saves PC. */ - mfSRR1 %r0 - stw %r0, 12(%sp) /* Saves MSR. */ - mfCR %r0 - stw %r0, 16(%sp) /* Saves CR. */ - mfLR %r0 - stw %r0, 20(%sp) /* Saves LR. */ - mfCTR %r0 - stw %r0, 24(%sp) /* Saves CTR. */ - mfXER %r0 - stw %r0, 28(%sp) /* Saves XER. */ - stw %r3, 36(%sp) /* Saves GPR3...GPR12. */ - stw %r4, 40(%sp) - stw %r5, 44(%sp) - stw %r6, 48(%sp) - stw %r7, 52(%sp) - stw %r8, 56(%sp) - stw %r9, 60(%sp) - stw %r10, 64(%sp) - stw %r11, 68(%sp) - stw %r12, 72(%sp) - - /* Software vector address from the INTC register.*/ - lis %r3, INTC_IACKR@h - ori %r3, %r3, INTC_IACKR@l /* IACKR register address. */ - lwz %r3, 0(%r3) /* IACKR register value. */ - lwz %r3, 0(%r3) - mtCTR %r3 /* Software handler address. */ - -#if PPC_USE_IRQ_PREEMPTION - /* Allows preemption while executing the software handler.*/ - wrteei 1 -#endif - - /* Exectes the software handler.*/ - bctrl - -#if PPC_USE_IRQ_PREEMPTION - /* Prevents preemption again.*/ - wrteei 0 -#endif - - /* Informs the INTC that the interrupt has been served.*/ - mbar 0 - lis %r3, INTC_EOIR@h - ori %r3, %r3, INTC_EOIR@l - stw %r3, 0(%r3) /* Writing any value should do. */ - - /* Verifies if a reschedulation is required.*/ - bl chSchIsRescRequiredExI - cmpli cr0, %r3, 0 - beq cr0, .ctxrestore - bl chSchDoRescheduleI - - /* Context restore.*/ -.ctxrestore: - lwz %r3, 36(%sp) /* Restores GPR3...GPR12. */ - lwz %r4, 40(%sp) - lwz %r5, 44(%sp) - lwz %r6, 48(%sp) - lwz %r7, 52(%sp) - lwz %r8, 56(%sp) - lwz %r9, 60(%sp) - lwz %r10, 64(%sp) - lwz %r11, 68(%sp) - lwz %r12, 72(%sp) - lwz %r0, 8(%sp) - mtSRR0 %r0 /* Restores PC. */ - lwz %r0, 12(%sp) - mtSRR1 %r0 /* Restores MSR. */ - lwz %r0, 16(%sp) - mtCR %r0 /* Restores CR. */ - lwz %r0, 20(%sp) - mtLR %r0 /* Restores LR. */ - lwz %r0, 24(%sp) - mtCTR %r0 /* Restores CTR. */ - lwz %r0, 28(%sp) - mtXER %r0 /* Restores XER. */ - lwz %r0, 32(%sp) /* Restores GPR0. */ - addi %sp, %sp, 80 /* Back to the previous frame. */ - rfi - -/** @endcond */ -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file PPC/ivor.s + * @brief PowerPC IVORx handlers. + * + * @addtogroup PPC_CORE + * @{ + */ +/** @cond never */ + + /* + * INTC registers address. + */ + .equ INTC_IACKR, 0xfff48010 + .equ INTC_EOIR, 0xfff48018 + + .section .handlers + + /* + * IVOR10 handler (Book-E decrementer). + */ + .align 4 + .globl IVOR10 +IVOR10: + /* Creation of the external stack frame (extctx structure).*/ + stwu %sp, -80(%sp) /* Size of the extctx structure.*/ + stw %r0, 32(%sp) /* Saves GPR0. */ + mfSRR0 %r0 + stw %r0, 8(%sp) /* Saves PC. */ + mfSRR1 %r0 + stw %r0, 12(%sp) /* Saves MSR. */ + mfCR %r0 + stw %r0, 16(%sp) /* Saves CR. */ + mfLR %r0 + stw %r0, 20(%sp) /* Saves LR. */ + mfCTR %r0 + stw %r0, 24(%sp) /* Saves CTR. */ + mfXER %r0 + stw %r0, 28(%sp) /* Saves XER. */ + stw %r3, 36(%sp) /* Saves GPR3...GPR12. */ + stw %r4, 40(%sp) + stw %r5, 44(%sp) + stw %r6, 48(%sp) + stw %r7, 52(%sp) + stw %r8, 56(%sp) + stw %r9, 60(%sp) + stw %r10, 64(%sp) + stw %r11, 68(%sp) + stw %r12, 72(%sp) + + /* Reset DIE bit in TSR register.*/ + lis %r3, 0x0800 /* DIS bit mask. */ + mtspr 336, %r3 /* TSR register. */ + + /* System tick handler invokation.*/ + bl chSysTimerHandlerI + bl chSchIsRescRequiredExI + cmpli cr0, %r3, 0 + beq cr0, .ctxrestore + bl chSchDoRescheduleI + b .ctxrestore + + /* + * IVOR4 handler (Book-E external interrupt). + */ + .align 4 + .globl IVOR4 +IVOR4: + /* Creation of the external stack frame (extctx structure).*/ + stwu %sp, -80(%sp) /* Size of the extctx structure.*/ + stw %r0, 32(%sp) /* Saves GPR0. */ + mfSRR0 %r0 + stw %r0, 8(%sp) /* Saves PC. */ + mfSRR1 %r0 + stw %r0, 12(%sp) /* Saves MSR. */ + mfCR %r0 + stw %r0, 16(%sp) /* Saves CR. */ + mfLR %r0 + stw %r0, 20(%sp) /* Saves LR. */ + mfCTR %r0 + stw %r0, 24(%sp) /* Saves CTR. */ + mfXER %r0 + stw %r0, 28(%sp) /* Saves XER. */ + stw %r3, 36(%sp) /* Saves GPR3...GPR12. */ + stw %r4, 40(%sp) + stw %r5, 44(%sp) + stw %r6, 48(%sp) + stw %r7, 52(%sp) + stw %r8, 56(%sp) + stw %r9, 60(%sp) + stw %r10, 64(%sp) + stw %r11, 68(%sp) + stw %r12, 72(%sp) + + /* Software vector address from the INTC register.*/ + lis %r3, INTC_IACKR@h + ori %r3, %r3, INTC_IACKR@l /* IACKR register address. */ + lwz %r3, 0(%r3) /* IACKR register value. */ + lwz %r3, 0(%r3) + mtCTR %r3 /* Software handler address. */ + +#if PPC_USE_IRQ_PREEMPTION + /* Allows preemption while executing the software handler.*/ + wrteei 1 +#endif + + /* Exectes the software handler.*/ + bctrl + +#if PPC_USE_IRQ_PREEMPTION + /* Prevents preemption again.*/ + wrteei 0 +#endif + + /* Informs the INTC that the interrupt has been served.*/ + mbar 0 + lis %r3, INTC_EOIR@h + ori %r3, %r3, INTC_EOIR@l + stw %r3, 0(%r3) /* Writing any value should do. */ + + /* Verifies if a reschedulation is required.*/ + bl chSchIsRescRequiredExI + cmpli cr0, %r3, 0 + beq cr0, .ctxrestore + bl chSchDoRescheduleI + + /* Context restore.*/ +.ctxrestore: + lwz %r3, 36(%sp) /* Restores GPR3...GPR12. */ + lwz %r4, 40(%sp) + lwz %r5, 44(%sp) + lwz %r6, 48(%sp) + lwz %r7, 52(%sp) + lwz %r8, 56(%sp) + lwz %r9, 60(%sp) + lwz %r10, 64(%sp) + lwz %r11, 68(%sp) + lwz %r12, 72(%sp) + lwz %r0, 8(%sp) + mtSRR0 %r0 /* Restores PC. */ + lwz %r0, 12(%sp) + mtSRR1 %r0 /* Restores MSR. */ + lwz %r0, 16(%sp) + mtCR %r0 /* Restores CR. */ + lwz %r0, 20(%sp) + mtLR %r0 /* Restores LR. */ + lwz %r0, 24(%sp) + mtCTR %r0 /* Restores CTR. */ + lwz %r0, 28(%sp) + mtXER %r0 /* Restores XER. */ + lwz %r0, 32(%sp) /* Restores GPR0. */ + addi %sp, %sp, 80 /* Back to the previous frame. */ + rfi + +/** @endcond */ +/** @} */ diff --git a/os/ports/GCC/PPC/SPC56x/vectors.s b/os/ports/GCC/PPC/SPC56x/vectors.s index 5c9c6d075..4b7e68ffe 100644 --- a/os/ports/GCC/PPC/SPC56x/vectors.s +++ b/os/ports/GCC/PPC/SPC56x/vectors.s @@ -1,1494 +1,1494 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file PPC/SPC56x/vectors.s - * @brief SPC56x vectors table. - * - * @addtogroup PPC_CORE - * @{ - */ -/** @cond never */ - - /* - * BAM info, SWT off, WTE off, VLE off. - */ - .section .bam - .long 0x005A0000 - .long _boot_address - - /* - * Software vectors table. The vectors are accessed from the IVOR4 - * handler only. In order to declare an interrupt handler just create - * a function withe the same name of a vector, the symbol will - * override the weak symbol declared here. - */ - .section .vectors - .align 2 - .globl _vectors -_vectors: - .long vector0 - .long vector1 - .long vector2 - .long vector3 - .long vector4 - .long vector5 - .long vector6 - .long vector7 - .long vector8 - .long vector9 - .long vector10 - .long vector11 - .long vector12 - .long vector13 - .long vector14 - .long vector15 - .long vector16 - .long vector17 - .long vector18 - .long vector19 - .long vector20 - .long vector21 - .long vector22 - .long vector23 - .long vector24 - .long vector25 - .long vector26 - .long vector27 - .long vector28 - .long vector29 - .long vector30 - .long vector31 - .long vector32 - .long vector33 - .long vector34 - .long vector35 - .long vector36 - .long vector37 - .long vector38 - .long vector39 - .long vector40 - .long vector41 - .long vector42 - .long vector43 - .long vector44 - .long vector45 - .long vector46 - .long vector47 - .long vector48 - .long vector49 - .long vector50 - .long vector51 - .long vector52 - .long vector53 - .long vector54 - .long vector55 - .long vector56 - .long vector57 - .long vector58 - .long vector59 - .long vector60 - .long vector61 - .long vector62 - .long vector63 - .long vector64 - .long vector65 - .long vector66 - .long vector67 - .long vector68 - .long vector69 - .long vector70 - .long vector71 - .long vector72 - .long vector73 - .long vector74 - .long vector75 - .long vector76 - .long vector77 - .long vector78 - .long vector79 - .long vector80 - .long vector81 - .long vector82 - .long vector83 - .long vector84 - .long vector85 - .long vector86 - .long vector87 - .long vector88 - .long vector89 - .long vector90 - .long vector91 - .long vector92 - .long vector93 - .long vector94 - .long vector95 - .long vector96 - .long vector97 - .long vector98 - .long vector99 - .long vector100 - .long vector101 - .long vector102 - .long vector103 - .long vector104 - .long vector105 - .long vector106 - .long vector107 - .long vector108 - .long vector109 - .long vector110 - .long vector111 - .long vector112 - .long vector113 - .long vector114 - .long vector115 - .long vector116 - .long vector117 - .long vector118 - .long vector119 - .long vector120 - .long vector121 - .long vector122 - .long vector123 - .long vector124 - .long vector125 - .long vector126 - .long vector127 - .long vector128 - .long vector129 - .long vector130 - .long vector131 - .long vector132 - .long vector133 - .long vector134 - .long vector135 - .long vector136 - .long vector137 - .long vector138 - .long vector139 - .long vector140 - .long vector141 - .long vector142 - .long vector143 - .long vector144 - .long vector145 - .long vector146 - .long vector147 - .long vector148 - .long vector149 - .long vector150 - .long vector151 - .long vector152 - .long vector153 - .long vector154 - .long vector155 - .long vector156 - .long vector157 - .long vector158 - .long vector159 - .long vector160 - .long vector161 - .long vector162 - .long vector163 - .long vector164 - .long vector165 - .long vector166 - .long vector167 - .long vector168 - .long vector169 - .long vector170 - .long vector171 - .long vector172 - .long vector173 - .long vector174 - .long vector175 - .long vector176 - .long vector177 - .long vector178 - .long vector179 - .long vector180 - .long vector181 - .long vector182 - .long vector183 - .long vector184 - .long vector185 - .long vector186 - .long vector187 - .long vector188 - .long vector189 - .long vector190 - .long vector191 - .long vector192 - .long vector193 - .long vector194 - .long vector195 - .long vector196 - .long vector197 - .long vector198 - .long vector199 - .long vector200 - .long vector201 - .long vector202 - .long vector203 - .long vector204 - .long vector205 - .long vector206 - .long vector207 - .long vector208 - .long vector209 - .long vector210 - .long vector211 - .long vector212 - .long vector213 - .long vector214 - .long vector215 - .long vector216 - .long vector217 - .long vector218 - .long vector219 - .long vector220 - .long vector221 - .long vector222 - .long vector223 - .long vector224 - .long vector225 - .long vector226 - .long vector227 - .long vector228 - .long vector229 - .long vector230 - .long vector231 - .long vector232 - .long vector233 - .long vector234 - .long vector235 - .long vector236 - .long vector237 - .long vector238 - .long vector239 - .long vector240 - .long vector241 - .long vector242 - .long vector243 - .long vector244 - .long vector245 - .long vector246 - .long vector247 - .long vector248 - .long vector249 - .long vector250 - .long vector251 - .long vector252 - .long vector253 - .long vector254 - .long vector255 - .long vector256 - .long vector257 - .long vector258 - .long vector259 - .long vector260 - .long vector261 - .long vector262 - .long vector263 - .long vector264 - .long vector265 - .long vector266 - .long vector267 - .long vector268 - .long vector269 - .long vector270 - .long vector271 - .long vector272 - .long vector273 - .long vector274 - .long vector275 - .long vector276 - .long vector277 - .long vector278 - .long vector279 - .long vector280 - .long vector281 - .long vector282 - .long vector283 - .long vector284 - .long vector285 - .long vector286 - .long vector287 - .long vector288 - .long vector289 - .long vector290 - .long vector291 - .long vector292 - .long vector293 - .long vector294 - .long vector295 - .long vector296 - .long vector297 - .long vector298 - .long vector299 - .long vector300 - .long vector301 - .long vector302 - .long vector303 - .long vector304 - .long vector305 - .long vector306 - .long vector307 - .long vector308 - .long vector309 - .long vector310 - .long vector311 - .long vector312 - .long vector313 - .long vector314 - .long vector315 - .long vector316 - .long vector317 - .long vector318 - .long vector319 - .long vector320 - .long vector321 - .long vector322 - .long vector323 - .long vector324 - .long vector325 - .long vector326 - .long vector327 - .long vector328 - .long vector329 - .long vector330 - .long vector331 - .long vector332 - .long vector333 - .long vector334 - .long vector335 - .long vector336 - .long vector337 - .long vector338 - .long vector339 - .long vector340 - .long vector341 - .long vector342 - .long vector343 - .long vector344 - .long vector345 - .long vector346 - .long vector347 - .long vector348 - .long vector349 - .long vector350 - .long vector351 - .long vector352 - .long vector353 - .long vector354 - .long vector355 - .long vector356 - .long vector357 - .long vector358 - .long vector359 - - .text - .align 2 - .weak vector0 -vector0: - - .weak vector1 -vector1: - - .weak vector2 -vector2: - - .weak vector3 -vector3: - - .weak vector4 -vector4: - - .weak vector5 -vector5: - - .weak vector6 -vector6: - - .weak vector7 -vector7: - - .weak vector8 -vector8: - - .weak vector9 -vector9: - - .weak vector10 -vector10: - - .weak vector11 -vector11: - - .weak vector12 -vector12: - - .weak vector13 -vector13: - - .weak vector14 -vector14: - - .weak vector15 -vector15: - - .weak vector16 -vector16: - - .weak vector17 -vector17: - - .weak vector18 -vector18: - - .weak vector19 -vector19: - - .weak vector20 -vector20: - - .weak vector21 -vector21: - - .weak vector22 -vector22: - - .weak vector23 -vector23: - - .weak vector24 -vector24: - - .weak vector25 -vector25: - - .weak vector26 -vector26: - - .weak vector27 -vector27: - - .weak vector28 -vector28: - - .weak vector29 -vector29: - - .weak vector30 -vector30: - - .weak vector31 -vector31: - - .weak vector32 -vector32: - - .weak vector33 -vector33: - - .weak vector34 -vector34: - - .weak vector35 -vector35: - - .weak vector36 -vector36: - - .weak vector37 -vector37: - - .weak vector38 -vector38: - - .weak vector39 -vector39: - - .weak vector40 -vector40: - - .weak vector41 -vector41: - - .weak vector42 -vector42: - - .weak vector43 -vector43: - - .weak vector44 -vector44: - - .weak vector45 -vector45: - - .weak vector46 -vector46: - - .weak vector47 -vector47: - - .weak vector48 -vector48: - - .weak vector49 -vector49: - - .weak vector50 -vector50: - - .weak vector51 -vector51: - - .weak vector52 -vector52: - - .weak vector53 -vector53: - - .weak vector54 -vector54: - - .weak vector55 -vector55: - - .weak vector56 -vector56: - - .weak vector57 -vector57: - - .weak vector58 -vector58: - - .weak vector59 -vector59: - - .weak vector60 -vector60: - - .weak vector61 -vector61: - - .weak vector62 -vector62: - - .weak vector63 -vector63: - - .weak vector64 -vector64: - - .weak vector65 -vector65: - - .weak vector66 -vector66: - - .weak vector67 -vector67: - - .weak vector68 -vector68: - - .weak vector69 -vector69: - - .weak vector70 -vector70: - - .weak vector71 -vector71: - - .weak vector72 -vector72: - - .weak vector73 -vector73: - - .weak vector74 -vector74: - - .weak vector75 -vector75: - - .weak vector76 -vector76: - - .weak vector77 -vector77: - - .weak vector78 -vector78: - - .weak vector79 -vector79: - - .weak vector80 -vector80: - - .weak vector81 -vector81: - - .weak vector82 -vector82: - - .weak vector83 -vector83: - - .weak vector84 -vector84: - - .weak vector85 -vector85: - - .weak vector86 -vector86: - - .weak vector87 -vector87: - - .weak vector88 -vector88: - - .weak vector89 -vector89: - - .weak vector90 -vector90: - - .weak vector91 -vector91: - - .weak vector92 -vector92: - - .weak vector93 -vector93: - - .weak vector94 -vector94: - - .weak vector95 -vector95: - - .weak vector96 -vector96: - - .weak vector97 -vector97: - - .weak vector98 -vector98: - - .weak vector99 -vector99: - - .weak vector100 -vector100: - - .weak vector101 -vector101: - - .weak vector102 -vector102: - - .weak vector103 -vector103: - - .weak vector104 -vector104: - - .weak vector105 -vector105: - - .weak vector106 -vector106: - - .weak vector107 -vector107: - - .weak vector108 -vector108: - - .weak vector109 -vector109: - - .weak vector110 -vector110: - - .weak vector111 -vector111: - - .weak vector112 -vector112: - - .weak vector113 -vector113: - - .weak vector114 -vector114: - - .weak vector115 -vector115: - - .weak vector116 -vector116: - - .weak vector117 -vector117: - - .weak vector118 -vector118: - - .weak vector119 -vector119: - - .weak vector120 -vector120: - - .weak vector121 -vector121: - - .weak vector122 -vector122: - - .weak vector123 -vector123: - - .weak vector124 -vector124: - - .weak vector125 -vector125: - - .weak vector126 -vector126: - - .weak vector127 -vector127: - - .weak vector128 -vector128: - - .weak vector129 -vector129: - - .weak vector130 -vector130: - - .weak vector131 -vector131: - - .weak vector132 -vector132: - - .weak vector133 -vector133: - - .weak vector134 -vector134: - - .weak vector135 -vector135: - - .weak vector136 -vector136: - - .weak vector137 -vector137: - - .weak vector138 -vector138: - - .weak vector139 -vector139: - - .weak vector140 -vector140: - - .weak vector141 -vector141: - - .weak vector142 -vector142: - - .weak vector143 -vector143: - - .weak vector144 -vector144: - - .weak vector145 -vector145: - - .weak vector146 -vector146: - - .weak vector147 -vector147: - - .weak vector148 -vector148: - - .weak vector149 -vector149: - - .weak vector150 -vector150: - - .weak vector151 -vector151: - - .weak vector152 -vector152: - - .weak vector153 -vector153: - - .weak vector154 -vector154: - - .weak vector155 -vector155: - - .weak vector156 -vector156: - - .weak vector157 -vector157: - - .weak vector158 -vector158: - - .weak vector159 -vector159: - - .weak vector160 -vector160: - - .weak vector161 -vector161: - - .weak vector162 -vector162: - - .weak vector163 -vector163: - - .weak vector164 -vector164: - - .weak vector165 -vector165: - - .weak vector166 -vector166: - - .weak vector167 -vector167: - - .weak vector168 -vector168: - - .weak vector169 -vector169: - - .weak vector170 -vector170: - - .weak vector171 -vector171: - - .weak vector172 -vector172: - - .weak vector173 -vector173: - - .weak vector174 -vector174: - - .weak vector175 -vector175: - - .weak vector176 -vector176: - - .weak vector177 -vector177: - - .weak vector178 -vector178: - - .weak vector179 -vector179: - - .weak vector180 -vector180: - - .weak vector181 -vector181: - - .weak vector182 -vector182: - - .weak vector183 -vector183: - - .weak vector184 -vector184: - - .weak vector185 -vector185: - - .weak vector186 -vector186: - - .weak vector187 -vector187: - - .weak vector188 -vector188: - - .weak vector189 -vector189: - - .weak vector190 -vector190: - - .weak vector191 -vector191: - - .weak vector192 -vector192: - - .weak vector193 -vector193: - - .weak vector194 -vector194: - - .weak vector195 -vector195: - - .weak vector196 -vector196: - - .weak vector197 -vector197: - - .weak vector198 -vector198: - - .weak vector199 -vector199: - - .weak vector200 -vector200: - - .weak vector201 -vector201: - - .weak vector202 -vector202: - - .weak vector203 -vector203: - - .weak vector204 -vector204: - - .weak vector205 -vector205: - - .weak vector206 -vector206: - - .weak vector207 -vector207: - - .weak vector208 -vector208: - - .weak vector209 -vector209: - - .weak vector210 -vector210: - - .weak vector211 -vector211: - - .weak vector212 -vector212: - - .weak vector213 -vector213: - - .weak vector214 -vector214: - - .weak vector215 -vector215: - - .weak vector216 -vector216: - - .weak vector217 -vector217: - - .weak vector218 -vector218: - - .weak vector219 -vector219: - - .weak vector220 -vector220: - - .weak vector221 -vector221: - - .weak vector222 -vector222: - - .weak vector223 -vector223: - - .weak vector224 -vector224: - - .weak vector225 -vector225: - - .weak vector226 -vector226: - - .weak vector227 -vector227: - - .weak vector228 -vector228: - - .weak vector229 -vector229: - - .weak vector230 -vector230: - - .weak vector231 -vector231: - - .weak vector232 -vector232: - - .weak vector233 -vector233: - - .weak vector234 -vector234: - - .weak vector235 -vector235: - - .weak vector236 -vector236: - - .weak vector237 -vector237: - - .weak vector238 -vector238: - - .weak vector239 -vector239: - - .weak vector240 -vector240: - - .weak vector241 -vector241: - - .weak vector242 -vector242: - - .weak vector243 -vector243: - - .weak vector244 -vector244: - - .weak vector245 -vector245: - - .weak vector246 -vector246: - - .weak vector247 -vector247: - - .weak vector248 -vector248: - - .weak vector249 -vector249: - - .weak vector250 -vector250: - - .weak vector251 -vector251: - - .weak vector252 -vector252: - - .weak vector253 -vector253: - - .weak vector254 -vector254: - - .weak vector255 -vector255: - - .weak vector256 -vector256: - - .weak vector257 -vector257: - - .weak vector258 -vector258: - - .weak vector259 -vector259: - - .weak vector260 -vector260: - - .weak vector261 -vector261: - - .weak vector262 -vector262: - - .weak vector263 -vector263: - - .weak vector264 -vector264: - - .weak vector265 -vector265: - - .weak vector266 -vector266: - - .weak vector267 -vector267: - - .weak vector268 -vector268: - - .weak vector269 -vector269: - - .weak vector270 -vector270: - - .weak vector271 -vector271: - - .weak vector272 -vector272: - - .weak vector273 -vector273: - - .weak vector274 -vector274: - - .weak vector275 -vector275: - - .weak vector276 -vector276: - - .weak vector277 -vector277: - - .weak vector278 -vector278: - - .weak vector279 -vector279: - - .weak vector280 -vector280: - - .weak vector281 -vector281: - - .weak vector282 -vector282: - - .weak vector283 -vector283: - - .weak vector284 -vector284: - - .weak vector285 -vector285: - - .weak vector286 -vector286: - - .weak vector287 -vector287: - - .weak vector288 -vector288: - - .weak vector289 -vector289: - - .weak vector290 -vector290: - - .weak vector291 -vector291: - - .weak vector292 -vector292: - - .weak vector293 -vector293: - - .weak vector294 -vector294: - - .weak vector295 -vector295: - - .weak vector296 -vector296: - - .weak vector297 -vector297: - - .weak vector298 -vector298: - - .weak vector299 -vector299: - - .weak vector300 -vector300: - - .weak vector301 -vector301: - - .weak vector302 -vector302: - - .weak vector303 -vector303: - - .weak vector304 -vector304: - - .weak vector305 -vector305: - - .weak vector306 -vector306: - - .weak vector307 -vector307: - - .weak vector308 -vector308: - - .weak vector309 -vector309: - - .weak vector310 -vector310: - - .weak vector311 -vector311: - - .weak vector312 -vector312: - - .weak vector313 -vector313: - - .weak vector314 -vector314: - - .weak vector315 -vector315: - - .weak vector316 -vector316: - - .weak vector317 -vector317: - - .weak vector318 -vector318: - - .weak vector319 -vector319: - - .weak vector320 -vector320: - - .weak vector321 -vector321: - - .weak vector322 -vector322: - - .weak vector323 -vector323: - - .weak vector324 -vector324: - - .weak vector325 -vector325: - - .weak vector326 -vector326: - - .weak vector327 -vector327: - - .weak vector328 -vector328: - - .weak vector329 -vector329: - - .weak vector330 -vector330: - - .weak vector331 -vector331: - - .weak vector332 -vector332: - - .weak vector333 -vector333: - - .weak vector334 -vector334: - - .weak vector335 -vector335: - - .weak vector336 -vector336: - - .weak vector337 -vector337: - - .weak vector338 -vector338: - - .weak vector339 -vector339: - - .weak vector340 -vector340: - - .weak vector341 -vector341: - - .weak vector342 -vector342: - - .weak vector343 -vector343: - - .weak vector344 -vector344: - - .weak vector345 -vector345: - - .weak vector346 -vector346: - - .weak vector347 -vector347: - - .weak vector348 -vector348: - - .weak vector349 -vector349: - - .weak vector350 -vector350: - - .weak vector351 -vector351: - - .weak vector352 -vector352: - - .weak vector353 -vector353: - - .weak vector354 -vector354: - - .weak vector355 -vector355: - - .weak vector356 -vector356: - - .weak vector357 -vector357: - - .weak vector358 -vector358: - - .weak vector359 -vector359: - - .globl _unhandled_irq -_unhandled_irq: - b _unhandled_irq - -/** @endcond */ -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file PPC/SPC56x/vectors.s + * @brief SPC56x vectors table. + * + * @addtogroup PPC_CORE + * @{ + */ +/** @cond never */ + + /* + * BAM info, SWT off, WTE off, VLE off. + */ + .section .bam + .long 0x005A0000 + .long _boot_address + + /* + * Software vectors table. The vectors are accessed from the IVOR4 + * handler only. In order to declare an interrupt handler just create + * a function withe the same name of a vector, the symbol will + * override the weak symbol declared here. + */ + .section .vectors + .align 2 + .globl _vectors +_vectors: + .long vector0 + .long vector1 + .long vector2 + .long vector3 + .long vector4 + .long vector5 + .long vector6 + .long vector7 + .long vector8 + .long vector9 + .long vector10 + .long vector11 + .long vector12 + .long vector13 + .long vector14 + .long vector15 + .long vector16 + .long vector17 + .long vector18 + .long vector19 + .long vector20 + .long vector21 + .long vector22 + .long vector23 + .long vector24 + .long vector25 + .long vector26 + .long vector27 + .long vector28 + .long vector29 + .long vector30 + .long vector31 + .long vector32 + .long vector33 + .long vector34 + .long vector35 + .long vector36 + .long vector37 + .long vector38 + .long vector39 + .long vector40 + .long vector41 + .long vector42 + .long vector43 + .long vector44 + .long vector45 + .long vector46 + .long vector47 + .long vector48 + .long vector49 + .long vector50 + .long vector51 + .long vector52 + .long vector53 + .long vector54 + .long vector55 + .long vector56 + .long vector57 + .long vector58 + .long vector59 + .long vector60 + .long vector61 + .long vector62 + .long vector63 + .long vector64 + .long vector65 + .long vector66 + .long vector67 + .long vector68 + .long vector69 + .long vector70 + .long vector71 + .long vector72 + .long vector73 + .long vector74 + .long vector75 + .long vector76 + .long vector77 + .long vector78 + .long vector79 + .long vector80 + .long vector81 + .long vector82 + .long vector83 + .long vector84 + .long vector85 + .long vector86 + .long vector87 + .long vector88 + .long vector89 + .long vector90 + .long vector91 + .long vector92 + .long vector93 + .long vector94 + .long vector95 + .long vector96 + .long vector97 + .long vector98 + .long vector99 + .long vector100 + .long vector101 + .long vector102 + .long vector103 + .long vector104 + .long vector105 + .long vector106 + .long vector107 + .long vector108 + .long vector109 + .long vector110 + .long vector111 + .long vector112 + .long vector113 + .long vector114 + .long vector115 + .long vector116 + .long vector117 + .long vector118 + .long vector119 + .long vector120 + .long vector121 + .long vector122 + .long vector123 + .long vector124 + .long vector125 + .long vector126 + .long vector127 + .long vector128 + .long vector129 + .long vector130 + .long vector131 + .long vector132 + .long vector133 + .long vector134 + .long vector135 + .long vector136 + .long vector137 + .long vector138 + .long vector139 + .long vector140 + .long vector141 + .long vector142 + .long vector143 + .long vector144 + .long vector145 + .long vector146 + .long vector147 + .long vector148 + .long vector149 + .long vector150 + .long vector151 + .long vector152 + .long vector153 + .long vector154 + .long vector155 + .long vector156 + .long vector157 + .long vector158 + .long vector159 + .long vector160 + .long vector161 + .long vector162 + .long vector163 + .long vector164 + .long vector165 + .long vector166 + .long vector167 + .long vector168 + .long vector169 + .long vector170 + .long vector171 + .long vector172 + .long vector173 + .long vector174 + .long vector175 + .long vector176 + .long vector177 + .long vector178 + .long vector179 + .long vector180 + .long vector181 + .long vector182 + .long vector183 + .long vector184 + .long vector185 + .long vector186 + .long vector187 + .long vector188 + .long vector189 + .long vector190 + .long vector191 + .long vector192 + .long vector193 + .long vector194 + .long vector195 + .long vector196 + .long vector197 + .long vector198 + .long vector199 + .long vector200 + .long vector201 + .long vector202 + .long vector203 + .long vector204 + .long vector205 + .long vector206 + .long vector207 + .long vector208 + .long vector209 + .long vector210 + .long vector211 + .long vector212 + .long vector213 + .long vector214 + .long vector215 + .long vector216 + .long vector217 + .long vector218 + .long vector219 + .long vector220 + .long vector221 + .long vector222 + .long vector223 + .long vector224 + .long vector225 + .long vector226 + .long vector227 + .long vector228 + .long vector229 + .long vector230 + .long vector231 + .long vector232 + .long vector233 + .long vector234 + .long vector235 + .long vector236 + .long vector237 + .long vector238 + .long vector239 + .long vector240 + .long vector241 + .long vector242 + .long vector243 + .long vector244 + .long vector245 + .long vector246 + .long vector247 + .long vector248 + .long vector249 + .long vector250 + .long vector251 + .long vector252 + .long vector253 + .long vector254 + .long vector255 + .long vector256 + .long vector257 + .long vector258 + .long vector259 + .long vector260 + .long vector261 + .long vector262 + .long vector263 + .long vector264 + .long vector265 + .long vector266 + .long vector267 + .long vector268 + .long vector269 + .long vector270 + .long vector271 + .long vector272 + .long vector273 + .long vector274 + .long vector275 + .long vector276 + .long vector277 + .long vector278 + .long vector279 + .long vector280 + .long vector281 + .long vector282 + .long vector283 + .long vector284 + .long vector285 + .long vector286 + .long vector287 + .long vector288 + .long vector289 + .long vector290 + .long vector291 + .long vector292 + .long vector293 + .long vector294 + .long vector295 + .long vector296 + .long vector297 + .long vector298 + .long vector299 + .long vector300 + .long vector301 + .long vector302 + .long vector303 + .long vector304 + .long vector305 + .long vector306 + .long vector307 + .long vector308 + .long vector309 + .long vector310 + .long vector311 + .long vector312 + .long vector313 + .long vector314 + .long vector315 + .long vector316 + .long vector317 + .long vector318 + .long vector319 + .long vector320 + .long vector321 + .long vector322 + .long vector323 + .long vector324 + .long vector325 + .long vector326 + .long vector327 + .long vector328 + .long vector329 + .long vector330 + .long vector331 + .long vector332 + .long vector333 + .long vector334 + .long vector335 + .long vector336 + .long vector337 + .long vector338 + .long vector339 + .long vector340 + .long vector341 + .long vector342 + .long vector343 + .long vector344 + .long vector345 + .long vector346 + .long vector347 + .long vector348 + .long vector349 + .long vector350 + .long vector351 + .long vector352 + .long vector353 + .long vector354 + .long vector355 + .long vector356 + .long vector357 + .long vector358 + .long vector359 + + .text + .align 2 + .weak vector0 +vector0: + + .weak vector1 +vector1: + + .weak vector2 +vector2: + + .weak vector3 +vector3: + + .weak vector4 +vector4: + + .weak vector5 +vector5: + + .weak vector6 +vector6: + + .weak vector7 +vector7: + + .weak vector8 +vector8: + + .weak vector9 +vector9: + + .weak vector10 +vector10: + + .weak vector11 +vector11: + + .weak vector12 +vector12: + + .weak vector13 +vector13: + + .weak vector14 +vector14: + + .weak vector15 +vector15: + + .weak vector16 +vector16: + + .weak vector17 +vector17: + + .weak vector18 +vector18: + + .weak vector19 +vector19: + + .weak vector20 +vector20: + + .weak vector21 +vector21: + + .weak vector22 +vector22: + + .weak vector23 +vector23: + + .weak vector24 +vector24: + + .weak vector25 +vector25: + + .weak vector26 +vector26: + + .weak vector27 +vector27: + + .weak vector28 +vector28: + + .weak vector29 +vector29: + + .weak vector30 +vector30: + + .weak vector31 +vector31: + + .weak vector32 +vector32: + + .weak vector33 +vector33: + + .weak vector34 +vector34: + + .weak vector35 +vector35: + + .weak vector36 +vector36: + + .weak vector37 +vector37: + + .weak vector38 +vector38: + + .weak vector39 +vector39: + + .weak vector40 +vector40: + + .weak vector41 +vector41: + + .weak vector42 +vector42: + + .weak vector43 +vector43: + + .weak vector44 +vector44: + + .weak vector45 +vector45: + + .weak vector46 +vector46: + + .weak vector47 +vector47: + + .weak vector48 +vector48: + + .weak vector49 +vector49: + + .weak vector50 +vector50: + + .weak vector51 +vector51: + + .weak vector52 +vector52: + + .weak vector53 +vector53: + + .weak vector54 +vector54: + + .weak vector55 +vector55: + + .weak vector56 +vector56: + + .weak vector57 +vector57: + + .weak vector58 +vector58: + + .weak vector59 +vector59: + + .weak vector60 +vector60: + + .weak vector61 +vector61: + + .weak vector62 +vector62: + + .weak vector63 +vector63: + + .weak vector64 +vector64: + + .weak vector65 +vector65: + + .weak vector66 +vector66: + + .weak vector67 +vector67: + + .weak vector68 +vector68: + + .weak vector69 +vector69: + + .weak vector70 +vector70: + + .weak vector71 +vector71: + + .weak vector72 +vector72: + + .weak vector73 +vector73: + + .weak vector74 +vector74: + + .weak vector75 +vector75: + + .weak vector76 +vector76: + + .weak vector77 +vector77: + + .weak vector78 +vector78: + + .weak vector79 +vector79: + + .weak vector80 +vector80: + + .weak vector81 +vector81: + + .weak vector82 +vector82: + + .weak vector83 +vector83: + + .weak vector84 +vector84: + + .weak vector85 +vector85: + + .weak vector86 +vector86: + + .weak vector87 +vector87: + + .weak vector88 +vector88: + + .weak vector89 +vector89: + + .weak vector90 +vector90: + + .weak vector91 +vector91: + + .weak vector92 +vector92: + + .weak vector93 +vector93: + + .weak vector94 +vector94: + + .weak vector95 +vector95: + + .weak vector96 +vector96: + + .weak vector97 +vector97: + + .weak vector98 +vector98: + + .weak vector99 +vector99: + + .weak vector100 +vector100: + + .weak vector101 +vector101: + + .weak vector102 +vector102: + + .weak vector103 +vector103: + + .weak vector104 +vector104: + + .weak vector105 +vector105: + + .weak vector106 +vector106: + + .weak vector107 +vector107: + + .weak vector108 +vector108: + + .weak vector109 +vector109: + + .weak vector110 +vector110: + + .weak vector111 +vector111: + + .weak vector112 +vector112: + + .weak vector113 +vector113: + + .weak vector114 +vector114: + + .weak vector115 +vector115: + + .weak vector116 +vector116: + + .weak vector117 +vector117: + + .weak vector118 +vector118: + + .weak vector119 +vector119: + + .weak vector120 +vector120: + + .weak vector121 +vector121: + + .weak vector122 +vector122: + + .weak vector123 +vector123: + + .weak vector124 +vector124: + + .weak vector125 +vector125: + + .weak vector126 +vector126: + + .weak vector127 +vector127: + + .weak vector128 +vector128: + + .weak vector129 +vector129: + + .weak vector130 +vector130: + + .weak vector131 +vector131: + + .weak vector132 +vector132: + + .weak vector133 +vector133: + + .weak vector134 +vector134: + + .weak vector135 +vector135: + + .weak vector136 +vector136: + + .weak vector137 +vector137: + + .weak vector138 +vector138: + + .weak vector139 +vector139: + + .weak vector140 +vector140: + + .weak vector141 +vector141: + + .weak vector142 +vector142: + + .weak vector143 +vector143: + + .weak vector144 +vector144: + + .weak vector145 +vector145: + + .weak vector146 +vector146: + + .weak vector147 +vector147: + + .weak vector148 +vector148: + + .weak vector149 +vector149: + + .weak vector150 +vector150: + + .weak vector151 +vector151: + + .weak vector152 +vector152: + + .weak vector153 +vector153: + + .weak vector154 +vector154: + + .weak vector155 +vector155: + + .weak vector156 +vector156: + + .weak vector157 +vector157: + + .weak vector158 +vector158: + + .weak vector159 +vector159: + + .weak vector160 +vector160: + + .weak vector161 +vector161: + + .weak vector162 +vector162: + + .weak vector163 +vector163: + + .weak vector164 +vector164: + + .weak vector165 +vector165: + + .weak vector166 +vector166: + + .weak vector167 +vector167: + + .weak vector168 +vector168: + + .weak vector169 +vector169: + + .weak vector170 +vector170: + + .weak vector171 +vector171: + + .weak vector172 +vector172: + + .weak vector173 +vector173: + + .weak vector174 +vector174: + + .weak vector175 +vector175: + + .weak vector176 +vector176: + + .weak vector177 +vector177: + + .weak vector178 +vector178: + + .weak vector179 +vector179: + + .weak vector180 +vector180: + + .weak vector181 +vector181: + + .weak vector182 +vector182: + + .weak vector183 +vector183: + + .weak vector184 +vector184: + + .weak vector185 +vector185: + + .weak vector186 +vector186: + + .weak vector187 +vector187: + + .weak vector188 +vector188: + + .weak vector189 +vector189: + + .weak vector190 +vector190: + + .weak vector191 +vector191: + + .weak vector192 +vector192: + + .weak vector193 +vector193: + + .weak vector194 +vector194: + + .weak vector195 +vector195: + + .weak vector196 +vector196: + + .weak vector197 +vector197: + + .weak vector198 +vector198: + + .weak vector199 +vector199: + + .weak vector200 +vector200: + + .weak vector201 +vector201: + + .weak vector202 +vector202: + + .weak vector203 +vector203: + + .weak vector204 +vector204: + + .weak vector205 +vector205: + + .weak vector206 +vector206: + + .weak vector207 +vector207: + + .weak vector208 +vector208: + + .weak vector209 +vector209: + + .weak vector210 +vector210: + + .weak vector211 +vector211: + + .weak vector212 +vector212: + + .weak vector213 +vector213: + + .weak vector214 +vector214: + + .weak vector215 +vector215: + + .weak vector216 +vector216: + + .weak vector217 +vector217: + + .weak vector218 +vector218: + + .weak vector219 +vector219: + + .weak vector220 +vector220: + + .weak vector221 +vector221: + + .weak vector222 +vector222: + + .weak vector223 +vector223: + + .weak vector224 +vector224: + + .weak vector225 +vector225: + + .weak vector226 +vector226: + + .weak vector227 +vector227: + + .weak vector228 +vector228: + + .weak vector229 +vector229: + + .weak vector230 +vector230: + + .weak vector231 +vector231: + + .weak vector232 +vector232: + + .weak vector233 +vector233: + + .weak vector234 +vector234: + + .weak vector235 +vector235: + + .weak vector236 +vector236: + + .weak vector237 +vector237: + + .weak vector238 +vector238: + + .weak vector239 +vector239: + + .weak vector240 +vector240: + + .weak vector241 +vector241: + + .weak vector242 +vector242: + + .weak vector243 +vector243: + + .weak vector244 +vector244: + + .weak vector245 +vector245: + + .weak vector246 +vector246: + + .weak vector247 +vector247: + + .weak vector248 +vector248: + + .weak vector249 +vector249: + + .weak vector250 +vector250: + + .weak vector251 +vector251: + + .weak vector252 +vector252: + + .weak vector253 +vector253: + + .weak vector254 +vector254: + + .weak vector255 +vector255: + + .weak vector256 +vector256: + + .weak vector257 +vector257: + + .weak vector258 +vector258: + + .weak vector259 +vector259: + + .weak vector260 +vector260: + + .weak vector261 +vector261: + + .weak vector262 +vector262: + + .weak vector263 +vector263: + + .weak vector264 +vector264: + + .weak vector265 +vector265: + + .weak vector266 +vector266: + + .weak vector267 +vector267: + + .weak vector268 +vector268: + + .weak vector269 +vector269: + + .weak vector270 +vector270: + + .weak vector271 +vector271: + + .weak vector272 +vector272: + + .weak vector273 +vector273: + + .weak vector274 +vector274: + + .weak vector275 +vector275: + + .weak vector276 +vector276: + + .weak vector277 +vector277: + + .weak vector278 +vector278: + + .weak vector279 +vector279: + + .weak vector280 +vector280: + + .weak vector281 +vector281: + + .weak vector282 +vector282: + + .weak vector283 +vector283: + + .weak vector284 +vector284: + + .weak vector285 +vector285: + + .weak vector286 +vector286: + + .weak vector287 +vector287: + + .weak vector288 +vector288: + + .weak vector289 +vector289: + + .weak vector290 +vector290: + + .weak vector291 +vector291: + + .weak vector292 +vector292: + + .weak vector293 +vector293: + + .weak vector294 +vector294: + + .weak vector295 +vector295: + + .weak vector296 +vector296: + + .weak vector297 +vector297: + + .weak vector298 +vector298: + + .weak vector299 +vector299: + + .weak vector300 +vector300: + + .weak vector301 +vector301: + + .weak vector302 +vector302: + + .weak vector303 +vector303: + + .weak vector304 +vector304: + + .weak vector305 +vector305: + + .weak vector306 +vector306: + + .weak vector307 +vector307: + + .weak vector308 +vector308: + + .weak vector309 +vector309: + + .weak vector310 +vector310: + + .weak vector311 +vector311: + + .weak vector312 +vector312: + + .weak vector313 +vector313: + + .weak vector314 +vector314: + + .weak vector315 +vector315: + + .weak vector316 +vector316: + + .weak vector317 +vector317: + + .weak vector318 +vector318: + + .weak vector319 +vector319: + + .weak vector320 +vector320: + + .weak vector321 +vector321: + + .weak vector322 +vector322: + + .weak vector323 +vector323: + + .weak vector324 +vector324: + + .weak vector325 +vector325: + + .weak vector326 +vector326: + + .weak vector327 +vector327: + + .weak vector328 +vector328: + + .weak vector329 +vector329: + + .weak vector330 +vector330: + + .weak vector331 +vector331: + + .weak vector332 +vector332: + + .weak vector333 +vector333: + + .weak vector334 +vector334: + + .weak vector335 +vector335: + + .weak vector336 +vector336: + + .weak vector337 +vector337: + + .weak vector338 +vector338: + + .weak vector339 +vector339: + + .weak vector340 +vector340: + + .weak vector341 +vector341: + + .weak vector342 +vector342: + + .weak vector343 +vector343: + + .weak vector344 +vector344: + + .weak vector345 +vector345: + + .weak vector346 +vector346: + + .weak vector347 +vector347: + + .weak vector348 +vector348: + + .weak vector349 +vector349: + + .weak vector350 +vector350: + + .weak vector351 +vector351: + + .weak vector352 +vector352: + + .weak vector353 +vector353: + + .weak vector354 +vector354: + + .weak vector355 +vector355: + + .weak vector356 +vector356: + + .weak vector357 +vector357: + + .weak vector358 +vector358: + + .weak vector359 +vector359: + + .globl _unhandled_irq +_unhandled_irq: + b _unhandled_irq + +/** @endcond */ +/** @} */ diff --git a/os/ports/GCC/PPC/chcore.c b/os/ports/GCC/PPC/chcore.c index faedea879..e0be71e3a 100644 --- a/os/ports/GCC/PPC/chcore.c +++ b/os/ports/GCC/PPC/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -32,7 +32,7 @@ * @details This function is invoked by the operating system when an * unrecoverable error is detected (as example because a programming * error in the application code that triggers an assertion while - * in debug mode). + * in debug mode). */ void port_halt(void) { diff --git a/os/ports/GCC/PPC/chcore.h b/os/ports/GCC/PPC/chcore.h index 3f3ce61af..dc09c75f5 100644 --- a/os/ports/GCC/PPC/chcore.h +++ b/os/ports/GCC/PPC/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -45,7 +45,7 @@ #define CH_ARCHITECTURE_PPCE200Z /** - * @brief Name of the implemented architecture. + * @brief Name of the implemented architecture. */ #define CH_ARCHITECTURE_NAME "PowerPC" @@ -55,7 +55,7 @@ #define CH_CORE_VARIANT_NAME "e200zX" /** - * @brief Base type for stack alignment. + * @brief Base type for stack alignment. * @details This type is used only for stack alignment reasons thus can be * anything from a char to a double. */ @@ -206,7 +206,7 @@ struct context { /** * @brief IRQ prologue code. * @details This macro must be inserted at the start of all IRQ handlers - * enabled to invoke system APIs. + * enabled to invoke system APIs. */ #define PORT_IRQ_PROLOGUE() @@ -220,7 +220,7 @@ struct context { /** * @brief IRQ handler function declaration. * @note @p id can be a function name or a vector number depending on the - * port implementation. + * port implementation. */ #define PORT_IRQ_HANDLER(id) void id(void) diff --git a/os/ports/GCC/PPC/chtypes.h b/os/ports/GCC/PPC/chtypes.h index 4a244c73c..ed380b457 100644 --- a/os/ports/GCC/PPC/chtypes.h +++ b/os/ports/GCC/PPC/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/PPC/crt0.s b/os/ports/GCC/PPC/crt0.s index f61c50bff..ee8d4c2ac 100644 --- a/os/ports/GCC/PPC/crt0.s +++ b/os/ports/GCC/PPC/crt0.s @@ -1,119 +1,119 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ - -/** - * @file PPC/crt0.s - * @brief Generic PowerPC startup file for ChibiOS/RT. - * - * @addtogroup PPC_CORE - * @{ - */ -/** @cond never */ - - .section .text - .align 2 - .globl _boot_address -_boot_address: - /* - * Stack setup. - */ - lis %r1, __ram_end__@h - ori %r1, %r1, __ram_end__@l - li %r0, 0 - stwu %r0, -8(%r1) - /* - * Early initialization. - */ - bl hwinit0 - /* - * BSS clearing. - */ - lis %r4, __bss_start__@h - ori %r4, %r4, __bss_start__@l - lis %r5, __bss_end__@h - ori %r5, %r5, __bss_end__@l - li %r7, 0 -.bssloop: - cmpl cr0, %r4, %r5 - bge cr0, .bssend - stw %r7, 0(%r4) - addi %r4, %r4, 4 - b .bssloop -.bssend: - /* - * DATA initialization. - */ - lis %r4, __romdata_start__@h - ori %r4, %r4, __romdata_start__@l - lis %r5, __data_start__@h - ori %r5, %r5, __data_start__@l - lis %r6, __data_end__@h - ori %r6, %r6, __data_end__@l -.dataloop: - cmpl cr0, %r5, %r6 - bge cr0, .dataend - lwz %r7, 0(%r4) - addi %r4, %r4, 4 - stw %r7, 0(%r5) - addi %r5, %r5, 4 - b .dataloop -.dataend: - /* - * Small sections registers initialization. - */ - lis %r2, __sdata2_start__@h - ori %r2, %r2, __sdata2_start__@l - lis %r13, __sdata_start__@h - ori %r13, %r13, __sdata_start__@l - /* - * IVPR initialization. - */ - lis %r4, __ivpr_base__@h - mtIVPR %r4 - /* - * Late initialization. - */ - bl hwinit1 - li %r3, 0 - li %r4, 0 - bl main - b main_exit - - /* - * Default main exit code, infinite loop. - */ - .weak main_exit - .globl main_exit -main_exit: -forever: - b forever - - /* - * Default initialization code, none. - */ - .weak hwinit0 - .globl hwinit0 -hwinit0: - .weak hwinit1 - .globl hwinit1 -hwinit1: - blr - -/** @endcond */ -/** @} */ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ + +/** + * @file PPC/crt0.s + * @brief Generic PowerPC startup file for ChibiOS/RT. + * + * @addtogroup PPC_CORE + * @{ + */ +/** @cond never */ + + .section .text + .align 2 + .globl _boot_address +_boot_address: + /* + * Stack setup. + */ + lis %r1, __ram_end__@h + ori %r1, %r1, __ram_end__@l + li %r0, 0 + stwu %r0, -8(%r1) + /* + * Early initialization. + */ + bl hwinit0 + /* + * BSS clearing. + */ + lis %r4, __bss_start__@h + ori %r4, %r4, __bss_start__@l + lis %r5, __bss_end__@h + ori %r5, %r5, __bss_end__@l + li %r7, 0 +.bssloop: + cmpl cr0, %r4, %r5 + bge cr0, .bssend + stw %r7, 0(%r4) + addi %r4, %r4, 4 + b .bssloop +.bssend: + /* + * DATA initialization. + */ + lis %r4, __romdata_start__@h + ori %r4, %r4, __romdata_start__@l + lis %r5, __data_start__@h + ori %r5, %r5, __data_start__@l + lis %r6, __data_end__@h + ori %r6, %r6, __data_end__@l +.dataloop: + cmpl cr0, %r5, %r6 + bge cr0, .dataend + lwz %r7, 0(%r4) + addi %r4, %r4, 4 + stw %r7, 0(%r5) + addi %r5, %r5, 4 + b .dataloop +.dataend: + /* + * Small sections registers initialization. + */ + lis %r2, __sdata2_start__@h + ori %r2, %r2, __sdata2_start__@l + lis %r13, __sdata_start__@h + ori %r13, %r13, __sdata_start__@l + /* + * IVPR initialization. + */ + lis %r4, __ivpr_base__@h + mtIVPR %r4 + /* + * Late initialization. + */ + bl hwinit1 + li %r3, 0 + li %r4, 0 + bl main + b main_exit + + /* + * Default main exit code, infinite loop. + */ + .weak main_exit + .globl main_exit +main_exit: +forever: + b forever + + /* + * Default initialization code, none. + */ + .weak hwinit0 + .globl hwinit0 +hwinit0: + .weak hwinit1 + .globl hwinit1 +hwinit1: + blr + +/** @endcond */ +/** @} */ diff --git a/os/ports/GCC/SIMIA32/chcore.c b/os/ports/GCC/SIMIA32/chcore.c index 3b382b957..56073bb50 100644 --- a/os/ports/GCC/SIMIA32/chcore.c +++ b/os/ports/GCC/SIMIA32/chcore.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/SIMIA32/chcore.h b/os/ports/GCC/SIMIA32/chcore.h index dc73de91f..2e5175c70 100644 --- a/os/ports/GCC/SIMIA32/chcore.h +++ b/os/ports/GCC/SIMIA32/chcore.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/GCC/SIMIA32/chtypes.h b/os/ports/GCC/SIMIA32/chtypes.h index 216ae5e6e..08d5b4cea 100644 --- a/os/ports/GCC/SIMIA32/chtypes.h +++ b/os/ports/GCC/SIMIA32/chtypes.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/ports/ports.dox b/os/ports/ports.dox index 5fd3caa95..393d787be 100644 --- a/os/ports/ports.dox +++ b/os/ports/ports.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/various/ch.cpp b/os/various/ch.cpp index 36999620a..51665a20a 100644 --- a/os/various/ch.cpp +++ b/os/various/ch.cpp @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/various/ch.hpp b/os/various/ch.hpp index f0055a174..aaf27a6d2 100644 --- a/os/various/ch.hpp +++ b/os/various/ch.hpp @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -74,7 +74,7 @@ namespace chibios_rt { class Timer { public: /** - * @brief Embedded @p VirtualTimer structure. + * @brief Embedded @p VirtualTimer structure. */ struct ::VirtualTimer timer; @@ -113,7 +113,7 @@ namespace chibios_rt { class BaseThread { public: /** - * @brief Pointer to the system thread. + * @brief Pointer to the system thread. */ ::Thread *thread_ref; @@ -250,7 +250,7 @@ namespace chibios_rt { public: /** - * @brief The thread name. + * @brief The thread name. */ const char *name; @@ -415,19 +415,19 @@ namespace chibios_rt { /** * @brief Signals the CondVar. - * @details The next thread waiting on the @p CondVar, if any, is awakened. + * @details The next thread waiting on the @p CondVar, if any, is awakened. */ void Signal(void); /** - * @brief Broadcasts the CondVar. + * @brief Broadcasts the CondVar. * @details All the threads waiting on the @p CondVar, if any, are awakened. */ void Broadcast(void); /** * @brief Waits on the CondVar while releasing the controlling mutex. - * + * * @return The wakep mode. * @retval RDY_OK if the condvar was signaled using chCondSignal(). * @retval RDY_RESET if the condvar was signaled using chCondBroadcast(). diff --git a/os/various/evtimer.c b/os/various/evtimer.c index 1a82792de..140d90ed0 100644 --- a/os/various/evtimer.c +++ b/os/various/evtimer.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/various/evtimer.h b/os/various/evtimer.h index acfc97eb1..3f675fffc 100644 --- a/os/various/evtimer.h +++ b/os/various/evtimer.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/various/memstreams.c b/os/various/memstreams.c index 935847ece..9e6bd1e3a 100644 --- a/os/various/memstreams.c +++ b/os/various/memstreams.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/various/memstreams.h b/os/various/memstreams.h index e7c54618b..ce1a8d69c 100644 --- a/os/various/memstreams.h +++ b/os/various/memstreams.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/os/various/shell.c b/os/various/shell.c index b8423e147..41c78b1d8 100644 --- a/os/various/shell.c +++ b/os/various/shell.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -35,7 +35,7 @@ #endif /** - * @brief Shell termination event source. + * @brief Shell termination event source. */ EventSource shell_terminated; @@ -107,7 +107,7 @@ static void cmd_systime(BaseChannel *chp, int argc, char *argv[]) { } /** - * @brief Array of the default commands. + * @brief Array of the default commands. */ static ShellCommand local_commands[] = { {"info", cmd_info}, @@ -130,11 +130,11 @@ static bool_t cmdexec(const ShellCommand *scp, BaseChannel *chp, /** * @brief Shell thread function. - * - * @param[in] p pointer to a @p BaseChannel object + * + * @param[in] p pointer to a @p BaseChannel object * @return Termination reason. * @retval RDY_OK terminated by command. - * @retval RDY_RESET terminated by reset condition on the I/O channel. + * @retval RDY_RESET terminated by reset condition on the I/O channel. */ static msg_t shell_thread(void *p) { int n; @@ -192,7 +192,7 @@ static msg_t shell_thread(void *p) { } /** - * @brief Shell manager initialization. + * @brief Shell manager initialization. */ void shellInit(void) { @@ -201,8 +201,8 @@ void shellInit(void) { /** * @brief Spawns a new shell. - * - * @param[in] scp pointer to a @p ShellConfig object + * + * @param[in] scp pointer to a @p ShellConfig object * @param[in] size size of the shell working area to be allocated * @param[in] prio the priority level for the new shell * @@ -216,9 +216,9 @@ Thread *shellCreate(const ShellConfig *scp, size_t size, tprio_t prio) { /** * @brief Prints a string. - * + * * @param[in] chp pointer to a @p BaseChannel object - * @param[in] msg pointer to the string + * @param[in] msg pointer to the string */ void shellPrint(BaseChannel *chp, const char *msg) { @@ -240,11 +240,11 @@ void shellPrintLine(BaseChannel *chp, const char *msg) { /** * @brief Reads a whole line from the input channel. - * + * * @param[in] chp pointer to a @p BaseChannel object - * @param[in] line pointer to the line buffer + * @param[in] line pointer to the line buffer * @param[in] size buffer maximum length - * + * * @return The operation status. * @retval TRUE the channel was reset or CTRL-D pressed. * @retval FALSE operation successful. diff --git a/os/various/shell.h b/os/various/shell.h index c3433bc21..821a2c985 100644 --- a/os/various/shell.h +++ b/os/various/shell.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -49,12 +49,12 @@ #endif /** - * @brief Command handler function type. + * @brief Command handler function type. */ typedef void (*shellcmd_t)(BaseChannel *chp, int argc, char *argv[]); /** - * @brief Custom command entry type. + * @brief Custom command entry type. */ typedef struct { const char *sc_name; /**< @brief Command name. */ @@ -62,7 +62,7 @@ typedef struct { } ShellCommand; /** - * @brief Shell descriptor type. + * @brief Shell descriptor type. */ typedef struct { BaseChannel *sc_channel; /**< @brief I/O channel associated diff --git a/os/various/syscalls.c b/os/various/syscalls.c index 5c886f8f5..0f0a14619 100644 --- a/os/various/syscalls.c +++ b/os/various/syscalls.c @@ -1,170 +1,170 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - 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 . -*/ -/* -* **** This file incorporates work covered by the following copyright and **** -* **** permission notice: **** -* -* Copyright (c) 2009 by Michael Fischer. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* 3. Neither the name of the author nor the names of its contributors may -* be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -**************************************************************************** -* History: -* -* 28.03.09 mifi First Version, based on the original syscall.c from -* newlib version 1.17.0 -* 17.08.09 gdisirio Modified the file for use under ChibiOS/RT -* 15.11.09 gdisirio Added read and write handling -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "ch.h" -#if defined(STDOUT_SD) || defined(STDIN_SD) -#include "hal.h" -#endif - -/***************************************************************************/ - -int _read_r(struct _reent *r, int file, char * ptr, int len) -{ - (void)r; -#if defined(STDIN_SD) - if (!len || (file != 0)) { - __errno_r(r) = EINVAL; - return -1; - } - len = sdRead(&STDOUT_SD, (uint8_t *)ptr, (size_t)len); - return len; -#else - (void)file; - (void)ptr; - (void)len; - __errno_r(r) = EINVAL; - return -1; -#endif -} - -/***************************************************************************/ - -int _lseek_r(struct _reent *r, int file, int ptr, int dir) -{ - (void)r; - (void)file; - (void)ptr; - (void)dir; - - return 0; -} - -/***************************************************************************/ - -int _write_r(struct _reent *r, int file, char * ptr, int len) -{ - (void)r; - (void)file; - (void)ptr; -#if defined(STDOUT_SD) - if (file != 1) { - __errno_r(r) = EINVAL; - return -1; - } - sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len); -#endif - return len; -} - -/***************************************************************************/ - -int _close_r(struct _reent *r, int file) -{ - (void)r; - (void)file; - - return 0; -} - -/***************************************************************************/ - -caddr_t _sbrk_r(struct _reent *r, int incr) -{ - void *p; - - chDbgCheck(incr > 0, "_sbrk_r"); - - (void)r; - p = chCoreAlloc((size_t)incr); - if (p == NULL) { - __errno_r(r) = ENOMEM; - return (caddr_t)-1; - } - return (caddr_t)p; -} - -/***************************************************************************/ - -int _fstat_r(struct _reent *r, int file, struct stat * st) -{ - (void)r; - (void)file; - - memset(st, 0, sizeof(*st)); - st->st_mode = S_IFCHR; - return 0; -} - -/***************************************************************************/ - -int _isatty_r(struct _reent *r, int fd) -{ - (void)r; - (void)fd; - - return 1; -} - -/*** EOF ***/ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + + 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 . +*/ +/* +* **** This file incorporates work covered by the following copyright and **** +* **** permission notice: **** +* +* Copyright (c) 2009 by Michael Fischer. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. Neither the name of the author nor the names of its contributors may +* be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +**************************************************************************** +* History: +* +* 28.03.09 mifi First Version, based on the original syscall.c from +* newlib version 1.17.0 +* 17.08.09 gdisirio Modified the file for use under ChibiOS/RT +* 15.11.09 gdisirio Added read and write handling +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "ch.h" +#if defined(STDOUT_SD) || defined(STDIN_SD) +#include "hal.h" +#endif + +/***************************************************************************/ + +int _read_r(struct _reent *r, int file, char * ptr, int len) +{ + (void)r; +#if defined(STDIN_SD) + if (!len || (file != 0)) { + __errno_r(r) = EINVAL; + return -1; + } + len = sdRead(&STDOUT_SD, (uint8_t *)ptr, (size_t)len); + return len; +#else + (void)file; + (void)ptr; + (void)len; + __errno_r(r) = EINVAL; + return -1; +#endif +} + +/***************************************************************************/ + +int _lseek_r(struct _reent *r, int file, int ptr, int dir) +{ + (void)r; + (void)file; + (void)ptr; + (void)dir; + + return 0; +} + +/***************************************************************************/ + +int _write_r(struct _reent *r, int file, char * ptr, int len) +{ + (void)r; + (void)file; + (void)ptr; +#if defined(STDOUT_SD) + if (file != 1) { + __errno_r(r) = EINVAL; + return -1; + } + sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len); +#endif + return len; +} + +/***************************************************************************/ + +int _close_r(struct _reent *r, int file) +{ + (void)r; + (void)file; + + return 0; +} + +/***************************************************************************/ + +caddr_t _sbrk_r(struct _reent *r, int incr) +{ + void *p; + + chDbgCheck(incr > 0, "_sbrk_r"); + + (void)r; + p = chCoreAlloc((size_t)incr); + if (p == NULL) { + __errno_r(r) = ENOMEM; + return (caddr_t)-1; + } + return (caddr_t)p; +} + +/***************************************************************************/ + +int _fstat_r(struct _reent *r, int file, struct stat * st) +{ + (void)r; + (void)file; + + memset(st, 0, sizeof(*st)); + st->st_mode = S_IFCHR; + return 0; +} + +/***************************************************************************/ + +int _isatty_r(struct _reent *r, int fd) +{ + (void)r; + (void)fd; + + return 1; +} + +/*** EOF ***/ diff --git a/os/various/various.dox b/os/various/various.dox index 10dfe874f..19d7987d9 100644 --- a/os/various/various.dox +++ b/os/various/various.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3