git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7555 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
0ee4e06235
commit
a0c1cff44c
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 ADC ADC Driver
|
||||
* @brief Generic ADC Driver.
|
||||
* @details This module implements a generic ADC (Analog to Digital Converter)
|
||||
* driver supporting a variety of buffer and conversion modes.
|
||||
* @pre In order to use the ADC driver the @p HAL_USE_ADC option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section adc_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
size="5, 7";
|
||||
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="ADC_STOP\nLow Power"];
|
||||
uninit [label="ADC_UNINIT", style="bold"];
|
||||
ready [label="ADC_READY\nClock Enabled"];
|
||||
active [label="ADC_ACTIVE\nConverting"];
|
||||
error [label="ADC_ERROR\nError"];
|
||||
complete [label="ADC_COMPLETE\nComplete"];
|
||||
|
||||
uninit -> stop [label="\n adcInit()", constraint=false];
|
||||
stop -> ready [label="\nadcStart()"];
|
||||
ready -> ready [label="\nadcStart()\nadcStopConversion()"];
|
||||
ready -> stop [label="\nadcStop()"];
|
||||
stop -> stop [label="\nadcStop()"];
|
||||
ready -> active [label="\nadcStartConversion() (async)\nadcConvert() (sync)"];
|
||||
active -> ready [label="\nadcStopConversion()\nsync return"];
|
||||
active -> active [label="\nasync callback (half buffer, circular)\nasync callback (full buffer)\n>acg_endcb<"];
|
||||
active -> complete [label="\n\nasync callback (full buffer)\n>end_cb<"];
|
||||
active -> error [label="\n\nasync callback (error)\n>error_cb<"];
|
||||
complete -> active [label="\nadcStartConversionI()\nthen\ncallback return"];
|
||||
complete -> ready [label="\ncallback return"];
|
||||
error -> active [label="\nadcStartConversionI()\nthen\ncallback return"];
|
||||
error -> ready [label="\ncallback return"];
|
||||
}
|
||||
* @enddot
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="ADC_STOP\nLow Power"];
|
||||
uninit [label="ADC_UNINIT", style="bold"];
|
||||
ready [label="ADC_READY\nClock Enabled"];
|
||||
active [label="ADC_ACTIVE\nConverting"];
|
||||
error [label="ADC_ERROR\nError"];
|
||||
complete [label="ADC_COMPLETE\nComplete"];
|
||||
|
||||
uninit -> stop [label="\n adcInit()", constraint=false];
|
||||
stop -> ready [label="\nadcStart()"];
|
||||
ready -> ready [label="\nadcStart()\nadcStopConversion()"];
|
||||
ready -> stop [label="\nadcStop()"];
|
||||
stop -> stop [label="\nadcStop()"];
|
||||
ready -> active [label="\nadcStartConversion() (async)\nadcConvert() (sync)"];
|
||||
active -> ready [label="\nadcStopConversion()\nsync return"];
|
||||
active -> active [label="\nasync callback (half buffer, circular)\nasync callback (full buffer)\n>acg_endcb<"];
|
||||
active -> complete [label="\n\nasync callback (full buffer)\n>end_cb<"];
|
||||
active -> error [label="\n\nasync callback (error)\n>error_cb<"];
|
||||
complete -> active [label="\nadcStartConversionI()\nthen\ncallback return"];
|
||||
complete -> ready [label="\ncallback return"];
|
||||
error -> active [label="\nadcStartConversionI()\nthen\ncallback return"];
|
||||
error -> ready [label="\ncallback return"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
*
|
||||
* @section adc_2 ADC Operations
|
||||
* The ADC driver is quite complex, an explanation of the terminology and of
|
||||
* the operational details follows.
|
||||
*
|
||||
* @subsection adc_2_1 ADC Conversion Groups
|
||||
* The @p ADCConversionGroup is the objects that specifies a physical
|
||||
* conversion operation. This structure contains some standard fields and
|
||||
* several implementation-dependent fields.<br>
|
||||
* The standard fields define the CG mode, the number of channels belonging
|
||||
* to the CG and the optional callbacks.<br>
|
||||
* The implementation-dependent fields specify the physical ADC operation
|
||||
* mode, the analog channels belonging to the group and any other
|
||||
* implementation-specific setting. Usually the extra fields just mirror
|
||||
* the physical ADC registers, please refer to the vendor's MCU Reference
|
||||
* Manual for details about the available settings. Details are also available
|
||||
* into the documentation of the ADC low level drivers and in the various
|
||||
* sample applications.
|
||||
*
|
||||
* @subsection adc_2_2 ADC Conversion Modes
|
||||
* The driver supports several conversion modes:
|
||||
* - <b>One Shot</b>, the driver performs a single group conversion then stops.
|
||||
* - <b>Linear Buffer</b>, the driver performs a series of group conversions
|
||||
* then stops. This mode is like a one shot conversion repeated N times,
|
||||
* the buffer pointer increases after each conversion. The buffer is
|
||||
* organized as an S(CG)*N samples matrix, when S(CG) is the conversion
|
||||
* group size (number of channels) and N is the buffer depth (number of
|
||||
* repeated conversions).
|
||||
* - <b>Circular Buffer</b>, much like the linear mode but the operation does
|
||||
* not stop when the buffer is filled, it is automatically restarted
|
||||
* with the buffer pointer wrapping back to the buffer base.
|
||||
* .
|
||||
* @subsection adc_2_3 ADC Callbacks
|
||||
* The driver is able to invoke callbacks during the conversion process. A
|
||||
* callback is invoked when the operation has been completed or, in circular
|
||||
* mode, when the buffer has been filled and the operation is restarted. In
|
||||
* circular mode a callback is also invoked when the buffer is half filled.<br>
|
||||
* The "half filled" and "filled" callbacks in circular mode allow to
|
||||
* implement "streaming processing" of the sampled data, while the driver is
|
||||
* busy filling one half of the buffer the application can process the
|
||||
* other half, this allows for continuous interleaved operations.
|
||||
*
|
||||
* The driver is not thread safe for performance reasons, if you need to access
|
||||
* the ADC bus from multiple threads then use the @p adcAcquireBus() and
|
||||
* @p adcReleaseBus() APIs in order to gain exclusive access.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 CAN CAN Driver
|
||||
* @brief Generic CAN Driver.
|
||||
* @details This module implements a generic CAN (Controller Area Network)
|
||||
* driver allowing the exchange of information at frame level.
|
||||
* @pre In order to use the CAN driver the @p HAL_USE_CAN option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section can_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
size="5, 7";
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="CAN_STOP\nLow Power"];
|
||||
uninit [label="CAN_UNINIT", style="bold"];
|
||||
starting [label="CAN_STARTING\nInitializing"];
|
||||
ready [label="CAN_READY\nClock Enabled"];
|
||||
sleep [label="CAN_SLEEP\nLow Power"];
|
||||
|
||||
uninit -> stop [label=" canInit()", constraint=false];
|
||||
stop -> stop [label="\ncanStop()"];
|
||||
stop -> ready [label="\ncanStart()\n(fast implementation)"];
|
||||
stop -> starting [label="\ncanStart()\n(slow implementation)"];
|
||||
starting -> starting [label="\ncanStart()\n(other thread)"];
|
||||
starting -> ready [label="\ninitialization complete\n(all threads)"];
|
||||
ready -> stop [label="\ncanStop()"];
|
||||
ready -> ready [label="\ncanStart()\ncanReceive()\ncanTransmit()"];
|
||||
ready -> sleep [label="\ncanSleep()"];
|
||||
sleep -> sleep [label="\ncanSleep()"];
|
||||
sleep -> ready [label="\ncanWakeup()"];
|
||||
sleep -> ready [label="\nhardware\nwakeup event"];
|
||||
}
|
||||
* @enddot
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="CAN_STOP\nLow Power"];
|
||||
uninit [label="CAN_UNINIT", style="bold"];
|
||||
starting [label="CAN_STARTING\nInitializing"];
|
||||
ready [label="CAN_READY\nClock Enabled"];
|
||||
sleep [label="CAN_SLEEP\nLow Power"];
|
||||
|
||||
uninit -> stop [label=" canInit()", constraint=false];
|
||||
stop -> stop [label="\ncanStop()"];
|
||||
stop -> ready [label="\ncanStart()\n(fast implementation)"];
|
||||
stop -> starting [label="\ncanStart()\n(slow implementation)"];
|
||||
starting -> starting [label="\ncanStart()\n(other thread)"];
|
||||
starting -> ready [label="\ninitialization complete\n(all threads)"];
|
||||
ready -> stop [label="\ncanStop()"];
|
||||
ready -> ready [label="\ncanStart()\ncanReceive()\ncanTransmit()"];
|
||||
ready -> sleep [label="\ncanSleep()"];
|
||||
sleep -> sleep [label="\ncanSleep()"];
|
||||
sleep -> ready [label="\ncanWakeup()"];
|
||||
sleep -> ready [label="\nhardware\nwakeup event"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 EXT EXT Driver
|
||||
* @brief Generic EXT Driver.
|
||||
* @details This module implements a generic EXT (EXTernal) driver.
|
||||
* @pre In order to use the EXT driver the @p HAL_USE_EXT option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section ext_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
size="5, 7";
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Sans, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Sans, fontsize=8];
|
||||
|
||||
uninit [label="EXT_UNINIT", style="bold"];
|
||||
stop [label="EXT_STOP\nLow Power"];
|
||||
active [label="EXT_ACTIVE"];
|
||||
|
||||
uninit -> stop [label="extInit()"];
|
||||
stop -> stop [label="\nextStop()"];
|
||||
stop -> active [label="\nextStart()"];
|
||||
active -> stop [label="\nextStop()"];
|
||||
active -> active [label="\nextStart()"];
|
||||
}
|
||||
* @enddot
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Sans, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Sans, fontsize=8];
|
||||
|
||||
uninit [label="EXT_UNINIT", style="bold"];
|
||||
stop [label="EXT_STOP\nLow Power"];
|
||||
active [label="EXT_ACTIVE"];
|
||||
|
||||
uninit -> stop [label="extInit()"];
|
||||
stop -> stop [label="\nextStop()"];
|
||||
stop -> active [label="\nextStart()"];
|
||||
active -> stop [label="\nextStop()"];
|
||||
active -> active [label="\nextStart()"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
*
|
||||
* @section ext_2 EXT Operations.
|
||||
* This driver abstracts generic external interrupt sources, a callback
|
||||
* is invoked when a programmable transition is detected on one of the
|
||||
* configured channels. Several channel modes are possible.
|
||||
* - <b>EXT_CH_MODE_DISABLED</b>, channel not used.
|
||||
* - <b>EXT_CH_MODE_RISING_EDGE</b>, callback on a rising edge.
|
||||
* - <b>EXT_CH_MODE_FALLING_EDGE</b>, callback on a falling edge.
|
||||
* - <b>EXT_CH_MODE_BOTH_EDGES</b>, callback on a both edges.
|
||||
* .
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 GPT GPT Driver
|
||||
* @brief Generic GPT Driver.
|
||||
* @details This module implements a generic GPT (General Purpose Timer)
|
||||
* driver. The timer can be programmed in order to trigger callbacks
|
||||
* after a specified time period or continuously with a specified
|
||||
* interval.
|
||||
* @pre In order to use the GPT driver the @p HAL_USE_GPT option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section gpt_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="GPT_STOP\nLow Power"];
|
||||
uninit [label="GPT_UNINIT", style="bold"];
|
||||
ready [label="GPT_READY\nClock Enabled"];
|
||||
continuous [label="GPT_CONT..S\nContinuous\nMode"];
|
||||
oneshot [label="GPT_ONESHOT\nOne Shot\nMode"];
|
||||
|
||||
uninit -> stop [label=" gptInit()", constraint=false];
|
||||
stop -> stop [label="\ngptStop()"];
|
||||
stop -> ready [label="\ngptStart()"];
|
||||
ready -> stop [label="\ngptStop()"];
|
||||
ready -> ready [label="\ngptStart()"];
|
||||
ready -> continuous [label="\ngptStartContinuous()"];
|
||||
continuous -> ready [label="\ngptStopTimer()"];
|
||||
continuous -> continuous [label=">callback<"];
|
||||
ready -> oneshot [label="\ngptStartOneShot()\ngptPolledDelay()"];
|
||||
oneshot -> ready [label="\n>callback<\nor\nDelay Over"];
|
||||
}
|
||||
* @enddot
|
||||
*
|
||||
* @section gpt_2 GPT Operations.
|
||||
* This driver abstracts a generic timer composed of:
|
||||
* - A clock prescaler.
|
||||
* - A main up counter.
|
||||
* - A comparator register that resets the main counter to zero when the limit
|
||||
* is reached. A callback is invoked when this happens.
|
||||
* .
|
||||
* The timer can operate in three different modes:
|
||||
* - <b>Continuous Mode</b>, a periodic callback is invoked until the driver
|
||||
* is explicitly stopped.
|
||||
* - <b>One Shot Mode</b>, a callback is invoked after the programmed period
|
||||
* and then the timer automatically stops.
|
||||
* - <b>Delay Mode</b>, the timer is used for inserting a brief delay into
|
||||
* the execution flow, no callback is invoked in this mode.
|
||||
* .
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 HAL HAL Driver
|
||||
* @brief Hardware Abstraction Layer.
|
||||
* @details The HAL (Hardware Abstraction Layer) driver performs the system
|
||||
* initialization and includes the platform support code shared by
|
||||
* the other drivers. This driver does contain any API function
|
||||
* except for a general initialization function @p halInit() that
|
||||
* must be invoked before any HAL service can be used, usually the
|
||||
* HAL initialization should be performed immediately before the
|
||||
* kernel initialization.<br>
|
||||
* Some HAL driver implementations also offer a custom early clock
|
||||
* setup function that can be invoked before the C runtime
|
||||
* initialization in order to accelerate the startup time.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 I2C I2C Driver
|
||||
* @brief Generic I2C Driver.
|
||||
* @details This module implements a generic I2C (Inter-Integrated Circuit)
|
||||
* driver.
|
||||
* @pre In order to use the I2C driver the @p HAL_USE_I2C option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section i2c_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
size="5, 7";
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="I2C_STOP\nLow Power"];
|
||||
uninit [label="I2C_UNINIT", style="bold"];
|
||||
ready [label="I2C_READY\nClock Enabled"];
|
||||
active_tx [label="I2C_ACTIVE_TX\nBus TX Active"];
|
||||
active_rx [label="I2C_ACTIVE_RX\nBus RX Active"];
|
||||
locked [label="I2C_LOCKED\nBus Locked"];
|
||||
|
||||
uninit -> stop [label="i2cInit()", constraint=false];
|
||||
stop -> stop [label="i2cStop()"];
|
||||
stop -> ready [label="i2cStart()"];
|
||||
ready -> ready [label="i2cStart()"];
|
||||
ready -> stop [label="i2cStop()"];
|
||||
ready -> active_tx [label="i2cMasterTransmit()"];
|
||||
ready -> active_rx [label="i2cMasterReceive()"];
|
||||
active_tx -> ready [label="completed"];
|
||||
active_rx -> ready [label="completed"];
|
||||
active_tx -> locked [label="RDY_TIMEOUT"];
|
||||
active_rx -> locked [label="RDY_TIMEOUT"];
|
||||
locked -> stop [label="i2cStop()"];
|
||||
locked -> ready [label="i2cStart()"];
|
||||
}
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="I2C_STOP\nLow Power"];
|
||||
uninit [label="I2C_UNINIT", style="bold"];
|
||||
ready [label="I2C_READY\nClock Enabled"];
|
||||
active_tx [label="I2C_ACTIVE_TX\nBus TX Active"];
|
||||
active_rx [label="I2C_ACTIVE_RX\nBus RX Active"];
|
||||
locked [label="I2C_LOCKED\nBus Locked"];
|
||||
|
||||
uninit -> stop [label="i2cInit()", constraint=false];
|
||||
stop -> stop [label="i2cStop()"];
|
||||
stop -> ready [label="i2cStart()"];
|
||||
ready -> ready [label="i2cStart()"];
|
||||
ready -> stop [label="i2cStop()"];
|
||||
ready -> active_tx [label="i2cMasterTransmit()"];
|
||||
ready -> active_rx [label="i2cMasterReceive()"];
|
||||
active_tx -> ready [label="completed"];
|
||||
active_rx -> ready [label="completed"];
|
||||
active_tx -> locked [label="RDY_TIMEOUT"];
|
||||
active_rx -> locked [label="RDY_TIMEOUT"];
|
||||
locked -> stop [label="i2cStop()"];
|
||||
locked -> ready [label="i2cStart()"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
* The driver is not thread safe for performance reasons, if you need to access
|
||||
* the I2C bus from multiple threads then use the @p i2cAcquireBus() and
|
||||
* @p i2cReleaseBus() APIs in order to gain exclusive access.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 I2S I2S Driver
|
||||
* @brief Generic I2S Driver.
|
||||
* @details This module implements a generic I2S driver.
|
||||
* @pre In order to use the I2S driver the @p HAL_USE_I2S option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section i2s_1 Driver State Machine
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 IO_BLOCK Abstract I/O Block Device
|
||||
* @ingroup IO
|
||||
*
|
||||
* @section io_block_1 Driver State Machine
|
||||
* The drivers implementing this interface shall implement the following
|
||||
* state machine internally. Not all the driver functionalities can be used
|
||||
* in any moment, any transition not explicitly shown in the following
|
||||
* diagram has to be considered an error and shall be captured by an
|
||||
* assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
size="5, 7";
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Sans, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Sans, fontsize=8];
|
||||
|
||||
stop [label="BLK_STOP\nLow Power"];
|
||||
uninit [label="BLK_UNINIT", style="bold"];
|
||||
active [label="BLK_ACTIVE\nClock Enabled"];
|
||||
connecting [label="BLK_CONN.ING\nConnecting"];
|
||||
disconnecting [label="BLK_DISC.ING\nDisconnecting"];
|
||||
ready [label="BLK_READY\nCard Ready"];
|
||||
reading [label="BLK_READING\nReading"];
|
||||
writing [label="BLK_WRITING\nWriting"];
|
||||
|
||||
uninit -> stop [label=" blkInit()", constraint=false];
|
||||
stop -> stop [label="\nblkStop()"];
|
||||
stop -> active [label="\nblkStart()"];
|
||||
active -> stop [label="\nblkStop()"];
|
||||
active -> active [label="\nblkStart()\nblkDisconnect()"];
|
||||
active -> connecting [label="\nblkConnect()"];
|
||||
connecting -> ready [label="\nconnection\nsuccessful"];
|
||||
connecting -> ready [label="\nblkConnect()", dir="back"];
|
||||
connecting -> active [label="\nconnection\nfailed"];
|
||||
disconnecting -> ready [label="\nblkDisconnect()", dir="back"];
|
||||
active -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
|
||||
ready -> reading [label="\nblkRead()"];
|
||||
reading -> ready [label="\nread finished\nread error"];
|
||||
ready -> writing [label="\nblkWrite()"];
|
||||
writing -> ready [label="\nwrite finished\nwrite error"];
|
||||
}
|
||||
* @enddot
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
|
||||
node [shape=circle, fontname=Sans, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Sans, fontsize=8];
|
||||
|
||||
stop [label="BLK_STOP\nLow Power"];
|
||||
uninit [label="BLK_UNINIT", style="bold"];
|
||||
active [label="BLK_ACTIVE\nClock Enabled"];
|
||||
connecting [label="BLK_CONN.ING\nConnecting"];
|
||||
disconnecting [label="BLK_DISC.ING\nDisconnecting"];
|
||||
ready [label="BLK_READY\nCard Ready"];
|
||||
reading [label="BLK_READING\nReading"];
|
||||
writing [label="BLK_WRITING\nWriting"];
|
||||
syncing [label="BLK_SYNCING\nSynchronizing"];
|
||||
|
||||
uninit -> stop [label=" blkInit()", constraint=false];
|
||||
stop -> stop [label="\nblkStop()"];
|
||||
stop -> active [label="\nblkStart()"];
|
||||
active -> stop [label="\nblkStop()"];
|
||||
active -> active [label="\nblkStart()\nblkDisconnect()"];
|
||||
active -> connecting [label="\nblkConnect()"];
|
||||
connecting -> ready [label="\nconnection\nsuccessful"];
|
||||
connecting -> ready [label="\nblkConnect()", dir="back"];
|
||||
connecting -> active [label="\nconnection\nfailed"];
|
||||
disconnecting -> ready [label="\nblkDisconnect()", dir="back"];
|
||||
active -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
|
||||
ready -> reading [label="\nblkRead()"];
|
||||
reading -> ready [label="\nread finished\nread error"];
|
||||
ready -> writing [label="\nblkWrite()"];
|
||||
writing -> ready [label="\nwrite finished\nwrite error"];
|
||||
ready -> syncing [label="\nblkSync()"];
|
||||
syncing -> ready [label="\nsynchronization finished"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
*/
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 IO_CHANNEL Abstract I/O Channel
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 MAC MAC Driver
|
||||
* @brief Generic MAC driver.
|
||||
* @details This module implements a generic MAC (Media Access Control)
|
||||
* driver for Ethernet controllers.
|
||||
* @pre In order to use the MAC driver the @p HAL_USE_MAC option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 MMC_SPI MMC over SPI Driver
|
||||
* @brief Generic MMC driver.
|
||||
* @details This module implements a portable MMC/SD driver that uses a SPI
|
||||
* driver as physical layer. Hot plugging and removal are supported
|
||||
* through kernel events.
|
||||
* @pre In order to use the MMC_SPI driver the @p HAL_USE_MMC_SPI and
|
||||
* @p HAL_USE_SPI options must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section mmc_spi_1 Driver State Machine
|
||||
* This driver implements a state machine internally, see the @ref IO_BLOCK
|
||||
* module documentation for details.
|
||||
*
|
||||
* @section mmc_spi_2 Driver Operations
|
||||
* This driver allows to read or write single or multiple 512 bytes blocks
|
||||
* on a SD Card.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 MMCSD MMC/SD Block Device
|
||||
* @details This module implements a common ancestor for all device drivers
|
||||
* accessing MMC or SD cards. This interface inherits the state
|
||||
* machine and the interface from the @ref IO_BLOCK module.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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
|
||||
*/
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 RTC RTC Driver
|
||||
* @brief Real Time Clock Abstraction Layer
|
||||
* @details This module defines an abstract interface for a Real Time Clock
|
||||
* Peripheral.
|
||||
* @pre In order to use the RTC driver the @p HAL_USE_RTC option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 SDC SDC Driver
|
||||
* @brief Generic SD Card Driver.
|
||||
* @details This module implements a generic SDC (Secure Digital Card) driver.
|
||||
* @pre In order to use the SDC driver the @p HAL_USE_SDC option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section sdc_1 Driver State Machine
|
||||
* This driver implements a state machine internally, see the @ref IO_BLOCK
|
||||
* module documentation for details.
|
||||
*
|
||||
* @section sdc_2 Driver Operations
|
||||
* This driver allows to read or write single or multiple 512 bytes blocks
|
||||
* on a SD Card.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 SERIAL Serial Driver
|
||||
* @brief Generic Serial Driver.
|
||||
* @details This module implements a generic full duplex serial driver. The
|
||||
* driver implements a @p SerialDriver interface and uses I/O Queues
|
||||
* for communication between the upper and the lower driver. Event
|
||||
* flags are used to notify the application about incoming data,
|
||||
* outgoing data and other I/O events.<br>
|
||||
* The module also contains functions that make the implementation
|
||||
* of the interrupt service routines much easier.
|
||||
* @pre In order to use the SERIAL driver the @p HAL_USE_SERIAL option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
*
|
||||
* @section serial_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
uninit [label="SD_UNINIT", style="bold"];
|
||||
stop [label="SD_STOP\nLow Power"];
|
||||
ready [label="SD_READY\nClock Enabled"];
|
||||
|
||||
uninit -> stop [label=" sdInit()"];
|
||||
stop -> stop [label="\nsdStop()"];
|
||||
stop -> ready [label="\nsdStart()"];
|
||||
ready -> stop [label="\nsdStop()"];
|
||||
ready -> ready [label="\nsdStart()"];
|
||||
ready -> ready [label="\nAny I/O operation"];
|
||||
}
|
||||
* @enddot
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 SERIAL_USB Serial over USB Driver
|
||||
* @brief Serial over USB Driver.
|
||||
* @details This module implements an USB Communication Device Class
|
||||
* (CDC) as a normal serial communication port accessible from
|
||||
* the device application.
|
||||
* @pre In order to use the USB over Serial driver the
|
||||
* @p HAL_USE_SERIAL_USB option must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section usb_serial_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
uninit [label="SDU_UNINIT", style="bold"];
|
||||
stop [label="SDU_STOP\nLow Power"];
|
||||
ready [label="SDU_READY\nClock Enabled"];
|
||||
|
||||
uninit -> stop [label=" sduInit()"];
|
||||
stop -> stop [label="\nsduStop()"];
|
||||
stop -> ready [label="\nsduStart()"];
|
||||
ready -> stop [label="\nsduStop()"];
|
||||
ready -> ready [label="\nsduStart()"];
|
||||
ready -> ready [label="\nAny I/O operation"];
|
||||
}
|
||||
* @enddot
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 SPI SPI Driver
|
||||
* @brief Generic SPI Driver.
|
||||
* @details This module implements a generic SPI (Serial Peripheral Interface)
|
||||
* driver allowing bidirectional and monodirectional transfers,
|
||||
* complex atomic transactions are supported as well.
|
||||
* @pre In order to use the SPI driver the @p HAL_USE_SPI option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section spi_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
size="5, 7";
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="SPI_STOP\nLow Power"];
|
||||
uninit [label="SPI_UNINIT", style="bold"];
|
||||
ready [label="SPI_READY\nClock Enabled"];
|
||||
active [label="SPI_ACTIVE\nBus Active"];
|
||||
complete [label="SPI_COMPLETE\nComplete"];
|
||||
|
||||
uninit -> stop [label="\n spiInit()", constraint=false];
|
||||
stop -> ready [label="\nspiStart()"];
|
||||
ready -> ready [label="\nspiSelect()\nspiUnselect()\nspiStart()"];
|
||||
ready -> stop [label="\nspiStop()"];
|
||||
stop -> stop [label="\nspiStop()"];
|
||||
ready -> active [label="\nspiStartXXXI() (async)\nspiXXX() (sync)"];
|
||||
active -> ready [label="\nsync return"];
|
||||
active -> complete [label="\nasync callback\n>spc_endcb<"];
|
||||
complete -> active [label="\nspiStartXXXI() (async)\nthen\ncallback return"];
|
||||
complete -> ready [label="\ncallback return"];
|
||||
}
|
||||
* @enddot
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="SPI_STOP\nLow Power"];
|
||||
uninit [label="SPI_UNINIT", style="bold"];
|
||||
ready [label="SPI_READY\nClock Enabled"];
|
||||
active [label="SPI_ACTIVE\nBus Active"];
|
||||
complete [label="SPI_COMPLETE\nComplete"];
|
||||
|
||||
uninit -> stop [label="\n spiInit()", constraint=false];
|
||||
stop -> ready [label="\nspiStart()"];
|
||||
ready -> ready [label="\nspiSelect()\nspiUnselect()\nspiStart()"];
|
||||
ready -> stop [label="\nspiStop()"];
|
||||
stop -> stop [label="\nspiStop()"];
|
||||
ready -> active [label="\nspiStartXXX() (async)\nspiXXX() (sync)"];
|
||||
active -> ready [label="\nsync return"];
|
||||
active -> complete [label="\nasync callback\n>spc_endcb<"];
|
||||
complete -> active [label="\nspiStartXXXI() (async)\nthen\ncallback return"];
|
||||
complete -> ready [label="\ncallback return"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
*
|
||||
* The driver is not thread safe for performance reasons, if you need to access
|
||||
* the SPI bus from multiple threads then use the @p spiAcquireBus() and
|
||||
* @p spiReleaseBus() APIs in order to gain exclusive access.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 UART UART Driver
|
||||
* @brief Generic UART Driver.
|
||||
* @details This driver abstracts a generic UART (Universal Asynchronous
|
||||
* Receiver Transmitter) peripheral, the API is designed to be:
|
||||
* - Unbuffered and copy-less, transfers are always directly performed
|
||||
* from/to the application-level buffers without extra copy
|
||||
* operations.
|
||||
* - Asynchronous, the API is always non blocking.
|
||||
* - Callbacks capable, operations completion and other events are
|
||||
* notified using callbacks.
|
||||
* .
|
||||
* Special hardware features like deep hardware buffers, DMA transfers
|
||||
* are hidden to the user but fully supportable by the low level
|
||||
* implementations.<br>
|
||||
* This driver model is best used where communication events are
|
||||
* meant to drive an higher level state machine, as example:
|
||||
* - RS485 drivers.
|
||||
* - Multipoint network drivers.
|
||||
* - Serial protocol decoders.
|
||||
* .
|
||||
* If your application requires a synchronous buffered driver then
|
||||
* the @ref SERIAL should be used instead.
|
||||
* @pre In order to use the UART driver the @p HAL_USE_UART option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section uart_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
uninit [label="UART_UNINIT", style="bold"];
|
||||
stop [label="UART_STOP\nLow Power"];
|
||||
ready [label="UART_READY\nClock Enabled"];
|
||||
|
||||
uninit -> stop [label="\nuartInit()"];
|
||||
stop -> ready [label="\nuartStart()"];
|
||||
ready -> ready [label="\nuartStart()"];
|
||||
ready -> stop [label="\nuartStop()"];
|
||||
stop -> stop [label="\nuartStop()"];
|
||||
}
|
||||
* @enddot
|
||||
*
|
||||
* @subsection uart_1_1 Transmitter sub State Machine
|
||||
* The follow diagram describes the transmitter state machine, this diagram
|
||||
* is valid while the driver is in the @p UART_READY state. This state
|
||||
* machine is automatically reset to the @p TX_IDLE state each time the
|
||||
* driver enters the @p UART_READY state.
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
tx_idle [label="TX_IDLE", style="bold"];
|
||||
tx_active [label="TX_ACTIVE"];
|
||||
tx_complete [label="TX_COMPLETE"];
|
||||
tx_fatal [label="Fatal Error", style="bold"];
|
||||
|
||||
tx_idle -> tx_active [label="\nuartStartSend()"];
|
||||
tx_idle -> tx_idle [label="\nuartStopSend()\n>uc_txend2<"];
|
||||
tx_active -> tx_complete [label="\nbuffer transmitted\n>uc_txend1<"];
|
||||
tx_active -> tx_idle [label="\nuartStopSend()"];
|
||||
tx_active -> tx_fatal [label="\nuartStartSend()"];
|
||||
tx_complete -> tx_active [label="\nuartStartSendI()\nthen\ncallback return"];
|
||||
tx_complete -> tx_idle [label="\ncallback return"];
|
||||
}
|
||||
* @enddot
|
||||
*
|
||||
* @subsection uart_1_2 Receiver sub State Machine
|
||||
* The follow diagram describes the receiver state machine, this diagram
|
||||
* is valid while the driver is in the @p UART_READY state. This state
|
||||
* machine is automatically reset to the @p RX_IDLE state each time the
|
||||
* driver enters the @p UART_READY state.
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true", width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
rx_idle [label="RX_IDLE", style="bold"];
|
||||
rx_active [label="RX_ACTIVE"];
|
||||
rx_complete [label="RX_COMPLETE"];
|
||||
rx_fatal [label="Fatal Error", style="bold"];
|
||||
|
||||
rx_idle -> rx_idle [label="\nuartStopReceive()\n>uc_rxchar<\n>uc_rxerr<"];
|
||||
rx_idle -> rx_active [label="\nuartStartReceive()"];
|
||||
|
||||
rx_active -> rx_complete [label="\nbuffer filled\n>uc_rxend<"];
|
||||
rx_active -> rx_idle [label="\nuartStopReceive()"];
|
||||
rx_active -> rx_active [label="\nreceive error\n>uc_rxerr<"];
|
||||
rx_active -> rx_fatal [label="\nuartStartReceive()"];
|
||||
rx_complete -> rx_active [label="\nuartStartReceiveI()\nthen\ncallback return"];
|
||||
rx_complete -> rx_idle [label="\ncallback return"];
|
||||
}
|
||||
* @enddot
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012,2013 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 USB USB Driver
|
||||
* @brief Generic USB Driver.
|
||||
* @details This module implements a generic USB (Universal Serial Bus) driver
|
||||
* supporting device-mode operations.
|
||||
* @pre In order to use the USB driver the @p HAL_USE_USB option
|
||||
* must be enabled in @p halconf.h.
|
||||
*
|
||||
* @section usb_1 Driver State Machine
|
||||
* The driver implements a state machine internally, not all the driver
|
||||
* functionalities can be used in any moment, any transition not explicitly
|
||||
* shown in the following diagram has to be considered an error and shall
|
||||
* be captured by an assertion (if enabled).
|
||||
* @if LATEX_PDF
|
||||
* @dot
|
||||
digraph example {
|
||||
size="5, 7";
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="USB_STOP\nLow Power"];
|
||||
uninit [label="USB_UNINIT", style="bold"];
|
||||
ready [label="USB_READY\nClock Enabled"];
|
||||
selected [label="\nUSB_SELECTED\naddress\nassigned"];
|
||||
active [label="\nUSB_ACTIVE\nconfiguration\nselected"];
|
||||
|
||||
uninit -> stop [label=" usbInit()", constraint=false];
|
||||
stop -> stop [label="\nusbStop()"];
|
||||
stop -> ready [label="\nusbStart()"];
|
||||
ready -> stop [label="\nusbStop()"];
|
||||
ready -> ready [label="\n\nusbStart()"];
|
||||
ready -> ready [label="\nSUSPEND/WAKEUP\n>event_cb<"];
|
||||
ready -> selected [label="\nSET_ADDRESS\n>event_cb<"];
|
||||
selected -> stop [label="\nusbStop()"];
|
||||
selected -> ready [label="\nUSB RESET\n>event_cb<"];
|
||||
selected -> selected [label="\nSUSPEND/WAKEUP\n>event_cb<\n\nValid EP0 Message\n>requests_hook_cb<\n\nGET DESCRIPTOR\n>get_descriptor_cb<"];
|
||||
selected -> active [label="\nSET_CONF(n)\n>event_cb<"];
|
||||
active -> stop [label="\nusbStop()"];
|
||||
active -> selected [label="\nSET_CONF(0)\n>event_cb<"];
|
||||
active -> active [label="\nSUSPEND/WAKEUP\n>event_cb<\n\nValid EP0 Message\n>requests_hook_cb<\n\nGET DESCRIPTOR\n>get_descriptor_cb<\n\nEndpoints Activity\n >in_cb< or >out_cb<"];
|
||||
active -> ready [label="\nUSB RESET\n>event_cb<"];
|
||||
}
|
||||
* @enddot
|
||||
* @else
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
stop [label="USB_STOP\nLow Power"];
|
||||
uninit [label="USB_UNINIT", style="bold"];
|
||||
ready [label="USB_READY\nClock Enabled"];
|
||||
selected [label="\nUSB_SELECTED\naddress\nassigned"];
|
||||
active [label="\nUSB_ACTIVE\nconfiguration\nselected"];
|
||||
|
||||
uninit -> stop [label=" usbInit()", constraint=false];
|
||||
stop -> stop [label="\nusbStop()"];
|
||||
stop -> ready [label="\nusbStart()"];
|
||||
ready -> stop [label="\nusbStop()"];
|
||||
ready -> ready [label="\n\nusbStart()"];
|
||||
ready -> ready [label="\nSUSPEND/WAKEUP\n>event_cb<"];
|
||||
ready -> selected [label="\nSET_ADDRESS\n>event_cb<"];
|
||||
selected -> stop [label="\nusbStop()"];
|
||||
selected -> ready [label="\nUSB RESET\n>event_cb<"];
|
||||
selected -> selected [label="\nSUSPEND/WAKEUP\n>event_cb<\n\nValid EP0 Message\n>requests_hook_cb<\n\nGET DESCRIPTOR\n>get_descriptor_cb<"];
|
||||
selected -> active [label="\nSET_CONF(n)\n>event_cb<"];
|
||||
active -> stop [label="\nusbStop()"];
|
||||
active -> selected [label="\nSET_CONF(0)\n>event_cb<"];
|
||||
active -> active [label="\nSUSPEND/WAKEUP\n>event_cb<\n\nValid EP0 Message\n>requests_hook_cb<\n\nGET DESCRIPTOR\n>get_descriptor_cb<\n\nEndpoints Activity\n >in_cb< or >out_cb<"];
|
||||
active -> ready [label="\nUSB RESET\n>event_cb<"];
|
||||
}
|
||||
* @enddot
|
||||
* @endif
|
||||
*
|
||||
* @section usb_2 USB Operations
|
||||
* The USB driver is quite complex and USB is complex in itself, it is
|
||||
* recommended to study the USB specification before trying to use the
|
||||
* driver.
|
||||
*
|
||||
* @subsection usb_2_1 USB Implementation
|
||||
* The USB driver abstracts the inner details of the underlying USB hardware.
|
||||
* The driver works asynchronously and communicates with the application
|
||||
* using callbacks. The application is responsible of the descriptors and
|
||||
* strings required by the USB device class to be implemented and of the
|
||||
* handling of the specific messages sent over the endpoint zero. Standard
|
||||
* messages are handled internally to the driver. The application can use
|
||||
* hooks in order to handle custom messages or override the handling of the
|
||||
* default handling of standard messages.
|
||||
*
|
||||
* @subsection usb_2_2 USB Endpoints
|
||||
* USB endpoints are the objects that the application uses to exchange
|
||||
* data with the host. There are two kind of endpoints:
|
||||
* - <b>IN</b> endpoints are used by the application to transmit data to
|
||||
* the host.<br>
|
||||
* - <b>OUT</b> endpoints are used by the application to receive data from
|
||||
* the host.
|
||||
* .
|
||||
* The driver invokes a callback after finishing an IN or OUT transaction.
|
||||
* States diagram for OUT endpoints in transaction mode:
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
disabled [label="EP_DISABLED\nDisabled", style="bold"];
|
||||
receiving [label="EP_BUSY\nReceiving"];
|
||||
idle [label="EP_IDLE\nReady"];
|
||||
|
||||
disabled -> idle [label="\nusbInitEndpointI()"];
|
||||
idle -> receiving [label="\nusbPrepareReceive()\nusbStartReceiveI()"];
|
||||
receiving -> receiving [label="\nmore packets"];
|
||||
receiving -> idle [label="\nreception end\n>out_cb<"];
|
||||
receiving -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
idle -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
}
|
||||
* @enddot
|
||||
* <br><br>
|
||||
* States diagram for IN endpoints in transaction mode:
|
||||
* @dot
|
||||
digraph example {
|
||||
rankdir="LR";
|
||||
node [shape=circle, fontname=Helvetica, fontsize=8, fixedsize="true",
|
||||
width="0.9", height="0.9"];
|
||||
edge [fontname=Helvetica, fontsize=8];
|
||||
|
||||
disabled [label="EP_DISABLED\nDisabled", style="bold"];
|
||||
transmitting [label="EP_BUSY\nTransmitting"];
|
||||
idle [label="EP_IDLE\nReady"];
|
||||
|
||||
disabled -> idle [label="\usbInitEndpointI()"];
|
||||
idle -> transmitting [label="\nusbPrepareTransmit()\nusbStartTransmitI()"];
|
||||
transmitting -> transmitting [label="\nmore packets"];
|
||||
transmitting -> idle [label="\ntransmission end\n>in_cb<"];
|
||||
transmitting -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
idle -> disabled [label="\nUSB RESET\nusbDisableEndpointsI()"];
|
||||
}
|
||||
* @enddot
|
||||
* <br><br>
|
||||
*
|
||||
* @subsection usb_2_4 USB Callbacks
|
||||
* The USB driver uses callbacks in order to interact with the application.
|
||||
* There are several kinds of callbacks to be handled:
|
||||
* - Driver events callback. As example errors, suspend event, reset event
|
||||
* etc.
|
||||
* - Messages Hook callback. This hook allows the application to implement
|
||||
* handling of custom messages or to override the default handling of
|
||||
* standard messages on endpoint zero.
|
||||
* - Descriptor Requested callback. When the driver endpoint zero handler
|
||||
* receives a GET DESCRIPTOR message and needs to send a descriptor to
|
||||
* the host it queries the application using this callback.
|
||||
* - Start of Frame callback. This callback is invoked each time a SOF
|
||||
* packet is received.
|
||||
* - Endpoint callbacks. Each endpoint informs the application about I/O
|
||||
* conditions using those callbacks.
|
||||
* .
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
Loading…
Reference in New Issue