pal.dox 3.79 KB
/*
    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
                 2011,2012 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 <http://www.gnu.org/licenses/>.

                                      ---

    A special exception to the GPL can be applied should you wish to distribute
    a combined work that includes ChibiOS/RT, without being obliged to provide
    the source code for any proprietary components. See the file exception.txt
    for full details of how and when the exception can be applied.
*/

/**
 * @defgroup PAL PAL Driver
 * @brief   I/O Ports Abstraction Layer
 * @details This module defines an abstract interface for digital I/O ports.
 *          Note that most I/O ports functions are just macros. The macros
 *          have default software implementations that can be redefined in a
 *          PAL Low Level Driver if the target hardware supports special
 *          features like, for example, atomic bit set/reset/masking. Please
 *          refer to the ports specific documentation for details.<br>
 *          The @ref PAL has the advantage to make the access to the I/O
 *          ports platform independent and still be optimized for the specific
 *          architectures.<br>
 *          Note that the PAL Low Level Driver may also offer non standard
 *          macro and functions in order to support specific features but,
 *          of course, the use of such interfaces would not be portable.
 *          Such interfaces shall be marked with the architecture name inside
 *          the function names.
 * @pre     In order to use the PAL driver the @p HAL_USE_PAL option
 *          must be enabled in @p halconf.h.
 *
 * @section pal_1 Implementation Rules
 * In implementing a PAL Low Level Driver there are some rules/behaviors that
 * should be respected.
 *
 * @subsection pal_1_1 Writing on input pads
 * The behavior is not specified but there are implementations better than
 * others, this is the list of possible implementations, preferred options
 * are on top:
 * -# The written value is not actually output but latched, should the pads
 *    be reprogrammed as outputs the value would be in effect.
 * -# The write operation is ignored.
 * -# The write operation has side effects, as example disabling/enabling
 *    pull up/down resistors or changing the pad direction. This scenario is
 *    discouraged, please try to avoid this scenario.
 * .
 * @subsection pal_1_2 Reading from output pads
 * The behavior is not specified but there are implementations better than
 * others, this is the list of possible implementations, preferred options
 * are on top:
 * -# The actual pads states are read (not the output latch).
 * -# The output latch value is read (regardless of the actual pads states).
 * -# Unspecified, please try to avoid this scenario.
 * .
 * @subsection pal_1_3 Writing unused or unimplemented port bits
 * The behavior is not specified.
 *
 * @subsection pal_1_4 Reading from unused or unimplemented port bits
 * The behavior is not specified.
 *
 * @subsection pal_1_5 Reading or writing on pins associated to other functionalities
 * The behavior is not specified.
 *
 * @ingroup IO
 */